fr.umlv.corosol.component
Interface JThread

All Superinterfaces:
JObject
All Known Implementing Classes:
DefaultJThread, VerboseJThread

public interface JThread
extends JObject

An object JThread represents a thread in the JVM.

Author:
DELERAY Christophe

Field Summary
static int MAX_PRIORITY
          The maximum priority that a thread can have.
static int MIN_PRIORITY
          The minimum priority that a thread can have.
static int NORM_PRIORITY
          The default priority that is assigned to a thread.
 
Method Summary
 void execNextInstruction()
          Executes the next instruction of the current method.
 JClass getCurrentClass()
          Returns the class of the method being executed.
 JStackFrame getCurrentFrame()
          Returns the current frame of the current method.
 JClassMethod getCurrentMethod()
          Returns the method being executed.
 JavaStack getJavaStack()
          Returns the Java Stack of this thread.
 JOperandInput getOperandInput()
          Returns an input stream that reads the operands of the current bytecode instruction.
 int getPC()
          Returns the program counter value.
 int getPriority()
          Returns this thread's priority.
 boolean hasMoreInstructions()
          Determines if there are instructions to execute.
 void incPC(int offset)
          Increments the program counter with the specified offset value.
 void pushContext(JClassMethod method)
          Pushes the next execution context for the execution of the specified method.
 void restoreContext()
          Restores the thread to its previous execution context.
 void setPC(int pc)
          Sets the program counter with the specified value.
 void setPriority(int newPriority)
          Changes the priority of this thread.
 

Field Detail

MIN_PRIORITY

static final int MIN_PRIORITY
The minimum priority that a thread can have.

See Also:
Constant Field Values

NORM_PRIORITY

static final int NORM_PRIORITY
The default priority that is assigned to a thread.

See Also:
Constant Field Values

MAX_PRIORITY

static final int MAX_PRIORITY
The maximum priority that a thread can have.

See Also:
Constant Field Values
Method Detail

getPriority

int getPriority()
Returns this thread's priority.

Returns:
this thread's priority.
See Also:
setPriority(int), setPriority(int)

setPriority

void setPriority(int newPriority)
Changes the priority of this thread. Tthe priority of this thread is set to the smaller of the specified newPriority and the maximum permitted priority.

Parameters:
newPriority - priority to set this thread to
Throws:
java.lang.IllegalArgumentException - if the priority is not in the range MIN_PRIORITY to MAX_PRIORITY.
See Also:
getPriority(), MAX_PRIORITY, NORM_PRIORITY, MIN_PRIORITY

getJavaStack

JavaStack getJavaStack()
Returns the Java Stack of this thread.


getCurrentClass

JClass getCurrentClass()
Returns the class of the method being executed.


getCurrentFrame

JStackFrame getCurrentFrame()
Returns the current frame of the current method.


getCurrentMethod

JClassMethod getCurrentMethod()
Returns the method being executed.


getPC

int getPC()
Returns the program counter value.


setPC

void setPC(int pc)
Sets the program counter with the specified value.

Parameters:
pc - the program counter

incPC

void incPC(int offset)
Increments the program counter with the specified offset value.

Parameters:
offset - a value for increment the current program counter

pushContext

void pushContext(JClassMethod method)
Pushes the next execution context for the execution of the specified method.

Parameters:
method - the method to be executed

restoreContext

void restoreContext()
Restores the thread to its previous execution context.


hasMoreInstructions

boolean hasMoreInstructions()
Determines if there are instructions to execute.

Returns:
true if there are instructions to execute and false otherwise.

execNextInstruction

void execNextInstruction()
                         throws java.lang.Throwable
Executes the next instruction of the current method.

Throws:
java.lang.IllegalStateException - if there isn't instruction to execute
java.lang.Throwable - if an exception occurs during execution

getOperandInput

JOperandInput getOperandInput()
Returns an input stream that reads the operands of the current bytecode instruction.

Returns:
an input stream reading the current instruction operands