question: private boolean recoverFailedInstance ( String instanceId , InstanceState state ) { try { if ( state . getState ( ) == InstanceState . STATE_RUNNING ) { state . updateDetectedDown ( ) ; state . clearRecoveryAttempts ( ) ; } state . setState ( InstanceState . STATE_PROCESSING_DOWN ) ; state . setRecoveringInstanceId ( this . instanceId ) ; state . updateRecoveringTimestamp ( ) ; state . startRecovery ( ) ; updateInstanceState ( instanceId , state ) ; } catch ( ResourceException e ) { if ( e . getCode ( ) != ResourceException . CONFLICT ) { logger . warn ( "Failed to update instance state" , e ) ; } return false ; } ClusterEvent recoveryEvent = new ClusterEvent ( ClusterEventType . RECOVERY_INITIATED , instanceId ) ; boolean success = sendEventToListeners ( recoveryEvent ) ; if ( success ) { logger . info ( "Instance {} recovered successfully" , instanceId ) ; try { InstanceState newState = getInstanceState ( instanceId ) ; newState . setState ( InstanceState . STATE_DOWN ) ; newState . finishRecovery ( ) ; updateInstanceState ( instanceId , newState ) ; } catch ( ResourceException e ) { if ( e . getCode ( ) != ResourceException . CONFLICT ) { logger . warn ( "Failed to update instance state" , e ) ; } return false ; } } else { logger . warn ( "Instance {} was not successfully recovered" , instanceId ) ; return false ; } return true ; }
target:  Recovers a failed instance by looping through all listeners and calling their instanceFailed method.