From cb742474a1854ab9b32a547e6a37674aabfaa5a5 Mon Sep 17 00:00:00 2001 From: slominskir Date: Wed, 14 Feb 2024 15:40:14 -0500 Subject: [PATCH] Log session id on shutdown --- src/main/java/org/jlab/epics2web/Application.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jlab/epics2web/Application.java b/src/main/java/org/jlab/epics2web/Application.java index 59f7c29..4b16811 100644 --- a/src/main/java/org/jlab/epics2web/Application.java +++ b/src/main/java/org/jlab/epics2web/Application.java @@ -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 writequeue = (ArrayBlockingQueue) session.getUserProperties().get("writequeue"); try { while (true) { @@ -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"); @@ -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); } } });