ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject ignite git commit: IGNITE-5364 Remove contention on DataStructure creation or removing
Date Tue, 13 Jun 2017 16:03:01 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 11881782b -> 9925bc2b8


IGNITE-5364 Remove contention on DataStructure creation or removing


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

Branch: refs/heads/master
Commit: 9925bc2b87238ce3ff58d138baa11aec169e27d9
Parents: 1188178
Author: mcherkasov <mcherkasov@gridgain.com>
Authored: Tue Jun 13 18:36:54 2017 +0300
Committer: Anton Vinogradov <av@apache.org>
Committed: Tue Jun 13 19:02:50 2017 +0300

----------------------------------------------------------------------
 .../CacheDataStructuresCacheKey.java            |  64 ----
 .../CacheDataStructuresConfigurationKey.java    |  64 ----
 .../datastructures/DataStructureInfoKey.java    |  56 +++
 .../datastructures/DataStructuresCacheKey.java  |  42 +++
 .../datastructures/DataStructuresProcessor.java | 373 +++----------------
 5 files changed, 158 insertions(+), 441 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9925bc2b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CacheDataStructuresCacheKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CacheDataStructuresCacheKey.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CacheDataStructuresCacheKey.java
deleted file mode 100644
index c7676a5..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CacheDataStructuresCacheKey.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.datastructures;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import org.apache.ignite.internal.processors.cache.GridCacheInternal;
-
-/**
- * Internal key for data structures processor.
- */
-public class CacheDataStructuresCacheKey implements GridCacheInternal, Externalizable {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     *
-     */
-    public CacheDataStructuresCacheKey() {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        return getClass().getName().hashCode();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object obj) {
-        return obj == this || (obj instanceof CacheDataStructuresCacheKey);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return "CacheDataStructuresCacheKey []";
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/9925bc2b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CacheDataStructuresConfigurationKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CacheDataStructuresConfigurationKey.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CacheDataStructuresConfigurationKey.java
deleted file mode 100644
index f331811..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CacheDataStructuresConfigurationKey.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.datastructures;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import org.apache.ignite.internal.processors.cache.GridCacheInternal;
-
-/**
- * Key used to store in utility cache information about all created data structures.
- */
-public class CacheDataStructuresConfigurationKey implements GridCacheInternal, Externalizable
{
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     *
-     */
-    public CacheDataStructuresConfigurationKey() {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        return getClass().getName().hashCode();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object obj) {
-        return obj == this || (obj instanceof CacheDataStructuresConfigurationKey);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return "CacheDataStructuresConfigurationKey []";
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/9925bc2b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructureInfoKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructureInfoKey.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructureInfoKey.java
new file mode 100644
index 0000000..5d6a337
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructureInfoKey.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.datastructures;
+
+import java.io.Serializable;
+
+/**
+ * Key used to store in utility cache information about created data structures.
+ */
+public class DataStructureInfoKey implements Serializable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Data structure name. */
+    private String name;
+
+    /**
+     * @param name Data structure name.
+     */
+    public DataStructureInfoKey(String name) {
+        this.name = name;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        DataStructureInfoKey key2 = (DataStructureInfoKey)o;
+
+        return name != null ? name.equals(key2.name) : key2.name == null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return name != null ? name.hashCode() : 0;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9925bc2b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresCacheKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresCacheKey.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresCacheKey.java
new file mode 100644
index 0000000..ef2e7ea
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresCacheKey.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.datastructures;
+
+import java.io.Serializable;
+
+/**
+ * Internal key for data structures processor.
+ */
+public class DataStructuresCacheKey implements Serializable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return getClass().getName().hashCode();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object obj) {
+        return obj == this || (obj instanceof DataStructuresCacheKey);
+    }
+
+    @Override public String toString() {
+        return "DataStructuresCacheKey []";
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/9925bc2b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
index df9d269..1b82967 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
@@ -34,7 +34,6 @@ import javax.cache.event.CacheEntryListenerException;
 import javax.cache.event.CacheEntryUpdatedListener;
 import javax.cache.event.EventType;
 import javax.cache.processor.EntryProcessor;
-import javax.cache.processor.EntryProcessorException;
 import javax.cache.processor.MutableEntry;
 import org.apache.ignite.IgniteAtomicLong;
 import org.apache.ignite.IgniteAtomicReference;
@@ -74,7 +73,6 @@ import org.apache.ignite.internal.util.lang.IgniteOutClosureX;
 import org.apache.ignite.internal.util.typedef.CI1;
 import org.apache.ignite.internal.util.typedef.CIX1;
 import org.apache.ignite.internal.util.typedef.CX1;
-import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.CU;
@@ -106,12 +104,8 @@ import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_REA
  */
 public final class DataStructuresProcessor extends GridProcessorAdapter implements IgniteChangeGlobalStateSupport
{
     /** */
-    public static final CacheDataStructuresConfigurationKey DATA_STRUCTURES_KEY =
-        new CacheDataStructuresConfigurationKey();
-
-    /** */
-    private static final CacheDataStructuresCacheKey DATA_STRUCTURES_CACHE_KEY =
-        new CacheDataStructuresCacheKey();
+    private static final DataStructuresCacheKey DATA_STRUCTURES_CACHE_KEY =
+        new DataStructuresCacheKey();
 
     /** Initial capacity. */
     private static final int INITIAL_CAPACITY = 10;
@@ -156,10 +150,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter
implemen
     private final AtomicConfiguration atomicCfg;
 
     /** */
-    private IgniteInternalCache<CacheDataStructuresConfigurationKey, Map<String, DataStructureInfo>>
utilityCache;
-
-    /** */
-    private IgniteInternalCache<CacheDataStructuresCacheKey, List<CacheCollectionInfo>>
utilityDataCache;
+    private IgniteInternalCache<DataStructureInfoKey, DataStructureInfo> utilityCache;
 
     /** */
     private volatile UUID qryId;
@@ -227,9 +218,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter
implemen
         if (!activeOnStart && ctx.state().active())
             ctx.event().addLocalEventListener(lsnr, EVT_NODE_LEFT, EVT_NODE_FAILED);
 
-        utilityCache = (IgniteInternalCache)ctx.cache().utilityCache();
-
-        utilityDataCache = (IgniteInternalCache)ctx.cache().utilityCache();
+        utilityCache = ctx.cache().utilityCache();
 
         assert utilityCache != null;
 
@@ -583,15 +572,17 @@ public final class DataStructuresProcessor extends GridProcessorAdapter
implemen
         Class<? extends T> cls)
         throws IgniteCheckedException
     {
-        Map<String, DataStructureInfo> dsMap = utilityCache.get(DATA_STRUCTURES_KEY);
+        final DataStructureInfoKey dsKey = new DataStructureInfoKey(dsInfo.name);
 
-        if (!create && (dsMap == null || !dsMap.containsKey(dsInfo.name)))
-            return null;
+        DataStructureInfo cached = utilityCache.get(dsKey);
 
-        IgniteCheckedException err = validateDataStructure(dsMap, dsInfo, create);
+        if (cached != null) {
+            IgniteCheckedException err = cached.validate(dsInfo, create);
 
-        if (err != null)
-            throw err;
+            if (err != null)
+                throw err;
+        } else if (!create)
+            return null;
 
         final GridCacheInternalKey key = new GridCacheInternalKeyImpl(dsInfo.name);
 
@@ -607,11 +598,16 @@ public final class DataStructuresProcessor extends GridProcessorAdapter
implemen
                     return c.applyx();
 
                 try (GridNearTxLocal tx = utilityCache.txStartEx(PESSIMISTIC, REPEATABLE_READ))
{
-                    IgniteCheckedException err =
-                        utilityCache.invoke(DATA_STRUCTURES_KEY, new AddAtomicProcessor(dsInfo)).get();
+                    DataStructureInfo oldInfo = utilityCache.get(dsKey);
 
-                    if (err != null)
-                        throw err;
+                    if (oldInfo == null)
+                        utilityCache.put(dsKey, dsInfo);
+                    else {
+                        IgniteCheckedException err = oldInfo.validate(dsInfo, true);
+
+                        if (err != null)
+                            throw err;
+                    }
 
                     T dataStructure = c.applyx();
 
@@ -664,14 +660,16 @@ public final class DataStructuresProcessor extends GridProcessorAdapter
implemen
         @Nullable final IgniteInClosureX<T> afterRmv)
         throws IgniteCheckedException
     {
-        Map<String, DataStructureInfo> dsMap = utilityCache.get(DATA_STRUCTURES_KEY);
+        final DataStructureInfoKey dsKey = new DataStructureInfoKey(name);
 
-        if (dsMap == null || !dsMap.containsKey(name))
+        DataStructureInfo cached = utilityCache.get(dsKey);
+
+        if (cached == null)
             return;
 
         final DataStructureInfo dsInfo = new DataStructureInfo(name, type, null);
 
-        IgniteCheckedException err = validateDataStructure(dsMap, dsInfo, false);
+        IgniteCheckedException err = cached.validate(dsInfo, false);
 
         if (err != null)
             throw err;
@@ -679,20 +677,17 @@ public final class DataStructuresProcessor extends GridProcessorAdapter
implemen
         retryTopologySafe(new IgniteOutClosureX<Void>() {
             @Override public Void applyx() throws IgniteCheckedException {
                 try (GridNearTxLocal tx = utilityCache.txStartEx(PESSIMISTIC, REPEATABLE_READ))
{
-                    T2<Boolean, IgniteCheckedException> res =
-                        utilityCache.invoke(DATA_STRUCTURES_KEY, new RemoveDataStructureProcessor(dsInfo)).get();
-
-                    IgniteCheckedException err = res.get2();
-
-                    if (err != null)
-                        throw err;
+                    DataStructureInfo oldInfo = utilityCache.get(dsKey);
 
-                    assert res.get1() != null;
+                    if (oldInfo == null)
+                        return null;
 
-                    boolean exists = res.get1();
+                    IgniteCheckedException err = oldInfo.validate(dsInfo, false);
 
-                    if (!exists)
-                        return null;
+                    if (err == null)
+                        utilityCache.remove(dsKey);
+                    else
+                        throw err;
 
                     T rmvInfo = c.applyx();
 
@@ -979,6 +974,9 @@ public final class DataStructuresProcessor extends GridProcessorAdapter
implemen
      * @throws IgniteCheckedException If failed.
      */
     private String compatibleConfiguration(CollectionConfiguration cfg) throws IgniteCheckedException
{
+        IgniteInternalCache<DataStructuresCacheKey, List<CacheCollectionInfo>>
utilityDataCache =
+            ctx.cache().utilityCache();
+
         List<CacheCollectionInfo> caches = utilityDataCache.context().affinityNode()
?
             utilityDataCache.localPeek(DATA_STRUCTURES_CACHE_KEY, null, null) :
             utilityDataCache.get(DATA_STRUCTURES_CACHE_KEY);
@@ -1057,22 +1055,23 @@ public final class DataStructuresProcessor extends GridProcessorAdapter
implemen
     {
         awaitInitialization();
 
-        Map<String, DataStructureInfo> dsMap = utilityCache.get(DATA_STRUCTURES_KEY);
+        final DataStructureInfoKey dsKey = new DataStructureInfoKey(dsInfo.name);
 
-        if (!create && (dsMap == null || !dsMap.containsKey(dsInfo.name)))
-            return null;
+        DataStructureInfo cached = utilityCache.get(dsKey);
 
-        IgniteCheckedException err = validateDataStructure(dsMap, dsInfo, create);
+        if (cached != null) {
+            IgniteCheckedException err = cached.validate(dsInfo, create);
 
-        if (err != null)
-            throw err;
+            if (err != null)
+                throw err;
 
-        if (!create) {
-            DataStructureInfo oldInfo = dsMap.get(dsInfo.name);
+        } else if (!create)
+            return null;
 
-            assert oldInfo.info instanceof CollectionInfo : oldInfo.info;
+        if (!create) {
+            assert cached.info instanceof CollectionInfo : cached.info;
 
-            String cacheName = ((CollectionInfo)oldInfo.info).cacheName;
+            String cacheName = ((CollectionInfo)cached.info).cacheName;
 
             GridCacheContext cacheCtx = ctx.cache().getOrStartCache(cacheName).context();
 
@@ -1082,17 +1081,20 @@ public final class DataStructuresProcessor extends GridProcessorAdapter
implemen
         return retryTopologySafe(new IgniteOutClosureX<T>() {
             @Override public T applyx() throws IgniteCheckedException {
                 try (GridNearTxLocal tx = utilityCache.txStartEx(PESSIMISTIC, REPEATABLE_READ))
{
-                    T2<String, IgniteCheckedException> res =
-                        utilityCache.invoke(DATA_STRUCTURES_KEY, new AddCollectionProcessor(dsInfo)).get();
+                    DataStructureInfo oldInfo = utilityCache.get(dsKey);
 
-                    IgniteCheckedException err = res.get2();
+                    if (oldInfo == null)
+                        utilityCache.put(dsKey, dsInfo);
+                    else {
+                        IgniteCheckedException err = oldInfo.validate(dsInfo, true);
 
-                    if (err != null)
-                        throw err;
+                        if (err != null)
+                            throw err;
+                    }
 
-                    String cacheName = res.get1();
+                    CollectionInfo colInfo = (CollectionInfo)dsInfo.info;
 
-                    final GridCacheContext cacheCtx = ctx.cache().internalCache(cacheName).context();
+                    final GridCacheContext cacheCtx = ctx.cache().internalCache(colInfo.cacheName).context();
 
                     T col = c.applyx(cacheCtx);
 
@@ -1123,28 +1125,6 @@ public final class DataStructuresProcessor extends GridProcessorAdapter
implemen
     }
 
     /**
-     * @param dsMap Map with data structure information.
-     * @param info New data structure information.
-     * @param create Create flag.
-     * @return {@link IgniteException} if validation failed.
-     */
-    @Nullable private static IgniteCheckedException validateDataStructure(
-        @Nullable Map<String, DataStructureInfo> dsMap,
-        DataStructureInfo info,
-        boolean create)
-    {
-        if (dsMap == null)
-            return null;
-
-        DataStructureInfo oldInfo = dsMap.get(info.name);
-
-        if (oldInfo != null)
-            return oldInfo.validate(info, create);
-
-        return null;
-    }
-
-    /**
      * Gets or creates count down latch. If count down latch is not found in cache,
      * it is created using provided name and count parameter.
      *
@@ -2125,168 +2105,8 @@ public final class DataStructuresProcessor extends GridProcessorAdapter
implemen
     /**
      *
      */
-    static class AddAtomicProcessor implements
-        EntryProcessor<CacheDataStructuresConfigurationKey, Map<String, DataStructureInfo>,
IgniteCheckedException>,
-        Externalizable {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** */
-        private DataStructureInfo info;
-
-        /**
-         * @param info Data structure information.
-         */
-        AddAtomicProcessor(DataStructureInfo info) {
-            assert info != null;
-
-            this.info = info;
-        }
-
-        /**
-         * Required by {@link Externalizable}.
-         */
-        public AddAtomicProcessor() {
-            // No-op.
-        }
-
-        /** {@inheritDoc} */
-        @Override public IgniteCheckedException process(
-            MutableEntry<CacheDataStructuresConfigurationKey, Map<String, DataStructureInfo>>
entry,
-            Object... args)
-            throws EntryProcessorException
-        {
-            Map<String, DataStructureInfo> map = entry.getValue();
-
-            if (map == null) {
-                map = new HashMap<>();
-
-                map.put(info.name, info);
-
-                entry.setValue(map);
-
-                return null;
-            }
-
-            DataStructureInfo oldInfo = map.get(info.name);
-
-            if (oldInfo == null) {
-                map = new HashMap<>(map);
-
-                map.put(info.name, info);
-
-                entry.setValue(map);
-
-                return null;
-            }
-
-            return oldInfo.validate(info, true);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void writeExternal(ObjectOutput out) throws IOException {
-            info.writeExternal(out);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
-            info = new DataStructureInfo();
-
-            info.readExternal(in);
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(AddAtomicProcessor.class, this);
-        }
-    }
-
-    /**
-     *
-     */
-    static class AddCollectionProcessor implements
-        EntryProcessor<CacheDataStructuresConfigurationKey, Map<String, DataStructureInfo>,
-            T2<String, IgniteCheckedException>>, Externalizable {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** */
-        private DataStructureInfo info;
-
-        /**
-         * @param info Data structure information.
-         */
-        AddCollectionProcessor(DataStructureInfo info) {
-            assert info != null;
-            assert info.info instanceof CollectionInfo;
-
-            this.info = info;
-        }
-
-        /**
-         * Required by {@link Externalizable}.
-         */
-        public AddCollectionProcessor() {
-            // No-op.
-        }
-
-        /** {@inheritDoc} */
-        @Override public T2<String, IgniteCheckedException> process(
-            MutableEntry<CacheDataStructuresConfigurationKey, Map<String, DataStructureInfo>>
entry,
-            Object... args)
-        {
-            Map<String, DataStructureInfo> map = entry.getValue();
-
-            CollectionInfo colInfo = (CollectionInfo)info.info;
-
-            if (map == null) {
-                map = new HashMap<>();
-
-                map.put(info.name, info);
-
-                entry.setValue(map);
-
-                return new T2<>(colInfo.cacheName, null);
-            }
-
-            DataStructureInfo oldInfo = map.get(info.name);
-
-            if (oldInfo == null) {
-                map = new HashMap<>(map);
-
-                map.put(info.name, info);
-
-                entry.setValue(map);
-
-                return new T2<>(colInfo.cacheName, null);
-            }
-
-            return new T2<>(colInfo.cacheName, oldInfo.validate(info, true));
-        }
-
-        /** {@inheritDoc} */
-        @Override public void writeExternal(ObjectOutput out) throws IOException {
-            info.writeExternal(out);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
-            info = new DataStructureInfo();
-
-            info.readExternal(in);
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(AddCollectionProcessor.class, this);
-        }
-    }
-
-    /**
-     *
-     */
     static class AddDataCacheProcessor implements
-        EntryProcessor<CacheDataStructuresCacheKey, List<CacheCollectionInfo>, String>,
Externalizable {
+        EntryProcessor<DataStructuresCacheKey, List<CacheCollectionInfo>, String>,
Externalizable {
         /** Cache name prefix. */
         private static final String CACHE_NAME_PREFIX = "datastructures_";
 
@@ -2312,7 +2132,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter
implemen
 
         /** {@inheritDoc} */
         @Override public String process(
-            MutableEntry<CacheDataStructuresCacheKey, List<CacheCollectionInfo>>
entry,
+            MutableEntry<DataStructuresCacheKey, List<CacheCollectionInfo>> entry,
             Object... args)
         {
             List<CacheCollectionInfo> list = entry.getValue();
@@ -2359,77 +2179,4 @@ public final class DataStructuresProcessor extends GridProcessorAdapter
implemen
         }
     }
 
-    /**
-     *
-     */
-    static class RemoveDataStructureProcessor implements
-        EntryProcessor<CacheDataStructuresConfigurationKey, Map<String, DataStructureInfo>,
-            T2<Boolean, IgniteCheckedException>>, Externalizable {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** */
-        private DataStructureInfo info;
-
-        /**
-         * @param info Data structure information.
-         */
-        RemoveDataStructureProcessor(DataStructureInfo info) {
-            assert info != null;
-
-            this.info = info;
-        }
-
-        /**
-         * Required by {@link Externalizable}.
-         */
-        public RemoveDataStructureProcessor() {
-            // No-op.
-        }
-
-        /** {@inheritDoc} */
-        @Override public T2<Boolean, IgniteCheckedException> process(
-            MutableEntry<CacheDataStructuresConfigurationKey, Map<String, DataStructureInfo>>
entry,
-            Object... args)
-        {
-            Map<String, DataStructureInfo> map = entry.getValue();
-
-            if (map == null)
-                return new T2<>(false, null);
-
-            DataStructureInfo oldInfo = map.get(info.name);
-
-            if (oldInfo == null)
-                return new T2<>(false, null);
-
-            IgniteCheckedException err = oldInfo.validate(info, false);
-
-            if (err == null) {
-                map = new HashMap<>(map);
-
-                map.remove(info.name);
-
-                entry.setValue(map);
-            }
-
-            return new T2<>(true, err);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void writeExternal(ObjectOutput out) throws IOException {
-            info.writeExternal(out);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
-            info = new DataStructureInfo();
-
-            info.readExternal(in);
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(RemoveDataStructureProcessor.class, this);
-        }
-    }
 }


Mime
View raw message