question: protected long calculateDuration ( LeasedResource resource , long requestedDuration ) { if ( requestedDuration == Lease . FOREVER ) requestedDuration = Long . MAX_VALUE ; else if ( requestedDuration == Lease . ANY ) requestedDuration = defaultLength ; else if ( requestedDuration < 0 ) throw new IllegalArgumentException ( "Negative lease duration " + "requested" ) ; return Math . min ( requestedDuration , maximum ) ; }
target:  Returns the duration this policy is willing to grant for the passed resource at this time. The duration actually granted will be shorter if the duration extends pass the end of the epoch.  Must return a positive number. <p> Note the duration returned by this method will be shorter than the final duration granted if the requested duration extends past the current expiration, and duration return by this method is before the current expiration.