| 
GigaSpaces XAP 9.1 API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.jini.landlord.FixedLeasePeriodPolicy
public class FixedLeasePeriodPolicy
Simple implementation of LeasePeriodPolicy that grants
 lease times based on a fixed default and maximum lease. Will grant
 renewals longer than the maximum if the current lease and the
 request are both longer than the maximum.
| Nested Class Summary | 
|---|
| Nested classes/interfaces inherited from interface com.sun.jini.landlord.LeasePeriodPolicy | 
|---|
LeasePeriodPolicy.Result | 
| Constructor Summary | |
|---|---|
FixedLeasePeriodPolicy(long maximum,
                       long defaultLength)
Create a new FixedLeasePeriodPolicy with 
 the specified values for the maxium and default lease
 lengths. | 
|
| Method Summary | |
|---|---|
protected  long | 
calculateDuration(LeasedResource resource,
                  long requestedDuration)
Returns the duration this policy is willing to grant for the passed resource at this time.  | 
protected  long | 
currentTime()
Method that provides some notion of the current time in milliseconds since the beginning of the epoch.  | 
 LeasePeriodPolicy.Result | 
grant(LeasedResource resource,
      long requestedDuration)
Calculate the initial expiration and duration for a new lease.  | 
 LeasePeriodPolicy.Result | 
renew(LeasedResource resource,
      long requestedDuration)
Calculate the expiration and duration for an existing lease that is being renewed.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public FixedLeasePeriodPolicy(long maximum,
                              long defaultLength)
FixedLeasePeriodPolicy with 
 the specified values for the maxium and default lease
 lengths.
maximum - the length in milliseconds of the longest lease
                this object should normally grantdefaultLength - the length in milliseconds of the
                default lease grants
IllegalArgumentException - if either argument
         is not positive.| Method Detail | 
|---|
protected long calculateDuration(LeasedResource resource,
                                 long requestedDuration)
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.
resource - the resource having a lease granted
                          or renewedrequestedDuration - the duration the client wants
IllegalArgumentException - thrown if requestedDuration
            is less than 0 and not equal to
            Lease.ANYLENGTH or
            Lease.FOREVER.protected long currentTime()
public LeasePeriodPolicy.Result grant(LeasedResource resource,
                                      long requestedDuration)
                               throws LeaseDeniedException
LeasePeriodPolicy
grant in interface LeasePeriodPolicyresource - the server side representation of the new lease that
        needs an initial expiration and durationrequestedDuration - the initial duration the 
        requester of the resources would like. May be
        Lease.ANY
Result that holds
         both the expiration and duration.
LeaseDeniedException - if the grant request 
         is denied.
public LeasePeriodPolicy.Result renew(LeasedResource resource,
                                      long requestedDuration)
                               throws LeaseDeniedException
LeasePeriodPolicy
renew in interface LeasePeriodPolicyresource - the server side representation of the lease that is
                 being renewedrequestedDuration - the duration the client is requesting. May be
        Lease.ANY.
Result that holds
         both the expiration and duration.
LeaseDeniedException - if the renewal request 
         is denied.
  | 
GigaSpaces XAP 9.1 API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||