parent
6d1220b55e
commit
85a2ba3752
@ -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
|
||||
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()) {
|
||||
flushNow();
|
||||
}
|
||||
} else {
|
||||
if (!flushNowPending) {
|
||||
flushNowPending = true;
|
||||
eventLoop().execute(flushTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void flushNow() {
|
||||
if (inFlushNow) {
|
||||
if (isFlushPending()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user