Removed unnecessary volatiles from the examples

This commit is contained in:
Trustin Lee 2010-02-19 09:02:57 +00:00
parent a462d0e85e
commit 0066f9c3ff
4 changed files with 7 additions and 7 deletions

View File

@ -53,8 +53,8 @@ import org.jboss.netty.util.CharsetUtil;
*/ */
public class HttpRequestHandler extends SimpleChannelUpstreamHandler { public class HttpRequestHandler extends SimpleChannelUpstreamHandler {
private volatile HttpRequest request; private HttpRequest request;
private volatile boolean readingChunks; private boolean readingChunks;
/** Buffer that stores the response content */ /** Buffer that stores the response content */
private final StringBuilder buf = new StringBuilder(); private final StringBuilder buf = new StringBuilder();

View File

@ -32,7 +32,7 @@ import org.jboss.netty.util.CharsetUtil;
*/ */
public class HttpResponseHandler extends SimpleChannelUpstreamHandler { public class HttpResponseHandler extends SimpleChannelUpstreamHandler {
private volatile boolean readingChunks; private boolean readingChunks;
@Override @Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception { public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {

View File

@ -49,7 +49,7 @@ public class LocalTimeClientHandler extends SimpleChannelUpstreamHandler {
LocalTimeClientHandler.class.getName()); LocalTimeClientHandler.class.getName());
// Stateful properties // Stateful properties
private volatile Channel channel; private Channel channel;
private final BlockingQueue<LocalTimes> answer = new LinkedBlockingQueue<LocalTimes>(); private final BlockingQueue<LocalTimes> answer = new LinkedBlockingQueue<LocalTimes>();
public List<String> getLocalTimes(Collection<String> cities) { public List<String> getLocalTimes(Collection<String> cities) {
@ -106,10 +106,10 @@ public class LocalTimeClientHandler extends SimpleChannelUpstreamHandler {
} }
@Override @Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e)
throws Exception { throws Exception {
channel = e.getChannel(); channel = e.getChannel();
super.channelOpen(ctx, e); super.channelConnected(ctx, e);
} }
@Override @Override

View File

@ -41,7 +41,7 @@ public class UptimeClientHandler extends SimpleChannelUpstreamHandler {
final ClientBootstrap bootstrap; final ClientBootstrap bootstrap;
private final Timer timer; private final Timer timer;
private volatile long startTime = -1; private long startTime = -1;
public UptimeClientHandler(ClientBootstrap bootstrap, Timer timer) { public UptimeClientHandler(ClientBootstrap bootstrap, Timer timer) {
this.bootstrap = bootstrap; this.bootstrap = bootstrap;