public boolean renew ( String appName , String id , boolean isReplication ) { RENEW . increment ( isReplication ) ; Map < String , Lease < InstanceInfo > > gMap = registry . get ( appName ) ; Lease < InstanceInfo > leaseToRenew = null ; if ( gMap != null ) { leaseToRenew = gMap . get ( id ) ; } if ( leaseToRenew == null ) { RENEW_NOT_FOUND . increment ( isReplication ) ; logger . warn ( "DS: Registry: lease doesn't exist, registering resource: {} - {}" , appName , id ) ; return false ; } else { InstanceInfo instanceInfo = leaseToRenew . getHolder ( ) ; if ( instanceInfo != null ) { // touchASGCache(instanceInfo.getASGName()); InstanceStatus overriddenInstanceStatus = this . getOverriddenInstanceStatus ( instanceInfo , leaseToRenew , isReplication ) ; if ( overriddenInstanceStatus == InstanceStatus . UNKNOWN ) { logger . info ( "Instance status UNKNOWN possibly due to deleted override for instance {}" + "; re-register required" , instanceInfo . getId ( ) ) ; RENEW_NOT_FOUND . increment ( isReplication ) ; return false ; } if ( ! instanceInfo . getStatus ( ) . equals ( overriddenInstanceStatus ) ) { logger . info ( "The instance status {} is different from overridden instance status {} for instance {}. " + "Hence setting the status to overridden status" , instanceInfo . getStatus ( ) . name ( ) , instanceInfo . getOverriddenStatus ( ) . name ( ) , instanceInfo . getId ( ) ) ; instanceInfo . setStatusWithoutDirty ( overriddenInstanceStatus ) ; } } renewsLastMin . increment ( ) ; leaseToRenew . renew ( ) ; return true ; } }
Marks the given instance of the given app name as renewed and also marks whether it originated from replication .