org.softamis.cluster4spring.support.invocation
Class LastAccessTimeEndpointSelectionPolicy<E extends Endpoint<SI>,SI extends ServiceMoniker>

java.lang.Object
  extended by org.softamis.cluster4spring.support.invocation.LastAccessTimeEndpointSelectionPolicy<E,SI>
Type Parameters:
SI - type of data used to invoke remote service (such as remote service URL)
E - type of endpoints that could be created by this factory
All Implemented Interfaces:
EndpointSelectionPolicy<E,SI>

public class LastAccessTimeEndpointSelectionPolicy<E extends Endpoint<SI>,SI extends ServiceMoniker>
extends java.lang.Object
implements EndpointSelectionPolicy<E,SI>

Policy that performs selection of endpoint for invocation from the given list of available endpoints. This implementation simply selects the endpoint with minimal last access time.

Author:
Andrew Sazonov
See Also:
Endpoint.getLastAccessTime()

Field Summary
protected static org.apache.commons.logging.Log fLog
           
 
Constructor Summary
LastAccessTimeEndpointSelectionPolicy()
           
 
Method Summary
 E selectServiceEndpoint(java.util.List<E> aEndpoints)
          Selects endpoint for invocation from the given list of endpoints based on value of last access time for every endpoint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fLog

protected static final org.apache.commons.logging.Log fLog
Constructor Detail

LastAccessTimeEndpointSelectionPolicy

public LastAccessTimeEndpointSelectionPolicy()
Method Detail

selectServiceEndpoint

public E selectServiceEndpoint(java.util.List<E> aEndpoints)
                                             throws org.springframework.remoting.RemoteAccessException
Selects endpoint for invocation from the given list of endpoints based on value of last access time for every endpoint. Endpoint with minimal value is selected.

Specified by:
selectServiceEndpoint in interface EndpointSelectionPolicy<E extends Endpoint<SI>,SI extends ServiceMoniker>
Parameters:
aEndpoints - list of endpoints available for invocation of remote service
Returns:
selected endpoints
Throws:
org.springframework.remoting.RemoteAccessException - throw if some error occured during seleting endpoint for invocation
See Also:
Endpoint.getLastAccessTime()