Code cleanup
This commit is contained in:
parent
4979cb6a21
commit
fbfebb1fd9
@ -85,11 +85,7 @@ public class WriteTimeoutHandler extends SimpleChannelDownstreamHandler
|
||||
new WriteTimeoutTask(ctx, future),
|
||||
timeoutMillis, TimeUnit.MILLISECONDS);
|
||||
|
||||
future.addListener(new ChannelFutureListener() {
|
||||
public void operationComplete(ChannelFuture future) throws Exception {
|
||||
timeout.cancel();
|
||||
}
|
||||
});
|
||||
future.addListener(new TimeoutCanceller(timeout));
|
||||
}
|
||||
|
||||
super.writeRequested(ctx, e);
|
||||
@ -129,4 +125,21 @@ public class WriteTimeoutHandler extends SimpleChannelDownstreamHandler
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @author The Netty Project (netty-dev@lists.jboss.org)
|
||||
* @author Trustin Lee (tlee@redhat.com)
|
||||
* @version $Rev$, $Date$
|
||||
*/
|
||||
private static final class TimeoutCanceller implements ChannelFutureListener {
|
||||
private final Timeout timeout;
|
||||
|
||||
TimeoutCanceller(Timeout timeout) {
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
||||
public void operationComplete(ChannelFuture future) throws Exception {
|
||||
timeout.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user