private HashSet doDisconnects(boolean doReconnect,String reason){
  HashSet shutdownListeners=new HashSet();
  for (; ; ) {
    DisconnectListener listener=null;
synchronized (this.listeners) {
      Iterator itr=listeners.iterator();
      if (!itr.hasNext()) {
        break;
      }
      listener=(DisconnectListener)itr.next();
      if (listener instanceof ShutdownListener) {
        shutdownListeners.add(listener);
      }
      itr.remove();
    }
    if (doReconnect) {
      runDisconnectForReconnect(listener,disconnectListenerThreadGroup);
    }
 else {
      runDisconnect(listener,disconnectListenerThreadGroup);
    }
  }
  return shutdownListeners;
}

private HashSet doDisconnects ( boolean doReconnect , String reason ) { HashSet shutdownListeners = new HashSet ( ) ; for ( ; ; ) { DisconnectListener listener = null ; synchronized ( this . listeners ) { Iterator itr = listeners . iterator ( ) ; if ( ! itr . hasNext ( ) ) { break ; } listener = ( DisconnectListener ) itr . next ( ) ; if ( listener instanceof ShutdownListener ) { shutdownListeners . add ( listener ) ; } itr . remove ( ) ; } if ( doReconnect ) { runDisconnectForReconnect ( listener , disconnectListenerThreadGroup ) ; } else { runDisconnect ( listener , disconnectListenerThreadGroup ) ; } } return shutdownListeners ; }
disconnect cache , run disconnect listeners .
