swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding events at a particular time in a Schedule


From: Marcus G. Daniels
Subject: Re: Finding events at a particular time in a Schedule
Date: 29 Sep 2000 09:12:05 -0700
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4

>>>>> "TTF" == Tee Toth-Fejel <address@hidden> writes:

TTF> I assume that you mean something like:
[..]
TTF> But it results in:

TTF> dumpSchedule: address@hidden
TTF> dumpSchedule: address@hidden
TTF> dumpSchedule: sheduleIndex=swarm.collections.MapIndexImpl
TTF> Internal error: caught an unexpected exception.

TTF> 1.  Why can't I do a .next on the MapIndexImpl I got from my schedule?

I can't reproduce that on W2K using the current 2.1.1-fixes DLLs.

Here's my test-program:

import swarm.activity.ScheduleImpl;
import swarm.activity.Schedule;
import swarm.objectbase.SwarmImpl;
import swarm.defobj.Zone;
import swarm.collections.Index;
import swarm.Selector;
import swarm.Globals;

public class TestMapIndex extends SwarmImpl {

  static void main (String []args) {
    Globals.env.initSwarm ("TestMapIndex", "0.0", "address@hidden", args);

    TestMapIndex obj = new TestMapIndex (Globals.env.globalZone);
 
    obj.buildActions ();
    obj.test ();
  }
  Schedule schedule;

  public TestMapIndex (Zone aZone) { 
    super (aZone);
  }

  public void message1 () {
    System.out.println ("message1");
  }

  public void message2 () {
    System.out.println ("message2");
  }

  public Object buildActions () {
    schedule = new ScheduleImpl (Globals.env.globalZone, true);

    try {
      Selector sel1 = new Selector (getClass (), "message1", false);
      Selector sel2 = new Selector (getClass (), "message2", false);

      schedule.at$createActionTo$message (1, this, sel1);
      schedule.at$createActionTo$message (2, this, sel2);
    } catch (Exception e) {
      e.printStackTrace (System.err);
      System.exit (1);
    }
    return this;
  }

  public void test () {
    Index index = schedule.begin (getZone ());

    System.out.println (index);
    System.out.println (index.getName ());
    System.out.println (index.getName ().toString ());
    System.out.println ("first event: " + index.next ());
    System.out.println ("second event: " + index.next ());
    System.out.println ("third event: " + index.next ());
  }
}

$ javaswarm TestMapIndex
address@hidden
swarm.collections.MapIndexImpl
swarm.collections.MapIndexImpl
first: address@hidden
second: address@hidden
third: null

TTF> 2.  In general, how does one debug such a stackdump?  

Run your program under the debugger:

  JAVASWARMGDB=gdb javaswarm YourProgram

                  ==================================
   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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]