org.axonframework.eventhandling
Class DefaultClusterSelector

java.lang.Object
  extended by org.axonframework.eventhandling.DefaultClusterSelector
All Implemented Interfaces:
ClusterSelector

public class DefaultClusterSelector
extends Object
implements ClusterSelector

ClusterSelector implementation that always selects the same cluster. This implementation can serve as delegate for other cluster selectors for event listeners that do not belong to a specific cluster.

Since:
1.2
Author:
Allard Buijze

Constructor Summary
DefaultClusterSelector()
          Initializes the DefaultClusterSelector using a SimpleCluster with identifier "default", to which this instance will assign all Event Listeners.
DefaultClusterSelector(Cluster defaultCluster)
          Initializes the DefaultClusterSelector to assign the given defaultCluster to each listener.
 
Method Summary
 Cluster selectCluster(EventListener eventListener)
          Selects the cluster instance that the given eventListener should be member of.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultClusterSelector

public DefaultClusterSelector()
Initializes the DefaultClusterSelector using a SimpleCluster with identifier "default", to which this instance will assign all Event Listeners.


DefaultClusterSelector

public DefaultClusterSelector(Cluster defaultCluster)
Initializes the DefaultClusterSelector to assign the given defaultCluster to each listener.

Parameters:
defaultCluster - The Cluster to assign to each listener
Method Detail

selectCluster

public Cluster selectCluster(EventListener eventListener)
Selects the cluster instance that the given eventListener should be member of. This may be an existing (or pre-configured) cluster, as well as a newly created cluster.

When null is returned, this may cause the Event Listener not to be subscribed to any cluster at all.

This implementation always returns the same instance of SimpleCluster.

Specified by:
selectCluster in interface ClusterSelector
Parameters:
eventListener - the event listener to select a cluster for
Returns:
The Cluster assigned to the listener


Copyright © 2010-2016. All Rights Reserved.