Class JmcThread
java.lang.Object
java.lang.Thread
org.mpi_sws.jmc.api.util.concurrent.JmcThread
- All Implemented Interfaces:
Runnable
This class is a wrapper around the Java Thread class -
Thread. It is used to
intercept the start, finish, and interrupt events of a thread.
The goal is to replace all references to Thread with JmcThread in bytecode instrumentation.
The method to be overridden is now run1 and similarly the method to join is join1.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new JmcThread object.Constructs a new JmcThread object with the given JMC thread ID.Constructs a new JmcThread object with the given Runnable.Constructs a new JmcThread object with the given Runnable and JMC thread ID. -
Method Summary
Modifier and TypeMethodDescriptionReturns the task ID of this thread.voidjoin1()Replacing the thread join to intercept the join EventvoidReplacing the Thread join to intercept the join Event.voidrun()voidrun1()This method is overridden by the user.voidUsed to run just the function in a wrapped thread and not as a separate thred.voidstart()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, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, startVirtualThread, stop, suspend, threadId, toString, yield
-
Constructor Details
-
JmcThread
public JmcThread()Constructs a new JmcThread object. -
JmcThread
Constructs a new JmcThread object with the given Runnable. -
JmcThread
Constructs a new JmcThread object with the given JMC thread ID. -
JmcThread
Constructs a new JmcThread object with the given Runnable and JMC thread ID.
-
-
Method Details
-
getTaskId
Returns the task ID of this thread.- Returns:
- The task ID of this thread.
-
run
public void run() -
runWithoutJoin
public void runWithoutJoin()Used to run just the function in a wrapped thread and not as a separate thred.Used internally by the Executor service that will invoke threads in a larger thread context.
-
start
public void start() -
run1
This method is overridden by the user.- Throws:
HaltTaskException
-
join1
Replacing the thread join to intercept the join Event- Throws:
InterruptedException- when the underlying join call fails
-
join1
Replacing the Thread join to intercept the join Event.- Throws:
InterruptedException
-