This commit is contained in:
Trustin Lee 2009-06-19 11:33:38 +00:00
parent dba344bd8e
commit 629ae769d7
3 changed files with 51 additions and 0 deletions

View File

@ -71,6 +71,9 @@ import org.jboss.netty.util.TimerTask;
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Trustin Lee (tlee@redhat.com)
* @version $Rev$, $Date$
*
* @see ReadTimeoutHandler
* @see WriteTimeoutHandler
*/
@ChannelPipelineCoverage("one")
public class IdleStateHandler extends SimpleChannelUpstreamHandler

View File

@ -39,9 +39,15 @@ import org.jboss.netty.util.Timer;
import org.jboss.netty.util.TimerTask;
/**
* Raises a {@link ReadTimeoutException} when no data was read within a certain
* period of time.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Trustin Lee (tlee@redhat.com)
* @version $Rev$, $Date$
*
* @see WriteTimeoutHandler
* @see IdleStateHandler
*/
@ChannelPipelineCoverage("one")
public class ReadTimeoutHandler extends SimpleChannelUpstreamHandler
@ -56,10 +62,28 @@ public class ReadTimeoutHandler extends SimpleChannelUpstreamHandler
private volatile ReadTimeoutTask task;
volatile long lastReadTime;
/**
* Creates a new instance.
*
* @param timer
* the {@link Timer} that is used to trigger the scheduled event
* @param timeoutSeconds
* read timeout in seconds
*/
public ReadTimeoutHandler(Timer timer, int timeoutSeconds) {
this(timer, timeoutSeconds, TimeUnit.SECONDS);
}
/**
* Creates a new instance.
*
* @param timer
* the {@link Timer} that is used to trigger the scheduled event
* @param timeout
* read timeout
* @param unit
* the {@link TimeUnit} of {@code timeout}
*/
public ReadTimeoutHandler(Timer timer, long timeout, TimeUnit unit) {
if (timer == null) {
throw new NullPointerException("timer");

View File

@ -39,9 +39,15 @@ import org.jboss.netty.util.Timer;
import org.jboss.netty.util.TimerTask;
/**
* Raises a {@link WriteTimeoutException} when no data was written within a
* certain period of time.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Trustin Lee (tlee@redhat.com)
* @version $Rev$, $Date$
*
* @see ReadTimeoutHandler
* @see IdleStateHandler
*/
@ChannelPipelineCoverage("all")
public class WriteTimeoutHandler extends SimpleChannelDownstreamHandler
@ -52,10 +58,28 @@ public class WriteTimeoutHandler extends SimpleChannelDownstreamHandler
private final Timer timer;
private final long timeoutMillis;
/**
* Creates a new instance.
*
* @param timer
* the {@link Timer} that is used to trigger the scheduled event
* @param timeoutSeconds
* write timeout in seconds
*/
public WriteTimeoutHandler(Timer timer, int timeoutSeconds) {
this(timer, timeoutSeconds, TimeUnit.SECONDS);
}
/**
* Creates a new instance.
*
* @param timer
* the {@link Timer} that is used to trigger the scheduled event
* @param timeout
* write timeout
* @param unit
* the {@link TimeUnit} of {@code timeout}
*/
public WriteTimeoutHandler(Timer timer, long timeout, TimeUnit unit) {
if (timer == null) {
throw new NullPointerException("timer");