Jadex 0.941

jadex.runtime
Class JavaStandardPlanExecutor

java.lang.Object
  extended byjadex.runtime.JavaStandardPlanExecutor
All Implemented Interfaces:
IPlanExecutor, Serializable

public class JavaStandardPlanExecutor
extends Object
implements IPlanExecutor, Serializable

A plan executor for plans that run on their own thread and therefore may perform blocking wait operations. Plan bodies have to inherit from @link{Plan}.

See Also:
Serialized Form

Field Summary
static String MAX_PLANSTEP_TIME
           
 
Constructor Summary
JavaStandardPlanExecutor(jadex.runtime.impl.RBDIAgent agent)
          Create a new threadbased plan executor.
 
Method Summary
 Object createPlanBody(jadex.runtime.impl.RPlan plan)
          Create the body of a plan.
 jadex.runtime.impl.IREvent eventWaitFor(jadex.runtime.impl.RPlan rplan, jadex.runtime.impl.WaitAbstraction wa)
          Called from a plan.
 boolean executePlanStep(jadex.runtime.impl.RPlan plan)
          Execute a step of a plan.
 Thread getExecutionThread(jadex.runtime.impl.RPlan rplan)
          Get the executing thread of a plan.
 void interruptPlanStep(jadex.runtime.impl.RPlan plan)
          Interrupt a plan step during execution.
 void terminatePlan(jadex.runtime.impl.RPlan rplan)
          Called on termination of a plan.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_PLANSTEP_TIME

public static final String MAX_PLANSTEP_TIME
See Also:
Constant Field Values
Constructor Detail

JavaStandardPlanExecutor

public JavaStandardPlanExecutor(jadex.runtime.impl.RBDIAgent agent)
Create a new threadbased plan executor.

Method Detail

createPlanBody

public Object createPlanBody(jadex.runtime.impl.RPlan plan)
                      throws Exception
Create the body of a plan.

Specified by:
createPlanBody in interface IPlanExecutor
Parameters:
plan - The plan.
Returns:
The created body. May throw any kind of exception, when the body creation fails
Throws:
Exception

executePlanStep

public boolean executePlanStep(jadex.runtime.impl.RPlan plan)
                        throws Exception
Execute a step of a plan. Executing a step should cause the latest event to be handled. Will be called by the scheduler for every event to be handled. May throw any kind of exception, when the plan execution fails

Specified by:
executePlanStep in interface IPlanExecutor
Returns:
True, if the plan step was interrupted (interrupted flag).
Throws:
Exception

terminatePlan

public void terminatePlan(jadex.runtime.impl.RPlan rplan)
Called on termination of a plan. Free all associated ressources, stop threads, etc.

Specified by:
terminatePlan in interface IPlanExecutor

interruptPlanStep

public void interruptPlanStep(jadex.runtime.impl.RPlan plan)
Interrupt a plan step during execution. The plan is requested to stop the execution to allow consequences of performed plan actions (like belief changes) taking place. If the method is not implemented the plan step will be NOT be interrupted.

Specified by:
interruptPlanStep in interface IPlanExecutor

getExecutionThread

public Thread getExecutionThread(jadex.runtime.impl.RPlan rplan)
Get the executing thread of a plan.

Specified by:
getExecutionThread in interface IPlanExecutor
Parameters:
rplan - The plan.
Returns:
The executing thread (if any).

eventWaitFor

public jadex.runtime.impl.IREvent eventWaitFor(jadex.runtime.impl.RPlan rplan,
                                               jadex.runtime.impl.WaitAbstraction wa)
Called from a plan. Registers the plan to wait for a event. Blocks plan when body method is finished. Note: This method cannot be synchronized, because when a thread comes in and waits it still own the BDIAgent lock.

Parameters:
rplan - The planinstance.
wa - The wait abstraction.

Jadex 0.941

Submit a bug or feature
For further API reference and developer documentation, see the Jadex User Guide and the Jadex Tutorial. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, and working code examples.

Copyright (C) 2002-2005 Lars Braubach, Alexander Pokahr, Andrzej Walczak - University of Hamburg. Use is subject to license terms.