storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ptgo...@apache.org
Subject [2/7] git commit: STORM-342: rename the read-write lock
Date Thu, 12 Jun 2014 21:03:14 GMT
STORM-342: rename the read-write lock


Project: http://git-wip-us.apache.org/repos/asf/incubator-storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-storm/commit/6946c34e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-storm/tree/6946c34e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-storm/diff/6946c34e

Branch: refs/heads/master
Commit: 6946c34e9f06726b46c5fb1bf12e1f186a1a8a19
Parents: 72b1f59
Author: Sean Zhong <clockfly@gmail.com>
Authored: Tue Jun 10 20:29:28 2014 +0800
Committer: Sean Zhong <clockfly@gmail.com>
Committed: Tue Jun 10 20:29:28 2014 +0800

----------------------------------------------------------------------
 .../src/jvm/backtype/storm/utils/DisruptorQueue.java    | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/6946c34e/storm-core/src/jvm/backtype/storm/utils/DisruptorQueue.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/utils/DisruptorQueue.java b/storm-core/src/jvm/backtype/storm/utils/DisruptorQueue.java
index 0068964..75ccbbc 100644
--- a/storm-core/src/jvm/backtype/storm/utils/DisruptorQueue.java
+++ b/storm-core/src/jvm/backtype/storm/utils/DisruptorQueue.java
@@ -55,8 +55,8 @@ public class DisruptorQueue implements IStatefulObject {
     ConcurrentLinkedQueue<Object> _cache = new ConcurrentLinkedQueue();
     
     private final ReentrantReadWriteLock cacheLock = new ReentrantReadWriteLock();
-    private final Lock cacheReadLock  = cacheLock.readLock();
-    private final Lock cacheWriteLock = cacheLock.writeLock();
+    private final Lock readLock  = cacheLock.readLock();
+    private final Lock writeLock = cacheLock.writeLock();
     
     private static String PREFIX = "disruptor-";
     private String _queueName = "";
@@ -152,14 +152,14 @@ public class DisruptorQueue implements IStatefulObject {
         boolean publishNow = consumerStartedFlag;
 
         if (!publishNow) {
-            cacheReadLock.lock(); 
+            readLock.lock(); 
             try {
                 publishNow = consumerStartedFlag;
                 if (!publishNow) {
                     _cache.add(obj);
                 }
             } finally {
-                cacheReadLock.unlock();
+                readLock.unlock();
             }
         }
         
@@ -185,8 +185,8 @@ public class DisruptorQueue implements IStatefulObject {
         consumerStartedFlag = true;
         
         // Use writeLock to make sure all pending cache add opearation completed
-        cacheWriteLock.lock();
-        cacheWriteLock.unlock();
+        writeLock.lock();
+        writeLock.unlock();
     }
     
     public long  population() { return (writePos() - readPos()); }


Mime
View raw message