Make sure we don't try to use Channel.setReadable(true) if it was not

read-suspend by the threadpool itself. See #215
This commit is contained in:
Norman Maurer 2012-03-04 19:26:14 +01:00
parent 27bd3e6d82
commit c2b830a188

View File

@ -438,10 +438,18 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor {
//System.out.println("READABLE");
ChannelHandlerContext ctx = eventTask.getContext();
if (ctx.getHandler() instanceof ExecutionHandler) {
// readSuspended = false;
ctx.setAttachment(null);
// check if the attachment was set as this means that we suspend the channel from reads. This only works when
// this pool is used with ExecutionHandler but I guess thats good enough for us.
//
// See #215
if (ctx.getAttachment() != null) {
// readSuspended = false;
ctx.setAttachment(null);
channel.setReadable(true);
}
} else {
channel.setReadable(true);
}
channel.setReadable(true);
}
}
}