예제 #1
0
  /** Closes the inbox */
  @Override
  public void shutdown(ShutdownModeAmp mode) {
    if (!_lifecycle.toStopping()) {
      return;
    }

    _lifecycle.toDestroy();

    OnShutdownMessage shutdownMessage = new OnShutdownMessage(this, mode, isSingle());

    _queue.offer(shutdownMessage);

    // _queue.close();
    /*
    for (Actor<?> actorProcessor : _queueActors) {
      actorProcessor.close();
    }
    */

    _queue.wakeAllAndWait();

    shutdownMessage.waitFor(1, TimeUnit.SECONDS);

    super.shutdown(mode);

    try (OutboxAmp outbox = OutboxAmp.currentOrCreate(manager())) {
      Object ctx = outbox.getAndSetContext(this);

      try {
        outbox.flush();

        if (!isSingle()) {
          _worker.shutdown(mode);
        }
      } finally {
        outbox.getAndSetContext(ctx);
      }
    }

    // XXX: _worker.shutdown(ShutdownModeAmp.IMMEDIATE);
  }
예제 #2
0
 @Override
 public void shutdownStubs(ShutdownModeAmp mode) {
   _worker.shutdown(mode);
 }