Example #1
0
 /**
  * Cancel a plan's IE subscription Always keep plans registered to CoreEventHandler
  *
  * @param sub The subscription to cancel due to event completion or cancellation
  * @return If the handler held and canceled this subscription
  */
 @Override
 public boolean cancel(GeneratedInputEventSubscription sub) {
   LOGGER.log(Level.FINE, "CoreEventHandler asked to cancel subscription: " + sub);
   if ((sub.getSubscriptionClass() == AbortMissionReceived.class
           || sub.getSubscriptionClass() == TimerExpired.class
           || sub.getSubscriptionClass() == TokensReturned.class)
       && listeners.contains(sub.getListener())) {
     return true;
   }
   return false;
 }
Example #2
0
 /**
  * Offer a plan's IE subscription to the handler Always keep plans registered to CoreEventHandler
  *
  * @param sub The newly created input event subscription
  * @return If the handler accepts the subscription
  */
 @Override
 public boolean offer(GeneratedInputEventSubscription sub) {
   LOGGER.log(Level.FINE, "CoreEventHandler offered subscription: " + sub);
   if (sub.getSubscriptionClass() == AbortMissionReceived.class
       || sub.getSubscriptionClass() == TimerExpired.class
       || sub.getSubscriptionClass() == TokensReturned.class) {
     LOGGER.log(Level.FINE, "\tCoreEventHandler took subscription request: " + sub);
     if (!listeners.contains(sub.getListener())) {
       LOGGER.log(Level.FINE, "\t\tCoreEventHandler adding listener: " + sub.getListener());
       listeners.add(sub.getListener());
       listenerGCCount.put(sub.getListener(), 1);
     }
     return true;
   }
   return false;
 }