예제 #1
0
 /**
  * Notifies all close listeners that the connection has been closed. Used by subclasses to
  * properly finish closing the connection.
  */
 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
 public Object registerCloseListener(ConnectionCloseListener listener, Object handbackMessage) {
   Object status = null;
   if (isClosed()) {
     listener.onConnectionClose(handbackMessage);
   } else {
     status = listeners.put(listener, handbackMessage);
   }
   return status;
 }