test_class.declarator: workerRecoveryManager
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private WorkerRecoveryManager workerRecoveryManager;
test_class.type: WorkerRecoveryManager
test_class.var_name: workerRecoveryManager
test_class.declarator: workerNodeService
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private WorkerNodeService workerNodeService;
test_class.type: WorkerNodeService
test_class.var_name: workerNodeService
test_class.declarator: retryTemplate
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private RetryTemplate retryTemplate;
test_class.type: RetryTemplate
test_class.var_name: retryTemplate
test_class.declarator: workerRecoveryListeners
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private List<WorkerRecoveryListener> workerRecoveryListeners;
test_class.type: List<WorkerRecoveryListener>
test_class.var_name: workerRecoveryListeners
test_class.declarator: synchronizationManager
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private SynchronizationManager synchronizationManager;
test_class.type: SynchronizationManager
test_class.var_name: synchronizationManager
test_class.file: worker/worker-manager/score-worker-manager-impl/src/test/java/io/cloudslang/worker/management/services/WorkerRecoveryManagerImplTest.java
test_class.identifier: WorkerRecoveryManagerImplTest
test_case.body: @Test
      public void testDoRecovery() throws Exception {
          Assert.assertEquals(2,workerRecoveryListeners.size());
  
          workerRecoveryManager.doRecovery();
  
          verify(workerRecoveryListeners.get(0),times(1)).doRecovery();
          verify(workerRecoveryListeners.get(1),times(1)).doRecovery();
      }
test_case.class_method_signature: WorkerRecoveryManagerImplTest.testDoRecovery()
test_case.full_signature: @Test public void testDoRecovery()
test_case.identifier: testDoRecovery
test_case.invocations: assertEquals size doRecovery doRecovery verify get times doRecovery verify get times
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testDoRecovery()
focal_class.declarator: logger = Logger.getLogger(WorkerRecoveryManagerImpl.class)
focal_class.modifier: protected static final
focal_class.original_string: protected static final Logger logger = Logger.getLogger(WorkerRecoveryManagerImpl.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: EXIT_STATUS = 75
focal_class.modifier: private static final
focal_class.original_string: private static final int EXIT_STATUS = 75;
focal_class.type: int
focal_class.var_name: EXIT_STATUS
focal_class.declarator: listeners
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private List<WorkerRecoveryListener> listeners;
focal_class.type: List<WorkerRecoveryListener>
focal_class.var_name: listeners
focal_class.declarator: workerNodeService
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private WorkerNodeService workerNodeService;
focal_class.type: WorkerNodeService
focal_class.var_name: workerNodeService
focal_class.declarator: retryTemplate
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private RetryTemplate retryTemplate;
focal_class.type: RetryTemplate
focal_class.var_name: retryTemplate
focal_class.declarator: syncManager
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private SynchronizationManager syncManager;
focal_class.type: SynchronizationManager
focal_class.var_name: syncManager
focal_class.declarator: workerVersionService
focal_class.modifier: @Autowired
     	protected
focal_class.original_string: @Autowired
     	protected WorkerVersionService workerVersionService;
focal_class.type: WorkerVersionService
focal_class.var_name: workerVersionService
focal_class.declarator: inRecovery
focal_class.modifier: private volatile
focal_class.original_string: private volatile boolean inRecovery;
focal_class.type: boolean
focal_class.var_name: inRecovery
focal_class.declarator: wrv
focal_class.modifier: private volatile
focal_class.original_string: private volatile String wrv;
focal_class.type: String
focal_class.var_name: wrv
focal_class.file: worker/worker-manager/score-worker-manager-impl/src/main/java/io/cloudslang/worker/management/services/WorkerRecoveryManagerImpl.java
focal_class.identifier: WorkerRecoveryManagerImpl
focal_class.interfaces: implements WorkerRecoveryManager
focal_class.class_method_signature: WorkerRecoveryManagerImpl.doRecovery()
focal_class.full_signature: public void doRecovery()
focal_class.identifier: doRecovery
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void doRecovery()
focal_class.class_method_signature: WorkerRecoveryManagerImpl.isInRecovery()
focal_class.full_signature: public boolean isInRecovery()
focal_class.identifier: isInRecovery
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isInRecovery()
focal_class.class_method_signature: WorkerRecoveryManagerImpl.getWRV()
focal_class.full_signature: public String getWRV()
focal_class.identifier: getWRV
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getWRV()
focal_class.class_method_signature: WorkerRecoveryManagerImpl.setWRV(String newWrv)
focal_class.full_signature: public void setWRV(String newWrv)
focal_class.identifier: setWRV
focal_class.modifiers: public
focal_class.parameters: (String newWrv)
focal_class.return: void
focal_class.signature: void setWRV(String newWrv)
focal_method.body: public void doRecovery(){
          try {
              boolean toRestart = Boolean.getBoolean("cloudslang.worker.restart.on.recovery");
              //If we are configured to restart on recovery - do shutdown
              if(toRestart){
                  logger.warn("Worker is configured to restart on recovery and since internal recovery is needed the process is exiting...");
                  System.exit(EXIT_STATUS);
              }
  
              synchronized (this){
                  //If already in recovery - then return and do nothing
                  if(inRecovery){
                      return;
                  }
                  inRecovery = true;
  
              }
              syncManager.startRecovery();
  
              logger.warn("Worker internal recovery started");
  
              for (WorkerRecoveryListener listener : listeners){
                  try {
                      listener.doRecovery();
                  } catch (Exception ex) {
                      logger.error("Failed on worker internal recovery", ex);
                  }
              }
              if (logger.isDebugEnabled()) logger.debug("Listeners recovery is done");
  
              retryTemplate.retry(RetryTemplate.INFINITELY, 30*1000L, new RetryTemplate.RetryCallback() {
                  @Override
                  public void tryOnce() {
  					if(logger.isDebugEnabled()) logger.debug("sending worker UP");
                      String newWrv = workerNodeService.up(System.getProperty("worker.uuid"), workerVersionService.getWorkerVersion(), workerVersionService.getWorkerVersionId());
                      setWRV(newWrv);
                      if(logger.isDebugEnabled()) logger.debug("the worker is UP");
                  }
              });
              inRecovery = false;
              logger.warn("Worker recovery is done");
          } finally {
              syncManager.finishRecovery();
  		}
  	}
focal_method.class_method_signature: WorkerRecoveryManagerImpl.doRecovery()
focal_method.full_signature: public void doRecovery()
focal_method.identifier: doRecovery
focal_method.invocations: getBoolean warn exit startRecovery warn doRecovery error isDebugEnabled debug retry isDebugEnabled debug up getProperty getWorkerVersion getWorkerVersionId setWRV isDebugEnabled debug warn finishRecovery
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void doRecovery()