org.softamis.cluster4spring.support.invocation
Class ShuffleEndpointSelectionPolicy<E extends Endpoint<SI>,SI extends ServiceMoniker>
java.lang.Object
org.softamis.cluster4spring.support.invocation.ShuffleEndpointSelectionPolicy<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 ShuffleEndpointSelectionPolicy<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 creates copy of given list, shuffle it and selects first
endpoint from resulting list.
- Author:
- Andrew Sazonov
- See Also:
Collections.shuffle(java.util.List)
Field Summary |
protected static org.apache.commons.logging.Log |
fLog
|
Method Summary |
E |
selectServiceEndpoint(java.util.List<E> aEndpoints)
Selects endpoint for invocation from the given list of endpoints. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fLog
protected static final org.apache.commons.logging.Log fLog
ShuffleEndpointSelectionPolicy
public ShuffleEndpointSelectionPolicy()
selectServiceEndpoint
public E selectServiceEndpoint(java.util.List<E> aEndpoints)
throws org.springframework.remoting.RemoteAccessException
- Selects endpoint for invocation from the given list of endpoints. This implementation
creates copy of given list, shuffle it and selects firstendpoint from resulting list.
- 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:
Collections.shuffle(java.util.List)