swarm-support
[Top][All Lists]
Advanced

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

java swarm shutdown: problem solved !


From: Paul E Johnson
Subject: java swarm shutdown: problem solved !
Date: Mon, 26 Feb 2001 08:52:37 -0600

We were talking about problems shutting down java swarm programs. the
jipd example at the end gives an error similar to the one that a user
reported yesterday:

*** event raised for error: SourceMessage
*** function: _i_Schedule_c__drop(), file:
/home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.1.41.20010214/src/activity/CompoundAction.m,
line: 236
> cannot drop action plan still referenced by an uncompleted activity
*** execution terminating due to error

Other java programs I've written "hang" when the quit button is hit,
they don't shut down. This happens in some Swarm programs that use Swing
graphics (or packages that use Swing, such as ptplot or diva).

The first problem above is caused by trying to drop an activity when you
shouldn't.  Marcus Daniels posted a sample program showing how a swarm
can be dropped yesterday, in case you are interested.  

But the error above is, I believe (80% confidence) is caused by the drop
method in its ObserverSwarm.java file, which explicitly drops a bunch of
stuff that most other swarm java programs don't bother to drop:

   public void drop() {
        displayActions.drop();
        displaySchedule.drop();
        model.drop();
        graph.drop();
        raster.drop();
        super.drop();
    }

If you eliminate those lines, then jipd hangs when you hit the quit
button, just like my other java swarpm programs. I imagine that "hang"
is the problem the author of jipd (who?) was trying to avoid by adding
all those explicit drops.  I think that was a mistaken approach.

Yesterday I guessed, and confirmed with Marcus Daniels, that a fix for
that "hang" problem is to add System.exit(0) at the end of the main
function. In jipd's Main.java file, it is like this:

public class Main {
    public static void main (String[] args) {
        Globals.env.initSwarm ("jipd-grid", "0.0.1", "address@hidden",
args);
        ObserverSwarm topLevelSwarm =
            new ObserverSwarm(Globals.env.globalZone);
        topLevelSwarm.buildObjects ();
        topLevelSwarm.buildActions ();
        topLevelSwarm.activateIn (null);
        topLevelSwarm.go ();
        topLevelSwarm.drop ();
        System.exit(0);
    }
}

After deleting the drop method from ObserverSwarm.java, and making this
change, then jipd shuts down quietly.

I have found this fixes the "hang" I get at quit time in other java
programs. So, in summary, probably you shouldn't go overboard explicitly
dropping things in a drop method because that causes those activity
errors.  Instead use this other approach.


-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700

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