Skip to content

Commit

Permalink
Merge pull request #30 from gneokleo/master
Browse files Browse the repository at this point in the history
Don't close all the sessions in server sockets
  • Loading branch information
gneokleo committed Apr 13, 2016
2 parents bd8d4da + 6dbda26 commit 2b18ba5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,21 @@ public void publishEvent(ChatAlyticsEvent event) {
}

/**
* Tries to close the session
* Closes a session
*
* @param session
* The session to close
* @param reason
* Reason for closing
* The reason for closing
*/
@OnClose
public void close(CloseReason reason) {
LOG.info("Closing {} sessions", sessions.size());
for (Session session : sessions) {
try {
session.close();
} catch (IOException e) {
LOG.warn("Couldn't close {}", session.getId());
}
public void close(Session session, CloseReason reason) {
LOG.info("Closing session {}. Reason {}", session.getId(), reason);
try {
session.close();
sessions.remove(session);
} catch (IOException e) {
LOG.warn("Couldn't close {}", session.getId());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,22 @@ public void onOpen(Session session) {
}
}

/**
* Closes a session
*
* @param session
* The session to close
* @param reason
* The reason for closing
*/
@OnClose
public void close(CloseReason reason) {
LOG.info("Closing {} sessions", sessions.size());
for (Session session : sessions) {
try {
session.close();
} catch (IOException e) {
LOG.warn("Couldn't close {}", session.getId());
}
public void close(Session session, CloseReason reason) {
LOG.info("Closing session {}. Reason {}", session.getId(), reason);
try {
session.close();
sessions.remove(session);
} catch (IOException e) {
LOG.warn("Couldn't close {}", session.getId());
}
}

Expand Down

0 comments on commit 2b18ba5

Please sign in to comment.