Is there a possibility that pipeline.fireChannelActive() is executed twice when executing ServerBootstrap.bind()?
<p>All the following code is from Netty4.0.31.Final. The <code>ServerBootstrap</code>'s channel is <code>NioServerSocketChannel</code>.</p>

<p>The main logic of <code>ServerBootstrap.bind(int)</code> is in <code>AbstractBootstrap.doBind(SocketAddress)</code>:</p>

<pre><code>private ChannelFuture doBind(final SocketAddress localAddress) {
        final ChannelFuture regFuture = initAndRegister();
        ...
        if (regFuture.isDone()) {
            ...
            doBind0(regFuture, channel, localAddress, promise);
            ...
        } else {
            regFuture.addListener(new ChannelFutureListener() {
                @Override
                public void operationComplete(ChannelFuture future) throws Exception {
                    ...
                    doBind0(regFuture, channel, localAddress, promise);
                }
            });
        }
}
</code></pre>

<p>The code in <code>initAndRegister()</code> finally goes into <code>AbstractUnsafe.register0(ChannelPromise promise)</code>:</p>

<pre><code>private void register0(ChannelPromise promise) {
        try {
            ...
            boolean firstRegistration = neverRegistered;
            doRegister();
            ...
            if (firstRegistration &amp;&amp; isActive()) {
                pipeline.fireChannelActive();
            }
        } catch (Throwable t) {
            ...
        }
 }
</code></pre>

<p>As you can see, <code>pipeline.fireChannelActive()</code> may be executed here.</p>

<p>Let's back to <code>AbstractBootstrap.doBind(SocketAddress)</code>,in <code>doBind0(regFuture, channel, localAddress, promise)</code> the code finally goes into <code>AbstractUnsafe.bind(SocketAddress,ChannelPromise)</code>:</p>

<pre><code>public final void bind(final SocketAddress localAddress, final ChannelPromise promise) {
        ...
        boolean wasActive = isActive();
        try {
            doBind(localAddress);
        } catch (Throwable t) {
            ...
        }

        if (!wasActive &amp;&amp; isActive()) {
            invokeLater(new OneTimeTask() {
                @Override
                public void run() {
                    pipeline.fireChannelActive();
                }
            });
        }
        ...
    }
</code></pre>

<p>As you can see, <code>pipeline.fireChannelActive()</code> may also be executed here.</p>

<p>So, is there a possibility that <code>pipeline.fireChannelActive()</code> is executed twice when creating and binding one <code>NioServerSocketChannel</code>?</p>