Rio Project 4.2 API Documentation



org.rioproject.resources.servicecore
Class LandlordLessor

java.lang.Object
  extended by org.rioproject.resources.servicecore.ResourceLessor
      extended by org.rioproject.resources.servicecore.LandlordLessor
All Implemented Interfaces:
Landlord, Remote, ReferentUuid, ServerProxyTrust

public class LandlordLessor
extends ResourceLessor
implements Landlord, ReferentUuid, ServerProxyTrust

The LandlordLessor manages leased resources using the Landlord protocol.

The LandlordLessor supports the following configuration entries; where each configuration entry name is associated with the component name org.rioproject.resources.servicecore

Author:
Dennis Reedy

Nested Class Summary
 
Nested classes/interfaces inherited from class org.rioproject.resources.servicecore.ResourceLessor
ResourceLessor.LeaseReaper
 
Nested classes/interfaces inherited from interface com.sun.jini.landlord.Landlord
Landlord.RenewResults
 
Field Summary
static long DEFAULT_LEASE_TIME
          The default time for a Lease: 1 hour
static long DEFAULT_MAX_LEASE_TIME
          The maximum time for a Lease: 1 day
 
Constructor Summary
LandlordLessor(Configuration config)
          Create a LandlordLessor
LandlordLessor(Configuration config, LeasePeriodPolicy leasePolicy)
          Create a LandlordLessor
 
Method Summary
 void cancel(Uuid cookie)
          Called by the lease when its cancel method is called.
 Map cancelAll(Uuid[] cookies)
          Called by the lease map when its cancelAll method is called.
 TrustVerifier getProxyVerifier()
           
 Uuid getReferentUuid()
          Return the Uuid that has been assigned to the resource this proxy represents.
 Lease newLease(LeasedResource resource, long duration)
          Concrete implementation of parent class
 long renew(Uuid cookie, long extension)
          Called by the lease when its renew method is called.
 Landlord.RenewResults renewAll(Uuid[] cookie, long[] extension)
          Called by the lease map when its renewAll method is called.
 boolean stop(boolean force)
          Stop the LandlordLessor
 
Methods inherited from class org.rioproject.resources.servicecore.ResourceLessor
addLeasedResource, addLeaseListener, currentTime, ensure, getLeasedResource, getLeasedResources, notifyLeaseExpiration, notifyLeaseRegistration, notifyLeaseRemoval, notifyLeaseRenewal, remove, removeAll, removeLeaseListener, stop, total
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LEASE_TIME

public static final long DEFAULT_LEASE_TIME
The default time for a Lease: 1 hour

See Also:
Constant Field Values

DEFAULT_MAX_LEASE_TIME

public static final long DEFAULT_MAX_LEASE_TIME
The maximum time for a Lease: 1 day

See Also:
Constant Field Values
Constructor Detail

LandlordLessor

public LandlordLessor(Configuration config)
               throws RemoteException
Create a LandlordLessor

Parameters:
config - The Configuration object used to initialize operational values.
Throws:
RemoteException - if errors occur setting up infrastructure

LandlordLessor

public LandlordLessor(Configuration config,
                      LeasePeriodPolicy leasePolicy)
               throws RemoteException
Create a LandlordLessor

Parameters:
config - The Configuration object used to initialize operational values.
leasePolicy - A LeasePeriodPolicy object to be used for the LandlordLessor.
Throws:
RemoteException - if errors occur setting up infrastructure
Method Detail

stop

public boolean stop(boolean force)
Stop the LandlordLessor

Parameters:
force - if true, unexports the LandlordLessor even if there are pending or in-progress calls; if false, only unexports the LandlordLessor if there are no pending or in-progress calls
Returns:
True or false if the unexport was succesful

newLease

public Lease newLease(LeasedResource resource,
                      long duration)
               throws LeaseDeniedException
Concrete implementation of parent class

Specified by:
newLease in class ResourceLessor
Parameters:
resource - to be leased
duration - Time requested for Lease
Returns:
A new Lease
Throws:
LeaseDeniedException - If the lease has been denied
See Also:
ResourceLessor.newLease(com.sun.jini.landlord.LeasedResource, long)

renew

public long renew(Uuid cookie,
                  long extension)
           throws LeaseDeniedException,
                  UnknownLeaseException
Called by the lease when its renew method is called.

Specified by:
renew in interface Landlord
Parameters:
cookie - Associated with the lease when it was created
extension - The duration argument passed to the Lease.renew() call
Returns:
The new duration the lease should have
Throws:
LeaseDeniedException
UnknownLeaseException

renewAll

public Landlord.RenewResults renewAll(Uuid[] cookie,
                                      long[] extension)
Called by the lease map when its renewAll method is called.

Specified by:
renewAll in interface Landlord
Parameters:
cookie - Associated with each lease when it was created
extension - The duration argument for each lease from the map
Returns:
The results of the renew

cancel

public void cancel(Uuid cookie)
            throws UnknownLeaseException
Called by the lease when its cancel method is called.

Specified by:
cancel in interface Landlord
Parameters:
cookie - Associated with the lease when it was created
Throws:
UnknownLeaseException

cancelAll

public Map cancelAll(Uuid[] cookies)
Called by the lease map when its cancelAll method is called.

Specified by:
cancelAll in interface Landlord
Parameters:
cookies - Associated with the lease when it was created

getProxyVerifier

public TrustVerifier getProxyVerifier()
                               throws RemoteException
Specified by:
getProxyVerifier in interface ServerProxyTrust
Throws:
RemoteException

getReferentUuid

public Uuid getReferentUuid()
Return the Uuid that has been assigned to the resource this proxy represents.

Specified by:
getReferentUuid in interface ReferentUuid
Returns:
the Uuid associated with the resource this proxy represents. Will not return null.

Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.