org.jgroups.service.lease
Class LeaseFactoryClient
java.lang.Object
org.jgroups.service.lease.LeaseFactoryClient
- LeaseFactory
public class LeaseFactoryClient
extends java.lang.Object
LeaseFactoryClient
is an implementation of
LeaseFactory
interface that delegates lease granting to group containing one or more
LeaseFactoryService
instances.
This service tries to implement semi-synchronous communication pattern: each
call blocks until reply from service received or timeout occurs.
Also this implementation assumes that pending new lease request conflicts
with renewal request and request that came last is aborted.
- Roman Rokytskyy (rrokytskyy@acm.org)
LeaseFactoryClient(Channel clientChannel) - Create instance of this class for specified client channel with
default timeouts.
|
LeaseFactoryClient(Channel clientChannel, int leaseTimeout, int cancelTimeout) - Create instance of this class for the specified channel with specified
timeouts.
|
DEFAULT_CANCEL_TIMEOUT
public static final int DEFAULT_CANCEL_TIMEOUT
DEFAULT_LEASE_TIMEOUT
public static final int DEFAULT_LEASE_TIMEOUT
cancelTimeout
protected int cancelTimeout
clientChannel
protected Channel clientChannel
leaseTimeout
protected int leaseTimeout
pendingCancels
protected HashMap pendingCancels
pendingLeases
protected HashMap pendingLeases
pendingRenewals
protected HashMap pendingRenewals
LeaseFactoryClient
public LeaseFactoryClient(Channel clientChannel)
Create instance of this class for specified client channel with
default timeouts.
LeaseFactoryClient
public LeaseFactoryClient(Channel clientChannel,
int leaseTimeout,
int cancelTimeout)
Create instance of this class for the specified channel with specified
timeouts.
clientChannel
- channel that will be used for client-service
communication.leaseTimeout
- timeout for "new lease" and "renew lease" requests.cancelTimeout
- timeout for "cancel lease" timeout.
getAddress
public Address getAddress()
Get address of this client in group.
renewLease
public Lease renewLease(Lease existingLease,
long requestedDuration,
boolean isAbsolute)
throws LeaseDeniedException
Renew existing lease. This method is used to extend lease time, therefore
existingLease
must be valid.
- renewLease in interface LeaseFactory
Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.