- All Implemented Interfaces:
public class SubjectCallable<V>
- extends Object
- implements Callable<V>
When instances of this class execute (typically via a
SubjectCallable associates a
Subject with a target/delegate
Callable to ensure proper
Subject thread-state management when the
This ensures that any calls to
during the target
Callable's execution still work correctly even if the
Callable executes on a
different thread than the one that created it. This allows
Subject access during asynchronous operations.
the following occurs:
This behavior ensures that the thread that executes this
- The specified Subject any of its associated thread state is first bound to the thread that executes the
- The delegate/target
- The previous thread state that might have existed before the
Subject was bound is fully restored
Callable, which is often a different thread than
the one that created the instance, retains a
Subject to support
invocations. It also guarantees that the running thread remains 'clean' in any thread-pooled environments.
This is typically considered a support class and is not often directly referenced. Most people prefer to use
associateWith method, which will automatically return
an instance of this class.
An even more convenient alternative is to use a
transparently uses instances of this class.
- See Also:
|Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected final ThreadState threadState
public SubjectCallable(Subject subject,
protected SubjectCallable(ThreadState threadState,
public V call()
- Specified by:
call in interface
protected V doCall(Callable<V> target)
Copyright © 2004-2014 The Apache Software Foundation. All Rights Reserved.