Reduce garbage in AbstractUnsafe.flush0()

This commit is contained in:
Trustin Lee 2013-07-12 20:04:01 +09:00
parent 529d904d29
commit 6d1220b55e

View File

@ -359,6 +359,13 @@ 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();
@ -609,12 +616,7 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha
} else {
if (!flushNowPending) {
flushNowPending = true;
eventLoop().execute(new Runnable() {
@Override
public void run() {
flush0();
}
});
eventLoop().execute(flushTask);
}
}
}