org.codehaus.wadi.core.contextualiser
Interface Contextualiser

All Superinterfaces:
Lifecycle
All Known Implementing Classes:
AbstractChainedContextualiser, AbstractDelegatingContextualiser, AbstractExclusiveContextualiser, AbstractMotingContextualiser, AbstractSharedContextualiser, ClusterContextualiser, DummyContextualiser, ExclusiveStoreContextualiser, MemoryContextualiser, ReplicaAwareContextualiser, SerialContextualiser, SharedStoreContextualiser, StatelessContextualiser

public interface Contextualiser
extends Lifecycle

Contextualising an Invocation is colocating it and the relevant Session within the same JVM and then invoke()-ing the Invocation... Each Contextualiser contains a store of Sessions. These may be held e.g. in Memory, on Disc, in a Database, or on another Peer in the Cluster. These are arranged in a linked list. This 'Contextualiser stack' is generally arranged with the most expensive, fastest, most volatile storage (i.e. Memory) at the top, and cheapest, slowest, securest storage (e.g. Database), at the bottom. As Sessions age, they are be evicted downwards to free up valuable and scarce resources. Incoming Invocations are passed down the Contextualiser stack until they meet the relevant Session. At this point, the Session is promoted up to Memory and the Invocation is invoke()-ed in its presence. If the Invocation reaches the ClusterContextualiser without meeting its Session and its Session is found to be located elsewhere in the Cluster, then the ClusterContextualiser has the option of relocating the Session to the Invocation in the local JVM OR the Invocation to the Session in the remote JVM. The location of the invocation's contextualisation is unimportant, provided that it occurs somewhere.

Version:
$Revision: 2317 $
Author:
Jules Gosnell

Method Summary
 boolean contextualise(Invocation invocation, java.lang.String key, Immoter immoter, boolean exclusiveOnly)
          Contextualise the given Invocation.
 void findRelevantSessionNames(PartitionMapper mapper, java.util.Map keyToSessionNames)
           
 Immoter getDemoter(java.lang.String name, Motable motable)
          Return an immoter to the first Contextualiser below us, which would be happy to accept this Motable - in other words - would not evict() it.
 java.util.Set getSessionNames()
           
 Immoter getSharedDemoter()
          Return an Immoter to the first SharedContextualiser below us.
 void promoteToExclusive(Immoter immoter)
          Pass this Immoter up to the first ExclusiveContextualiser above us, where...
 
Methods inherited from interface org.codehaus.wadi.core.Lifecycle
start, stop
 

Method Detail

contextualise

boolean contextualise(Invocation invocation,
                      java.lang.String key,
                      Immoter immoter,
                      boolean exclusiveOnly)
                      throws InvocationException
Contextualise the given Invocation.

Parameters:
invocation - the Invocation
key - the Session key
immoter - an Immoter that can be used to promote the Session when found
exclusiveOnly - whether we should only look in exclusive stores, or descend to shared ones as well
Returns:
whether or not the Invocation was contextualised.
Throws:
InvocationException

getDemoter

Immoter getDemoter(java.lang.String name,
                   Motable motable)
Return an immoter to the first Contextualiser below us, which would be happy to accept this Motable - in other words - would not evict() it.

Parameters:
name - - uid of the Motable
motable - - the Motable in question
Returns:
- a Demoter - a delegate capable of arranging immotion into the correct Contextualiser

getSharedDemoter

Immoter getSharedDemoter()
Return an Immoter to the first SharedContextualiser below us.

Returns:
the Immoter

promoteToExclusive

void promoteToExclusive(Immoter immoter)
Pass this Immoter up to the first ExclusiveContextualiser above us, where...

Parameters:
immoter - the Immoter

findRelevantSessionNames

void findRelevantSessionNames(PartitionMapper mapper,
                              java.util.Map keyToSessionNames)

getSessionNames

java.util.Set getSessionNames()


Copyright © 2011. All Rights Reserved.