예제 #1
0
  @Override
  public void joinService(final ServiceQueue serviceQueue) {

    if (services.contains(serviceQueue)) {
      logger.info(
          "EventManager{}::joinService: Service queue "
              + "is already a member of this event manager {}",
          name,
          serviceQueue.name());
      return;
    }

    services.add(serviceQueue);

    logger.info("EventManager{}::joinService::  {} joined {}", name, serviceQueue.name(), name);

    doListen(serviceQueue.service(), serviceQueue);
  }
예제 #2
0
  @Override
  public void leave() {

    final ServiceQueue serviceQueue = serviceContext().currentService();
    if (serviceQueue == null) {
      throw new IllegalStateException(
          String.format("EventManager %s:: Must be called from inside of a Service", name));
    }

    stopListening(serviceQueue.service());

    services.remove(serviceQueue);
  }