@Override public void run(){
  TOP:   while (!shutDown) {
    SystemFailure.checkFailure();
    try {
      connected=false;
      initialized=false;
      if (!shutDown) {
        connectToDS();
        if (isListening()) {
          Assert.assertTrue(system != null);
        }
        return;
      }
    }
 catch (    IncompatibleSystemException ise) {
      logger.fatal(ise.getMessage(),ise);
      callAlertListener(new VersionMismatchAlert(RemoteGfManagerAgent.this,ise.getMessage()));
    }
catch (    Exception e) {
      for (Throwable cause=e; cause != null; cause=cause.getCause()) {
        if (cause instanceof InterruptedException) {
          if (shutDown) {
            break TOP;
          }
        }
        if (cause instanceof AuthenticationFailedException) {
          shutDown=true;
          securityLogWriter.warning(LocalizedStrings.RemoteGFManagerAgent_AN_AUTHENTICATIONFAILEDEXCEPTION_WAS_CAUGHT_WHILE_CONNECTING_TO_DS,e);
          break TOP;
        }
      }
      logger.debug("[RemoteGfManagerAgent] While connecting to DS",e);
    }
    try {
      sleep(1000);
    }
 catch (    InterruptedException ignore) {
    }
  }
  connected=false;
  initialized=false;
}

@ Override public void run ( ) { TOP : while ( ! shutDown ) { SystemFailure . checkFailure ( ) ; try { connected = false ; initialized = false ; if ( ! shutDown ) { connectToDS ( ) ; if ( isListening ( ) ) { Assert . assertTrue ( system != null ) ; } return ; } } catch ( IncompatibleSystemException ise ) { logger . fatal ( ise . getMessage ( ) , ise ) ; callAlertListener ( new VersionMismatchAlert ( RemoteGfManagerAgent . this , ise . getMessage ( ) ) ) ; } catch ( Exception e ) { for ( Throwable cause = e ; cause != null ; cause = cause . getCause ( ) ) { if ( cause instanceof InterruptedException ) { if ( shutDown ) { break TOP ; } } if ( cause instanceof AuthenticationFailedException ) { shutDown = true ; securityLogWriter . warning ( LocalizedStrings . RemoteGFManagerAgent_AN_AUTHENTICATIONFAILEDEXCEPTION_WAS_CAUGHT_WHILE_CONNECTING_TO_DS , e ) ; break TOP ; } } logger . debug ( "[RemoteGfManagerAgent] While connecting to DS" , e ) ; } try { sleep ( 1000 ) ; } catch ( InterruptedException ignore ) { } } connected = false ; initialized = false ; }
keep trying to connect to the distributed system . if we have problems connecting , the agent will not be marked as " connected " .
