Package wt.session
Class SessionThread
java.lang.Object
java.lang.Thread
wt.session.SessionThread
- All Implemented Interfaces:
Runnable
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.
Supported API: true
Extendable: false
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionSessionThread(Runnable target) Construct a session thread that inherits the current session context.SessionThread(Runnable target, SessionContext session_context) Construct a session thread for the given session context.SessionThread(Runnable target, SessionContext session_context, String name) Construct a session thread for the given session context. -
Method Summary
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Constructor Details
-
SessionThread
Construct a session thread that inherits the current session context.
Supported API: true- Parameters:
target- theRunnabletarget for the new thread
-
SessionThread
Construct a session thread for the given session context.
Supported API: true- Parameters:
target- theRunnabletarget for the new threadsession_context- theSessionContextobject associated with the thread
-
SessionThread
Construct a session thread for the given session context.
Supported API: true- Parameters:
target- theRunnabletarget for the new threadsession_context- theSessionContextobject associated with the threadname- the name to give the resulting thread
-
-
Method Details