예제 #1
0
 /** Notifies all close listeners that the connection has been closed. */
 private void notifyCloseListeners() {
   synchronized (listeners) {
     for (ConnectionCloseListener listener : listeners.keySet()) {
       try {
         listener.onConnectionClose(listeners.get(listener));
       } catch (Exception e) {
         Log.error("Error notifying listener: " + listener, e);
       }
     }
   }
 }
예제 #2
0
 @Override
 public void registerCloseListener(ConnectionCloseListener listener, Object handbackMessage) {
   if (isClosed()) {
     listener.onConnectionClose(handbackMessage);
   } else {
     listeners.put(listener, handbackMessage);
   }
 }
예제 #3
0
 /**
  * Notifies all close listeners that the connection has been closed. Used by subclasses to
  * properly finish closing the connection.
  */
 private void notifyCloseListeners() {
   if (closeListener != null) {
     try {
       closeListener.onConnectionClose(session);
     } catch (Exception e) {
       Log.error("Error notifying listener: " + closeListener, e);
     }
   }
 }
예제 #4
0
 public void registerCloseListener(ConnectionCloseListener listener, Object ignore) {
   if (closeListener != null) {
     throw new IllegalStateException("Close listener already configured");
   }
   if (isClosed()) {
     listener.onConnectionClose(session);
   } else {
     closeListener = listener;
   }
 }