hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1526519 - /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java
Date Thu, 26 Sep 2013 14:50:40 GMT
Author: tedyu
Date: Thu Sep 26 14:50:40 2013
New Revision: 1526519

URL: http://svn.apache.org/r1526519
Log:
HBASE-9640 Increment of loadSequence in CoprocessorHost#loadInstance() is thread-unsafe 


Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java?rev=1526519&r1=1526518&r2=1526519&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java
Thu Sep 26 14:50:40 2013
@@ -30,6 +30,7 @@ import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
 import java.util.UUID;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -97,7 +98,7 @@ public abstract class CoprocessorHost<E 
   protected Configuration conf;
   // unique file prefix to use for local copies of jars when classloading
   protected String pathPrefix;
-  protected volatile int loadSequence;
+  protected AtomicInteger loadSequence = new AtomicInteger();
 
   public CoprocessorHost() {
     pathPrefix = UUID.randomUUID().toString();
@@ -253,7 +254,7 @@ public abstract class CoprocessorHost<E 
       throw new IOException(e);
     }
     // create the environment
-    E env = createEnvironment(implClass, impl, priority, ++loadSequence, conf);
+    E env = createEnvironment(implClass, impl, priority, loadSequence.incrementAndGet(),
conf);
     if (env instanceof Environment) {
       ((Environment)env).startup();
     }



Mime
View raw message