protected synchronized void beforeSpaceModeChange(SpaceMode newMode){
  if (_logger.isLoggable(Level.FINER))   _logger.finer("Invoking beforeSpaceModeChange event, new mode " + newMode);
  Queue<ISpaceModeListener> remoteListeners=new LinkedList<ISpaceModeListener>();
  for (Iterator<ISpaceModeListener> iter=_primarySpaceModeListeners.iterator(); iter.hasNext(); ) {
    ISpaceModeListener listener=iter.next();
    try {
      SpaceInitializationIndicator.setInitializer();
      if (LRMIUtilities.isRemoteProxy(listener)) {
        if (_logger.isLoggable(Level.FINEST))         _logger.finest("located remote listener for beforeSpaceModeChange, adding to asynchronous dispatch queue [" + listener.toString() + "]");
        remoteListeners.add(listener);
        continue;
      }
      listener.beforeSpaceModeChange(newMode);
    }
 catch (    DirectPersistencyRecoveryException dpe) {
      if (_logger.isLoggable(Level.SEVERE)) {
        _logger.log(Level.SEVERE,dpe.getMessage());
      }
      throw dpe;
    }
catch (    Exception rex) {
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"Failed to invoke method ISpaceModeListener.beforeSpaceModeChange(...) implemented by listener [" + listener + "]. Action Taken: Unregistered listener",rex);
      }
      _primarySpaceModeListeners.removeListener(listener);
    }
 finally {
      SpaceInitializationIndicator.unsetInitializer();
    }
  }
  if (remoteListeners.size() > 0)   dispatchBeforeEventToRemoteListeners(remoteListeners,newMode);
  if (_logger.isLoggable(Level.FINEST))   _logger.finest("completed invoking synchronous beforeSpaceModeChange event with mode " + newMode);
}

protected synchronized void beforeSpaceModeChange ( SpaceMode newMode ) { if ( _logger . isLoggable ( Level . FINER ) ) _logger . finer ( "Invoking beforeSpaceModeChange event, new mode " + newMode ) ; Queue < ISpaceModeListener > remoteListeners = new LinkedList < ISpaceModeListener > ( ) ; for ( Iterator < ISpaceModeListener > iter = _primarySpaceModeListeners . iterator ( ) ; iter . hasNext ( ) ; ) { ISpaceModeListener listener = iter . next ( ) ; try { SpaceInitializationIndicator . setInitializer ( ) ; if ( LRMIUtilities . isRemoteProxy ( listener ) ) { if ( _logger . isLoggable ( Level . FINEST ) ) _logger . finest ( "located remote listener for beforeSpaceModeChange, adding to asynchronous dispatch queue [" + listener . toString ( ) + "]" ) ; remoteListeners . add ( listener ) ; continue ; } listener . beforeSpaceModeChange ( newMode ) ; } catch ( DirectPersistencyRecoveryException dpe ) { if ( _logger . isLoggable ( Level . SEVERE ) ) { _logger . log ( Level . SEVERE , dpe . getMessage ( ) ) ; } throw dpe ; } catch ( Exception rex ) { if ( _logger . isLoggable ( Level . FINE ) ) { _logger . log ( Level . FINE , "Failed to invoke method ISpaceModeListener.beforeSpaceModeChange(...) implemented by listener [" + listener + "]. Action Taken: Unregistered listener" , rex ) ; } _primarySpaceModeListeners . removeListener ( listener ) ; } finally { SpaceInitializationIndicator . unsetInitializer ( ) ; } } if ( remoteListeners . size ( ) > 0 ) dispatchBeforeEventToRemoteListeners ( remoteListeners , newMode ) ; if ( _logger . isLoggable ( Level . FINEST ) ) _logger . finest ( "completed invoking synchronous beforeSpaceModeChange event with mode " + newMode ) ; }
notify the listeners about the event
