public class LeaseManager extends Object
[ Cell-1 | Cell-2 | Cell-3 | ... | Cell-i ] where each cell holds leases in between intervals: Cell-1 0...LM_EXPIRATION_TIME_INTERVAL Cell-2 LM_EXPIRATION_TIME_INTERVAL...LM_EXPIRATION_TIME_INTERVAL*2 ... Cell-i LM_EXPIRATION_TIME_INTERVAL...LM_EXPIRATION_TIME_INTERVAL*iEach Cell is ordered in a Sorted Tree Map which guarantees that the map will be in ascending key order, sorted according to the natural order of the key's class (Long).
Constructor and Description |
---|
LeaseManager(SpaceEngine engine,
String spaceName,
Processor coreProcessor) |
Modifier and Type | Method and Description |
---|---|
IEntryHolder |
cancel(String entryUid,
String classname,
int objectType,
boolean fromReplication,
boolean origin,
boolean isFromGateway)
Cancel a lease for a registered Entry in this Lease Manager.
|
IEntryHolder |
cancel(String entryUid,
String classname,
int objectType,
boolean fromReplication,
boolean origin,
boolean lease_expired,
OperationID operationID,
boolean isFromGateway) |
Exception[] |
cancelAll(String[] entryUids,
String[] classNames,
int[] objectTypes)
Batch cancellation operations for entries.
|
void |
close()
Closes the Lease Manager by waking up the lease reaper daemon thread and waits for it to
gracefully die.
|
OperationID |
createOperationIDForLeaseExpirationEvent() |
void |
forceLeaseReaperCycle(boolean mustExecute) |
void |
forceLeaseReaperCycle(boolean mustExecute,
long timeToWait)
Force a lease reaper cycle and blocks until the cycle is completed (unless
LeaseReaper#_minForceReapInterval is not elapsed since last reaper cycle completion) |
long |
getEffectiveEntryLeaseTime(long time) |
long |
getEffectiveEntryLeaseTimeForReaper(long time) |
void |
init() |
boolean |
isCurrentLeaseReaperThread() |
boolean |
isNoReapUnderXtnLeases() |
boolean |
isSlaveLeaseManagerForEntries() |
boolean |
isSlaveLeaseManagerForNotifyTemplates() |
boolean |
isSupportsRecentExtendedUpdates() |
void |
registerEntryLease(IEntryCacheInfo entryCacheInfo,
long expiration) |
Lease |
registerTemplateLease(TemplateCacheInfo templateCacheInfo) |
long |
renew(String entryUid,
String className,
int objectType,
long duration,
boolean fromReplication,
boolean origin,
boolean isFromGateway)
Renews a lease for an additional period of time (specified in milliseconds) for a registered
entry in this Lease Manager.
|
Object[] |
renewAll(String[] entryUids,
String[] classNames,
int[] objectTypes,
long[] durations)
Batch renewal operations for entries.
|
boolean |
replicateLeaseExpirationEventsForEntries() |
boolean |
replicateLeaseExpirationEventsForNotifyTemplates() |
void |
reRegisterLease(ILeasedEntryCacheInfo leaseCacheInfo,
IEntryHolder entry,
long original_expiration,
long new_expiration,
int objectType) |
static long |
toAbsoluteTime(long duration)
Calculates the absolute time for the given duration.
|
static long |
toAbsoluteTime(long duration,
long current)
Calculates the absolute time for the given duration.
|
void |
unregister(ILeasedEntryCacheInfo leaseCacheInfo,
long expiration)
unregister from lease manager based on direct backrefs Note: entry/template must be locked
|
void |
update(String entryUid,
String className,
int objectType,
long duration) |
public LeaseManager(SpaceEngine engine, String spaceName, Processor coreProcessor)
public void init()
public void registerEntryLease(IEntryCacheInfo entryCacheInfo, long expiration)
public Lease registerTemplateLease(TemplateCacheInfo templateCacheInfo)
public void reRegisterLease(ILeasedEntryCacheInfo leaseCacheInfo, IEntryHolder entry, long original_expiration, long new_expiration, int objectType)
public OperationID createOperationIDForLeaseExpirationEvent()
public boolean isNoReapUnderXtnLeases()
public long getEffectiveEntryLeaseTime(long time)
public long getEffectiveEntryLeaseTimeForReaper(long time)
public boolean isCurrentLeaseReaperThread()
public void forceLeaseReaperCycle(boolean mustExecute, long timeToWait) throws InterruptedException
LeaseReaper#_minForceReapInterval
is not elapsed since last reaper cycle completion)mustExecute
- TODO XML:timeToWait
- indicates how long should the leaseReaperDaemon wait for completing the
cycle, 0 means foreverInterruptedException
public void forceLeaseReaperCycle(boolean mustExecute) throws InterruptedException
InterruptedException
public long renew(String entryUid, String className, int objectType, long duration, boolean fromReplication, boolean origin, boolean isFromGateway) throws UnknownLeaseException, InternalSpaceException
entryUid
- Uid of entry to renew a lease for.className
- The class name of this entry.objectType
- The type of the entry.duration
- The requested duration in milliseconds.fromReplication
- true If this entry arrived from replication.UnknownLeaseException
- if lease is unknown to the registrar.InternalSpaceException
- if an internal error occurred.public void update(String entryUid, String className, int objectType, long duration) throws UnknownLeaseException, InternalSpaceException
public Object[] renewAll(String[] entryUids, String[] classNames, int[] objectTypes, long[] durations)
entryUids
- Uid of entries to renew a lease for.classNames
- The class name of each corresponding entry.objectTypes
- Type of the object of each entry.durations
- The requested durations (in milliseconds) of each entry.renew(String, String, int, long, boolean, boolean, boolean)
public IEntryHolder cancel(String entryUid, String classname, int objectType, boolean fromReplication, boolean origin, boolean isFromGateway) throws UnknownLeaseException
entryUid
- Uid of entry to renew a lease for.classname
- The class name of this entry.objectType
- The type of the entry.fromReplication
- true If this entry arrived from replication.UnknownLeaseException
public IEntryHolder cancel(String entryUid, String classname, int objectType, boolean fromReplication, boolean origin, boolean lease_expired, OperationID operationID, boolean isFromGateway) throws UnknownLeaseException
UnknownLeaseException
public Exception[] cancelAll(String[] entryUids, String[] classNames, int[] objectTypes)
entryUids
- Uid of entries to cancel their lease.classNames
- The class name of each corresponding entry.objectTypes
- Type of the object of each entry.cancel(String, String, int, boolean, boolean, boolean)
public final void close()
public static final long toAbsoluteTime(long duration, long current)
toAbsoluteTime(long)
but uses a provided clock.duration
- duration in milliseconds.current
- current time.public static final long toAbsoluteTime(long duration)
toAbsoluteTime(long)
but uses a provided clock.duration
- duration in milliseconds.public boolean isSlaveLeaseManagerForEntries()
public boolean isSlaveLeaseManagerForNotifyTemplates()
public boolean replicateLeaseExpirationEventsForEntries()
public boolean replicateLeaseExpirationEventsForNotifyTemplates()
public boolean isSupportsRecentExtendedUpdates()
public void unregister(ILeasedEntryCacheInfo leaseCacheInfo, long expiration)
Copyright © GigaSpaces.