Class JmcThread

java.lang.Object
java.lang.Thread
org.mpi_sws.jmc.api.util.concurrent.JmcThread
All Implemented Interfaces:
Runnable

public class JmcThread extends Thread
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.

  • Constructor Details

    • JmcThread

      public JmcThread()
      Constructs a new JmcThread object.
    • JmcThread

      public JmcThread(Runnable r)
      Constructs a new JmcThread object with the given Runnable.
    • JmcThread

      public JmcThread(Long jmcThreadId)
      Constructs a new JmcThread object with the given JMC thread ID.
    • JmcThread

      public JmcThread(Runnable r, Long jmcThreadId)
      Constructs a new JmcThread object with the given Runnable and JMC thread ID.
  • Method Details

    • getTaskId

      public Long getTaskId()
      Returns the task ID of this thread.
      Returns:
      The task ID of this thread.
    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • 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()
      Overrides:
      start in class Thread
    • run1

      public void run1() throws HaltTaskException
      This method is overridden by the user.
      Throws:
      HaltTaskException
    • join1

      public void join1() throws InterruptedException
      Replacing the thread join to intercept the join Event
      Throws:
      InterruptedException - when the underlying join call fails
    • join1

      public void join1(Long millis) throws InterruptedException
      Replacing the Thread join to intercept the join Event.
      Throws:
      InterruptedException