Removed unnecessary volatiles from the examples
This commit is contained in:
parent
a462d0e85e
commit
0066f9c3ff
@ -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();
|
||||||
|
|
||||||
|
@ -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 {
|
||||||
|
@ -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
|
||||||
|
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user