public class ThreadedBehaviourFactory
extends java.lang.Object
wrap()
method
of this class (see the example below).
ThreadedBehaviourFactory tbf = new ThreadedBehaviourFactory(); Behaviour b = // create a JADE behaviour addBehaviour(tbf.wrap(b));
Constructor and Description |
---|
ThreadedBehaviourFactory() |
Modifier and Type | Method and Description |
---|---|
java.lang.Thread |
getThread(Behaviour b) |
void |
interrupt()
Interrupt all threaded behaviours managed by this ThreadedBehaviourFactory
|
java.lang.Thread |
interrupt(Behaviour b)
Interrupt a threaded behaviour.
|
void |
resume(Behaviour b)
Resume a threaded behaviour.
|
int |
size() |
void |
suspend(Behaviour b)
Suspend a threaded behaviour.
|
boolean |
waitUntilEmpty(long timeout)
Blocks until all threads dedicated to the execution of threaded
behaviours complete.
|
Behaviour |
wrap(Behaviour b)
Wraps a normal JADE Behaviour
b into a "threaded behaviour". |
public Behaviour wrap(Behaviour b)
b
into a "threaded behaviour". Adding the
wrapper behaviour to an agent results in executing b
in a dedicated Java Therad.public int size()
public void interrupt()
public boolean waitUntilEmpty(long timeout)
timeout
- The maximum timeout to wait for threaded behaviour
termination.true
if all threaded behaviour have actually
completed, false
otherwise.public java.lang.Thread interrupt(Behaviour b) throws NotFoundException
NotFoundException
public void suspend(Behaviour b)
resume()
method.public void resume(Behaviour b)
public java.lang.Thread getThread(Behaviour b)
b