java.lang.Object
java.lang.Thread
org.apache.jena.geosparql.spatial.task.TaskThread
Thread base class that provides a
abort() method that can run a custom action
(in addition to setting the interrupted flag) as well as a doAfterRun() method
for cleaning up after execution (only gets called if there is a prior call to run).-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandlerNested classes/interfaces inherited from interface org.apache.jena.geosparql.spatial.task.BasicTask
BasicTask.TaskListener<T extends BasicTask> -
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionTaskThread(String label, BasicTask.TaskListener<BasicTask> taskListener) TaskThread(String label, BasicTask.TaskListener<BasicTask> taskListener, AtomicBoolean requestingCancel) -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()longlonglonggetLabel()A label for the task.longGet the last status message of the task.If non null, the throwable that is the cause for an exceptional termination of the task.booleanWhether abort has been called.final voidrun()abstract voidThe actual "run" method that must be implemented.final voidMethods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yieldMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.jena.geosparql.spatial.task.BasicTask
isTerminated
-
Constructor Details
-
TaskThread
-
TaskThread
public TaskThread(String label, BasicTask.TaskListener<BasicTask> taskListener, AtomicBoolean requestingCancel)
-
-
Method Details
-
getLabel
Description copied from interface:BasicTaskA label for the task. -
getTaskState
- Specified by:
getTaskStatein interfaceBasicTask
-
getThrowable
Description copied from interface:BasicTaskIf non null, the throwable that is the cause for an exceptional termination of the task.- Specified by:
getThrowablein interfaceBasicTask
-
getCreationTime
public long getCreationTime()- Specified by:
getCreationTimein interfaceBasicTask
-
getStartTime
public long getStartTime()- Specified by:
getStartTimein interfaceBasicTask
-
getEndTime
public long getEndTime()- Specified by:
getEndTimein interfaceBasicTask
-
getAbortTime
public long getAbortTime()- Specified by:
getAbortTimein interfaceBasicTask
-
getStatusMessage
Description copied from interface:BasicTaskGet the last status message of the task. May be null.- Specified by:
getStatusMessagein interfaceBasicTask
-
run
public final void run() -
runInternal
public final void runInternal() -
runActual
The actual "run" method that must be implemented.- Throws:
Exception
-
abort
public void abort() -
isAborting
public boolean isAborting()Description copied from interface:BasicTaskWhether abort has been called.- Specified by:
isAbortingin interfaceBasicTask
-