/** 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); }
@Override public void shutdownStubs(ShutdownModeAmp mode) { _worker.shutdown(mode); }