|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object context.arch.discoverer.lease.LeasesKeeper
A component registers to the discoverer for a given period of time that is defined with a lease. That allows the discovery system to make sure a component is still available. This class keeps all information about the context components leases that are registered. It contains a LeasesWatcher object that watches the end of leases each xx minutes as defined in the Lease class by the constant Lease.TIME_SLOT_MILLIS. If the LeaseKeeper detects the end of a lease, it sends it to the discoverer that will send a checking message to the component.
LeasesWatcher
,
Discoverer
Field Summary | |
protected java.util.Hashtable |
leases
All leases, associates the component (Integer)index -> Lease object |
protected DiscovererMediator |
mediator
The discoverer object |
protected LeasesWatcher |
watcher
The watcher that triggers the leases examination |
Constructor Summary | |
LeasesKeeper(DiscovererMediator mediator)
Creates new LeasesKeeper TO COMPLETE (if the discoverer restarts from a log file) |
Method Summary | |
void |
addLease(Lease lease)
Adds a Lease object and update the LeaseWatcher object |
java.lang.Integer |
contains(java.lang.Integer componentIndex)
This method tests if an index of a ComponentDescription exists |
boolean |
existingComponentDescription(java.lang.Integer componentDescriptionIndex)
Tests if an index corresponds to an existing ComponentDescription in the discoverer |
void |
leaseEndNotificationTo(java.util.ArrayList listOfLeaseEnd)
This method allows to send a list of leases that should end to the discoverer. |
Lease |
removeLease(java.lang.Integer indexToRemove)
This method allows to remove a Lease corresponding to the index |
boolean |
renewLease(Lease renewal)
This method allows to renew an exiting lease |
java.lang.String |
toString()
Returns a printable version of this object |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected DiscovererMediator mediator
protected java.util.Hashtable leases
protected LeasesWatcher watcher
Constructor Detail |
public LeasesKeeper(DiscovererMediator mediator)
Method Detail |
public void addLease(Lease lease)
lease
- The Lease objectpublic void leaseEndNotificationTo(java.util.ArrayList listOfLeaseEnd)
listOfLeaseEnd
- The leases to send to the discovererpublic Lease removeLease(java.lang.Integer indexToRemove)
indexToRemove
- The index of the ComponentDescription for which we
want to remove the lease
public java.lang.Integer contains(java.lang.Integer componentIndex)
componentIndex
- The Integer to test
public java.lang.String toString()
public boolean renewLease(Lease renewal)
renewal
- The new lease
public boolean existingComponentDescription(java.lang.Integer componentDescriptionIndex)
componentDescriptionIndex
- The index of the object to test
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |