Undo AbstractChannelHandlerContext extend PausableChannelEventExecutor. ...

...Fixes #2814

Motivation:
Our last-minute change that made AbstractChannelHandlerContext implement PausableChannelEventExecutor broke the socksproxy example.

Modifications:
AbstractChannelHandlerContext does not inherit from PausableChannelEventExecutor anymore. Instead we'll allocate an extra object on demand.

Result:

AbstractChannelHandlerContext.executor().newPromise() returns the correct type.
I have never thought about this. That's a neat trick.

Personally, I am not a fan of AtomicReferenceFieldUpdater because I think it has an ugly syntax and it makes the code harder to understand.

-----Original Message-----
From: "Norman Maurer" <notifications@github.com>
Sent: ‎25/‎08/‎2014 15:24
To: "netty/netty" <netty@noreply.github.com>
Cc: "Jakob Buchgraber" <jakob.buchgraber@tum.de>
Subject: Re: [netty] Undo AbstractChannelHandlerContext extendPausableChannelEventExecutor. ... (#2818)

In transport/src/main/java/io/netty/channel/AbstractChannelHandlerContext.java:
>      }
>  
>      @Override
>      public final ChannelHandlerInvoker invoker() {
> -        return this;
> +        if (invoker == null) {
> +            return channel().eventLoop().asInvoker();
> +        } else {
> +            initWrappedEventLoop();
> +            return wrappedEventLoop;
> +        }
> +    }
> +
> +    private void initWrappedEventLoop() {
> +        // Double checked locking
> +        if (wrappedEventLoop == null) {
> +            synchronized (this) {
Why not using AtomicReferenceFieldUpdater and remove the double checked locking ?
—
Reply to this email directly or view it on GitHub.