Пример #1
0
 /**
  * Kill an agent. This method terminates an agent running within the active Front End container.
  *
  * @param name The local name (i.e. without the platform ID) of the agent to kill.
  * @throws NotFoundException If no agent with the given local name are running within the active
  *     Front End.
  */
 public static void killAgent(String name) throws NotFoundException {
   if (myFrontEnd != null) {
     try {
       myFrontEnd.killAgent(name);
     } catch (IMTPException imtpe) {
       // Should never happen as this is a local call
       imtpe.printStackTrace();
     }
   }
 }
Пример #2
0
 /**
  * Start a new agent. This method starts a new agent within the active Front End container.
  *
  * @param name The local name (i.e. without the platform ID) of the agent to create.
  * @param className The fully qualified name of the class implementing the agent to start.
  * @param args The creation arguments for the agent.
  * @throws Exception If the underlying agent creation process fails.
  */
 public static void startAgent(String name, String className, Object[] args) throws Exception {
   if (myFrontEnd != null) {
     try {
       myFrontEnd.createAgent(name, className, args);
     } catch (IMTPException imtpe) {
       // This is a local call --> an IMTPxception always wrap some other exception
       throw (Exception) imtpe.getNested();
     }
   }
 }
Пример #3
0
 /**
  * Shut down the JADE runtime. This method stops the JADE Front End container currently running in
  * this JVM, if one such container exists.
  */
 public static void stopJADE() {
   if (myFrontEnd != null) {
     try {
       // Self-initiated shutdown
       myFrontEnd.exit(true);
     } catch (IMTPException imtpe) {
       // Should never happen as this is a local call
       imtpe.printStackTrace();
     }
   }
 }
Пример #4
0
 private void notifySynchronized() {
   synchronized (frontEndSynchLock) {
     Iterator it = fronEndSynchBuffer.iterator();
     while (it.hasNext()) {
       try {
         MessageSenderPair msp = (MessageSenderPair) it.next();
         messageOut(msp.getMessage(), msp.getSender());
       } catch (NotFoundException nfe) {
         // The sender does not exist --> nothing to notify
         nfe.printStackTrace();
       } catch (IMTPException imtpe) {
         // Should never happen since this is a local call
         imtpe.printStackTrace();
       }
     }
     fronEndSynchBuffer.clear();
     synchronizing = false;
   }
 }