ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ivasilin...@apache.org
Subject [25/29] incubator-ignite git commit: # ignite-961 review
Date Tue, 21 Jul 2015 11:25:19 GMT
# ignite-961 review


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

Branch: refs/heads/ignite-961
Commit: ed1482934e777d9a0aa99aa1fefd2f73231a6b2a
Parents: 829311d
Author: sboikov <sboikov@gridgain.com>
Authored: Tue Jul 21 11:55:22 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Tue Jul 21 11:55:22 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    |  8 ++--
 .../handlers/cache/GridCacheCommandHandler.java | 48 +-------------------
 2 files changed, 6 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ed148293/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 8a16e48..af38b20 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -2454,7 +2454,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
      * @param cacheName Cache name.
      * @return Ignite future.
      */
-    public IgniteInternalFuture destroyCacheAsync(String cacheName) {
+    public IgniteInternalFuture<?> destroyCacheAsync(String cacheName) {
         guard();
 
         try {
@@ -2487,14 +2487,14 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
      * @param cacheName Cache name.
      * @return Future that will be completed when cache is deployed.
      */
-    public IgniteInternalFuture getOrCreateCacheAsync(String cacheName) {
+    public IgniteInternalFuture<?> getOrCreateCacheAsync(String cacheName) {
         guard();
 
         try {
             if (ctx.cache().cache(cacheName) == null)
-                ctx.cache().getOrCreateFromTemplate(cacheName);
+                return ctx.cache().getOrCreateFromTemplate(cacheName);
 
-            return ctx.cache().dynamicStartCache(null, cacheName, null, false, true);
+            return new GridFinishedFuture<>();
         }
         finally {
             unguard();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ed148293/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
index 2d75341..64f595d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
@@ -158,7 +158,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
 
             switch (cmd) {
                 case DESTROY_CACHE: {
-                    fut = new DestroyCacheCommand(cacheName).apply(ctx).chain(
+                    fut = ((IgniteKernal)ctx.grid()).destroyCacheAsync(cacheName).chain(
                         new CX1<IgniteInternalFuture<?>, GridRestResponse>()
{
                             @Override public GridRestResponse applyx(IgniteInternalFuture<?>
f)
                                 throws IgniteCheckedException {
@@ -170,7 +170,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
                 }
 
                 case GET_OR_CREATE_CACHE: {
-                    fut = new GetOrCreateCacheClosure(cacheName).apply(ctx).chain(
+                    fut = ((IgniteKernal)ctx.grid()).getOrCreateCacheAsync(cacheName).chain(
                         new CX1<IgniteInternalFuture<?>, GridRestResponse>()
{
                             @Override public GridRestResponse applyx(IgniteInternalFuture<?>
f)
                                 throws IgniteCheckedException {
@@ -1348,48 +1348,4 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
             return c.sizeAsync(new CachePeekMode[]{CachePeekMode.PRIMARY});
         }
     }
-
-    /**
-     * Destroy cache callable.
-     */
-    private static class DestroyCacheCommand extends GetOrCreateCacheClosure {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /**
-         * @param cacheName Cache name.
-         */
-        public DestroyCacheCommand(String cacheName) {
-            super(cacheName);
-        }
-
-        /** {@inheritDoc} */
-        @Override public IgniteInternalFuture<?> apply(GridKernalContext ctx) {
-            return ((IgniteKernal)ctx.grid()).destroyCacheAsync(cacheName);
-        }
-    }
-
-    /**
-     * Get or create cache callable.
-     */
-    private static class GetOrCreateCacheClosure implements
-        IgniteClosure<GridKernalContext, IgniteInternalFuture<?>> {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** Cache name. */
-        protected String cacheName;
-
-        /**
-         * @param cacheName Cache name.
-         */
-        public GetOrCreateCacheClosure(String cacheName) {
-            this.cacheName = cacheName;
-        }
-
-        /** {@inheritDoc} */
-        @Override public IgniteInternalFuture<?> apply(GridKernalContext ctx) {
-            return ((IgniteKernal)ctx.grid()).getOrCreateCacheAsync(cacheName);
-        }
-    }
 }


Mime
View raw message