Class WorkerThread
java.lang.Object
java.lang.Thread
nl.tudelft.simulation.language.concurrent.WorkerThread
- All Implemented Interfaces:
Runnable
The WorkerThread is a working thread. The thread sleeps while not interrupted. If interrupted the job.run operation is
invoked.
Copyright (c) 2002-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://https://simulation.tudelft.nl/dsol/docs/latest/license.html.
- Author:
- Peter H.M. Jacobs, Alexander Verbraeck
-
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
ConstructorDescriptionWorkerThread
(String name, Runnable job) constructs a new SimulatorRunThread. -
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
-
WorkerThread
constructs a new SimulatorRunThread.- Parameters:
name
- String; the name of the threadjob
- Runnable; the job to run
-
-
Method Details
-
cleanUp
public void cleanUp()Clean up the worker thread. synchronized method, otherwise it does not own the Monitor on the wait. -
isRunning
public boolean isRunning()- Returns:
- whether the run method of the job is running or not
-
run
public void run()
-