Move private methods only used from inner classes to the inner classes
This commit is contained in:
parent
3e21e3250f
commit
b1f2fe752b
@ -15,10 +15,6 @@
|
||||
*/
|
||||
package org.jboss.netty.handler.timeout;
|
||||
|
||||
import static org.jboss.netty.channel.Channels.*;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jboss.netty.bootstrap.ServerBootstrap;
|
||||
import org.jboss.netty.channel.ChannelHandler;
|
||||
import org.jboss.netty.channel.ChannelHandler.Sharable;
|
||||
@ -36,6 +32,10 @@ import org.jboss.netty.util.Timeout;
|
||||
import org.jboss.netty.util.Timer;
|
||||
import org.jboss.netty.util.TimerTask;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.jboss.netty.channel.Channels.*;
|
||||
|
||||
/**
|
||||
* Raises a {@link ReadTimeoutException} when no data was read within a certain
|
||||
* period of time.
|
||||
@ -232,19 +232,6 @@ public class ReadTimeoutHandler extends SimpleChannelUpstreamHandler
|
||||
return state;
|
||||
}
|
||||
|
||||
private void fireReadTimedOut(final ChannelHandlerContext ctx) throws Exception {
|
||||
ctx.getPipeline().execute(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
readTimedOut(ctx);
|
||||
} catch (Throwable t) {
|
||||
fireExceptionCaught(ctx, t);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void readTimedOut(ChannelHandlerContext ctx) throws Exception {
|
||||
Channels.fireExceptionCaught(ctx, EXCEPTION);
|
||||
}
|
||||
@ -280,6 +267,19 @@ public class ReadTimeoutHandler extends SimpleChannelUpstreamHandler
|
||||
timer.newTimeout(this, nextDelay, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
private void fireReadTimedOut(final ChannelHandlerContext ctx) throws Exception {
|
||||
ctx.getPipeline().execute(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
readTimedOut(ctx);
|
||||
} catch (Throwable t) {
|
||||
fireExceptionCaught(ctx, t);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static final class State {
|
||||
|
@ -15,10 +15,6 @@
|
||||
*/
|
||||
package org.jboss.netty.handler.timeout;
|
||||
|
||||
import static org.jboss.netty.channel.Channels.*;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jboss.netty.bootstrap.ServerBootstrap;
|
||||
import org.jboss.netty.channel.ChannelFuture;
|
||||
import org.jboss.netty.channel.ChannelFutureListener;
|
||||
@ -35,6 +31,10 @@ import org.jboss.netty.util.Timeout;
|
||||
import org.jboss.netty.util.Timer;
|
||||
import org.jboss.netty.util.TimerTask;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.jboss.netty.channel.Channels.*;
|
||||
|
||||
/**
|
||||
* Raises a {@link WriteTimeoutException} when no data was written within a
|
||||
* certain period of time.
|
||||
@ -159,19 +159,6 @@ public class WriteTimeoutHandler extends SimpleChannelDownstreamHandler
|
||||
super.writeRequested(ctx, e);
|
||||
}
|
||||
|
||||
private void fireWriteTimeOut(final ChannelHandlerContext ctx) {
|
||||
ctx.getPipeline().execute(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
writeTimedOut(ctx);
|
||||
} catch (Throwable t) {
|
||||
fireExceptionCaught(ctx, t);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void writeTimedOut(ChannelHandlerContext ctx) throws Exception {
|
||||
Channels.fireExceptionCaught(ctx, EXCEPTION);
|
||||
}
|
||||
@ -201,6 +188,19 @@ public class WriteTimeoutHandler extends SimpleChannelDownstreamHandler
|
||||
fireWriteTimeOut(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
private void fireWriteTimeOut(final ChannelHandlerContext ctx) {
|
||||
ctx.getPipeline().execute(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
writeTimedOut(ctx);
|
||||
} catch (Throwable t) {
|
||||
fireExceptionCaught(ctx, t);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static final class TimeoutCanceller implements ChannelFutureListener {
|
||||
|
Loading…
Reference in New Issue
Block a user