예제 #1
0
 public List removePendingMessages(MessageTemplate template, boolean notifyFailure) {
   List pendingMsg = ((jade.imtp.leap.FrontEndStub) myFrontEnd).removePendingMessages(template);
   if (pendingMsg.size() > 0) {
     myLogger.log(
         Logger.INFO, "Removed " + pendingMsg.size() + " pending messages from BackEnd queue.");
   }
   if (notifyFailure) {
     Iterator it = pendingMsg.iterator();
     while (it.hasNext()) {
       try {
         Object[] removed = (Object[]) it.next();
         ACLMessage msg = (ACLMessage) removed[0];
         AID receiver = new AID((String) removed[1], AID.ISLOCALNAME);
         ServiceFinder myFinder = getServiceFinder();
         MessagingService msgSvc = (MessagingService) myFinder.findService(MessagingSlice.NAME);
         msgSvc.notifyFailureToSender(
             new GenericMessage(msg), receiver, new InternalError("Agent dead"));
       } catch (Exception e) {
         myLogger.log(Logger.WARNING, "Cannot send AMS FAILURE. " + e);
       }
     }
   }
   return pendingMsg;
 }
예제 #2
0
/**