|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.components.flow.ContinuationsManagerImpl
public class ContinuationsManagerImpl
The default implementation of ContinuationsManager
.
There are
two modes of work:
ContinuationsManager
Nested Class Summary | |
---|---|
protected static class |
ContinuationsManagerImpl.HolderAwareWebContinuation
WebContinuation extension that holds also the information about the holder. |
protected class |
ContinuationsManagerImpl.WebContinuationsHolder
A holder for WebContinuations. |
Field Summary | |
---|---|
protected boolean |
bindContinuationsToSession
|
protected byte[] |
bytes
|
protected Context |
context
|
protected ValueInstrument |
continuationsCount
|
protected int |
continuationsCounter
|
protected CounterInstrument |
continuationsCreated
|
protected ContinuationsManagerImpl.WebContinuationsHolder |
continuationsHolder
Main continuations holder. |
protected CounterInstrument |
continuationsInvalidated
|
protected int |
defaultTimeToLive
How long does a continuation exist in memory since the last access? The time is in miliseconds, and the default is 1 hour. |
protected SortedSet |
expirations
Sorted set of WebContinuation instances, based on
their expiration time. |
protected ValueInstrument |
expirationsSize
|
protected Set |
forest
Maintains the forest of WebContinuation trees. |
protected ValueInstrument |
forestSize
|
protected String |
instrumentableName
|
protected boolean |
isContinuationSharingBugCompatible
|
protected SecureRandom |
random
Random number generator used to create continuation ID |
protected ServiceManager |
serviceManager
|
Fields inherited from interface org.apache.cocoon.components.flow.ContinuationsManager |
---|
ROLE |
Fields inherited from interface org.apache.excalibur.instrument.Instrumentable |
---|
EMPTY_INSTRUMENT_ARRAY, EMPTY_INSTRUMENTABLE_ARRAY |
Constructor Summary | |
---|---|
ContinuationsManagerImpl()
|
Method Summary | |
---|---|
protected void |
_invalidate(ContinuationsManagerImpl.WebContinuationsHolder continuationsHolder,
WebContinuation wk)
|
void |
configure(Configuration config)
|
void |
contextualize(Context context)
|
WebContinuation |
createWebContinuation(Object kont,
WebContinuation parent,
int timeToLive,
String interpreterId,
ContinuationsDisposer disposer)
Create a WebContinuation object given a native
continuation object and its parent. |
void |
displayAllContinuations()
Dump to Log file all WebContinuation s
in the system |
protected void |
displayExpireSet()
Dump to Log file the current contents of the expirations SortedSet |
protected void |
disposeContinuation(ContinuationsManagerImpl.WebContinuationsHolder continuationsHolder,
WebContinuation wk)
Makes the continuation inaccessible for lookup, and triggers possible needed cleanup code through the ContinuationsDisposer interface. |
protected void |
expireContinuations()
Remove all continuations which have already expired. |
protected WebContinuation |
generateContinuation(Object kont,
WebContinuation parent,
int ttl,
String interpreterId,
ContinuationsDisposer disposer)
Create WebContinuation and generate unique identifier
for it. |
Instrumentable[] |
getChildInstrumentables()
|
String |
getInstrumentableName()
|
Instrument[] |
getInstruments()
|
List |
getWebContinuationsDataBeanList()
Get a list of all web continuations (data only) |
protected void |
handleLeafContinuationExpiration(WebContinuation wk)
When a new continuation is created in @link #createWebContinuation(Object, WebContinuation, int, String, ContinuationsDisposer), it is registered in the expiration set in order to be evaluated by the invalidation mechanism. |
protected void |
handleParentContinuationExpiration(WebContinuation parent)
When a new continuation is created in @link #createWebContinuation(Object, WebContinuation, int, String, ContinuationsDisposer), its parent continuation is removed from the expiration set. |
protected void |
invalidateContinuations(ContinuationsManagerImpl.WebContinuationsHolder continuationsHolder)
Method used by WebContinuationsHolder to notify the continuations manager about session invalidation. |
void |
invalidateWebContinuation(WebContinuation wk)
Invalidates a WebContinuation . |
WebContinuation |
lookupWebContinuation(String id,
String interpreterId)
Given a WebContinuation id, retrieve the associated
WebContinuation object. |
ContinuationsManagerImpl.WebContinuationsHolder |
lookupWebContinuationsHolder(boolean createNew)
Lookup a proper web continuations holder. |
protected void |
removeContinuation(ContinuationsManagerImpl.WebContinuationsHolder continuationsHolder,
WebContinuation wk)
Removes an expired leaf WebContinuation node
from its continuation tree, and recursively removes its
parent(s) if it they have expired and have no (other) children. |
void |
service(ServiceManager manager)
|
void |
setInstrumentableName(String instrumentableName)
|
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected SecureRandom random
protected byte[] bytes
protected int defaultTimeToLive
protected Set forest
WebContinuation
trees.
This set is used only for debugging puroses by
displayAllContinuations()
method.
protected ContinuationsManagerImpl.WebContinuationsHolder continuationsHolder
protected SortedSet expirations
WebContinuation
instances, based on
their expiration time. This is used by the background thread to
invalidate continuations.
protected String instrumentableName
protected ValueInstrument continuationsCount
protected int continuationsCounter
protected ValueInstrument forestSize
protected ValueInstrument expirationsSize
protected CounterInstrument continuationsCreated
protected CounterInstrument continuationsInvalidated
protected boolean isContinuationSharingBugCompatible
protected boolean bindContinuationsToSession
protected ServiceManager serviceManager
protected Context context
Constructor Detail |
---|
public ContinuationsManagerImpl() throws Exception
Exception
Method Detail |
---|
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)
public void configure(Configuration config)
configure
in interface Configurable
Configurable.configure(org.apache.avalon.framework.configuration.Configuration)
public void setInstrumentableName(String instrumentableName)
setInstrumentableName
in interface Instrumentable
Instrumentable.setInstrumentableName(java.lang.String)
public String getInstrumentableName()
getInstrumentableName
in interface Instrumentable
Instrumentable.getInstrumentableName()
public Instrument[] getInstruments()
getInstruments
in interface Instrumentable
Instrumentable.getInstruments()
public Instrumentable[] getChildInstrumentables()
getChildInstrumentables
in interface Instrumentable
Instrumentable.getChildInstrumentables()
public WebContinuation createWebContinuation(Object kont, WebContinuation parent, int timeToLive, String interpreterId, ContinuationsDisposer disposer)
ContinuationsManager
WebContinuation
object given a native
continuation object and its parent. If the parent continuation is
null, the WebContinuation
returned becomes the root
of a tree in the forrest.
createWebContinuation
in interface ContinuationsManager
kont
- an Object
valueparent
- a WebContinuation
valuetimeToLive
- an int
value indicating how long
in seconds this continuation will live in the server if not
accessedinterpreterId
- id of interpreter invoking continuation creationdisposer
- a ContinuationsDisposer
instance to called when
the continuation gets cleaned up.
WebContinuation
valueContinuationsManager.createWebContinuation(java.lang.Object, org.apache.cocoon.components.flow.WebContinuation, int, java.lang.String, org.apache.cocoon.components.flow.ContinuationsDisposer)
protected void handleLeafContinuationExpiration(WebContinuation wk)
protected void handleParentContinuationExpiration(WebContinuation parent)
public WebContinuation lookupWebContinuation(String id, String interpreterId)
ContinuationsManager
WebContinuation
id, retrieve the associated
WebContinuation
object.
lookupWebContinuation
in interface ContinuationsManager
id
- a String
valueinterpreterId
- Id of an interpreter that queries for
the continuation
WebContinuation
object, null if no such
WebContinuation
could be found. Also null if
WebContinuation
was found but interpreter id does
not match the one that the continuation was initialy created for.ContinuationsManager.lookupWebContinuation(java.lang.String, java.lang.String)
protected WebContinuation generateContinuation(Object kont, WebContinuation parent, int ttl, String interpreterId, ContinuationsDisposer disposer)
WebContinuation
and generate unique identifier
for it. The identifier is generated using a cryptographically strong
algorithm to prevent people to generate their own identifiers.
kont
- an Object
value representing continuationparent
- value representing parent WebContinuation
ttl
- WebContinuation
time to liveinterpreterId
- id of interpreter invoking continuation creationdisposer
- ContinuationsDisposer
instance to use for
cleanup of the continuation.
WebContinuation
with unique identifierpublic void invalidateWebContinuation(WebContinuation wk)
ContinuationsManager
WebContinuation
. This effectively
means that the continuation object associated with it will no
longer be accessible from Web pages. Invalidating a
WebContinuation
invalidates all the
WebContinuation
s which are children of it.
invalidateWebContinuation
in interface ContinuationsManager
wk
- a WebContinuation
valueContinuationsManager.invalidateWebContinuation(org.apache.cocoon.components.flow.WebContinuation)
protected void _invalidate(ContinuationsManagerImpl.WebContinuationsHolder continuationsHolder, WebContinuation wk)
protected void disposeContinuation(ContinuationsManagerImpl.WebContinuationsHolder continuationsHolder, WebContinuation wk)
continuationsHolder
- wk
- the continuation to dispose.protected void removeContinuation(ContinuationsManagerImpl.WebContinuationsHolder continuationsHolder, WebContinuation wk)
WebContinuation
node
from its continuation tree, and recursively removes its
parent(s) if it they have expired and have no (other) children.
continuationsHolder
- wk
- WebContinuation
nodeprotected void displayExpireSet()
SortedSet
public void displayAllContinuations()
WebContinuation
s
in the system
displayAllContinuations
in interface ContinuationsManager
WebContinuation.display()
protected void expireContinuations()
protected void invalidateContinuations(ContinuationsManagerImpl.WebContinuationsHolder continuationsHolder)
public ContinuationsManagerImpl.WebContinuationsHolder lookupWebContinuationsHolder(boolean createNew)
createNew
- should the manager create a continuations holder in session
when none found?public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
Contextualizable.contextualize(org.apache.avalon.framework.context.Context)
public List getWebContinuationsDataBeanList()
getWebContinuationsDataBeanList
in interface ContinuationsManager
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |