Repository: ignite
Updated Branches:
  refs/heads/ignite-1093-2 fa34b7f4b -> cda7c83cc


1093


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cda7c83c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cda7c83c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cda7c83c

Branch: refs/heads/ignite-1093-2
Commit: cda7c83cc9ab7bd90958c298647f70d7ecf0f7c8
Parents: fa34b7f
Author: Anton Vinogradov <[email protected]>
Authored: Tue Oct 27 11:23:23 2015 +0300
Committer: Anton Vinogradov <[email protected]>
Committed: Tue Oct 27 11:23:23 2015 +0300

----------------------------------------------------------------------
 .../dht/preloader/GridDhtPreloader.java         | 25 ++++++++++++++------
 1 file changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cda7c83c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index 627b254..edcc18c 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -107,6 +107,9 @@ public class GridDhtPreloader extends 
GridCachePreloaderAdapter {
     /** Busy lock to prevent activities from accessing exchanger while it's 
stopping. */
     private final ReadWriteLock busyLock = new ReentrantReadWriteLock();
 
+    /** Demand lock. */
+    private final ReadWriteLock demandLock = new ReentrantReadWriteLock();
+
     /** Pending affinity assignment futures. */
     private ConcurrentMap<AffinityTopologyVersion, 
GridDhtAssignmentFetchFuture> pendingAssignmentFetchFuts =
         new ConcurrentHashMap8<>();
@@ -394,25 +397,33 @@ public class GridDhtPreloader extends 
GridCachePreloaderAdapter {
 
     /** {@inheritDoc} */
     public void handleSupplyMessage(int idx, UUID id, final 
GridDhtPartitionSupplyMessageV2 s) {
-        busyLock.readLock().lock();
+        if (!enterBusy())
+            return;
 
         try {
-            demander.handleSupplyMessage(idx, id, s);
+            demandLock.readLock().lock();
+            try {
+                demander.handleSupplyMessage(idx, id, s);
+            }
+            finally {
+                demandLock.readLock().unlock();
+            }
         }
         finally {
-            busyLock.readLock().unlock();
+            leaveBusy();
         }
     }
 
     /** {@inheritDoc} */
     public void handleDemandMessage(int idx, UUID id, 
GridDhtPartitionDemandMessage d) {
-        busyLock.readLock().lock();
+        if (!enterBusy())
+            return;
 
         try {
             supplier.handleDemandMessage(idx, id, d);
         }
         finally {
-            busyLock.readLock().unlock();
+            leaveBusy();
         }
     }
 
@@ -724,13 +735,13 @@ public class GridDhtPreloader extends 
GridCachePreloaderAdapter {
 
     /** {@inheritDoc} */
     @Override public void unwindUndeploys() {
-        busyLock.writeLock().lock();
+        demandLock.writeLock().lock();
 
         try {
             cctx.deploy().unwind(cctx);
         }
         finally {
-            busyLock.writeLock().unlock();
+            demandLock.writeLock().unlock();
         }
     }
 

Reply via email to