|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rioproject.resources.servicecore.ResourceLessor
public abstract class ResourceLessor
Abstract class to manage the service's leased resources.
| Nested Class Summary | |
|---|---|
protected class |
ResourceLessor.LeaseReaper
Clean up leases that have not been renewed. |
| Constructor Summary | |
|---|---|
ResourceLessor()
|
|
| Method Summary | |
|---|---|
protected void |
addLeasedResource(LeasedResource resource)
Add a LeasedResource for a new Lease or renewing a Lease |
void |
addLeaseListener(LeaseListener listener)
Add a LeaseListener |
protected long |
currentTime()
Method that provides some notion of the current time in milliseconds since the beginning of the epoch. |
boolean |
ensure(LeasedResource resource)
Check to make sure that the LeasedResource lease has not expired yet |
protected LeasedResource |
getLeasedResource(Uuid cookie)
Get a LeasedResource |
protected LeasedResource[] |
getLeasedResources()
This method returns a snapshot of the LeasedResource objects that this ResourceLessor is managing |
abstract Lease |
newLease(LeasedResource resource,
long duration)
Create a new lease |
protected void |
notifyLeaseExpiration(ServiceResource resource)
Notify LeaseListener instances of a lease expiration |
protected void |
notifyLeaseRegistration(LeasedResource resource)
Notify LeaseListener instances of a new registration |
protected void |
notifyLeaseRemoval(LeasedResource resource)
Notify LeaseListener instances of a lease removal |
protected void |
notifyLeaseRenewal(LeasedResource resource)
Notify LeaseListener instances of a lease renewal |
boolean |
remove(ServiceResource resource)
Remove a leased resource from the list of managed leases. |
void |
removeAll()
Remove all leased resources . |
void |
removeLeaseListener(LeaseListener listener)
Remove a LeaseListener |
protected void |
stop()
Stop and clean up all resources |
int |
total()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ResourceLessor()
| Method Detail |
|---|
public boolean ensure(LeasedResource resource)
resource - The LeasedResource
public abstract Lease newLease(LeasedResource resource,
long duration)
throws LeaseDeniedException
resource - to be leasedduration - Time requested for Lease
LeaseDeniedException - If the lease has been deniedpublic boolean remove(ServiceResource resource)
resource - ServiceResource to remove
public void removeAll()
public void addLeaseListener(LeaseListener listener)
listener - the LeaseListener to addpublic void removeLeaseListener(LeaseListener listener)
listener - the LeaseListener to removepublic int total()
protected void addLeasedResource(LeasedResource resource)
resource - The resource to add or update
IllegalArgumentException - if the resource is nullprotected LeasedResource getLeasedResource(Uuid cookie)
cookie - The Uuid of the LeasedResource to get
IllegalArgumentException - if the cookie is nullprotected LeasedResource[] getLeasedResources()
protected void notifyLeaseRegistration(LeasedResource resource)
resource - The LeasedResourceprotected void notifyLeaseRenewal(LeasedResource resource)
resource - The LeasedResourceprotected void notifyLeaseExpiration(ServiceResource resource)
resource - The LeasedResourceprotected void notifyLeaseRemoval(LeasedResource resource)
resource - The LeasedResourceprotected void stop()
protected long currentTime()
|
Copyright © Rio Project. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||