org.codehaus.wadi.impl
Class ClusterContextualiser
java.lang.Object
org.codehaus.wadi.impl.AbstractContextualiser
org.codehaus.wadi.impl.AbstractChainedContextualiser
org.codehaus.wadi.impl.AbstractMotingContextualiser
org.codehaus.wadi.impl.AbstractSharedContextualiser
org.codehaus.wadi.impl.ClusterContextualiser
- All Implemented Interfaces:
- ClusterListener, Config, Contextualiser, EventListener, Lifecycle, RelocaterConfig, StateManager.ImmigrationListener
- public class ClusterContextualiser
- extends AbstractSharedContextualiser
- implements RelocaterConfig, ClusterListener, StateManager.ImmigrationListener
A cache of Locations. If the Location of a Context is not known, the Cluster
may be queried for it. If it is forthcoming, we can proxy to it. After a
given number of successful proxies, the Context will be migrated to this
Contextualiser which should promote it so that future requests for it can be
run straight off the top of the stack.
Node N1 sends LocationRequest to Cluster
Node N2 contextualises this request with a FilterChain that will send a LocationResponse and wait a specified handover period.
Node N1 receives the response, updates its cache and then proxies through the Location to the required resource.
The promotion mutex is held correctly during the initial Location lookup, so that searches for the same Context are correctly collapsed.
Proxy should be applied before Migration- if it succeeds, we don't migrate...
This class is getting out of hand !
- Version:
- $Revision: 1430 $
- Author:
- Jules Gosnell
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_nodeNameKey
protected static final String _nodeNameKey
- See Also:
- Constant Field Values
_shuttingDownKey
protected static final String _shuttingDownKey
- See Also:
- Constant Field Values
_evacuatingKey
protected static final String _evacuatingKey
- See Also:
- Constant Field Values
_evacuationPartnerCount
protected final SynchronizedInt _evacuationPartnerCount
_collapser
protected final Collapser _collapser
_relocater
protected final Relocater _relocater
_immoter
protected final Immoter _immoter
_emoter
protected final Emoter _emoter
_resTimeout
protected final int _resTimeout
- See Also:
- Constant Field Values
_lockLog
protected final Log _lockLog
_shuttingDown
protected SynchronizedBoolean _shuttingDown
_nodeName
protected String _nodeName
_evacuating
protected boolean _evacuating
_dispatcher
protected ActiveClusterDispatcher _dispatcher
_cluster
protected Cluster _cluster
_location
protected HttpProxyLocation _location
_proxiedLocation
protected ProxiedLocation _proxiedLocation
_dindex
protected DIndex _dindex
_top
protected Contextualiser _top
_locationMaxInactiveInterval
protected int _locationMaxInactiveInterval
ClusterContextualiser
public ClusterContextualiser(Contextualiser next,
Collapser collapser,
Relocater relocater)
init
public void init(ContextualiserConfig config)
- Specified by:
init
in interface Contextualiser
- Overrides:
init
in class AbstractMotingContextualiser
getStartInfo
public String getStartInfo()
- Overrides:
getStartInfo
in class AbstractContextualiser
destroy
public void destroy()
- Specified by:
destroy
in interface Contextualiser
- Overrides:
destroy
in class AbstractMotingContextualiser
getImmoter
public Immoter getImmoter()
- Specified by:
getImmoter
in class AbstractMotingContextualiser
- Returns:
- - an Immoter that facilitates insertion of Motables into this Contextualiser's own store
getEmoter
public Emoter getEmoter()
- Specified by:
getEmoter
in class AbstractMotingContextualiser
- Returns:
- - an Emoter that facilitates removal of Motables from this Contextualiser's own store
getEvacuationPartnersCount
protected int getEvacuationPartnersCount()
refreshEvacuationPartnersCount
protected void refreshEvacuationPartnersCount()
getDemoter
public Immoter getDemoter(String name,
Motable motable)
- Description copied from interface:
Contextualiser
- Return a Demoter to the first Contextualiser which would be happy to accept this Motable - in other words - would not evict() it.
- Specified by:
getDemoter
in interface Contextualiser
- Overrides:
getDemoter
in class AbstractSharedContextualiser
getSharedDemoter
public Immoter getSharedDemoter()
- Specified by:
getSharedDemoter
in interface Contextualiser
- Overrides:
getSharedDemoter
in class AbstractMotingContextualiser
handle
public boolean handle(InvocationContext invocationContext,
String id,
Immoter immoter,
Sync motionLock)
throws InvocationException
- Overrides:
handle
in class AbstractMotingContextualiser
- Throws:
InvocationException
createEvacuationQueue
protected void createEvacuationQueue()
throws Exception
- Throws:
Exception
destroyEvacuationQueue
protected void destroyEvacuationQueue()
throws Exception
- Throws:
Exception
ensureEvacuationQueue
protected void ensureEvacuationQueue()
stop
public void stop()
throws Exception
- Specified by:
stop
in interface Lifecycle
- Overrides:
stop
in class AbstractChainedContextualiser
- Throws:
Exception
onImmigration
public void onImmigration(ObjectMessage message,
Motable emotable)
- Specified by:
onImmigration
in interface StateManager.ImmigrationListener
load
public void load(Emoter emoter,
Immoter immoter)
- Specified by:
load
in interface Contextualiser
onNodeAdd
public void onNodeAdd(ClusterEvent event)
- Specified by:
onNodeAdd
in interface ClusterListener
onNodeUpdate
public void onNodeUpdate(ClusterEvent event)
- Specified by:
onNodeUpdate
in interface ClusterListener
onNodeStateChange
public void onNodeStateChange(ClusterEvent event)
ensureEvacuationJoined
protected void ensureEvacuationJoined(String nodeName)
ensureEvacuationLeft
protected void ensureEvacuationLeft(String nodeName)
onNodeRemoved
public void onNodeRemoved(ClusterEvent event)
- Specified by:
onNodeRemoved
in interface ClusterListener
onNodeFailed
public void onNodeFailed(ClusterEvent event)
- Specified by:
onNodeFailed
in interface ClusterListener
onCoordinatorChanged
public void onCoordinatorChanged(ClusterEvent event)
- Specified by:
onCoordinatorChanged
in interface ClusterListener
getCollapser
public Collapser getCollapser()
- Specified by:
getCollapser
in interface RelocaterConfig
getDispatcher
public Dispatcher getDispatcher()
- Specified by:
getDispatcher
in interface RelocaterConfig
getLocation
public Location getLocation()
- Specified by:
getLocation
in interface RelocaterConfig
getProxiedLocation
public ProxiedLocation getProxiedLocation()
- Specified by:
getProxiedLocation
in interface RelocaterConfig
getContextualiser
public Contextualiser getContextualiser()
- Specified by:
getContextualiser
in interface RelocaterConfig
getNodeName
public String getNodeName()
- Specified by:
getNodeName
in interface RelocaterConfig
getShuttingDown
public SynchronizedBoolean getShuttingDown()
- Specified by:
getShuttingDown
in interface RelocaterConfig
getInvocationProxy
public InvocationProxy getInvocationProxy()
- Specified by:
getInvocationProxy
in interface RelocaterConfig
getDIndex
public DIndex getDIndex()
- Specified by:
getDIndex
in interface RelocaterConfig
notifySessionRelocation
public void notifySessionRelocation(String name)
- Specified by:
notifySessionRelocation
in interface RelocaterConfig
get
public Motable get(String name)
- Specified by:
get
in class AbstractMotingContextualiser
Copyright © 2004-2008 Core Developers Network Ltd.. All Rights Reserved.