Tuesday, April 25, 2006

Jade just doesn't quit.

No, really. Jade doesn't quit. Jade is the java multi-agent platform that follows FIPA specs pretty tightly and it actually isn't too bad of an agent platform. But the stupid thing refuses to shut down. You'd think it'd be really easy, like invoking a single method call called "shutdown" within the Runtime instance. That doesn't kill the VM for whatever reason.

After following a maze of method calls, I finally realized that I have to construct an AMS message with an Action object passed inside that tells the AMS agent to shutdown the container. But there's a gotcha - apparently, this only works with containers other than the main container. So there's a shutdown platform action that you can pass to the AMS. This closes the platform, but the stupid VM won't die.

So finally, there's a setCloseVM method that does the trick.

Here's the full code to shut down the &$%#& platform via code:

ACLMessage msg = new ACLMessage(ACLMessage.REQUEST);
msg.setLanguage(new SLCodec().getName());

msg.setContent("((action (agent-identifier :name " + getAMS().getName() + ")(shutdown-platform)))");


You might get a few interrupt exceptions. Just ignore them. Hopefully that won't break your unit tests! Grrr!


Anonymous Anonymous said...

I was getting upset.... thanks to you my friend....

10:25 AM  
Anonymous Anonymous said...

YOURURL propecia generic safe - propecia depression

2:08 PM  

Post a Comment

Links to this post:

Create a Link

<< Home