Skip to content

Commit

Permalink
Log session id on shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
slominskir committed Feb 14, 2024
1 parent ecb631e commit 0e85fcb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/org/jlab/epics2web/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public static Future<?> writeFromBlockingQueue(Session session) {
return writerExecutor.submit(new Runnable() {
@Override
public void run() {
final String id = session.getId() + " / " + session.getUserProperties().get("ip");
final ArrayBlockingQueue<String> writequeue = (ArrayBlockingQueue<String>) session.getUserProperties().get("writequeue");
try {
while (true) {
Expand All @@ -72,7 +73,7 @@ public void run() {
try {
session.getBasicRemote().sendText(msg);
} catch (IllegalStateException | IOException e) { // If session closes between time session.isOpen() and sentText(msg) then you'll get this exception. Not an issue.
LOGGER.log(Level.FINEST, "Unable to send message: ", e);
LOGGER.log(Level.FINEST, "Unable to send message to " + id, e);

if (!session.isOpen()) {
LOGGER.log(Level.FINEST, "Session closed after write exception; shutting down write thread");
Expand All @@ -81,12 +82,12 @@ public void run() {
}
}
} else {
LOGGER.log(Level.FINEST, "Session closed; shutting down write thread");
LOGGER.log(Level.FINEST, "Session {0} closed; shutting down write thread", id);
break;
}
}
} catch (InterruptedException e) {
LOGGER.log(Level.FINEST, "Shutting down writer thread as requested", e);
LOGGER.log(Level.FINEST, "Shutting down {0} writer thread as requested by InterruptException", id);
}
}
});
Expand Down

0 comments on commit 0e85fcb

Please sign in to comment.