Interface LeasePeriodPolicy

All Known Implementing Classes:
FixedLeasePeriodPolicy, SystemTimeFixedLeasePeriodPolicy

public interface LeasePeriodPolicy
Interface for objects that define what policy to use when calculating lease grants and renewals.
Since:
2.0
Author:
Sun Microsystems, Inc.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    Simple class that holds a pair of times, the new expiration and duration for a lease.
  • Method Summary

    Modifier and Type
    Method
    Description
    grant(LeasedResource resource, long requestedDuration)
    Calculate the initial expiration and duration for a new lease.
    renew(LeasedResource resource, long requestedDuration)
    Calculate the expiration and duration for an existing lease that is being renewed.
  • Method Details

    • grant

      LeasePeriodPolicy.Result grant(LeasedResource resource, long requestedDuration) throws LeaseDeniedException
      Calculate the initial expiration and duration for a new lease.
      Parameters:
      resource - the server side representation of the new lease that needs an initial expiration and duration
      requestedDuration - the initial duration the requester of the resources would like. May be Lease.ANY
      Returns:
      A Result that holds both the expiration and duration.
      Throws:
      LeaseDeniedException - if the grant request is denied.
      IllegalArgumentException - if the requested duration is not Lease.ANY and is negative.
    • renew

      LeasePeriodPolicy.Result renew(LeasedResource resource, long requestedDuration) throws LeaseDeniedException
      Calculate the expiration and duration for an existing lease that is being renewed.
      Parameters:
      resource - the server side representation of the lease that is being renewed
      requestedDuration - the duration the client is requesting. May be Lease.ANY.
      Returns:
      A Result that holds both the expiration and duration.
      Throws:
      LeaseDeniedException - if the renewal request is denied.
      IllegalArgumentException - if the requested duration is not Lease.ANY and is negative.