public abstract class ThreadLocalCyclicDependencyGuard extends java.lang.ThreadLocal implements CyclicDependencyGuard
run()
.
The method will be called by observe(java.lang.Class)
. Select
an appropriate guard for your scope. Any ObjectReference
can be
used as long as it is initialized with Boolean.FALSE
.Constructor and Description |
---|
ThreadLocalCyclicDependencyGuard() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object |
initialValue() |
java.lang.Object |
observe(java.lang.Class stackFrame)
Call the observing function.
|
abstract java.lang.Object |
run()
Derive from this class and implement this function with the functionality
to observe for a dependency cycle.
|
protected java.lang.Object initialValue()
initialValue
in class java.lang.ThreadLocal
public abstract java.lang.Object run()
run
in interface CyclicDependencyGuard
null
public final java.lang.Object observe(java.lang.Class stackFrame)
Boolean
value.
If the guard is already Boolean.TRUE
a CyclicDependencyException
will be thrown.observe
in interface CyclicDependencyGuard
stackFrame
- the current stack framerun
method