From 85a2ba37529bbd0f11443390af2544a1ee9a1742 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Fri, 12 Jul 2013 20:10:39 +0900 Subject: [PATCH] Remove dead code - Fixed #1557 --- .../io/netty/channel/AbstractChannel.java | 33 +++++-------------- .../main/java/io/netty/channel/Channel.java | 7 +--- 2 files changed, 9 insertions(+), 31 deletions(-) diff --git a/transport/src/main/java/io/netty/channel/AbstractChannel.java b/transport/src/main/java/io/netty/channel/AbstractChannel.java index 3bdff15402..5ba47e4383 100644 --- a/transport/src/main/java/io/netty/channel/AbstractChannel.java +++ b/transport/src/main/java/io/netty/channel/AbstractChannel.java @@ -55,7 +55,6 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha private ClosedChannelException closedChannelException; private boolean inFlushNow; - private boolean flushNowPending; /** Cache for the string representation of this channel */ private boolean strValActive; @@ -359,13 +358,6 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha */ protected abstract class AbstractUnsafe implements Unsafe { - private final Runnable flushTask = new Runnable() { - @Override - public void run() { - flush0(); - } - }; - @Override public final SocketAddress localAddress() { return localAddress0(); @@ -606,24 +598,15 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha } private void flush0() { - if (!inFlushNow) { // Avoid re-entrance - // Flush immediately only when there's no pending flush. - // If there's a pending flush operation, event loop will call flushNow() later, - // and thus there's no need to call it now. - if (!isFlushPending()) { - flushNow(); - } - } else { - if (!flushNowPending) { - flushNowPending = true; - eventLoop().execute(flushTask); - } - } - } - - @Override - public final void flushNow() { if (inFlushNow) { + // Avoid re-entrance + return; + } + + // Flush immediately only when there's no pending flush. + // If there's a pending flush operation, event loop will call flushNow() later, + // and thus there's no need to call it now. + if (isFlushPending()) { return; } diff --git a/transport/src/main/java/io/netty/channel/Channel.java b/transport/src/main/java/io/netty/channel/Channel.java index 7656bcb117..41a73d3e21 100644 --- a/transport/src/main/java/io/netty/channel/Channel.java +++ b/transport/src/main/java/io/netty/channel/Channel.java @@ -240,15 +240,10 @@ public interface Channel extends AttributeMap, ChannelOutboundInvoker, ChannelPr void write(Object msg, ChannelPromise promise); /** - * Flush out all scheduled writes. + * Flush out all write operations scheduled via {@link #write(Object, ChannelPromise)}. */ void flush(); - /** - * Flush out all schedules writes immediately. - */ - void flushNow(); - /** * Return a special ChannelPromise which can be reused and passed to the operations in {@link Unsafe}. * It will never be notified of a success or error and so is only a placeholder for operations