org.apache.ode.jacob.vpu
Class JacobVPU

java.lang.Object
  extended by org.apache.ode.jacob.vpu.JacobVPU

public final class JacobVPU
extends java.lang.Object

The JACOB Virtual Processing Unit ("VPU").


Constructor Summary
JacobVPU()
          Default constructor.
JacobVPU(ExecutionQueue executionQueue)
          Re-hydration constructor.
JacobVPU(ExecutionQueue context, JacobRunnable concretion)
          Instantiation constructor; used to initialize context with the concretion of a process abstraction.
 
Method Summary
static JacobThread activeJacobThread()
          Get the active Jacob thread, i.e.
 void addReaction(JacobObject jo, java.lang.reflect.Method method, java.lang.Object[] args, java.lang.String desc)
          Add an item to the run queue.
 void dumpState()
          Dump the state of the VPU for debugging purposes.
 boolean execute()
          Execute one VPU cycle.
 void flush()
           
 void inject(JacobRunnable concretion)
          Inject a concretion into the process context.
 boolean isComplete()
           
 void registerExtension(java.lang.Class extensionClass, java.lang.Object obj)
           
 void setClassLoader(java.lang.ClassLoader classLoader)
           
 void setContext(ExecutionQueue executionQueue)
          Set the state of of the VPU; this is analagous to loading a CPU with a thread's context (re-hydration).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JacobVPU

public JacobVPU()
Default constructor.


JacobVPU

public JacobVPU(ExecutionQueue executionQueue)
Re-hydration constructor.

Parameters:
executionQueue - previously saved execution context

JacobVPU

public JacobVPU(ExecutionQueue context,
                JacobRunnable concretion)
Instantiation constructor; used to initialize context with the concretion of a process abstraction.

Parameters:
context - virgin context object
concretion - the process
Method Detail

execute

public boolean execute()
Execute one VPU cycle.

Returns:
true if the run queue is not empty after this cycle, false otherwise.

flush

public void flush()

setContext

public void setContext(ExecutionQueue executionQueue)
Set the state of of the VPU; this is analagous to loading a CPU with a thread's context (re-hydration).

Parameters:
executionQueue - process executionQueue (state)

registerExtension

public void registerExtension(java.lang.Class extensionClass,
                              java.lang.Object obj)

addReaction

public void addReaction(JacobObject jo,
                        java.lang.reflect.Method method,
                        java.lang.Object[] args,
                        java.lang.String desc)
Add an item to the run queue.


activeJacobThread

public static JacobThread activeJacobThread()
Get the active Jacob thread, i.e. the one associated with the current Java thread.


inject

public void inject(JacobRunnable concretion)
Inject a concretion into the process context. This amounts to chaning the process context from P to P|Q where P is the previous process context and Q is the injected process. This method is equivalent to the parallel operator, but is intended to be used from outside of an active JacobThread.


setClassLoader

public void setClassLoader(java.lang.ClassLoader classLoader)

dumpState

public void dumpState()
Dump the state of the VPU for debugging purposes.


isComplete

public boolean isComplete()