Example usage for io.netty.channel EventLoopException EventLoopException

List of usage examples for io.netty.channel EventLoopException EventLoopException

Introduction

In this page you can find the example usage for io.netty.channel EventLoopException EventLoopException.

Prototype

public EventLoopException(Throwable cause) 

Source Link

Usage

From source file:org.fusesource.hawtdispatch.netty.HawtEventLoop.java

License:Apache License

@Override
public ChannelFuture register(final Channel channel, final ChannelPromise promise) {
    if (isShutdown()) {
        channel.unsafe().closeForcibly();
        promise.setFailure(new EventLoopException("cannot register a channel to a shut down loop"));
        return promise;
    }/*  ww w .  j  a  va  2  s  .  c  o  m*/

    if (inEventLoop()) {
        channel.unsafe().register(this, promise);
    } else {
        execute(new Runnable() {
            @Override
            public void run() {
                channel.unsafe().register(HawtEventLoop.this, promise);
            }
        });
    }

    return promise;
}