From 3f9e1e6c8fe976e69abfb1a61bccd5e22ace6685 Mon Sep 17 00:00:00 2001 From: Zhihong Yu Date: Thu, 5 Sep 2013 22:03:37 +0000 Subject: [PATCH] HBASE-9411 Increment / decrement of rpcCount in RpcServer#Connection is not protected by synchronization git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1520438 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/hadoop/hbase/ipc/RpcServer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java index 6cdf7f1cc24..f1e45263fc4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java @@ -1093,7 +1093,7 @@ public class RpcServer implements RpcServerInterface { private ByteBuffer data; private ByteBuffer dataLengthBuffer; protected final LinkedList responseQueue; - private volatile int rpcCount = 0; // number of outstanding rpcs + private Counter rpcCount = new Counter(); // number of outstanding rpcs private long lastContact; private InetAddress addr; protected Socket socket; @@ -1186,17 +1186,17 @@ public class RpcServer implements RpcServerInterface { /* Return true if the connection has no outstanding rpc */ private boolean isIdle() { - return rpcCount == 0; + return rpcCount.get() == 0; } /* Decrement the outstanding RPC count */ protected void decRpcCount() { - rpcCount--; + rpcCount.decrement(); } /* Increment the outstanding RPC count */ protected void incRpcCount() { - rpcCount++; + rpcCount.increment(); } protected boolean timedOut(long currentTime) {