public abstract class InterruptibleBatchThread extends InterruptibleThread implements BatchControllable, CoreRunnable
A different concept is to define interruptible processes without immediate decision to
run them in an own thread, see {@link InterruptibleProcess2}. Thus, the same process
can be performed inside a thread or sequentially, dependent on the context.
,
DesktopProcessRunner
,
ServerProcessRunner
Modifier and Type | Field and Description |
---|---|
protected SessionResources |
sessionResources |
threadController
threadDoneListeners
GROUP_TERMINATION_ALLOWED_WITHOUT_CONFIRMATION, GROUP_TERMINATION_NOT_ALLOWED, GROUP_TERMINATION_REQUIRES_CONFIRMATION
Constructor and Description |
---|
InterruptibleBatchThread(SessionResources sessionResources)
Constructs a new interruptible batch thread.
|
InterruptibleBatchThread(SessionResources sessionResources,
boolean terminationRequiresUserConfirmation)
Constructs a new interruptible batch thread.
|
InterruptibleBatchThread(SessionResources sessionResources,
java.lang.String name)
Constructs a new interruptible batch thread.
|
Modifier and Type | Method and Description |
---|---|
SessionResources |
getSessionResources() |
protected boolean |
isTerminationRequested()
Returns true if termination is requested.
|
boolean |
isToRun()
Returns true if the thread is to be continued.
|
boolean |
requiresUserConfirmationToTerminate()
Returns true of process requires user confirmation to terminate it.
|
void |
runCore()
Runs the core functionality to be defined by sub class.
|
void |
setTerminationRequiresUserConfirmation(boolean b) |
void |
start()
Causes this thread to begin execution; the Java Virtual Machine
calls the
run method of this thread. |
void |
terminate()
Terminates the thread.
|
free, register, register, run, runPartAfterCore, setStatusInformation, setThreadController
addThreadDoneListener, fireThreadDone, fireThreadDone, getEventMessage, getFinalState, idle, logDebug, logError, logError, logInfo, setEventErrorMessage, setEventMessage, setFinalState
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, stop, stop, suspend, toString, yield
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getName
addThreadDoneListener, setThreadController
runCore
protected SessionResources sessionResources
public InterruptibleBatchThread(SessionResources sessionResources)
sessionResources
- the session resources to usepublic InterruptibleBatchThread(SessionResources sessionResources, java.lang.String name)
sessionResources
- the session resources to usename
- the name of the thread - describing what it is doingpublic InterruptibleBatchThread(SessionResources sessionResources, boolean terminationRequiresUserConfirmation)
sessionResources
- the session resources to useterminationAtAnyTime
- whether or not this thread requires explicit user confirmation to terminaten itpublic void setTerminationRequiresUserConfirmation(boolean b)
public boolean requiresUserConfirmationToTerminate()
BatchControllable
requiresUserConfirmationToTerminate
in interface BatchControllable
public SessionResources getSessionResources()
public void start()
Controllable
run
method of this thread.
The result is that two threads are running concurrently: the
current thread (which returns from the call to the
start
method) and the other thread (which executes its
run
method).
start
in interface Controllable
start
in class java.lang.Thread
Thread.run()
public final void runCore()
Controllable
runCore
in interface Controllable
public boolean isToRun()
InterruptibleThread
isToRun
in class InterruptibleThread
public void terminate()
BatchControllable
terminate
in interface BatchControllable
protected boolean isTerminationRequested()
Copyright 1998-2023 Christoph Mueller, Kaerntner Str. 56, D-70469 Stuttgart, Germany, https://www.perpus.de