ActiveThread

public class ActiveThread implements Runnable

ActiveThread is a thread which executes its associated task and manages the retry of the task. An active thread may or may not be managed by an active monitor.

Author:Hugo Y. K. Lam

See also: ActiveTask, ActiveMonitor

Constructors

ActiveThread

public ActiveThread()

Creates a new instance of ActiveThread.

ActiveThread

public ActiveThread(ActiveMonitor monitor)

Creates a new instance of ActiveThread.

Parameters:
  • monitor – the active monitor from which this active thread is acquired.

Methods

getTask

public ActiveTask getTask()

Gets the active task of this thread.

Returns:the active task of this thread.

run

public void run()

Executes its associated task and manages the retry of the task.

See also: java.lang.Runnable.run()

setTask

public void setTask(ActiveTask task)

Sets the active task of this thread.

Parameters:
  • task – the active task to be executed.

start

public void start()

Starts a new thread to execute the associated task.

See also: .run()