wt.session
Class SessionThread
java.lang.Object
java.lang.Thread
wt.session.SessionThread
- All Implemented Interfaces:
- Runnable
public class SessionThread
- extends Thread
A thread class for executing asynchronous server-side operations under a new or existing
session context. A new method context is established for the thread and a new or
existing session context is associated with the new method context.
For example, the following code shows creating a new thread to continue
processing while the original thread returns method results to the caller.
...
Runnable async_stuff = new Runnable ()
{
public void run ()
{
doAsyncStuff();
}
}
new SessionThread(async_stuff).start();
...
The following code illustrates creating a new session context to perform a background
operation as a different principle.
...
Runnable admin_stuff = new Runnable ()
{
public void run ()
{
try
{
SessionMgr.setPrincipal(AdministrativeDomainHelper.ADMINISTRATOR_NAME);
doAdminStuff();
}
catch (Exception e)
{
e.printStackTrace(System.err);
}
}
}
new SessionThread(admin_stuff, new SessionContext()).start();
...
For simple push/pop of a new session context within a single thread, see the
newContext method in the SessionContext class.
Supported API: true
Extendable: false
- See Also:
SessionContext,
MethodContext
|
Method Summary |
void |
run()
Execute target runnable. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
SessionThread
public SessionThread(Runnable target)
- Construct a session thread that inherits the current session context.
Supported API: true
- Parameters:
target - the Runnable target for the new thread
SessionThread
public SessionThread(Runnable target,
SessionContext session_context)
- Construct a session thread for the given session context.
Supported API: true
- Parameters:
target - the Runnable target for the new threadsession_context - the SessionContext object associated with the thread
run
public void run()
- Execute target runnable.
A new
MethodContext is created which establishes the association between
the executing thread and the desired SessionContext object.
Supported API: true
- Specified by:
run in interface Runnable- Overrides:
run in class Thread
- See Also:
MethodContext,
SessionContext