public class AssociatedThread
extends java.lang.Thread
Modifier and Type | Field and Description |
---|---|
private SecurityContext |
context
Any pending security context switch or
null . |
private java.lang.Runnable |
core
The core logic that will be executed.
|
private SecurityManager |
sm
Security Manager instance.
|
private SecurityContextStack |
stack
The security context of the instantiating thread.
|
Constructor and Description |
---|
AssociatedThread(java.lang.Runnable core)
Constructor which allows the core logic to be specified.
|
Modifier and Type | Method and Description |
---|---|
void |
morphContextIfNeeded()
Switch security contexts on the current thread if a switch is pending.
|
void |
run()
This method will be invoked when the thread is started, it sets up the
initial security context to match the saved context of the instantiating
thread, then it will call the core logic specified by the caller and
drop the security context after that logic is done.
|
void |
setPendingContextSwitch(java.lang.Object context)
Save the given context as a pending context switch which will be
processed later by the key reading thread.
|
activeCount, checkAccess, clone, 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
private java.lang.Runnable core
private SecurityContextStack stack
private SecurityContext context
null
.private SecurityManager sm
public AssociatedThread(java.lang.Runnable core) throws java.lang.NullPointerException
core
- The logic to execute when the thread is started. Must not be
null
.java.lang.NullPointerException
- If the instantiating thread has no security context or if the
core
is null
.public void setPendingContextSwitch(java.lang.Object context)
context
- The security context to switch to (if non-null).public void morphContextIfNeeded()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread