From ed30037098e09b83ac5a04913389417178f55533 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Fri, 30 Sep 2011 22:14:36 +0200 Subject: [PATCH 01/10] Add patch of NETTY-434 to the mix to fix Deadlock in ChunkedWriteHandler. This patch was not written by me... --- .../handler/stream/ChunkedWriteHandler.java | 54 ++++++++++--------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java b/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java index ea6d8a6d98..92c9bf08c0 100644 --- a/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java +++ b/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java @@ -152,34 +152,36 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns private void discard(ChannelHandlerContext ctx) { ClosedChannelException cause = null; boolean fireExceptionCaught = false; - synchronized (this) { - for (;;) { - if (currentEvent == null) { - currentEvent = queue.poll(); - } - - if (currentEvent == null) { - break; - } - - MessageEvent currentEvent = this.currentEvent; - this.currentEvent = null; - - Object m = currentEvent.getMessage(); - if (m instanceof ChunkedInput) { - closeInput((ChunkedInput) m); - } - - // Trigger a ClosedChannelException - if (cause == null) { - cause = new ClosedChannelException(); - } - currentEvent.getFuture().setFailure(cause); - fireExceptionCaught = true; - - currentEvent = null; + + for (;;) { + MessageEvent currentEvent = this.currentEvent; + + if (this.currentEvent == null) { + currentEvent = queue.poll(); + } else { + this.currentEvent = null; } + + if (currentEvent == null) { + break; + } + + + Object m = currentEvent.getMessage(); + if (m instanceof ChunkedInput) { + closeInput((ChunkedInput) m); + } + + // Trigger a ClosedChannelException + if (cause == null) { + cause = new ClosedChannelException(); + } + currentEvent.getFuture().setFailure(cause); + fireExceptionCaught = true; + + currentEvent = null; } + if (fireExceptionCaught) { Channels.fireExceptionCaught(ctx.getChannel(), cause); From 28120aa778cea6b0738b7d54988f282ca8dd3a70 Mon Sep 17 00:00:00 2001 From: norman Date: Wed, 12 Oct 2011 10:35:12 +0200 Subject: [PATCH 02/10] Add javadoc entry to explain that some events are executed in the boss thread. --- src/main/java/org/jboss/netty/channel/ChannelEvent.java | 5 ++++- .../netty/channel/SimpleChannelUpstreamHandler.java | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/channel/ChannelEvent.java b/src/main/java/org/jboss/netty/channel/ChannelEvent.java index 020cf47094..cd5d175c0a 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelEvent.java +++ b/src/main/java/org/jboss/netty/channel/ChannelEvent.java @@ -71,6 +71,7 @@ import org.jboss.netty.channel.socket.ServerSocketChannel; * {@code "channelOpen"} * {@link ChannelStateEvent}
(state = {@link ChannelState#OPEN OPEN}, value = {@code true}) * a {@link Channel} is open, but not bound nor connected + * Be aware that this event is fired from within the Boss-Thread so you should not execute any heavy operation in there as it will block the dispatching to other workers! * * * {@code "channelClosed"} @@ -80,7 +81,8 @@ import org.jboss.netty.channel.socket.ServerSocketChannel; * * {@code "channelBound"} * {@link ChannelStateEvent}
(state = {@link ChannelState#BOUND BOUND}, value = {@link SocketAddress}) - * a {@link Channel} is open and bound to a local address, but not connected + * a {@link Channel} is open and bound to a local address, but not connected. + * Be aware that this event is fired from within the Boss-Thread so you should not execute any heavy operation in there as it will block the dispatching to other workers! * * * {@code "channelUnbound"} @@ -91,6 +93,7 @@ import org.jboss.netty.channel.socket.ServerSocketChannel; * {@code "channelConnected"} * {@link ChannelStateEvent}
(state = {@link ChannelState#CONNECTED CONNECTED}, value = {@link SocketAddress}) * a {@link Channel} is open, bound to a local address, and connected to a remote address + * Be aware that this event is fired from within the Boss-Thread so you should not execute any heavy operation in there as it will block the dispatching to other workers! * * * {@code "writeComplete"} diff --git a/src/main/java/org/jboss/netty/channel/SimpleChannelUpstreamHandler.java b/src/main/java/org/jboss/netty/channel/SimpleChannelUpstreamHandler.java index 590a04a7c6..8fc3c286bf 100644 --- a/src/main/java/org/jboss/netty/channel/SimpleChannelUpstreamHandler.java +++ b/src/main/java/org/jboss/netty/channel/SimpleChannelUpstreamHandler.java @@ -150,6 +150,9 @@ public class SimpleChannelUpstreamHandler implements ChannelUpstreamHandler { /** * Invoked when a {@link Channel} is open, but not bound nor connected. + *
+ * + * Be aware that this event is fired from within the Boss-Thread so you should not execute any heavy operation in there as it will block the dispatching to other workers! */ public void channelOpen( ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { @@ -159,6 +162,9 @@ public class SimpleChannelUpstreamHandler implements ChannelUpstreamHandler { /** * Invoked when a {@link Channel} is open and bound to a local address, * but not connected. + *
+ * + * Be aware that this event is fired from within the Boss-Thread so you should not execute any heavy operation in there as it will block the dispatching to other workers! */ public void channelBound( ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { @@ -168,6 +174,9 @@ public class SimpleChannelUpstreamHandler implements ChannelUpstreamHandler { /** * Invoked when a {@link Channel} is open, bound to a local address, and * connected to a remote address. + *
+ * + * Be aware that this event is fired from within the Boss-Thread so you should not execute any heavy operation in there as it will block the dispatching to other workers! */ public void channelConnected( ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { From bbdc2032f09d78ae5e5ff0ad83160bf6e75f683a Mon Sep 17 00:00:00 2001 From: norman Date: Wed, 12 Oct 2011 13:02:50 +0200 Subject: [PATCH 03/10] Make sure the ChannelOpen, ChannelBound and ChannelConnected events get fired from within an IO-Worker Thread. This makes sure the Boss-Thread will not get blocked by any user action --- .../socket/nio/NioAcceptedSocketChannel.java | 5 ----- .../jboss/netty/channel/socket/nio/NioWorker.java | 14 +++++++++++++- .../socket/oio/OioAcceptedSocketChannel.java | 6 ------ .../jboss/netty/channel/socket/oio/OioWorker.java | 8 ++++++++ 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java index d9ee05ded5..e2d017c1ce 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java @@ -15,8 +15,6 @@ */ package org.jboss.netty.channel.socket.nio; -import static org.jboss.netty.channel.Channels.*; - import java.nio.channels.SocketChannel; import org.jboss.netty.channel.Channel; @@ -46,8 +44,5 @@ final class NioAcceptedSocketChannel extends NioSocketChannel { this.bossThread = bossThread; setConnected(); - fireChannelOpen(this); - fireChannelBound(this, getLocalAddress()); - fireChannelConnected(this, getRemoteAddress()); } } diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java index 8618ab3c4e..98b3850c03 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java @@ -82,7 +82,8 @@ class NioWorker implements Runnable { private final SocketReceiveBufferPool recvBufferPool = new SocketReceiveBufferPool(); private final SocketSendBufferPool sendBufferPool = new SocketSendBufferPool(); - + private final AtomicBoolean fireConnect = new AtomicBoolean(true); + NioWorker(int bossId, int id, Executor executor) { this.bossId = bossId; this.id = id; @@ -96,6 +97,8 @@ class NioWorker implements Runnable { Selector selector; synchronized (startStopLock) { + fireConnect.set(true); + if (!started) { // Open a selector if this worker didn't start yet. try { @@ -160,6 +163,7 @@ class NioWorker implements Runnable { } try { + SelectorUtil.select(selector); // 'wakenUp.compareAndSet(false, true)' is always evaluated @@ -790,6 +794,14 @@ class NioWorker implements Runnable { } fireChannelConnected(channel, remoteAddress); } + + // Handle the channelOpen, channelBound and channelConnected in the worker thread + if (channel instanceof NioAcceptedSocketChannel) { + fireChannelOpen(channel); + fireChannelBound(channel, channel.getLocalAddress()); + fireChannelConnected(channel, channel.getRemoteAddress()); + + } } } } diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java index 0454b2f6a3..38b7b1424f 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java @@ -15,8 +15,6 @@ */ package org.jboss.netty.channel.socket.oio; -import static org.jboss.netty.channel.Channels.*; - import java.io.IOException; import java.io.OutputStream; import java.io.PushbackInputStream; @@ -60,10 +58,6 @@ class OioAcceptedSocketChannel extends OioSocketChannel { } catch (IOException e) { throw new ChannelException("Failed to obtain an OutputStream.", e); } - - fireChannelOpen(this); - fireChannelBound(this, getLocalAddress()); - fireChannelConnected(this, getRemoteAddress()); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java index 11ba4001d1..0499b739bd 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java @@ -50,7 +50,15 @@ class OioWorker implements Runnable { channel.workerThread = Thread.currentThread(); final PushbackInputStream in = channel.getInputStream(); + boolean fireOpen = channel instanceof OioAcceptedSocketChannel; + while (channel.isOpen()) { + if (fireOpen) { + fireOpen = false; + fireChannelOpen(channel); + fireChannelBound(channel, channel.getLocalAddress()); + fireChannelConnected(channel, channel.getRemoteAddress()); + } synchronized (channel.interestOpsLock) { while (!channel.isReadable()) { try { From cb2e047f1dcb7cc62eae7ce0f3c8195ea6a20da8 Mon Sep 17 00:00:00 2001 From: norman Date: Wed, 12 Oct 2011 13:04:37 +0200 Subject: [PATCH 04/10] Remove code which I committed by mistake --- src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java index 98b3850c03..fb5bd95813 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java @@ -82,7 +82,6 @@ class NioWorker implements Runnable { private final SocketReceiveBufferPool recvBufferPool = new SocketReceiveBufferPool(); private final SocketSendBufferPool sendBufferPool = new SocketSendBufferPool(); - private final AtomicBoolean fireConnect = new AtomicBoolean(true); NioWorker(int bossId, int id, Executor executor) { this.bossId = bossId; @@ -97,7 +96,6 @@ class NioWorker implements Runnable { Selector selector; synchronized (startStopLock) { - fireConnect.set(true); if (!started) { // Open a selector if this worker didn't start yet. From fb408778d1d20f1e58b937f1a352c4515719e5cf Mon Sep 17 00:00:00 2001 From: norman Date: Wed, 12 Oct 2011 13:15:06 +0200 Subject: [PATCH 05/10] Only handle the channelConnected in the worker thread. The channelOpen and channelBound was moved back to the boss thread. This was done after reading NETTY-154 --- .../channel/socket/nio/NioAcceptedSocketChannel.java | 6 ++++++ .../org/jboss/netty/channel/socket/nio/NioWorker.java | 4 +--- .../channel/socket/oio/OioAcceptedSocketChannel.java | 6 ++++++ .../org/jboss/netty/channel/socket/oio/OioWorker.java | 8 +++----- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java index e2d017c1ce..187b727d3b 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java @@ -15,6 +15,9 @@ */ package org.jboss.netty.channel.socket.nio; +import static org.jboss.netty.channel.Channels.fireChannelBound; +import static org.jboss.netty.channel.Channels.fireChannelOpen; + import java.nio.channels.SocketChannel; import org.jboss.netty.channel.Channel; @@ -44,5 +47,8 @@ final class NioAcceptedSocketChannel extends NioSocketChannel { this.bossThread = bossThread; setConnected(); + + fireChannelOpen(this); + fireChannelBound(this, getLocalAddress()); } } diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java index fb5bd95813..0618dec97f 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java @@ -793,10 +793,8 @@ class NioWorker implements Runnable { fireChannelConnected(channel, remoteAddress); } - // Handle the channelOpen, channelBound and channelConnected in the worker thread + // Handle the channelConnected in the worker thread if (channel instanceof NioAcceptedSocketChannel) { - fireChannelOpen(channel); - fireChannelBound(channel, channel.getLocalAddress()); fireChannelConnected(channel, channel.getRemoteAddress()); } diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java index 38b7b1424f..c8728df6db 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java @@ -15,6 +15,9 @@ */ package org.jboss.netty.channel.socket.oio; +import static org.jboss.netty.channel.Channels.fireChannelBound; +import static org.jboss.netty.channel.Channels.fireChannelOpen; + import java.io.IOException; import java.io.OutputStream; import java.io.PushbackInputStream; @@ -58,6 +61,9 @@ class OioAcceptedSocketChannel extends OioSocketChannel { } catch (IOException e) { throw new ChannelException("Failed to obtain an OutputStream.", e); } + + fireChannelOpen(this); + fireChannelBound(this, getLocalAddress()); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java index 0499b739bd..74e18ef942 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java @@ -50,13 +50,11 @@ class OioWorker implements Runnable { channel.workerThread = Thread.currentThread(); final PushbackInputStream in = channel.getInputStream(); - boolean fireOpen = channel instanceof OioAcceptedSocketChannel; + boolean fireConnected = channel instanceof OioAcceptedSocketChannel; while (channel.isOpen()) { - if (fireOpen) { - fireOpen = false; - fireChannelOpen(channel); - fireChannelBound(channel, channel.getLocalAddress()); + if (fireConnected) { + fireConnected = false; fireChannelConnected(channel, channel.getRemoteAddress()); } synchronized (channel.interestOpsLock) { From 2d25998eb4e4211998903bdd82d1b2ac77326901 Mon Sep 17 00:00:00 2001 From: norman Date: Wed, 12 Oct 2011 15:07:53 +0200 Subject: [PATCH 06/10] Make sure FileRegion.releaseExternalResources() is called after the write was done. See NETTY-440 --- .../jboss/netty/channel/socket/nio/SocketSendBufferPool.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java b/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java index 70826d0300..d4f898ab8c 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java @@ -288,7 +288,8 @@ final class SocketSendBufferPool { } public void release() { - // Unpooled. + // Make sure the FileRegion resource are released otherwise it may cause a FD leak or something similar + file.releaseExternalResources(); } } From fd1d11ec395509c488979d4cdfc41b63f9df6ee0 Mon Sep 17 00:00:00 2001 From: norman Date: Wed, 12 Oct 2011 17:09:02 +0200 Subject: [PATCH 07/10] Add support for FileRegion in OIOWorker. --- .../netty/channel/socket/oio/OioWorker.java | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java index 74e18ef942..eaee7fbdb8 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java @@ -20,12 +20,15 @@ import static org.jboss.netty.channel.Channels.*; import java.io.OutputStream; import java.io.PushbackInputStream; import java.net.SocketException; +import java.nio.channels.Channels; import java.nio.channels.ClosedChannelException; +import java.nio.channels.WritableByteChannel; import java.util.regex.Pattern; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelFuture; +import org.jboss.netty.channel.FileRegion; /** * @@ -119,13 +122,39 @@ class OioWorker implements Runnable { } try { - ChannelBuffer a = (ChannelBuffer) message; - int length = a.readableBytes(); - synchronized (out) { - a.getBytes(a.readerIndex(), out, length); + int length = 0; + + // Add support to write a FileRegion. This in fact will not give any performance gain but at least it not fail and + // we did the best to emulate it + if (message instanceof FileRegion) { + FileRegion fr = (FileRegion) message; + try { + synchronized (out) { + WritableByteChannel bchannel = Channels.newChannel(out); + + long i = 0; + while ((i = fr.transferTo(bchannel, length)) > 0) { + length += i; + if (length >= fr.getCount()) { + break; + } + } + } + } finally { + fr.releaseExternalResources(); + + } + } else { + ChannelBuffer a = (ChannelBuffer) message; + length = a.readableBytes(); + synchronized (out) { + a.getBytes(a.readerIndex(), out, length); + } } + fireWriteComplete(channel, length); future.setSuccess(); + } catch (Throwable t) { // Convert 'SocketException: Socket closed' to // ClosedChannelException. From 35401caac44e907045a24ed5c54ce3d36b3bafac Mon Sep 17 00:00:00 2001 From: norman Date: Thu, 13 Oct 2011 12:08:06 +0200 Subject: [PATCH 08/10] Remove unused imports and fix warnings --- src/main/java/org/jboss/netty/channel/ChannelLocal.java | 2 +- .../org/jboss/netty/channel/socket/nio/NioSocketChannel.java | 1 - src/main/java/org/jboss/netty/handler/ssl/SslHandler.java | 4 ++-- .../org/jboss/netty/handler/timeout/WriteTimeoutHandler.java | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/ChannelLocal.java b/src/main/java/org/jboss/netty/channel/ChannelLocal.java index 407700ee3f..32abb6ae6a 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelLocal.java +++ b/src/main/java/org/jboss/netty/channel/ChannelLocal.java @@ -51,7 +51,7 @@ public class ChannelLocal { * Returns the initial value of the variable. By default, it returns * {@code null}. Override it to change the initial value. */ - protected T initialValue(@SuppressWarnings("unused") Channel channel) { + protected T initialValue(Channel channel) { return null; } diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannel.java index 7b547b7b8a..6dc97527a5 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannel.java @@ -29,7 +29,6 @@ import org.jboss.netty.channel.AbstractChannel; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelFactory; import org.jboss.netty.channel.ChannelFuture; -import org.jboss.netty.channel.ChannelFutureListener; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.channel.ChannelSink; import org.jboss.netty.channel.MessageEvent; diff --git a/src/main/java/org/jboss/netty/handler/ssl/SslHandler.java b/src/main/java/org/jboss/netty/handler/ssl/SslHandler.java index 940953248e..c22bded121 100644 --- a/src/main/java/org/jboss/netty/handler/ssl/SslHandler.java +++ b/src/main/java/org/jboss/netty/handler/ssl/SslHandler.java @@ -370,7 +370,7 @@ public class SslHandler extends FrameDecoder * @deprecated Use {@link #handshake()} instead. */ @Deprecated - public ChannelFuture handshake(@SuppressWarnings("unused") Channel channel) { + public ChannelFuture handshake(Channel channel) { return handshake(); } @@ -394,7 +394,7 @@ public class SslHandler extends FrameDecoder * @deprecated Use {@link #close()} instead. */ @Deprecated - public ChannelFuture close(@SuppressWarnings("unused") Channel channel) { + public ChannelFuture close(Channel channel) { return close(); } diff --git a/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutHandler.java b/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutHandler.java index 3fe62cf319..63c15f904d 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutHandler.java +++ b/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutHandler.java @@ -135,7 +135,7 @@ public class WriteTimeoutHandler extends SimpleChannelDownstreamHandler timer.stop(); } - protected long getTimeoutMillis(@SuppressWarnings("unused") MessageEvent e) { + protected long getTimeoutMillis(MessageEvent e) { return timeoutMillis; } From 4be22a42ef16d3f9ffafb382de7cbd584040ddc8 Mon Sep 17 00:00:00 2001 From: norman Date: Mon, 17 Oct 2011 15:49:29 +0200 Subject: [PATCH 09/10] ThreadNameDeterminer.CURRENT return the right name now. Was returning null before all the time --- src/main/java/org/jboss/netty/util/ThreadNameDeterminer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/util/ThreadNameDeterminer.java b/src/main/java/org/jboss/netty/util/ThreadNameDeterminer.java index 05840124a8..fcff9cd3d4 100644 --- a/src/main/java/org/jboss/netty/util/ThreadNameDeterminer.java +++ b/src/main/java/org/jboss/netty/util/ThreadNameDeterminer.java @@ -42,7 +42,7 @@ public interface ThreadNameDeterminer { ThreadNameDeterminer CURRENT = new ThreadNameDeterminer() { public String determineThreadName(String currentThreadName, String proposedThreadName) throws Exception { - return null; + return currentThreadName; } }; From 48c6793d3029b88813a7c2d0bfa22b01886e0649 Mon Sep 17 00:00:00 2001 From: norman Date: Mon, 17 Oct 2011 15:56:38 +0200 Subject: [PATCH 10/10] Revert invalid fix --- src/main/java/org/jboss/netty/util/ThreadNameDeterminer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/util/ThreadNameDeterminer.java b/src/main/java/org/jboss/netty/util/ThreadNameDeterminer.java index fcff9cd3d4..05840124a8 100644 --- a/src/main/java/org/jboss/netty/util/ThreadNameDeterminer.java +++ b/src/main/java/org/jboss/netty/util/ThreadNameDeterminer.java @@ -42,7 +42,7 @@ public interface ThreadNameDeterminer { ThreadNameDeterminer CURRENT = new ThreadNameDeterminer() { public String determineThreadName(String currentThreadName, String proposedThreadName) throws Exception { - return currentThreadName; + return null; } };