org.axonframework.eventhandling
Class AbstractClusterSelector

java.lang.Object
  extended by org.axonframework.eventhandling.AbstractClusterSelector
All Implemented Interfaces:
ClusterSelector
Direct Known Subclasses:
AnnotationClusterSelector, ClassNamePatternClusterSelector, ClassNamePrefixClusterSelector

public abstract class AbstractClusterSelector
extends Object
implements ClusterSelector

Abstract implementation of the ClusterSelector interface that detects proxies and passes the actual Class of the Event Listener implementation. Typically, this occurs when annotated event handlers are used. The doSelectCluster(org.axonframework.eventhandling.EventListener, Class) method, in such case, returns the Class of the annotated listener.

Since:
2.0
Author:
Allard Buijze

Constructor Summary
AbstractClusterSelector()
           
 
Method Summary
protected abstract  Cluster doSelectCluster(EventListener eventListener, Class<?> listenerType)
          Select a cluster for the given eventListener, which has the actual class listenerType.
 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

AbstractClusterSelector

public AbstractClusterSelector()
Method Detail

selectCluster

public Cluster selectCluster(EventListener eventListener)
Description copied from interface: ClusterSelector
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.

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

doSelectCluster

protected abstract Cluster doSelectCluster(EventListener eventListener,
                                           Class<?> listenerType)
Select a cluster for the given eventListener, which has the actual class listenerType. Note that the given listenerType does not have to be assignable to EventListener, as it is possible that the eventListener acts as a proxy to an instance of listenerType.

Parameters:
eventListener - The listener instance handling the events, possibly a proxy
listenerType - The actual type of the Event Listener
Returns:
the cluster to assign the Event Listener to


Copyright © 2010-2016. All Rights Reserved.