org.codehaus.wadi.impl
Class SharedStoreContextualiser

java.lang.Object
  extended byorg.codehaus.wadi.impl.AbstractContextualiser
      extended byorg.codehaus.wadi.impl.AbstractChainedContextualiser
          extended byorg.codehaus.wadi.impl.AbstractMotingContextualiser
              extended byorg.codehaus.wadi.impl.AbstractSharedContextualiser
                  extended byorg.codehaus.wadi.impl.SharedStoreContextualiser
All Implemented Interfaces:
Contextualiser, Lifecycle

public class SharedStoreContextualiser
extends AbstractSharedContextualiser

A Contextualiser which stores its Contexts in a shared database via JDBC. On shutdown of the cluster's last node, all extant sessions will be demoted to here. On startup of the cluster's first node, all sessions stored here will be promoted upwards.

Version:
$Revision: 1430 $
Author:
Jules Gosnell

Nested Class Summary
 class SharedStoreContextualiser.SharedJDBCEmoter
           
 class SharedStoreContextualiser.SharedJDBCImmoter
          An Emoter that deals in terms of SharedJDBCMotables
 
Field Summary
protected  Emoter _emoter
           
protected  Immoter _immoter
           
protected  DatabaseStore _store
           
 
Fields inherited from class org.codehaus.wadi.impl.AbstractMotingContextualiser
_clean, _config, _locker
 
Fields inherited from class org.codehaus.wadi.impl.AbstractChainedContextualiser
_next
 
Fields inherited from class org.codehaus.wadi.impl.AbstractContextualiser
_log
 
Constructor Summary
SharedStoreContextualiser(Contextualiser next, Collapser collapser, boolean clean, DatabaseStore store)
           
 
Method Summary
 boolean contextualise(InvocationContext invocationContext, String id, Immoter immoter, Sync motionLock, boolean exclusiveOnly)
          Shared Contextualisers do nothing at runtime.
 void expire(Motable motable)
           
 Motable get(String id)
           
 Immoter getDemoter(String name, Motable motable)
          Return a Demoter to the first Contextualiser which would be happy to accept this Motable - in other words - would not evict() it.
 Emoter getEmoter()
           
 Emoter getEvictionEmoter()
           
 Immoter getImmoter()
           
 String getStartInfo()
           
 void init(ContextualiserConfig config)
           
 void load(Emoter emoter, Immoter immoter)
           
 
Methods inherited from class org.codehaus.wadi.impl.AbstractSharedContextualiser
getLocalSessionCount, isExclusive
 
Methods inherited from class org.codehaus.wadi.impl.AbstractMotingContextualiser
destroy, getPromoter, getSharedDemoter, handle, promote, promoteToExclusive
 
Methods inherited from class org.codehaus.wadi.impl.AbstractChainedContextualiser
findRelevantSessionNames, setLastAccessedTime, setMaxInactiveInterval, start, stop
 
Methods inherited from class org.codehaus.wadi.impl.AbstractContextualiser
getStopInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_store

protected final DatabaseStore _store

_immoter

protected final Immoter _immoter

_emoter

protected final Emoter _emoter
Constructor Detail

SharedStoreContextualiser

public SharedStoreContextualiser(Contextualiser next,
                                 Collapser collapser,
                                 boolean clean,
                                 DatabaseStore store)
Method Detail

getStartInfo

public String getStartInfo()
Overrides:
getStartInfo in class AbstractContextualiser

init

public void init(ContextualiserConfig config)
Specified by:
init in interface Contextualiser
Overrides:
init 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

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

get

public Motable get(String id)
Specified by:
get in class AbstractMotingContextualiser

load

public void load(Emoter emoter,
                 Immoter immoter)

getEvictionEmoter

public Emoter getEvictionEmoter()

expire

public void expire(Motable motable)

contextualise

public boolean contextualise(InvocationContext invocationContext,
                             String id,
                             Immoter immoter,
                             Sync motionLock,
                             boolean exclusiveOnly)
                      throws InvocationException
Shared Contextualisers do nothing at runtime. They exist only to load data at startup and store it at shutdown.

Specified by:
contextualise in interface Contextualiser
Overrides:
contextualise in class AbstractMotingContextualiser
Throws:
InvocationException


Copyright © 2004-2008 Core Developers Network Ltd.. All Rights Reserved.