@ PUT public Response renewLease ( @ HeaderParam ( PeerEurekaNode . HEADER_REPLICATION ) String isReplication , @ QueryParam ( "overriddenstatus" ) String overriddenStatus , @ QueryParam ( "status" ) String status , @ QueryParam ( "lastDirtyTimestamp" ) String lastDirtyTimestamp ) { boolean isFromReplicaNode = "true" . equals ( isReplication ) ; boolean isSuccess = registry . renew ( app . getName ( ) , id , isFromReplicaNode ) ; // Not found in the registry, immediately ask for a register if ( ! isSuccess ) { logger . warn ( "Not Found (Renew): {} - {}" , app . getName ( ) , id ) ; return Response . status ( Status . NOT_FOUND ) . build ( ) ; } // Check if we need to sync based on dirty time stamp, the client // instance might have changed some value Response response ; if ( lastDirtyTimestamp != null && serverConfig . shouldSyncWhenTimestampDiffers ( ) ) { response = this . validateDirtyTimestamp ( Long . valueOf ( lastDirtyTimestamp ) , isFromReplicaNode ) ; // Store the overridden status since the validation found out the node that replicates wins if ( response . getStatus ( ) == Response . Status . NOT_FOUND . getStatusCode ( ) && ( overriddenStatus != null ) && ! ( InstanceStatus . UNKNOWN . name ( ) . equals ( overriddenStatus ) ) && isFromReplicaNode ) { registry . storeOverriddenStatusIfRequired ( app . getAppName ( ) , id , InstanceStatus . valueOf ( overriddenStatus ) ) ; } } else { response = Response . ok ( ) . build ( ) ; } logger . debug ( "Found (Renew): {} - {}; reply status={}" , app . getName ( ) , id , response . getStatus ( ) ) ; return response ; }
A put request for renewing lease from a client instance .