org.codehaus.wadi.impl
Class AbstractExclusiveContextualiser

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.AbstractExclusiveContextualiser
All Implemented Interfaces:
Config, Contextualiser, EvicterConfig, Lifecycle
Direct Known Subclasses:
ExclusiveStoreContextualiser, GiannisContextualiser, MemoryContextualiser

public abstract class AbstractExclusiveContextualiser
extends AbstractMotingContextualiser
implements EvicterConfig

Basic implementation for Contextualisers which maintain a local Map of references to Motables.

Version:
$Revision: 1430 $
Author:
Jules Gosnell

Field Summary
protected  Evicter _evicter
           
protected  Map _map
           
protected  String _stringPrefix
           
protected  String _stringSuffix
           
 
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
AbstractExclusiveContextualiser(Contextualiser next, Locker locker, boolean clean, Evicter evicter, Map map)
           
 
Method Summary
 void demote(Motable emotable)
           
 void destroy()
           
 void findRelevantSessionNames(int numPartitions, Collection[] resultSet)
           
 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.
 Evicter getEvicter()
           
 Emoter getEvictionEmoter()
           
 Sync getEvictionLock(String id, Motable motable)
           
 int getLocalSessionCount()
           
 Map getMap()
           
 int getMaxInactiveInterval()
           
 int getSize()
           
 Timer getTimer()
           
 boolean handle(InvocationContext invocationContext, String id, Immoter immoter, Sync motionLock)
           
 void init(ContextualiserConfig config)
           
 void load(Emoter emoter, Immoter immoter)
           
 void start()
           
 void stop()
           
 String toString()
           
protected  void unload()
           
 
Methods inherited from class org.codehaus.wadi.impl.AbstractMotingContextualiser
contextualise, getEmoter, getImmoter, getPromoter, getSharedDemoter, promote, promoteToExclusive
 
Methods inherited from class org.codehaus.wadi.impl.AbstractChainedContextualiser
setLastAccessedTime, setMaxInactiveInterval
 
Methods inherited from class org.codehaus.wadi.impl.AbstractContextualiser
getStartInfo, getStopInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.codehaus.wadi.EvicterConfig
expire
 
Methods inherited from interface org.codehaus.wadi.Contextualiser
isExclusive
 

Field Detail

_map

protected final Map _map

_evicter

protected final Evicter _evicter

_stringPrefix

protected String _stringPrefix

_stringSuffix

protected String _stringSuffix
Constructor Detail

AbstractExclusiveContextualiser

public AbstractExclusiveContextualiser(Contextualiser next,
                                       Locker locker,
                                       boolean clean,
                                       Evicter evicter,
                                       Map map)
Method Detail

toString

public String toString()

get

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

handle

public boolean handle(InvocationContext invocationContext,
                      String id,
                      Immoter immoter,
                      Sync motionLock)
               throws InvocationException
Overrides:
handle in class AbstractMotingContextualiser
Throws:
InvocationException

getEvictionEmoter

public Emoter getEvictionEmoter()
Specified by:
getEvictionEmoter in interface EvicterConfig

unload

protected void unload()

init

public void init(ContextualiserConfig config)
Specified by:
init in interface Contextualiser
Overrides:
init in class AbstractMotingContextualiser

start

public void start()
           throws Exception
Specified by:
start in interface Lifecycle
Overrides:
start in class AbstractChainedContextualiser
Throws:
Exception

stop

public void stop()
          throws Exception
Specified by:
stop in interface Lifecycle
Overrides:
stop in class AbstractChainedContextualiser
Throws:
Exception

destroy

public void destroy()
Specified by:
destroy in interface Contextualiser
Overrides:
destroy in class AbstractMotingContextualiser

load

public void load(Emoter emoter,
                 Immoter immoter)
Specified by:
load in interface Contextualiser

getEvicter

public Evicter getEvicter()

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
Parameters:
name - - uid of the Motable
motable - - the Motable in question
Returns:
- a Demoter - a delegate capable of arranging immotion into the correct Contextualiser

getLocalSessionCount

public int getLocalSessionCount()
Specified by:
getLocalSessionCount in interface Contextualiser

getSize

public int getSize()

getMap

public Map getMap()
Specified by:
getMap in interface EvicterConfig

getTimer

public Timer getTimer()
Specified by:
getTimer in interface EvicterConfig

getEvictionLock

public Sync getEvictionLock(String id,
                            Motable motable)
Specified by:
getEvictionLock in interface EvicterConfig

demote

public void demote(Motable emotable)
Specified by:
demote in interface EvicterConfig

getMaxInactiveInterval

public int getMaxInactiveInterval()
Specified by:
getMaxInactiveInterval in interface EvicterConfig

findRelevantSessionNames

public void findRelevantSessionNames(int numPartitions,
                                     Collection[] resultSet)
Specified by:
findRelevantSessionNames in interface Contextualiser
Overrides:
findRelevantSessionNames in class AbstractChainedContextualiser


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