Code cleanup
This commit is contained in:
parent
4979cb6a21
commit
fbfebb1fd9
@ -85,11 +85,7 @@ public class WriteTimeoutHandler extends SimpleChannelDownstreamHandler
|
|||||||
new WriteTimeoutTask(ctx, future),
|
new WriteTimeoutTask(ctx, future),
|
||||||
timeoutMillis, TimeUnit.MILLISECONDS);
|
timeoutMillis, TimeUnit.MILLISECONDS);
|
||||||
|
|
||||||
future.addListener(new ChannelFutureListener() {
|
future.addListener(new TimeoutCanceller(timeout));
|
||||||
public void operationComplete(ChannelFuture future) throws Exception {
|
|
||||||
timeout.cancel();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
super.writeRequested(ctx, e);
|
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