hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1520438 - /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
Date Thu, 05 Sep 2013 22:03:38 GMT
Author: tedyu
Date: Thu Sep  5 22:03:37 2013
New Revision: 1520438

URL: http://svn.apache.org/r1520438
Log:
HBASE-9411 Increment / decrement of rpcCount in RpcServer#Connection is not protected by synchronization


Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java?rev=1520438&r1=1520437&r2=1520438&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java Thu
Sep  5 22:03:37 2013
@@ -1093,7 +1093,7 @@ public class RpcServer implements RpcSer
     private ByteBuffer data;
     private ByteBuffer dataLengthBuffer;
     protected final LinkedList<Call> 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 RpcSer
 
     /* 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) {



Mime
View raw message