DRCL JavaSim API

drcl.comp
Class ACARuntime

java.lang.Object
  |
  +--drcl.DrclObj
        |
        +--drcl.comp.ForkManager
              |
              +--drcl.comp.ACARuntime
All Implemented Interfaces:
java.lang.Cloneable, ObjectDuplicable, java.io.Serializable
Direct Known Subclasses:
ARuntime, SESimulator

public abstract class ACARuntime
extends ForkManager

Defines the interface of an ACA runtime.

See Also:
Serialized Form

Field Summary
 boolean debug
           
static ACARuntime DEFAULT_RUNTIME
           
 boolean logenabled
           
protected  java.lang.String name
           
 boolean resetting
          Whether the runtime is in resetting or not.
protected  java.lang.String state
           
static java.lang.String State_INACTIVE
          State of no thread running or waiting to be started.
static java.lang.String State_RUNNING
          State of have threads running.
static java.lang.String State_SUSPENDED
          State of system suspended.
protected static java.io.FileWriter tf
           
protected  double timeScale
           
protected  double timeScaleReciprocal
           
protected  TraceManager tr
           
protected  java.util.Vector vStateListener
           
 
Fields inherited from class drcl.comp.ForkManager
parent, runtime
 
Constructor Summary
ACARuntime()
           
ACARuntime(java.lang.String name_)
           
 
Method Summary
protected abstract  double _getTime()
          Asynchronized version of getTime(), for diagnosis.
protected  void _openlog()
           
protected abstract  void _stop(boolean block_)
           
 java.lang.String a_info()
          Asynchronous version of diag().
abstract  java.lang.String a_info(boolean listWaitingTasks_)
          Asynchronous version of diag(boolean).
 void addDebugLevel(java.lang.String trace_)
           
 void addRunnable(double later_, Port port_, java.lang.Runnable task_)
           
 void addRunnable(double later_, java.lang.Runnable task_)
           
 void addRunnableAt(double time_, Port port_, java.lang.Runnable task_)
           
 void addRunnableAt(double time_, java.lang.Runnable task_)
           
 void addStateListener(java.beans.PropertyChangeListener l_)
           
protected  void childManager(ForkManager child_, double time_)
          Sets up an event for childManager.
 boolean containsDebugLevel(java.lang.String trace_)
           
 java.lang.String debug_info()
           
 java.lang.String diag()
          Returns more detailed information of this runtime, for diagnosis purpose.
 java.lang.String diag(boolean listWaitingTasks_)
          Returns more detailed information of this runtime, for diagnosis purpose.
protected  void finalized()
           
 java.lang.String[] getAllDebugLevels()
           
 java.beans.PropertyChangeListener[] getAllStateListeners()
           
abstract  java.lang.Object getEventQueue()
           
abstract  double getEventRate()
          Returns the event processing rate of this runtime.
 java.lang.String getName()
           
abstract  long getNumberOfArrivalEvents()
          Returns the number of arrival events.
 ForkManager getParent()
           
 java.lang.String getState()
           
 double getTime()
          Returns the system current time in second.
 double getTimeScale()
           
abstract  long getWallTimeElapsed()
          Returns the actual time (in ms) for which this runtime has participated.
abstract  java.lang.String info()
          Returns general information of this runtime.
 boolean isDebugEnabled()
           
 boolean isDebugEnabledAt(java.lang.String which_)
           
 boolean isIdle()
          Returns true if the runtime is stopped (inactive or suspended) or running but all working threads are waiting.
 boolean isRunning()
          Returns true if the runtime is running.
 boolean isStopped()
          Returns true if the runtime is either inactive or suspended.
 boolean isSuspended()
          Returns true if the runtime is suspended.
protected abstract  void newTask(Task task_, WorkerThread current_)
          The only way to trigger new tasks to be executed.
 void notifyStateListeners(java.beans.PropertyChangeEvent e_)
           
protected abstract  void off(ACATimer handle_)
          Cancels a fork event.
protected  void process(WorkerThread current_, double now_)
          For a parent fork manager to notify its child manager of processing expired fork events.
 void reboot()
           
protected  ACATimer receive(Port p_, java.lang.Object evt_, double duration_)
          Sets up a "receive" event.
protected  ACATimer receiveAt(Port p_, java.lang.Object evt_, double time_)
          Sets up a "receive" event.
 void removeDebugLevel(java.lang.String trace_)
           
 void removeStateListener(java.beans.PropertyChangeListener l_)
           
abstract  void reset()
          The workerpool enters a transitional period when reset() is issued.
abstract  void resume()
          Resumes the system.
 void resumeFor(double later_)
          Resumes the system and lets it run for the time duration specified.
 void resumeTo(double time_)
          Resumes the system and lets it run for the time duration specified.
protected  ACATimer send(Port p_, java.lang.Object evt_, double duration_)
          Sets up a "send" event.
protected  ACATimer sendAt(Port p_, java.lang.Object evt_, double time_)
          Sets up a "send" event.
 void setDebugEnabled(boolean enabled_)
           
 void setDebugEnabledAt(java.lang.String level_, boolean enabled_)
           
 void setDebugLevels(java.lang.String[] traces_)
           
 void setMaxWorkforce(int maxwf_)
           
 void setName(java.lang.String name_)
           
 void setParent(ForkManager parent_)
           
 void setRuntime(ACARuntime runtime_)
           
protected  void setState(java.lang.String new_)
           
 void setTimeScale(double e_)
          Time scale is the ratio of wall time over system time.
 void stop()
          Stops the system.
 void stop(double later_)
          Stops the system at the time specified later.
 void stopAt(double time_)
          Stops the system at the time specified.
 java.lang.String t_info()
           
protected abstract  java.lang.String t_info(java.lang.String prefix_)
           
 void takeover(Component c_)
          Takes over as the fork manager of the component system under c_.
 void takeover(java.lang.Object[] oo_)
           
 java.lang.String toString()
           
 java.lang.String tr_info()
           
 
Methods inherited from class drcl.comp.ForkManager
a_list, getRuntime, info, list, takeover
 
Methods inherited from class drcl.DrclObj
clone, duplicate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_RUNTIME

public static final ACARuntime DEFAULT_RUNTIME

State_INACTIVE

public static final java.lang.String State_INACTIVE
State of no thread running or waiting to be started.

State_RUNNING

public static final java.lang.String State_RUNNING
State of have threads running.

State_SUSPENDED

public static final java.lang.String State_SUSPENDED
State of system suspended.

debug

public boolean debug

name

protected java.lang.String name

state

protected java.lang.String state

timeScale

protected double timeScale

timeScaleReciprocal

protected double timeScaleReciprocal

resetting

public transient boolean resetting
Whether the runtime is in resetting or not.

logenabled

public boolean logenabled

tf

protected static java.io.FileWriter tf

vStateListener

protected transient java.util.Vector vStateListener

tr

protected TraceManager tr
Constructor Detail

ACARuntime

public ACARuntime()

ACARuntime

public ACARuntime(java.lang.String name_)
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class ForkManager

takeover

public void takeover(java.lang.Object[] oo_)

takeover

public void takeover(Component c_)
Description copied from class: ForkManager
Takes over as the fork manager of the component system under c_.
Overrides:
takeover in class ForkManager

newTask

protected abstract void newTask(Task task_,
                                WorkerThread current_)
The only way to trigger new tasks to be executed.

_openlog

protected void _openlog()

setTimeScale

public void setTimeScale(double e_)
Time scale is the ratio of wall time over system time.

getTimeScale

public double getTimeScale()

setName

public void setName(java.lang.String name_)
Overrides:
setName in class ForkManager

getName

public java.lang.String getName()
Overrides:
getName in class ForkManager

setMaxWorkforce

public void setMaxWorkforce(int maxwf_)

info

public abstract java.lang.String info()
Returns general information of this runtime.

diag

public java.lang.String diag()
Returns more detailed information of this runtime, for diagnosis purpose.

diag

public java.lang.String diag(boolean listWaitingTasks_)
Returns more detailed information of this runtime, for diagnosis purpose.

a_info

public java.lang.String a_info()
Asynchronous version of diag().

a_info

public abstract java.lang.String a_info(boolean listWaitingTasks_)
Asynchronous version of diag(boolean).
Overrides:
a_info in class ForkManager

addRunnable

public final void addRunnable(double later_,
                              java.lang.Runnable task_)

addRunnableAt

public final void addRunnableAt(double time_,
                                java.lang.Runnable task_)

addRunnable

public final void addRunnable(double later_,
                              Port port_,
                              java.lang.Runnable task_)

addRunnableAt

public final void addRunnableAt(double time_,
                                Port port_,
                                java.lang.Runnable task_)

getNumberOfArrivalEvents

public abstract long getNumberOfArrivalEvents()
Returns the number of arrival events.

getEventRate

public abstract double getEventRate()
Returns the event processing rate of this runtime.

getTime

public double getTime()
Returns the system current time in second.

_getTime

protected abstract double _getTime()
Asynchronized version of getTime(), for diagnosis. Subclasses should override this method to provide its own time mapping function.

stop

public final void stop()
Stops the system. The state must be SUSPENDED when the method returns.

_stop

protected abstract void _stop(boolean block_)

resume

public abstract void resume()
Resumes the system. The state must advance to RUNNING when this method returns.

stop

public final void stop(double later_)
Stops the system at the time specified later.

stopAt

public final void stopAt(double time_)
Stops the system at the time specified.

resumeFor

public final void resumeFor(double later_)
Resumes the system and lets it run for the time duration specified. The state must advance to RUNNING when this method returns.

resumeTo

public final void resumeTo(double time_)
Resumes the system and lets it run for the time duration specified. The state must advance to RUNNING when this method returns.

reset

public abstract void reset()
The workerpool enters a transitional period when reset() is issued. It waits for all the working thread to either finishes the job or goes into sleep. After all the threads finish jobs, it releases all the threads by kill()ing them.
Overrides:
reset in class ForkManager

getWallTimeElapsed

public abstract long getWallTimeElapsed()
Returns the actual time (in ms) for which this runtime has participated.

t_info

public java.lang.String t_info()

t_info

protected abstract java.lang.String t_info(java.lang.String prefix_)

reboot

public void reboot()

addStateListener

public void addStateListener(java.beans.PropertyChangeListener l_)

removeStateListener

public void removeStateListener(java.beans.PropertyChangeListener l_)

getAllStateListeners

public java.beans.PropertyChangeListener[] getAllStateListeners()

notifyStateListeners

public void notifyStateListeners(java.beans.PropertyChangeEvent e_)

getState

public java.lang.String getState()

setState

protected void setState(java.lang.String new_)

isRunning

public boolean isRunning()
Returns true if the runtime is running.

isStopped

public boolean isStopped()
Returns true if the runtime is either inactive or suspended.

isSuspended

public boolean isSuspended()
Returns true if the runtime is suspended.

isIdle

public boolean isIdle()
Returns true if the runtime is stopped (inactive or suspended) or running but all working threads are waiting.

tr_info

public java.lang.String tr_info()

setDebugEnabled

public void setDebugEnabled(boolean enabled_)
Overrides:
setDebugEnabled in class ForkManager

isDebugEnabled

public boolean isDebugEnabled()
Overrides:
isDebugEnabled in class ForkManager

isDebugEnabledAt

public boolean isDebugEnabledAt(java.lang.String which_)

getAllDebugLevels

public java.lang.String[] getAllDebugLevels()

setDebugLevels

public void setDebugLevels(java.lang.String[] traces_)

addDebugLevel

public void addDebugLevel(java.lang.String trace_)

removeDebugLevel

public void removeDebugLevel(java.lang.String trace_)

containsDebugLevel

public boolean containsDebugLevel(java.lang.String trace_)

setDebugEnabledAt

public void setDebugEnabledAt(java.lang.String level_,
                              boolean enabled_)

debug_info

public java.lang.String debug_info()

finalized

protected void finalized()

receive

protected ACATimer receive(Port p_,
                           java.lang.Object evt_,
                           double duration_)
Description copied from class: ForkManager
Sets up a "receive" event.
Overrides:
receive in class ForkManager
Following copied from class: drcl.comp.ForkManager
Returns:
a handle to cancel the event.

receiveAt

protected ACATimer receiveAt(Port p_,
                             java.lang.Object evt_,
                             double time_)
Description copied from class: ForkManager
Sets up a "receive" event.
Overrides:
receiveAt in class ForkManager
Following copied from class: drcl.comp.ForkManager
Returns:
a handle to cancel the event.

send

protected ACATimer send(Port p_,
                        java.lang.Object evt_,
                        double duration_)
Description copied from class: ForkManager
Sets up a "send" event.
Overrides:
send in class ForkManager
Following copied from class: drcl.comp.ForkManager
Returns:
a handle to cancel the event.

sendAt

protected ACATimer sendAt(Port p_,
                          java.lang.Object evt_,
                          double time_)
Description copied from class: ForkManager
Sets up a "send" event.
Overrides:
sendAt in class ForkManager
Following copied from class: drcl.comp.ForkManager
Returns:
a handle to cancel the event.

childManager

protected void childManager(ForkManager child_,
                            double time_)
Description copied from class: ForkManager
Sets up an event for childManager. A child manager calls this method of its parent to sets itself up in parent's event queue.
Overrides:
childManager in class ForkManager

process

protected void process(WorkerThread current_,
                       double now_)
Description copied from class: ForkManager
For a parent fork manager to notify its child manager of processing expired fork events.
Overrides:
process in class ForkManager

getParent

public ForkManager getParent()
Overrides:
getParent in class ForkManager

setParent

public void setParent(ForkManager parent_)
Overrides:
setParent in class ForkManager

setRuntime

public void setRuntime(ACARuntime runtime_)
Overrides:
setRuntime in class ForkManager

off

protected abstract void off(ACATimer handle_)
Description copied from class: ForkManager
Cancels a fork event.
Overrides:
off in class ForkManager

getEventQueue

public abstract java.lang.Object getEventQueue()

DRCL JavaSim API

Copyright © 2001 - DRCL, OSU     ~ Back to JavaSim Home ~