ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [36/50] [abbrv] ignite git commit: IGNITE-4157 Mapping update notification hook - Fixes #1447.
Date Wed, 15 Feb 2017 10:45:01 GMT
IGNITE-4157 Mapping update notification hook - Fixes #1447.

Signed-off-by: Alexey Goncharuk <alexey.goncharuk@gmail.com>


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

Branch: refs/heads/ignite-3477-merge2.0
Commit: 2e421c2a847caec7a2666a9d6cdf1035093c10fa
Parents: 19739a0
Author: Sergey Chugunov <sergey.chugunov@gmail.com>
Authored: Fri Feb 10 17:42:45 2017 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Fri Feb 10 17:42:45 2017 +0300

----------------------------------------------------------------------
 .../ignite/internal/MappingStoreTask.java       |  3 +-
 .../ignite/internal/MarshallerContextImpl.java  | 50 ++++++++++++++++----
 .../communication/GridIoMessageFactory.java     | 20 ++++----
 .../GridMarshallerMappingProcessor.java         | 39 ++++++++++-----
 .../marshaller/MappingUpdatedListener.java      | 29 ++++++++++++
 .../MissingMappingRequestMessage.java           |  2 +-
 .../MissingMappingResponseMessage.java          |  2 +-
 .../MarshallerContextLockingSelfTest.java       |  6 +++
 ...lerCacheClientRequestsMappingOnMissTest.java | 24 ++++------
 .../marshaller/MarshallerContextSelfTest.java   |  8 ++++
 .../marshaller/MarshallerContextTestImpl.java   |  1 +
 11 files changed, 136 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2e421c2a/modules/core/src/main/java/org/apache/ignite/internal/MappingStoreTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MappingStoreTask.java b/modules/core/src/main/java/org/apache/ignite/internal/MappingStoreTask.java
index 102347a..96ef1b9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/MappingStoreTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/MappingStoreTask.java
@@ -18,12 +18,13 @@
 package org.apache.ignite.internal;
 
 import org.apache.ignite.internal.processors.marshaller.MarshallerMappingItem;
+import org.apache.ignite.internal.util.lang.GridPlainRunnable;
 
 /**
  * Task is used in {@link MarshallerContextImpl#onMappingAccepted(MarshallerMappingItem)}
  * to offload storing mapping data into file system from discovery thread.
  */
-class MappingStoreTask implements Runnable {
+class MappingStoreTask implements GridPlainRunnable {
     /** Store to put item to. */
     private final MarshallerMappingFileStore fileStore;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/2e421c2a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
index b137e99..5416ff0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
@@ -28,6 +28,7 @@ import java.util.Collection;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -39,10 +40,12 @@ import org.apache.ignite.IgniteException;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
+import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
 import org.apache.ignite.internal.processors.marshaller.MappedName;
 import org.apache.ignite.internal.processors.marshaller.MappingExchangeResult;
 import org.apache.ignite.internal.processors.marshaller.MarshallerMappingItem;
 import org.apache.ignite.internal.processors.marshaller.MarshallerMappingTransport;
+import org.apache.ignite.internal.util.IgniteUtils;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.marshaller.MarshallerContext;
@@ -76,13 +79,13 @@ public class MarshallerContextImpl implements MarshallerContext {
     private MarshallerMappingFileStore fileStore;
 
     /** */
-    private ExecutorService execSrvc;
+    private GridClosureProcessor closProc;
 
     /** */
     private MarshallerMappingTransport transport;
 
     /** */
-    private boolean isClientNode;
+    private boolean clientNode;
 
     /**
      * Initializes context.
@@ -319,7 +322,7 @@ public class MarshallerContextImpl implements MarshallerContext {
 
         cache.replace(item.typeId(), new MappedName(item.className(), true));
 
-        execSrvc.submit(new MappingStoreTask(fileStore, item.platformId(), item.typeId(),
item.className()));
+        closProc.runLocalSafe(new MappingStoreTask(fileStore, item.platformId(), item.typeId(),
item.className()));
     }
 
     /** {@inheritDoc} */
@@ -351,7 +354,7 @@ public class MarshallerContextImpl implements MarshallerContext {
             if (clsName != null)
                 cache.putIfAbsent(typeId, new MappedName(clsName, true));
             else
-                if (isClientNode) {
+                if (clientNode) {
                     mappedName = cache.get(typeId);
 
                     if (mappedName == null) {
@@ -375,7 +378,7 @@ public class MarshallerContextImpl implements MarshallerContext {
                 }
                 else
                     throw new ClassNotFoundException(
-                            "Unknown pair [platformId= "
+                            "Unknown pair [platformId="
                                     + platformId
                                     + ", typeId="
                                     + typeId + "]");
@@ -406,7 +409,7 @@ public class MarshallerContextImpl implements MarshallerContext {
      * @param item Item.
      * @param resolvedClsName Resolved class name.
      */
-    public void onMissedMappingResolved(MarshallerMappingItem item, String resolvedClsName)
{
+    public void onMissedMappingResolved(final MarshallerMappingItem item, String resolvedClsName)
{
         ConcurrentMap<Integer, MappedName> cache = getCacheFor(item.platformId());
 
         int typeId = item.typeId();
@@ -422,7 +425,7 @@ public class MarshallerContextImpl implements MarshallerContext {
             mappedName = new MappedName(resolvedClsName, true);
             cache.putIfAbsent(typeId, mappedName);
 
-            execSrvc.submit(new MappingStoreTask(fileStore, item.platformId(), item.typeId(),
resolvedClsName));
+            closProc.runLocalSafe(new MappingStoreTask(fileStore, item.platformId(), item.typeId(),
resolvedClsName));
         }
     }
 
@@ -502,8 +505,8 @@ public class MarshallerContextImpl implements MarshallerContext {
 
         fileStore = new MarshallerMappingFileStore(workDir, ctx.log(MarshallerMappingFileStore.class));
         this.transport = transport;
-        execSrvc = ctx.getSystemExecutorService();
-        isClientNode = ctx.clientNode();
+        closProc = ctx.closure();
+        clientNode = ctx.clientNode();
     }
 
     /**
@@ -514,6 +517,35 @@ public class MarshallerContextImpl implements MarshallerContext {
     }
 
     /**
+     * Method collects current mappings for all platforms.
+     *
+     * @return current mappings.
+     */
+    public Iterator<Map.Entry<Byte, Map<Integer, String>>> currentMappings()
{
+        int size = allCaches.size();
+
+        Map<Byte, Map<Integer, String>> res = IgniteUtils.newHashMap(size);
+
+        for (byte i = 0; i < size; i++) {
+            Map<Integer, MappedName> platformMappings = allCaches.get(i);
+
+            if (platformMappings != null) {
+                if (i == JAVA_ID)
+                    platformMappings = ((CombinedMap)platformMappings).userMap;
+
+                Map<Integer, String> nameMappings = IgniteUtils.newHashMap(platformMappings.size());
+
+                for (Map.Entry<Integer, MappedName> e : platformMappings.entrySet())
+                    nameMappings.put(e.getKey(), e.getValue().className());
+
+                res.put(i, nameMappings);
+            }
+        }
+
+        return res.entrySet().iterator();
+    }
+
+    /**
      *
      */
     static final class CombinedMap extends AbstractMap<Integer, MappedName>

http://git-wip-us.apache.org/repos/asf/ignite/blob/2e421c2a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index e283bdc..6f95400 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -618,6 +618,16 @@ public class GridIoMessageFactory implements MessageFactory {
 
                 break;
 
+            case 78:
+                msg = new MissingMappingRequestMessage();
+
+                break;
+
+            case 79:
+                msg = new MissingMappingResponseMessage();
+
+                break;
+
             case 82:
                 msg = new JobStealingRequest();
 
@@ -808,16 +818,6 @@ public class GridIoMessageFactory implements MessageFactory {
 
                 break;
 
-            case 120:
-                msg = new MissingMappingRequestMessage();
-
-                break;
-
-            case 121:
-                msg = new MissingMappingResponseMessage();
-
-                break;
-
             case 124:
                 msg = new GridMessageCollection<>();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/2e421c2a/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/GridMarshallerMappingProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/GridMarshallerMappingProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/GridMarshallerMappingProcessor.java
index f5193ab..fdea869 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/GridMarshallerMappingProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/GridMarshallerMappingProcessor.java
@@ -17,12 +17,13 @@
 
 package org.apache.ignite.internal.processors.marshaller;
 
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ExecutorService;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.events.DiscoveryEvent;
@@ -38,10 +39,9 @@ import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
 import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
 import org.apache.ignite.internal.processors.GridProcessorAdapter;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteBiInClosure;
-import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.spi.discovery.DiscoveryDataBag;
 import org.apache.ignite.spi.discovery.DiscoveryDataBag.GridDiscoveryData;
@@ -77,6 +77,12 @@ public class GridMarshallerMappingProcessor extends GridProcessorAdapter
{
     private final MarshallerContextImpl marshallerCtx;
 
     /** */
+    private final GridClosureProcessor closProc;
+
+    /** */
+    private final List<MappingUpdatedListener> mappingUpdatedLsnrs = new CopyOnWriteArrayList<>();
+
+    /** */
     private final ConcurrentMap<MarshallerMappingItem, GridFutureAdapter<MappingExchangeResult>>
mappingExchangeSyncMap
             = new ConcurrentHashMap8<>();
 
@@ -90,6 +96,8 @@ public class GridMarshallerMappingProcessor extends GridProcessorAdapter
{
         super(ctx);
 
         marshallerCtx = ctx.marshallerContext();
+
+        closProc = ctx.closure();
     }
 
     /** {@inheritDoc} */
@@ -108,10 +116,10 @@ public class GridMarshallerMappingProcessor extends GridProcessorAdapter
{
 
         discoMgr.setCustomEventListener(MappingAcceptedMessage.class, new MappingAcceptedListener());
 
-        if (!ctx.clientNode())
-            ioMgr.addMessageListener(TOPIC_MAPPING_MARSH, new MissingMappingRequestListener(ioMgr));
-        else
+        if (ctx.clientNode())
             ioMgr.addMessageListener(TOPIC_MAPPING_MARSH, new MissingMappingResponseListener());
+        else
+            ioMgr.addMessageListener(TOPIC_MAPPING_MARSH, new MissingMappingRequestListener(ioMgr));
 
         if (ctx.clientNode())
             ctx.event().addLocalEventListener(new GridLocalEventListener() {
@@ -129,10 +137,10 @@ public class GridMarshallerMappingProcessor extends GridProcessorAdapter
{
     /**
      * Adds a listener to be notified when mapping changes.
      *
-     * @param mappingUpdatedListener Mapping updated listener.
+     * @param mappingUpdatedListener listener for mapping updated events.
      */
-    public void addMappingUpdatedListener(IgniteBiInClosure<Integer, String> mappingUpdatedListener)
{
-
+    public void addMappingUpdatedListener(MappingUpdatedListener mappingUpdatedListener)
{
+        mappingUpdatedLsnrs.add(mappingUpdatedListener);
     }
 
     /**
@@ -140,8 +148,8 @@ public class GridMarshallerMappingProcessor extends GridProcessorAdapter
{
      *
      * @return Iterator over current mappings.
      */
-    public Iterator<IgniteBiTuple<Integer, String>> currentMappings() {
-        return Collections.emptyListIterator();
+    public Iterator<Map.Entry<Byte, Map<Integer, String>>> currentMappings()
{
+        return marshallerCtx.currentMappings();
     }
 
     /**
@@ -286,9 +294,16 @@ public class GridMarshallerMappingProcessor extends GridProcessorAdapter
{
                 ClusterNode snd,
                 MappingAcceptedMessage msg
         ) {
-            MarshallerMappingItem item = msg.getMappingItem();
+            final MarshallerMappingItem item = msg.getMappingItem();
             marshallerCtx.onMappingAccepted(item);
 
+            closProc.runLocalSafe(new Runnable() {
+                @Override public void run() {
+                    for (MappingUpdatedListener lsnr : mappingUpdatedLsnrs)
+                        lsnr.mappingUpdated(item.platformId(), item.typeId(), item.className());
+                }
+            });
+
             GridFutureAdapter<MappingExchangeResult> fut = mappingExchangeSyncMap.get(item);
 
             if (fut != null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/2e421c2a/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MappingUpdatedListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MappingUpdatedListener.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MappingUpdatedListener.java
new file mode 100644
index 0000000..8a9d3d8
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MappingUpdatedListener.java
@@ -0,0 +1,29 @@
+/*
+ * 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.marshaller;
+
+/**
+ *  Interface allows any component to register for events of newly added mappings.
+ */
+public interface MappingUpdatedListener {
+    /**
+     * @param platformId Id of platform new mapping was added for.
+     * @param typeId Id of type new mapping was added for.
+     * @param className Name of mapped class.
+     */
+    public void mappingUpdated(byte platformId, int typeId, String className);
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/2e421c2a/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingRequestMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingRequestMessage.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingRequestMessage.java
index ba2afce..a42072a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingRequestMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingRequestMessage.java
@@ -116,7 +116,7 @@ public class MissingMappingRequestMessage implements Message {
 
     /** {@inheritDoc} */
     @Override public byte directType() {
-        return 120;
+        return 78;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/2e421c2a/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingResponseMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingResponseMessage.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingResponseMessage.java
index d468302..33f892b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingResponseMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/MissingMappingResponseMessage.java
@@ -128,7 +128,7 @@ public class MissingMappingResponseMessage implements Message {
 
     /** {@inheritDoc} */
     @Override public byte directType() {
-        return 121;
+        return 79;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/2e421c2a/modules/core/src/test/java/org/apache/ignite/internal/MarshallerContextLockingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/MarshallerContextLockingSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/MarshallerContextLockingSelfTest.java
index cc2bc39..0e278f3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/MarshallerContextLockingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/MarshallerContextLockingSelfTest.java
@@ -24,8 +24,10 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
 import org.apache.ignite.internal.processors.marshaller.MarshallerMappingItem;
 import org.apache.ignite.internal.processors.marshaller.MarshallerMappingTransport;
+import org.apache.ignite.internal.processors.pool.PoolProcessor;
 import org.apache.ignite.testframework.GridTestClassLoader;
 import org.apache.ignite.testframework.junits.GridTestKernalContext;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -40,6 +42,7 @@ public class MarshallerContextLockingSelfTest extends GridCommonAbstractTest
{
     /** Inner logger. */
     private InnerLogger innerLog;
 
+    /** */
     private GridTestKernalContext ctx;
 
     /** {@inheritDoc} */
@@ -56,6 +59,9 @@ public class MarshallerContextLockingSelfTest extends GridCommonAbstractTest
{
         };
 
         ctx.setSystemExecutorService(Executors.newFixedThreadPool(12));
+
+        ctx.add(new PoolProcessor(ctx));
+        ctx.add(new GridClosureProcessor(ctx));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/2e421c2a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClientRequestsMappingOnMissTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClientRequestsMappingOnMissTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClientRequestsMappingOnMissTest.java
index 27c01c5..d0e863e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClientRequestsMappingOnMissTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClientRequestsMappingOnMissTest.java
@@ -24,8 +24,6 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Map;
 import java.util.UUID;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.configuration.CacheConfiguration;
@@ -131,22 +129,20 @@ public class IgniteMarshallerCacheClientRequestsMappingOnMissTest extends
GridCo
 
         stopGrid(1);
 
-        if (!getMarshCtxFileStoreExecutorSrvc((GridKernalContext) U.field(cl1, "ctx"))
-                .awaitTermination(5000, TimeUnit.MILLISECONDS))
-            fail("Failed to wait for executor service used by MarshallerContext to shutdown");
-
         File[] files = Paths.get(TMP_DIR, "marshaller").toFile().listFiles();
 
         assertNotNull(TMP_DIR + "/marshaller directory should contain at least one file",
files);
-        assertEquals(TMP_DIR + "/marshaller directory should contain exactly one file", 1,
files.length);
-        assertEquals(clsName, new String(Files.readAllBytes(files[0].toPath())));
-    }
 
-    /**
-     * @param ctx Context.
-     */
-    private ExecutorService getMarshCtxFileStoreExecutorSrvc(GridKernalContext ctx) {
-        return U.field((Object)U.field(ctx, "marshCtx"), "execSrvc");
+        boolean orgClsMarshalled = false;
+
+        for (File f : files) {
+            if (clsName.equals(new String(Files.readAllBytes(f.toPath())))) {
+                orgClsMarshalled = true;
+                break;
+            }
+        }
+
+        assertTrue(clsName + " should be marshalled and stored to disk", orgClsMarshalled);
     }
 
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/2e421c2a/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextSelfTest.java
index 7ce6ece..5883898 100644
--- a/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextSelfTest.java
@@ -28,7 +28,9 @@ import java.util.concurrent.TimeUnit;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.MarshallerContextImpl;
+import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
 import org.apache.ignite.internal.processors.marshaller.MarshallerMappingItem;
+import org.apache.ignite.internal.processors.pool.PoolProcessor;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.testframework.junits.GridTestKernalContext;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -52,6 +54,10 @@ public class MarshallerContextSelfTest extends GridCommonAbstractTest {
         execSvc = Executors.newSingleThreadExecutor();
 
         ctx.setSystemExecutorService(execSvc);
+
+        ctx.add(new PoolProcessor(ctx));
+
+        ctx.add(new GridClosureProcessor(ctx));
     }
 
     /**
@@ -64,6 +70,8 @@ public class MarshallerContextSelfTest extends GridCommonAbstractTest {
 
         MarshallerMappingItem item = new MarshallerMappingItem(JAVA_ID, 1, String.class.getName());
 
+        ctx.onMappingProposed(item);
+
         ctx.onMappingAccepted(item);
 
         try (Ignite g1 = startGrid(1)) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/2e421c2a/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextTestImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextTestImpl.java
b/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextTestImpl.java
index 6085332..0a59bba 100644
--- a/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextTestImpl.java
+++ b/modules/core/src/test/java/org/apache/ignite/marshaller/MarshallerContextTestImpl.java
@@ -91,6 +91,7 @@ public class MarshallerContextTestImpl extends MarshallerContextImpl {
             int typeId
     ) throws ClassNotFoundException, IgniteCheckedException {
         String clsName = map.get(typeId);
+
         return (clsName == null) ? super.getClassName(platformId, typeId) : clsName;
     }
 }


Mime
View raw message