[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Action Groups
From: |
Marcus G. Daniels |
Subject: |
Re: Action Groups |
Date: |
30 Mar 2000 09:28:37 -0800 |
User-agent: |
Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4 |
>>>>> "CS" == Charles Staelin <address@hidden> writes:
CS> Is there a simple way to execute an ActionGroup outside of a
CS> schedule? I'd like to execute the actions within a ActionGroup
CS> once, asynchronously.
Sure.
import swarm.Globals;
import swarm.Selector;
import swarm.objectbase.SwarmImpl;
import swarm.objectbase.Swarm;
import swarm.activity.ActionGroup;
import swarm.activity.ActionGroupImpl;
import swarm.activity.Activity;
import swarm.defobj.Zone;
public class TestActionGroup extends SwarmImpl {
ActionGroup actionGroup;
public Object start1 () {
System.out.println ("Start 1");
return this;
}
public Object start2 () {
System.out.println ("Start 2");
return this;
}
public TestActionGroup (Zone aZone) {
super (aZone);
actionGroup = new ActionGroupImpl (Globals.env.globalZone);
try {
actionGroup.createActionTo$message
(this,
new Selector (getClass (), "start1", false));
actionGroup.createActionTo$message
(this,
new Selector (getClass (), "start2", false));
} catch (Exception e) {
e.printStackTrace (System.err);
}
}
public Activity activateIn (Swarm swarmContext) {
super.activateIn (swarmContext);
actionGroup.activateIn (this);
return getActivity ();
}
static void main (String[] args) {
Globals.env.initSwarm ("TestActionGroup", "0.0", "address@hidden", args);
new TestActionGroup (Globals.env.globalZone).activateIn (null).run ();
}
}
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.