org.jactr.tools.misc
Class ExecutionUtilities

java.lang.Object
  extended by org.jactr.tools.misc.ExecutionUtilities

public class ExecutionUtilities
extends java.lang.Object

some general purpose utilities invoking code on the model thread. executeLater(IModel, Runnable) and executeLater(IModel, Runnable, Runnable) both wrap the runnables in ITimedEvents that are posted onto the IModel's TimedEventQueue.
executeNow(IModel, Runnable) uses the ModelCycleExecutor to fire the runnable ModelCycleExecutor.When#ASAP.

Author:
harrison

Constructor Summary
ExecutionUtilities()
           
 
Method Summary
static java.util.concurrent.Future<java.lang.Boolean> executeLater(org.jactr.core.model.IModel model, java.lang.Runnable onFire)
           
static java.util.concurrent.Future<java.lang.Boolean> executeLater(org.jactr.core.model.IModel model, java.lang.Runnable onFire, java.lang.Runnable onAbort)
          will execute the runnable on the model thread at the earliest possible moment.
static java.util.concurrent.Future<java.lang.Boolean> executeNow(org.jactr.core.model.IModel model, java.lang.Runnable onFire)
          post this runnable to execute after the current cycle finishes
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecutionUtilities

public ExecutionUtilities()
Method Detail

executeLater

public static java.util.concurrent.Future<java.lang.Boolean> executeLater(org.jactr.core.model.IModel model,
                                                                          java.lang.Runnable onFire,
                                                                          java.lang.Runnable onAbort)
                                                                   throws java.lang.IllegalStateException
will execute the runnable on the model thread at the earliest possible moment. This allows you to specify different runnables for the timedevent if it is fired or aborted. This method uses ITimedEvents to handle the execution

Parameters:
model -
runnable -
Returns:
future boolean if the runnable was fired (false if aborted)
Throws:
java.lang.IllegalStateException - if the model is not running

executeNow

public static java.util.concurrent.Future<java.lang.Boolean> executeNow(org.jactr.core.model.IModel model,
                                                                        java.lang.Runnable onFire)
post this runnable to execute after the current cycle finishes

Parameters:
model -
onFire -
Returns:

executeLater

public static java.util.concurrent.Future<java.lang.Boolean> executeLater(org.jactr.core.model.IModel model,
                                                                          java.lang.Runnable onFire)
                                                                   throws java.lang.IllegalStateException
Throws:
java.lang.IllegalStateException