public synchronized void shutdown() {
    if (state != State.STARTED) {
      throw new IllegalStateException("Cannot shutdown manager in state: " + state);
    }
    state = State.SHUTTING_DOWN;

    counter = 0;

    if (driver != null) {
      aeron.close();

      TimedScheduler timer = Schedulers.timer();

      timer.schedule(new RetryShutdownTask(timer), retryShutdownMillis, TimeUnit.MILLISECONDS);
    }
  }
Ejemplo n.º 2
0
  @SuppressWarnings("unchecked")
  public NettyChannelHandler(
      ChannelHandler<ByteBuf, ByteBuf, NettyChannel> handler,
      ChannelBridge<C> bridgeFactory,
      io.netty.channel.Channel ch,
      NettyChannelHandler parent) {
    this.handler = handler;
    if (parent == null) {
      this.inboundEmitter = new InboundSink(ch);
      // guard requests/cancel/subscribe
      this.input = Flux.from(this).subscribeOn(Schedulers.fromExecutor(ch.eventLoop()));
    } else {

      this.inboundEmitter = parent.inboundEmitter;
      this.input = parent.input;
    }
    this.bridgeFactory = bridgeFactory;
  }