Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-45-debug 4e4feb841 -> 77715e238


# IGNITE-45 - Fixing tests.


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

Branch: refs/heads/ignite-45-debug
Commit: 77715e238754dc983abf6b23341bbf0ea1060e5c
Parents: 4e4feb8
Author: Alexey Goncharuk <agoncha...@gridgain.com>
Authored: Fri Mar 20 19:03:48 2015 -0700
Committer: Alexey Goncharuk <agoncha...@gridgain.com>
Committed: Fri Mar 20 19:03:48 2015 -0700

----------------------------------------------------------------------
 .../processors/cache/GridCacheProcessor.java    | 33 +++++++++++++++++---
 1 file changed, 29 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/77715e23/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 278e2c8..a943624 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -46,6 +46,7 @@ import org.apache.ignite.internal.processors.query.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.future.*;
 import org.apache.ignite.internal.util.lang.*;
+import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
@@ -1539,10 +1540,12 @@ public class GridCacheProcessor extends 
GridProcessorAdapter {
 
         DynamicCacheDescriptor desc = 
registeredCaches.get(maskNull(cacheName));
 
+        U.debug(log, "Requested to start cache [localNodeId=" + 
ctx.localNodeId() + ", name=" + cacheName + ", desc=" + desc + ']');
+
         DynamicCacheChangeRequest req = new 
DynamicCacheChangeRequest(ctx.localNodeId());
 
         if (ccfg != null) {
-            if (desc != null) {
+            if (desc != null && !desc.cancelled()) {
                 if (failIfExists)
                     return new GridFinishedFuture<>(new 
IgniteCacheExistsException("Failed to start cache " +
                             "(a cache with the same name is already started): 
" + cacheName));
@@ -1615,7 +1618,7 @@ public class GridCacheProcessor extends 
GridProcessorAdapter {
         Collection<DynamicCacheChangeRequest> sendReqs = new 
ArrayList<>(reqs.size());
 
         for (DynamicCacheChangeRequest req : reqs) {
-            DynamicCacheStartFuture fut = new 
DynamicCacheStartFuture(req.cacheName(), req.deploymentId());
+            DynamicCacheStartFuture fut = new 
DynamicCacheStartFuture(req.cacheName(), req.deploymentId(), req);
 
             try {
                 if (req.isStop()) {
@@ -1643,6 +1646,8 @@ public class GridCacheProcessor extends 
GridProcessorAdapter {
 
                 if (old != null) {
                     if (req.isStart() && !req.clientStartOnly()) {
+                        U.debug(log, "!!! Future collision (will fail) [old=" 
+ old + ", req=" + req + ']');
+
                         fut.onDone(new IgniteCacheExistsException("Failed to 
start cache " +
                             "(a cache with the same name is already being 
started or stopped): " + req.cacheName()));
                     }
@@ -2464,16 +2469,22 @@ public class GridCacheProcessor extends 
GridProcessorAdapter {
     @SuppressWarnings("ExternalizableWithoutPublicNoArgConstructor")
     private class DynamicCacheStartFuture extends GridFutureAdapter<Object> {
         /** Start ID. */
+        @GridToStringInclude
         private IgniteUuid deploymentId;
 
         /** Cache name. */
         private String cacheName;
 
+        /** Change request. */
+        @GridToStringInclude
+        private DynamicCacheChangeRequest req;
+
         /**
          */
-        private DynamicCacheStartFuture(String cacheName, IgniteUuid 
deploymentId) {
+        private DynamicCacheStartFuture(String cacheName, IgniteUuid 
deploymentId, DynamicCacheChangeRequest req) {
             this.deploymentId = deploymentId;
             this.cacheName = cacheName;
+            this.req = req;
         }
 
         /**
@@ -2483,16 +2494,30 @@ public class GridCacheProcessor extends 
GridProcessorAdapter {
             return deploymentId;
         }
 
+        /**
+         * @return Request.
+         */
+        public DynamicCacheChangeRequest request() {
+            return req;
+        }
+
         /** {@inheritDoc} */
         @Override public boolean onDone(@Nullable Object res, @Nullable 
Throwable err) {
+            pendingFuts.remove(maskNull(cacheName), this);
+
             if (super.onDone(res, err)) {
-                pendingFuts.remove(maskNull(cacheName), this);
+                U.debug(log, "Completed future: " + this);
 
                 return true;
             }
 
             return false;
         }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(DynamicCacheStartFuture.class, this);
+        }
     }
 
     /**

Reply via email to