Rio Project 4.2 API Documentation



org.rioproject.resources.servicecore
Class LeasedListManager

java.lang.Object
  extended by org.rioproject.resources.servicecore.LeasedListManager
All Implemented Interfaces:
LeaseListener

public class LeasedListManager
extends Object
implements LeaseListener

This class provides an implementation of a LeaseListener which uses manages a LinkedList of ServiceResource objects which reflect the resources being leased. This class must be registered with the LandlordLessor, and will be notified as resources are leased, updated or removed

Author:
Dennis Reedy
See Also:
LandlordLessor, ResourceLessor

Constructor Summary
LeasedListManager()
           
 
Method Summary
 void expired(LeasedResource resource)
          Notifies the manager of a lease expiration
 ServiceResource getNext()
          Returns the next ServiceResource in the list of ServiceResource elements that have been leased.
 ServiceResource getPrevious()
          Returns the previous ServiceResource in the list of ServiceResource elements that have been leased.
 ServiceResource[] getServiceResources()
          This method returns a snapshot of the ServiceResource objects in the LinkedList of resources
 void putLast(ServiceResource sr)
          This method will move the ServiceResource from wherever it is in the list to the last element in the list
 void register(LeasedResource resource)
          Notifies the manager of a new lease being created.
 void removed(LeasedResource resource)
          Notifies the manager of a lease removal
 void removeResource(ServiceResource resource)
          Removes a ServiceResource from the managed Collection of ServiceResource elements
 void renewed(LeasedResource resource)
          Notifies the manager of a lease being renewed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LeasedListManager

public LeasedListManager()
Method Detail

getServiceResources

public ServiceResource[] getServiceResources()
This method returns a snapshot of the ServiceResource objects in the LinkedList of resources

Returns:
An array of ServiceResource objects

removeResource

public void removeResource(ServiceResource resource)
Removes a ServiceResource from the managed Collection of ServiceResource elements

Parameters:
resource - The ServiceResource to remove

putLast

public void putLast(ServiceResource sr)
This method will move the ServiceResource from wherever it is in the list to the last element in the list

Parameters:
sr - The ServiceResource to move

getNext

public ServiceResource getNext()
                        throws NoSuchElementException
Returns the next ServiceResource in the list of ServiceResource elements that have been leased. The behavior of this method is simply to remove the first element from the LinkedList and append it to the end of the list.

Use of this method provides access to the list of ServiceResource elements traversing in a forward direction.

If there is only one element in the list, the that element will be returned each time this method is called.

Returns:
ServiceResource
Throws:
NoSuchElementException - if the iteration is empty

getPrevious

public ServiceResource getPrevious()
                            throws NoSuchElementException
Returns the previous ServiceResource in the list of ServiceResource elements that have been leased. The behavior of this method is simply to remove the last element from the LinkedList and append it to the beginning of the list.

Use of this method provides access to the list of ServiceResource elements traversing in a forward direction.

If there is only one element in the list, the that element will be returned each time this method is called.

Returns:
ServiceResource
Throws:
NoSuchElementException - if the iteration is empty

expired

public void expired(LeasedResource resource)
Notifies the manager of a lease expiration

Specified by:
expired in interface LeaseListener
Parameters:
resource - The resource associated with the expiration

removed

public void removed(LeasedResource resource)
Notifies the manager of a lease removal

Specified by:
removed in interface LeaseListener
Parameters:
resource - The resource associated with the removal

register

public void register(LeasedResource resource)
Notifies the manager of a new lease being created.

Specified by:
register in interface LeaseListener
Parameters:
resource - The resource associated with the new Lease.

renewed

public void renewed(LeasedResource resource)
Notifies the manager of a lease being renewed.

Specified by:
renewed in interface LeaseListener
Parameters:
resource - The resource associated with the new Lease.

Copyright © Rio Project.

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