|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ix.util.context.ContextHoldingStrategy ix.util.context.ThreadLocalHoldingStrategy
public class ThreadLocalHoldingStrategy
A context-holding strategy that associates context-holders with
threads. The holder for a thread is created by the initialHolder()
method. (In some cases, it may be better to override that method to
have it return null, so that the holder must be explicitly set.)
More than one thread may be given the same context-holder, however
this must be done with care, because some objects that use contexts
frequently change their current context, and two threads doing that
with the same holder could confuse each other.
Field Summary | |
---|---|
protected java.lang.ThreadLocal<ContextHolder> |
threadContextHolder
|
Constructor Summary | |
---|---|
ThreadLocalHoldingStrategy()
|
Method Summary | |
---|---|
void |
clearContexts()
Clears contexts in the current thread's holder by telling it to set its current context to the root context. |
ContextHolder |
getContextHolder()
Returns the ContextHolder for the current thread. |
protected ContextHolder |
initialHolder()
Called to create a holder for a thread that doesn't already have one. |
void |
setContextHolder(ContextHolder h)
Sets the ContextHolder for the current thread. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.ThreadLocal<ContextHolder> threadContextHolder
Constructor Detail |
---|
public ThreadLocalHoldingStrategy()
Method Detail |
---|
protected ContextHolder initialHolder()
BasicContextHolder
.
public ContextHolder getContextHolder()
getContextHolder
in class ContextHoldingStrategy
public void setContextHolder(ContextHolder h)
setContextHolder
in class ContextHoldingStrategy
public void clearContexts()
clearContexts
in class ContextHoldingStrategy
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |