You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vk...@apache.org on 2015/02/02 04:27:53 UTC
[01/52] [abbrv] incubator-ignite git commit: GridNamedInstance ->
IgniteNamedInstance GridgainEx -> IgnitionEx
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-61 9b7fea2d3 -> 7c93b5e9d
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5247ab3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 35b34f0..0e60832 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -4430,7 +4430,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
try {
IgniteBiTuple<String, String> t = stash.get();
- return GridGainEx.gridx(t.get1()).cachex(t.get2());
+ return IgnitionEx.gridx(t.get1()).cachex(t.get2());
}
catch (IllegalStateException e) {
throw U.withCause(new InvalidObjectException(e.getMessage()), e);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5247ab3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 0f5b06d..1f624f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -1888,7 +1888,7 @@ public class GridCacheContext<K, V> implements Externalizable {
try {
IgniteBiTuple<String, String> t = stash.get();
- IgniteKernal grid = GridGainEx.gridx(t.get1());
+ IgniteKernal grid = IgnitionEx.gridx(t.get1());
GridCacheAdapter<K, V> cache = grid.internalCache(t.get2());
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5247ab3/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridSpringResourceContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridSpringResourceContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridSpringResourceContext.java
index f5db642..369837e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridSpringResourceContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/resource/GridSpringResourceContext.java
@@ -23,7 +23,7 @@ import org.apache.ignite.internal.*;
/**
* Interface was introduced to avoid compile-time dependency on spring framework. Spring resource context
* provides optional spring resource injectors, it can be passed to factory method
- * starting GridGain {@link GridGainEx#start(GridSpringResourceContext)}.
+ * starting GridGain {@link IgnitionEx#start(GridSpringResourceContext)}.
*/
public interface GridSpringResourceContext {
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5247ab3/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsEventsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsEventsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsEventsAbstractSelfTest.java
index a72b151..c96ad41 100644
--- a/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsEventsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/fs/GridGgfsEventsAbstractSelfTest.java
@@ -111,7 +111,7 @@ public abstract class GridGgfsEventsAbstractSelfTest extends GridCommonAbstractT
* @throws Exception If failed.
*/
protected IgniteConfiguration getConfiguration(String gridName, IgniteFsConfiguration ggfsCfg) throws Exception {
- IgniteConfiguration cfg = GridGainEx.loadConfiguration("config/hadoop/default-config.xml").get1();
+ IgniteConfiguration cfg = IgnitionEx.loadConfiguration("config/hadoop/default-config.xml").get1();
assert cfg != null;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5247ab3/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCachePutRemoveLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCachePutRemoveLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCachePutRemoveLoadTest.java
index e11963d..6eca2c8 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCachePutRemoveLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCachePutRemoveLoadTest.java
@@ -96,7 +96,7 @@ public class GridCachePutRemoveLoadTest {
protected void startNodes() throws Exception {
for (int i = 0; i < args.nodes(); i++) {
IgniteConfiguration cfg =
- GridGainEx.loadConfiguration("modules/core/src/test/config/spring-cache-put-remove-load.xml").get1();
+ IgnitionEx.loadConfiguration("modules/core/src/test/config/spring-cache-put-remove-load.xml").get1();
assert cfg != null;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5247ab3/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index fca61d1..84883f9 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -653,7 +653,7 @@ public abstract class GridAbstractTest extends TestCase {
* @throws Exception If failed.
*/
protected Ignite startGrid(String gridName, GridSpringResourceContext ctx) throws Exception {
- return GridGainEx.start(optimize(getConfiguration(gridName)), ctx);
+ return IgnitionEx.start(optimize(getConfiguration(gridName)), ctx);
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5247ab3/modules/spring/src/main/java/org/apache/ignite/IgniteSpring.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/main/java/org/apache/ignite/IgniteSpring.java b/modules/spring/src/main/java/org/apache/ignite/IgniteSpring.java
index 74f9e1b..cbc54dc 100644
--- a/modules/spring/src/main/java/org/apache/ignite/IgniteSpring.java
+++ b/modules/spring/src/main/java/org/apache/ignite/IgniteSpring.java
@@ -48,7 +48,7 @@ public class IgniteSpring {
* also if default grid has already been started.
*/
public static Ignite start(@Nullable ApplicationContext springCtx) throws IgniteCheckedException {
- return GridGainEx.start(new GridSpringResourceContextImpl(springCtx));
+ return IgnitionEx.start(new GridSpringResourceContextImpl(springCtx));
}
/**
@@ -64,7 +64,7 @@ public class IgniteSpring {
* also if named grid has already been started.
*/
public static Ignite start(IgniteConfiguration cfg, @Nullable ApplicationContext springCtx) throws IgniteCheckedException {
- return GridGainEx.start(cfg, new GridSpringResourceContextImpl(springCtx));
+ return IgnitionEx.start(cfg, new GridSpringResourceContextImpl(springCtx));
}
/**
@@ -88,7 +88,7 @@ public class IgniteSpring {
* been started or Spring XML configuration file is invalid.
*/
public static Ignite start(String springCfgPath, @Nullable ApplicationContext springCtx) throws IgniteCheckedException {
- return GridGainEx.start(springCfgPath, null, new GridSpringResourceContextImpl(springCtx));
+ return IgnitionEx.start(springCfgPath, null, new GridSpringResourceContextImpl(springCtx));
}
/**
@@ -112,6 +112,6 @@ public class IgniteSpring {
* been started or Spring XML configuration file is invalid.
*/
public static Ignite start(URL springCfgUrl, @Nullable ApplicationContext springCtx) throws IgniteCheckedException {
- return GridGainEx.start(springCfgUrl, null, new GridSpringResourceContextImpl(springCtx));
+ return IgnitionEx.start(springCfgUrl, null, new GridSpringResourceContextImpl(springCtx));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5247ab3/modules/web/src/main/java/org/apache/ignite/startup/servlet/GridServletContextListenerStartup.java
----------------------------------------------------------------------
diff --git a/modules/web/src/main/java/org/apache/ignite/startup/servlet/GridServletContextListenerStartup.java b/modules/web/src/main/java/org/apache/ignite/startup/servlet/GridServletContextListenerStartup.java
index 928958d..4759907 100644
--- a/modules/web/src/main/java/org/apache/ignite/startup/servlet/GridServletContextListenerStartup.java
+++ b/modules/web/src/main/java/org/apache/ignite/startup/servlet/GridServletContextListenerStartup.java
@@ -121,7 +121,7 @@ public class GridServletContextListenerStartup implements ServletContextListener
IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> t;
try {
- t = GridGainEx.loadConfigurations(cfgUrl);
+ t = IgnitionEx.loadConfigurations(cfgUrl);
}
catch (IgniteCheckedException e) {
throw new IgniteException("Failed to load GridGain configuration.", e);
@@ -149,7 +149,7 @@ public class GridServletContextListenerStartup implements ServletContextListener
ignite = G.ignite(cfg.getGridName());
}
catch (IgniteIllegalStateException ignored) {
- ignite = GridGainEx.start(new IgniteConfiguration(cfg), rsrcCtx);
+ ignite = IgnitionEx.start(new IgniteConfiguration(cfg), rsrcCtx);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5247ab3/modules/web/src/main/java/org/apache/ignite/startup/servlet/GridServletStartup.java
----------------------------------------------------------------------
diff --git a/modules/web/src/main/java/org/apache/ignite/startup/servlet/GridServletStartup.java b/modules/web/src/main/java/org/apache/ignite/startup/servlet/GridServletStartup.java
index 8e806d3..0cc5701 100644
--- a/modules/web/src/main/java/org/apache/ignite/startup/servlet/GridServletStartup.java
+++ b/modules/web/src/main/java/org/apache/ignite/startup/servlet/GridServletStartup.java
@@ -141,7 +141,7 @@ public class GridServletStartup extends HttpServlet {
try {
IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> t =
- GridGainEx.loadConfigurations(cfgUrl);
+ IgnitionEx.loadConfigurations(cfgUrl);
Collection<IgniteConfiguration> cfgs = t.get1();
@@ -153,7 +153,7 @@ public class GridServletStartup extends HttpServlet {
IgniteConfiguration adapter = new IgniteConfiguration(cfg);
- Ignite ignite = GridGainEx.start(adapter, t.get2());
+ Ignite ignite = IgnitionEx.start(adapter, t.get2());
// Test if grid is not null - started properly.
if (ignite != null)
[13/52] [abbrv] incubator-ignite git commit: GridUtils -> IgniteUtils
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/main/java/org/apache/ignite/internal/util/typedef/internal/U.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/typedef/internal/U.java b/modules/core/src/main/java/org/apache/ignite/internal/util/typedef/internal/U.java
index ef36125..05c76b4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/typedef/internal/U.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/typedef/internal/U.java
@@ -20,9 +20,9 @@ package org.apache.ignite.internal.util.typedef.internal;
import org.apache.ignite.internal.util.*;
/**
- * Defines internal {@code typedef} for {@link GridUtils}. Since Java doesn't provide type aliases
+ * Defines internal {@code typedef} for {@link IgniteUtils}. Since Java doesn't provide type aliases
* (like Scala, for example) we resort to these types of measures. This is intended for internal
* use only and meant to provide for more terse code when readability of code is not compromised.
*/
@SuppressWarnings({"ExtendsUtilityClass"})
-public class U extends GridUtils { /* No-op. */ }
+public class U extends IgniteUtils { /* No-op. */ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorResolveHostNameTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorResolveHostNameTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorResolveHostNameTask.java
index 8a2247e..6342bb5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorResolveHostNameTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorResolveHostNameTask.java
@@ -63,7 +63,7 @@ public class VisorResolveHostNameTask extends VisorOneNodeTask<Void, Map<String,
try {
IgniteBiTuple<Collection<String>, Collection<String>> addrs =
- GridUtils.resolveLocalAddresses(InetAddress.getByName("0.0.0.0"));
+ IgniteUtils.resolveLocalAddresses(InetAddress.getByName("0.0.0.0"));
assert(addrs.get1() != null);
assert(addrs.get2() != null);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
index 95bb434..190f6da 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
@@ -53,8 +53,8 @@ public class VisorQueryUtils {
if (o != null) {
Class<?> clazz = o.getClass();
- return clazz.isArray() ? GridUtils.compact(clazz.getComponentType().getName()) + "[]"
- : GridUtils.compact(o.getClass().getName());
+ return clazz.isArray() ? IgniteUtils.compact(clazz.getComponentType().getName()) + "[]"
+ : IgniteUtils.compact(o.getClass().getName());
}
else
return "n/a";
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/IgniteOptimizedMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/IgniteOptimizedMarshaller.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/IgniteOptimizedMarshaller.java
index bee3a2e..22349e1 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/IgniteOptimizedMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/IgniteOptimizedMarshaller.java
@@ -183,7 +183,7 @@ public class IgniteOptimizedMarshaller extends IgniteAbstractMarshaller {
if (path == null)
return;
- URL url = GridUtils.resolveGridGainUrl(path, false);
+ URL url = IgniteUtils.resolveGridGainUrl(path, false);
if (url == null)
throw new IgniteCheckedException("Failed to find resource for name: " + path);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/test/java/org/apache/ignite/IgniteExceptionHelpLinksSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/IgniteExceptionHelpLinksSelfTest.java b/modules/core/src/test/java/org/apache/ignite/IgniteExceptionHelpLinksSelfTest.java
index 3fbf4ec..d555c41 100644
--- a/modules/core/src/test/java/org/apache/ignite/IgniteExceptionHelpLinksSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/IgniteExceptionHelpLinksSelfTest.java
@@ -18,12 +18,11 @@
package org.apache.ignite;
import junit.framework.*;
-import org.apache.ignite.*;
import org.jetbrains.annotations.*;
import java.util.*;
-import static org.apache.ignite.internal.util.GridUtils.*;
+import static org.apache.ignite.internal.util.IgniteUtils.*;
/**
* Tests for proper link output in stack traces.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageCheckAllEventsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageCheckAllEventsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageCheckAllEventsSelfTest.java
index ca71778..2c0b1dd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageCheckAllEventsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageCheckAllEventsSelfTest.java
@@ -233,7 +233,7 @@ public class GridEventStorageCheckAllEventsSelfTest extends GridCommonAbstractTe
/**
* Returns timestamp at the method call moment, but sleeps before return,
- * to allow pass {@link GridUtils#currentTimeMillis()}.
+ * to allow pass {@link IgniteUtils#currentTimeMillis()}.
*
* @return Call timestamp.
* @throws InterruptedException If sleep was interrupted.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
index fa3aeb3..d0dcda6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.*;
import org.apache.ignite.cache.*;
import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.util.GridUtils;
+import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.internal.util.lang.*;
import org.apache.ignite.testframework.*;
import org.apache.ignite.transactions.*;
@@ -739,7 +739,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
}
// One more update from the same cache entry to ensure that expire time is shifted forward.
- GridUtils.sleep(100);
+ IgniteUtils.sleep(100);
tx = inTx ? c.txStart() : null;
@@ -764,7 +764,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
}
// And one more direct update to ensure that expire time is shifted forward.
- GridUtils.sleep(100);
+ IgniteUtils.sleep(100);
assertEquals(0, grid(0).cache(null).metrics().getCacheEvictions());
@@ -791,7 +791,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
}
// And one more update to ensure that ttl is not changed and expire time is not shifted forward.
- GridUtils.sleep(100);
+ IgniteUtils.sleep(100);
assertEquals(0, grid(0).cache(null).metrics().getCacheEvictions());
@@ -864,7 +864,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
tx.commit();
}
- GridUtils.sleep(2000);
+ IgniteUtils.sleep(2000);
entry = c.entry(key);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithSpecifiedWorkDirectorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithSpecifiedWorkDirectorySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithSpecifiedWorkDirectorySelfTest.java
index d6ef6f3..0e034af 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithSpecifiedWorkDirectorySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithSpecifiedWorkDirectorySelfTest.java
@@ -31,7 +31,7 @@ import java.io.*;
import java.util.*;
import static org.apache.ignite.IgniteSystemProperties.*;
-import static org.apache.ignite.internal.util.GridUtils.*;
+import static org.apache.ignite.internal.util.IgniteUtils.*;
/**
* Checks creation of work folder.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithUndefinedGridGainHomeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithUndefinedGridGainHomeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithUndefinedGridGainHomeSelfTest.java
index 0fc0ef4..a56f8b2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithUndefinedGridGainHomeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithUndefinedGridGainHomeSelfTest.java
@@ -29,7 +29,7 @@ import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.testframework.junits.common.*;
import static org.apache.ignite.IgniteSystemProperties.*;
-import static org.apache.ignite.internal.util.GridUtils.*;
+import static org.apache.ignite.internal.util.IgniteUtils.*;
/**
* Checks that node can be started without operations with undefined GRIDGAIN_HOME.
@@ -58,7 +58,7 @@ public class GridStartupWithUndefinedGridGainHomeSelfTest extends TestCase {
* @throws Exception If failed.
*/
public void testStartStopWithUndefinedGridGainHome() throws Exception {
- GridUtils.nullifyHomeDirectory();
+ IgniteUtils.nullifyHomeDirectory();
// We can't use U.getGridGainHome() here because
// it will initialize cached value which is forbidden to override.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/test/java/org/apache/ignite/internal/util/GridTestClockTimer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/GridTestClockTimer.java b/modules/core/src/test/java/org/apache/ignite/internal/util/GridTestClockTimer.java
index b095c5f..b9bb5ab 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/GridTestClockTimer.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/GridTestClockTimer.java
@@ -17,8 +17,6 @@
package org.apache.ignite.internal.util;
-import org.apache.ignite.internal.util.*;
-
/**
* Clock timer for tests.
*/
@@ -26,13 +24,13 @@ public class GridTestClockTimer implements Runnable {
/** {@inheritDoc} */
@Override public void run() {
while (true) {
- GridUtils.curTimeMillis = System.currentTimeMillis();
+ IgniteUtils.curTimeMillis = System.currentTimeMillis();
try {
Thread.sleep(10);
}
catch (InterruptedException ignored) {
- GridUtils.log(null, "Timer thread has been interrupted.");
+ IgniteUtils.log(null, "Timer thread has been interrupted.");
break;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/test/java/org/apache/ignite/internal/util/GridUtilsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/GridUtilsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/GridUtilsSelfTest.java
deleted file mode 100644
index 3848b7f..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/GridUtilsSelfTest.java
+++ /dev/null
@@ -1,728 +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.util;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.cluster.ClusterGroup;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.compute.ComputeJob;
-import org.apache.ignite.compute.ComputeJobAdapter;
-import org.apache.ignite.internal.util.lang.GridPeerDeployAware;
-import org.apache.ignite.internal.util.typedef.X;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.http.GridEmbeddedHttpServer;
-import org.apache.ignite.testframework.junits.GridTestKernalContext;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.apache.ignite.testframework.junits.common.GridCommonTest;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.*;
-import java.lang.annotation.*;
-import java.math.BigInteger;
-import java.net.InetSocketAddress;
-import java.net.URL;
-import java.nio.ByteBuffer;
-import java.util.*;
-
-import static org.junit.Assert.assertArrayEquals;
-
-/**
- * Grid utils tests.
- */
-@GridCommonTest(group = "Utils")
-public class GridUtilsSelfTest extends GridCommonAbstractTest {
- /** */
- public static final int[] EMPTY = new int[0];
-
- /**
- * @return 120 character length string.
- */
- private String text120() {
- char[] chs = new char[120];
-
- Arrays.fill(chs, 'x');
-
- return new String(chs);
- }
-
- /**
- *
- */
- public void testIsPow2() {
- assertTrue(U.isPow2(1));
- assertTrue(U.isPow2(2));
- assertTrue(U.isPow2(4));
- assertTrue(U.isPow2(8));
- assertTrue(U.isPow2(16));
- assertTrue(U.isPow2(16 * 16));
- assertTrue(U.isPow2(32 * 32));
-
- assertFalse(U.isPow2(-4));
- assertFalse(U.isPow2(-3));
- assertFalse(U.isPow2(-2));
- assertFalse(U.isPow2(-1));
- assertFalse(U.isPow2(0));
- assertFalse(U.isPow2(3));
- assertFalse(U.isPow2(5));
- assertFalse(U.isPow2(6));
- assertFalse(U.isPow2(7));
- assertFalse(U.isPow2(9));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testAllLocalIps() throws Exception {
- Collection<String> ips = U.allLocalIps();
-
- System.out.println("All local IPs: " + ips);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testAllLocalMACs() throws Exception {
- Collection<String> macs = U.allLocalMACs();
-
- System.out.println("All local MACs: " + macs);
- }
-
- /**
- * On linux NetworkInterface.getHardwareAddress() returns null from time to time.
- *
- * @throws Exception If failed.
- */
- public void testAllLocalMACsMultiThreaded() throws Exception {
- GridTestUtils.runMultiThreaded(new Runnable() {
- @Override public void run() {
- for (int i = 0; i < 30; i++) {
- Collection<String> macs = U.allLocalMACs();
-
- assertTrue("Mac address are not defined.", !macs.isEmpty());
- }
- }
- }, 32, "thread");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testByteArray2String() throws Exception {
- assertEquals("{0x0A,0x14,0x1E,0x28,0x32,0x3C,0x46,0x50,0x5A}",
- U.byteArray2String(new byte[] {10, 20, 30, 40, 50, 60, 70, 80, 90}, "0x%02X", ",0x%02X"));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testFormatMins() throws Exception {
- printFormatMins(0);
- printFormatMins(1);
- printFormatMins(2);
- printFormatMins(59);
- printFormatMins(60);
- printFormatMins(61);
- printFormatMins(60 * 24 - 1);
- printFormatMins(60 * 24);
- printFormatMins(60 * 24 + 1);
- printFormatMins(5 * 60 * 24 - 1);
- printFormatMins(5 * 60 * 24);
- printFormatMins(5 * 60 * 24 + 1);
- }
-
- /**
- * Helper method for {@link #testFormatMins()}
- *
- * @param mins Minutes to test.
- */
- private void printFormatMins(long mins) {
- System.out.println("For " + mins + " minutes: " + X.formatMins(mins));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDownloadUrlFromHttp() throws Exception {
- GridEmbeddedHttpServer srv = null;
- try {
- String urlPath = "/testDownloadUrl/";
- srv = GridEmbeddedHttpServer.startHttpServer().withFileDownloadingHandler(urlPath,
- GridTestUtils.resolveGridGainPath("/modules/core/src/test/config/tests.properties"));
-
- File file = new File(System.getProperty("java.io.tmpdir") + File.separator + "url-http.file");
-
- file = U.downloadUrl(new URL(srv.getBaseUrl() + urlPath), file);
-
- assert file.exists();
- assert file.delete();
- }
- finally {
- if (srv != null)
- srv.stop(1);
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDownloadUrlFromHttps() throws Exception {
- GridEmbeddedHttpServer srv = null;
- try {
- String urlPath = "/testDownloadUrl/";
- srv = GridEmbeddedHttpServer.startHttpsServer().withFileDownloadingHandler(urlPath,
- GridTestUtils.resolveGridGainPath("modules/core/src/test/config/tests.properties"));
-
- File file = new File(System.getProperty("java.io.tmpdir") + File.separator + "url-http.file");
-
- file = U.downloadUrl(new URL(srv.getBaseUrl() + urlPath), file);
-
- assert file.exists();
- assert file.delete();
- }
- finally {
- if (srv != null)
- srv.stop(1);
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDownloadUrlFromLocalFile() throws Exception {
- File file = new File(System.getProperty("java.io.tmpdir") + File.separator + "url-http.file");
-
- file = U.downloadUrl(
- GridTestUtils.resolveGridGainPath("modules/core/src/test/config/tests.properties").toURI().toURL(), file);
-
- assert file.exists();
- assert file.delete();
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testOs() throws Exception {
- System.out.println("OS string: " + U.osString());
- System.out.println("JDK string: " + U.jdkString());
- System.out.println("OS/JDK string: " + U.osJdkString());
-
- System.out.println("Is Windows: " + U.isWindows());
- System.out.println("Is Windows 95: " + U.isWindows95());
- System.out.println("Is Windows 98: " + U.isWindows98());
- System.out.println("Is Windows NT: " + U.isWindowsNt());
- System.out.println("Is Windows 2000: " + U.isWindows2k());
- System.out.println("Is Windows 2003: " + U.isWindows2003());
- System.out.println("Is Windows XP: " + U.isWindowsXp());
- System.out.println("Is Windows Vista: " + U.isWindowsVista());
- System.out.println("Is Linux: " + U.isLinux());
- System.out.println("Is Mac OS: " + U.isMacOs());
- System.out.println("Is Netware: " + U.isNetWare());
- System.out.println("Is Solaris: " + U.isSolaris());
- System.out.println("Is Solaris SPARC: " + U.isSolarisSparc());
- System.out.println("Is Solaris x86: " + U.isSolarisX86());
- System.out.println("Is Windows7: " + U.isWindows7());
- System.out.println("Is Sufficiently Tested OS: " + U.isSufficientlyTestedOs());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testJavaSerialization() throws Exception {
- ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
- ObjectOutputStream objOut = new ObjectOutputStream(byteOut);
-
- objOut.writeObject(new byte[] {1, 2, 3, 4, 5, 5});
-
- objOut.flush();
-
- byte[] sBytes = byteOut.toByteArray();
-
- ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(sBytes));
-
- in.readObject();
- }
-
- /**
- *
- */
- public void testHidePassword() {
- Collection<String> uriList = new ArrayList<>();
-
- uriList.add("ftp://anonymous:111111;freq=5000@unknown.host:21/pub/gg-test");
- uriList.add("ftp://anonymous:111111;freq=5000@localhost:21/pub/gg-test");
-
- uriList.add("http://freq=5000@localhost/tasks");
- uriList.add("http://freq=5000@unknownhost.host/tasks");
-
- for (String uri : uriList)
- X.println(uri + " -> " + U.hidePassword(uri));
- }
-
- /**
- * Test job to test possible indefinite recursion in detecting peer deploy aware.
- */
- @SuppressWarnings({"UnusedDeclaration"})
- private class SelfReferencedJob extends ComputeJobAdapter implements GridPeerDeployAware {
- /** */
- private SelfReferencedJob ref;
-
- /** */
- private SelfReferencedJob[] arr;
-
- /** */
- private Collection<SelfReferencedJob> col;
-
- /** */
- private ClusterNode node;
-
- /** */
- private ClusterGroup subGrid;
-
- /**
- * @param ignite Grid.
- */
- private SelfReferencedJob(Ignite ignite) {
- node = ignite.cluster().localNode();
-
- ref = this;
-
- arr = new SelfReferencedJob[] {this, this};
-
- col = Arrays.asList(this, this, this);
-
- GridTestKernalContext ctx = newContext();
-
- subGrid = ignite.cluster().forNodes(Collections.singleton(node));
- }
-
- /** {@inheritDoc} */
- @Override public Object execute() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public Class<?> deployClass() {
- return getClass();
- }
-
- /** {@inheritDoc} */
- @Override public ClassLoader classLoader() {
- return getClass().getClassLoader();
- }
- }
-
- /**
- * @throws Exception If test fails.
- */
- public void testDetectPeerDeployAwareInfiniteRecursion() throws Exception {
- Ignite g = startGrid(1);
-
- try {
- final SelfReferencedJob job = new SelfReferencedJob(g);
-
- GridPeerDeployAware d = U.detectPeerDeployAware(U.peerDeployAware(job));
-
- assert d != null;
- assert SelfReferencedJob.class == d.deployClass();
- assert d.classLoader() == SelfReferencedJob.class.getClassLoader();
- }
- finally {
- stopGrid(1);
- }
- }
-
- /**
- * @param r Runnable.
- * @return Job created for given runnable.
- */
- private static ComputeJob job(final Runnable r) {
- return new ComputeJobAdapter() {
- @Nullable @Override public Object execute() {
- r.run();
-
- return null;
- }
- };
- }
-
- /**
- *
- * @throws Exception If failed.
- */
- public void testParseIsoDate() throws Exception {
- Calendar cal = U.parseIsoDate("2009-12-08T13:30:44.000Z");
-
- assert cal.get(Calendar.YEAR) == 2009;
- assert cal.get(Calendar.MONTH) == 11;
- assert cal.get(Calendar.DAY_OF_MONTH) == 8;
- assert cal.get(Calendar.HOUR_OF_DAY) == 13;
- assert cal.get(Calendar.MINUTE) == 30;
- assert cal.get(Calendar.SECOND) == 44;
- assert cal.get(Calendar.MILLISECOND) == 0;
- assert cal.get(Calendar.ZONE_OFFSET) == 0 :
- "Unexpected value: " + cal.get(Calendar.ZONE_OFFSET);
-
- cal = U.parseIsoDate("2009-12-08T13:30:44.000+03:00");
-
- assert cal.get(Calendar.YEAR) == 2009;
- assert cal.get(Calendar.MONTH) == 11;
- assert cal.get(Calendar.DAY_OF_MONTH) == 8;
- assert cal.get(Calendar.HOUR_OF_DAY) == 13;
- assert cal.get(Calendar.MINUTE) == 30;
- assert cal.get(Calendar.SECOND) == 44;
- assert cal.get(Calendar.MILLISECOND) == 0;
- assert cal.get(Calendar.ZONE_OFFSET) == 3 * 60 * 60 * 1000 :
- "Unexpected value: " + cal.get(Calendar.ZONE_OFFSET);
-
- cal = U.parseIsoDate("2009-12-08T13:30:44.000+0300");
-
- assert cal.get(Calendar.YEAR) == 2009;
- assert cal.get(Calendar.MONTH) == 11;
- assert cal.get(Calendar.DAY_OF_MONTH) == 8;
- assert cal.get(Calendar.HOUR_OF_DAY) == 13;
- assert cal.get(Calendar.MINUTE) == 30;
- assert cal.get(Calendar.SECOND) == 44;
- assert cal.get(Calendar.MILLISECOND) == 0;
- assert cal.get(Calendar.ZONE_OFFSET) == 3 * 60 * 60 * 1000 :
- "Unexpected value: " + cal.get(Calendar.ZONE_OFFSET);
- }
-
- /**
- * @throws Exception If test failed.
- */
- public void testPeerDeployAware0() throws Exception {
- Collection<Object> col = new ArrayList<>();
-
- col.add(null);
- col.add(null);
- col.add(null);
-
- GridPeerDeployAware pda = U.peerDeployAware0(col);
-
- assert pda != null;
-
- col.clear();
-
- col.add(null);
-
- pda = U.peerDeployAware0(col);
-
- assert pda != null;
-
- col.clear();
-
- pda = U.peerDeployAware0(col);
-
- assert pda != null;
-
- col.clear();
-
- col.add(null);
- col.add("Test");
- col.add(null);
-
- pda = U.peerDeployAware0(col);
-
- assert pda != null;
-
- col.clear();
-
- col.add("Test");
-
- pda = U.peerDeployAware0(col);
-
- assert pda != null;
-
- col.clear();
-
- col.add("Test");
- col.add(this);
-
- pda = U.peerDeployAware0(col);
-
- assert pda != null;
-
- col.clear();
-
- col.add(null);
- col.add("Test");
- col.add(null);
- col.add(this);
- col.add(null);
-
- pda = U.peerDeployAware0(col);
-
- assert pda != null;
- }
-
- /**
- * Test UUID to bytes array conversion.
- */
- public void testsGetBytes() {
- for (int i = 0; i < 100; i++) {
- UUID id = UUID.randomUUID();
-
- byte[] bytes = GridUtils.uuidToBytes(id);
- BigInteger n = new BigInteger(bytes);
-
- assert n.shiftRight(Long.SIZE).longValue() == id.getMostSignificantBits();
- assert n.longValue() == id.getLeastSignificantBits();
- }
- }
-
- /**
- *
- */
- @SuppressWarnings("ZeroLengthArrayAllocation")
- public void testReadByteArray() {
- assertTrue(Arrays.equals(new byte[0], U.readByteArray(ByteBuffer.allocate(0))));
- assertTrue(Arrays.equals(new byte[0], U.readByteArray(ByteBuffer.allocate(0), ByteBuffer.allocate(0))));
-
- Random rnd = new Random();
-
- byte[] bytes = new byte[13];
-
- rnd.nextBytes(bytes);
-
- assertTrue(Arrays.equals(bytes, U.readByteArray(ByteBuffer.wrap(bytes))));
- assertTrue(Arrays.equals(bytes, U.readByteArray(ByteBuffer.wrap(bytes), ByteBuffer.allocate(0))));
- assertTrue(Arrays.equals(bytes, U.readByteArray(ByteBuffer.allocate(0), ByteBuffer.wrap(bytes))));
-
- for (int i = 0; i < 1000; i++) {
- int n = rnd.nextInt(100);
-
- bytes = new byte[n];
-
- rnd.nextBytes(bytes);
-
- ByteBuffer[] bufs = new ByteBuffer[1 + rnd.nextInt(10)];
-
- int x = 0;
-
- for (int j = 0; j < bufs.length - 1; j++) {
- int size = x == n ? 0 : rnd.nextInt(n - x);
-
- bufs[j] = (ByteBuffer)ByteBuffer.wrap(bytes).position(x).limit(x += size);
- }
-
- bufs[bufs.length - 1] = (ByteBuffer)ByteBuffer.wrap(bytes).position(x).limit(n);
-
- assertTrue(Arrays.equals(bytes, U.readByteArray(bufs)));
- }
- }
-
- /**
- *
- */
- @SuppressWarnings("ZeroLengthArrayAllocation")
- public void testHashCodeFromBuffers() {
- assertEquals(Arrays.hashCode(new byte[0]), U.hashCode(ByteBuffer.allocate(0)));
- assertEquals(Arrays.hashCode(new byte[0]), U.hashCode(ByteBuffer.allocate(0), ByteBuffer.allocate(0)));
-
- Random rnd = new Random();
-
- for (int i = 0; i < 1000; i++) {
- ByteBuffer[] bufs = new ByteBuffer[1 + rnd.nextInt(15)];
-
- for (int j = 0; j < bufs.length; j++) {
- byte[] bytes = new byte[rnd.nextInt(25)];
-
- rnd.nextBytes(bytes);
-
- bufs[j] = ByteBuffer.wrap(bytes);
- }
-
- assertEquals(U.hashCode(bufs), Arrays.hashCode(U.readByteArray(bufs)));
- }
- }
-
- /**
- * Test annotation look up.
- */
- public void testGetAnnotations() {
- assert U.getAnnotation(A1.class, Ann1.class) != null;
- assert U.getAnnotation(A2.class, Ann1.class) != null;
-
- assert U.getAnnotation(A1.class, Ann2.class) != null;
- assert U.getAnnotation(A2.class, Ann2.class) != null;
-
- assert U.getAnnotation(A3.class, Ann1.class) == null;
- assert U.getAnnotation(A3.class, Ann2.class) != null;
- }
-
- /**
- *
- */
- public void testUnique() {
- int[][][] arrays = new int[][][]{
- new int[][]{EMPTY, EMPTY, EMPTY},
- new int[][]{new int[]{1, 2, 3}, EMPTY, new int[]{1, 2, 3}},
- new int[][]{new int[]{1, 2, 3}, new int[]{1, 2, 3}, new int[]{1, 2, 3}},
- new int[][]{new int[]{1, 2, 3}, new int[]{1, 3}, new int[]{1, 2, 3}},
- new int[][]{new int[]{1, 2, 30, 40, 50}, new int[]{2, 40}, new int[]{1, 2, 30, 40, 50}},
- new int[][]{new int[]{-100, -13, 1, 2, 5, 30, 40, 50}, new int[]{1, 2, 6, 100, 113},
- new int[]{-100, -13, 1, 2, 5, 6, 30, 40, 50, 100, 113}}
- };
-
- for (int[][] a : arrays) {
- assertArrayEquals(a[2], U.unique(a[0], a[0].length, a[1], a[1].length));
-
- assertArrayEquals(a[2], U.unique(a[1], a[1].length, a[0], a[0].length));
- }
-
- assertArrayEquals(new int[]{1, 2, 3, 4}, U.unique(new int[]{1, 2, 3, 8}, 3, new int[]{2, 4, 5}, 2));
- assertArrayEquals(new int[]{2, 4}, U.unique(new int[]{1, 2, 3, 8}, 0, new int[]{2, 4, 5}, 2));
- assertArrayEquals(new int[]{1, 2, 4, 5}, U.unique(new int[]{1, 2, 3, 8}, 2, new int[]{2, 4, 5, 6}, 3));
- assertArrayEquals(new int[]{1, 2}, U.unique(new int[]{1, 2, 3, 8}, 2, new int[]{2, 4, 5, 6}, 0));
- }
-
- /**
- *
- */
- public void testDifference() {
- int[][][] arrays = new int[][][]{
- new int[][]{EMPTY, EMPTY, EMPTY},
- new int[][]{new int[]{1, 2, 3}, EMPTY, new int[]{1, 2, 3}},
- new int[][]{EMPTY, new int[]{1, 2, 3}, EMPTY},
- new int[][]{new int[]{1, 2, 3}, new int[]{1, 2, 3}, EMPTY},
- new int[][]{new int[]{-100, -50, 1, 2, 3}, new int[]{-50, -1, 1, 3}, new int[]{-100, 2}},
- new int[][]{new int[]{-100, 1, 2, 30, 40, 50}, new int[]{2, 40}, new int[]{-100, 1, 30, 50}},
- new int[][]{new int[]{-1, 1, 2, 30, 40, 50}, new int[]{1, 2, 100, 113}, new int[]{-1, 30, 40, 50}}
- };
-
- for (int[][] a : arrays)
- assertArrayEquals(a[2], U.difference(a[0], a[0].length, a[1], a[1].length));
-
- assertArrayEquals(new int[]{1, 2}, U.difference(new int[]{1, 2, 30, 40, 50}, 3, new int[]{30, 40}, 2));
- assertArrayEquals(EMPTY, U.difference(new int[]{1, 2, 30, 40, 50}, 0, new int[]{30, 40}, 2));
- assertArrayEquals(new int[]{1, 2, 40}, U.difference(new int[]{1, 2, 30, 40, 50}, 4, new int[]{30, 40}, 1));
- assertArrayEquals(new int[]{1, 2, 30, 40}, U.difference(new int[]{1, 2, 30, 40, 50}, 4, new int[]{30, 40}, 0));
- }
-
- /**
- *
- */
- public void testCopyIfExceeded() {
- int[][] arrays = new int[][]{new int[]{13, 14, 17, 11}, new int[]{13}, EMPTY};
-
- for (int[] a : arrays) {
- int[] b = Arrays.copyOf(a, a.length);
-
- assertEquals(a, U.copyIfExceeded(a, a.length));
- assertArrayEquals(b, U.copyIfExceeded(a, a.length));
-
- for (int j = 0; j < a.length - 1; j++)
- assertArrayEquals(Arrays.copyOf(b, j), U.copyIfExceeded(a, j));
- }
- }
-
- /**
- *
- */
- public void testIsIncreasingArray() {
- assertTrue(U.isIncreasingArray(EMPTY, 0));
- assertTrue(U.isIncreasingArray(new int[]{Integer.MIN_VALUE, -10, 1, 13, Integer.MAX_VALUE}, 5));
- assertTrue(U.isIncreasingArray(new int[]{1, 2, 3, -1, 5}, 0));
- assertTrue(U.isIncreasingArray(new int[]{1, 2, 3, -1, 5}, 3));
- assertFalse(U.isIncreasingArray(new int[]{1, 2, 3, -1, 5}, 4));
- assertFalse(U.isIncreasingArray(new int[]{1, 2, 3, -1, 5}, 5));
- assertFalse(U.isIncreasingArray(new int[]{1, 2, 3, 3, 5}, 4));
- assertTrue(U.isIncreasingArray(new int[]{1, -1}, 1));
- assertFalse(U.isIncreasingArray(new int[]{1, -1}, 2));
- assertTrue(U.isIncreasingArray(new int[]{13, 13, 13}, 1));
- assertFalse(U.isIncreasingArray(new int[]{13, 13, 13}, 2));
- assertFalse(U.isIncreasingArray(new int[]{13, 13, 13}, 3));
- }
-
- /**
- *
- */
- public void testIsNonDecreasingArray() {
- assertTrue(U.isNonDecreasingArray(EMPTY, 0));
- assertTrue(U.isNonDecreasingArray(new int[]{Integer.MIN_VALUE, -10, 1, 13, Integer.MAX_VALUE}, 5));
- assertTrue(U.isNonDecreasingArray(new int[]{1, 2, 3, -1, 5}, 0));
- assertTrue(U.isNonDecreasingArray(new int[]{1, 2, 3, -1, 5}, 3));
- assertFalse(U.isNonDecreasingArray(new int[]{1, 2, 3, -1, 5}, 4));
- assertFalse(U.isNonDecreasingArray(new int[]{1, 2, 3, -1, 5}, 5));
- assertTrue(U.isNonDecreasingArray(new int[]{1, 2, 3, 3, 5}, 4));
- assertTrue(U.isNonDecreasingArray(new int[]{1, -1}, 1));
- assertFalse(U.isNonDecreasingArray(new int[]{1, -1}, 2));
- assertTrue(U.isNonDecreasingArray(new int[]{13, 13, 13}, 1));
- assertTrue(U.isNonDecreasingArray(new int[]{13, 13, 13}, 2));
- assertTrue(U.isNonDecreasingArray(new int[]{13, 13, 13}, 3));
- }
-
- /**
- * Test InetAddress Comparator.
- */
- public void testInetAddressesComparator() {
- List<InetSocketAddress> ips = new ArrayList<InetSocketAddress>() {
- {
- add(new InetSocketAddress("127.0.0.1", 1));
- add(new InetSocketAddress("10.0.0.1", 1));
- add(new InetSocketAddress("172.16.0.1", 1));
- add(new InetSocketAddress("192.168.0.1", 1));
- add(new InetSocketAddress("100.0.0.1", 1));
- add(new InetSocketAddress("XXX", 1));
- }
- };
-
- Collections.sort(ips, U.inetAddressesComparator(true));
-
- assertTrue(ips.get(0).getAddress().isLoopbackAddress());
- assertTrue(ips.get(ips.size() - 1).isUnresolved());
-
- Collections.sort(ips, U.inetAddressesComparator(false));
-
- assertTrue(ips.get(ips.size() - 2).getAddress().isLoopbackAddress());
- assertTrue(ips.get(ips.size() - 1).isUnresolved());
- }
-
-
- public void testMD5Calculation() throws Exception {
- String md5 = GridUtils.calculateMD5(new ByteArrayInputStream("Corrupted information.".getBytes()));
-
- assertEquals("d7dbe555be2eee7fa658299850169fa1", md5);
- }
-
- /**
- * Test enum.
- */
- private enum TestEnum {
- E1,
- E2,
- E3
- }
-
- @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE)
- private @interface Ann1 {}
-
- @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE)
- private @interface Ann2 {}
-
- private static class A1 implements I3, I5 {}
- private static class A2 extends A1 {}
- private static class A3 implements I5 {}
-
- @Ann1 private interface I1 {}
- private interface I2 extends I1 {}
- private interface I3 extends I2 {}
- @Ann2 private interface I4 {}
- private interface I5 extends I4 {}
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
new file mode 100644
index 0000000..c5917bd
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
@@ -0,0 +1,728 @@
+/*
+ * 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.util;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.cluster.ClusterGroup;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobAdapter;
+import org.apache.ignite.internal.util.lang.GridPeerDeployAware;
+import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.http.GridEmbeddedHttpServer;
+import org.apache.ignite.testframework.junits.GridTestKernalContext;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.testframework.junits.common.GridCommonTest;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.*;
+import java.lang.annotation.*;
+import java.math.BigInteger;
+import java.net.InetSocketAddress;
+import java.net.URL;
+import java.nio.ByteBuffer;
+import java.util.*;
+
+import static org.junit.Assert.assertArrayEquals;
+
+/**
+ * Grid utils tests.
+ */
+@GridCommonTest(group = "Utils")
+public class IgniteUtilsSelfTest extends GridCommonAbstractTest {
+ /** */
+ public static final int[] EMPTY = new int[0];
+
+ /**
+ * @return 120 character length string.
+ */
+ private String text120() {
+ char[] chs = new char[120];
+
+ Arrays.fill(chs, 'x');
+
+ return new String(chs);
+ }
+
+ /**
+ *
+ */
+ public void testIsPow2() {
+ assertTrue(U.isPow2(1));
+ assertTrue(U.isPow2(2));
+ assertTrue(U.isPow2(4));
+ assertTrue(U.isPow2(8));
+ assertTrue(U.isPow2(16));
+ assertTrue(U.isPow2(16 * 16));
+ assertTrue(U.isPow2(32 * 32));
+
+ assertFalse(U.isPow2(-4));
+ assertFalse(U.isPow2(-3));
+ assertFalse(U.isPow2(-2));
+ assertFalse(U.isPow2(-1));
+ assertFalse(U.isPow2(0));
+ assertFalse(U.isPow2(3));
+ assertFalse(U.isPow2(5));
+ assertFalse(U.isPow2(6));
+ assertFalse(U.isPow2(7));
+ assertFalse(U.isPow2(9));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testAllLocalIps() throws Exception {
+ Collection<String> ips = U.allLocalIps();
+
+ System.out.println("All local IPs: " + ips);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testAllLocalMACs() throws Exception {
+ Collection<String> macs = U.allLocalMACs();
+
+ System.out.println("All local MACs: " + macs);
+ }
+
+ /**
+ * On linux NetworkInterface.getHardwareAddress() returns null from time to time.
+ *
+ * @throws Exception If failed.
+ */
+ public void testAllLocalMACsMultiThreaded() throws Exception {
+ GridTestUtils.runMultiThreaded(new Runnable() {
+ @Override public void run() {
+ for (int i = 0; i < 30; i++) {
+ Collection<String> macs = U.allLocalMACs();
+
+ assertTrue("Mac address are not defined.", !macs.isEmpty());
+ }
+ }
+ }, 32, "thread");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testByteArray2String() throws Exception {
+ assertEquals("{0x0A,0x14,0x1E,0x28,0x32,0x3C,0x46,0x50,0x5A}",
+ U.byteArray2String(new byte[] {10, 20, 30, 40, 50, 60, 70, 80, 90}, "0x%02X", ",0x%02X"));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testFormatMins() throws Exception {
+ printFormatMins(0);
+ printFormatMins(1);
+ printFormatMins(2);
+ printFormatMins(59);
+ printFormatMins(60);
+ printFormatMins(61);
+ printFormatMins(60 * 24 - 1);
+ printFormatMins(60 * 24);
+ printFormatMins(60 * 24 + 1);
+ printFormatMins(5 * 60 * 24 - 1);
+ printFormatMins(5 * 60 * 24);
+ printFormatMins(5 * 60 * 24 + 1);
+ }
+
+ /**
+ * Helper method for {@link #testFormatMins()}
+ *
+ * @param mins Minutes to test.
+ */
+ private void printFormatMins(long mins) {
+ System.out.println("For " + mins + " minutes: " + X.formatMins(mins));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDownloadUrlFromHttp() throws Exception {
+ GridEmbeddedHttpServer srv = null;
+ try {
+ String urlPath = "/testDownloadUrl/";
+ srv = GridEmbeddedHttpServer.startHttpServer().withFileDownloadingHandler(urlPath,
+ GridTestUtils.resolveGridGainPath("/modules/core/src/test/config/tests.properties"));
+
+ File file = new File(System.getProperty("java.io.tmpdir") + File.separator + "url-http.file");
+
+ file = U.downloadUrl(new URL(srv.getBaseUrl() + urlPath), file);
+
+ assert file.exists();
+ assert file.delete();
+ }
+ finally {
+ if (srv != null)
+ srv.stop(1);
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDownloadUrlFromHttps() throws Exception {
+ GridEmbeddedHttpServer srv = null;
+ try {
+ String urlPath = "/testDownloadUrl/";
+ srv = GridEmbeddedHttpServer.startHttpsServer().withFileDownloadingHandler(urlPath,
+ GridTestUtils.resolveGridGainPath("modules/core/src/test/config/tests.properties"));
+
+ File file = new File(System.getProperty("java.io.tmpdir") + File.separator + "url-http.file");
+
+ file = U.downloadUrl(new URL(srv.getBaseUrl() + urlPath), file);
+
+ assert file.exists();
+ assert file.delete();
+ }
+ finally {
+ if (srv != null)
+ srv.stop(1);
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDownloadUrlFromLocalFile() throws Exception {
+ File file = new File(System.getProperty("java.io.tmpdir") + File.separator + "url-http.file");
+
+ file = U.downloadUrl(
+ GridTestUtils.resolveGridGainPath("modules/core/src/test/config/tests.properties").toURI().toURL(), file);
+
+ assert file.exists();
+ assert file.delete();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testOs() throws Exception {
+ System.out.println("OS string: " + U.osString());
+ System.out.println("JDK string: " + U.jdkString());
+ System.out.println("OS/JDK string: " + U.osJdkString());
+
+ System.out.println("Is Windows: " + U.isWindows());
+ System.out.println("Is Windows 95: " + U.isWindows95());
+ System.out.println("Is Windows 98: " + U.isWindows98());
+ System.out.println("Is Windows NT: " + U.isWindowsNt());
+ System.out.println("Is Windows 2000: " + U.isWindows2k());
+ System.out.println("Is Windows 2003: " + U.isWindows2003());
+ System.out.println("Is Windows XP: " + U.isWindowsXp());
+ System.out.println("Is Windows Vista: " + U.isWindowsVista());
+ System.out.println("Is Linux: " + U.isLinux());
+ System.out.println("Is Mac OS: " + U.isMacOs());
+ System.out.println("Is Netware: " + U.isNetWare());
+ System.out.println("Is Solaris: " + U.isSolaris());
+ System.out.println("Is Solaris SPARC: " + U.isSolarisSparc());
+ System.out.println("Is Solaris x86: " + U.isSolarisX86());
+ System.out.println("Is Windows7: " + U.isWindows7());
+ System.out.println("Is Sufficiently Tested OS: " + U.isSufficientlyTestedOs());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testJavaSerialization() throws Exception {
+ ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
+ ObjectOutputStream objOut = new ObjectOutputStream(byteOut);
+
+ objOut.writeObject(new byte[] {1, 2, 3, 4, 5, 5});
+
+ objOut.flush();
+
+ byte[] sBytes = byteOut.toByteArray();
+
+ ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(sBytes));
+
+ in.readObject();
+ }
+
+ /**
+ *
+ */
+ public void testHidePassword() {
+ Collection<String> uriList = new ArrayList<>();
+
+ uriList.add("ftp://anonymous:111111;freq=5000@unknown.host:21/pub/gg-test");
+ uriList.add("ftp://anonymous:111111;freq=5000@localhost:21/pub/gg-test");
+
+ uriList.add("http://freq=5000@localhost/tasks");
+ uriList.add("http://freq=5000@unknownhost.host/tasks");
+
+ for (String uri : uriList)
+ X.println(uri + " -> " + U.hidePassword(uri));
+ }
+
+ /**
+ * Test job to test possible indefinite recursion in detecting peer deploy aware.
+ */
+ @SuppressWarnings({"UnusedDeclaration"})
+ private class SelfReferencedJob extends ComputeJobAdapter implements GridPeerDeployAware {
+ /** */
+ private SelfReferencedJob ref;
+
+ /** */
+ private SelfReferencedJob[] arr;
+
+ /** */
+ private Collection<SelfReferencedJob> col;
+
+ /** */
+ private ClusterNode node;
+
+ /** */
+ private ClusterGroup subGrid;
+
+ /**
+ * @param ignite Grid.
+ */
+ private SelfReferencedJob(Ignite ignite) {
+ node = ignite.cluster().localNode();
+
+ ref = this;
+
+ arr = new SelfReferencedJob[] {this, this};
+
+ col = Arrays.asList(this, this, this);
+
+ GridTestKernalContext ctx = newContext();
+
+ subGrid = ignite.cluster().forNodes(Collections.singleton(node));
+ }
+
+ /** {@inheritDoc} */
+ @Override public Object execute() {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Class<?> deployClass() {
+ return getClass();
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClassLoader classLoader() {
+ return getClass().getClassLoader();
+ }
+ }
+
+ /**
+ * @throws Exception If test fails.
+ */
+ public void testDetectPeerDeployAwareInfiniteRecursion() throws Exception {
+ Ignite g = startGrid(1);
+
+ try {
+ final SelfReferencedJob job = new SelfReferencedJob(g);
+
+ GridPeerDeployAware d = U.detectPeerDeployAware(U.peerDeployAware(job));
+
+ assert d != null;
+ assert SelfReferencedJob.class == d.deployClass();
+ assert d.classLoader() == SelfReferencedJob.class.getClassLoader();
+ }
+ finally {
+ stopGrid(1);
+ }
+ }
+
+ /**
+ * @param r Runnable.
+ * @return Job created for given runnable.
+ */
+ private static ComputeJob job(final Runnable r) {
+ return new ComputeJobAdapter() {
+ @Nullable @Override public Object execute() {
+ r.run();
+
+ return null;
+ }
+ };
+ }
+
+ /**
+ *
+ * @throws Exception If failed.
+ */
+ public void testParseIsoDate() throws Exception {
+ Calendar cal = U.parseIsoDate("2009-12-08T13:30:44.000Z");
+
+ assert cal.get(Calendar.YEAR) == 2009;
+ assert cal.get(Calendar.MONTH) == 11;
+ assert cal.get(Calendar.DAY_OF_MONTH) == 8;
+ assert cal.get(Calendar.HOUR_OF_DAY) == 13;
+ assert cal.get(Calendar.MINUTE) == 30;
+ assert cal.get(Calendar.SECOND) == 44;
+ assert cal.get(Calendar.MILLISECOND) == 0;
+ assert cal.get(Calendar.ZONE_OFFSET) == 0 :
+ "Unexpected value: " + cal.get(Calendar.ZONE_OFFSET);
+
+ cal = U.parseIsoDate("2009-12-08T13:30:44.000+03:00");
+
+ assert cal.get(Calendar.YEAR) == 2009;
+ assert cal.get(Calendar.MONTH) == 11;
+ assert cal.get(Calendar.DAY_OF_MONTH) == 8;
+ assert cal.get(Calendar.HOUR_OF_DAY) == 13;
+ assert cal.get(Calendar.MINUTE) == 30;
+ assert cal.get(Calendar.SECOND) == 44;
+ assert cal.get(Calendar.MILLISECOND) == 0;
+ assert cal.get(Calendar.ZONE_OFFSET) == 3 * 60 * 60 * 1000 :
+ "Unexpected value: " + cal.get(Calendar.ZONE_OFFSET);
+
+ cal = U.parseIsoDate("2009-12-08T13:30:44.000+0300");
+
+ assert cal.get(Calendar.YEAR) == 2009;
+ assert cal.get(Calendar.MONTH) == 11;
+ assert cal.get(Calendar.DAY_OF_MONTH) == 8;
+ assert cal.get(Calendar.HOUR_OF_DAY) == 13;
+ assert cal.get(Calendar.MINUTE) == 30;
+ assert cal.get(Calendar.SECOND) == 44;
+ assert cal.get(Calendar.MILLISECOND) == 0;
+ assert cal.get(Calendar.ZONE_OFFSET) == 3 * 60 * 60 * 1000 :
+ "Unexpected value: " + cal.get(Calendar.ZONE_OFFSET);
+ }
+
+ /**
+ * @throws Exception If test failed.
+ */
+ public void testPeerDeployAware0() throws Exception {
+ Collection<Object> col = new ArrayList<>();
+
+ col.add(null);
+ col.add(null);
+ col.add(null);
+
+ GridPeerDeployAware pda = U.peerDeployAware0(col);
+
+ assert pda != null;
+
+ col.clear();
+
+ col.add(null);
+
+ pda = U.peerDeployAware0(col);
+
+ assert pda != null;
+
+ col.clear();
+
+ pda = U.peerDeployAware0(col);
+
+ assert pda != null;
+
+ col.clear();
+
+ col.add(null);
+ col.add("Test");
+ col.add(null);
+
+ pda = U.peerDeployAware0(col);
+
+ assert pda != null;
+
+ col.clear();
+
+ col.add("Test");
+
+ pda = U.peerDeployAware0(col);
+
+ assert pda != null;
+
+ col.clear();
+
+ col.add("Test");
+ col.add(this);
+
+ pda = U.peerDeployAware0(col);
+
+ assert pda != null;
+
+ col.clear();
+
+ col.add(null);
+ col.add("Test");
+ col.add(null);
+ col.add(this);
+ col.add(null);
+
+ pda = U.peerDeployAware0(col);
+
+ assert pda != null;
+ }
+
+ /**
+ * Test UUID to bytes array conversion.
+ */
+ public void testsGetBytes() {
+ for (int i = 0; i < 100; i++) {
+ UUID id = UUID.randomUUID();
+
+ byte[] bytes = IgniteUtils.uuidToBytes(id);
+ BigInteger n = new BigInteger(bytes);
+
+ assert n.shiftRight(Long.SIZE).longValue() == id.getMostSignificantBits();
+ assert n.longValue() == id.getLeastSignificantBits();
+ }
+ }
+
+ /**
+ *
+ */
+ @SuppressWarnings("ZeroLengthArrayAllocation")
+ public void testReadByteArray() {
+ assertTrue(Arrays.equals(new byte[0], U.readByteArray(ByteBuffer.allocate(0))));
+ assertTrue(Arrays.equals(new byte[0], U.readByteArray(ByteBuffer.allocate(0), ByteBuffer.allocate(0))));
+
+ Random rnd = new Random();
+
+ byte[] bytes = new byte[13];
+
+ rnd.nextBytes(bytes);
+
+ assertTrue(Arrays.equals(bytes, U.readByteArray(ByteBuffer.wrap(bytes))));
+ assertTrue(Arrays.equals(bytes, U.readByteArray(ByteBuffer.wrap(bytes), ByteBuffer.allocate(0))));
+ assertTrue(Arrays.equals(bytes, U.readByteArray(ByteBuffer.allocate(0), ByteBuffer.wrap(bytes))));
+
+ for (int i = 0; i < 1000; i++) {
+ int n = rnd.nextInt(100);
+
+ bytes = new byte[n];
+
+ rnd.nextBytes(bytes);
+
+ ByteBuffer[] bufs = new ByteBuffer[1 + rnd.nextInt(10)];
+
+ int x = 0;
+
+ for (int j = 0; j < bufs.length - 1; j++) {
+ int size = x == n ? 0 : rnd.nextInt(n - x);
+
+ bufs[j] = (ByteBuffer)ByteBuffer.wrap(bytes).position(x).limit(x += size);
+ }
+
+ bufs[bufs.length - 1] = (ByteBuffer)ByteBuffer.wrap(bytes).position(x).limit(n);
+
+ assertTrue(Arrays.equals(bytes, U.readByteArray(bufs)));
+ }
+ }
+
+ /**
+ *
+ */
+ @SuppressWarnings("ZeroLengthArrayAllocation")
+ public void testHashCodeFromBuffers() {
+ assertEquals(Arrays.hashCode(new byte[0]), U.hashCode(ByteBuffer.allocate(0)));
+ assertEquals(Arrays.hashCode(new byte[0]), U.hashCode(ByteBuffer.allocate(0), ByteBuffer.allocate(0)));
+
+ Random rnd = new Random();
+
+ for (int i = 0; i < 1000; i++) {
+ ByteBuffer[] bufs = new ByteBuffer[1 + rnd.nextInt(15)];
+
+ for (int j = 0; j < bufs.length; j++) {
+ byte[] bytes = new byte[rnd.nextInt(25)];
+
+ rnd.nextBytes(bytes);
+
+ bufs[j] = ByteBuffer.wrap(bytes);
+ }
+
+ assertEquals(U.hashCode(bufs), Arrays.hashCode(U.readByteArray(bufs)));
+ }
+ }
+
+ /**
+ * Test annotation look up.
+ */
+ public void testGetAnnotations() {
+ assert U.getAnnotation(A1.class, Ann1.class) != null;
+ assert U.getAnnotation(A2.class, Ann1.class) != null;
+
+ assert U.getAnnotation(A1.class, Ann2.class) != null;
+ assert U.getAnnotation(A2.class, Ann2.class) != null;
+
+ assert U.getAnnotation(A3.class, Ann1.class) == null;
+ assert U.getAnnotation(A3.class, Ann2.class) != null;
+ }
+
+ /**
+ *
+ */
+ public void testUnique() {
+ int[][][] arrays = new int[][][]{
+ new int[][]{EMPTY, EMPTY, EMPTY},
+ new int[][]{new int[]{1, 2, 3}, EMPTY, new int[]{1, 2, 3}},
+ new int[][]{new int[]{1, 2, 3}, new int[]{1, 2, 3}, new int[]{1, 2, 3}},
+ new int[][]{new int[]{1, 2, 3}, new int[]{1, 3}, new int[]{1, 2, 3}},
+ new int[][]{new int[]{1, 2, 30, 40, 50}, new int[]{2, 40}, new int[]{1, 2, 30, 40, 50}},
+ new int[][]{new int[]{-100, -13, 1, 2, 5, 30, 40, 50}, new int[]{1, 2, 6, 100, 113},
+ new int[]{-100, -13, 1, 2, 5, 6, 30, 40, 50, 100, 113}}
+ };
+
+ for (int[][] a : arrays) {
+ assertArrayEquals(a[2], U.unique(a[0], a[0].length, a[1], a[1].length));
+
+ assertArrayEquals(a[2], U.unique(a[1], a[1].length, a[0], a[0].length));
+ }
+
+ assertArrayEquals(new int[]{1, 2, 3, 4}, U.unique(new int[]{1, 2, 3, 8}, 3, new int[]{2, 4, 5}, 2));
+ assertArrayEquals(new int[]{2, 4}, U.unique(new int[]{1, 2, 3, 8}, 0, new int[]{2, 4, 5}, 2));
+ assertArrayEquals(new int[]{1, 2, 4, 5}, U.unique(new int[]{1, 2, 3, 8}, 2, new int[]{2, 4, 5, 6}, 3));
+ assertArrayEquals(new int[]{1, 2}, U.unique(new int[]{1, 2, 3, 8}, 2, new int[]{2, 4, 5, 6}, 0));
+ }
+
+ /**
+ *
+ */
+ public void testDifference() {
+ int[][][] arrays = new int[][][]{
+ new int[][]{EMPTY, EMPTY, EMPTY},
+ new int[][]{new int[]{1, 2, 3}, EMPTY, new int[]{1, 2, 3}},
+ new int[][]{EMPTY, new int[]{1, 2, 3}, EMPTY},
+ new int[][]{new int[]{1, 2, 3}, new int[]{1, 2, 3}, EMPTY},
+ new int[][]{new int[]{-100, -50, 1, 2, 3}, new int[]{-50, -1, 1, 3}, new int[]{-100, 2}},
+ new int[][]{new int[]{-100, 1, 2, 30, 40, 50}, new int[]{2, 40}, new int[]{-100, 1, 30, 50}},
+ new int[][]{new int[]{-1, 1, 2, 30, 40, 50}, new int[]{1, 2, 100, 113}, new int[]{-1, 30, 40, 50}}
+ };
+
+ for (int[][] a : arrays)
+ assertArrayEquals(a[2], U.difference(a[0], a[0].length, a[1], a[1].length));
+
+ assertArrayEquals(new int[]{1, 2}, U.difference(new int[]{1, 2, 30, 40, 50}, 3, new int[]{30, 40}, 2));
+ assertArrayEquals(EMPTY, U.difference(new int[]{1, 2, 30, 40, 50}, 0, new int[]{30, 40}, 2));
+ assertArrayEquals(new int[]{1, 2, 40}, U.difference(new int[]{1, 2, 30, 40, 50}, 4, new int[]{30, 40}, 1));
+ assertArrayEquals(new int[]{1, 2, 30, 40}, U.difference(new int[]{1, 2, 30, 40, 50}, 4, new int[]{30, 40}, 0));
+ }
+
+ /**
+ *
+ */
+ public void testCopyIfExceeded() {
+ int[][] arrays = new int[][]{new int[]{13, 14, 17, 11}, new int[]{13}, EMPTY};
+
+ for (int[] a : arrays) {
+ int[] b = Arrays.copyOf(a, a.length);
+
+ assertEquals(a, U.copyIfExceeded(a, a.length));
+ assertArrayEquals(b, U.copyIfExceeded(a, a.length));
+
+ for (int j = 0; j < a.length - 1; j++)
+ assertArrayEquals(Arrays.copyOf(b, j), U.copyIfExceeded(a, j));
+ }
+ }
+
+ /**
+ *
+ */
+ public void testIsIncreasingArray() {
+ assertTrue(U.isIncreasingArray(EMPTY, 0));
+ assertTrue(U.isIncreasingArray(new int[]{Integer.MIN_VALUE, -10, 1, 13, Integer.MAX_VALUE}, 5));
+ assertTrue(U.isIncreasingArray(new int[]{1, 2, 3, -1, 5}, 0));
+ assertTrue(U.isIncreasingArray(new int[]{1, 2, 3, -1, 5}, 3));
+ assertFalse(U.isIncreasingArray(new int[]{1, 2, 3, -1, 5}, 4));
+ assertFalse(U.isIncreasingArray(new int[]{1, 2, 3, -1, 5}, 5));
+ assertFalse(U.isIncreasingArray(new int[]{1, 2, 3, 3, 5}, 4));
+ assertTrue(U.isIncreasingArray(new int[]{1, -1}, 1));
+ assertFalse(U.isIncreasingArray(new int[]{1, -1}, 2));
+ assertTrue(U.isIncreasingArray(new int[]{13, 13, 13}, 1));
+ assertFalse(U.isIncreasingArray(new int[]{13, 13, 13}, 2));
+ assertFalse(U.isIncreasingArray(new int[]{13, 13, 13}, 3));
+ }
+
+ /**
+ *
+ */
+ public void testIsNonDecreasingArray() {
+ assertTrue(U.isNonDecreasingArray(EMPTY, 0));
+ assertTrue(U.isNonDecreasingArray(new int[]{Integer.MIN_VALUE, -10, 1, 13, Integer.MAX_VALUE}, 5));
+ assertTrue(U.isNonDecreasingArray(new int[]{1, 2, 3, -1, 5}, 0));
+ assertTrue(U.isNonDecreasingArray(new int[]{1, 2, 3, -1, 5}, 3));
+ assertFalse(U.isNonDecreasingArray(new int[]{1, 2, 3, -1, 5}, 4));
+ assertFalse(U.isNonDecreasingArray(new int[]{1, 2, 3, -1, 5}, 5));
+ assertTrue(U.isNonDecreasingArray(new int[]{1, 2, 3, 3, 5}, 4));
+ assertTrue(U.isNonDecreasingArray(new int[]{1, -1}, 1));
+ assertFalse(U.isNonDecreasingArray(new int[]{1, -1}, 2));
+ assertTrue(U.isNonDecreasingArray(new int[]{13, 13, 13}, 1));
+ assertTrue(U.isNonDecreasingArray(new int[]{13, 13, 13}, 2));
+ assertTrue(U.isNonDecreasingArray(new int[]{13, 13, 13}, 3));
+ }
+
+ /**
+ * Test InetAddress Comparator.
+ */
+ public void testInetAddressesComparator() {
+ List<InetSocketAddress> ips = new ArrayList<InetSocketAddress>() {
+ {
+ add(new InetSocketAddress("127.0.0.1", 1));
+ add(new InetSocketAddress("10.0.0.1", 1));
+ add(new InetSocketAddress("172.16.0.1", 1));
+ add(new InetSocketAddress("192.168.0.1", 1));
+ add(new InetSocketAddress("100.0.0.1", 1));
+ add(new InetSocketAddress("XXX", 1));
+ }
+ };
+
+ Collections.sort(ips, U.inetAddressesComparator(true));
+
+ assertTrue(ips.get(0).getAddress().isLoopbackAddress());
+ assertTrue(ips.get(ips.size() - 1).isUnresolved());
+
+ Collections.sort(ips, U.inetAddressesComparator(false));
+
+ assertTrue(ips.get(ips.size() - 2).getAddress().isLoopbackAddress());
+ assertTrue(ips.get(ips.size() - 1).isUnresolved());
+ }
+
+
+ public void testMD5Calculation() throws Exception {
+ String md5 = IgniteUtils.calculateMD5(new ByteArrayInputStream("Corrupted information.".getBytes()));
+
+ assertEquals("d7dbe555be2eee7fa658299850169fa1", md5);
+ }
+
+ /**
+ * Test enum.
+ */
+ private enum TestEnum {
+ E1,
+ E2,
+ E3
+ }
+
+ @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE)
+ private @interface Ann1 {}
+
+ @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE)
+ private @interface Ann2 {}
+
+ private static class A1 implements I3, I5 {}
+ private static class A2 extends A1 {}
+ private static class A3 implements I5 {}
+
+ @Ann1 private interface I1 {}
+ private interface I2 extends I1 {}
+ private interface I3 extends I2 {}
+ @Ann2 private interface I4 {}
+ private interface I5 extends I4 {}
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/test/java/org/apache/ignite/lang/GridSetWrapperSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/lang/GridSetWrapperSelfTest.java b/modules/core/src/test/java/org/apache/ignite/lang/GridSetWrapperSelfTest.java
index c0c0d66..07a78ea 100644
--- a/modules/core/src/test/java/org/apache/ignite/lang/GridSetWrapperSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/lang/GridSetWrapperSelfTest.java
@@ -120,7 +120,7 @@ public class GridSetWrapperSelfTest extends GridCommonAbstractTest {
set.add("v4");
set.add("v5");
- set.removeAll(GridUtils.addAll(new HashSet<String>(), "v2", "v4", "v5"));
+ set.removeAll(IgniteUtils.addAll(new HashSet<String>(), "v2", "v4", "v5"));
assertEquals(2, set.size());
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
index 87d38b7..6564b6f 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
@@ -42,7 +42,7 @@ public class IgniteUtilSelfTestSuite extends TestSuite {
TestSuite suite = new TestSuite("Ignite Util Test Suite");
suite.addTestSuite(GridThreadPoolExecutorServiceSelfTest.class);
- suite.addTestSuite(GridUtilsSelfTest.class);
+ suite.addTestSuite(IgniteUtilsSelfTest.class);
suite.addTestSuite(GridSpinReadWriteLockSelfTest.class);
suite.addTestSuite(GridQueueSelfTest.class);
suite.addTestSuite(GridStringBuilderFactorySelfTest.class);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
index 4f74794..d983025 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
@@ -18,7 +18,7 @@
package org.apache.ignite.visor.commands
import org.apache.ignite.internal.GridProductImpl
-import org.apache.ignite.internal.util.GridUtils
+import org.apache.ignite.internal.util.IgniteUtils
import org.apache.ignite.internal.util.typedef.internal.U
import org.apache.ignite.internal.util.scala.impl
@@ -94,7 +94,7 @@ object VisorConsole extends App {
customizeUI()
// Wrap line symbol for user input.
- private val wrapLine = if (GridUtils.isWindows) "^" else "\\"
+ private val wrapLine = if (IgniteUtils.isWindows) "^" else "\\"
private val emptyArg = "^([a-zA-z!?]+)$".r
private val varArg = "^([a-zA-z!?]+)\\s+(.+)$".r
@@ -270,7 +270,7 @@ private[commands] class VisorFileNameCompleter extends Completer {
case emptyStr if emptyStr.trim == "" => ""
case str =>
// replace wrong '/' on windows.
- val translated = if (GridUtils.isWindows) str.replace('/', '\\') else str
+ val translated = if (IgniteUtils.isWindows) str.replace('/', '\\') else str
// line before cursor.
val left = translated.substring(0, cursor)
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala
index 73c6e83..1899ca4 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala
@@ -17,7 +17,7 @@
package org.apache.ignite.visor.commands.alert
-import org.apache.ignite.internal.util.{GridUtils => U}
+import org.apache.ignite.internal.util.{IgniteUtils => U}
import org.apache.ignite.internal.util.lang.{GridFunc => F}
import org.apache.ignite._
@@ -278,7 +278,7 @@ class VisorAlertCommand {
// Grid-wide metrics (not node specific).
case "cc" if v != null => gf = makeGridFilter(v, gf, grid.metrics().getTotalCpus)
case "nc" if v != null => gf = makeGridFilter(v, gf, grid.nodes().size)
- case "hc" if v != null => gf = makeGridFilter(v, gf, U.neighborhood(grid.nodes()).size)
+ case "hc" if v != null => gf = makeGridFilter(v, gf, IgniteUtils.neighborhood(grid.nodes()).size)
case "cl" if v != null => gf = makeGridFilter(v, gf,
() => (grid.metrics().getAverageCpuLoad * 100).toLong)
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
index 2221e6b..4df0c35 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
@@ -17,7 +17,7 @@
package org.apache.ignite.visor.commands.config
-import org.apache.ignite.internal.util.GridUtils
+import org.apache.ignite.internal.util.IgniteUtils
import org.apache.ignite.internal.visor.node.VisorNodeConfigurationCollectorTask
import org.apache.ignite._
@@ -104,7 +104,7 @@ class VisorConfigurationCommand {
* @return String.
*/
private def arr2Str[T: ClassTag](arr: Array[T]): String = {
- if (arr != null && arr.length > 0) GridUtils.compact(arr.mkString(", ")) else DFLT
+ if (arr != null && arr.length > 0) IgniteUtils.compact(arr.mkString(", ")) else DFLT
}
/**
@@ -352,7 +352,7 @@ class VisorConfigurationCommand {
val evtsT = VisorTextTable()
- val inclEvtTypes = Option(cfg.includeEventTypes()).fold(DFLT)(et => arr2Str(et.map(GridUtils.gridEventName)))
+ val inclEvtTypes = Option(cfg.includeEventTypes()).fold(DFLT)(et => arr2Str(et.map(IgniteUtils.gridEventName)))
evtsT += ("Included event types", inclEvtTypes)
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/deploy/VisorDeployCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/deploy/VisorDeployCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/deploy/VisorDeployCommand.scala
index 4f189f2..08456d7 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/deploy/VisorDeployCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/deploy/VisorDeployCommand.scala
@@ -17,7 +17,7 @@
package org.apache.ignite.visor.commands.deploy
-import org.apache.ignite.internal.util.GridUtils
+import org.apache.ignite.internal.util.IgniteUtils
import org.apache.ignite.internal.util.io.GridFilenameUtils
import org.apache.ignite.internal.util.typedef.X
@@ -184,7 +184,7 @@ private case class VisorCopier(
ch.connect()
// Added to skip login message.
- GridUtils.sleep(1000)
+ IgniteUtils.sleep(1000)
val writer = new PrintStream(ch.getOutputStream, true)
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala
index 3f9dea0..fc0f35d 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/disco/VisorDiscoveryCommand.scala
@@ -17,7 +17,7 @@
package org.apache.ignite.visor.commands.disco
-import org.apache.ignite.internal.util.GridUtils
+import org.apache.ignite.internal.util.IgniteUtils
import org.apache.ignite.internal.util.typedef.internal.U
import org.apache.ignite.internal.visor.event.VisorGridDiscoveryEvent
import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask
@@ -226,7 +226,7 @@ class VisorDiscoveryCommand {
val nodeStartTime = node.metrics().getStartTime
if (nodeStartTime > System.currentTimeMillis() - tmFrame) {
- val root = new VisorGridDiscoveryEvent(EVT_NODE_JOINED, null, GridUtils.gridEventName(EVT_NODE_JOINED),
+ val root = new VisorGridDiscoveryEvent(EVT_NODE_JOINED, null, IgniteUtils.gridEventName(EVT_NODE_JOINED),
node.id(), nodeStartTime, "", "", node.id, node.addresses().head, node.isDaemon)
evts = Seq(root) ++ evts
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala
index 24b9b94..79a98e5 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala
@@ -17,7 +17,7 @@
package org.apache.ignite.visor.commands.events
-import org.apache.ignite.internal.util.GridUtils
+import org.apache.ignite.internal.util.IgniteUtils
import org.apache.ignite.internal.util.typedef.internal.U
import org.apache.ignite.internal.visor.event.VisorGridEvent
import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask
@@ -395,7 +395,7 @@ class VisorEventsCommand {
all #= ("Timestamp", "Description")
sorted.take(cnt).foreach(evt =>
- all += (formatDateTime(evt.timestamp()), GridUtils.compact(evt.shortDisplay))
+ all += (formatDateTime(evt.timestamp()), IgniteUtils.compact(evt.shortDisplay))
)
all.render()
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/node/VisorNodeCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/node/VisorNodeCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/node/VisorNodeCommand.scala
index 8083ce9..475f916 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/node/VisorNodeCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/node/VisorNodeCommand.scala
@@ -18,7 +18,7 @@
package org.apache.ignite.visor.commands.node
import org.apache.ignite.internal.GridNodeAttributes
-import org.apache.ignite.internal.util.GridUtils
+import org.apache.ignite.internal.util.IgniteUtils
import org.apache.ignite.internal.util.typedef.internal.U
import GridNodeAttributes._
import org.apache.ignite.internal.util.lang.{GridFunc => F}
@@ -175,7 +175,7 @@ class VisorNodeCommand {
val gridName: String = node.attribute(ATTR_GRID_NAME)
- val ver = GridUtils.productVersion(node)
+ val ver = IgniteUtils.productVersion(node)
val verStr = ver.major() + "." + ver.minor() + "." + ver.maintenance() +
(if (F.isEmpty(ver.stage())) "" else "-" + ver.stage())
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala
index 7f4ab1f..e91dd26 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala
@@ -22,7 +22,7 @@ import org.apache.ignite._
import java.io._
import java.util.concurrent._
-import org.apache.ignite.internal.util.GridUtils
+import org.apache.ignite.internal.util.IgniteUtils
import org.apache.ignite.internal.util.typedef.internal.U
import org.apache.ignite.visor.VisorTag
import org.apache.ignite.visor.commands.{VisorConsoleCommand, VisorTextTable}
@@ -311,7 +311,7 @@ class VisorStartCommand {
errT #= ("Host", "Error")
- res.filter(!_.ok) foreach (r => { errT += (r.host, r.errMsg.replace("\t", " ").split(GridUtils.nl()).toSeq) })
+ res.filter(!_.ok) foreach (r => { errT += (r.host, r.errMsg.replace("\t", " ").split(IgniteUtils.nl()).toSeq) })
errT.render()
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala
index be1b9f1..3486b95 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala
@@ -17,7 +17,7 @@
package org.apache.ignite.visor.commands.tasks
-import org.apache.ignite.internal.util.GridUtils
+import org.apache.ignite.internal.util.IgniteUtils
import org.apache.ignite.internal.util.typedef.internal.U
import org.apache.ignite.internal.visor.event.{VisorGridEvent, VisorGridJobEvent, VisorGridTaskEvent}
import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask
@@ -76,7 +76,7 @@ private case class VisorExecution(
* ID8 form of task execution ID.
*/
lazy val id8: String =
- GridUtils.id8(id)
+ IgniteUtils.id8(id)
/**
* ID8 of the task execution + its associated variable.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommand.scala
index 7648ea1..9f6b637 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommand.scala
@@ -18,7 +18,7 @@
package org.apache.ignite.visor.commands.top
import org.apache.ignite.internal.GridNodeAttributes
-import org.apache.ignite.internal.util.GridUtils
+import org.apache.ignite.internal.util.IgniteUtils
import GridNodeAttributes._
import org.apache.ignite.internal.util.typedef._
@@ -275,7 +275,7 @@ class VisorTopologyCommand {
nl()
}
- val neighborhood = GridUtils.neighborhood(nodes)
+ val neighborhood = IgniteUtils.neighborhood(nodes)
val hostsT = VisorTextTable()
@@ -336,7 +336,7 @@ class VisorTopologyCommand {
val sumT = VisorTextTable()
- sumT += ("Total hosts", GridUtils.neighborhood(grid.nodes()).size)
+ sumT += ("Total hosts", IgniteUtils.neighborhood(grid.nodes()).size)
sumT += ("Total nodes", grid.nodes().size)
sumT += ("Total CPUs", m.getTotalCpus)
sumT += ("Avg. CPU load", safePercent(m.getAverageCpuLoad * 100))
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommand.scala
index 733cfee..a36762a 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommand.scala
@@ -18,7 +18,7 @@
package org.apache.ignite.visor.commands.vvm
import org.apache.ignite.internal.GridNodeAttributes
-import org.apache.ignite.internal.util.GridUtils
+import org.apache.ignite.internal.util.IgniteUtils
import org.apache.ignite.internal.util.typedef.internal.U
import GridNodeAttributes._
import org.apache.ignite.internal.visor.util.{VisorTaskUtils => TU}
@@ -120,7 +120,7 @@ class VisorVvmCommand {
var vvmCmd: String = null
- val ext = if (GridUtils.isWindows) ".exe" else ""
+ val ext = if (IgniteUtils.isWindows) ".exe" else ""
val fs = File.separator
@@ -195,7 +195,7 @@ class VisorVvmCommand {
val neighbors = grid.forHost(grid.localNode).nodes()
- if (GridUtils.isWindows)
+ if (IgniteUtils.isWindows)
vvmCmd = "cmd /c \"%s\"".format(vvmCmd)
for (node <- nodes if !neighbors.contains(node)) {
@@ -236,7 +236,7 @@ class VisorVvmCommand {
* @param vvmCmd VisualVM command.
*/
private def vvmCommandArray(vvmCmd: String): Array[String] = {
- if (GridUtils.isWindows) Array("cmd", "/c", vvmCmd) else Array(vvmCmd)
+ if (IgniteUtils.isWindows) Array("cmd", "/c", vvmCmd) else Array(vvmCmd)
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
index cb7ce1b..764a347 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
@@ -33,7 +33,7 @@ import org.apache.ignite.internal.GridNodeAttributes._
import org.apache.ignite.internal.processors.spring.IgniteSpringProcessor
import org.apache.ignite.internal.util.lang.{GridFunc => F}
import org.apache.ignite.internal.util.typedef._
-import org.apache.ignite.internal.util.{GridConfigurationFinder, GridUtils}
+import org.apache.ignite.internal.util.{GridConfigurationFinder, IgniteUtils}
import org.apache.ignite.internal.visor.VisorTaskArgument
import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask
import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask.VisorNodeEventsCollectorTaskArg
@@ -1475,7 +1475,7 @@ object visor extends VisorTag {
new URL(path)
catch {
case e: Exception =>
- val url = GridUtils.resolveGridGainUrl(path)
+ val url = IgniteUtils.resolveGridGainUrl(path)
if (url == null)
throw new IgniteCheckedException("GridGain configuration path is invalid: " + path, e)
@@ -1486,7 +1486,7 @@ object visor extends VisorTag {
// Add no-op logger to remove no-appender warning.
val log4jTup =
if (classOf[Ignition].getClassLoader.getResource("org/apache/log4j/Appender.class") != null)
- GridUtils.addLog4jNoOpLogger()
+ IgniteUtils.addLog4jNoOpLogger()
else
null
@@ -1499,7 +1499,7 @@ object visor extends VisorTag {
"drSenderHubConfiguration", "drReceiverHubConfiguration").get1()
finally {
if (log4jTup != null)
- GridUtils.removeLog4jNoOpLogger(log4jTup)
+ IgniteUtils.removeLog4jNoOpLogger(log4jTup)
}
if (cfgs == null || cfgs.isEmpty)
@@ -1903,7 +1903,7 @@ object visor extends VisorTag {
t #= ("#", "Int./Ext. IPs", "Node ID8(@)", "OS", "CPUs", "MACs", "CPU Load")
- val neighborhood = GridUtils.neighborhood(grid.nodes()).values().toIndexedSeq
+ val neighborhood = IgniteUtils.neighborhood(grid.nodes()).values().toIndexedSeq
if (neighborhood.isEmpty) {
warn("Topology is empty.")
@@ -2355,7 +2355,7 @@ object visor extends VisorTag {
val folder = Option(f.getParent).getOrElse("")
val fileName = f.getName
- logFile = new File(GridUtils.resolveWorkDirectory(folder, false), fileName)
+ logFile = new File(IgniteUtils.resolveWorkDirectory(folder, false), fileName)
logFile.createNewFile()
@@ -2449,7 +2449,7 @@ object visor extends VisorTag {
out,
formatDateTime(e.timestamp),
nodeId8Addr(e.nid()),
- GridUtils.compact(e.shortDisplay())
+ IgniteUtils.compact(e.shortDisplay())
)
if (EVTS_DISCOVERY.contains(e.typeId()))
@@ -2457,7 +2457,7 @@ object visor extends VisorTag {
})
}
finally {
- GridUtils.close(out, null)
+ IgniteUtils.close(out, null)
}
}
}
@@ -2522,7 +2522,7 @@ object visor extends VisorTag {
}
logText("H/N/C" + pipe +
- GridUtils.neighborhood(grid.nodes()).size.toString.padTo(4, ' ') + pipe +
+ IgniteUtils.neighborhood(grid.nodes()).size.toString.padTo(4, ' ') + pipe +
grid.nodes().size().toString.padTo(4, ' ') + pipe +
m.getTotalCpus.toString.padTo(4, ' ') + pipe +
bar(m.getAverageCpuLoad, m.getHeapMemoryUsed / m.getHeapMemoryMaximum) + pipe
@@ -2554,7 +2554,7 @@ object visor extends VisorTag {
case e: IOException => ()
}
finally {
- GridUtils.close(out, null)
+ IgniteUtils.close(out, null)
}
}
}
[52/52] [abbrv] incubator-ignite git commit: # IGNITE-61 - Fixed
compilation
Posted by vk...@apache.org.
# IGNITE-61 - Fixed compilation
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7c93b5e9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7c93b5e9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7c93b5e9
Branch: refs/heads/ignite-61
Commit: 7c93b5e9def21eed8b35795035d9ed2fa0acfb3b
Parents: 3dbb6ac
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Sun Feb 1 19:26:40 2015 -0800
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Sun Feb 1 19:26:40 2015 -0800
----------------------------------------------------------------------
.../ignite/internal/GridJobExecuteRequest.java | 2 +-
.../internal/managers/GridManagerAdapter.java | 2 +-
.../managers/communication/GridIoManager.java | 19 ++++----
.../distributed/GridCacheTtlUpdateRequest.java | 50 ++++++++++----------
.../distributed/dht/GridDhtLockRequest.java | 4 +-
.../distributed/dht/GridDhtTxFinishRequest.java | 8 ++--
.../dht/atomic/GridDhtAtomicUpdateRequest.java | 10 ++--
.../dht/atomic/GridNearAtomicUpdateRequest.java | 4 +-
.../distributed/near/GridNearGetRequest.java | 4 +-
.../ignite/internal/util/IgniteUtils.java | 1 +
.../GridTcpCommunicationMessageAdapter.java | 5 +-
.../GridTcpCommunicationMessageState.java | 5 +-
.../internal/util/ipc/IpcToNioAdapter.java | 1 +
.../internal/util/nio/GridDirectParser.java | 5 +-
.../extensions/communication/MessageReader.java | 2 +-
.../extensions/communication/MessageWriter.java | 2 +-
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 3 +-
.../org/apache/ignite/spi/IgniteSpiContext.java | 8 ++--
.../GridTcpCommunicationByteBufferStream.java | 8 ++--
.../GridTcpCommunicationMessageReader.java | 3 +-
.../GridTcpCommunicationMessageWriter.java | 1 +
.../testframework/GridSpiTestContext.java | 13 +++--
22 files changed, 83 insertions(+), 77 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
index 929f718..d26ce22 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
@@ -832,7 +832,7 @@ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter im
commState.idx++;
case 16:
- UUID subjId0 = commState.getUuid();
+ UUID subjId0 = commState.getUuid(null);
if (subjId0 == UUID_NOT_READ)
return false;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
index a5c5e47..3cb470c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
@@ -516,7 +516,7 @@ public abstract class GridManagerAdapter<T extends IgniteSpi> implements GridMan
return e != null ? (V)e.value() : null;
}
- @Override public MessageFactory messageFactory() {
+ @Override public GridTcpMessageFactory messageFactory() {
return ctx.io().messageFactory();
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
index b918b68..e26a124 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
@@ -21,21 +21,22 @@ import org.apache.ignite.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.events.*;
import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.util.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.marshaller.*;
-import org.apache.ignite.plugin.extensions.communication.*;
-import org.apache.ignite.spi.*;
-import org.apache.ignite.spi.communication.*;
import org.apache.ignite.internal.managers.*;
import org.apache.ignite.internal.managers.deployment.*;
import org.apache.ignite.internal.managers.eventstorage.*;
import org.apache.ignite.internal.processors.timeout.*;
+import org.apache.ignite.internal.util.*;
import org.apache.ignite.internal.util.direct.*;
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.internal.util.worker.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.marshaller.*;
+import org.apache.ignite.plugin.extensions.communication.*;
+import org.apache.ignite.spi.*;
+import org.apache.ignite.spi.communication.*;
+import org.gridgain.grid.util.direct.*;
import org.jdk8.backport.*;
import org.jetbrains.annotations.*;
@@ -138,7 +139,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
private Map<Byte, GridTcpCommunicationMessageProducer> pluginMsgs;
/** */
- private MessageFactory msgFactory;
+ private GridTcpMessageFactory msgFactory;
/** */
private MessageWriterFactory writerFactory;
@@ -200,7 +201,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
else
producers = common;
- msgFactory = new MessageFactory() {
+ msgFactory = new GridTcpMessageFactory() {
@Override public GridTcpCommunicationMessageAdapter create(byte type) {
GridTcpCommunicationMessageAdapter msg;
@@ -222,7 +223,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
};
}
- public MessageFactory messageFactory() {
+ public GridTcpMessageFactory messageFactory() {
assert msgFactory != null;
return msgFactory;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java
index 615a1d4..6b0fa97 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java
@@ -201,7 +201,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
return false;
if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
+ if (!commState.putByte(null, directType()))
return false;
commState.typeWritten = true;
@@ -211,7 +211,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
case 3:
if (keysBytes != null) {
if (commState.it == null) {
- if (!commState.putInt(keysBytes.size()))
+ if (!commState.putInt(null, keysBytes.size()))
return false;
commState.it = keysBytes.iterator();
@@ -221,7 +221,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
if (commState.cur == NULL)
commState.cur = commState.it.next();
- if (!commState.putByteArray((byte[])commState.cur))
+ if (!commState.putByteArray(null, (byte[])commState.cur))
return false;
commState.cur = NULL;
@@ -229,7 +229,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
commState.it = null;
} else {
- if (!commState.putInt(-1))
+ if (!commState.putInt(null, -1))
return false;
}
@@ -238,7 +238,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
case 4:
if (nearKeysBytes != null) {
if (commState.it == null) {
- if (!commState.putInt(nearKeysBytes.size()))
+ if (!commState.putInt(null, nearKeysBytes.size()))
return false;
commState.it = nearKeysBytes.iterator();
@@ -248,7 +248,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
if (commState.cur == NULL)
commState.cur = commState.it.next();
- if (!commState.putByteArray((byte[])commState.cur))
+ if (!commState.putByteArray(null, (byte[])commState.cur))
return false;
commState.cur = NULL;
@@ -256,7 +256,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
commState.it = null;
} else {
- if (!commState.putInt(-1))
+ if (!commState.putInt(null, -1))
return false;
}
@@ -265,7 +265,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
case 5:
if (nearVers != null) {
if (commState.it == null) {
- if (!commState.putInt(nearVers.size()))
+ if (!commState.putInt(null, nearVers.size()))
return false;
commState.it = nearVers.iterator();
@@ -275,7 +275,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
if (commState.cur == NULL)
commState.cur = commState.it.next();
- if (!commState.putCacheVersion((GridCacheVersion)commState.cur))
+ if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur))
return false;
commState.cur = NULL;
@@ -283,20 +283,20 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
commState.it = null;
} else {
- if (!commState.putInt(-1))
+ if (!commState.putInt(null, -1))
return false;
}
commState.idx++;
case 6:
- if (!commState.putLong(topVer))
+ if (!commState.putLong(null, topVer))
return false;
commState.idx++;
case 7:
- if (!commState.putLong(ttl))
+ if (!commState.putLong(null, ttl))
return false;
commState.idx++;
@@ -304,7 +304,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
case 8:
if (vers != null) {
if (commState.it == null) {
- if (!commState.putInt(vers.size()))
+ if (!commState.putInt(null, vers.size()))
return false;
commState.it = vers.iterator();
@@ -314,7 +314,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
if (commState.cur == NULL)
commState.cur = commState.it.next();
- if (!commState.putCacheVersion((GridCacheVersion)commState.cur))
+ if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur))
return false;
commState.cur = NULL;
@@ -322,7 +322,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
commState.it = null;
} else {
- if (!commState.putInt(-1))
+ if (!commState.putInt(null, -1))
return false;
}
@@ -346,7 +346,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
if (buf.remaining() < 4)
return false;
- commState.readSize = commState.getInt();
+ commState.readSize = commState.getInt(null);
}
if (commState.readSize >= 0) {
@@ -354,7 +354,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
keysBytes = new ArrayList<>(commState.readSize);
for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
+ byte[] _val = commState.getByteArray(null);
if (_val == BYTE_ARR_NOT_READ)
return false;
@@ -375,7 +375,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
if (buf.remaining() < 4)
return false;
- commState.readSize = commState.getInt();
+ commState.readSize = commState.getInt(null);
}
if (commState.readSize >= 0) {
@@ -383,7 +383,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
nearKeysBytes = new ArrayList<>(commState.readSize);
for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
+ byte[] _val = commState.getByteArray(null);
if (_val == BYTE_ARR_NOT_READ)
return false;
@@ -404,7 +404,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
if (buf.remaining() < 4)
return false;
- commState.readSize = commState.getInt();
+ commState.readSize = commState.getInt(null);
}
if (commState.readSize >= 0) {
@@ -412,7 +412,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
nearVers = new ArrayList<>(commState.readSize);
for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheVersion _val = commState.getCacheVersion();
+ GridCacheVersion _val = commState.getCacheVersion(null);
if (_val == CACHE_VER_NOT_READ)
return false;
@@ -432,7 +432,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
if (buf.remaining() < 8)
return false;
- topVer = commState.getLong();
+ topVer = commState.getLong(null);
commState.idx++;
@@ -440,7 +440,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
if (buf.remaining() < 8)
return false;
- ttl = commState.getLong();
+ ttl = commState.getLong(null);
commState.idx++;
@@ -449,7 +449,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
if (buf.remaining() < 4)
return false;
- commState.readSize = commState.getInt();
+ commState.readSize = commState.getInt(null);
}
if (commState.readSize >= 0) {
@@ -457,7 +457,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
vers = new ArrayList<>(commState.readSize);
for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheVersion _val = commState.getCacheVersion();
+ GridCacheVersion _val = commState.getCacheVersion(null);
if (_val == CACHE_VER_NOT_READ)
return false;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
index b5fe8b3..8ed9715 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
@@ -458,7 +458,7 @@ public class GridDhtLockRequest<K, V> extends GridDistributedLockRequest<K, V> {
commState.idx++;
case 32:
- if (!commState.putLong(accessTtl))
+ if (!commState.putLong(null, accessTtl))
return false;
commState.idx++;
@@ -566,7 +566,7 @@ public class GridDhtLockRequest<K, V> extends GridDistributedLockRequest<K, V> {
if (buf.remaining() < 8)
return false;
- accessTtl = commState.getLong();
+ accessTtl = commState.getLong(null);
commState.idx++;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
index 30987df..c394cf6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
@@ -506,13 +506,13 @@ public class GridDhtTxFinishRequest<K, V> extends GridDistributedTxFinishRequest
commState.idx++;
case 32:
- if (!commState.putLongList(ttls))
+ if (!commState.putLongList(null, ttls))
return false;
commState.idx++;
case 33:
- if (!commState.putLongList(nearTtls))
+ if (!commState.putLongList(null, nearTtls))
return false;
commState.idx++;
@@ -664,7 +664,7 @@ public class GridDhtTxFinishRequest<K, V> extends GridDistributedTxFinishRequest
commState.idx++;
case 32:
- GridLongList ttls0 = commState.getLongList();
+ GridLongList ttls0 = commState.getLongList(null);
if (ttls0 == LONG_LIST_NOT_READ)
return false;
@@ -674,7 +674,7 @@ public class GridDhtTxFinishRequest<K, V> extends GridDistributedTxFinishRequest
commState.idx++;
case 33:
- GridLongList nearTtls0 = commState.getLongList();
+ GridLongList nearTtls0 = commState.getLongList(null);
if (nearTtls0 == LONG_LIST_NOT_READ)
return false;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
index 6f7ce44..baf929b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
@@ -866,13 +866,13 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K, V> imp
commState.idx++;
case 12:
- if (!commState.putLong(topVer))
+ if (!commState.putLong(null, topVer))
return false;
commState.idx++;
case 13:
- if (!commState.putLongList(ttls))
+ if (!commState.putLongList(null, ttls))
return false;
commState.idx++;
@@ -1100,7 +1100,7 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K, V> imp
if (buf.remaining() < 4)
return false;
- commState.readSize = commState.getInt();
+ commState.readSize = commState.getInt(null);
}
if (commState.readSize >= 0) {
@@ -1154,7 +1154,7 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K, V> imp
commState.idx++;
case 8:
- GridLongList nearExpireTimes0 = commState.getLongList();
+ GridLongList nearExpireTimes0 = commState.getLongList(null);
if (nearExpireTimes0 == LONG_LIST_NOT_READ)
return false;
@@ -1164,7 +1164,7 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K, V> imp
commState.idx++;
case 9:
- GridLongList nearTtls0 = commState.getLongList();
+ GridLongList nearTtls0 = commState.getLongList(null);
if (nearTtls0 == LONG_LIST_NOT_READ)
return false;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
index e095e1f..e27065e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
@@ -955,7 +955,7 @@ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K, V> im
invokeArgsBytes = new byte[commState.readSize][];
for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
+ byte[] _val = commState.getByteArray(null);
if (_val == BYTE_ARR_NOT_READ)
return false;
@@ -976,7 +976,7 @@ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K, V> im
if (buf.remaining() < 4)
return false;
- commState.readSize = commState.getInt();
+ commState.readSize = commState.getInt(null);
}
if (commState.readSize >= 0) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
index 2a51d59..033e793 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
@@ -297,7 +297,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements
switch (commState.idx) {
case 3:
- if (!commState.putLong(accessTtl))
+ if (!commState.putLong(null, accessTtl))
return false;
commState.idx++;
@@ -433,7 +433,7 @@ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements
if (buf.remaining() < 8)
return false;
- accessTtl = commState.getLong();
+ accessTtl = commState.getLong(null);
commState.idx++;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 5ba3403..75939e0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -27,6 +27,7 @@ import org.apache.ignite.internal.*;
import org.apache.ignite.internal.mxbean.*;
import org.apache.ignite.internal.processors.cache.*;
import org.apache.ignite.internal.processors.cache.version.*;
+import org.apache.ignite.internal.util.direct.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.lifecycle.*;
import org.apache.ignite.portables.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java
index 822c0bc..3580cb7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java
@@ -18,11 +18,12 @@
package org.apache.ignite.internal.util.direct;
import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*;
import org.apache.ignite.internal.processors.cache.version.*;
+import org.apache.ignite.internal.processors.clock.*;
import org.apache.ignite.internal.util.*;
import org.apache.ignite.lang.*;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*;
-import org.apache.ignite.internal.processors.clock.*;
+import org.apache.ignite.plugin.extensions.communication.*;
import java.io.*;
import java.nio.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java
index 85717e4..44b22ce 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java
@@ -18,11 +18,12 @@
package org.apache.ignite.internal.util.direct;
import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*;
import org.apache.ignite.internal.processors.cache.version.*;
+import org.apache.ignite.internal.processors.clock.*;
import org.apache.ignite.internal.util.*;
import org.apache.ignite.lang.*;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*;
-import org.apache.ignite.internal.processors.clock.*;
+import org.apache.ignite.plugin.extensions.communication.*;
import org.jetbrains.annotations.*;
import sun.misc.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java
index d9daba6..043e2bb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.util.ipc;
import org.apache.ignite.*;
import org.apache.ignite.internal.util.direct.*;
import org.apache.ignite.internal.util.nio.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
import java.io.*;
import java.nio.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
index 350d0b1..b87236c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
@@ -18,9 +18,8 @@
package org.apache.ignite.internal.util.nio;
import org.apache.ignite.*;
-import org.apache.ignite.plugin.extensions.communication.*;
-import org.apache.ignite.spi.*;
import org.apache.ignite.internal.util.direct.*;
+import org.apache.ignite.spi.*;
import org.jetbrains.annotations.*;
import java.io.*;
@@ -37,7 +36,7 @@ public class GridDirectParser implements GridNioParser {
private IgniteSpiAdapter spi;
/** */
- private MessageFactory msgFactory;
+ private GridTcpMessageFactory msgFactory;
/**
* @param spi Spi.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java
index dc2bee8..1431738 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java
@@ -9,8 +9,8 @@
package org.apache.ignite.plugin.extensions.communication;
+import org.apache.ignite.internal.util.direct.*;
import org.apache.ignite.plugin.*;
-import org.gridgain.grid.util.direct.*;
import java.nio.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java
index ce0b249..125c84c 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java
@@ -9,8 +9,8 @@
package org.apache.ignite.plugin.extensions.communication;
+import org.apache.ignite.internal.util.direct.*;
import org.apache.ignite.plugin.*;
-import org.gridgain.grid.util.direct.*;
import java.nio.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
index 892c0de..4b07a0e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
@@ -21,6 +21,7 @@ import org.apache.ignite.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.events.*;
import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.util.direct.*;
import org.apache.ignite.resources.*;
import org.apache.ignite.spi.authentication.*;
import org.apache.ignite.internal.managers.communication.*;
@@ -727,7 +728,7 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement
}
/** {@inheritDoc} */
- @Override public MessageFactory messageFactory() {
+ @Override public GridTcpMessageFactory messageFactory() {
return null;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java
index 822dae7..af4c54a 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java
@@ -20,11 +20,11 @@ package org.apache.ignite.spi;
import org.apache.ignite.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.events.*;
-import org.apache.ignite.plugin.extensions.communication.*;
-import org.apache.ignite.plugin.security.*;
-import org.apache.ignite.spi.swapspace.*;
import org.apache.ignite.internal.managers.communication.*;
import org.apache.ignite.internal.managers.eventstorage.*;
+import org.apache.ignite.internal.util.direct.*;
+import org.apache.ignite.plugin.security.*;
+import org.apache.ignite.spi.swapspace.*;
import org.jetbrains.annotations.*;
import java.io.*;
@@ -399,5 +399,5 @@ public interface IgniteSpiContext {
/**
* @return Message factory.
*/
- public MessageFactory messageFactory();
+ public GridTcpMessageFactory messageFactory();
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java
index 0de1ea3..85ce982 100644
--- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java
+++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationByteBufferStream.java
@@ -9,8 +9,8 @@
package org.gridgain.grid.util.direct;
-import org.apache.ignite.plugin.extensions.communication.*;
-import org.gridgain.grid.util.*;
+import org.apache.ignite.internal.util.*;
+import org.apache.ignite.internal.util.direct.*;
import org.jetbrains.annotations.*;
import sun.misc.*;
import sun.nio.ch.*;
@@ -193,7 +193,7 @@ public class GridTcpCommunicationByteBufferStream {
};
/** */
- private final MessageFactory msgFactory;
+ private final GridTcpMessageFactory msgFactory;
/** */
private ByteBuffer buf;
@@ -228,7 +228,7 @@ public class GridTcpCommunicationByteBufferStream {
/**
* @param msgFactory Message factory.
*/
- public GridTcpCommunicationByteBufferStream(@Nullable MessageFactory msgFactory) {
+ public GridTcpCommunicationByteBufferStream(@Nullable GridTcpMessageFactory msgFactory) {
this.msgFactory = msgFactory;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java
index 1645fb5..278beca 100644
--- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java
+++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageReader.java
@@ -9,6 +9,7 @@
package org.gridgain.grid.util.direct;
+import org.apache.ignite.internal.util.direct.*;
import org.apache.ignite.plugin.extensions.communication.*;
import org.jetbrains.annotations.*;
@@ -27,7 +28,7 @@ public class GridTcpCommunicationMessageReader implements MessageReader {
/**
* @param msgFactory Message factory.
*/
- public GridTcpCommunicationMessageReader(MessageFactory msgFactory) {
+ public GridTcpCommunicationMessageReader(GridTcpMessageFactory msgFactory) {
this.stream = new GridTcpCommunicationByteBufferStream(msgFactory);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageWriter.java b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageWriter.java
index 101015c..82ad4f8 100644
--- a/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageWriter.java
+++ b/modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageWriter.java
@@ -9,6 +9,7 @@
package org.gridgain.grid.util.direct;
+import org.apache.ignite.internal.util.direct.*;
import org.apache.ignite.plugin.extensions.communication.*;
import org.jetbrains.annotations.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7c93b5e9/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
index 6b5003f..4bba5eb 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
@@ -21,15 +21,14 @@ import org.apache.ignite.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.events.*;
import org.apache.ignite.internal.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.plugin.extensions.communication.*;
-import org.apache.ignite.plugin.security.*;
-import org.apache.ignite.spi.*;
-import org.apache.ignite.spi.swapspace.*;
import org.apache.ignite.internal.managers.communication.*;
import org.apache.ignite.internal.managers.eventstorage.*;
import org.apache.ignite.internal.util.direct.*;
import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.plugin.security.*;
+import org.apache.ignite.spi.*;
+import org.apache.ignite.spi.swapspace.*;
import org.jetbrains.annotations.*;
import java.io.*;
@@ -518,8 +517,8 @@ public class GridSpiTestContext implements IgniteSpiContext {
}
/** {@inheritDoc} */
- @Override public MessageFactory messageFactory() {
- return new MessageFactory() {
+ @Override public GridTcpMessageFactory messageFactory() {
+ return new GridTcpMessageFactory() {
@Override public GridTcpCommunicationMessageAdapter create(byte type) {
return GridTcpCommunicationMessageFactory.create(type);
}
[09/52] [abbrv] incubator-ignite git commit: # ignite-117 : fix
IpcSharedMemoryUtils.cpp (fix name of exceptions)
Posted by vk...@apache.org.
# ignite-117 : fix IpcSharedMemoryUtils.cpp (fix name of exceptions)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/96f56c78
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/96f56c78
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/96f56c78
Branch: refs/heads/ignite-61
Commit: 96f56c7801c920b47e76b752a903f023bab74b35
Parents: d01fa22
Author: Artem SHutak <as...@gridgain.com>
Authored: Thu Jan 29 15:49:45 2015 +0300
Committer: Artem SHutak <as...@gridgain.com>
Committed: Thu Jan 29 15:49:45 2015 +0300
----------------------------------------------------------------------
...rnal_util_ipc_shmem_IpcSharedMemoryUtils.cpp | 26 ++++++++++----------
1 file changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96f56c78/ipc/shmem/igniteshmem/org_apache_ignite_internal_util_ipc_shmem_IpcSharedMemoryUtils.cpp
----------------------------------------------------------------------
diff --git a/ipc/shmem/igniteshmem/org_apache_ignite_internal_util_ipc_shmem_IpcSharedMemoryUtils.cpp b/ipc/shmem/igniteshmem/org_apache_ignite_internal_util_ipc_shmem_IpcSharedMemoryUtils.cpp
index eaa13fd..923c6fb 100644
--- a/ipc/shmem/igniteshmem/org_apache_ignite_internal_util_ipc_shmem_IpcSharedMemoryUtils.cpp
+++ b/ipc/shmem/igniteshmem/org_apache_ignite_internal_util_ipc_shmem_IpcSharedMemoryUtils.cpp
@@ -36,13 +36,13 @@
using namespace std;
/** IgniteCheckedException JNI class name. */
-const char* GRID_EXCEPTION = "org/apache/ignite/IgniteCheckedException";
+const char* IGNITE_EXCEPTION = "org/apache/ignite/IgniteCheckedException";
-/** GridIpcSharedMemoryOperationTimedoutException JNI class name. */
-const char* OP_TIMEDOUT_EXCEPTION = "org/apache/ignite/internal/util/ipc/shmem/GridIpcSharedMemoryOperationTimedoutException";
+/** IpcSharedMemoryOperationTimedoutException JNI class name. */
+const char* OP_TIMEDOUT_EXCEPTION = "org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryOperationTimedoutException";
-/** GridIpcOutOfSystemResourcesException JNI class name. */
-const char* OUT_OF_RSRCS_EXCEPTION = "org/apache/ignite/internal/util/ipc/shmem/GridIpcOutOfSystemResourcesException";
+/** IpcOutOfSystemResourcesException JNI class name. */
+const char* OUT_OF_RSRCS_EXCEPTION = "org/apache/ignite/internal/util/ipc/shmem/IpcOutOfSystemResourcesException";
/** Global flag for enabling debug logging. */
static bool __GG_DEBUG = false;
@@ -220,7 +220,7 @@ static void throwExceptionByErrno(JNIEnv* env) {
break;
default:
- throwException(env, GRID_EXCEPTION);
+ throwException(env, IGNITE_EXCEPTION);
break;
}
}
@@ -244,7 +244,7 @@ static bool semInit(JNIEnv* env, int semId, int semNum) {
GG_LOG_DEBUG("Semaphore init failed [semId=%d, semNum=%s, errno=%d]", semId,
semNum == SEM_READ ? "SEM_READ" : "SEM_WRITE", errno);
- throwException(env, GRID_EXCEPTION);
+ throwException(env, IGNITE_EXCEPTION);
return false;
}
@@ -299,7 +299,7 @@ static void semWait(JNIEnv * env, int semId, int semNum, int timeout, T_IpcData
return;
}
else {
- throwException(env, GRID_EXCEPTION);
+ throwException(env, IGNITE_EXCEPTION);
}
}
}
@@ -329,7 +329,7 @@ static void semNotify(JNIEnv * env, int semId, int semNum, T_IpcData *ipcData) {
GG_LOG_DEBUG("Semaphore wait failed [semId=%d, semNum=%s, errno=%d]", semId,
semNum == SEM_READ ? "SEM_READ" : "SEM_WRITE", errno);
- throwException(env, GRID_EXCEPTION);
+ throwException(env, IGNITE_EXCEPTION);
}
}
@@ -361,7 +361,7 @@ jlong Java_org_apache_ignite_internal_util_ipc_shmem_IpcSharedMemoryUtils_alloca
// Get system token, used in IPC.
if ((key = ::ftok(tokFileName.c_str(), 'G')) == -1) {
- throwException(env, GRID_EXCEPTION);
+ throwException(env, IGNITE_EXCEPTION);
return 0;
}
@@ -405,7 +405,7 @@ jlong Java_org_apache_ignite_internal_util_ipc_shmem_IpcSharedMemoryUtils_alloca
// Initialize SEM_READ and SEM_WRITE to 1.
if (!semInit(env, semId, SEM_READ) || !semInit(env, semId, SEM_WRITE)) {
// Exception will be thrown on return.
- throwException(env, GRID_EXCEPTION);
+ throwException(env, IGNITE_EXCEPTION);
// Cleanup ignoring possible errors.
::semctl(semId, 0, IPC_RMID);
@@ -722,7 +722,7 @@ void Java_org_apache_ignite_internal_util_ipc_shmem_IpcSharedMemoryUtils_WriteSh
while (unreadCnt == ipcData->size) {
if (ipcData->closed) {
- env->ThrowNew(env->FindClass(GRID_EXCEPTION), "Shared memory segment has been closed.");
+ env->ThrowNew(env->FindClass(IGNITE_EXCEPTION), "Shared memory segment has been closed.");
return;
}
@@ -746,7 +746,7 @@ void Java_org_apache_ignite_internal_util_ipc_shmem_IpcSharedMemoryUtils_WriteSh
}
if (ipcData->closed) {
- env->ThrowNew(env->FindClass(GRID_EXCEPTION), "Shared memory segment has been closed");
+ env->ThrowNew(env->FindClass(IGNITE_EXCEPTION), "Shared memory segment has been closed");
return;
}
[39/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
index 0000000,e703dff..e095e1f
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
@@@ -1,0 -1,1127 +1,1115 @@@
+ /*
+ * 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.cache.distributed.dht.atomic;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.cache.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import javax.cache.expiry.*;
+ import javax.cache.processor.*;
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*;
+
+ /**
+ * Lite DHT cache update request sent from near node to primary node.
+ */
+ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K, V> implements GridCacheDeployable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Message index. */
+ public static final int CACHE_MSG_IDX = nextIndexId();
+
+ /** Target node ID. */
+ @GridDirectTransient
+ private UUID nodeId;
+
+ /** Future version. */
+ private GridCacheVersion futVer;
+
+ /** Fast map flag. */
+ private boolean fastMap;
+
+ /** Update version. Set to non-null if fastMap is {@code true}. */
+ private GridCacheVersion updateVer;
+
+ /** Topology version. */
+ private long topVer;
+
+ /** Write synchronization mode. */
+ private CacheWriteSynchronizationMode syncMode;
+
+ /** Update operation. */
+ private GridCacheOperation op;
+
+ /** Keys to update. */
+ @GridDirectTransient
+ @GridToStringInclude
+ private List<K> keys;
+
+ /** Key bytes. */
+ @GridDirectCollection(byte[].class)
+ private List<byte[]> keyBytes;
+
+ /** Values to update. */
+ @GridDirectTransient
+ private List<Object> vals;
+
+ /** Value bytes. */
+ @GridDirectCollection(GridCacheValueBytes.class)
+ private List<GridCacheValueBytes> valBytes;
+
+ /** Optional arguments for entry processor. */
+ @GridDirectTransient
+ private Object[] invokeArgs;
+
+ /** Entry processor arguments bytes. */
+ private byte[][] invokeArgsBytes;
+
+ /** DR versions. */
+ @GridDirectCollection(GridCacheVersion.class)
+ private List<GridCacheVersion> drVers;
+
+ /** DR TTLs. */
+ private GridLongList drTtls;
+
+ /** DR TTLs. */
+ private GridLongList drExpireTimes;
+
+ /** Return value flag. */
+ private boolean retval;
+
+ /** Expiry policy. */
+ @GridDirectTransient
+ private ExpiryPolicy expiryPlc;
+
+ /** Expiry policy bytes. */
+ private byte[] expiryPlcBytes;
+
+ /** Filter. */
+ @GridDirectTransient
+ private IgnitePredicate<CacheEntry<K, V>>[] filter;
+
+ /** Filter bytes. */
+ private byte[][] filterBytes;
+
+ /** Flag indicating whether request contains primary keys. */
+ private boolean hasPrimary;
+
+ /** Force transform backups flag. */
+ @GridDirectVersion(2)
+ private boolean forceTransformBackups;
+
+ /** Subject ID. */
+ @GridDirectVersion(3)
+ private UUID subjId;
+
+ /** Task name hash. */
+ @GridDirectVersion(4)
+ private int taskNameHash;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridNearAtomicUpdateRequest() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param cacheId Cache ID.
+ * @param nodeId Node ID.
+ * @param futVer Future version.
+ * @param fastMap Fast map scheme flag.
+ * @param updateVer Update version set if fast map is performed.
+ * @param topVer Topology version.
+ * @param syncMode Synchronization mode.
+ * @param op Cache update operation.
+ * @param retval Return value required flag.
+ * @param forceTransformBackups Force transform backups flag.
+ * @param expiryPlc Expiry policy.
+ * @param invokeArgs Optional arguments for entry processor.
+ * @param filter Optional filter for atomic check.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash code.
+ */
+ public GridNearAtomicUpdateRequest(
+ int cacheId,
+ UUID nodeId,
+ GridCacheVersion futVer,
+ boolean fastMap,
+ @Nullable GridCacheVersion updateVer,
+ long topVer,
+ CacheWriteSynchronizationMode syncMode,
+ GridCacheOperation op,
+ boolean retval,
+ boolean forceTransformBackups,
+ @Nullable ExpiryPolicy expiryPlc,
+ @Nullable Object[] invokeArgs,
+ @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter,
+ @Nullable UUID subjId,
+ int taskNameHash
+ ) {
+ this.cacheId = cacheId;
+ this.nodeId = nodeId;
+ this.futVer = futVer;
+ this.fastMap = fastMap;
+ this.updateVer = updateVer;
+
+ this.topVer = topVer;
+ this.syncMode = syncMode;
+ this.op = op;
+ this.retval = retval;
+ this.forceTransformBackups = forceTransformBackups;
+ this.expiryPlc = expiryPlc;
+ this.invokeArgs = invokeArgs;
+ this.filter = filter;
+ this.subjId = subjId;
+ this.taskNameHash = taskNameHash;
+
+ keys = new ArrayList<>();
+ vals = new ArrayList<>();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int lookupIndex() {
+ return CACHE_MSG_IDX;
+ }
+
+ /**
+ * @return Mapped node ID.
+ */
+ public UUID nodeId() {
+ return nodeId;
+ }
+
+ /**
+ * @param nodeId Node ID.
+ */
+ public void nodeId(UUID nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ /**
+ * @return Subject ID.
+ */
+ public UUID subjectId() {
+ return subjId;
+ }
+
+ /**
+ * @return Task name hash.
+ */
+ public int taskNameHash() {
+ return taskNameHash;
+ }
+
+ /**
+ * @return Future version.
+ */
+ public GridCacheVersion futureVersion() {
+ return futVer;
+ }
+
+ /**
+ * @return Flag indicating whether this is fast-map udpate.
+ */
+ public boolean fastMap() {
+ return fastMap;
+ }
+
+ /**
+ * @return Update version for fast-map request.
+ */
+ public GridCacheVersion updateVersion() {
+ return updateVer;
+ }
+
+ /**
+ * @return Topology version.
+ */
+ @Override public long topologyVersion() {
+ return topVer;
+ }
+
+ /**
+ * @return Cache write synchronization mode.
+ */
+ public CacheWriteSynchronizationMode writeSynchronizationMode() {
+ return syncMode;
+ }
+
+ /**
+ * @return Expiry policy.
+ */
+ public ExpiryPolicy expiry() {
+ return expiryPlc;
+ }
+
+ /**
+ * @return Return value flag.
+ */
+ public boolean returnValue() {
+ return retval;
+ }
+
+ /**
+ * @return Filter.
+ */
+ @Nullable public IgnitePredicate<CacheEntry<K, V>>[] filter() {
+ return filter;
+ }
+
+ /**
+ * @param key Key to add.
+ * @param val Optional update value.
+ * @param drTtl DR TTL (optional).
+ * @param drExpireTime DR expire time (optional).
+ * @param drVer DR version (optional).
+ * @param primary If given key is primary on this mapping.
+ */
+ public void addUpdateEntry(K key,
+ @Nullable Object val,
+ long drTtl,
+ long drExpireTime,
+ @Nullable GridCacheVersion drVer,
+ boolean primary) {
+ assert val != null || op == DELETE;
+ assert op != TRANSFORM || val instanceof EntryProcessor;
+
+ keys.add(key);
+ vals.add(val);
+
+ hasPrimary |= primary;
+
+ // In case there is no DR, do not create the list.
+ if (drVer != null) {
+ if (drVers == null) {
+ drVers = new ArrayList<>();
+
+ for (int i = 0; i < keys.size() - 1; i++)
+ drVers.add(null);
+ }
+
+ drVers.add(drVer);
+ }
+ else if (drVers != null)
+ drVers.add(drVer);
+
+ if (drTtl >= 0) {
+ if (drTtls == null) {
+ drTtls = new GridLongList(keys.size());
+
+ for (int i = 0; i < keys.size() - 1; i++)
+ drTtls.add(-1);
+ }
+
+ drTtls.add(drTtl);
+ }
+
+ if (drExpireTime >= 0) {
+ if (drExpireTimes == null) {
+ drExpireTimes = new GridLongList(keys.size());
+
+ for (int i = 0; i < keys.size() - 1; i++)
+ drExpireTimes.add(-1);
+ }
+
+ drExpireTimes.add(drExpireTime);
+ }
+ }
+
+ /**
+ * @return Keys for this update request.
+ */
+ public List<K> keys() {
+ return keys;
+ }
+
+ /**
+ * @return Values for this update request.
+ */
+ public List<Object> values() {
+ return vals;
+ }
+
+ /**
+ * @return Update operation.
+ */
+ public GridCacheOperation operation() {
+ return op;
+ }
+
+ /**
+ * @return Optional arguments for entry processor.
+ */
+ @Nullable public Object[] invokeArguments() {
+ return invokeArgs;
+ }
+
+ /**
+ * @param idx Key index.
+ * @return Value.
+ */
+ public V value(int idx) {
+ assert op == UPDATE : op;
+
+ return (V)vals.get(idx);
+ }
+
+ /**
+ * @param idx Key index.
+ * @return Entry processor.
+ */
+ public EntryProcessor<K, V, ?> entryProcessor(int idx) {
+ assert op == TRANSFORM : op;
+
+ return (EntryProcessor<K, V, ?>)vals.get(idx);
+ }
+
+ /**
+ * @param idx Index to get.
+ * @return Write value - either value, or transform closure.
+ */
+ public Object writeValue(int idx) {
+ if (vals != null) {
+ Object val = vals.get(idx);
+
+ if (val != null)
+ return val;
+ }
+
+ if (valBytes != null) {
+ GridCacheValueBytes valBytesTuple = valBytes.get(idx);
+
+ if (valBytesTuple != null && valBytesTuple.isPlain())
+ return valBytesTuple.get();
+ }
+
+ return null;
+ }
+
+ /**
+ * @param idx Key index.
+ * @return Value bytes.
+ */
+ public byte[] valueBytes(int idx) {
+ if (op != TRANSFORM && valBytes != null) {
+ GridCacheValueBytes valBytesTuple = valBytes.get(idx);
+
+ if (valBytesTuple != null && !valBytesTuple.isPlain())
+ return valBytesTuple.get();
+ }
+
+ return null;
+ }
+
+ /**
+ * @return DR versions.
+ */
+ @Nullable public List<GridCacheVersion> drVersions() {
+ return drVers;
+ }
+
+ /**
+ * @param idx Index.
+ * @return DR version.
+ */
+ @Nullable public GridCacheVersion drVersion(int idx) {
+ if (drVers != null) {
+ assert idx >= 0 && idx < drVers.size();
+
+ return drVers.get(idx);
+ }
+
+ return null;
+ }
+
+ /**
+ * @return DR TTLs.
+ */
+ @Nullable public GridLongList drTtls() {
+ return drTtls;
+ }
+
+ /**
+ * @param idx Index.
+ * @return DR TTL.
+ */
+ public long drTtl(int idx) {
+ if (drTtls != null) {
+ assert idx >= 0 && idx < drTtls.size();
+
+ return drTtls.get(idx);
+ }
+
+ return -1L;
+ }
+
+ /**
+ * @return DR TTLs.
+ */
+ @Nullable public GridLongList drExpireTimes() {
+ return drExpireTimes;
+ }
+
+ /**
+ * @param idx Index.
+ * @return DR TTL.
+ */
+ public long drExpireTime(int idx) {
+ if (drExpireTimes != null) {
+ assert idx >= 0 && idx < drExpireTimes.size();
+
+ return drExpireTimes.get(idx);
+ }
+
+ return -1L;
+ }
+
+ /**
+ * @return Flag indicating whether this request contains primary keys.
+ */
+ public boolean hasPrimary() {
+ return hasPrimary;
+ }
+
+ /**
+ * @return Force transform backups flag.
+ */
+ public boolean forceTransformBackups() {
+ return forceTransformBackups;
+ }
+
+ /**
+ * @param forceTransformBackups Force transform backups flag.
+ */
+ public void forceTransformBackups(boolean forceTransformBackups) {
+ this.forceTransformBackups = forceTransformBackups;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ keyBytes = marshalCollection(keys, ctx);
+ valBytes = marshalValuesCollection(vals, ctx);
+ filterBytes = marshalFilter(filter, ctx);
+ invokeArgsBytes = marshalInvokeArguments(invokeArgs, ctx);
+
+ if (expiryPlc != null)
+ expiryPlcBytes = CU.marshal(ctx, new IgniteExternalizableExpiryPolicy(expiryPlc));
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ keys = unmarshalCollection(keyBytes, ctx, ldr);
+ vals = unmarshalValueBytesCollection(valBytes, ctx, ldr);
+ filter = unmarshalFilter(filterBytes, ctx, ldr);
+ invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
+
+ if (expiryPlcBytes != null)
+ expiryPlc = ctx.marshaller().unmarshal(expiryPlcBytes, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridNearAtomicUpdateRequest _clone = new GridNearAtomicUpdateRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridNearAtomicUpdateRequest _clone = (GridNearAtomicUpdateRequest)_msg;
+
+ _clone.nodeId = nodeId;
+ _clone.futVer = futVer;
+ _clone.fastMap = fastMap;
+ _clone.updateVer = updateVer;
+ _clone.topVer = topVer;
+ _clone.syncMode = syncMode;
+ _clone.op = op;
+ _clone.keys = keys;
+ _clone.keyBytes = keyBytes;
+ _clone.vals = vals;
+ _clone.valBytes = valBytes;
+ _clone.invokeArgs = invokeArgs;
+ _clone.invokeArgsBytes = invokeArgsBytes;
+ _clone.drVers = drVers;
+ _clone.drTtls = drTtls;
+ _clone.drExpireTimes = drExpireTimes;
+ _clone.retval = retval;
+ _clone.expiryPlc = expiryPlc;
+ _clone.expiryPlcBytes = expiryPlcBytes;
+ _clone.filter = filter;
+ _clone.filterBytes = filterBytes;
+ _clone.hasPrimary = hasPrimary;
+ _clone.forceTransformBackups = forceTransformBackups;
+ _clone.subjId = subjId;
+ _clone.taskNameHash = taskNameHash;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
- if (!commState.putLongList(drExpireTimes))
++ if (!commState.putLongList("drExpireTimes", drExpireTimes))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putLongList(drTtls))
++ if (!commState.putLongList("drTtls", drTtls))
+ return false;
+
+ commState.idx++;
+
+ case 5:
+ if (drVers != null) {
+ if (commState.it == null) {
- if (!commState.putInt(drVers.size()))
++ if (!commState.putInt(null, drVers.size()))
+ return false;
+
+ commState.it = drVers.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putCacheVersion((GridCacheVersion)commState.cur))
++ if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 6:
- if (!commState.putByteArray(expiryPlcBytes))
++ if (!commState.putByteArray("expiryPlcBytes", expiryPlcBytes))
+ return false;
+
+ commState.idx++;
+
+ case 7:
- if (!commState.putBoolean(fastMap))
++ if (!commState.putBoolean("fastMap", fastMap))
+ return false;
+
+ commState.idx++;
+
+ case 8:
+ if (filterBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(filterBytes.length))
++ if (!commState.putInt(null, filterBytes.length))
+ return false;
+
+ commState.it = arrayIterator(filterBytes);
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 9:
- if (!commState.putCacheVersion(futVer))
++ if (!commState.putCacheVersion("futVer", futVer))
+ return false;
+
+ commState.idx++;
+
+ case 10:
- if (!commState.putBoolean(hasPrimary))
++ if (!commState.putBoolean("hasPrimary", hasPrimary))
+ return false;
+
+ commState.idx++;
+
+ case 11:
+ if (invokeArgsBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(invokeArgsBytes.length))
++ if (!commState.putInt(null, invokeArgsBytes.length))
+ return false;
+
+ commState.it = arrayIterator(invokeArgsBytes);
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 12:
+ if (keyBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(keyBytes.size()))
++ if (!commState.putInt(null, keyBytes.size()))
+ return false;
+
+ commState.it = keyBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 13:
- if (!commState.putEnum(op))
++ if (!commState.putEnum("op", op))
+ return false;
+
+ commState.idx++;
+
+ case 14:
- if (!commState.putBoolean(retval))
++ if (!commState.putBoolean("retval", retval))
+ return false;
+
+ commState.idx++;
+
+ case 15:
- if (!commState.putEnum(syncMode))
++ if (!commState.putEnum("syncMode", syncMode))
+ return false;
+
+ commState.idx++;
+
+ case 16:
- if (!commState.putLong(topVer))
++ if (!commState.putLong("topVer", topVer))
+ return false;
+
+ commState.idx++;
+
+ case 17:
- if (!commState.putCacheVersion(updateVer))
++ if (!commState.putCacheVersion("updateVer", updateVer))
+ return false;
+
+ commState.idx++;
+
+ case 18:
+ if (valBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(valBytes.size()))
++ if (!commState.putInt(null, valBytes.size()))
+ return false;
+
+ commState.it = valBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putValueBytes((GridCacheValueBytes)commState.cur))
++ if (!commState.putValueBytes(null, (GridCacheValueBytes)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 19:
- if (!commState.putBoolean(forceTransformBackups))
++ if (!commState.putBoolean("forceTransformBackups", forceTransformBackups))
+ return false;
+
+ commState.idx++;
+
+ case 20:
- if (!commState.putUuid(subjId))
++ if (!commState.putUuid("subjId", subjId))
+ return false;
+
+ commState.idx++;
+
+ case 21:
- if (!commState.putInt(taskNameHash))
++ if (!commState.putInt("taskNameHash", taskNameHash))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
- GridLongList drExpireTimes0 = commState.getLongList();
++ drExpireTimes = commState.getLongList("drExpireTimes");
+
- if (drExpireTimes0 == LONG_LIST_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- drExpireTimes = drExpireTimes0;
-
+ commState.idx++;
+
+ case 4:
- GridLongList drTtls0 = commState.getLongList();
++ drTtls = commState.getLongList("drTtls");
+
- if (drTtls0 == LONG_LIST_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- drTtls = drTtls0;
-
+ commState.idx++;
+
+ case 5:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (drVers == null)
+ drVers = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheVersion _val = commState.getCacheVersion();
++ GridCacheVersion _val = commState.getCacheVersion(null);
+
- if (_val == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ drVers.add((GridCacheVersion)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 6:
- byte[] expiryPlcBytes0 = commState.getByteArray();
++ byte[] expiryPlcBytes = commState.getByteArray("expiryPlcBytes");
+
- if (expiryPlcBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- expiryPlcBytes = expiryPlcBytes0;
-
+ commState.idx++;
+
+ case 7:
- if (buf.remaining() < 1)
- return false;
++ fastMap = commState.getBoolean("fastMap");
+
- fastMap = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 8:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (filterBytes == null)
+ filterBytes = new byte[commState.readSize][];
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ filterBytes[i] = (byte[])_val;
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 9:
- GridCacheVersion futVer0 = commState.getCacheVersion();
++ futVer = commState.getCacheVersion("futVer");
+
- if (futVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futVer = futVer0;
-
+ commState.idx++;
+
+ case 10:
- if (buf.remaining() < 1)
- return false;
++ hasPrimary = commState.getBoolean("hasPrimary");
+
- hasPrimary = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 11:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (invokeArgsBytes == null)
+ invokeArgsBytes = new byte[commState.readSize][];
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
+ byte[] _val = commState.getByteArray();
+
+ if (_val == BYTE_ARR_NOT_READ)
+ return false;
+
+ invokeArgsBytes[i] = (byte[])_val;
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 12:
+ if (commState.readSize == -1) {
+ if (buf.remaining() < 4)
+ return false;
+
+ commState.readSize = commState.getInt();
+ }
+
+ if (commState.readSize >= 0) {
+ if (keyBytes == null)
+ keyBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ keyBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 13:
- if (buf.remaining() < 1)
- return false;
++ byte op0 = commState.getByte("op");
+
- byte op0 = commState.getByte();
++ if (!commState.lastRead())
++ return false;
+
+ op = GridCacheOperation.fromOrdinal(op0);
+
+ commState.idx++;
+
+ case 14:
- if (buf.remaining() < 1)
- return false;
++ retval = commState.getBoolean("retval");
+
- retval = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 15:
- if (buf.remaining() < 1)
- return false;
++ byte syncMode0 = commState.getByte("syncMode");
+
- byte syncMode0 = commState.getByte();
++ if (!commState.lastRead())
++ return false;
+
+ syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncMode0);
+
+ commState.idx++;
+
+ case 16:
- if (buf.remaining() < 8)
- return false;
++ topVer = commState.getLong("topVer");
+
- topVer = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 17:
- GridCacheVersion updateVer0 = commState.getCacheVersion();
++ updateVer = commState.getCacheVersion("updateVer");
+
- if (updateVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- updateVer = updateVer0;
-
+ commState.idx++;
+
+ case 18:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (valBytes == null)
+ valBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheValueBytes _val = commState.getValueBytes();
++ GridCacheValueBytes _val = commState.getValueBytes(null);
+
- if (_val == VAL_BYTES_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ valBytes.add((GridCacheValueBytes)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 19:
- if (buf.remaining() < 1)
- return false;
++ forceTransformBackups = commState.getBoolean("forceTransformBackups");
+
- forceTransformBackups = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 20:
- UUID subjId0 = commState.getUuid();
++ subjId = commState.getUuid("subjId");
+
- if (subjId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- subjId = subjId0;
-
+ commState.idx++;
+
+ case 21:
- if (buf.remaining() < 4)
- return false;
++ taskNameHash = commState.getInt("taskNameHash");
+
- taskNameHash = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 39;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridNearAtomicUpdateRequest.class, this, "filter", Arrays.toString(filter),
+ "parent", super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
index 0000000,e88de2e..42ee3db
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
@@@ -1,0 -1,798 +1,782 @@@
+ /*
+ * 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.cache.distributed.dht.atomic;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+ import java.util.concurrent.*;
+
+ /**
+ * DHT atomic cache near update response.
+ */
+ public class GridNearAtomicUpdateResponse<K, V> extends GridCacheMessage<K, V> implements GridCacheDeployable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Cache message index. */
+ public static final int CACHE_MSG_IDX = nextIndexId();
+
+ /** Node ID this reply should be sent to. */
+ @GridDirectTransient
+ private UUID nodeId;
+
+ /** Future version. */
+ private GridCacheVersion futVer;
+
+ /** Update error. */
+ @GridDirectTransient
+ private volatile IgniteCheckedException err;
+
+ /** Serialized error. */
+ private byte[] errBytes;
+
+ /** Return value. */
+ @GridDirectTransient
+ private GridCacheReturn<Object> retVal;
+
+ /** Serialized return value. */
+ private byte[] retValBytes;
+
+ /** Failed keys. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private volatile Collection<K> failedKeys;
+
+ /** Serialized failed keys. */
+ private byte[] failedKeysBytes;
+
+ /** Keys that should be remapped. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<K> remapKeys;
+
+ /** Serialized keys that should be remapped. */
+ private byte[] remapKeysBytes;
+
+ /** Indexes of keys for which values were generated on primary node (used if originating node has near cache). */
+ @GridDirectCollection(int.class)
+ @GridDirectVersion(1)
+ private List<Integer> nearValsIdxs;
+
+ /** Indexes of keys for which update was skipped (used if originating node has near cache). */
+ @GridDirectCollection(int.class)
+ @GridDirectVersion(1)
+ private List<Integer> nearSkipIdxs;
+
+ /** Values generated on primary node which should be put to originating node's near cache. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private List<V> nearVals;
+
+ /** Serialized values generated on primary node which should be put to originating node's near cache. */
+ @GridToStringInclude
+ @GridDirectCollection(GridCacheValueBytes.class)
+ @GridDirectVersion(1)
+ private List<GridCacheValueBytes> nearValBytes;
+
+ /** Version generated on primary node to be used for originating node's near cache update. */
+ @GridDirectVersion(1)
+ private GridCacheVersion nearVer;
+
+ /** Near TTLs. */
+ private GridLongList nearTtls;
+
+ /** Near expire times. */
+ private GridLongList nearExpireTimes;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridNearAtomicUpdateResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param nodeId Node ID this reply should be sent to.
+ * @param futVer Future version.
+ */
+ public GridNearAtomicUpdateResponse(int cacheId, UUID nodeId, GridCacheVersion futVer) {
+ this.cacheId = cacheId;
+ this.nodeId = nodeId;
+ this.futVer = futVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int lookupIndex() {
+ return CACHE_MSG_IDX;
+ }
+
+ /**
+ * @return Node ID this response should be sent to.
+ */
+ public UUID nodeId() {
+ return nodeId;
+ }
+
+ /**
+ * @param nodeId Node ID.
+ */
+ public void nodeId(UUID nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ /**
+ * @return Future version.
+ */
+ public GridCacheVersion futureVersion() {
+ return futVer;
+ }
+
+ /**
+ * @return Update error, if any.
+ */
+ public Throwable error() {
+ return err;
+ }
+
+ /**
+ * @return Collection of failed keys.
+ */
+ public Collection<K> failedKeys() {
+ return failedKeys;
+ }
+
+ /**
+ * @return Return value.
+ */
+ public GridCacheReturn<Object> returnValue() {
+ return retVal;
+ }
+
+ /**
+ * @param retVal Return value.
+ */
+ public void returnValue(GridCacheReturn<Object> retVal) {
+ this.retVal = retVal;
+ }
+
+ /**
+ * @param remapKeys Remap keys.
+ */
+ public void remapKeys(Collection<K> remapKeys) {
+ this.remapKeys = remapKeys;
+ }
+
+ /**
+ * @return Remap keys.
+ */
+ public Collection<K> remapKeys() {
+ return remapKeys;
+ }
+
+ /**
+ * Adds value to be put in near cache on originating node.
+ *
+ * @param keyIdx Key index.
+ * @param val Value.
+ * @param valBytes Value bytes.
+ * @param ttl TTL for near cache update.
+ * @param expireTime Expire time for near cache update.
+ */
+ public void addNearValue(int keyIdx,
+ @Nullable V val,
+ @Nullable byte[] valBytes,
+ long ttl,
+ long expireTime) {
+ if (nearValsIdxs == null) {
+ nearValsIdxs = new ArrayList<>();
+ nearValBytes = new ArrayList<>();
+ nearVals = new ArrayList<>();
+ }
+
+ addNearTtl(keyIdx, ttl, expireTime);
+
+ nearValsIdxs.add(keyIdx);
+ nearVals.add(val);
+ nearValBytes.add(valBytes != null ? GridCacheValueBytes.marshaled(valBytes) : null);
+ }
+
+ /**
+ * @param keyIdx Key index.
+ * @param ttl TTL for near cache update.
+ * @param expireTime Expire time for near cache update.
+ */
+ @SuppressWarnings("ForLoopReplaceableByForEach")
+ public void addNearTtl(int keyIdx, long ttl, long expireTime) {
+ if (ttl >= 0) {
+ if (nearTtls == null) {
+ nearTtls = new GridLongList(16);
+
+ for (int i = 0; i < keyIdx; i++)
+ nearTtls.add(-1L);
+ }
+ }
+
+ if (nearTtls != null)
+ nearTtls.add(ttl);
+
+ if (expireTime >= 0) {
+ if (nearExpireTimes == null) {
+ nearExpireTimes = new GridLongList(16);
+
+ for (int i = 0; i < keyIdx; i++)
+ nearExpireTimes.add(-1);
+ }
+ }
+
+ if (nearExpireTimes != null)
+ nearExpireTimes.add(expireTime);
+ }
+
+ /**
+ * @param idx Index.
+ * @return Expire time for near cache update.
+ */
+ public long nearExpireTime(int idx) {
+ if (nearExpireTimes != null) {
+ assert idx >= 0 && idx < nearExpireTimes.size();
+
+ return nearExpireTimes.get(idx);
+ }
+
+ return -1L;
+ }
+
+ /**
+ * @param idx Index.
+ * @return TTL for near cache update.
+ */
+ public long nearTtl(int idx) {
+ if (nearTtls != null) {
+ assert idx >= 0 && idx < nearTtls.size();
+
+ return nearTtls.get(idx);
+ }
+
+ return -1L;
+ }
+
+ /**
+ * @param nearVer Version generated on primary node to be used for originating node's near cache update.
+ */
+ public void nearVersion(GridCacheVersion nearVer) {
+ this.nearVer = nearVer;
+ }
+
+ /**
+ * @return Version generated on primary node to be used for originating node's near cache update.
+ */
+ public GridCacheVersion nearVersion() {
+ return nearVer;
+ }
+
+ /**
+ * @param keyIdx Index of key for which update was skipped
+ */
+ public void addSkippedIndex(int keyIdx) {
+ if (nearSkipIdxs == null)
+ nearSkipIdxs = new ArrayList<>();
+
+ nearSkipIdxs.add(keyIdx);
+
+ addNearTtl(keyIdx, -1L, -1L);
+ }
+
+ /**
+ * @return Indexes of keys for which update was skipped
+ */
+ @Nullable public List<Integer> skippedIndexes() {
+ return nearSkipIdxs;
+ }
+
+ /**
+ * @return Indexes of keys for which values were generated on primary node.
+ */
+ @Nullable public List<Integer> nearValuesIndexes() {
+ return nearValsIdxs;
+ }
+
+ /**
+ * @param idx Index.
+ * @return Value generated on primary node which should be put to originating node's near cache.
+ */
+ @Nullable public V nearValue(int idx) {
+ return nearVals.get(idx);
+ }
+
+ /**
+ * @param idx Index.
+ * @return Serialized value generated on primary node which should be put to originating node's near cache.
+ */
+ @Nullable public byte[] nearValueBytes(int idx) {
+ if (nearValBytes != null) {
+ GridCacheValueBytes valBytes0 = nearValBytes.get(idx);
+
+ if (valBytes0 != null && !valBytes0.isPlain())
+ return valBytes0.get();
+ }
+
+ return null;
+ }
+
+ /**
+ * Adds key to collection of failed keys.
+ *
+ * @param key Key to add.
+ * @param e Error cause.
+ */
+ public synchronized void addFailedKey(K key, Throwable e) {
+ if (failedKeys == null)
+ failedKeys = new ConcurrentLinkedQueue<>();
+
+ failedKeys.add(key);
+
+ if (err == null)
+ err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+ err.addSuppressed(e);
+ }
+
+ /**
+ * Adds keys to collection of failed keys.
+ *
+ * @param keys Key to add.
+ * @param e Error cause.
+ */
+ public synchronized void addFailedKeys(Collection<K> keys, Throwable e) {
+ if (failedKeys == null)
+ failedKeys = new ArrayList<>(keys.size());
+
+ failedKeys.addAll(keys);
+
+ if (err == null)
+ err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+ err.addSuppressed(e);
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (err != null)
+ errBytes = ctx.marshaller().marshal(err);
+
+ if (retVal != null)
+ retValBytes = ctx.marshaller().marshal(retVal);
+
+ if (failedKeys != null)
+ failedKeysBytes = ctx.marshaller().marshal(failedKeys);
+
+ if (remapKeys != null)
+ remapKeysBytes = ctx.marshaller().marshal(remapKeys);
+
+ nearValBytes = marshalValuesCollection(nearVals, ctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (errBytes != null)
+ err = ctx.marshaller().unmarshal(errBytes, ldr);
+
+ if (retValBytes != null)
+ retVal = ctx.marshaller().unmarshal(retValBytes, ldr);
+
+ if (failedKeysBytes != null)
+ failedKeys = ctx.marshaller().unmarshal(failedKeysBytes, ldr);
+
+ if (remapKeysBytes != null)
+ remapKeys = ctx.marshaller().unmarshal(remapKeysBytes, ldr);
+
+ nearVals = unmarshalValueBytesCollection(nearValBytes, ctx, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridNearAtomicUpdateResponse _clone = new GridNearAtomicUpdateResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridNearAtomicUpdateResponse _clone = (GridNearAtomicUpdateResponse)_msg;
+
+ _clone.nodeId = nodeId;
+ _clone.futVer = futVer;
+ _clone.err = err;
+ _clone.errBytes = errBytes;
+ _clone.retVal = retVal;
+ _clone.retValBytes = retValBytes;
+ _clone.failedKeys = failedKeys;
+ _clone.failedKeysBytes = failedKeysBytes;
+ _clone.remapKeys = remapKeys;
+ _clone.remapKeysBytes = remapKeysBytes;
+ _clone.nearValsIdxs = nearValsIdxs;
+ _clone.nearSkipIdxs = nearSkipIdxs;
+ _clone.nearVals = nearVals;
+ _clone.nearValBytes = nearValBytes;
+ _clone.nearVer = nearVer;
+ _clone.nearTtls = nearTtls;
+ _clone.nearExpireTimes = nearExpireTimes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("fallthrough")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
- if (!commState.putByteArray(errBytes))
++ if (!commState.putByteArray("errBytes", errBytes))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putByteArray(failedKeysBytes))
++ if (!commState.putByteArray("failedKeysBytes", failedKeysBytes))
+ return false;
+
+ commState.idx++;
+
+ case 5:
- if (!commState.putCacheVersion(futVer))
++ if (!commState.putCacheVersion("futVer", futVer))
+ return false;
+
+ commState.idx++;
+
+ case 6:
- if (!commState.putByteArray(remapKeysBytes))
++ if (!commState.putByteArray("remapKeysBytes", remapKeysBytes))
+ return false;
+
+ commState.idx++;
+
+ case 7:
- if (!commState.putByteArray(retValBytes))
++ if (!commState.putByteArray("retValBytes", retValBytes))
+ return false;
+
+ commState.idx++;
+
+ case 8:
+ if (nearSkipIdxs != null) {
+ if (commState.it == null) {
- if (!commState.putInt(nearSkipIdxs.size()))
++ if (!commState.putInt(null, nearSkipIdxs.size()))
+ return false;
+
+ commState.it = nearSkipIdxs.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putInt((int)commState.cur))
++ if (!commState.putInt(null, (int)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 9:
+ if (nearValBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(nearValBytes.size()))
++ if (!commState.putInt(null, nearValBytes.size()))
+ return false;
+
+ commState.it = nearValBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putValueBytes((GridCacheValueBytes)commState.cur))
++ if (!commState.putValueBytes(null, (GridCacheValueBytes)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 10:
+ if (nearValsIdxs != null) {
+ if (commState.it == null) {
- if (!commState.putInt(nearValsIdxs.size()))
++ if (!commState.putInt(null, nearValsIdxs.size()))
+ return false;
+
+ commState.it = nearValsIdxs.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putInt((int)commState.cur))
++ if (!commState.putInt(null, (int)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 11:
- if (!commState.putCacheVersion(nearVer))
++ if (!commState.putCacheVersion("nearVer", nearVer))
+ return false;
+
+ commState.idx++;
+
+ case 12:
- if (!commState.putLongList(nearExpireTimes))
++ if (!commState.putLongList("nearExpireTimes", nearExpireTimes))
+ return false;
+
+ commState.idx++;
+
+ case 13:
- if (!commState.putLongList(nearTtls))
++ if (!commState.putLongList("nearTtls", nearTtls))
+ return false;
+
+ commState.idx++;
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("fallthrough")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
- byte[] errBytes0 = commState.getByteArray();
++ errBytes = commState.getByteArray("errBytes");
+
- if (errBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- errBytes = errBytes0;
-
+ commState.idx++;
+
+ case 4:
- byte[] failedKeysBytes0 = commState.getByteArray();
++ failedKeysBytes = commState.getByteArray("failedKeysBytes");
+
- if (failedKeysBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- failedKeysBytes = failedKeysBytes0;
-
+ commState.idx++;
+
+ case 5:
- GridCacheVersion futVer0 = commState.getCacheVersion();
++ futVer = commState.getCacheVersion("futVer");
+
- if (futVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futVer = futVer0;
-
+ commState.idx++;
+
+ case 6:
- byte[] remapKeysBytes0 = commState.getByteArray();
++ remapKeysBytes = commState.getByteArray("remapKeysBytes");
+
- if (remapKeysBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- remapKeysBytes = remapKeysBytes0;
-
+ commState.idx++;
+
+ case 7:
- byte[] retValBytes0 = commState.getByteArray();
++ retValBytes = commState.getByteArray("retValBytes");
+
- if (retValBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- retValBytes = retValBytes0;
-
+ commState.idx++;
+
+ case 8:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (nearSkipIdxs == null)
+ nearSkipIdxs = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- if (buf.remaining() < 4)
- return false;
++ int _val = commState.getInt(null);
+
- int _val = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ nearSkipIdxs.add((Integer)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 9:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (nearValBytes == null)
+ nearValBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheValueBytes _val = commState.getValueBytes();
++ GridCacheValueBytes _val = commState.getValueBytes(null);
+
- if (_val == VAL_BYTES_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ nearValBytes.add((GridCacheValueBytes)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 10:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (nearValsIdxs == null)
+ nearValsIdxs = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- if (buf.remaining() < 4)
- return false;
++ int _val = commState.getInt(null);
+
- int _val = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ nearValsIdxs.add((Integer)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 11:
- GridCacheVersion nearVer0 = commState.getCacheVersion();
++ nearVer = commState.getCacheVersion("nearVer");
+
- if (nearVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- nearVer = nearVer0;
-
+ commState.idx++;
+
+ case 12:
- GridLongList nearExpireTimes0 = commState.getLongList();
++ nearExpireTimes = commState.getLongList("nearExpireTimes");
+
- if (nearExpireTimes0 == LONG_LIST_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- nearExpireTimes = nearExpireTimes0;
-
+ commState.idx++;
+
+ case 13:
- GridLongList nearTtls0 = commState.getLongList();
++ nearTtls = commState.getLongList("nearTtls");
+
- if (nearTtls0 == LONG_LIST_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- nearTtls = nearTtls0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 40;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridNearAtomicUpdateResponse.class, this, "parent");
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java
index 0000000,e7fde44..1d94c2e
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java
@@@ -1,0 -1,333 +1,329 @@@
+ /*
+ * 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.cache.distributed.dht.preloader;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Force keys request. This message is sent by node while preloading to force
+ * another node to put given keys into the next batch of transmitting entries.
+ */
+ public class GridDhtForceKeysRequest<K, V> extends GridCacheMessage<K, V> implements GridCacheDeployable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /** Mini-future ID. */
+ private IgniteUuid miniId;
+
+ /** Serialized keys. */
+ @GridDirectCollection(byte[].class)
+ private Collection<byte[]> keyBytes;
+
+ /** Keys to request. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<K> keys;
+
+ /** Topology version for which keys are requested. */
+ private long topVer;
+
+ /**
+ * @param cacheId Cache ID.
+ * @param futId Future ID.
+ * @param miniId Mini-future ID.
+ * @param keys Keys.
+ * @param topVer Topology version.
+ */
+ GridDhtForceKeysRequest(
+ int cacheId,
+ IgniteUuid futId,
+ IgniteUuid miniId,
+ Collection<K> keys,
+ long topVer
+ ) {
+ assert futId != null;
+ assert miniId != null;
+ assert !F.isEmpty(keys);
+
+ this.cacheId = cacheId;
+ this.futId = futId;
+ this.miniId = miniId;
+ this.keys = keys;
+ this.topVer = topVer;
+ }
+
+ /**
+ * Required by {@link Externalizable}.
+ */
+ public GridDhtForceKeysRequest() {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean allowForStartup() {
+ return true;
+ }
+
+ /**
+ * @param keys Collection of keys.
+ */
+ public GridDhtForceKeysRequest(Collection<K> keys) {
+ assert !F.isEmpty(keys);
+
+ this.keys = keys;
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Mini-future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @return Collection of serialized keys.
+ */
+ public Collection<byte[]> keyBytes() {
+ return keyBytes;
+ }
+
+ /**
+ * @return Keys.
+ */
+ public Collection<K> keys() {
+ return keys;
+ }
+
+ /**
+ * @return Topology version for which keys are requested.
+ */
+ @Override public long topologyVersion() {
+ return topVer;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (keyBytes == null)
+ keyBytes = marshalCollection(keys, ctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (keys == null)
+ keys = unmarshalCollection(keyBytes, ctx, ldr);
+ }
+
+ /**
+ * @return Key count.
+ */
+ private int keyCount() {
+ return keyBytes == null ? keys.size() : keyBytes.size();
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtForceKeysRequest _clone = new GridDhtForceKeysRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtForceKeysRequest _clone = (GridDhtForceKeysRequest)_msg;
+
+ _clone.futId = futId;
+ _clone.miniId = miniId;
+ _clone.keyBytes = keyBytes;
+ _clone.keys = keys;
+ _clone.topVer = topVer;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 4:
+ if (keyBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(keyBytes.size()))
++ if (!commState.putInt(null, keyBytes.size()))
+ return false;
+
+ commState.it = keyBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 5:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 6:
- if (!commState.putLong(topVer))
++ if (!commState.putLong("topVer", topVer))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
- IgniteUuid futId0 = commState.getGridUuid();
++ futId = commState.getGridUuid("futId");
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ case 4:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (keyBytes == null)
+ keyBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ keyBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 5:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 6:
- if (buf.remaining() < 8)
- return false;
++ topVer = commState.getLong("topVer");
+
- topVer = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 41;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtForceKeysRequest.class, this, "keyCnt", keyCount(), "super", super.toString());
+ }
+ }
[17/52] [abbrv] incubator-ignite git commit: IGNITE-146 (remove async
instance caching inside Async support adapter and always create new instance)
Posted by vk...@apache.org.
IGNITE-146 (remove async instance caching inside Async support adapter and always create new instance)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/25fb8e5c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/25fb8e5c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/25fb8e5c
Branch: refs/heads/ignite-61
Commit: 25fb8e5ca42d8137c37ce513868bd246a5cc146a
Parents: fc768b8
Author: sevdokimov <se...@gridgain.com>
Authored: Thu Jan 29 13:05:20 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Thu Jan 29 17:22:35 2015 +0300
----------------------------------------------------------------------
.../ignite/lang/IgniteAsyncSupportAdapter.java | 27 +++-----------------
1 file changed, 4 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25fb8e5c/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupportAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupportAdapter.java b/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupportAdapter.java
index e9ab2a1..3d8e14c 100644
--- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupportAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/lang/IgniteAsyncSupportAdapter.java
@@ -24,15 +24,9 @@ import org.apache.ignite.internal.*;
* Adapter for {@link IgniteAsyncSupport}.
*/
public class IgniteAsyncSupportAdapter<T extends IgniteAsyncSupport> implements IgniteAsyncSupport {
- /** */
- private static final Object mux = new Object();
-
/** Future for previous asynchronous operation. */
protected ThreadLocal<IgniteInternalFuture<?>> curFut;
- /** */
- private volatile T asyncInstance;
-
/**
* Default constructor.
*/
@@ -44,29 +38,16 @@ public class IgniteAsyncSupportAdapter<T extends IgniteAsyncSupport> implements
* @param async Async enabled flag.
*/
public IgniteAsyncSupportAdapter(boolean async) {
- if (async) {
+ if (async)
curFut = new ThreadLocal<>();
-
- asyncInstance = (T)this;
- }
}
/** {@inheritDoc} */
@Override public T withAsync() {
- T res = asyncInstance;
-
- if (res == null) {
- res = createAsyncInstance();
-
- synchronized (mux) {
- if (asyncInstance != null)
- return asyncInstance;
-
- asyncInstance = res;
- }
- }
+ if (isAsync())
+ return (T)this;
- return res;
+ return createAsyncInstance();
}
/**
[16/52] [abbrv] incubator-ignite git commit: GridUtils -> IgniteUtils
Posted by vk...@apache.org.
GridUtils -> IgniteUtils
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/fc768b83
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/fc768b83
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/fc768b83
Branch: refs/heads/ignite-61
Commit: fc768b8318213841dec6d92d1fcd013a8052aaca
Parents: d6a720f
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jan 29 17:10:36 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jan 29 17:10:36 2015 +0300
----------------------------------------------------------------------
.../spi/checkpoint/s3/S3CheckpointSpi.java | 4 +-
.../ClientPropertiesConfigurationSelfTest.java | 4 +-
.../apache/ignite/IgniteCheckedException.java | 2 +-
.../java/org/apache/ignite/IgniteException.java | 2 +-
.../cache/GridCacheDeploymentManager.java | 2 +-
.../cache/GridCacheMvccCandidate.java | 4 +-
.../apache/ignite/internal/util/GridUtils.java | 9141 ------------------
.../ignite/internal/util/IgniteUtils.java | 9141 ++++++++++++++++++
.../internal/util/typedef/internal/U.java | 4 +-
.../visor/misc/VisorResolveHostNameTask.java | 2 +-
.../internal/visor/query/VisorQueryUtils.java | 4 +-
.../optimized/IgniteOptimizedMarshaller.java | 2 +-
.../IgniteExceptionHelpLinksSelfTest.java | 3 +-
.../GridEventStorageCheckAllEventsSelfTest.java | 2 +-
.../cache/GridCacheAbstractMetricsSelfTest.java | 10 +-
...artupWithSpecifiedWorkDirectorySelfTest.java | 2 +-
...tartupWithUndefinedGridGainHomeSelfTest.java | 4 +-
.../internal/util/GridTestClockTimer.java | 6 +-
.../ignite/internal/util/GridUtilsSelfTest.java | 728 --
.../internal/util/IgniteUtilsSelfTest.java | 728 ++
.../ignite/lang/GridSetWrapperSelfTest.java | 2 +-
.../testsuites/IgniteUtilSelfTestSuite.java | 2 +-
.../ignite/visor/commands/VisorConsole.scala | 6 +-
.../commands/alert/VisorAlertCommand.scala | 4 +-
.../config/VisorConfigurationCommand.scala | 6 +-
.../commands/deploy/VisorDeployCommand.scala | 4 +-
.../commands/disco/VisorDiscoveryCommand.scala | 4 +-
.../commands/events/VisorEventsCommand.scala | 4 +-
.../visor/commands/node/VisorNodeCommand.scala | 4 +-
.../commands/start/VisorStartCommand.scala | 4 +-
.../commands/tasks/VisorTasksCommand.scala | 4 +-
.../commands/top/VisorTopologyCommand.scala | 6 +-
.../visor/commands/vvm/VisorVvmCommand.scala | 8 +-
.../scala/org/apache/ignite/visor/visor.scala | 20 +-
34 files changed, 9935 insertions(+), 9938 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpi.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpi.java b/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpi.java
index 8bc0fb7..5a977a1 100644
--- a/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpi.java
+++ b/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpi.java
@@ -338,8 +338,8 @@ public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi,
/** {@inheritDoc} */
@Override public void spiStop() throws IgniteSpiException {
if (timeoutWrk != null) {
- GridUtils.interrupt(timeoutWrk);
- GridUtils.join(timeoutWrk, log);
+ IgniteUtils.interrupt(timeoutWrk);
+ IgniteUtils.join(timeoutWrk, log);
}
unregisterMBean();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/clients/src/test/java/org/apache/ignite/client/impl/ClientPropertiesConfigurationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/client/impl/ClientPropertiesConfigurationSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/client/impl/ClientPropertiesConfigurationSelfTest.java
index 31e8638..7b903fa 100644
--- a/modules/clients/src/test/java/org/apache/ignite/client/impl/ClientPropertiesConfigurationSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/client/impl/ClientPropertiesConfigurationSelfTest.java
@@ -158,7 +158,7 @@ public class ClientPropertiesConfigurationSelfTest extends GridCommonAbstractTes
while (it.hasNext())
lines.add(it.nextLine().replace("#gg.client.", "gg.client."));
- GridUtils.closeQuiet(in);
+ IgniteUtils.closeQuiet(in);
File tmp = File.createTempFile(UUID.randomUUID().toString(), "properties");
@@ -188,7 +188,7 @@ public class ClientPropertiesConfigurationSelfTest extends GridCommonAbstractTes
assertEquals(expLoaded, props.size());
- GridUtils.closeQuiet(in);
+ IgniteUtils.closeQuiet(in);
return props;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/main/java/org/apache/ignite/IgniteCheckedException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCheckedException.java b/modules/core/src/main/java/org/apache/ignite/IgniteCheckedException.java
index 8313c40..399b067 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCheckedException.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCheckedException.java
@@ -20,7 +20,7 @@ package org.apache.ignite;
import org.apache.ignite.internal.util.typedef.*;
import org.jetbrains.annotations.*;
-import static org.apache.ignite.internal.util.GridUtils.*;
+import static org.apache.ignite.internal.util.IgniteUtils.*;
/**
* General grid exception. This exception is used to indicate any error condition
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/main/java/org/apache/ignite/IgniteException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteException.java b/modules/core/src/main/java/org/apache/ignite/IgniteException.java
index b517dea..0f89743 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteException.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteException.java
@@ -20,7 +20,7 @@ package org.apache.ignite;
import org.apache.ignite.internal.util.typedef.*;
import org.jetbrains.annotations.*;
-import static org.apache.ignite.internal.util.GridUtils.*;
+import static org.apache.ignite.internal.util.IgniteUtils.*;
/**
* General grid exception. This exception is used to indicate any error condition
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
index d5ffb0d..c74d0b3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
@@ -485,7 +485,7 @@ public class GridCacheDeploymentManager<K, V> extends GridCacheSharedManagerAdap
allParticipants.put(nodeId, ldrVer);
if (added == null)
- added = GridUtils.newHashMap(participants.size());
+ added = IgniteUtils.newHashMap(participants.size());
added.put(nodeId, ldrVer);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
index d814430..43aa691 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
@@ -539,7 +539,7 @@ public class GridCacheMvccCandidate<K> implements Externalizable,
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
- GridUtils.writeUuid(out, nodeId);
+ IgniteUtils.writeUuid(out, nodeId);
CU.writeVersion(out, ver);
@@ -551,7 +551,7 @@ public class GridCacheMvccCandidate<K> implements Externalizable,
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- nodeId = GridUtils.readUuid(in);
+ nodeId = IgniteUtils.readUuid(in);
ver = CU.readVersion(in);
[10/52] [abbrv] incubator-ignite git commit: # ignite-117 : rebuild
igniteshmem.so
Posted by vk...@apache.org.
# ignite-117 : rebuild igniteshmem.so
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e73857f1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e73857f1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e73857f1
Branch: refs/heads/ignite-61
Commit: e73857f1604645fa7593d7a7f8d26f286a8c8ea5
Parents: 96f56c7
Author: Artem SHutak <as...@gridgain.com>
Authored: Thu Jan 29 16:07:44 2015 +0300
Committer: Artem SHutak <as...@gridgain.com>
Committed: Thu Jan 29 16:07:44 2015 +0300
----------------------------------------------------------------------
.../META-INF/native/linux64/libigniteshmem.so | Bin 138335 -> 138345 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e73857f1/modules/core/src/main/java/META-INF/native/linux64/libigniteshmem.so
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/META-INF/native/linux64/libigniteshmem.so b/modules/core/src/main/java/META-INF/native/linux64/libigniteshmem.so
index ff0f674..36de663 100755
Binary files a/modules/core/src/main/java/META-INF/native/linux64/libigniteshmem.so and b/modules/core/src/main/java/META-INF/native/linux64/libigniteshmem.so differ
[24/52] [abbrv] incubator-ignite git commit: # sprint-1 Fixed typo
after auto renaming.
Posted by vk...@apache.org.
# sprint-1 Fixed typo after auto renaming.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9502c0d9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9502c0d9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9502c0d9
Branch: refs/heads/ignite-61
Commit: 9502c0d9f747bc77d6e10f999d86e7f6dc5cb402
Parents: 580c36e
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Jan 29 22:35:26 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Jan 29 22:35:26 2015 +0700
----------------------------------------------------------------------
.../org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9502c0d9/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala
index ca22fa1..837b424 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala
@@ -17,7 +17,7 @@
package org.apache.ignite.visor.commands.alert
-import org.apache.ignite.internal.util.IgniteUtils
+import org.apache.ignite.internal.util.{IgniteUtils => U}
import org.apache.ignite.internal.util.lang.{GridFunc => F}
import org.apache.ignite._
[15/52] [abbrv] incubator-ignite git commit: GridUtils -> IgniteUtils
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/main/java/org/apache/ignite/internal/util/GridUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridUtils.java
deleted file mode 100644
index b3627fc..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridUtils.java
+++ /dev/null
@@ -1,9141 +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.util;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.events.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.mxbean.*;
-import org.apache.ignite.internal.processors.cache.*;
-import org.apache.ignite.internal.processors.cache.version.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.lifecycle.*;
-import org.apache.ignite.portables.*;
-import org.apache.ignite.spi.*;
-import org.apache.ignite.internal.managers.deployment.*;
-import org.apache.ignite.internal.processors.streamer.*;
-import org.apache.ignite.spi.discovery.*;
-import org.apache.ignite.internal.util.io.*;
-import org.apache.ignite.internal.util.lang.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.internal.util.worker.*;
-import org.jdk8.backport.*;
-import org.jetbrains.annotations.*;
-import sun.misc.*;
-
-import javax.management.*;
-import javax.naming.*;
-import javax.net.ssl.*;
-import java.io.*;
-import java.lang.annotation.Annotation;
-import java.lang.management.*;
-import java.lang.reflect.Array;
-import java.lang.reflect.*;
-import java.math.*;
-import java.net.*;
-import java.nio.*;
-import java.nio.channels.*;
-import java.nio.channels.spi.*;
-import java.nio.charset.*;
-import java.security.*;
-import java.security.cert.*;
-import java.sql.*;
-import java.sql.Timestamp;
-import java.text.*;
-import java.util.*;
-import java.util.Date;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-import java.util.concurrent.locks.*;
-import java.util.jar.*;
-import java.util.logging.*;
-import java.util.regex.*;
-import java.util.zip.*;
-
-import static org.apache.ignite.IgniteSystemProperties.*;
-import static org.apache.ignite.events.IgniteEventType.*;
-import static org.apache.ignite.internal.GridNodeAttributes.*;
-
-/**
- * Collection of utility methods used throughout the system.
- */
-@SuppressWarnings({"UnusedReturnValue", "UnnecessaryFullyQualifiedName"})
-public abstract class GridUtils {
- /** Unsafe. */
- private static final Unsafe UNSAFE = GridUnsafe.unsafe();
-
- /** {@code True} if {@code unsafe} should be used for array copy. */
- private static final boolean UNSAFE_BYTE_ARR_CP = unsafeByteArrayCopyAvailable();
-
- /** Offset. */
- private static final int BYTE_ARRAY_DATA_OFFSET = UNSAFE.arrayBaseOffset(byte[].class);
-
- /** Sun-specific JDK constructor factory for objects that don't have empty constructor. */
- private static final Method CTOR_FACTORY;
-
- /** Sun JDK reflection factory. */
- private static final Object SUN_REFLECT_FACTORY;
-
- /** Public {@code java.lang.Object} no-argument constructor. */
- private static final Constructor OBJECT_CTOR;
-
- /** All grid event names. */
- private static final Map<Integer, String> GRID_EVT_NAMES = new HashMap<>();
-
- /** All grid events. */
- private static final int[] GRID_EVTS;
-
- /** Empty integers array. */
- private static final int[] EMPTY_INTS = new int[0];
-
- /** Empty longs. */
- private static final long[] EMPTY_LONGS = new long[0];
-
- /** System line separator. */
- private static final String NL = System.getProperty("line.separator");
-
- /** Default user version. */
- public static final String DFLT_USER_VERSION = "0";
-
- /** Cache for {@link GridPeerDeployAware} fields to speed up reflection. */
- private static final ConcurrentMap<String, IgniteBiTuple<Class<?>, Collection<Field>>> p2pFields =
- new ConcurrentHashMap8<>();
-
- /** Secure socket protocol to use. */
- private static final String HTTPS_PROTOCOL = "TLS";
-
- /** Project home directory. */
- private static volatile GridTuple<String> ggHome;
-
- /** Project work directory. */
- private static volatile String ggWork;
-
- /** OS JDK string. */
- private static String osJdkStr;
-
- /** OS string. */
- private static String osStr;
-
- /** JDK string. */
- private static String jdkStr;
-
- /** Indicates whether current OS is Windows 95. */
- private static boolean win95;
-
- /** Indicates whether current OS is Windows 98. */
- private static boolean win98;
-
- /** Indicates whether current OS is Windows NT. */
- private static boolean winNt;
-
- /** Indicates whether current OS is Windows Vista. */
- private static boolean winVista;
-
- /** Indicates whether current OS is Windows 7. */
- private static boolean win7;
-
- /** Indicates whether current OS is Windows 8. */
- private static boolean win8;
-
- /** Indicates whether current OS is Windows 8.1. */
- private static boolean win81;
-
- /** Indicates whether current OS is some version of Windows. */
- private static boolean unknownWin;
-
- /** Indicates whether current OS is Windows 2000. */
- private static boolean win2k;
-
- /** Indicates whether current OS is Windows XP. */
- private static boolean winXp;
-
- /** Indicates whether current OS is Windows Server 2003. */
- private static boolean win2003;
-
- /** Indicates whether current OS is Windows Server 2008. */
- private static boolean win2008;
-
- /** Indicates whether current OS is UNIX flavor. */
- private static boolean unix;
-
- /** Indicates whether current OS is Solaris. */
- private static boolean solaris;
-
- /** Indicates whether current OS is Linux flavor. */
- private static boolean linux;
-
- /** Indicates whether current OS is NetWare. */
- private static boolean netware;
-
- /** Indicates whether current OS is Mac OS. */
- private static boolean mac;
-
- /** Indicates whether current OS architecture is Sun Sparc. */
- private static boolean sparc;
-
- /** Indicates whether current OS architecture is Intel X86. */
- private static boolean x86;
-
- /** Name of the underlying OS. */
- private static String osName;
-
- /** Version of the underlying OS. */
- private static String osVer;
-
- /** CPU architecture of the underlying OS. */
- private static String osArch;
-
- /** Name of the Java Runtime. */
- private static String javaRtName;
-
- /** Name of the Java Runtime version. */
- private static String javaRtVer;
-
- /** Name of the JDK vendor. */
- private static String jdkVendor;
-
- /** Name of the JDK. */
- private static String jdkName;
-
- /** Version of the JDK. */
- private static String jdkVer;
-
- /** Name of JVM specification. */
- private static String jvmSpecName;
-
- /** Version of JVM implementation. */
- private static String jvmImplVer;
-
- /** Vendor's name of JVM implementation. */
- private static String jvmImplVendor;
-
- /** Name of the JVM implementation. */
- private static String jvmImplName;
-
- /** JMX domain as 'xxx.gridgain'. */
- public static final String JMX_DOMAIN = GridUtils.class.getName().substring(0, GridUtils.class.getName().
- indexOf('.', GridUtils.class.getName().indexOf('.') + 1));
-
- /** Network packet header. */
- public static final byte[] GG_HEADER = U.intToBytes(0x00004747);
-
- /** Default buffer size = 4K. */
- private static final int BUF_SIZE = 4096;
-
- /** Byte bit-mask. */
- private static final int MASK = 0xf;
-
- /** Long date format pattern for log messages. */
- private static final SimpleDateFormat LONG_DATE_FMT = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
-
- /**
- * Short date format pattern for log messages in "quiet" mode.
- * Only time is included since we don't expect "quiet" mode to be used
- * for longer runs.
- */
- private static final SimpleDateFormat SHORT_DATE_FMT = new SimpleDateFormat("HH:mm:ss");
-
- /** Debug date format. */
- private static final SimpleDateFormat DEBUG_DATE_FMT = new SimpleDateFormat("HH:mm:ss,SSS");
-
- /** Cached local host address to make sure that every time the same local host is returned. */
- private static InetAddress locHost;
-
- /** */
- static volatile long curTimeMillis = System.currentTimeMillis();
-
- /** Primitive class map. */
- private static final Map<String, Class<?>> primitiveMap = new HashMap<>(16, .5f);
-
- /** Boxed class map. */
- private static final Map<Class<?>, Class<?>> boxedClsMap = new HashMap<>(16, .5f);
-
- /** Class loader used to load GridGain. */
- private static final ClassLoader gridClassLoader = GridUtils.class.getClassLoader();
-
- /** MAC OS invalid argument socket error message. */
- public static final String MAC_INVALID_ARG_MSG = "On MAC OS you may have too many file descriptors open " +
- "(simple restart usually solves the issue)";
-
- /** Default help pages. */
- public static final List<String> DFLT_HELP_LINKS = Arrays.asList(
- "Troubleshooting: http://bit.ly/GridGain-Troubleshooting",
- "Documentation Center: http://bit.ly/GridGain-Documentation");
-
- /** Portable classes. */
- private static final Collection<Class<?>> PORTABLE_CLS = new HashSet<>();
-
- /** GridGain Logging Directory. */
- public static final String GRIDGAIN_LOG_DIR = System.getenv(GG_LOG_DIR);
-
- /** GridGain Work Directory. */
- public static final String GRIDGAIN_WORK_DIR = System.getenv(GG_WORK_DIR);
-
- /** Clock timer. */
- private static Thread timer;
-
- /** Grid counter. */
- private static int gridCnt;
-
- /** Mutex. */
- private static final Object mux = new Object();
-
- /**
- * Initializes enterprise check.
- */
- static {
- String osName = System.getProperty("os.name");
-
- String osLow = osName.toLowerCase();
-
- // OS type detection.
- if (osLow.contains("win")) {
- if (osLow.contains("95"))
- win95 = true;
- else if (osLow.contains("98"))
- win98 = true;
- else if (osLow.contains("nt"))
- winNt = true;
- else if (osLow.contains("2000"))
- win2k = true;
- else if (osLow.contains("vista"))
- winVista = true;
- else if (osLow.contains("xp"))
- winXp = true;
- else if (osLow.contains("2003"))
- win2003 = true;
- else if (osLow.contains("2008"))
- win2008 = true;
- else if (osLow.contains("7"))
- win7 = true;
- else if (osLow.contains("8.1"))
- win81 = true;
- else if (osLow.contains("8"))
- win8 = true;
- else
- unknownWin = true;
- }
- else if (osLow.contains("netware"))
- netware = true;
- else if (osLow.contains("mac os"))
- mac = true;
- else {
- // UNIXs flavors tokens.
- for (CharSequence os : new String[]{"ix", "inux", "olaris", "un", "ux", "sco", "bsd", "att"})
- if (osLow.contains(os)) {
- unix = true;
-
- break;
- }
-
- // UNIX name detection.
- if (osLow.contains("olaris"))
- solaris = true;
- else if (osLow.contains("inux"))
- linux = true;
- }
-
- String osArch = System.getProperty("os.arch");
-
- String archStr = osArch.toLowerCase();
-
- // OS architecture detection.
- if (archStr.contains("x86"))
- x86 = true;
- else if (archStr.contains("sparc"))
- sparc = true;
-
- String javaRtName = System.getProperty("java.runtime.name");
- String javaRtVer = System.getProperty("java.runtime.version");
- String jdkVendor = System.getProperty("java.specification.vendor");
- String jdkName = System.getProperty("java.specification.name");
- String jdkVer = System.getProperty("java.specification.version");
- String osVer = System.getProperty("os.version");
- String jvmSpecName = System.getProperty("java.vm.specification.name");
- String jvmImplVer = System.getProperty("java.vm.version");
- String jvmImplVendor = System.getProperty("java.vm.vendor");
- String jvmImplName = System.getProperty("java.vm.name");
-
- String jdkStr = javaRtName + ' ' + javaRtVer + ' ' + jvmImplVendor + ' ' + jvmImplName + ' ' +
- jvmImplVer;
-
- osStr = osName + ' ' + osVer + ' ' + osArch;
- osJdkStr = osLow + ", " + jdkStr;
-
- // Copy auto variables to static ones.
- GridUtils.osName = osName;
- GridUtils.jdkName = jdkName;
- GridUtils.jdkVendor = jdkVendor;
- GridUtils.jdkVer = jdkVer;
- GridUtils.jdkStr = jdkStr;
- GridUtils.osVer = osVer;
- GridUtils.osArch = osArch;
- GridUtils.jvmSpecName = jvmSpecName;
- GridUtils.jvmImplVer = jvmImplVer;
- GridUtils.jvmImplVendor = jvmImplVendor;
- GridUtils.jvmImplName = jvmImplName;
- GridUtils.javaRtName = javaRtName;
- GridUtils.javaRtVer = javaRtVer;
-
- primitiveMap.put("byte", byte.class);
- primitiveMap.put("short", short.class);
- primitiveMap.put("int", int.class);
- primitiveMap.put("long", long.class);
- primitiveMap.put("float", float.class);
- primitiveMap.put("double", double.class);
- primitiveMap.put("char", char.class);
- primitiveMap.put("boolean", boolean.class);
-
- boxedClsMap.put(byte.class, Byte.class);
- boxedClsMap.put(short.class, Short.class);
- boxedClsMap.put(int.class, Integer.class);
- boxedClsMap.put(long.class, Long.class);
- boxedClsMap.put(float.class, Float.class);
- boxedClsMap.put(double.class, Double.class);
- boxedClsMap.put(char.class, Character.class);
- boxedClsMap.put(boolean.class, Boolean.class);
-
- try {
- OBJECT_CTOR = Object.class.getConstructor();
- }
- catch (NoSuchMethodException e) {
- throw withCause(new AssertionError("Object class does not have empty constructor (is JDK corrupted?)."), e);
- }
-
- // Constructor factory.
- Method ctorFac = null;
- Object refFac = null;
-
- try {
- Class<?> refFactoryCls = Class.forName("sun.reflect.ReflectionFactory");
-
- refFac = refFactoryCls.getMethod("getReflectionFactory").invoke(null);
-
- ctorFac = refFac.getClass().getMethod("newConstructorForSerialization", Class.class,
- Constructor.class);
- }
- catch (NoSuchMethodException | ClassNotFoundException | IllegalAccessException | InvocationTargetException ignored) {
- // No-op.
- }
-
- CTOR_FACTORY = ctorFac;
- SUN_REFLECT_FACTORY = refFac;
-
- // Disable hostname SSL verification for development and testing with self-signed certificates.
- if (Boolean.parseBoolean(System.getProperty(GG_DISABLE_HOSTNAME_VERIFIER))) {
- HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
- @Override public boolean verify(String hostname, SSLSession sslSes) {
- return true;
- }
- });
- }
-
- // Event names initialization.
- for (Field field : IgniteEventType.class.getFields()) {
- if (field.getType().equals(int.class)) {
- try {
- assert field.getName().startsWith("EVT_") : "Invalid event name (should start with 'EVT_': " +
- field.getName();
-
- int type = field.getInt(null);
-
- String prev = GRID_EVT_NAMES.put(type, field.getName().substring(4));
-
- // Check for duplicate event types.
- assert prev == null : "Duplicate event [type=" + type + ", name1=" + prev +
- ", name2=" + field.getName() + ']';
- }
- catch (IllegalAccessException e) {
- throw new IgniteException(e);
- }
- }
- }
-
- // Event array initialization.
- GRID_EVTS = toIntArray(GRID_EVT_NAMES.keySet());
-
- // Sort for fast event lookup.
- Arrays.sort(GRID_EVTS);
-
- // We need to re-initialize EVTS_ALL and EVTS_ALL_MINUS_METRIC_UPDATE
- // because they may have been initialized to null before GRID_EVTS were initialized.
- if (EVTS_ALL == null || EVTS_ALL_MINUS_METRIC_UPDATE == null) {
- try {
- Field f1 = IgniteEventType.class.getDeclaredField("EVTS_ALL");
- Field f2 = IgniteEventType.class.getDeclaredField("EVTS_ALL_MINUS_METRIC_UPDATE");
-
- assert f1 != null;
- assert f2 != null;
-
- // We use unsafe operations to update static fields on interface because
- // they are treated as static final and cannot be updated via standard reflection.
- UNSAFE.putObjectVolatile(UNSAFE.staticFieldBase(f1), UNSAFE.staticFieldOffset(f1), gridEvents());
- UNSAFE.putObjectVolatile(UNSAFE.staticFieldBase(f2), UNSAFE.staticFieldOffset(f2),
- gridEvents(EVT_NODE_METRICS_UPDATED));
-
- assert EVTS_ALL != null;
- assert EVTS_ALL.length == GRID_EVTS.length;
-
- assert EVTS_ALL_MINUS_METRIC_UPDATE != null;
- assert EVTS_ALL_MINUS_METRIC_UPDATE.length == GRID_EVTS.length - 1;
-
- // Validate correctness.
- for (int type : GRID_EVTS) {
- assert containsIntArray(EVTS_ALL, type);
-
- if (type != EVT_NODE_METRICS_UPDATED)
- assert containsIntArray(EVTS_ALL_MINUS_METRIC_UPDATE, type);
- }
-
- assert !containsIntArray(EVTS_ALL_MINUS_METRIC_UPDATE, EVT_NODE_METRICS_UPDATED);
- }
- catch (NoSuchFieldException e) {
- throw new IgniteException(e);
- }
- }
-
- PORTABLE_CLS.add(Byte.class);
- PORTABLE_CLS.add(Short.class);
- PORTABLE_CLS.add(Integer.class);
- PORTABLE_CLS.add(Long.class);
- PORTABLE_CLS.add(Float.class);
- PORTABLE_CLS.add(Double.class);
- PORTABLE_CLS.add(Character.class);
- PORTABLE_CLS.add(Boolean.class);
- PORTABLE_CLS.add(String.class);
- PORTABLE_CLS.add(UUID.class);
- PORTABLE_CLS.add(Date.class);
- PORTABLE_CLS.add(Timestamp.class);
- PORTABLE_CLS.add(byte[].class);
- PORTABLE_CLS.add(short[].class);
- PORTABLE_CLS.add(int[].class);
- PORTABLE_CLS.add(long[].class);
- PORTABLE_CLS.add(float[].class);
- PORTABLE_CLS.add(double[].class);
- PORTABLE_CLS.add(char[].class);
- PORTABLE_CLS.add(boolean[].class);
- PORTABLE_CLS.add(String[].class);
- PORTABLE_CLS.add(UUID[].class);
- PORTABLE_CLS.add(Date[].class);
- PORTABLE_CLS.add(Timestamp[].class);
- }
-
- /**
- * @return System time approximated by 10 ms.
- */
- public static long currentTimeMillis() {
- return curTimeMillis;
- }
-
- /**
- * @return Value of {@link System#nanoTime()} in microseconds.
- */
- public static long microTime() {
- return System.nanoTime() / 1000;
- }
-
- /**
- * Gets nearest power of 2 larger or equal than v.
- *
- * @param v Value.
- * @return Nearest power of 2.
- */
- public static int ceilPow2(int v) {
- v--;
-
- v |= v >> 1;
- v |= v >> 2;
- v |= v >> 4;
- v |= v >> 8;
- v |= v >> 16;
-
- return ++v;
- }
-
- /**
- * @param i Value.
- * @return {@code true} If the given value is power of 2 (0 is not power of 2).
- */
- public static boolean isPow2(int i) {
- return i > 0 && (i & (i - 1)) == 0;
- }
-
- /**
- * Return SUN specific constructor factory.
- *
- * @return SUN specific constructor factory.
- */
- @Nullable public static Method ctorFactory() {
- return CTOR_FACTORY;
- }
-
- /**
- * @return Empty constructor for object class.
- */
- public static Constructor objectConstructor() {
- return OBJECT_CTOR;
- }
-
- /**
- * SUN JDK specific reflection factory for objects without public constructor.
- *
- * @return Reflection factory for objects without public constructor.
- */
- @Nullable public static Object sunReflectionFactory() {
- return SUN_REFLECT_FACTORY;
- }
-
- /**
- * Gets name for given grid event type.
- *
- * @param type Event type.
- * @return Event name.
- */
- public static String gridEventName(int type) {
- String name = GRID_EVT_NAMES.get(type);
-
- return name != null ? name : Integer.toString(type);
- }
-
- /**
- * Gets all event types.
- *
- * @param excl Optional exclude events.
- * @return All events minus excluded ones.
- */
- public static int[] gridEvents(final int... excl) {
- if (F.isEmpty(excl))
- return GRID_EVTS;
-
- List<Integer> evts = toIntList(GRID_EVTS, new P1<Integer>() {
- @Override
- public boolean apply(Integer i) {
- return !containsIntArray(excl, i);
- }
- });
-
- return toIntArray(evts);
- }
-
- /**
- * @param discoSpi Discovery SPI.
- * @return {@code True} if ordering is supported.
- */
- public static boolean discoOrdered(DiscoverySpi discoSpi) {
- DiscoverySpiOrderSupport ann = U.getAnnotation(discoSpi.getClass(), DiscoverySpiOrderSupport.class);
-
- return ann != null && ann.value();
- }
-
- /**
- * @return Checks if disco ordering should be enforced.
- */
- public static boolean relaxDiscoveryOrdered() {
- return "true".equalsIgnoreCase(System.getProperty(GG_NO_DISCO_ORDER));
- }
-
- /**
- * This method should be used for adding quick debug statements in code
- * while debugging. Calls to this method should never be committed to master.
- *
- * @param msg Message to debug.
- * @deprecated Calls to this method should never be committed to master.
- */
- @Deprecated
- public static void debug(Object msg) {
- X.println(debugPrefix() + msg);
- }
-
- /**
- * This method should be used for adding quick debug statements in code
- * while debugging. Calls to this method should never be committed to master.
- *
- * @param msg Message to debug.
- * @deprecated Calls to this method should never be committed to master.
- */
- @Deprecated
- public static void debugx(String msg) {
- X.printerrln(debugPrefix() + msg);
- }
-
- /**
- * This method should be used for adding quick debug statements in code
- * while debugging. Calls to this method should never be committed to master.
- *
- * @param log Logger.
- * @param msg Message to debug.
- *
- * @deprecated Calls to this method should never be committed to master.
- */
- @Deprecated
- public static void debug(IgniteLogger log, String msg) {
- log.info(msg);
- }
-
- /**
- * Prints stack trace of the current thread to {@code System.out}.
- *
- * @deprecated Calls to this method should never be committed to master.
- */
- @SuppressWarnings("deprecation")
- @Deprecated
- public static void dumpStack() {
- dumpStack("Dumping stack.");
- }
-
- /**
- * Prints stack trace of the current thread to {@code System.out}.
- *
- * @param msg Message to print with the stack.
- *
- * @deprecated Calls to this method should never be committed to master.
- */
- @Deprecated
- public static void dumpStack(String msg) {
- new Exception(debugPrefix() + msg).printStackTrace(System.out);
- }
-
- /**
- * @param log Logger.
- * @param msg Message.
- */
- public static void dumpStack(@Nullable IgniteLogger log, String msg) {
- U.error(log, "Dumping stack.", new Exception(msg));
- }
-
- /**
- * Prints stack trace of the current thread to provided output stream.
- *
- * @param msg Message to print with the stack.
- * @param out Output to dump stack to.
- *
- * @deprecated Calls to this method should never be committed to master.
- */
- @Deprecated
- public static void dumpStack(String msg, PrintStream out) {
- new Exception(msg).printStackTrace(out);
- }
-
- /**
- * Prints stack trace of the current thread to provided logger.
- *
- * @param log Logger.
- * @param msg Message to print with the stack.
- *
- * @deprecated Calls to this method should never be committed to master.
- */
- @Deprecated
- public static void debugStack(IgniteLogger log, String msg) {
- log.error(msg, new Exception(debugPrefix() + msg));
- }
-
- /**
- * @return Common prefix for debug messages.
- */
- private static String debugPrefix() {
- return '<' + DEBUG_DATE_FMT.format(new Date(System.currentTimeMillis())) + "><DEBUG><" +
- Thread.currentThread().getName() + '>' + ' ';
- }
-
- /**
- * Prints heap usage.
- */
- public static void debugHeapUsage() {
- System.gc();
-
- Runtime runtime = Runtime.getRuntime();
-
- X.println('<' + DEBUG_DATE_FMT.format(new Date(System.currentTimeMillis())) + "><DEBUG><" +
- Thread.currentThread().getName() + "> Heap stats [free=" + runtime.freeMemory() / (1024 * 1024) +
- "M, total=" + runtime.totalMemory() / (1024 * 1024) + "M]");
- }
-
- /**
- * Gets heap size in GB rounded to specified precision.
- *
- * @param node Node.
- * @param precision Precision.
- * @return Heap size in GB.
- */
- public static double heapSize(ClusterNode node, int precision) {
- return heapSize(Collections.singleton(node), precision);
- }
-
- /**
- * Gets total heap size in GB rounded to specified precision.
- *
- * @param nodes Nodes.
- * @param precision Precision.
- * @return Total heap size in GB.
- */
- public static double heapSize(Iterable<ClusterNode> nodes, int precision) {
- // In bytes.
- double heap = 0.0;
-
- for (ClusterNode n : nodesPerJvm(nodes)) {
- ClusterMetrics m = n.metrics();
-
- heap += Math.max(m.getHeapMemoryInitialized(), m.getHeapMemoryMaximum());
- }
-
- return roundedHeapSize(heap, precision);
- }
-
- /**
- * Returns one representative node for each JVM.
- *
- * @param nodes Nodes.
- * @return Collection which contains only one representative node for each JVM.
- */
- private static Iterable<ClusterNode> nodesPerJvm(Iterable<ClusterNode> nodes) {
- Map<String, ClusterNode> grpMap = new HashMap<>();
-
- // Group by mac addresses and pid.
- for (ClusterNode node : nodes) {
- String grpId = node.attribute(ATTR_MACS) + "|" + node.attribute(ATTR_JVM_PID);
-
- if (!grpMap.containsKey(grpId))
- grpMap.put(grpId, node);
- }
-
- return grpMap.values();
- }
-
- /**
- * Returns current JVM maxMemory in the same format as {@link #heapSize(org.apache.ignite.cluster.ClusterNode, int)}.
- *
- * @param precision Precision.
- * @return Maximum memory size in GB.
- */
- public static double heapSize(int precision) {
- return roundedHeapSize(Runtime.getRuntime().maxMemory(), precision);
- }
-
- /**
- * Rounded heap size in gigabytes.
- *
- * @param heap Heap.
- * @param precision Precision.
- * @return Rounded heap size.
- */
- private static double roundedHeapSize(double heap, int precision) {
- double rounded = new BigDecimal(heap / (1024 * 1024 * 1024d)).round(new MathContext(precision)).doubleValue();
-
- return rounded < 0.1 ? 0.1 : rounded;
- }
-
- /**
- * Performs thread dump and prints all available info to the given log.
- *
- * @param log Logger.
- */
- public static void dumpThreads(@Nullable IgniteLogger log) {
- ThreadMXBean mxBean = ManagementFactory.getThreadMXBean();
-
- ThreadInfo[] threadInfos =
- mxBean.dumpAllThreads(mxBean.isObjectMonitorUsageSupported(), mxBean.isSynchronizerUsageSupported());
-
- GridStringBuilder sb = new GridStringBuilder("Thread dump at ")
- .a(new SimpleDateFormat("yyyy/MM/dd HH:mm:ss z").format(new Date(U.currentTimeMillis()))).a(NL);
-
- for (ThreadInfo info : threadInfos) {
- printThreadInfo(info, sb);
-
- sb.a(NL);
-
- if (info.getLockedSynchronizers() != null && info.getLockedSynchronizers().length > 0) {
- printSynchronizersInfo(info.getLockedSynchronizers(), sb);
-
- sb.a(NL);
- }
- }
-
- sb.a(NL);
-
- warn(log, sb.toString());
- }
-
- /**
- * Prints single thread info to a buffer.
- *
- * @param threadInfo Thread info.
- * @param sb Buffer.
- */
- private static void printThreadInfo(ThreadInfo threadInfo, GridStringBuilder sb) {
- sb.a("Thread [name=\"").a(threadInfo.getThreadName())
- .a("\", id=").a(threadInfo.getThreadId())
- .a(", state=").a(threadInfo.getThreadState())
- .a(", blockCnt=").a(threadInfo.getBlockedCount())
- .a(", waitCnt=").a(threadInfo.getWaitedCount()).a("]").a(NL);
-
- LockInfo lockInfo = threadInfo.getLockInfo();
-
- if (lockInfo != null) {
- sb.a(" Lock [object=").a(lockInfo)
- .a(", ownerName=").a(threadInfo.getLockOwnerName())
- .a(", ownerId=").a(threadInfo.getLockOwnerId()).a("]").a(NL);
- }
-
- MonitorInfo[] monitors = threadInfo.getLockedMonitors();
- StackTraceElement[] elements = threadInfo.getStackTrace();
-
- for (int i = 0; i < elements.length; i++) {
- StackTraceElement e = elements[i];
-
- sb.a(" at ").a(e.toString());
-
- for (MonitorInfo monitor : monitors) {
- if (monitor.getLockedStackDepth() == i)
- sb.a(NL).a(" - locked ").a(monitor);
- }
-
- sb.a(NL);
- }
- }
-
- /**
- * Prints Synchronizers info to a buffer.
- *
- * @param syncs Synchronizers info.
- * @param sb Buffer.
- */
- private static void printSynchronizersInfo(LockInfo[] syncs, GridStringBuilder sb) {
- sb.a(" Locked synchronizers:");
-
- for (LockInfo info : syncs)
- sb.a(NL).a(" ").a(info);
- }
-
- /**
- * Gets empty constructor for class even if the class does not have empty constructor
- * declared. This method is guaranteed to work with SUN JDK and other JDKs still need
- * to be tested.
- *
- * @param cls Class to get empty constructor for.
- * @return Empty constructor if one could be found or {@code null} otherwise.
- * @throws IgniteCheckedException If failed.
- */
- @Nullable public static Constructor<?> forceEmptyConstructor(Class<?> cls) throws IgniteCheckedException {
- Constructor<?> ctor = null;
-
- try {
- return cls.getDeclaredConstructor();
- }
- catch (Exception ignore) {
- Method ctorFac = U.ctorFactory();
- Object sunRefFac = U.sunReflectionFactory();
-
- if (ctorFac != null && sunRefFac != null)
- try {
- ctor = (Constructor)ctorFac.invoke(sunRefFac, cls, U.objectConstructor());
- }
- catch (IllegalAccessException | InvocationTargetException e) {
- throw new IgniteCheckedException("Failed to get object constructor for class: " + cls, e);
- }
- }
-
- return ctor;
- }
-
- /**
- * Creates new instance of a class only if it has an empty constructor (can be non-public).
- *
- * @param cls Class name.
- * @return Instance.
- * @throws IgniteCheckedException If failed.
- */
- @Nullable public static <T> T newInstance(String cls) throws IgniteCheckedException {
- Class<?> cls0;
-
- try {
- cls0 = Class.forName(cls);
- }
- catch (Exception e) {
- throw new IgniteCheckedException(e);
- }
-
- return (T)newInstance(cls0);
- }
-
- /**
- * Creates new instance of a class only if it has an empty constructor (can be non-public).
- *
- * @param cls Class to instantiate.
- * @return New instance of the class or {@code null} if empty constructor could not be assigned.
- * @throws IgniteCheckedException If failed.
- */
- @Nullable public static <T> T newInstance(Class<T> cls) throws IgniteCheckedException {
- boolean set = false;
-
- Constructor<T> ctor = null;
-
- try {
- ctor = cls.getDeclaredConstructor();
-
- if (ctor == null)
- return null;
-
- if (!ctor.isAccessible()) {
- ctor.setAccessible(true);
-
- set = true;
- }
-
- return ctor.newInstance();
- }
- catch (NoSuchMethodException e) {
- throw new IgniteCheckedException("Failed to find empty constructor for class: " + cls, e);
- }
- catch (InstantiationException | InvocationTargetException | IllegalAccessException e) {
- throw new IgniteCheckedException("Failed to create new instance for class: " + cls, e);
- } finally {
- if (ctor != null && set)
- ctor.setAccessible(false);
- }
- }
-
- /**
- * Creates new instance of a class even if it does not have public constructor.
- *
- * @param cls Class to instantiate.
- * @return New instance of the class or {@code null} if empty constructor could not be assigned.
- * @throws IgniteCheckedException If failed.
- */
- @SuppressWarnings({"unchecked"})
- @Nullable public static <T> T forceNewInstance(Class<?> cls) throws IgniteCheckedException {
- Constructor ctor = forceEmptyConstructor(cls);
-
- if (ctor == null)
- return null;
-
- boolean set = false;
-
- try {
-
- if (!ctor.isAccessible()) {
- ctor.setAccessible(true);
-
- set = true;
- }
-
- return (T)ctor.newInstance();
- }
- catch (InstantiationException | InvocationTargetException | IllegalAccessException e) {
- throw new IgniteCheckedException("Failed to create new instance for class: " + cls, e);
- } finally {
- if (set)
- ctor.setAccessible(false);
- }
- }
-
- /**
- * Pretty-formatting for minutes.
- *
- * @param mins Minutes to format.
- * @return Formatted presentation of minutes.
- */
- public static String formatMins(long mins) {
- assert mins >= 0;
-
- if (mins == 0)
- return "< 1 min";
-
- SB sb = new SB();
-
- long dd = mins / 1440; // 1440 mins = 60 mins * 24 hours
-
- if (dd > 0)
- sb.a(dd).a(dd == 1 ? " day " : " days ");
-
- mins %= 1440;
-
- long hh = mins / 60;
-
- if (hh > 0)
- sb.a(hh).a(hh == 1 ? " hour " : " hours ");
-
- mins %= 60;
-
- if (mins > 0)
- sb.a(mins).a(mins == 1 ? " min " : " mins ");
-
- return sb.toString().trim();
- }
-
- /**
- * Gets 8-character substring of UUID (for terse logging).
- *
- * @param id Input ID.
- * @return 8-character ID substring.
- */
- public static String id8(UUID id) {
- return id.toString().substring(0, 8);
- }
-
- /**
- * Gets 8-character substring of {@link org.apache.ignite.lang.IgniteUuid} (for terse logging).
- * The ID8 will be constructed as follows:
- * <ul>
- * <li>Take first 4 digits for global ID, i.e. {@code GridUuid.globalId()}.</li>
- * <li>Take last 4 digits for local ID, i.e. {@code GridUuid.localId()}.</li>
- * </ul>
- *
- * @param id Input ID.
- * @return 8-character representation of {@code GridUuid}.
- */
- public static String id8(IgniteUuid id) {
- String s = id.toString();
-
- return s.substring(0, 4) + s.substring(s.length() - 4);
- }
-
- /**
- *
- * @param len Number of characters to fill in.
- * @param ch Character to fill with.
- * @return String.
- */
- public static String filler(int len, char ch) {
- char[] a = new char[len];
-
- Arrays.fill(a, ch);
-
- return new String(a);
- }
-
- /**
- * Writes array to output stream.
- *
- * @param out Output stream.
- * @param arr Array to write.
- * @param <T> Array type.
- * @throws IOException If failed.
- */
- public static <T> void writeArray(ObjectOutput out, T[] arr) throws IOException {
- int len = arr == null ? 0 : arr.length;
-
- out.writeInt(len);
-
- if (arr != null && arr.length > 0)
- for (T t : arr)
- out.writeObject(t);
- }
-
- /**
- * Reads array from input stream.
- *
- * @param in Input stream.
- * @return Deserialized array.
- * @throws IOException If failed.
- * @throws ClassNotFoundException If class not found.
- */
- @Nullable public static Object[] readArray(ObjectInput in) throws IOException, ClassNotFoundException {
- int len = in.readInt();
-
- Object[] arr = null;
-
- if (len > 0) {
- arr = new Object[len];
-
- for (int i = 0; i < len; i++)
- arr[i] = in.readObject();
- }
-
- return arr;
- }
-
- /**
- * Reads array from input stream.
- *
- * @param in Input stream.
- * @return Deserialized array.
- * @throws IOException If failed.
- * @throws ClassNotFoundException If class not found.
- */
- @Nullable public static Class<?>[] readClassArray(ObjectInput in) throws IOException, ClassNotFoundException {
- int len = in.readInt();
-
- Class<?>[] arr = null;
-
- if (len > 0) {
- arr = new Class<?>[len];
-
- for (int i = 0; i < len; i++)
- arr[i] = (Class<?>)in.readObject();
- }
-
- return arr;
- }
-
- /**
- * Reads array from input stream.
- *
- * @param in Input stream.
- * @return Deserialized array.
- * @throws IOException If failed.
- * @throws ClassNotFoundException If class not found.
- */
- @SuppressWarnings("unchecked")
- @Nullable public static <K, V> IgnitePredicate<CacheEntry<K, V>>[] readEntryFilterArray(ObjectInput in)
- throws IOException, ClassNotFoundException {
- int len = in.readInt();
-
- IgnitePredicate<CacheEntry<K, V>>[] arr = null;
-
- if (len > 0) {
- arr = new IgnitePredicate[len];
-
- for (int i = 0; i < len; i++)
- arr[i] = (IgnitePredicate<CacheEntry<K, V>>)in.readObject();
- }
-
- return arr;
- }
-
- /**
- *
- * @param out Output.
- * @param col Set to write.
- * @throws IOException If write failed.
- */
- public static void writeCollection(ObjectOutput out, Collection<?> col) throws IOException {
- if (col != null) {
- out.writeInt(col.size());
-
- for (Object o : col)
- out.writeObject(o);
- }
- else
- out.writeInt(-1);
- }
-
- /**
- * Writes collection of byte arrays to data output.
- *
- * @param out Output to write to.
- * @param bytes Collection with byte arrays.
- * @throws IOException If write failed.
- */
- public static void writeBytesCollection(DataOutput out, Collection<byte[]> bytes) throws IOException {
- if (bytes != null) {
- out.writeInt(bytes.size());
-
- for (byte[] b : bytes)
- writeByteArray(out, b);
- }
- else
- out.writeInt(-1);
- }
-
- /**
- * Reads collection of byte arrays from data input.
- *
- * @param in Data input to read from.
- * @return List of byte arrays.
- * @throws IOException If read failed.
- */
- public static List<byte[]> readBytesList(DataInput in) throws IOException {
- int size = in.readInt();
-
- if (size < 0)
- return null;
-
- List<byte[]> res = new ArrayList<>(size);
-
- for (int i = 0; i < size; i++)
- res.add(readByteArray(in));
-
- return res;
- }
-
- /**
- *
- * @param out Output.
- * @param col Set to write.
- * @throws IOException If write failed.
- */
- public static void writeIntCollection(DataOutput out, Collection<Integer> col) throws IOException {
- if (col != null) {
- out.writeInt(col.size());
-
- for (Integer i : col)
- out.writeInt(i);
- }
- else
- out.writeInt(-1);
- }
-
- /**
- * @param in Input.
- * @return Deserialized set.
- * @throws IOException If deserialization failed.
- * @throws ClassNotFoundException If deserialized class could not be found.
- */
- @Nullable public static <E> Collection<E> readCollection(ObjectInput in)
- throws IOException, ClassNotFoundException {
- return readList(in);
- }
-
- /**
- * @param in Input.
- * @return Deserialized set.
- * @throws IOException If deserialization failed.
- */
- @Nullable public static Collection<Integer> readIntCollection(DataInput in) throws IOException {
- int size = in.readInt();
-
- // Check null flag.
- if (size == -1)
- return null;
-
- Collection<Integer> col = new ArrayList<>(size);
-
- for (int i = 0; i < size; i++)
- col.add(in.readInt());
-
- return col;
- }
-
- /**
- *
- * @param m Map to copy.
- * @param <K> Key type.
- * @param <V> Value type
- * @return Copied map.
- */
- public static <K, V> Map<K, V> copyMap(Map<K, V> m) {
- return new HashMap<>(m);
- }
-
- /**
- *
- * @param m Map to seal.
- * @param <K> Key type.
- * @param <V> Value type
- * @return Sealed map.
- */
- public static <K, V> Map<K, V> sealMap(Map<K, V> m) {
- assert m != null;
-
- return Collections.unmodifiableMap(new HashMap<>(m));
- }
-
- /**
- * Seal collection.
- *
- * @param c Collection to seal.
- * @param <E> Entry type
- * @return Sealed collection.
- */
- public static <E> List<E> sealList(Collection<E> c) {
- return Collections.unmodifiableList(new ArrayList<>(c));
- }
-
- /**
- * Convert array to seal list.
- *
- * @param a Array for convert to seal list.
- * @param <E> Entry type
- * @return Sealed collection.
- */
- public static <E> List<E> sealList(E... a) {
- return Collections.unmodifiableList(Arrays.asList(a));
- }
-
- /**
- * Gets display name of the network interface this IP address belongs to.
- *
- * @param addr IP address for which to find network interface name.
- * @return Network interface name or {@code null} if can't be found.
- */
- @Nullable public static String getNetworkInterfaceName(String addr) {
- assert addr != null;
-
- try {
- InetAddress inetAddr = InetAddress.getByName(addr);
-
- for (NetworkInterface itf : asIterable(NetworkInterface.getNetworkInterfaces()))
- for (InetAddress itfAddr : asIterable(itf.getInetAddresses()))
- if (itfAddr.equals(inetAddr))
- return itf.getDisplayName();
- }
- catch (UnknownHostException ignore) {
- return null;
- }
- catch (SocketException ignore) {
- return null;
- }
-
- return null;
- }
-
- /**
- * Tries to resolve host by name, returning local host if input is empty.
- * This method reflects how {@link org.apache.ignite.configuration.IgniteConfiguration#getLocalHost()} should
- * be handled in most places.
- *
- * @param hostName Hostname or {@code null} if local host should be returned.
- * @return Address of given host or of localhost.
- * @throws IOException If attempt to get local host failed.
- */
- public static InetAddress resolveLocalHost(@Nullable String hostName) throws IOException {
- return F.isEmpty(hostName) ?
- // Should default to InetAddress#anyLocalAddress which is package-private.
- new InetSocketAddress(0).getAddress() :
- InetAddress.getByName(hostName);
- }
-
- /**
- * Determines whether current local host is different from previously cached.
- *
- * @return {@code true} or {@code false} depending on whether or not local host
- * has changed from the cached value.
- * @throws IOException If attempt to get local host failed.
- */
- public static synchronized boolean isLocalHostChanged() throws IOException {
- InetAddress locHost0 = locHost;
-
- return locHost0 != null && !resetLocalHost().equals(locHost0);
- }
-
- /**
- * Returns host names consistent with {@link #resolveLocalHost(String)}. So when it returns
- * a common address this method returns single host name, and when a wildcard address passed
- * this method tries to collect addresses of all available interfaces.
- *
- * @param locAddr Local address to resolve.
- * @return Resolved available addresses of given local address.
- * @throws IOException If failed.
- * @throws IgniteCheckedException If no network interfaces found.
- */
- public static IgniteBiTuple<Collection<String>, Collection<String>> resolveLocalAddresses(InetAddress locAddr)
- throws IOException, IgniteCheckedException {
- assert locAddr != null;
-
- Collection<String> addrs = new ArrayList<>();
- Collection<String> hostNames = new ArrayList<>();
-
- if (locAddr.isAnyLocalAddress()) {
- // It should not take longer than 2 seconds to reach
- // local address on any network.
- int reachTimeout = 2000;
-
- for (NetworkInterface itf : asIterable(NetworkInterface.getNetworkInterfaces())) {
- for (InetAddress addr : asIterable(itf.getInetAddresses())) {
- if (!addr.isLinkLocalAddress() && reachable(itf, addr, reachTimeout))
- addresses(addr, addrs, hostNames);
- }
- }
-
- if (F.isEmpty(addrs))
- throw new IgniteCheckedException("No network addresses found (is networking enabled?).");
- }
- else
- addresses(locAddr, addrs, hostNames);
-
- return F.t(addrs, hostNames);
- }
-
- /**
- * @param addr Address.
- * @param addrs Addresses.
- * @param hostNames Host names.
- */
- private static void addresses(InetAddress addr, Collection<String> addrs, Collection<String> hostNames) {
- String hostName = addr.getHostName();
-
- String ipAddr = addr.getHostAddress();
-
- hostName = F.isEmpty(hostName) || hostName.equals(ipAddr) || addr.isLoopbackAddress() ? "" : hostName;
-
- addrs.add(ipAddr);
- hostNames.add(hostName);
- }
-
- /**
- * Gets local host. Implementation will first attempt to get a non-loopback
- * address. If that fails, then loopback address will be returned.
- * <p>
- * Note that this method is synchronized to make sure that local host
- * initialization happens only once.
- *
- * @return Address representing local host.
- * @throws IOException If attempt to get local host failed.
- */
- public static synchronized InetAddress getLocalHost() throws IOException {
- if (locHost == null)
- // Cache it.
- resetLocalHost();
-
- return locHost;
- }
-
- /**
- * @return Local host.
- * @throws IOException If attempt to get local host failed.
- */
- private static synchronized InetAddress resetLocalHost() throws IOException {
- locHost = null;
-
- String sysLocHost = IgniteSystemProperties.getString(GG_LOCAL_HOST);
-
- if (sysLocHost != null)
- sysLocHost = sysLocHost.trim();
-
- if (!F.isEmpty(sysLocHost))
- locHost = InetAddress.getByName(sysLocHost);
- else {
- List<NetworkInterface> itfs = new ArrayList<>();
-
- for (NetworkInterface itf : asIterable(NetworkInterface.getNetworkInterfaces()))
- itfs.add(itf);
-
- Collections.sort(itfs, new Comparator<NetworkInterface>() {
- @Override public int compare(NetworkInterface itf1, NetworkInterface itf2) {
- // Interfaces whose name starts with 'e' should go first.
- return itf1.getName().compareTo(itf2.getName());
- }
- });
-
- // It should not take longer than 2 seconds to reach
- // local address on any network.
- int reachTimeout = 2000;
-
- for (NetworkInterface itf : itfs) {
- boolean found = false;
-
- for (InetAddress addr : asIterable(itf.getInetAddresses())) {
- if (!addr.isLoopbackAddress() && !addr.isLinkLocalAddress() && reachable(itf, addr, reachTimeout)) {
- locHost = addr;
-
- found = true;
-
- break;
- }
- }
-
- if (found)
- break;
- }
- }
-
- if (locHost == null)
- locHost = InetAddress.getLocalHost();
-
- return locHost;
- }
-
- /**
- * Checks if address can be reached using three argument InetAddress.isReachable() version.
- *
- * @param itf Network interface to use for test.
- * @param addr Address to check.
- * @param reachTimeout Timeout for the check.
- * @return {@code True} if address is reachable.
- */
- public static boolean reachable(NetworkInterface itf, InetAddress addr, int reachTimeout) {
- try {
- return addr.isReachable(itf, 0, reachTimeout);
- }
- catch (IOException ignore) {
- return false;
- }
- }
-
- /**
- * Checks if address can be reached using one argument InetAddress.isReachable() version.
- *
- * @param addr Address to check.
- * @param reachTimeout Timeout for the check.
- * @return {@code True} if address is reachable.
- */
- public static boolean reachable(InetAddress addr, int reachTimeout) {
- try {
- return addr.isReachable(reachTimeout);
- }
- catch (IOException ignore) {
- return false;
- }
- }
-
- /**
- * @param loc Local node.
- * @param rmt Remote node.
- * @return Whether given nodes have the same macs.
- */
- public static boolean sameMacs(ClusterNode loc, ClusterNode rmt) {
- assert loc != null;
- assert rmt != null;
-
- String locMacs = loc.attribute(GridNodeAttributes.ATTR_MACS);
- String rmtMacs = rmt.attribute(GridNodeAttributes.ATTR_MACS);
-
- return locMacs != null && locMacs.equals(rmtMacs);
- }
-
- /**
- * Gets a list of all local non-loopback IPs known to this JVM.
- * Note that this will include both IPv4 and IPv6 addresses (even if one "resolves"
- * into another). Loopbacks will be skipped.
- *
- * @return List of all known local IPs (empty list if no addresses available).
- */
- public static synchronized Collection<String> allLocalIps() {
- List<String> ips = new ArrayList<>(4);
-
- try {
- Enumeration<NetworkInterface> itfs = NetworkInterface.getNetworkInterfaces();
-
- if (itfs != null) {
- for (NetworkInterface itf : asIterable(itfs)) {
- if (!itf.isLoopback()) {
- Enumeration<InetAddress> addrs = itf.getInetAddresses();
-
- if (addrs != null) {
- for (InetAddress addr : asIterable(addrs)) {
- String hostAddr = addr.getHostAddress();
-
- if (!addr.isLoopbackAddress() && !ips.contains(hostAddr))
- ips.add(hostAddr);
- }
- }
- }
- }
- }
- }
- catch (SocketException ignore) {
- return Collections.emptyList();
- }
-
- Collections.sort(ips);
-
- return ips;
- }
-
- /**
- * Gets a list of all local enabled MACs known to this JVM. It
- * is using hardware address of the network interface that is not guaranteed to be
- * MAC addresses (but in most cases it is).
- * <p>
- * Note that if network interface is disabled - its MAC won't be included. All
- * local network interfaces are probed including loopbacks. Virtual interfaces
- * (sub-interfaces) are skipped.
- * <p>
- * Note that on linux getHardwareAddress() can return null from time to time
- * if NetworkInterface.getHardwareAddress() method is called from many threads.
- *
- * @return List of all known enabled local MACs or empty list
- * if no MACs could be found.
- */
- public static synchronized Collection<String> allLocalMACs() {
- List<String> macs = new ArrayList<>(3);
-
- try {
- Enumeration<NetworkInterface> itfs = NetworkInterface.getNetworkInterfaces();
-
- if (itfs != null) {
- for (NetworkInterface itf : asIterable(itfs)) {
- byte[] hwAddr = itf.getHardwareAddress();
-
- // Loopback produces empty MAC.
- if (hwAddr != null && hwAddr.length > 0) {
- String mac = byteArray2HexString(hwAddr);
-
- if (!macs.contains(mac))
- macs.add(mac);
- }
- }
- }
- }
- catch (SocketException ignore) {
- return Collections.emptyList();
- }
-
- Collections.sort(macs);
-
- return macs;
- }
-
- /**
- * Downloads resource by URL.
- *
- * @param url URL to download.
- * @param file File where downloaded resource should be stored.
- * @return File where downloaded resource should be stored.
- * @throws IOException If error occurred.
- */
- public static File downloadUrl(URL url, File file) throws IOException {
- assert url != null;
- assert file != null;
-
- InputStream in = null;
- OutputStream out = null;
-
- try {
- URLConnection conn = url.openConnection();
-
- if (conn instanceof HttpsURLConnection) {
- HttpsURLConnection https = (HttpsURLConnection)conn;
-
- https.setHostnameVerifier(new DeploymentHostnameVerifier());
-
- SSLContext ctx = SSLContext.getInstance(HTTPS_PROTOCOL);
-
- ctx.init(null, getTrustManagers(), null);
-
- // Initialize socket factory.
- https.setSSLSocketFactory(ctx.getSocketFactory());
- }
-
- in = conn.getInputStream();
-
- if (in == null)
- throw new IOException("Failed to open connection: " + url.toString());
-
- out = new BufferedOutputStream(new FileOutputStream(file));
-
- copy(in, out);
- }
- catch (NoSuchAlgorithmException | KeyManagementException e) {
- throw new IOException("Failed to open HTTPs connection [url=" + url.toString() + ", msg=" + e + ']', e);
- } finally {
- close(in, null);
- close(out, null);
- }
-
- return file;
- }
-
- /**
- * Construct array with one trust manager which don't reject input certificates.
- *
- * @return Array with one X509TrustManager implementation of trust manager.
- */
- private static TrustManager[] getTrustManagers() {
- return new TrustManager[]{
- new X509TrustManager() {
- @Nullable @Override public X509Certificate[] getAcceptedIssuers() {
- return null;
- }
-
- @Override public void checkClientTrusted(X509Certificate[] certs, String authType) {
- /* No-op. */
- }
-
- @Override public void checkServerTrusted(X509Certificate[] certs, String authType) {
- /* No-op. */
- }
- }
- };
- }
-
- /**
- * Replace password in URI string with a single '*' character.
- * <p>
- * Parses given URI by applying ".*://(.*:.*)@.*"
- * regular expression pattern and than if URI matches it
- * replaces password strings between '/' and '@' with '*'.
- *
- * @param uri URI which password should be replaced.
- * @return Converted URI string
- */
- @Nullable public static String hidePassword(@Nullable String uri) {
- if (uri == null)
- return null;
-
- if (Pattern.matches(".*://(.*:.*)@.*", uri)) {
- int userInfoLastIdx = uri.indexOf('@');
-
- assert userInfoLastIdx != -1;
-
- String str = uri.substring(0, userInfoLastIdx);
-
- int userInfoStartIdx = str.lastIndexOf('/');
-
- str = str.substring(userInfoStartIdx + 1);
-
- String[] params = str.split(";");
-
- StringBuilder builder = new StringBuilder();
-
- for (int i = 0; i < params.length; i++) {
- int idx;
-
- if ((idx = params[i].indexOf(':')) != -1)
- params[i] = params[i].substring(0, idx + 1) + '*';
-
- builder.append(params[i]);
-
- if (i != params.length - 1)
- builder.append(';');
- }
-
- return new StringBuilder(uri).replace(userInfoStartIdx + 1, userInfoLastIdx,
- builder.toString()).toString();
- }
-
- return uri;
- }
-
- /**
- * @return Class loader used to load GridGain itself.
- */
- public static ClassLoader gridClassLoader() {
- return gridClassLoader;
- }
-
- /**
- * @param parent Parent to find.
- * @param ldr Loader to check.
- * @return {@code True} if parent found.
- */
- public static boolean hasParent(@Nullable ClassLoader parent, ClassLoader ldr) {
- if (parent != null) {
- for (; ldr != null; ldr = ldr.getParent()) {
- if (ldr.equals(parent))
- return true;
- }
-
- return false;
- }
-
- return true;
- }
-
- /**
- * Verifier always returns successful result for any host.
- */
- private static class DeploymentHostnameVerifier implements HostnameVerifier {
- /** {@inheritDoc} */
- @Override public boolean verify(String hostname, SSLSession ses) {
- // Remote host trusted by default.
- return true;
- }
- }
-
- /**
- * Makes a {@code '+---+'} dash line.
- *
- * @param len Length of the dash line to make.
- * @return Dash line.
- */
- public static String dash(int len) {
- char[] dash = new char[len];
-
- Arrays.fill(dash, '-');
-
- dash[0] = dash[len - 1] = '+';
-
- return new String(dash);
- }
-
- /**
- * Creates space filled string of given length.
- *
- * @param len Number of spaces.
- * @return Space filled string of given length.
- */
- public static String pad(int len) {
- char[] dash = new char[len];
-
- Arrays.fill(dash, ' ');
-
- return new String(dash);
- }
-
- /**
- * Formats system time in milliseconds for printing in logs.
- *
- * @param sysTime System time.
- * @return Formatted time string.
- */
- public static String format(long sysTime) {
- return LONG_DATE_FMT.format(new java.util.Date(sysTime));
- }
-
- /**
- * Takes given collection, shuffles it and returns iterable instance.
- *
- * @param <T> Type of elements to create iterator for.
- * @param col Collection to shuffle.
- * @return Iterable instance over randomly shuffled collection.
- */
- public static <T> Iterable<T> randomIterable(Collection<T> col) {
- List<T> list = new ArrayList<>(col);
-
- Collections.shuffle(list);
-
- return list;
- }
-
- /**
- * Converts enumeration to iterable so it can be used in {@code foreach} construct.
- *
- * @param <T> Types of instances for iteration.
- * @param e Enumeration to convert.
- * @return Iterable over the given enumeration.
- */
- public static <T> Iterable<T> asIterable(final Enumeration<T> e) {
- return new Iterable<T>() {
- @Override public Iterator<T> iterator() {
- return new Iterator<T>() {
- @Override public boolean hasNext() {
- return e.hasMoreElements();
- }
-
- @SuppressWarnings({"IteratorNextCanNotThrowNoSuchElementException"})
- @Override public T next() {
- return e.nextElement();
- }
-
- @Override public void remove() {
- throw new UnsupportedOperationException();
- }
- };
- }
- };
- }
-
- /**
- * Copy source file (or folder) to destination file (or folder). Supported source & destination:
- * <ul>
- * <li>File to File</li>
- * <li>File to Folder</li>
- * <li>Folder to Folder (Copy the content of the directory and not the directory itself)</li>
- * </ul>
- *
- * @param src Source file or folder.
- * @param dest Destination file or folder.
- * @param overwrite Whether or not overwrite existing files and folders.
- * @throws IOException Thrown if an I/O error occurs.
- */
- public static void copy(File src, File dest, boolean overwrite) throws IOException {
- assert src != null;
- assert dest != null;
-
- /*
- * Supported source & destination:
- * ===============================
- * 1. File -> File
- * 2. File -> Directory
- * 3. Directory -> Directory
- */
-
- // Source must exist.
- if (!src.exists())
- throw new FileNotFoundException("Source can't be found: " + src);
-
- // Check that source and destination are not the same.
- if (src.getAbsoluteFile().equals(dest.getAbsoluteFile()))
- throw new IOException("Source and destination are the same [src=" + src + ", dest=" + dest + ']');
-
- if (dest.exists()) {
- if (!dest.isDirectory() && !overwrite)
- throw new IOException("Destination already exists: " + dest);
-
- if (!dest.canWrite())
- throw new IOException("Destination is not writable:" + dest);
- }
- else {
- File parent = dest.getParentFile();
-
- if (parent != null && !parent.exists())
- // Ignore any errors here.
- // We will get errors when we'll try to open the file stream.
- //noinspection ResultOfMethodCallIgnored
- parent.mkdirs();
-
- // If source is a directory, we should create destination directory.
- if (src.isDirectory())
- //noinspection ResultOfMethodCallIgnored
- dest.mkdir();
- }
-
- if (src.isDirectory()) {
- // In this case we have Directory -> Directory.
- // Note that we copy the content of the directory and not the directory itself.
-
- File[] files = src.listFiles();
-
- for (File file : files) {
- if (file.isDirectory()) {
- File dir = new File(dest, file.getName());
-
- if (!dir.exists() && !dir.mkdirs())
- throw new IOException("Can't create directory: " + dir);
-
- copy(file, dir, overwrite);
- }
- else
- copy(file, dest, overwrite);
- }
- }
- else {
- // In this case we have File -> File or File -> Directory.
- File file = dest.exists() && dest.isDirectory() ? new File(dest, src.getName()) : dest;
-
- if (!overwrite && file.exists())
- throw new IOException("Destination already exists: " + file);
-
- FileInputStream in = null;
- FileOutputStream out = null;
-
- try {
- in = new FileInputStream(src);
- out = new FileOutputStream(file);
-
- copy(in, out);
- }
- finally {
- if (in != null)
- in.close();
-
- if (out != null) {
- out.getFD().sync();
-
- out.close();
- }
- }
- }
- }
-
- /**
- * Starts clock timer if grid is first.
- */
- public static void onGridStart() {
- synchronized (mux) {
- if (gridCnt == 0) {
- timer = new Thread(new Runnable() {
- @SuppressWarnings({"BusyWait", "InfiniteLoopStatement"})
- @Override public void run() {
- while (true) {
- curTimeMillis = System.currentTimeMillis();
-
- try {
- Thread.sleep(10);
- }
- catch (InterruptedException ignored) {
- U.log(null, "Timer thread has been interrupted.");
-
- break;
- }
- }
- }
- }, "gridgain-clock");
-
- timer.setDaemon(true);
-
- timer.setPriority(10);
-
- timer.start();
- }
-
- ++gridCnt;
- }
- }
-
- /**
- * Stops clock timer if all nodes into JVM were stopped.
- */
- public static void onGridStop(){
- synchronized (mux) {
- assert gridCnt > 0 : gridCnt;
-
- --gridCnt;
-
- if (gridCnt == 0 && timer != null) {
- timer.interrupt();
-
- timer = null;
- }
- }
- }
-
- /**
- * Copies input byte stream to output byte stream.
- *
- * @param in Input byte stream.
- * @param out Output byte stream.
- * @return Number of the copied bytes.
- * @throws IOException Thrown if an I/O error occurs.
- */
- public static int copy(InputStream in, OutputStream out) throws IOException {
- assert in != null;
- assert out != null;
-
- byte[] buf = new byte[BUF_SIZE];
-
- int cnt = 0;
-
- for (int n; (n = in.read(buf)) > 0;) {
- out.write(buf, 0, n);
-
- cnt += n;
- }
-
- return cnt;
- }
-
- /**
- * Copies input character stream to output character stream.
- *
- * @param in Input character stream.
- * @param out Output character stream.
- * @return Number of the copied characters.
- * @throws IOException Thrown if an I/O error occurs.
- */
- public static int copy(Reader in, Writer out) throws IOException {
- assert in != null;
- assert out != null;
-
- char[] buf = new char[BUF_SIZE];
-
- int cnt = 0;
-
- for (int n; (n = in.read(buf)) > 0;) {
- out.write(buf, 0, n);
-
- cnt += n;
- }
-
- return cnt;
- }
-
- /**
- * Writes string to file.
- *
- * @param file File.
- * @param s String to write.
- * @throws IOException Thrown if an I/O error occurs.
- */
- public static void writeStringToFile(File file, String s) throws IOException {
- writeStringToFile(file, s, Charset.defaultCharset().toString(), false);
- }
-
- /**
- * Writes string to file.
- *
- * @param file File.
- * @param s String to write.
- * @param charset Encoding.
- * @throws IOException Thrown if an I/O error occurs.
- */
- public static void writeStringToFile(File file, String s, String charset) throws IOException {
- writeStringToFile(file, s, charset, false);
- }
-
- /**
- * Reads file to string using specified charset.
- *
- * @param fileName File name.
- * @param charset File charset.
- * @return File content.
- * @throws IOException If error occurred.
- */
- public static String readFileToString(String fileName, String charset) throws IOException {
- Reader input = new InputStreamReader(new FileInputStream(fileName), charset);
-
- StringWriter output = new StringWriter();
-
- char[] buf = new char[4096];
-
- int n;
-
- while ((n = input.read(buf)) != -1)
- output.write(buf, 0, n);
-
- return output.toString();
- }
-
- /**
- * Writes string to file.
- *
- * @param file File.
- * @param s String to write.
- * @param charset Encoding.
- * @param append If {@code true}, then specified string will be added to the end of the file.
- * @throws IOException Thrown if an I/O error occurs.
- */
- public static void writeStringToFile(File file, String s, String charset, boolean append) throws IOException {
- if (s == null)
- return;
-
- OutputStream out = null;
-
- try {
- out = new FileOutputStream(file, append);
-
- if (s != null)
- out.write(s.getBytes(charset));
- } finally {
- closeQuiet(out);
- }
- }
-
- /**
- * Utility method that sets cause into exception and returns it.
- *
- * @param e Exception to set cause to and return.
- * @param cause Optional cause to set (if not {@code null}).
- * @param <E> Type of the exception.
- * @return Passed in exception with optionally set cause.
- */
- public static <E extends Throwable> E withCause(E e, @Nullable Throwable cause) {
- assert e != null;
-
- if (cause != null)
- e.initCause(cause);
-
- return e;
- }
-
- /**
- * Deletes file or directory with all sub-directories and files.
- *
- * @param file File or directory to delete.
- * @return {@code true} if and only if the file or directory is successfully deleted,
- * {@code false} otherwise
- */
- public static boolean delete(File file) {
- assert file != null;
-
- boolean res = true;
-
- if (file.isDirectory()) {
- File[] files = file.listFiles();
-
- if (files != null && files.length > 0)
- for (File file1 : files)
- if (file1.isDirectory())
- res &= delete(file1);
- else if (file1.getName().endsWith("jar"))
- try {
- // Why do we do this?
- new JarFile(file1, false).close();
-
- res &= file1.delete();
- }
- catch (IOException ignore) {
- // Ignore it here...
- }
- else
- res &= file1.delete();
-
- res &= file.delete();
- }
- else
- res = file.delete();
-
- return res;
- }
-
- /**
- * @param dir Directory to create along with all non-existent parent directories.
- * @return {@code True} if directory exists (has been created or already existed),
- * {@code false} if has not been created and does not exist.
- */
- public static boolean mkdirs(File dir) {
- assert dir != null;
-
- return dir.mkdirs() || dir.exists();
- }
-
- /**
- * Resolve project home directory based on source code base.
- *
- * @return Project home directory (or {@code null} if it cannot be resolved).
- */
- @Nullable private static String resolveProjectHome() {
- assert Thread.holdsLock(GridUtils.class);
-
- // Resolve GridGain home via environment variables.
- String ggHome0 = IgniteSystemProperties.getString(GG_HOME);
-
- if (!F.isEmpty(ggHome0))
- return ggHome0;
-
- String appWorkDir = System.getProperty("user.dir");
-
- if (appWorkDir != null) {
- ggHome0 = findProjectHome(new File(appWorkDir));
-
- if (ggHome0 != null)
- return ggHome0;
- }
-
- URI uri;
-
- Class<GridUtils> cls = GridUtils.class;
-
- try {
- ProtectionDomain domain = cls.getProtectionDomain();
-
- // Should not happen, but to make sure our code is not broken.
- if (domain == null || domain.getCodeSource() == null || domain.getCodeSource().getLocation() == null) {
- logResolveFailed(cls, null);
-
- return null;
- }
-
- // Resolve path to class-file.
- uri = domain.getCodeSource().getLocation().toURI();
-
- // Overcome UNC path problem on Windows (http://www.tomergabel.com/JavaMishandlesUNCPathsOnWindows.aspx)
- if (isWindows() && uri.getAuthority() != null)
- uri = new URI(uri.toString().replace("file://", "file:/"));
- }
- catch (URISyntaxException | SecurityException e) {
- logResolveFailed(cls, e);
-
- return null;
- }
-
- return findProjectHome(new File(uri));
- }
-
- /**
- * Tries to find project home starting from specified directory and moving to root.
- *
- * @param startDir First directory in search hierarchy.
- * @return Project home path or {@code null} if it wasn't found.
- */
- private static String findProjectHome(File startDir) {
- for (File cur = startDir.getAbsoluteFile(); cur != null; cur = cur.getParentFile()) {
- // Check 'cur' is project home directory.
- if (!new File(cur, "bin").isDirectory() ||
- !new File(cur, "libs").isDirectory() ||
- !new File(cur, "config").isDirectory())
- continue;
-
- return cur.getPath();
- }
-
- return null;
- }
-
- /**
- * @param cls Class.
- * @param e Exception.
- */
- private static void logResolveFailed(Class cls, Exception e) {
- warn(null, "Failed to resolve GRIDGAIN_HOME automatically for class codebase " +
- "[class=" + cls + (e == null ? "" : ", e=" + e.getMessage()) + ']');
- }
-
- /**
- * Retrieves {@code GRIDGAIN_HOME} property. The property is retrieved from system
- * properties or from environment in that order.
- *
- * @return {@code GRIDGAIN_HOME} property.
- */
- @Nullable public static String getGridGainHome() {
- GridTuple<String> ggHomeTup = ggHome;
-
- String ggHome0;
-
- if (ggHomeTup == null) {
- synchronized (GridUtils.class) {
- // Double check.
- ggHomeTup = ggHome;
-
- if (ggHomeTup == null) {
- // Resolve GridGain installation home directory.
- ggHome = F.t(ggHome0 = resolveProjectHome());
-
- if (ggHome0 != null)
- System.setProperty(GG_HOME, ggHome0);
- }
- else
- ggHome0 = ggHomeTup.get();
- }
- }
- else
- ggHome0 = ggHomeTup.get();
-
- return ggHome0;
- }
-
- /**
- * @param path GridGain home. May be {@code null}.
- */
- public static void setGridGainHome(@Nullable String path) {
- GridTuple<String> ggHomeTup = ggHome;
-
- String ggHome0;
-
- if (ggHomeTup == null) {
- synchronized (GridUtils.class) {
- // Double check.
- ggHomeTup = ggHome;
-
- if (ggHomeTup == null) {
- if (F.isEmpty(path))
- System.clearProperty(GG_HOME);
- else
- System.setProperty(GG_HOME, path);
-
- ggHome = F.t(path);
-
- return;
- }
- else
- ggHome0 = ggHomeTup.get();
- }
- }
- else
- ggHome0 = ggHomeTup.get();
-
- if (ggHome0 != null && !ggHome0.equals(path))
- throw new IgniteException("Failed to set GRIDGAIN_HOME after it has been already resolved " +
- "[ggHome=" + ggHome0 + ", newGgHome=" + path + ']');
- }
-
- /**
- * Gets file associated with path.
- * <p>
- * First check if path is relative to {@code GRIDGAIN_HOME}.
- * If not, check if path is absolute.
- * If all checks fail, then {@code null} is returned.
- * <p>
- * See {@link #getGridGainHome()} for information on how {@code GRIDGAIN_HOME} is retrieved.
- *
- * @param path Path to resolve.
- * @return Resolved path as file, or {@code null} if path cannot be resolved.
- */
- @Nullable public static File resolveGridGainPath(String path) {
- assert path != null;
-
- /*
- * 1. Check relative to GRIDGAIN_HOME specified in configuration, if any.
- */
-
- String home = getGridGainHome();
-
- if (home != null) {
- File file = new File(home, path);
-
- if (file.exists())
- return file;
- }
-
- /*
- * 2. Check given path as absolute.
- */
-
- File file = new File(path);
-
- if (file.exists())
- return file;
-
- /*
- * 3. Check development path.
- */
-
- if (home != null)
- file = new File(home, "os/" + path);
-
- return file.exists() ? file : null;
- }
-
- /**
- * Gets URL representing the path passed in. First the check is made if path is absolute.
- * If not, then the check is made if path is relative to {@code META-INF} folder in classpath.
- * If not, then the check is made if path is relative to ${GRIDGAIN_HOME}.
- * If all checks fail,
- * then {@code null} is returned, otherwise URL representing path is returned.
- * <p>
- * See {@link #getGridGainHome()} for information on how {@code GRIDGAIN_HOME} is retrieved.
- *
- * @param path Path to resolve.
- * @return Resolved path as URL, or {@code null} if path cannot be resolved.
- * @see #getGridGainHome()
- */
- @Nullable public static URL resolveGridGainUrl(String path) {
- return resolveGridGainUrl(path, true);
- }
-
- /**
- * Gets URL representing the path passed in. First the check is made if path is absolute.
- * If not, then the check is made if path is relative to {@code META-INF} folder in classpath.
- * If not, then the check is made if path is relative to ${GRIDGAIN_HOME}.
- * If all checks fail,
- * then {@code null} is returned, otherwise URL representing path is returned.
- * <p>
- * See {@link #getGridGainHome()} for information on how {@code GRIDGAIN_HOME} is retrieved.
- *
- * @param path Path to resolve.
- * @param metaInf Flag to indicate whether META-INF folder should be checked or class path root.
- * @return Resolved path as URL, or {@code null} if path cannot be resolved.
- * @see #getGridGainHome()
- */
- @SuppressWarnings({"UnusedCatchParameter"})
- @Nullable public static URL resolveGridGainUrl(String path, boolean metaInf) {
- File f = resolveGridGainPath(path);
-
- if (f == null)
- f = resolveGridGainPath("os/" + path);
-
- if (f != null) {
- try {
- // Note: we use that method's chain instead of File.getURL() with due
- // Sun bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6179468
- return f.toURI().toURL();
- }
- catch (MalformedURLException e) {
- // No-op.
- }
- }
-
- String locPath = (metaInf ? "META-INF/" : "") + path.replaceAll("\\\\", "/");
-
- return Thread.currentThread().getContextClassLoader().getResource(locPath);
- }
-
- /**
- * Join byte arrays into single one.
- *
- * @param bufs list of byte arrays to concatenate.
- * @return Concatenated byte's array.
- */
- public static byte[] join(byte[]... bufs) {
- int size = 0;
- for (byte[] buf : bufs) {
- size += buf.length;
- }
-
- byte[] res = new byte[size];
- int position = 0;
- for (byte[] buf : bufs) {
- arrayCopy(buf, 0, res, position, buf.length);
- position += buf.length;
- }
-
- return res;
- }
-
- /**
- * Converts byte array to formatted string. If calling:
- * <pre name="code" class="java">
- * ...
- * byte[] data = {10, 20, 30, 40, 50, 60, 70, 80, 90};
- *
- * U.byteArray2String(data, "0x%02X", ",0x%02X")
- * ...
- * </pre>
- * the result will be:
- * <pre name="code" class="java">
- * ...
- * 0x0A, 0x14, 0x1E, 0x28, 0x32, 0x3C, 0x46, 0x50, 0x5A
- * ...
- * </pre>
- *
- * @param arr Array of byte.
- * @param hdrFmt C-style string format for the first element.
- * @param bodyFmt C-style string format for second and following elements, if any.
- * @return String with converted bytes.
- */
- public static String byteArray2String(byte[] arr, String hdrFmt, String bodyFmt) {
- assert arr != null;
- assert hdrFmt != null;
- assert bodyFmt != null;
-
- SB sb = new SB();
-
- sb.a('{');
-
- boolean first = true;
-
- for (byte b : arr)
- if (first) {
- sb.a(String.format(hdrFmt, b));
-
- first = false;
- }
- else
- sb.a(String.format(bodyFmt, b));
-
- sb.a('}');
-
- return sb.toString();
- }
-
- /**
- * Converts byte array to hex string.
- *
- * @param arr Array of bytes.
- * @return Hex string.
- */
- public static String byteArray2HexString(byte[] arr) {
- SB sb = new SB(arr.length << 1);
-
- for (byte b : arr)
- sb.a(Integer.toHexString(MASK & b >>> 4)).a(Integer.toHexString(MASK & b));
-
- return sb.toString().toUpperCase();
- }
-
- /**
- * Convert string with hex values to byte array.
- *
- * @param hex Hexadecimal string to convert.
- * @return array of bytes defined as hex in string.
- * @throws IllegalArgumentException If input character differs from certain hex characters.
- */
- public static byte[] hexString2ByteArray(String hex) throws IllegalArgumentException {
- // If Hex string has odd character length.
- if (hex.length() % 2 != 0)
- hex = '0' + hex;
-
- char[] chars = hex.toCharArray();
-
- byte[] bytes = new byte[chars.length / 2];
-
- int byteCnt = 0;
-
- for (int i = 0; i < chars.length; i += 2) {
- int newByte = 0;
-
- newByte |= hexCharToByte(chars[i]);
-
- newByte <<= 4;
-
- newByte |= hexCharToByte(chars[i + 1]);
-
- bytes[byteCnt] = (byte)newByte;
-
- byteCnt++;
- }
-
- return bytes;
- }
-
- /**
- * Return byte value for certain character.
- *
- * @param ch Character
- * @return Byte value.
- * @throws IllegalArgumentException If input character differ from certain hex characters.
- */
- @SuppressWarnings({"UnnecessaryFullyQualifiedName", "fallthrough"})
- private static byte hexCharToByte(char ch) throws IllegalArgumentException {
- switch (ch) {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- return (byte)(ch - '0');
-
- case 'a':
- case 'A':
- return 0xa;
-
- case 'b':
- case 'B':
- return 0xb;
-
- case 'c':
- case 'C':
- return 0xc;
-
- case 'd':
- case 'D':
- return 0xd;
-
- case 'e':
- case 'E':
- return 0xe;
-
- case 'f':
- case 'F':
- return 0xf;
-
- default:
- throw new IllegalArgumentException("Hex decoding wrong input character [character=" + ch + ']');
- }
- }
-
- /**
- * Converts primitive double to byte array.
- *
- * @param d Double to convert.
- * @return Byte array.
- */
- public static byte[] doubleToBytes(double d) {
- return longToBytes(Double.doubleToLongBits(d));
- }
-
- /**
- * Converts primitive {@code double} type to byte array and stores
- * it in the specified byte array.
- *
- * @param d Double to convert.
- * @param bytes Array of bytes.
- * @param off Offset.
- * @return New offset.
- */
- public static int doubleToBytes(double d, byte[] bytes, int off) {
- return longToBytes(Double.doubleToLongBits(d), bytes, off);
- }
-
- /**
- * Converts primitive float to byte array.
- *
- * @param f Float to convert.
- * @return Array of bytes.
- */
- public static byte[] floatToBytes(float f) {
- return intToBytes(Float.floatToIntBits(f));
- }
-
- /**
- * Converts primitive float to byte array.
- *
- * @param f Float to convert.
- * @param bytes Array of bytes.
- * @param off Offset.
- * @return New offset.
- */
- public static int floatToBytes(float f, byte[] bytes, int off) {
- return intToBytes(Float.floatToIntBits(f), bytes, off);
- }
-
- /**
- * Converts primitive {@code long} type to byte array.
- *
- * @param l Long value.
- * @return Array of bytes.
- */
- public static byte[] longToBytes(long l) {
- return GridClientByteUtils.longToBytes(l);
- }
-
- /**
- * Converts primitive {@code long} type to byte array and stores it in specified
- * byte array.
- *
- * @param l Long value.
- * @param bytes Array of bytes.
- * @param off Offset in {@code bytes} array.
- * @return Number of bytes overwritten in {@code bytes} array.
-
<TRUNCATED>
[33/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestProtocol.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestProtocol.java
index 0000000,a4f6488..71ed911
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestProtocol.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestProtocol.java
@@@ -1,0 -1,335 +1,280 @@@
+ /*
+ * 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.rest.protocols.tcp;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.marshaller.*;
+ import org.apache.ignite.marshaller.jdk.*;
+ import org.apache.ignite.spi.*;
+ import org.apache.ignite.client.marshaller.*;
+ import org.apache.ignite.client.marshaller.jdk.*;
+ import org.apache.ignite.client.marshaller.optimized.*;
+ import org.apache.ignite.client.ssl.*;
+ import org.apache.ignite.internal.processors.rest.*;
+ import org.apache.ignite.internal.processors.rest.client.message.*;
+ import org.apache.ignite.internal.processors.rest.protocols.*;
-import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.nio.*;
+ import org.apache.ignite.internal.util.nio.ssl.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import javax.net.ssl.*;
+ import java.io.*;
+ import java.net.*;
+ import java.nio.*;
+ import java.util.*;
+
+ import static org.apache.ignite.internal.util.nio.GridNioSessionMetaKey.*;
+
+ /**
+ * TCP binary protocol implementation.
+ */
+ public class GridTcpRestProtocol extends GridRestProtocolAdapter {
+ /** Server. */
+ private GridNioServer<GridClientMessage> srv;
+
+ /** JDK marshaller. */
+ private final IgniteMarshaller jdkMarshaller = new IgniteJdkMarshaller();
+
+ /** NIO server listener. */
+ private GridTcpRestNioListener lsnr;
+
- /** Message reader. */
- private final GridNioMessageReader msgReader = new GridNioMessageReader() {
- @Override public boolean read(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, ByteBuffer buf) {
- assert msg != null;
- assert buf != null;
-
- msg.messageReader(this, nodeId);
-
- return msg.readFrom(buf);
- }
-
- @Nullable @Override public GridTcpMessageFactory messageFactory() {
- return null;
- }
- };
-
- /** Message writer. */
- private final GridNioMessageWriter msgWriter = new GridNioMessageWriter() {
- @Override public boolean write(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, ByteBuffer buf) {
- assert msg != null;
- assert buf != null;
-
- msg.messageWriter(this, nodeId);
-
- return msg.writeTo(buf);
- }
-
- @Override public int writeFully(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, OutputStream out,
- ByteBuffer buf) throws IOException {
- assert msg != null;
- assert out != null;
- assert buf != null;
- assert buf.hasArray();
-
- msg.messageWriter(this, nodeId);
-
- boolean finished = false;
- int cnt = 0;
-
- while (!finished) {
- finished = msg.writeTo(buf);
-
- out.write(buf.array(), 0, buf.position());
-
- cnt += buf.position();
-
- buf.clear();
- }
-
- return cnt;
- }
- };
-
+ /** @param ctx Context. */
+ public GridTcpRestProtocol(GridKernalContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * @return JDK marshaller.
+ */
+ IgniteMarshaller jdkMarshaller() {
+ return jdkMarshaller;
+ }
+
+ /**
+ * Returns marshaller.
+ *
+ * @param ses Session.
+ * @return Marshaller.
+ */
+ GridClientMarshaller marshaller(GridNioSession ses) {
+ GridClientMarshaller marsh = ses.meta(MARSHALLER.ordinal());
+
+ assert marsh != null;
+
+ return marsh;
+ }
+
+ /**
+ * @param ses Session.
+ * @return Whether portable marshaller is used.
+ */
+ boolean portableMode(GridNioSession ses) {
+ return ctx.portable().isPortable(marshaller(ses));
+ }
+
+ /** {@inheritDoc} */
+ @Override public String name() {
+ return "TCP binary";
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("BusyWait")
+ @Override public void start(final GridRestProtocolHandler hnd) throws IgniteCheckedException {
+ assert hnd != null;
+
+ ClientConnectionConfiguration cfg = ctx.config().getClientConnectionConfiguration();
+
+ assert cfg != null;
+
+ lsnr = new GridTcpRestNioListener(log, this, hnd, ctx);
+
- GridNioParser parser = new GridTcpRestDirectParser(this, msgReader);
++ GridNioParser parser = new GridTcpRestDirectParser(this);
+
+ try {
+ host = resolveRestTcpHost(ctx.config());
+
+ SSLContext sslCtx = null;
+
+ if (cfg.isRestTcpSslEnabled()) {
+ GridSslContextFactory factory = cfg.getRestTcpSslContextFactory();
+
+ if (factory == null)
+ // Thrown SSL exception instead of IgniteCheckedException for writing correct warning message into log.
+ throw new SSLException("SSL is enabled, but SSL context factory is not specified.");
+
+ sslCtx = factory.createSslContext();
+ }
+
+ int lastPort = cfg.getRestTcpPort() + cfg.getRestPortRange() - 1;
+
+ for (int port0 = cfg.getRestTcpPort(); port0 <= lastPort; port0++) {
+ if (startTcpServer(host, port0, lsnr, parser, sslCtx, cfg)) {
+ port = port0;
+
+ if (log.isInfoEnabled())
+ log.info(startInfo());
+
+ return;
+ }
+ }
+
+ U.warn(log, "Failed to start TCP binary REST server (possibly all ports in range are in use) " +
+ "[firstPort=" + cfg.getRestTcpPort() + ", lastPort=" + lastPort + ", host=" + host + ']');
+ }
+ catch (SSLException e) {
+ U.warn(log, "Failed to start " + name() + " protocol on port " + port + ": " + e.getMessage(),
+ "Failed to start " + name() + " protocol on port " + port + ". Check if SSL context factory is " +
+ "properly configured.");
+ }
+ catch (IOException e) {
+ U.warn(log, "Failed to start " + name() + " protocol on port " + port + ": " + e.getMessage(),
+ "Failed to start " + name() + " protocol on port " + port + ". " +
+ "Check restTcpHost configuration property.");
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onKernalStart() {
+ super.onKernalStart();
+
+ Map<Byte, GridClientMarshaller> marshMap = new HashMap<>();
+
+ marshMap.put(GridClientOptimizedMarshaller.ID, new GridClientOptimizedMarshaller());
+ marshMap.put(GridClientJdkMarshaller.ID, new GridClientJdkMarshaller());
+ marshMap.put((byte)0, ctx.portable().portableMarshaller());
+
+ lsnr.marshallers(marshMap);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void stop() {
+ if (srv != null) {
+ ctx.ports().deregisterPorts(getClass());
+
+ srv.stop();
+ }
+
+ if (log.isInfoEnabled())
+ log.info(stopInfo());
+ }
+
+ /**
+ * Resolves host for REST TCP server using grid configuration.
+ *
+ * @param cfg Grid configuration.
+ * @return REST host.
+ * @throws IOException If failed to resolve REST host.
+ */
+ private InetAddress resolveRestTcpHost(IgniteConfiguration cfg) throws IOException {
+ String host = cfg.getClientConnectionConfiguration().getRestTcpHost();
+
+ if (host == null)
+ host = cfg.getLocalHost();
+
+ return U.resolveLocalHost(host);
+ }
+
+ /**
+ * Tries to start server with given parameters.
+ *
+ * @param hostAddr Host on which server should be bound.
+ * @param port Port on which server should be bound.
+ * @param lsnr Server message listener.
+ * @param parser Server message parser.
+ * @param sslCtx SSL context in case if SSL is enabled.
+ * @param cfg Configuration for other parameters.
+ * @return {@code True} if server successfully started, {@code false} if port is used and
+ * server was unable to start.
+ */
+ private boolean startTcpServer(InetAddress hostAddr, int port, GridNioServerListener<GridClientMessage> lsnr,
+ GridNioParser parser, @Nullable SSLContext sslCtx, ClientConnectionConfiguration cfg) {
+ try {
+ GridNioFilter codec = new GridNioCodecFilter(parser, log, true);
+
+ GridNioFilter[] filters;
+
+ if (sslCtx != null) {
+ GridNioSslFilter sslFilter = new GridNioSslFilter(sslCtx, log);
+
+ sslFilter.directMode(true);
+
+ boolean auth = cfg.isRestTcpSslClientAuth();
+
+ sslFilter.wantClientAuth(auth);
+
+ sslFilter.needClientAuth(auth);
+
+ filters = new GridNioFilter[] {
+ codec,
+ sslFilter
+ };
+ }
+ else
+ filters = new GridNioFilter[] { codec };
+
+ srv = GridNioServer.<GridClientMessage>builder()
+ .address(hostAddr)
+ .port(port)
+ .listener(lsnr)
+ .logger(log)
+ .selectorCount(cfg.getRestTcpSelectorCount())
+ .gridName(ctx.gridName())
+ .tcpNoDelay(cfg.isRestTcpNoDelay())
+ .directBuffer(cfg.isRestTcpDirectBuffer())
+ .byteOrder(ByteOrder.nativeOrder())
+ .socketSendBufferSize(cfg.getRestTcpSendBufferSize())
+ .socketReceiveBufferSize(cfg.getRestTcpReceiveBufferSize())
+ .sendQueueLimit(cfg.getRestTcpSendQueueLimit())
+ .filters(filters)
+ .directMode(true)
- .messageWriter(msgWriter)
+ .build();
+
+ srv.idleTimeout(cfg.getRestIdleTimeout());
+
+ srv.start();
+
+ ctx.ports().registerPort(port, IgnitePortProtocol.TCP, getClass());
+
+ return true;
+ }
+ catch (IgniteCheckedException e) {
+ if (log.isDebugEnabled())
+ log.debug("Failed to start " + name() + " protocol on port " + port + ": " + e.getMessage());
+
+ return false;
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected String getAddressPropertyName() {
+ return GridNodeAttributes.ATTR_REST_TCP_ADDRS;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected String getHostNamePropertyName() {
+ return GridNodeAttributes.ATTR_REST_TCP_HOST_NAMES;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected String getPortPropertyName() {
+ return GridNodeAttributes.ATTR_REST_TCP_PORT;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java
index 0000000,0afb745..efc80cb
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerCancelRequest.java
@@@ -1,0 -1,123 +1,121 @@@
+ /*
+ * 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.streamer;
+
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Streamer cancel request.
+ */
+ public class GridStreamerCancelRequest extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Cancelled future ID. */
+ private IgniteUuid cancelledFutId;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridStreamerCancelRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param cancelledFutId Cancelled future ID.
+ */
+ public GridStreamerCancelRequest(IgniteUuid cancelledFutId) {
+ this.cancelledFutId = cancelledFutId;
+ }
+
+ /**
+ * @return Cancelled future ID.
+ */
+ public IgniteUuid cancelledFutureId() {
+ return cancelledFutId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridStreamerCancelRequest _clone = new GridStreamerCancelRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridStreamerCancelRequest _clone = (GridStreamerCancelRequest)_msg;
+
+ _clone.cancelledFutId = cancelledFutId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putGridUuid(cancelledFutId))
++ if (!commState.putGridUuid("cancelledFutId", cancelledFutId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- IgniteUuid cancelledFutId0 = commState.getGridUuid();
++ cancelledFutId = commState.getGridUuid("cancelledFutId");
+
- if (cancelledFutId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- cancelledFutId = cancelledFutId0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 75;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java
index 0000000,5e9f937..e62a003
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java
@@@ -1,0 -1,382 +1,374 @@@
+ /*
+ * 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.streamer;
+
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.jetbrains.annotations.*;
+
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ *
+ */
+ public class GridStreamerExecutionRequest extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Force local deployment flag. */
+ private boolean forceLocDep;
+
+ /** Serialized batch in case if P2P class loading is enabled. */
+ @GridToStringExclude
+ private byte[] batchBytes;
+
+ /** Deployment mode. */
+ private IgniteDeploymentMode depMode;
+
+ /** Deployment sample class name. */
+ private String sampleClsName;
+
+ /** Deployment user version. */
+ private String userVer;
+
+ /** Node class loader participants. */
+ @GridToStringInclude
+ @GridDirectMap(keyType = UUID.class, valueType = IgniteUuid.class)
+ private Map<UUID, IgniteUuid> ldrParticipants;
+
+ /** Class loader ID. */
+ private IgniteUuid clsLdrId;
+
+ /**
+ *
+ */
+ public GridStreamerExecutionRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param forceLocDep Force local deployment flag.
+ * @param batchBytes Batch serialized bytes.
+ * @param depMode Deployment mode.
+ * @param sampleClsName Sample class name.
+ * @param userVer User version.
+ * @param ldrParticipants Loader participants.
+ * @param clsLdrId Class loader ID.
+ */
+ public GridStreamerExecutionRequest(
+ boolean forceLocDep,
+ byte[] batchBytes,
+ @Nullable IgniteDeploymentMode depMode,
+ @Nullable String sampleClsName,
+ @Nullable String userVer,
+ @Nullable Map<UUID, IgniteUuid> ldrParticipants,
+ @Nullable IgniteUuid clsLdrId
+ ) {
+ assert batchBytes != null;
+
+ this.forceLocDep = forceLocDep;
+ this.batchBytes = batchBytes;
+ this.depMode = depMode;
+ this.sampleClsName = sampleClsName;
+ this.userVer = userVer;
+ this.ldrParticipants = ldrParticipants;
+ this.clsLdrId = clsLdrId;
+ }
+
+ /**
+ * @return Force local deployment flag.
+ */
+ public boolean forceLocalDeployment() {
+ return forceLocDep;
+ }
+
+ /**
+ * @return Deployment mode.
+ */
+ public IgniteDeploymentMode deploymentMode() {
+ return depMode;
+ }
+
+ /**
+ * @return Deployment sample class name.
+ */
+ public String sampleClassName() {
+ return sampleClsName;
+ }
+
+ /**
+ * @return Deployment user version.
+ */
+ public String userVersion() {
+ return userVer;
+ }
+
+ /**
+ * @return Node class loader participants.
+ */
+ public Map<UUID, IgniteUuid> loaderParticipants() {
+ return ldrParticipants;
+ }
+
+ /**
+ * @return Class loader ID.
+ */
+ public IgniteUuid classLoaderId() {
+ return clsLdrId;
+ }
+
+ /**
+ * @return Serialized batch in case if P2P class loading is enabled.
+ */
+ public byte[] batchBytes() {
+ return batchBytes;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridStreamerExecutionRequest.class, this);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridStreamerExecutionRequest _clone = new GridStreamerExecutionRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridStreamerExecutionRequest _clone = (GridStreamerExecutionRequest)_msg;
+
+ _clone.forceLocDep = forceLocDep;
+ _clone.batchBytes = batchBytes;
+ _clone.depMode = depMode;
+ _clone.sampleClsName = sampleClsName;
+ _clone.userVer = userVer;
+ _clone.ldrParticipants = ldrParticipants;
+ _clone.clsLdrId = clsLdrId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putByteArray(batchBytes))
++ if (!commState.putByteArray("batchBytes", batchBytes))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putGridUuid(clsLdrId))
++ if (!commState.putGridUuid("clsLdrId", clsLdrId))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putEnum(depMode))
++ if (!commState.putEnum("depMode", depMode))
+ return false;
+
+ commState.idx++;
+
+ case 3:
- if (!commState.putBoolean(forceLocDep))
++ if (!commState.putBoolean("forceLocDep", forceLocDep))
+ return false;
+
+ commState.idx++;
+
+ case 4:
+ if (ldrParticipants != null) {
+ if (commState.it == null) {
- if (!commState.putInt(ldrParticipants.size()))
++ if (!commState.putInt(null, ldrParticipants.size()))
+ return false;
+
+ commState.it = ldrParticipants.entrySet().iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
+ Map.Entry<UUID, IgniteUuid> e = (Map.Entry<UUID, IgniteUuid>)commState.cur;
+
+ if (!commState.keyDone) {
- if (!commState.putUuid(e.getKey()))
++ if (!commState.putUuid(null, e.getKey()))
+ return false;
+
+ commState.keyDone = true;
+ }
+
- if (!commState.putGridUuid(e.getValue()))
++ if (!commState.putGridUuid(null, e.getValue()))
+ return false;
+
+ commState.keyDone = false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 5:
- if (!commState.putString(sampleClsName))
++ if (!commState.putString("sampleClsName", sampleClsName))
+ return false;
+
+ commState.idx++;
+
+ case 6:
- if (!commState.putString(userVer))
++ if (!commState.putString("userVer", userVer))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- byte[] batchBytes0 = commState.getByteArray();
++ batchBytes = commState.getByteArray("batchBytes");
+
- if (batchBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- batchBytes = batchBytes0;
-
+ commState.idx++;
+
+ case 1:
- IgniteUuid clsLdrId0 = commState.getGridUuid();
++ clsLdrId = commState.getGridUuid("clsLdrId");
+
- if (clsLdrId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- clsLdrId = clsLdrId0;
-
+ commState.idx++;
+
+ case 2:
- if (buf.remaining() < 1)
- return false;
++ byte depMode0 = commState.getByte("depMode");
+
- byte depMode0 = commState.getByte();
++ if (!commState.lastRead())
++ return false;
+
+ depMode = IgniteDeploymentMode.fromOrdinal(depMode0);
+
+ commState.idx++;
+
+ case 3:
- if (buf.remaining() < 1)
- return false;
++ forceLocDep = commState.getBoolean("forceLocDep");
+
- forceLocDep = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 4:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (ldrParticipants == null)
- ldrParticipants = U.newHashMap(commState.readSize);
++ ldrParticipants = new HashMap<>(commState.readSize, 1.0f);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
+ if (!commState.keyDone) {
- UUID _val = commState.getUuid();
++ UUID _val = commState.getUuid(null);
+
- if (_val == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ commState.cur = _val;
+ commState.keyDone = true;
+ }
+
- IgniteUuid _val = commState.getGridUuid();
++ IgniteUuid _val = commState.getGridUuid(null);
+
- if (_val == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ ldrParticipants.put((UUID)commState.cur, _val);
+
+ commState.keyDone = false;
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+ commState.cur = null;
+
+ commState.idx++;
+
+ case 5:
- String sampleClsName0 = commState.getString();
++ sampleClsName = commState.getString("sampleClsName");
+
- if (sampleClsName0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- sampleClsName = sampleClsName0;
-
+ commState.idx++;
+
+ case 6:
- String userVer0 = commState.getString();
++ userVer = commState.getString("userVer");
+
- if (userVer0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- userVer = userVer0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 76;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java
index 0000000,7ca0e36..fdd21df
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerResponse.java
@@@ -1,0 -1,160 +1,156 @@@
+ /*
+ * 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.streamer;
+
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.nio.*;
+
+ /**
+ *
+ */
+ public class GridStreamerResponse extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private IgniteUuid futId;
+
+ /** */
+ private byte[] errBytes;
+
+ /**
+ *
+ */
+ public GridStreamerResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param futId Future ID.
+ * @param errBytes Serialized error, if any.
+ */
+ public GridStreamerResponse(IgniteUuid futId, @Nullable byte[] errBytes) {
+ assert futId != null;
+
+ this.futId = futId;
+ this.errBytes = errBytes;
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Serialized error.
+ */
+ public byte[] errorBytes() {
+ return errBytes;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridStreamerResponse.class, this);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridStreamerResponse _clone = new GridStreamerResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridStreamerResponse _clone = (GridStreamerResponse)_msg;
+
+ _clone.futId = futId;
+ _clone.errBytes = errBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putByteArray(errBytes))
++ if (!commState.putByteArray("errBytes", errBytes))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- byte[] errBytes0 = commState.getByteArray();
++ errBytes = commState.getByteArray("errBytes");
+
- if (errBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- errBytes = errBytes0;
-
+ commState.idx++;
+
+ case 1:
- IgniteUuid futId0 = commState.getGridUuid();
++ futId = commState.getGridUuid("futId");
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 77;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java
index 0000000,bce75f6..d167e55
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridLongList.java
@@@ -1,0 -1,500 +1,504 @@@
+ /*
+ * 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.util;
+
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.util.*;
+
+ /**
+ * Minimal list API to work with primitive longs. This list exists
+ * to avoid boxing/unboxing when using standard list from Java.
+ */
+ public class GridLongList implements Externalizable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private long[] arr;
+
+ /** */
+ private int idx;
+
+ /**
+ *
+ */
+ public GridLongList() {
+ // No-op.
+ }
+
+ /**
+ * @param size Size.
+ */
+ public GridLongList(int size) {
+ arr = new long[size];
+ // idx = 0
+ }
+
+ /**
+ * @param arr Array.
+ */
+ public GridLongList(long[] arr) {
+ this.arr = arr;
+
+ idx = arr.length;
+ }
+
+ /**
+ * @param vals Values.
+ * @return List from values.
+ */
+ public static GridLongList asList(long... vals) {
+ if (F.isEmpty(vals))
+ return new GridLongList();
+
+ return new GridLongList(vals);
+ }
+
+ /**
+ * @param arr Array.
+ * @param size Size.
+ */
+ private GridLongList(long[] arr, int size) {
+ this.arr = arr;
+ idx = size;
+ }
+
+ /**
+ * @return Copy of this list.
+ */
+ public GridLongList copy() {
+ if (idx == 0)
+ return new GridLongList();
+
+ return new GridLongList(Arrays.copyOf(arr, idx));
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (!(o instanceof GridLongList))
+ return false;
+
+ GridLongList that = (GridLongList)o;
+
+ if (idx != that.idx)
+ return false;
+
+ if (idx == 0 || arr == that.arr)
+ return true;
+
+ for (int i = 0; i < idx; i++) {
+ if (arr[i] != that.arr[i])
+ return false;
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ int res = 1;
+
+ for (int i = 0; i < idx; i++) {
+ long element = arr[i];
+ int elementHash = (int)(element ^ (element >>> 32));
+ res = 31 * res + elementHash;
+ }
+
+ return res;
+ }
+
+ /**
+ * @param l List to add all elements of.
+ */
+ public void addAll(GridLongList l) {
+ assert l != null;
+
+ if (l.isEmpty())
+ return;
+
+ if (arr == null)
+ arr = new long[4];
+
+ int len = arr.length;
+
+ while (len < idx + l.size())
+ len <<= 1;
+
+ arr = Arrays.copyOf(arr, len);
+
+ System.arraycopy(l.arr, 0, arr, idx, l.size());
+
+ idx += l.size();
+ }
+
+ /**
+ * Add element to this array.
+ * @param x Value.
+ */
+ public void add(long x) {
+ if (arr == null)
+ arr = new long[4];
+ else if (arr.length == idx)
+ arr = Arrays.copyOf(arr, arr.length << 1);
+
+ arr[idx++] = x;
+ }
+
+ /**
+ * Clears the list.
+ */
+ public void clear() {
+ idx = 0;
+ }
+
+ /**
+ * Gets the last element.
+ *
+ * @return The last element.
+ */
+ public long last() {
+ return arr[idx - 1];
+ }
+
+ /**
+ * Removes and returns the last element of the list. Complementary method to {@link #add(long)} for stack like usage.
+ *
+ * @return Removed element.
+ * @throws NoSuchElementException If the list is empty.
+ */
+ public long remove() throws NoSuchElementException {
+ if (idx == 0)
+ throw new NoSuchElementException();
+
+ return arr[--idx];
+ }
+
+ /**
+ * Returns (possibly reordered) copy of this list, excluding all elements of given list.
+ *
+ * @param l List of elements to remove.
+ * @return New list without all elements from {@code l}.
+ */
+ public GridLongList copyWithout(GridLongList l) {
+ assert l != null;
+
+ if (idx == 0)
+ return new GridLongList();
+
+ if (l.idx == 0)
+ return new GridLongList(Arrays.copyOf(arr, idx));
+
+ long[] newArr = Arrays.copyOf(arr, idx);
+ int newIdx = idx;
+
+ for (int i = 0; i < l.size(); i++) {
+ long rmVal = l.get(i);
+
+ for (int j = 0; j < newIdx; j++) {
+ if (newArr[j] == rmVal) {
+
+ while (newIdx > 0 && newArr[newIdx - 1] == rmVal)
+ newIdx--;
+
+ if (newIdx > 0) {
+ newArr[j] = newArr[newIdx - 1];
+ newIdx--;
+ }
+ }
+ }
+ }
+
+ return new GridLongList(newArr, newIdx);
+ }
+
+ /**
+ * @param i Index.
+ * @return Value.
+ */
+ public long get(int i) {
+ assert i < idx;
+
+ return arr[i];
+ }
+
+ /**
+ * @return Size.
+ */
+ public int size() {
+ return idx;
+ }
+
+ /**
+ * @return {@code True} if this list has no elements.
+ */
+ public boolean isEmpty() {
+ return idx == 0;
+ }
+
+ /**
+ * @param l Element to find.
+ * @return {@code True} if found.
+ */
+ public boolean contains(long l) {
+ for (int i = 0; i < idx; i++) {
+ if (arr[i] == l)
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @param l List to check.
+ * @return {@code True} if this list contains all the elements of passed in list.
+ */
+ public boolean containsAll(GridLongList l) {
+ for (int i = 0; i < l.size(); i++) {
+ if (!contains(l.get(i)))
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * @return {@code True} if there are no duplicates.
+ */
+ public boolean distinct() {
+ for (int i = 0; i < idx; i++) {
+ for (int j = i + 1; j < idx; j++) {
+ if (arr[i] == arr[j])
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * @param size New size.
+ * @param last If {@code true} the last elements will be removed, otherwise the first.
+ */
+ public void truncate(int size, boolean last) {
+ assert size >= 0 && size <= idx;
+
+ if (size == idx)
+ return;
+
+ if (!last && idx != 0 && size != 0)
+ System.arraycopy(arr, idx - size, arr, 0, size);
+
+ idx = size;
+ }
+
+ /**
+ * Removes element by given index.
+ *
+ * @param i Index.
+ * @return Removed value.
+ */
+ public long removeIndex(int i) {
+ assert i < idx : i;
+
+ long res = arr[i];
+
+ if (i == idx - 1) { // Last element.
+ idx = i;
+ }
+ else {
+ System.arraycopy(arr, i + 1, arr, i, idx - i - 1);
+ idx--;
+ }
+
+ return res;
+ }
+
+ /**
+ * Removes value from this list.
+ *
+ * @param startIdx Index to begin search with.
+ * @param val Value.
+ * @return Index of removed value if the value was found and removed or {@code -1} otherwise.
+ */
+ public int removeValue(int startIdx, long val) {
+ assert startIdx >= 0;
+
+ for (int i = startIdx; i < idx; i++) {
+ if (arr[i] == val) {
+ removeIndex(i);
+
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ /**
+ * Removes value from this list.
+ *
+ * @param startIdx Index to begin search with.
+ * @param oldVal Old value.
+ * @param newVal New value.
+ * @return Index of replaced value if the value was found and replaced or {@code -1} otherwise.
+ */
+ public int replaceValue(int startIdx, long oldVal, long newVal) {
+ for (int i = startIdx; i < idx; i++) {
+ if (arr[i] == oldVal) {
+ arr[i] = newVal;
+
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ /**
- * @return Internal array.
++ * @return Array copy.
+ */
- public long[] internalArray() {
- return arr;
++ public long[] array() {
++ long[] res = new long[idx];
++
++ System.arraycopy(arr, 0, res, 0, idx);
++
++ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeInt(idx);
+
+ for (int i = 0; i < idx; i++)
+ out.writeLong(arr[i]);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ idx = in.readInt();
+
+ arr = new long[idx];
+
+ for (int i = 0; i < idx; i++)
+ arr[i] = in.readLong();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ SB b = new SB("[");
+
+ for (int i = 0; i < idx; i++) {
+ if (i != 0)
+ b.a(',');
+
+ b.a(arr[i]);
+ }
+
+ b.a(']');
+
+ return S.toString(GridLongList.class, this, "arr", b);
+ }
+
+ /**
+ * @param in Input to read list from.
+ * @return Grid long list.
+ * @throws IOException If failed.
+ */
+ @Nullable public static GridLongList readFrom(DataInput in) throws IOException {
+ int idx = in.readInt();
+
+ if (idx == -1)
+ return null;
+
+ long[] arr = new long[idx];
+
+ for (int i = 0; i < idx; i++)
+ arr[i] = in.readLong();
+
+ return new GridLongList(arr);
+ }
+
+ /**
+ * @param out Output to write to.
+ * @param list List.
+ * @throws IOException If failed.
+ */
+ public static void writeTo(DataOutput out, @Nullable GridLongList list) throws IOException {
+ out.writeInt(list != null ? list.idx : -1);
+
+ if (list != null) {
+ for (int i = 0; i < list.idx; i++)
+ out.writeLong(list.arr[i]);
+ }
+ }
+
+ /**
+ * @param to To list.
+ * @param from From list.
+ * @return To list (passed in or created).
+ */
+ public static GridLongList addAll(@Nullable GridLongList to, GridLongList from) {
+ if (to == null) {
+ GridLongList res = new GridLongList(from.size());
+
+ res.addAll(from);
+
+ return res;
+ }
+ else {
+ to.addAll(from);
+
+ return to;
+ }
+ }
+
+ /**
+ * Sorts this list.
+ * Use {@code copy().sort()} if you need a defensive copy.
+ *
+ * @return {@code this} For chaining.
+ */
+ public GridLongList sort() {
+ if (idx > 1)
+ Arrays.sort(arr, 0, idx);
+
+ return this;
+ }
+
+ /**
+ * Removes given number of elements from the end. If the given number of elements is higher than
+ * list size, then list will be cleared.
+ *
+ * @param cnt Count to pop from the end.
+ */
+ public void pop(int cnt) {
+ assert cnt >= 0 : cnt;
+
+ if (idx < cnt)
+ idx = 0;
+ else
+ idx -= cnt;
+ }
+ }
[02/52] [abbrv] incubator-ignite git commit: GridNamedInstance ->
IgniteNamedInstance GridgainEx -> IgnitionEx
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5247ab3/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
new file mode 100644
index 0000000..acab6d0
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -0,0 +1,2399 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.affinity.rendezvous.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.fs.*;
+import org.apache.ignite.internal.util.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.lifecycle.*;
+import org.apache.ignite.logger.*;
+import org.apache.ignite.logger.java.*;
+import org.apache.ignite.marshaller.*;
+import org.apache.ignite.marshaller.jdk.*;
+import org.apache.ignite.marshaller.optimized.*;
+import org.apache.ignite.mxbean.*;
+import org.apache.ignite.spi.*;
+import org.apache.ignite.spi.authentication.*;
+import org.apache.ignite.spi.authentication.noop.*;
+import org.apache.ignite.spi.indexing.*;
+import org.apache.ignite.streamer.*;
+import org.apache.ignite.thread.*;
+import org.apache.ignite.internal.processors.resource.*;
+import org.apache.ignite.internal.processors.spring.*;
+import org.apache.ignite.plugin.segmentation.*;
+import org.apache.ignite.spi.checkpoint.*;
+import org.apache.ignite.spi.checkpoint.noop.*;
+import org.apache.ignite.spi.collision.*;
+import org.apache.ignite.spi.collision.noop.*;
+import org.apache.ignite.spi.communication.*;
+import org.apache.ignite.spi.communication.tcp.*;
+import org.apache.ignite.spi.deployment.*;
+import org.apache.ignite.spi.deployment.local.*;
+import org.apache.ignite.spi.discovery.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.*;
+import org.apache.ignite.spi.eventstorage.*;
+import org.apache.ignite.spi.eventstorage.memory.*;
+import org.apache.ignite.spi.failover.*;
+import org.apache.ignite.spi.failover.always.*;
+import org.apache.ignite.spi.loadbalancing.*;
+import org.apache.ignite.spi.loadbalancing.roundrobin.*;
+import org.apache.ignite.spi.securesession.*;
+import org.apache.ignite.spi.securesession.noop.*;
+import org.apache.ignite.spi.swapspace.*;
+import org.apache.ignite.spi.swapspace.file.*;
+import org.apache.ignite.spi.swapspace.noop.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.jdk8.backport.*;
+import org.jetbrains.annotations.*;
+
+import javax.management.*;
+import java.io.*;
+import java.lang.management.*;
+import java.lang.reflect.*;
+import java.net.*;
+import java.util.*;
+import java.util.Map.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+import java.util.logging.*;
+
+import static org.apache.ignite.configuration.IgniteConfiguration.*;
+import static org.apache.ignite.IgniteState.*;
+import static org.apache.ignite.IgniteSystemProperties.*;
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheDistributionMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CachePreloadMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
+import static org.apache.ignite.internal.IgniteComponentType.*;
+import static org.apache.ignite.plugin.segmentation.GridSegmentationPolicy.*;
+
+/**
+ * This class defines a factory for the main GridGain API. It controls Grid life cycle
+ * and allows listening for grid events.
+ * <h1 class="header">Grid Loaders</h1>
+ * Although user can apply grid factory directly to start and stop grid, grid is
+ * often started and stopped by grid loaders. Grid loaders can be found in
+ * {@link org.apache.ignite.startup} package, for example:
+ * <ul>
+ * <li>{@code GridCommandLineStartup}</li>
+ * <li>{@code GridServletStartup}</li>
+ * </ul>
+ * <h1 class="header">Examples</h1>
+ * Use {@link #start()} method to start grid with default configuration. You can also use
+ * {@link org.apache.ignite.configuration.IgniteConfiguration} to override some default configuration. Below is an
+ * example on how to start grid with <strong>URI deployment</strong>.
+ * <pre name="code" class="java">
+ * GridConfiguration cfg = new GridConfiguration();
+ */
+public class IgnitionEx {
+ /** Default configuration path relative to GridGain home. */
+ public static final String DFLT_CFG = "config/default-config.xml";
+
+ /** Map of named grids. */
+ private static final ConcurrentMap<Object, IgniteNamedInstance> grids = new ConcurrentHashMap8<>();
+
+ /** Map of grid states ever started in this JVM. */
+ private static final Map<Object, IgniteState> gridStates = new ConcurrentHashMap8<>();
+
+ /** Mutex to synchronize updates of default grid reference. */
+ private static final Object dfltGridMux = new Object();
+
+ /** Default grid. */
+ private static volatile IgniteNamedInstance dfltGrid;
+
+ /** Default grid state. */
+ private static volatile IgniteState dfltGridState;
+
+ /** List of state listeners. */
+ private static final Collection<IgniteListener> lsnrs = new GridConcurrentHashSet<>(4);
+
+ /** */
+ private static volatile boolean daemon;
+
+ /**
+ * Checks runtime version to be 1.7.x or 1.8.x.
+ * This will load pretty much first so we must do these checks here.
+ */
+ static {
+ // Check 1.8 just in case for forward compatibility.
+ if (!U.jdkVersion().contains("1.7") &&
+ !U.jdkVersion().contains("1.8"))
+ throw new IllegalStateException("GridGain requires Java 7 or above. Current Java version " +
+ "is not supported: " + U.jdkVersion());
+
+ // To avoid nasty race condition in UUID.randomUUID() in JDK prior to 6u34.
+ // For details please see:
+ // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7071826
+ // http://www.oracle.com/technetwork/java/javase/2col/6u34-bugfixes-1733379.html
+ // http://hg.openjdk.java.net/jdk6/jdk6/jdk/rev/563d392b3e5c
+ UUID.randomUUID();
+ }
+
+ /**
+ * Enforces singleton.
+ */
+ private IgnitionEx() {
+ // No-op.
+ }
+
+ /**
+ * Sets daemon flag.
+ * <p>
+ * If daemon flag is set then all grid instances created by the factory will be
+ * daemon, i.e. the local node for these instances will be a daemon node. Note that
+ * if daemon flag is set - it will override the same settings in {@link org.apache.ignite.configuration.IgniteConfiguration#isDaemon()}.
+ * Note that you can set on and off daemon flag at will.
+ *
+ * @param daemon Daemon flag to set.
+ */
+ public static void setDaemon(boolean daemon) {
+ IgnitionEx.daemon = daemon;
+ }
+
+ /**
+ * Gets daemon flag.
+ * <p>
+ * If daemon flag it set then all grid instances created by the factory will be
+ * daemon, i.e. the local node for these instances will be a daemon node. Note that
+ * if daemon flag is set - it will override the same settings in {@link org.apache.ignite.configuration.IgniteConfiguration#isDaemon()}.
+ * Note that you can set on and off daemon flag at will.
+ *
+ * @return Daemon flag.
+ */
+ public static boolean isDaemon() {
+ return daemon;
+ }
+
+ /**
+ * Gets state of grid default grid.
+ *
+ * @return Default grid state.
+ */
+ public static IgniteState state() {
+ return state(null);
+ }
+
+ /**
+ * Gets states of named grid. If name is {@code null}, then state of
+ * default no-name grid is returned.
+ *
+ * @param name Grid name. If name is {@code null}, then state of
+ * default no-name grid is returned.
+ * @return Grid state.
+ */
+ public static IgniteState state(@Nullable String name) {
+ IgniteNamedInstance grid = name != null ? grids.get(name) : dfltGrid;
+
+ if (grid == null) {
+ IgniteState state = name != null ? gridStates.get(name) : dfltGridState;
+
+ return state != null ? state : STOPPED;
+ }
+
+ return grid.state();
+ }
+
+ /**
+ * Stops default grid. This method is identical to {@code G.stop(null, cancel)} apply.
+ * Note that method does not wait for all tasks to be completed.
+ *
+ * @param cancel If {@code true} then all jobs currently executing on
+ * default grid will be cancelled by calling {@link org.apache.ignite.compute.ComputeJob#cancel()}
+ * method. Note that just like with {@link Thread#interrupt()}, it is
+ * up to the actual job to exit from execution
+ * @return {@code true} if default grid instance was indeed stopped,
+ * {@code false} otherwise (if it was not started).
+ */
+ public static boolean stop(boolean cancel) {
+ return stop(null, cancel);
+ }
+
+ /**
+ * Stops named grid. If {@code cancel} flag is set to {@code true} then
+ * all jobs currently executing on local node will be interrupted. If
+ * grid name is {@code null}, then default no-name grid will be stopped.
+ * If wait parameter is set to {@code true} then grid will wait for all
+ * tasks to be finished.
+ *
+ * @param name Grid name. If {@code null}, then default no-name grid will
+ * be stopped.
+ * @param cancel If {@code true} then all jobs currently will be cancelled
+ * by calling {@link org.apache.ignite.compute.ComputeJob#cancel()} method. Note that just like with
+ * {@link Thread#interrupt()}, it is up to the actual job to exit from
+ * execution. If {@code false}, then jobs currently running will not be
+ * canceled. In either case, grid node will wait for completion of all
+ * jobs running on it before stopping.
+ * @return {@code true} if named grid instance was indeed found and stopped,
+ * {@code false} otherwise (the instance with given {@code name} was
+ * not found).
+ */
+ public static boolean stop(@Nullable String name, boolean cancel) {
+ IgniteNamedInstance grid = name != null ? grids.get(name) : dfltGrid;
+
+ if (grid != null && grid.state() == STARTED) {
+ grid.stop(cancel);
+
+ boolean fireEvt;
+
+ if (name != null)
+ fireEvt = grids.remove(name, grid);
+ else {
+ synchronized (dfltGridMux) {
+ fireEvt = dfltGrid == grid;
+
+ if (fireEvt)
+ dfltGrid = null;
+ }
+ }
+
+ if (fireEvt)
+ notifyStateChange(grid.getName(), grid.state());
+
+ return true;
+ }
+
+ // We don't have log at this point...
+ U.warn(null, "Ignoring stopping grid instance that was already stopped or never started: " + name);
+
+ return false;
+ }
+
+ /**
+ * Stops <b>all</b> started grids. If {@code cancel} flag is set to {@code true} then
+ * all jobs currently executing on local node will be interrupted.
+ * If wait parameter is set to {@code true} then grid will wait for all
+ * tasks to be finished.
+ * <p>
+ * <b>Note:</b> it is usually safer and more appropriate to stop grid instances individually
+ * instead of blanket operation. In most cases, the party that started the grid instance
+ * should be responsible for stopping it.
+ *
+ * @param cancel If {@code true} then all jobs currently executing on
+ * all grids will be cancelled by calling {@link org.apache.ignite.compute.ComputeJob#cancel()}
+ * method. Note that just like with {@link Thread#interrupt()}, it is
+ * up to the actual job to exit from execution
+ */
+ public static void stopAll(boolean cancel) {
+ IgniteNamedInstance dfltGrid0 = dfltGrid;
+
+ if (dfltGrid0 != null) {
+ dfltGrid0.stop(cancel);
+
+ boolean fireEvt;
+
+ synchronized (dfltGridMux) {
+ fireEvt = dfltGrid == dfltGrid0;
+
+ if (fireEvt)
+ dfltGrid = null;
+ }
+
+ if (fireEvt)
+ notifyStateChange(dfltGrid0.getName(), dfltGrid0.state());
+ }
+
+ // Stop the rest and clear grids map.
+ for (IgniteNamedInstance grid : grids.values()) {
+ grid.stop(cancel);
+
+ boolean fireEvt = grids.remove(grid.getName(), grid);
+
+ if (fireEvt)
+ notifyStateChange(grid.getName(), grid.state());
+ }
+ }
+
+ /**
+ * Restarts <b>all</b> started grids. If {@code cancel} flag is set to {@code true} then
+ * all jobs currently executing on the local node will be interrupted.
+ * If {@code wait} parameter is set to {@code true} then grid will wait for all
+ * tasks to be finished.
+ * <p>
+ * <b>Note:</b> it is usually safer and more appropriate to stop grid instances individually
+ * instead of blanket operation. In most cases, the party that started the grid instance
+ * should be responsible for stopping it.
+ * <p>
+ * Note also that restarting functionality only works with the tools that specifically
+ * support GridGain's protocol for restarting. Currently only standard <tt>ggstart.{sh|bat}</tt>
+ * scripts support restarting of JVM GridGain's process.
+ *
+ * @param cancel If {@code true} then all jobs currently executing on
+ * all grids will be cancelled by calling {@link org.apache.ignite.compute.ComputeJob#cancel()}
+ * method. Note that just like with {@link Thread#interrupt()}, it is
+ * up to the actual job to exit from execution.
+ * @see org.apache.ignite.Ignition#RESTART_EXIT_CODE
+ */
+ public static void restart(boolean cancel) {
+ String file = System.getProperty(GG_SUCCESS_FILE);
+
+ if (file == null)
+ U.warn(null, "Cannot restart node when restart not enabled.");
+ else {
+ try {
+ new File(file).createNewFile();
+ }
+ catch (IOException e) {
+ U.error(null, "Failed to create restart marker file (restart aborted): " + e.getMessage());
+
+ return;
+ }
+
+ U.log(null, "Restarting node. Will exit (" + Ignition.RESTART_EXIT_CODE + ").");
+
+ // Set the exit code so that shell process can recognize it and loop
+ // the start up sequence again.
+ System.setProperty(GG_RESTART_CODE, Integer.toString(Ignition.RESTART_EXIT_CODE));
+
+ stopAll(cancel);
+
+ // This basically leaves loaders hang - we accept it.
+ System.exit(Ignition.RESTART_EXIT_CODE);
+ }
+ }
+
+ /**
+ * Stops <b>all</b> started grids. If {@code cancel} flag is set to {@code true} then
+ * all jobs currently executing on the local node will be interrupted.
+ * If {@code wait} parameter is set to {@code true} then grid will wait for all
+ * tasks to be finished.
+ * <p>
+ * <b>Note:</b> it is usually safer and more appropriate to stop grid instances individually
+ * instead of blanket operation. In most cases, the party that started the grid instance
+ * should be responsible for stopping it.
+ * <p>
+ * Note that upon completion of this method, the JVM with forcefully exist with
+ * exit code {@link org.apache.ignite.Ignition#KILL_EXIT_CODE}.
+ *
+ * @param cancel If {@code true} then all jobs currently executing on
+ * all grids will be cancelled by calling {@link org.apache.ignite.compute.ComputeJob#cancel()}
+ * method. Note that just like with {@link Thread#interrupt()}, it is
+ * up to the actual job to exit from execution.
+ * @see org.apache.ignite.Ignition#KILL_EXIT_CODE
+ */
+ public static void kill(boolean cancel) {
+ stopAll(cancel);
+
+ // This basically leaves loaders hang - we accept it.
+ System.exit(Ignition.KILL_EXIT_CODE);
+ }
+
+ /**
+ * Starts grid with default configuration. By default this method will
+ * use grid configuration defined in {@code GRIDGAIN_HOME/config/default-config.xml}
+ * configuration file. If such file is not found, then all system defaults will be used.
+ *
+ * @return Started grid.
+ * @throws IgniteCheckedException If default grid could not be started. This exception will be thrown
+ * also if default grid has already been started.
+ */
+ public static Ignite start() throws IgniteCheckedException {
+ return start((GridSpringResourceContext)null);
+ }
+
+ /**
+ * Starts grid with default configuration. By default this method will
+ * use grid configuration defined in {@code GRIDGAIN_HOME/config/default-config.xml}
+ * configuration file. If such file is not found, then all system defaults will be used.
+ *
+ * @param springCtx Optional Spring application context, possibly {@code null}.
+ * Spring bean definitions for bean injection are taken from this context.
+ * If provided, this context can be injected into grid tasks and grid jobs using
+ * {@link org.apache.ignite.resources.IgniteSpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation.
+ * @return Started grid.
+ * @throws IgniteCheckedException If default grid could not be started. This exception will be thrown
+ * also if default grid has already been started.
+ */
+ public static Ignite start(@Nullable GridSpringResourceContext springCtx) throws IgniteCheckedException {
+ URL url = U.resolveGridGainUrl(DFLT_CFG);
+
+ if (url != null)
+ return start(DFLT_CFG, null, springCtx);
+
+ U.warn(null, "Default Spring XML file not found (is GRIDGAIN_HOME set?): " + DFLT_CFG);
+
+ return start0(new GridStartContext(new IgniteConfiguration(), null, springCtx)).grid();
+ }
+
+ /**
+ * Starts grid with given configuration. Note that this method is no-op if grid with the name
+ * provided in given configuration is already started.
+ *
+ * @param cfg Grid configuration. This cannot be {@code null}.
+ * @return Started grid.
+ * @throws IgniteCheckedException If grid could not be started. This exception will be thrown
+ * also if named grid has already been started.
+ */
+ public static Ignite start(IgniteConfiguration cfg) throws IgniteCheckedException {
+ return start(cfg, null);
+ }
+
+ /**
+ * Starts grid with given configuration. Note that this method is no-op if grid with the name
+ * provided in given configuration is already started.
+ *
+ * @param cfg Grid configuration. This cannot be {@code null}.
+ * @param springCtx Optional Spring application context, possibly {@code null}.
+ * Spring bean definitions for bean injection are taken from this context.
+ * If provided, this context can be injected into grid tasks and grid jobs using
+ * {@link org.apache.ignite.resources.IgniteSpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation.
+ * @return Started grid.
+ * @throws IgniteCheckedException If grid could not be started. This exception will be thrown
+ * also if named grid has already been started.
+ */
+ public static Ignite start(IgniteConfiguration cfg, @Nullable GridSpringResourceContext springCtx) throws IgniteCheckedException {
+ A.notNull(cfg, "cfg");
+
+ return start0(new GridStartContext(cfg, null, springCtx)).grid();
+ }
+
+ /**
+ * Starts all grids specified within given Spring XML configuration file. If grid with given name
+ * is already started, then exception is thrown. In this case all instances that may
+ * have been started so far will be stopped too.
+ * <p>
+ * Usually Spring XML configuration file will contain only one Grid definition. Note that
+ * Grid configuration bean(s) is retrieved form configuration file by type, so the name of
+ * the Grid configuration bean is ignored.
+ *
+ * @param springCfgPath Spring XML configuration file path or URL.
+ * @return Started grid. If Spring configuration contains multiple grid instances,
+ * then the 1st found instance is returned.
+ * @throws IgniteCheckedException If grid could not be started or configuration
+ * read. This exception will be thrown also if grid with given name has already
+ * been started or Spring XML configuration file is invalid.
+ */
+ public static Ignite start(@Nullable String springCfgPath) throws IgniteCheckedException {
+ return springCfgPath == null ? start() : start(springCfgPath, null);
+ }
+
+ /**
+ * Starts all grids specified within given Spring XML configuration file. If grid with given name
+ * is already started, then exception is thrown. In this case all instances that may
+ * have been started so far will be stopped too.
+ * <p>
+ * Usually Spring XML configuration file will contain only one Grid definition. Note that
+ * Grid configuration bean(s) is retrieved form configuration file by type, so the name of
+ * the Grid configuration bean is ignored.
+ *
+ * @param springCfgPath Spring XML configuration file path or URL.
+ * @param gridName Grid name that will override default.
+ * @return Started grid. If Spring configuration contains multiple grid instances,
+ * then the 1st found instance is returned.
+ * @throws IgniteCheckedException If grid could not be started or configuration
+ * read. This exception will be thrown also if grid with given name has already
+ * been started or Spring XML configuration file is invalid.
+ */
+ public static Ignite start(@Nullable String springCfgPath, @Nullable String gridName) throws IgniteCheckedException {
+ if (springCfgPath == null) {
+ IgniteConfiguration cfg = new IgniteConfiguration();
+
+ if (cfg.getGridName() == null && !F.isEmpty(gridName))
+ cfg.setGridName(gridName);
+
+ return start(cfg);
+ }
+ else
+ return start(springCfgPath, gridName, null);
+ }
+
+ /**
+ * Start Grid for interop scenario.
+ *
+ * @param springCfgPath Spring config path.
+ * @param gridName Grid name.
+ * @param cfgClo Configuration closure.
+ * @return Started Grid.
+ * @throws IgniteCheckedException If failed.
+ */
+ public static Ignite startInterop(@Nullable String springCfgPath, @Nullable String gridName,
+ IgniteClosure<IgniteConfiguration, IgniteConfiguration> cfgClo) throws IgniteCheckedException {
+ URL url = resolveSpringUrl(springCfgPath);
+
+ return start(url, gridName, null, cfgClo);
+ }
+
+ /**
+ * Loads all grid configurations specified within given Spring XML configuration file.
+ * <p>
+ * Usually Spring XML configuration file will contain only one Grid definition. Note that
+ * Grid configuration bean(s) is retrieved form configuration file by type, so the name of
+ * the Grid configuration bean is ignored.
+ *
+ * @param springCfgUrl Spring XML configuration file path or URL. This cannot be {@code null}.
+ * @return Tuple containing all loaded configurations and Spring context used to load them.
+ * @throws IgniteCheckedException If grid could not be started or configuration
+ * read. This exception will be thrown also if grid with given name has already
+ * been started or Spring XML configuration file is invalid.
+ */
+ public static IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> loadConfigurations(
+ URL springCfgUrl) throws IgniteCheckedException {
+ IgniteSpringProcessor spring = SPRING.create(false);
+
+ return spring.loadConfigurations(springCfgUrl);
+ }
+
+ /**
+ * Loads all grid configurations specified within given Spring XML configuration file.
+ * <p>
+ * Usually Spring XML configuration file will contain only one Grid definition. Note that
+ * Grid configuration bean(s) is retrieved form configuration file by type, so the name of
+ * the Grid configuration bean is ignored.
+ *
+ * @param springCfgPath Spring XML configuration file path. This cannot be {@code null}.
+ * @return Tuple containing all loaded configurations and Spring context used to load them.
+ * @throws IgniteCheckedException If grid could not be started or configuration
+ * read. This exception will be thrown also if grid with given name has already
+ * been started or Spring XML configuration file is invalid.
+ */
+ public static IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> loadConfigurations(
+ String springCfgPath) throws IgniteCheckedException {
+ A.notNull(springCfgPath, "springCfgPath");
+
+ URL url;
+
+ try {
+ url = new URL(springCfgPath);
+ }
+ catch (MalformedURLException e) {
+ url = U.resolveGridGainUrl(springCfgPath);
+
+ if (url == null)
+ throw new IgniteCheckedException("Spring XML configuration path is invalid: " + springCfgPath +
+ ". Note that this path should be either absolute or a relative local file system path, " +
+ "relative to META-INF in classpath or valid URL to GRIDGAIN_HOME.", e);
+ }
+
+ return loadConfigurations(url);
+ }
+
+ /**
+ * Loads first found grid configuration specified within given Spring XML configuration file.
+ * <p>
+ * Usually Spring XML configuration file will contain only one Grid definition. Note that
+ * Grid configuration bean(s) is retrieved form configuration file by type, so the name of
+ * the Grid configuration bean is ignored.
+ *
+ * @param springCfgUrl Spring XML configuration file path or URL. This cannot be {@code null}.
+ * @return First found configuration and Spring context used to load it.
+ * @throws IgniteCheckedException If grid could not be started or configuration
+ * read. This exception will be thrown also if grid with given name has already
+ * been started or Spring XML configuration file is invalid.
+ */
+ public static IgniteBiTuple<IgniteConfiguration, GridSpringResourceContext> loadConfiguration(URL springCfgUrl)
+ throws IgniteCheckedException {
+ IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> t = loadConfigurations(springCfgUrl);
+
+ return F.t(F.first(t.get1()), t.get2());
+ }
+
+ /**
+ * Loads first found grid configuration specified within given Spring XML configuration file.
+ * <p>
+ * Usually Spring XML configuration file will contain only one Grid definition. Note that
+ * Grid configuration bean(s) is retrieved form configuration file by type, so the name of
+ * the Grid configuration bean is ignored.
+ *
+ * @param springCfgPath Spring XML configuration file path. This cannot be {@code null}.
+ * @return First found configuration and Spring context used to load it.
+ * @throws IgniteCheckedException If grid could not be started or configuration
+ * read. This exception will be thrown also if grid with given name has already
+ * been started or Spring XML configuration file is invalid.
+ */
+ public static IgniteBiTuple<IgniteConfiguration, GridSpringResourceContext> loadConfiguration(String springCfgPath)
+ throws IgniteCheckedException {
+ IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> t =
+ loadConfigurations(springCfgPath);
+
+ return F.t(F.first(t.get1()), t.get2());
+ }
+
+ /**
+ * Starts all grids specified within given Spring XML configuration file. If grid with given name
+ * is already started, then exception is thrown. In this case all instances that may
+ * have been started so far will be stopped too.
+ * <p>
+ * Usually Spring XML configuration file will contain only one Grid definition. Note that
+ * Grid configuration bean(s) is retrieved form configuration file by type, so the name of
+ * the Grid configuration bean is ignored.
+ *
+ * @param springCfgPath Spring XML configuration file path or URL. This cannot be {@code null}.
+ * @param gridName Grid name that will override default.
+ * @param springCtx Optional Spring application context, possibly {@code null}.
+ * Spring bean definitions for bean injection are taken from this context.
+ * If provided, this context can be injected into grid tasks and grid jobs using
+ * {@link org.apache.ignite.resources.IgniteSpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation.
+ * @return Started grid. If Spring configuration contains multiple grid instances,
+ * then the 1st found instance is returned.
+ * @throws IgniteCheckedException If grid could not be started or configuration
+ * read. This exception will be thrown also if grid with given name has already
+ * been started or Spring XML configuration file is invalid.
+ */
+ public static Ignite start(String springCfgPath, @Nullable String gridName,
+ @Nullable GridSpringResourceContext springCtx) throws IgniteCheckedException {
+ URL url = resolveSpringUrl(springCfgPath);
+
+ return start(url, gridName, springCtx);
+ }
+
+ /**
+ * Starts all grids specified within given Spring XML configuration file URL. If grid with given name
+ * is already started, then exception is thrown. In this case all instances that may
+ * have been started so far will be stopped too.
+ * <p>
+ * Usually Spring XML configuration file will contain only one Grid definition. Note that
+ * Grid configuration bean(s) is retrieved form configuration file by type, so the name of
+ * the Grid configuration bean is ignored.
+ *
+ * @param springCfgUrl Spring XML configuration file URL. This cannot be {@code null}.
+ * @return Started grid. If Spring configuration contains multiple grid instances,
+ * then the 1st found instance is returned.
+ * @throws IgniteCheckedException If grid could not be started or configuration
+ * read. This exception will be thrown also if grid with given name has already
+ * been started or Spring XML configuration file is invalid.
+ */
+ public static Ignite start(URL springCfgUrl) throws IgniteCheckedException {
+ return start(springCfgUrl, null, null);
+ }
+
+ /**
+ * Starts all grids specified within given Spring XML configuration file URL. If grid with given name
+ * is already started, then exception is thrown. In this case all instances that may
+ * have been started so far will be stopped too.
+ * <p>
+ * Usually Spring XML configuration file will contain only one Grid definition. Note that
+ * Grid configuration bean(s) is retrieved form configuration file by type, so the name of
+ * the Grid configuration bean is ignored.
+ *
+ * @param springCfgUrl Spring XML configuration file URL. This cannot be {@code null}.
+ * @param gridName Grid name that will override default.
+ * @param springCtx Optional Spring application context, possibly {@code null}.
+ * Spring bean definitions for bean injection are taken from this context.
+ * If provided, this context can be injected into grid tasks and grid jobs using
+ * {@link org.apache.ignite.resources.IgniteSpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation.
+ * @return Started grid. If Spring configuration contains multiple grid instances,
+ * then the 1st found instance is returned.
+ * @throws IgniteCheckedException If grid could not be started or configuration
+ * read. This exception will be thrown also if grid with given name has already
+ * been started or Spring XML configuration file is invalid.
+ */
+ public static Ignite start(URL springCfgUrl, @Nullable String gridName,
+ @Nullable GridSpringResourceContext springCtx) throws IgniteCheckedException {
+ return start(springCfgUrl, gridName, springCtx, null);
+ }
+
+ /**
+ * Internal Spring-based start routine.
+ *
+ * @param springCfgUrl Spring XML configuration file URL. This cannot be {@code null}.
+ * @param gridName Grid name that will override default.
+ * @param springCtx Optional Spring application context.
+ * @param cfgClo Optional closure to change configuration before it is used to start the grid.
+ * @return Started grid.
+ * @throws IgniteCheckedException If failed.
+ */
+ private static Ignite start(URL springCfgUrl, @Nullable String gridName,
+ @Nullable GridSpringResourceContext springCtx,
+ @Nullable IgniteClosure<IgniteConfiguration, IgniteConfiguration> cfgClo)
+ throws IgniteCheckedException {
+ A.notNull(springCfgUrl, "springCfgUrl");
+
+ boolean isLog4jUsed = U.gridClassLoader().getResource("org/apache/log4j/Appender.class") != null;
+
+ IgniteBiTuple<Object, Object> t = null;
+
+ Collection<Handler> savedHnds = null;
+
+ if (isLog4jUsed)
+ t = U.addLog4jNoOpLogger();
+ else
+ savedHnds = U.addJavaNoOpLogger();
+
+ IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> cfgMap;
+
+ try {
+ cfgMap = loadConfigurations(springCfgUrl);
+ }
+ finally {
+ if (isLog4jUsed && t != null)
+ U.removeLog4jNoOpLogger(t);
+
+ if (!isLog4jUsed)
+ U.removeJavaNoOpLogger(savedHnds);
+ }
+
+ List<IgniteNamedInstance> grids = new ArrayList<>(cfgMap.size());
+
+ try {
+ for (IgniteConfiguration cfg : cfgMap.get1()) {
+ assert cfg != null;
+
+ if (cfg.getGridName() == null && !F.isEmpty(gridName))
+ cfg.setGridName(gridName);
+
+ if (cfgClo != null) {
+ cfg = cfgClo.apply(cfg);
+
+ assert cfg != null;
+ }
+
+ // Use either user defined context or our one.
+ IgniteNamedInstance grid = start0(
+ new GridStartContext(cfg, springCfgUrl, springCtx == null ? cfgMap.get2() : springCtx));
+
+ // Add it if it was not stopped during startup.
+ if (grid != null)
+ grids.add(grid);
+ }
+ }
+ catch (IgniteCheckedException e) {
+ // Stop all instances started so far.
+ for (IgniteNamedInstance grid : grids) {
+ try {
+ grid.stop(true);
+ }
+ catch (Exception e1) {
+ U.error(grid.log, "Error when stopping grid: " + grid, e1);
+ }
+ }
+
+ throw e;
+ }
+
+ // Return the first grid started.
+ IgniteNamedInstance res = !grids.isEmpty() ? grids.get(0) : null;
+
+ return res != null ? res.grid() : null;
+ }
+
+ /**
+ * Resolve Spring configuration URL.
+ *
+ * @param springCfgPath Spring XML configuration file path or URL. This cannot be {@code null}.
+ * @return URL.
+ * @throws IgniteCheckedException If failed.
+ */
+ private static URL resolveSpringUrl(String springCfgPath) throws IgniteCheckedException {
+ A.notNull(springCfgPath, "springCfgPath");
+
+ URL url;
+
+ try {
+ url = new URL(springCfgPath);
+ }
+ catch (MalformedURLException e) {
+ url = U.resolveGridGainUrl(springCfgPath);
+
+ if (url == null)
+ throw new IgniteCheckedException("Spring XML configuration path is invalid: " + springCfgPath +
+ ". Note that this path should be either absolute or a relative local file system path, " +
+ "relative to META-INF in classpath or valid URL to GRIDGAIN_HOME.", e);
+ }
+
+ return url;
+ }
+
+ /**
+ * Starts grid with given configuration.
+ *
+ * @param startCtx Start context.
+ * @return Started grid.
+ * @throws IgniteCheckedException If grid could not be started.
+ */
+ private static IgniteNamedInstance start0(GridStartContext startCtx) throws IgniteCheckedException {
+ assert startCtx != null;
+
+ String name = startCtx.config().getGridName();
+
+ if (name != null && name.isEmpty())
+ throw new IgniteCheckedException("Non default grid instances cannot have empty string name.");
+
+ IgniteNamedInstance grid = new IgniteNamedInstance(name);
+
+ IgniteNamedInstance old;
+
+ if (name != null)
+ old = grids.putIfAbsent(name, grid);
+ else {
+ synchronized (dfltGridMux) {
+ old = dfltGrid;
+
+ if (old == null)
+ dfltGrid = grid;
+ }
+ }
+
+ if (old != null) {
+ if (name == null)
+ throw new IgniteCheckedException("Default grid instance has already been started.");
+ else
+ throw new IgniteCheckedException("Grid instance with this name has already been started: " + name);
+ }
+
+ if (startCtx.config().getWarmupClosure() != null)
+ startCtx.config().getWarmupClosure().apply(startCtx.config());
+
+ startCtx.single(grids.size() == 1);
+
+ boolean success = false;
+
+ try {
+ grid.start(startCtx);
+
+ notifyStateChange(name, STARTED);
+
+ success = true;
+ }
+ finally {
+ if (!success) {
+ if (name != null)
+ grids.remove(name, grid);
+ else {
+ synchronized (dfltGridMux) {
+ if (dfltGrid == grid)
+ dfltGrid = null;
+ }
+ }
+
+ grid = null;
+ }
+ }
+
+ if (grid == null)
+ throw new IgniteCheckedException("Failed to start grid with provided configuration.");
+
+ return grid;
+ }
+
+ /**
+ * Gets an instance of default no-name grid. Note that
+ * caller of this method should not assume that it will return the same
+ * instance every time.
+ * <p>
+ * This method is identical to {@code G.grid(null)} apply.
+ *
+ * @return An instance of default no-name grid. This method never returns
+ * {@code null}.
+ * @throws org.apache.ignite.IgniteIllegalStateException Thrown if default grid was not properly
+ * initialized or grid instance was stopped or was not started.
+ */
+ public static Ignite grid() throws IgniteIllegalStateException {
+ return grid((String)null);
+ }
+
+ /**
+ * Gets a list of all grids started so far.
+ *
+ * @return List of all grids started so far.
+ */
+ public static List<Ignite> allGrids() {
+ List<Ignite> allIgnites = new ArrayList<>(grids.size() + 1);
+
+ for (IgniteNamedInstance grid : grids.values()) {
+ Ignite g = grid.grid();
+
+ if (g != null)
+ allIgnites.add(g);
+ }
+
+ IgniteNamedInstance dfltGrid0 = dfltGrid;
+
+ if (dfltGrid0 != null) {
+ IgniteKernal g = dfltGrid0.grid();
+
+ if (g != null)
+ allIgnites.add(g);
+ }
+
+ return allIgnites;
+ }
+
+ /**
+ * Gets a grid instance for given local node ID. Note that grid instance and local node have
+ * one-to-one relationship where node has ID and instance has name of the grid to which
+ * both grid instance and its node belong. Note also that caller of this method
+ * should not assume that it will return the same instance every time.
+ *
+ * @param locNodeId ID of local node the requested grid instance is managing.
+ * @return An instance of named grid. This method never returns
+ * {@code null}.
+ * @throws org.apache.ignite.IgniteIllegalStateException Thrown if grid was not properly
+ * initialized or grid instance was stopped or was not started.
+ */
+ public static Ignite grid(UUID locNodeId) throws IgniteIllegalStateException {
+ A.notNull(locNodeId, "locNodeId");
+
+ IgniteNamedInstance dfltGrid0 = dfltGrid;
+
+ if (dfltGrid0 != null) {
+ IgniteKernal g = dfltGrid0.grid();
+
+ if (g != null && g.getLocalNodeId().equals(locNodeId))
+ return g;
+ }
+
+ for (IgniteNamedInstance grid : grids.values()) {
+ IgniteKernal g = grid.grid();
+
+ if (g != null && g.getLocalNodeId().equals(locNodeId))
+ return g;
+ }
+
+ throw new IgniteIllegalStateException("Grid instance with given local node ID was not properly " +
+ "started or was stopped: " + locNodeId);
+ }
+
+ /**
+ * Gets an named grid instance. If grid name is {@code null} or empty string,
+ * then default no-name grid will be returned. Note that caller of this method
+ * should not assume that it will return the same instance every time.
+ * <p>
+ * Note that Java VM can run multiple grid instances and every grid instance (and its
+ * node) can belong to a different grid. Grid name defines what grid a particular grid
+ * instance (and correspondingly its node) belongs to.
+ *
+ * @param name Grid name to which requested grid instance belongs to. If {@code null},
+ * then grid instance belonging to a default no-name grid will be returned.
+ * @return An instance of named grid. This method never returns
+ * {@code null}.
+ * @throws org.apache.ignite.IgniteIllegalStateException Thrown if default grid was not properly
+ * initialized or grid instance was stopped or was not started.
+ */
+ public static Ignite grid(@Nullable String name) throws IgniteIllegalStateException {
+ IgniteNamedInstance grid = name != null ? grids.get(name) : dfltGrid;
+
+ Ignite res;
+
+ if (grid == null || (res = grid.grid()) == null)
+ throw new IgniteIllegalStateException("Grid instance was not properly started " +
+ "or was already stopped: " + name);
+
+ return res;
+ }
+
+ /**
+ * Gets grid instance without waiting its initialization.
+ *
+ * @param name Grid name.
+ * @return Grid instance.
+ */
+ public static IgniteKernal gridx(@Nullable String name) {
+ IgniteNamedInstance grid = name != null ? grids.get(name) : dfltGrid;
+
+ IgniteKernal res;
+
+ if (grid == null || (res = grid.gridx()) == null)
+ throw new IllegalStateException("Grid instance was not properly started or was already stopped: " + name);
+
+ return res;
+ }
+
+ /**
+ * Adds a lsnr for grid life cycle events.
+ * <p>
+ * Note that unlike other listeners in GridGain this listener will be
+ * notified from the same thread that triggers the state change. Because of
+ * that it is the responsibility of the user to make sure that listener logic
+ * is light-weight and properly handles (catches) any runtime exceptions, if any
+ * are expected.
+ *
+ * @param lsnr Listener for grid life cycle events. If this listener was already added
+ * this method is no-op.
+ */
+ public static void addListener(IgniteListener lsnr) {
+ A.notNull(lsnr, "lsnr");
+
+ lsnrs.add(lsnr);
+ }
+
+ /**
+ * Removes lsnr added by {@link #addListener(org.apache.ignite.lifecycle.IgniteListener)} method.
+ *
+ * @param lsnr Listener to remove.
+ * @return {@code true} if lsnr was added before, {@code false} otherwise.
+ */
+ public static boolean removeListener(IgniteListener lsnr) {
+ A.notNull(lsnr, "lsnr");
+
+ return lsnrs.remove(lsnr);
+ }
+
+ /**
+ * @param gridName Grid instance name.
+ * @param state Factory state.
+ */
+ private static void notifyStateChange(@Nullable String gridName, IgniteState state) {
+ if (gridName != null)
+ gridStates.put(gridName, state);
+ else
+ dfltGridState = state;
+
+ for (IgniteListener lsnr : lsnrs)
+ lsnr.onStateChange(gridName, state);
+ }
+
+ /**
+ * Start context encapsulates all starting parameters.
+ */
+ private static final class GridStartContext {
+ /** User-defined configuration. */
+ private IgniteConfiguration cfg;
+
+ /** Optional configuration path. */
+ private URL cfgUrl;
+
+ /** Optional Spring application context. */
+ private GridSpringResourceContext springCtx;
+
+ /** Whether or not this is a single grid instance in current VM. */
+ private boolean single;
+
+ /**
+ *
+ * @param cfg User-defined configuration.
+ * @param cfgUrl Optional configuration path.
+ * @param springCtx Optional Spring application context.
+ */
+ GridStartContext(IgniteConfiguration cfg, @Nullable URL cfgUrl, @Nullable GridSpringResourceContext springCtx) {
+ assert(cfg != null);
+
+ this.cfg = cfg;
+ this.cfgUrl = cfgUrl;
+ this.springCtx = springCtx;
+ }
+
+ /**
+ * @return Whether or not this is a single grid instance in current VM.
+ */
+ public boolean single() {
+ return single;
+ }
+
+ /**
+ * @param single Whether or not this is a single grid instance in current VM.
+ */
+ public void single(boolean single) {
+ this.single = single;
+ }
+
+ /**
+ * @return User-defined configuration.
+ */
+ IgniteConfiguration config() {
+ return cfg;
+ }
+
+ /**
+ * @param cfg User-defined configuration.
+ */
+ void config(IgniteConfiguration cfg) {
+ this.cfg = cfg;
+ }
+
+ /**
+ * @return Optional configuration path.
+ */
+ URL configUrl() {
+ return cfgUrl;
+ }
+
+ /**
+ * @param cfgUrl Optional configuration path.
+ */
+ void configUrl(URL cfgUrl) {
+ this.cfgUrl = cfgUrl;
+ }
+
+ /**
+ * @return Optional Spring application context.
+ */
+ public GridSpringResourceContext springContext() {
+ return springCtx;
+ }
+ }
+
+ /**
+ * Grid data container.
+ */
+ private static final class IgniteNamedInstance {
+ /** Map of registered MBeans. */
+ private static final Map<MBeanServer, GridMBeanServerData> mbeans =
+ new HashMap<>();
+
+ /** */
+ private static final String[] EMPTY_STR_ARR = new String[0];
+
+ /** Empty array of caches. */
+ private static final CacheConfiguration[] EMPTY_CACHE_CONFIGS = new CacheConfiguration[0];
+
+ /** Grid name. */
+ private final String name;
+
+ /** Grid instance. */
+ private volatile IgniteKernal grid;
+
+ /** Executor service. */
+ private ExecutorService execSvc;
+
+ /** Auto executor service flag. */
+ private boolean isAutoExecSvc;
+
+ /** Executor service shutdown flag. */
+ private boolean execSvcShutdown;
+
+ /** System executor service. */
+ private ExecutorService sysExecSvc;
+
+ /** Auto system service flag. */
+ private boolean isAutoSysSvc;
+
+ /** System executor service shutdown flag. */
+ private boolean sysSvcShutdown;
+
+ /** Management executor service. */
+ private ExecutorService mgmtExecSvc;
+
+ /** Auto management service flag. */
+ private boolean isAutoMgmtSvc;
+
+ /** Management executor service shutdown flag. */
+ private boolean mgmtSvcShutdown;
+
+ /** P2P executor service. */
+ private ExecutorService p2pExecSvc;
+
+ /** Auto P2P service flag. */
+ private boolean isAutoP2PSvc;
+
+ /** P2P executor service shutdown flag. */
+ private boolean p2pSvcShutdown;
+
+ /** GGFS executor service. */
+ private ExecutorService ggfsExecSvc;
+
+ /** Auto GGFS service flag. */
+ private boolean isAutoGgfsSvc;
+
+ /** GGFS executor service shutdown flag. */
+ private boolean ggfsSvcShutdown;
+
+ /** REST requests executor service. */
+ private ExecutorService restExecSvc;
+
+ /** Auto REST service flag. */
+ private boolean isAutoRestSvc;
+
+ /** REST executor service shutdown flag. */
+ private boolean restSvcShutdown;
+
+ /** Utility cache executor service. */
+ private ExecutorService utilityCacheExecSvc;
+
+ /** Grid state. */
+ private volatile IgniteState state = STOPPED;
+
+ /** Shutdown hook. */
+ private Thread shutdownHook;
+
+ /** Grid log. */
+ private IgniteLogger log;
+
+ /** Start guard. */
+ private final AtomicBoolean startGuard = new AtomicBoolean();
+
+ /** Start latch. */
+ private final CountDownLatch startLatch = new CountDownLatch(1);
+
+ /**
+ * Thread that starts this named instance. This field can be non-volatile since
+ * it makes sense only for thread where it was originally initialized.
+ */
+ @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
+ private Thread starterThread;
+
+ /**
+ * Creates un-started named instance.
+ *
+ * @param name Grid name (possibly {@code null} for default grid).
+ */
+ IgniteNamedInstance(@Nullable String name) {
+ this.name = name;
+ }
+
+ /**
+ * Gets grid name.
+ *
+ * @return Grid name.
+ */
+ String getName() {
+ return name;
+ }
+
+ /**
+ * Gets grid instance.
+ *
+ * @return Grid instance.
+ */
+ IgniteKernal grid() {
+ if (starterThread != Thread.currentThread())
+ U.awaitQuiet(startLatch);
+
+ return grid;
+ }
+
+ /**
+ * Gets grid instance without waiting for its initialization.
+ *
+ * @return Grid instance.
+ */
+ public IgniteKernal gridx() {
+ return grid;
+ }
+
+ /**
+ * Gets grid state.
+ *
+ * @return Grid state.
+ */
+ IgniteState state() {
+ if (starterThread != Thread.currentThread())
+ U.awaitQuiet(startLatch);
+
+ return state;
+ }
+
+ /**
+ * @param spi SPI implementation.
+ * @throws IgniteCheckedException Thrown in case if multi-instance is not supported.
+ */
+ private void ensureMultiInstanceSupport(IgniteSpi spi) throws IgniteCheckedException {
+ IgniteSpiMultipleInstancesSupport ann = U.getAnnotation(spi.getClass(),
+ IgniteSpiMultipleInstancesSupport.class);
+
+ if (ann == null || !ann.value())
+ throw new IgniteCheckedException("SPI implementation doesn't support multiple grid instances in " +
+ "the same VM: " + spi);
+ }
+
+ /**
+ * @param spis SPI implementations.
+ * @throws IgniteCheckedException Thrown in case if multi-instance is not supported.
+ */
+ private void ensureMultiInstanceSupport(IgniteSpi[] spis) throws IgniteCheckedException {
+ for (IgniteSpi spi : spis)
+ ensureMultiInstanceSupport(spi);
+ }
+
+ /**
+ * Starts grid with given configuration.
+ *
+ * @param startCtx Starting context.
+ * @throws IgniteCheckedException If start failed.
+ */
+ synchronized void start(GridStartContext startCtx) throws IgniteCheckedException {
+ if (startGuard.compareAndSet(false, true)) {
+ try {
+ starterThread = Thread.currentThread();
+
+ start0(startCtx);
+ }
+ catch (Exception e) {
+ if (log != null)
+ stopExecutors(log);
+
+ throw e;
+ }
+ finally {
+ startLatch.countDown();
+ }
+ }
+ else
+ U.awaitQuiet(startLatch);
+ }
+
+ /**
+ * @param startCtx Starting context.
+ * @throws IgniteCheckedException If start failed.
+ */
+ @SuppressWarnings({"unchecked", "TooBroadScope"})
+ private void start0(GridStartContext startCtx) throws IgniteCheckedException {
+ assert grid == null : "Grid is already started: " + name;
+
+ IgniteConfiguration cfg = startCtx.config();
+
+ if (cfg == null)
+ cfg = new IgniteConfiguration();
+
+ IgniteConfiguration myCfg = new IgniteConfiguration();
+
+ String ggHome = cfg.getGridGainHome();
+
+ // Set GridGain home.
+ if (ggHome == null)
+ ggHome = U.getGridGainHome();
+ else
+ // If user provided GRIDGAIN_HOME - set it as a system property.
+ U.setGridGainHome(ggHome);
+
+ U.setWorkDirectory(cfg.getWorkDirectory(), ggHome);
+
+ /*
+ * Set up all defaults and perform all checks.
+ */
+
+ // Ensure invariant.
+ // It's a bit dirty - but this is a result of late refactoring
+ // and I don't want to reshuffle a lot of code.
+ assert F.eq(name, cfg.getGridName());
+
+ // Set configuration URL, if any, into system property.
+ if (startCtx.configUrl() != null)
+ System.setProperty(GG_CONFIG_URL, startCtx.configUrl().toString());
+
+ myCfg.setGridName(cfg.getGridName());
+
+ UUID nodeId = cfg.getNodeId();
+
+ if (nodeId == null)
+ nodeId = UUID.randomUUID();
+
+ IgniteLogger cfgLog = initLogger(cfg.getGridLogger(), nodeId);
+
+ assert cfgLog != null;
+
+ cfgLog = new GridLoggerProxy(cfgLog, null, name, U.id8(nodeId));
+
+ // Initialize factory's log.
+ log = cfgLog.getLogger(G.class);
+
+ // Check GridGain home folder (after log is available).
+ if (ggHome != null) {
+ File ggHomeFile = new File(ggHome);
+
+ if (!ggHomeFile.exists() || !ggHomeFile.isDirectory())
+ throw new IgniteCheckedException("Invalid GridGain installation home folder: " + ggHome);
+ }
+
+ myCfg.setGridGainHome(ggHome);
+
+ // Copy values that don't need extra processing.
+ myCfg.setLicenseUrl(cfg.getLicenseUrl());
+ myCfg.setPeerClassLoadingEnabled(cfg.isPeerClassLoadingEnabled());
+ myCfg.setDeploymentMode(cfg.getDeploymentMode());
+ myCfg.setNetworkTimeout(cfg.getNetworkTimeout());
+ myCfg.setClockSyncSamples(cfg.getClockSyncSamples());
+ myCfg.setClockSyncFrequency(cfg.getClockSyncFrequency());
+ myCfg.setDiscoveryStartupDelay(cfg.getDiscoveryStartupDelay());
+ myCfg.setMetricsHistorySize(cfg.getMetricsHistorySize());
+ myCfg.setMetricsExpireTime(cfg.getMetricsExpireTime());
+ myCfg.setMetricsUpdateFrequency(cfg.getMetricsUpdateFrequency());
+ myCfg.setLifecycleBeans(cfg.getLifecycleBeans());
+ myCfg.setLocalEventListeners(cfg.getLocalEventListeners());
+ myCfg.setPeerClassLoadingMissedResourcesCacheSize(cfg.getPeerClassLoadingMissedResourcesCacheSize());
+ myCfg.setIncludeEventTypes(cfg.getIncludeEventTypes());
+ myCfg.setDaemon(cfg.isDaemon());
+ myCfg.setIncludeProperties(cfg.getIncludeProperties());
+ myCfg.setLifeCycleEmailNotification(cfg.isLifeCycleEmailNotification());
+ myCfg.setMetricsLogFrequency(cfg.getMetricsLogFrequency());
+ myCfg.setNetworkSendRetryDelay(cfg.getNetworkSendRetryDelay());
+ myCfg.setNetworkSendRetryCount(cfg.getNetworkSendRetryCount());
+ myCfg.setSecurityCredentialsProvider(cfg.getSecurityCredentialsProvider());
+ myCfg.setServiceConfiguration(cfg.getServiceConfiguration());
+ myCfg.setWarmupClosure(cfg.getWarmupClosure());
+ myCfg.setInteropConfiguration(cfg.getInteropConfiguration());
+ myCfg.setPluginConfigurations(cfg.getPluginConfigurations());
+ myCfg.setTransactionsConfiguration(new TransactionsConfiguration(cfg.getTransactionsConfiguration()));
+ myCfg.setQueryConfiguration(cfg.getQueryConfiguration());
+
+ ClientConnectionConfiguration clientCfg = cfg.getClientConnectionConfiguration();
+
+ if (clientCfg == null) {
+ // If client config is not provided then create config copying values from GridConfiguration.
+ if (cfg.isRestEnabled()) {
+ clientCfg = new ClientConnectionConfiguration();
+
+ clientCfg.setClientMessageInterceptor(cfg.getClientMessageInterceptor());
+ clientCfg.setRestAccessibleFolders(cfg.getRestAccessibleFolders());
+ clientCfg.setRestExecutorService(cfg.getRestExecutorService());
+ clientCfg.setRestExecutorServiceShutdown(cfg.getRestExecutorServiceShutdown());
+ clientCfg.setRestIdleTimeout(cfg.getRestIdleTimeout());
+ clientCfg.setRestJettyPath(cfg.getRestJettyPath());
+ clientCfg.setRestPortRange(cfg.getRestPortRange());
+ clientCfg.setRestSecretKey(cfg.getRestSecretKey());
+ clientCfg.setRestTcpDirectBuffer(cfg.isRestTcpDirectBuffer());
+ clientCfg.setRestTcpHost(cfg.getRestTcpHost());
+ clientCfg.setRestTcpNoDelay(cfg.isRestTcpNoDelay());
+ clientCfg.setRestTcpPort(cfg.getRestTcpPort());
+ clientCfg.setRestTcpReceiveBufferSize(cfg.getRestTcpReceiveBufferSize());
+ clientCfg.setRestTcpSelectorCount(cfg.getRestTcpSelectorCount());
+ clientCfg.setRestTcpSendBufferSize(cfg.getRestTcpSendBufferSize());
+ clientCfg.setRestTcpSendQueueLimit(cfg.getRestTcpSendQueueLimit());
+ clientCfg.setRestTcpSslClientAuth(cfg.isRestTcpSslClientAuth());
+ clientCfg.setRestTcpSslContextFactory(cfg.getRestTcpSslContextFactory());
+ clientCfg.setRestTcpSslEnabled(cfg.isRestTcpSslEnabled());
+ }
+ }
+ else
+ clientCfg = new ClientConnectionConfiguration(clientCfg);
+
+
+ String ntfStr = IgniteSystemProperties.getString(GG_LIFECYCLE_EMAIL_NOTIFY);
+
+ if (ntfStr != null)
+ myCfg.setLifeCycleEmailNotification(Boolean.parseBoolean(ntfStr));
+
+ // Local host.
+ String locHost = IgniteSystemProperties.getString(GG_LOCAL_HOST);
+
+ myCfg.setLocalHost(F.isEmpty(locHost) ? cfg.getLocalHost() : locHost);
+
+ // Override daemon flag if it was set on the factory.
+ if (daemon)
+ myCfg.setDaemon(true);
+
+ // Check for deployment mode override.
+ String depModeName = IgniteSystemProperties.getString(GG_DEP_MODE_OVERRIDE);
+
+ if (!F.isEmpty(depModeName)) {
+ if (!F.isEmpty(cfg.getCacheConfiguration())) {
+ U.quietAndInfo(log, "Skipping deployment mode override for caches (custom closure " +
+ "execution may not work for console Visor)");
+ }
+ else {
+ try {
+ IgniteDeploymentMode depMode = IgniteDeploymentMode.valueOf(depModeName);
+
+ if (myCfg.getDeploymentMode() != depMode)
+ myCfg.setDeploymentMode(depMode);
+ }
+ catch (IllegalArgumentException e) {
+ throw new IgniteCheckedException("Failed to override deployment mode using system property " +
+ "(are there any misspellings?)" +
+ "[name=" + GG_DEP_MODE_OVERRIDE + ", value=" + depModeName + ']', e);
+ }
+ }
+ }
+
+ Map<String, ?> attrs = cfg.getUserAttributes();
+
+ if (attrs == null)
+ attrs = Collections.emptyMap();
+
+ MBeanServer mbSrv = cfg.getMBeanServer();
+
+ IgniteMarshaller marsh = cfg.getMarshaller();
+
+ String[] p2pExclude = cfg.getPeerClassLoadingLocalClassPathExclude();
+
+ CommunicationSpi commSpi = cfg.getCommunicationSpi();
+ DiscoverySpi discoSpi = cfg.getDiscoverySpi();
+ EventStorageSpi evtSpi = cfg.getEventStorageSpi();
+ CollisionSpi colSpi = cfg.getCollisionSpi();
+ AuthenticationSpi authSpi = cfg.getAuthenticationSpi();
+ SecureSessionSpi sesSpi = cfg.getSecureSessionSpi();
+ DeploymentSpi deploySpi = cfg.getDeploymentSpi();
+ CheckpointSpi[] cpSpi = cfg.getCheckpointSpi();
+ FailoverSpi[] failSpi = cfg.getFailoverSpi();
+ LoadBalancingSpi[] loadBalancingSpi = cfg.getLoadBalancingSpi();
+ SwapSpaceSpi swapspaceSpi = cfg.getSwapSpaceSpi();
+ GridIndexingSpi indexingSpi = cfg.getIndexingSpi();
+
+ execSvc = cfg.getExecutorService();
+ sysExecSvc = cfg.getSystemExecutorService();
+ p2pExecSvc = cfg.getPeerClassLoadingExecutorService();
+ mgmtExecSvc = cfg.getManagementExecutorService();
+ ggfsExecSvc = cfg.getGgfsExecutorService();
+
+ if (execSvc == null) {
+ isAutoExecSvc = true;
+
+ execSvc = new IgniteThreadPoolExecutor(
+ "pub-" + cfg.getGridName(),
+ DFLT_PUBLIC_CORE_THREAD_CNT,
+ DFLT_PUBLIC_MAX_THREAD_CNT,
+ DFLT_PUBLIC_KEEP_ALIVE_TIME,
+ new LinkedBlockingQueue<Runnable>(DFLT_PUBLIC_THREADPOOL_QUEUE_CAP));
+
+ // Pre-start all threads as they are guaranteed to be needed.
+ ((ThreadPoolExecutor)execSvc).prestartAllCoreThreads();
+ }
+
+ if (sysExecSvc == null) {
+ isAutoSysSvc = true;
+
+ // Note that since we use 'LinkedBlockingQueue', number of
+ // maximum threads has no effect.
+ sysExecSvc = new IgniteThreadPoolExecutor(
+ "sys-" + cfg.getGridName(),
+ DFLT_SYSTEM_CORE_THREAD_CNT,
+ DFLT_SYSTEM_MAX_THREAD_CNT,
+ DFLT_SYSTEM_KEEP_ALIVE_TIME,
+ new LinkedBlockingQueue<Runnable>(DFLT_SYSTEM_THREADPOOL_QUEUE_CAP));
+
+ // Pre-start all threads as they are guaranteed to be needed.
+ ((ThreadPoolExecutor)sysExecSvc).prestartAllCoreThreads();
+ }
+
+ if (mgmtExecSvc == null) {
+ isAutoMgmtSvc = true;
+
+ // Note that since we use 'LinkedBlockingQueue', number of
+ // maximum threads has no effect.
+ // Note, that we do not pre-start threads here as management pool may
+ // not be needed.
+ mgmtExecSvc = new IgniteThreadPoolExecutor(
+ "mgmt-" + cfg.getGridName(),
+ DFLT_MGMT_THREAD_CNT,
+ DFLT_MGMT_THREAD_CNT,
+ 0,
+ new LinkedBlockingQueue<Runnable>());
+ }
+
+ if (p2pExecSvc == null) {
+ isAutoP2PSvc = true;
+
+ // Note that since we use 'LinkedBlockingQueue', number of
+ // maximum threads has no effect.
+ // Note, that we do not pre-start threads here as class loading pool may
+ // not be needed.
+ p2pExecSvc = new IgniteThreadPoolExecutor(
+ "p2p-" + cfg.getGridName(),
+ DFLT_P2P_THREAD_CNT,
+ DFLT_P2P_THREAD_CNT,
+ 0,
+ new LinkedBlockingQueue<Runnable>());
+ }
+
+ if (ggfsExecSvc == null) {
+ isAutoGgfsSvc = true;
+
+ int procCnt = Runtime.getRuntime().availableProcessors();
+
+ // Note that we do not pre-start threads here as ggfs pool may not be needed.
+ ggfsExecSvc = new IgniteThreadPoolExecutor(
+ "ggfs-" + cfg.getGridName(),
+ procCnt,
+ procCnt,
+ 0,
+ new LinkedBlockingQueue<Runnable>());
+ }
+
+ restExecSvc = clientCfg != null ? clientCfg.getRestExecutorService() : null;
+
+ if (restExecSvc != null && !cfg.isRestEnabled()) {
+ U.warn(log, "REST executor service is configured, but REST is disabled in configuration " +
+ "(safely ignoring).");
+ }
+ else if (restExecSvc == null && clientCfg != null) {
+ isAutoRestSvc = true;
+
+ restExecSvc = new IgniteThreadPoolExecutor(
+ "rest-" + cfg.getGridName(),
+ DFLT_REST_CORE_THREAD_CNT,
+ DFLT_REST_MAX_THREAD_CNT,
+ DFLT_REST_KEEP_ALIVE_TIME,
+ new LinkedBlockingQueue<Runnable>(DFLT_REST_THREADPOOL_QUEUE_CAP)
+ );
+
+ clientCfg.setRestExecutorService(restExecSvc);
+ }
+
+ utilityCacheExecSvc = new IgniteThreadPoolExecutor(
+ "utility-" + cfg.getGridName(),
+ DFLT_SYSTEM_CORE_THREAD_CNT,
+ DFLT_SYSTEM_MAX_THREAD_CNT,
+ DFLT_SYSTEM_KEEP_ALIVE_TIME,
+ new LinkedBlockingQueue<Runnable>(DFLT_SYSTEM_THREADPOOL_QUEUE_CAP));
+
+ execSvcShutdown = cfg.getExecutorServiceShutdown();
+ sysSvcShutdown = cfg.getSystemExecutorServiceShutdown();
+ mgmtSvcShutdown = cfg.getManagementExecutorServiceShutdown();
+ p2pSvcShutdown = cfg.getPeerClassLoadingExecutorServiceShutdown();
+ ggfsSvcShutdown = cfg.getGgfsExecutorServiceShutdown();
+ restSvcShutdown = clientCfg != null && clientCfg.isRestExecutorServiceShutdown();
+
+ if (marsh == null) {
+ if (!U.isHotSpot()) {
+ U.warn(log, "GridOptimizedMarshaller is not supported on this JVM " +
+ "(only Java HotSpot VMs are supported). Switching to standard JDK marshalling - " +
+ "object serialization performance will be significantly slower.",
+ "To enable fast marshalling upgrade to recent 1.6 or 1.7 HotSpot VM release.");
+
+ marsh = new IgniteJdkMarshaller();
+ }
+ else if (!IgniteOptimizedMarshaller.available()) {
+ U.warn(log, "GridOptimizedMarshaller is not supported on this JVM " +
+ "(only recent 1.6 and 1.7 versions HotSpot VMs are supported). " +
+ "To enable fast marshalling upgrade to recent 1.6 or 1.7 HotSpot VM release. " +
+ "Switching to standard JDK marshalling - " +
+ "object serialization performance will be significantly slower.",
+ "To enable fast marshalling upgrade to recent 1.6 or 1.7 HotSpot VM release.");
+
+ marsh = new IgniteJdkMarshaller();
+ }
+ else
+ marsh = new IgniteOptimizedMarshaller();
+ }
+ else if (marsh instanceof IgniteOptimizedMarshaller && !U.isHotSpot()) {
+ U.warn(log, "Using GridOptimizedMarshaller on untested JVM (only Java HotSpot VMs were tested) - " +
+ "object serialization behavior could yield unexpected results.",
+ "Using GridOptimizedMarshaller on untested JVM.");
+ }
+
+ myCfg.setUserAttributes(attrs);
+ myCfg.setMBeanServer(mbSrv == null ? ManagementFactory.getPlatformMBeanServer() : mbSrv);
+ myCfg.setGridLogger(cfgLog);
+ myCfg.setMarshaller(marsh);
+ myCfg.setMarshalLocalJobs(cfg.isMarshalLocalJobs());
+ myCfg.setExecutorService(execSvc);
+ myCfg.setSystemExecutorService(sysExecSvc);
+ myCfg.setManagementExecutorService(mgmtExecSvc);
+ myCfg.setPeerClassLoadingExecutorService(p2pExecSvc);
+ myCfg.setGgfsExecutorService(ggfsExecSvc);
+ myCfg.setExecutorServiceShutdown(execSvcShutdown);
+ myCfg.setSystemExecutorServiceShutdown(sysSvcShutdown);
+ myCfg.setManagementExecutorServiceShutdown(mgmtSvcShutdown);
+ myCfg.setPeerClassLoadingExecutorServiceShutdown(p2pSvcShutdown);
+ myCfg.setGgfsExecutorServiceShutdown(ggfsSvcShutdown);
+ myCfg.setNodeId(nodeId);
+
+ IgniteFsConfiguration[] ggfsCfgs = cfg.getGgfsConfiguration();
+
+ if (ggfsCfgs != null) {
+ IgniteFsConfiguration[] clone = ggfsCfgs.clone();
+
+ for (int i = 0; i < ggfsCfgs.length; i++)
+ clone[i] = new IgniteFsConfiguration(ggfsCfgs[i]);
+
+ myCfg.setGgfsConfiguration(clone);
+ }
+
+ StreamerConfiguration[] streamerCfgs = cfg.getStreamerConfiguration();
+
+ if (streamerCfgs != null) {
+ StreamerConfiguration[] clone = streamerCfgs.clone();
+
+ for (int i = 0; i < streamerCfgs.length; i++)
+ clone[i] = new StreamerConfiguration(streamerCfgs[i]);
+
+ myCfg.setStreamerConfiguration(clone);
+ }
+
+ if (p2pExclude == null)
+ p2pExclude = EMPTY_STR_ARR;
+
+ myCfg.setPeerClassLoadingLocalClassPathExclude(p2pExclude);
+
+ /*
+ * Initialize default SPI implementations.
+ */
+
+ if (commSpi == null)
+ commSpi = new TcpCommunicationSpi();
+
+ if (discoSpi == null)
+ discoSpi = new TcpDiscoverySpi();
+
+ if (discoSpi instanceof TcpDiscoverySpi) {
+ TcpDiscoverySpi tcpDisco = (TcpDiscoverySpi)discoSpi;
+
+ if (tcpDisco.getIpFinder() == null)
+ tcpDisco.setIpFinder(new TcpDiscoveryMulticastIpFinder());
+ }
+
+ if (evtSpi == null)
+ evtSpi = new MemoryEventStorageSpi();
+
+ if (colSpi == null)
+ colSpi = new NoopCollisionSpi();
+
+ if (authSpi == null)
+ authSpi = new NoopAuthenticationSpi();
+
+ if (sesSpi == null)
+ sesSpi = new NoopSecureSessionSpi();
+
+ if (deploySpi == null)
+ deploySpi = new LocalDeploymentSpi();
+
+ if (cpSpi == null)
+ cpSpi = new CheckpointSpi[] {new NoopCheckpointSpi()};
+
+ if (failSpi == null)
+ failSpi = new FailoverSpi[] {new AlwaysFailoverSpi()};
+
+ if (loadBalancingSpi == null)
+ loadBalancingSpi = new LoadBalancingSpi[] {new RoundRobinLoadBalancingSpi()};
+
+ if (swapspaceSpi == null) {
+ boolean needSwap = false;
+
+ CacheConfiguration[] caches = cfg.getCacheConfiguration();
+
+ if (caches != null) {
+ for (CacheConfiguration c : caches) {
+ if (c.isSwapEnabled()) {
+ needSwap = true;
+
+ break;
+ }
+ }
+ }
+
+ swapspaceSpi = needSwap ? new FileSwapSpaceSpi() : new NoopSwapSpaceSpi();
+ }
+
+ if (indexingSpi == null)
+ indexingSpi = new GridNoopIndexingSpi();
+
+ myCfg.setCommunicationSpi(commSpi);
+ myCfg.setDiscoverySpi(discoSpi);
+ myCfg.setCheckpointSpi(cpSpi);
+ myCfg.setEventStorageSpi(evtSpi);
+ myCfg.setAuthenticationSpi(authSpi);
+ myCfg.setSecureSessionSpi(sesSpi);
+ myCfg.setDeploymentSpi(deploySpi);
+ myCfg.setFailoverSpi(failSpi);
+ myCfg.setCollisionSpi(colSpi);
+ myCfg.setLoadBalancingSpi(loadBalancingSpi);
+ myCfg.setSwapSpaceSpi(swapspaceSpi);
+ myCfg.setIndexingSpi(indexingSpi);
+
+ myCfg.setAddressResolver(cfg.getAddressResolver());
+
+ // Set SMTP configuration.
+ myCfg.setSmtpFromEmail(cfg.getSmtpFromEmail());
+ myCfg.setSmtpHost(cfg.getSmtpHost());
+ myCfg.setSmtpPort(cfg.getSmtpPort());
+ myCfg.setSmtpSsl(cfg.isSmtpSsl());
+ myCfg.setSmtpUsername(cfg.getSmtpUsername());
+ myCfg.setSmtpPassword(cfg.getSmtpPassword());
+ myCfg.setAdminEmails(cfg.getAdminEmails());
+
+ // REST configuration.
+ myCfg.setClientConnectionConfiguration(clientCfg);
+
+ // Portable configuration.
+ myCfg.setPortableConfiguration(cfg.getPortableConfiguration());
+
+ // Hadoop configuration.
+ myCfg.setHadoopConfiguration(cfg.getHadoopConfiguration());
+
+ // Validate segmentation configuration.
+ GridSegmentationPolicy segPlc = cfg.getSegmentationPolicy();
+
+ // 1. Warn on potential configuration problem: grid is not configured to wait
+ // for correct segment after segmentation happens.
+ if (!F.isEmpty(cfg.getSegmentationResolvers()) && segPlc == RESTART_JVM && !cfg.isWaitForSegmentOnStart()) {
+ U.warn(log, "Found potential configuration problem (forgot to enable waiting for segment" +
+ "on start?) [segPlc=" + segPlc + ", wait=false]");
+ }
+
+ myCfg.setSegmentationResolvers(cfg.getSegmentationResolvers());
+ myCfg.setSegmentationPolicy(segPlc);
+ myCfg.setSegmentCheckFrequency(cfg.getSegmentCheckFrequency());
+ myCfg.setWaitForSegmentOnStart(cfg.isWaitForSegmentOnStart());
+ myCfg.setAllSegmentationResolversPassRequired(cfg.isAllSegmentationResolversPassRequired());
+
+ // Override SMTP configuration from system properties
+ // and environment variables, if specified.
+ String fromEmail = IgniteSystemProperties.getString(GG_SMTP_FROM);
+
+ if (fromEmail != null)
+ myCfg.setSmtpFromEmail(fromEmail);
+
+ String smtpHost = IgniteSystemProperties.getString(GG_SMTP_HOST);
+
+ if (smtpHost != null)
+ myCfg.setSmtpHost(smtpHost);
+
+ String smtpUsername = IgniteSystemProperties.getString(GG_SMTP_USERNAME);
+
+ if (smtpUsername != null)
+ myCfg.setSmtpUsername(smtpUsername);
+
+ String smtpPwd = IgniteSystemProperties.getString(GG_SMTP_PWD);
+
+ if (smtpPwd != null)
+ myCfg.setSmtpPassword(smtpPwd);
+
+ int smtpPort = IgniteSystemProperties.getInteger(GG_SMTP_PORT, -1);
+
+ if(smtpPort != -1)
+ myCfg.setSmtpPort(smtpPort);
+
+ myCfg.setSmtpSsl(IgniteSystemProperties.getBoolean(GG_SMTP_SSL));
+
+ String adminEmails = IgniteSystemProperties.getString(GG_ADMIN_EMAILS);
+
+ if (adminEmails != null)
+ myCfg.setAdminEmails(adminEmails.split(","));
+
+ CacheConfiguration[] cacheCfgs = cfg.getCacheConfiguration();
+
+ boolean hasHadoop = IgniteComponentType.HADOOP.inClassPath();
+
+ CacheConfiguration[] copies;
+
+ if (cacheCfgs != null && cacheCfgs.length > 0) {
+ if (!U.discoOrdered(discoSpi) && !U.relaxDiscoveryOrdered())
+ throw new IgniteCheckedException("Discovery SPI implementation does not support node ordering and " +
+ "cannot be used with cache (use SPI with @GridDiscoverySpiOrderSupport annotation, " +
+ "like GridTcpDiscoverySpi)");
+
+ for (CacheConfiguration ccfg : cacheCfgs) {
+ if (CU.isHadoopSystemCache(ccfg.getName()))
+ throw new IgniteCheckedException("Cache name cannot be \"" + CU.SYS_CACHE_HADOOP_MR +
+ "\" because it is reserved for internal purposes.");
+
+ if (CU.isUtilityCache(ccfg.getName()))
+ throw new IgniteCheckedException("Cache name cannot start with \"" + CU.UTILITY_CACHE_NAME +
+ "\" because this prefix is reserved for internal purposes.");
+ }
+
+ copies = new CacheConfiguration[cacheCfgs.length + (hasHadoop ? 2 : 1)];
+
+ int cloneIdx = 1;
+
+ if (hasHadoop)
+ copies[cloneIdx++] = CU.hadoopSystemCache();
+
+ for (CacheConfiguration ccfg : cacheCfgs)
+ copies[cloneIdx++] = new CacheConfiguration(ccfg);
+ }
+ else if (hasHadoop) {
+ // Populate system caches
+ copies = new CacheConfiguration[hasHadoop ? 2 : 1];
+
+ copies[1] = CU.hadoopSystemCache();
+ }
+ else
+ copies = new CacheConfiguration[1];
+
+ // Always add utility cache.
+ copies[0] = utilitySystemCache(discoSpi instanceof TcpClientDiscoverySpi);
+
+ myCfg.setCacheConfiguration(copies);
+
+ myCfg.setCacheSanityCheckEnabled(cfg.isCacheSanityCheckEnabled());
+
+ try {
+ // Use reflection to avoid loading undesired classes.
+ Class helperCls = Class.forName("org.gridgain.grid.util.GridConfigurationHelper");
+
+ helperCls.getMethod("overrideConfiguration", IgniteConfiguration.class, Properties.class,
+ String.class, IgniteLogger.class).invoke(helperCls, myCfg, System.getProperties(), name, log);
+ }
+ catch (Exception ignored) {
+ // No-op.
+ }
+
+ // Ensure that SPIs support multiple grid instances, if required.
+ if (!startCtx.single()) {
+ ensureMultiInstanceSupport(deploySpi);
+ ensureMultiInstanceSupport(commSpi);
+ ensureMultiInstanceSupport(discoSpi);
+ ensureMultiInstanceSupport(cpSpi);
+ ensureMultiInstanceSupport(evtSpi);
+ ensureMultiInstanceSupport(colSpi);
+ ensureMultiInstanceSupport(failSpi);
+ ensureMultiInstanceSupport(authSpi);
+ ensureMultiInstanceSupport(sesSpi);
+ ensureMultiInstanceSupport(loadBalancingSpi);
+ ensureMultiInstanceSupport(swapspaceSpi);
+ }
+
+ // Register GridGain MBean for current grid instance.
+ registerFactoryMbean(myCfg.getMBeanServer());
+
+ boolean started = false;
+
+ try {
+ IgniteKernal grid0 = new IgniteKernal(startCtx.springContext());
+
+ // Init here to make grid available to lifecycle listeners.
+ grid = grid0;
+
+ grid0.start(myCfg, utilityCacheExecSvc, new CA() {
+ @Override public void apply() {
+ startLatch.countDown();
+ }
+ });
+
+ state = STARTED;
+
+ if (log.isDebugEnabled())
+ log.debug("Grid factory started ok: " + name);
+
+ started = true;
+ }
+ catch (IgniteCheckedException e) {
+ unregisterFactoryMBean();
+
+ throw e;
+ }
+ // Catch Throwable to protect against any possible failure.
+ catch (Throwable e) {
+ unregisterFactoryMBean();
+
+ throw new IgniteCheckedException("Unexpected exception when starting grid.", e);
+ }
+ finally {
+ if (!started)
+ // Grid was not started.
+ grid = null;
+ }
+
+ // Do NOT set it up only if GRIDGAIN_NO_SHUTDOWN_HOOK=TRUE is provided.
+ if (!IgniteSystemProperties.getBoolean(GG_NO_SHUTDOWN_HOOK, false)) {
+ try {
+ Runtime.getRuntime().addShutdownHook(shutdownHook = new Thread() {
+ @Override public void run() {
+ if (log.isInfoEnabled())
+ log.info("Invoking shutdown hook...");
+
+ IgniteNamedInstance.this.stop(true);
+ }
+ });
+
+ if (log.isDebugEnabled())
+ log.debug("Shutdown hook is installed.");
+ }
+ catch (IllegalStateException e) {
+ stop(true);
+
+ throw new IgniteCheckedException("Failed to install shutdown hook.", e);
+ }
+ }
+ else {
+ if (log.isDebugEnabled())
+ log.debug("Shutdown hook has not been installed because environment " +
+ "or system property " + GG_NO_SHUTDOWN_HOOK + " is set.");
+ }
+ }
+
+ /**
+ * @param cfgLog Configured logger.
+ * @param nodeId Local node ID.
+ * @return Initialized logger.
+ * @throws IgniteCheckedException If failed.
+ */
+ private IgniteLogger initLogger(@Nullable IgniteLogger cfgLog, UUID nodeId) throws IgniteCheckedException {
+ try {
+ if (cfgLog == null) {
+ Class<?> log4jCls;
+
+ try {
+ log4jCls = Class.forName("org.gridgain.grid.logger.log4j.GridLog4jLogger");
+ }
+ catch (ClassNotFoundException | NoClassDefFoundError ignored) {
+ log4jCls = null;
+ }
+
+ if (log4jCls != null) {
+ URL url = U.resolveGridGainUrl("config/gridgain-log4j.xml");
+
+ if (url == null) {
+ File cfgFile = new File("config/gridgain-log4j.xml");
+
+ if (!cfgFile.exists())
+ cfgFile = new File("../config/gridgain-log4j.xml");
+
+ if (cfgFile.exists()) {
+ try {
+ url = cfgFile.toURI().toURL();
+ }
+ catch (MalformedURLException ignore) {
+ // No-op.
+ }
+ }
+ }
+
+ if (url != null) {
+ boolean configured = (Boolean)log4jCls.getMethod("isConfigured").invoke(null);
+
+ if (configured)
+ url = null;
+ }
+
+ if (url != null) {
+ Constructor<?> ctor = log4jCls.getConstructor(URL.class);
+
+ cfgLog = (IgniteLogger)ctor.newInstance(url);
+ }
+ else
+ cfgLog = (IgniteLogger)log4jCls.newInstance();
+ }
+ else
+ cfgLog = new IgniteJavaLogger();
+ }
+
+ // Set node IDs for all file appenders.
+ if (cfgLog instanceof IgniteLoggerNodeIdAware)
+ ((IgniteLoggerNodeIdAware)cfgLog).setNodeId(nodeId);
+
+ return cfgLog;
+ }
+ catch (Exception e) {
+ throw new IgniteCheckedException("Failed to create logger.", e);
+ }
+ }
+
+ /**
+ * Creates utility system cache configuration.
+ *
+ * @param client If {@code true} creates client-only cache configuration.
+ * @return Utility system cache configuration.
+ */
+ private CacheConfiguration utilitySystemCache(boolean client) {
+ CacheConfiguration cache = new CacheConfiguration();
+
+ cache.setName(CU.UTILITY_CACHE_NAME);
+ cache.setCacheMode(REPLICATED);
+ cache.setAtomicityMode(TRANSACTIONAL);
+ cache.setSwapEnabled(false);
+ cache.setQueryIndexEnabled(false);
+ cache.setPreloadMode(SYNC);
+ cache.setWriteSynchronizationMode(FULL_SYNC);
+ cache.setAffinity(new CacheRendezvousAffinityFunction(false, 100));
+
+ if (client)
+ cache.setDistributionMode(CLIENT_ONLY);
+
+ return cache;
+ }
+
+ /**
+ * Stops grid.
+ *
+ * @param cancel Flag indicating whether all currently running jobs
+ * should be cancelled.
+ */
+ void stop(boolean cancel) {
+ // Stop cannot be called prior to start from public API,
+ // since it checks for STARTED state. So, we can assert here.
+ assert startGuard.get();
+
+ stop0(cancel);
+ }
+
+ /**
+ * @param cancel Flag indicating whether all currently running jobs
+ * should be cancelled.
+ */
+ private synchronized void stop0(boolean cancel) {
+ IgniteKernal grid0 = grid;
+
+ // Double check.
+ if (grid0 == null) {
+ if (log != null)
+ U.warn(log, "Attempting to stop an already stopped grid instance (ignore): " + name);
+
+ return;
+ }
+
+ if (shutdownHook != null)
+ try {
+ Runtime.getRuntime().removeShutdownHook(shutdownHook);
+
+ shutdownHook = null;
+
+ if (log.isDebugEnabled())
+ log.debug("Shutdown hook is removed.");
+ }
+ catch (IllegalStateException e) {
+ // Shutdown is in progress...
+ if (log.isDebugEnabled())
+ log.debug("Shutdown is in progress (ignoring): " + e.getMessage());
+ }
+
+ // Unregister GridGain MBean.
+ unregisterFactoryMBean();
+
+ try {
+ grid0.stop(cancel);
+
+ if (log.isDebugEnabled())
+
<TRUNCATED>
[41/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
index 0000000,451b221..84d7eff
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
@@@ -1,0 -1,454 +1,452 @@@
+ /*
+ * 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.cache.distributed.dht;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * DHT cache lock response.
+ */
+ public class GridDhtLockResponse<K, V> extends GridDistributedLockResponse<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Evicted readers. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<IgniteTxKey<K>> nearEvicted;
+
+ /** Evicted reader key bytes. */
+ @GridDirectCollection(byte[].class)
+ private Collection<byte[]> nearEvictedBytes;
+
+ /** Mini ID. */
+ private IgniteUuid miniId;
+
+ /** Invalid partitions. */
+ @GridToStringInclude
+ @GridDirectCollection(int.class)
+ private Set<Integer> invalidParts = new GridLeanSet<>();
+
+ @GridDirectTransient
+ /** Preload entries. */
+ private List<GridCacheEntryInfo<K, V>> preloadEntries;
+
+ /** */
+ @GridDirectCollection(byte[].class)
+ @GridDirectVersion(1)
+ private List<byte[]> preloadEntriesBytes;
+
+ /**
+ * Empty constructor (required by {@link Externalizable}).
+ */
+ public GridDhtLockResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param lockVer Lock version.
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ * @param cnt Key count.
+ */
+ public GridDhtLockResponse(int cacheId, GridCacheVersion lockVer, IgniteUuid futId, IgniteUuid miniId, int cnt) {
+ super(cacheId, lockVer, futId, cnt);
+
+ assert miniId != null;
+
+ this.miniId = miniId;
+ }
+
+ /**
+ * @param lockVer Lock ID.
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ * @param err Error.
+ */
+ public GridDhtLockResponse(int cacheId, GridCacheVersion lockVer, IgniteUuid futId, IgniteUuid miniId, Throwable err) {
+ super(cacheId, lockVer, futId, err);
+
+ assert miniId != null;
+
+ this.miniId = miniId;
+ }
+
+ /**
+ * @return Evicted readers.
+ */
+ public Collection<IgniteTxKey<K>> nearEvicted() {
+ return nearEvicted;
+ }
+
+ /**
+ * @param nearEvicted Evicted readers.
+ */
+ public void nearEvicted(Collection<IgniteTxKey<K>> nearEvicted) {
+ this.nearEvicted = nearEvicted;
+ }
+
+ /**
+ * @param nearEvictedBytes Key bytes.
+ */
+ public void nearEvictedBytes(Collection<byte[]> nearEvictedBytes) {
+ this.nearEvictedBytes = nearEvictedBytes;
+ }
+
+ /**
+ * @return Mini future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @param part Invalid partition.
+ */
+ public void addInvalidPartition(int part) {
+ invalidParts.add(part);
+ }
+
+ /**
+ * @return Invalid partitions.
+ */
+ public Set<Integer> invalidPartitions() {
+ return invalidParts;
+ }
+
+ /**
+ * Adds preload entry to lock response.
+ *
+ * @param info Info to add.
+ */
+ public void addPreloadEntry(GridCacheEntryInfo<K, V> info) {
+ if (preloadEntries == null)
+ preloadEntries = new ArrayList<>();
+
+ preloadEntries.add(info);
+ }
+
+ /**
+ * Gets preload entries returned from backup.
+ *
+ * @return Collection of preload entries.
+ */
+ public Collection<GridCacheEntryInfo<K, V>> preloadEntries() {
+ return preloadEntries == null ? Collections.<GridCacheEntryInfo<K, V>>emptyList() : preloadEntries;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (nearEvictedBytes == null && nearEvicted != null)
+ nearEvictedBytes = marshalCollection(nearEvicted, ctx);
+
+ if (preloadEntriesBytes == null && preloadEntries != null)
+ preloadEntriesBytes = marshalCollection(preloadEntries, ctx);
+
+ if (preloadEntriesBytes == null && preloadEntries != null) {
+ marshalInfos(preloadEntries, ctx);
+
+ preloadEntriesBytes = marshalCollection(preloadEntries, ctx);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (nearEvicted == null && nearEvictedBytes != null)
+ nearEvicted = unmarshalCollection(nearEvictedBytes, ctx, ldr);
+
+ if (preloadEntries == null && preloadEntriesBytes != null)
+ preloadEntries = unmarshalCollection(preloadEntriesBytes, ctx, ldr);
+
+ if (preloadEntries == null && preloadEntriesBytes != null) {
+ preloadEntries = unmarshalCollection(preloadEntriesBytes, ctx, ldr);
+
+ unmarshalInfos(preloadEntries, ctx.cacheContext(cacheId), ldr);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtLockResponse _clone = new GridDhtLockResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtLockResponse _clone = (GridDhtLockResponse)_msg;
+
+ _clone.nearEvicted = nearEvicted;
+ _clone.nearEvictedBytes = nearEvictedBytes;
+ _clone.miniId = miniId;
+ _clone.invalidParts = invalidParts;
+ _clone.preloadEntries = preloadEntries;
+ _clone.preloadEntriesBytes = preloadEntriesBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 11:
+ if (invalidParts != null) {
+ if (commState.it == null) {
- if (!commState.putInt(invalidParts.size()))
++ if (!commState.putInt(null, invalidParts.size()))
+ return false;
+
+ commState.it = invalidParts.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putInt((int)commState.cur))
++ if (!commState.putInt(null, (int)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 12:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 13:
+ if (nearEvictedBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(nearEvictedBytes.size()))
++ if (!commState.putInt(null, nearEvictedBytes.size()))
+ return false;
+
+ commState.it = nearEvictedBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 14:
+ if (preloadEntriesBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(preloadEntriesBytes.size()))
++ if (!commState.putInt(null, preloadEntriesBytes.size()))
+ return false;
+
+ commState.it = preloadEntriesBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 11:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (invalidParts == null)
+ invalidParts = new HashSet<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- if (buf.remaining() < 4)
- return false;
++ int _val = commState.getInt(null);
+
- int _val = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ invalidParts.add((Integer)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 12:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 13:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (nearEvictedBytes == null)
+ nearEvictedBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ nearEvictedBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 14:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (preloadEntriesBytes == null)
+ preloadEntriesBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ preloadEntriesBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 30;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtLockResponse.class, this, super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
index 0000000,dd71384..30987df
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
@@@ -1,0 -1,703 +1,695 @@@
+ /*
+ * 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.cache.distributed.dht;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.transactions.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Near transaction finish request.
+ */
+ public class GridDhtTxFinishRequest<K, V> extends GridDistributedTxFinishRequest<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Near node ID. */
+ private UUID nearNodeId;
+
+ /** Transaction isolation. */
+ private IgniteTxIsolation isolation;
+
+ /** Near writes. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<IgniteTxEntry<K, V>> nearWrites;
+
+ /** Serialized near writes. */
+ @GridDirectCollection(byte[].class)
+ private Collection<byte[]> nearWritesBytes;
+
+ /** Mini future ID. */
+ private IgniteUuid miniId;
+
+ /** System invalidation flag. */
+ private boolean sysInvalidate;
+
+ /** Topology version. */
+ private long topVer;
+
+ /** Pending versions with order less than one for this message (needed for commit ordering). */
+ @GridToStringInclude
+ @GridDirectCollection(GridCacheVersion.class)
+ private Collection<GridCacheVersion> pendingVers;
+
+ /** One phase commit flag for fast-commit path. */
+ private boolean onePhaseCommit;
+
+ /** One phase commit write version. */
+ private GridCacheVersion writeVer;
+
+ /** Subject ID. */
+ @GridDirectVersion(1)
+ private UUID subjId;
+
+ /** Task name hash. */
+ @GridDirectVersion(2)
+ private int taskNameHash;
+
+ /** TTLs for optimistic transaction. */
+ private GridLongList ttls;
+
+ /** Near cache TTLs for optimistic transaction. */
+ private GridLongList nearTtls;
+
+ /**
+ * Empty constructor required for {@link Externalizable}.
+ */
+ public GridDhtTxFinishRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param nearNodeId Near node ID.
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ * @param topVer Topology version.
+ * @param xidVer Transaction ID.
+ * @param threadId Thread ID.
+ * @param commitVer Commit version.
+ * @param isolation Transaction isolation.
+ * @param commit Commit flag.
+ * @param invalidate Invalidate flag.
+ * @param sys System flag.
+ * @param sysInvalidate System invalidation flag.
+ * @param syncCommit Synchronous commit flag.
+ * @param syncRollback Synchronous rollback flag.
+ * @param baseVer Base version.
+ * @param committedVers Committed versions.
+ * @param rolledbackVers Rolled back versions.
+ * @param pendingVers Pending versions.
+ * @param txSize Expected transaction size.
+ * @param writes Write entries.
+ * @param nearWrites Near cache writes.
+ * @param recoverWrites Recovery write entries.
+ * @param onePhaseCommit One phase commit flag.
+ * @param grpLockKey Group lock key.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash.
+ */
+ public GridDhtTxFinishRequest(
+ UUID nearNodeId,
+ IgniteUuid futId,
+ IgniteUuid miniId,
+ long topVer,
+ GridCacheVersion xidVer,
+ GridCacheVersion commitVer,
+ long threadId,
+ IgniteTxIsolation isolation,
+ boolean commit,
+ boolean invalidate,
+ boolean sys,
+ boolean sysInvalidate,
+ boolean syncCommit,
+ boolean syncRollback,
+ GridCacheVersion baseVer,
+ Collection<GridCacheVersion> committedVers,
+ Collection<GridCacheVersion> rolledbackVers,
+ Collection<GridCacheVersion> pendingVers,
+ int txSize,
+ Collection<IgniteTxEntry<K, V>> writes,
+ Collection<IgniteTxEntry<K, V>> nearWrites,
+ Collection<IgniteTxEntry<K, V>> recoverWrites,
+ boolean onePhaseCommit,
+ @Nullable IgniteTxKey grpLockKey,
+ @Nullable UUID subjId,
+ int taskNameHash
+ ) {
+ super(xidVer, futId, commitVer, threadId, commit, invalidate, sys, syncCommit, syncRollback, baseVer,
+ committedVers, rolledbackVers, txSize, writes, recoverWrites, grpLockKey);
+
+ assert miniId != null;
+ assert nearNodeId != null;
+ assert isolation != null;
+
+ this.pendingVers = pendingVers;
+ this.topVer = topVer;
+ this.nearNodeId = nearNodeId;
+ this.isolation = isolation;
+ this.nearWrites = nearWrites;
+ this.miniId = miniId;
+ this.sysInvalidate = sysInvalidate;
+ this.onePhaseCommit = onePhaseCommit;
+ this.subjId = subjId;
+ this.taskNameHash = taskNameHash;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean allowForStartup() {
+ return true;
+ }
+
+ /**
+ * @return Near writes.
+ */
+ public Collection<IgniteTxEntry<K, V>> nearWrites() {
+ return nearWrites == null ? Collections.<IgniteTxEntry<K, V>>emptyList() : nearWrites;
+ }
+
+ /**
+ * @return Mini ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @return Subject ID.
+ */
+ @Nullable public UUID subjectId() {
+ return subjId;
+ }
+
+ /**
+ * @return Task name hash.
+ */
+ public int taskNameHash() {
+ return taskNameHash;
+ }
+
+ /**
+ * @return Transaction isolation.
+ */
+ public IgniteTxIsolation isolation() {
+ return isolation;
+ }
+
+ /**
+ * @return Near node ID.
+ */
+ public UUID nearNodeId() {
+ return nearNodeId;
+ }
+
+ /**
+ * @return System invalidate flag.
+ */
+ public boolean isSystemInvalidate() {
+ return sysInvalidate;
+ }
+
+ /**
+ * @return One phase commit flag.
+ */
+ public boolean onePhaseCommit() {
+ return onePhaseCommit;
+ }
+
+ /**
+ * @return Write version for one-phase commit transactions.
+ */
+ public GridCacheVersion writeVersion() {
+ return writeVer;
+ }
+
+ /**
+ * @param writeVer Write version for one-phase commit transactions.
+ */
+ public void writeVersion(GridCacheVersion writeVer) {
+ this.writeVer = writeVer;
+ }
+
+ /**
+ * @return Topology version.
+ */
+ @Override public long topologyVersion() {
+ return topVer;
+ }
+
+ /**
+ * Gets versions of not acquired locks with version less then one of transaction being committed.
+ *
+ * @return Versions of locks for entries participating in transaction that have not been acquired yet
+ * have version less then one of transaction being committed.
+ */
+ public Collection<GridCacheVersion> pendingVersions() {
+ return pendingVers == null ? Collections.<GridCacheVersion>emptyList() : pendingVers;
+ }
+
+ /**
+ * @param idx Entry index.
+ * @param ttl TTL.
+ */
+ public void ttl(int idx, long ttl) {
+ if (ttl != -1L) {
+ if (ttls == null) {
+ ttls = new GridLongList();
+
+ for (int i = 0; i < idx - 1; i++)
+ ttls.add(-1L);
+ }
+ }
+
+ if (ttls != null)
+ ttls.add(ttl);
+ }
+
+ /**
+ * @return TTLs for optimistic transaction.
+ */
+ public GridLongList ttls() {
+ return ttls;
+ }
+
+ /**
+ * @param idx Entry index.
+ * @param ttl TTL.
+ */
+ public void nearTtl(int idx, long ttl) {
+ if (ttl != -1L) {
+ if (nearTtls == null) {
+ nearTtls = new GridLongList();
+
+ for (int i = 0; i < idx - 1; i++)
+ nearTtls.add(-1L);
+ }
+ }
+
+ if (nearTtls != null)
+ nearTtls.add(ttl);
+ }
+
+ /**
+ * @return TTLs for optimistic transaction.
+ */
+ public GridLongList nearTtls() {
+ return nearTtls;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (nearWrites != null) {
+ marshalTx(nearWrites, ctx);
+
+ nearWritesBytes = new ArrayList<>(nearWrites.size());
+
+ for (IgniteTxEntry<K, V> e : nearWrites)
+ nearWritesBytes.add(ctx.marshaller().marshal(e));
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (nearWritesBytes != null) {
+ nearWrites = new ArrayList<>(nearWritesBytes.size());
+
+ for (byte[] arr : nearWritesBytes)
+ nearWrites.add(ctx.marshaller().<IgniteTxEntry<K, V>>unmarshal(arr, ldr));
+
+ unmarshalTx(nearWrites, true, ctx, ldr);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtTxFinishRequest.class, this, super.toString());
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtTxFinishRequest _clone = new GridDhtTxFinishRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtTxFinishRequest _clone = (GridDhtTxFinishRequest)_msg;
+
+ _clone.nearNodeId = nearNodeId;
+ _clone.isolation = isolation;
+ _clone.nearWrites = nearWrites;
+ _clone.nearWritesBytes = nearWritesBytes;
+ _clone.miniId = miniId;
+ _clone.sysInvalidate = sysInvalidate;
+ _clone.topVer = topVer;
+ _clone.pendingVers = pendingVers;
+ _clone.onePhaseCommit = onePhaseCommit;
+ _clone.writeVer = writeVer;
+ _clone.subjId = subjId;
+ _clone.taskNameHash = taskNameHash;
+ _clone.ttls = ttls;
+ _clone.nearTtls = nearTtls;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 21:
- if (!commState.putEnum(isolation))
++ if (!commState.putEnum("isolation", isolation))
+ return false;
+
+ commState.idx++;
+
+ case 22:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 23:
- if (!commState.putUuid(nearNodeId))
++ if (!commState.putUuid("nearNodeId", nearNodeId))
+ return false;
+
+ commState.idx++;
+
+ case 24:
+ if (nearWritesBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(nearWritesBytes.size()))
++ if (!commState.putInt(null, nearWritesBytes.size()))
+ return false;
+
+ commState.it = nearWritesBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 25:
- if (!commState.putBoolean(onePhaseCommit))
++ if (!commState.putBoolean("onePhaseCommit", onePhaseCommit))
+ return false;
+
+ commState.idx++;
+
+ case 26:
+ if (pendingVers != null) {
+ if (commState.it == null) {
- if (!commState.putInt(pendingVers.size()))
++ if (!commState.putInt(null, pendingVers.size()))
+ return false;
+
+ commState.it = pendingVers.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putCacheVersion((GridCacheVersion)commState.cur))
++ if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 27:
- if (!commState.putBoolean(sysInvalidate))
++ if (!commState.putBoolean("sysInvalidate", sysInvalidate))
+ return false;
+
+ commState.idx++;
+
+ case 28:
- if (!commState.putLong(topVer))
++ if (!commState.putLong("topVer", topVer))
+ return false;
+
+ commState.idx++;
+
+ case 29:
- if (!commState.putCacheVersion(writeVer))
++ if (!commState.putCacheVersion("writeVer", writeVer))
+ return false;
+
+ commState.idx++;
+
+ case 30:
- if (!commState.putUuid(subjId))
++ if (!commState.putUuid("subjId", subjId))
+ return false;
+
+ commState.idx++;
+
+ case 31:
- if (!commState.putInt(taskNameHash))
++ if (!commState.putInt("taskNameHash", taskNameHash))
+ return false;
+
+ commState.idx++;
+
+ case 32:
+ if (!commState.putLongList(ttls))
+ return false;
+
+ commState.idx++;
+
+ case 33:
+ if (!commState.putLongList(nearTtls))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 21:
- if (buf.remaining() < 1)
- return false;
++ byte isolation0 = commState.getByte("isolation");
+
- byte isolation0 = commState.getByte();
++ if (!commState.lastRead())
++ return false;
+
+ isolation = IgniteTxIsolation.fromOrdinal(isolation0);
+
+ commState.idx++;
+
+ case 22:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 23:
- UUID nearNodeId0 = commState.getUuid();
++ nearNodeId = commState.getUuid("nearNodeId");
+
- if (nearNodeId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- nearNodeId = nearNodeId0;
-
+ commState.idx++;
+
+ case 24:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (nearWritesBytes == null)
+ nearWritesBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ nearWritesBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 25:
- if (buf.remaining() < 1)
- return false;
++ onePhaseCommit = commState.getBoolean("onePhaseCommit");
+
- onePhaseCommit = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 26:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (pendingVers == null)
+ pendingVers = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheVersion _val = commState.getCacheVersion();
++ GridCacheVersion _val = commState.getCacheVersion(null);
+
- if (_val == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ pendingVers.add((GridCacheVersion)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 27:
- if (buf.remaining() < 1)
- return false;
++ sysInvalidate = commState.getBoolean("sysInvalidate");
+
- sysInvalidate = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 28:
- if (buf.remaining() < 8)
- return false;
++ topVer = commState.getLong("topVer");
+
- topVer = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 29:
- GridCacheVersion writeVer0 = commState.getCacheVersion();
++ writeVer = commState.getCacheVersion("writeVer");
+
- if (writeVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- writeVer = writeVer0;
-
+ commState.idx++;
+
+ case 30:
- UUID subjId0 = commState.getUuid();
++ subjId = commState.getUuid("subjId");
+
- if (subjId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- subjId = subjId0;
-
+ commState.idx++;
+
+ case 31:
- if (buf.remaining() < 4)
- return false;
++ taskNameHash = commState.getInt("taskNameHash");
+
- taskNameHash = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 32:
+ GridLongList ttls0 = commState.getLongList();
+
+ if (ttls0 == LONG_LIST_NOT_READ)
+ return false;
+
+ ttls = ttls0;
+
+ commState.idx++;
+
+ case 33:
+ GridLongList nearTtls0 = commState.getLongList();
+
+ if (nearTtls0 == LONG_LIST_NOT_READ)
+ return false;
+
+ nearTtls = nearTtls0;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 31;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
index 0000000,a100f93..1ee5a3f
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
@@@ -1,0 -1,145 +1,143 @@@
+ /*
+ * 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.cache.distributed.dht;
+
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * DHT transaction finish response.
+ */
+ public class GridDhtTxFinishResponse<K, V> extends GridDistributedTxFinishResponse<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Mini future ID. */
+ private IgniteUuid miniId;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridDhtTxFinishResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param xid Xid version.
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ */
+ public GridDhtTxFinishResponse(GridCacheVersion xid, IgniteUuid futId, IgniteUuid miniId) {
+ super(xid, futId);
+
+ assert miniId != null;
+
+ this.miniId = miniId;
+ }
+
+ /**
+ * @return Mini future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtTxFinishResponse.class, this, super.toString());
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtTxFinishResponse _clone = new GridDhtTxFinishResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtTxFinishResponse _clone = (GridDhtTxFinishResponse)_msg;
+
+ _clone.miniId = miniId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 5:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 5:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 32;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
index 0000000,4211696..819db64
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
@@@ -1,0 -1,614 +1,598 @@@
+ /*
+ * 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.cache.distributed.dht;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * DHT prepare request.
+ */
+ public class GridDhtTxPrepareRequest<K, V> extends GridDistributedTxPrepareRequest<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Max order. */
+ private UUID nearNodeId;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /** Mini future ID. */
+ private IgniteUuid miniId;
+
+ /** Topology version. */
+ private long topVer;
+
+ /** Invalidate near entries flags. */
+ private BitSet invalidateNearEntries;
+
+ /** Near writes. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<IgniteTxEntry<K, V>> nearWrites;
+
+ /** Serialized near writes. */
+ @GridDirectCollection(byte[].class)
+ private Collection<byte[]> nearWritesBytes;
+
+ /** Owned versions by key. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Map<IgniteTxKey<K>, GridCacheVersion> owned;
+
+ /** Owned versions bytes. */
+ private byte[] ownedBytes;
+
+ /** Near transaction ID. */
+ private GridCacheVersion nearXidVer;
+
+ /** {@code True} if this is last prepare request for node. */
+ private boolean last;
+
+ /** Subject ID. */
+ @GridDirectVersion(1)
+ private UUID subjId;
+
+ /** Task name hash. */
+ @GridDirectVersion(2)
+ private int taskNameHash;
+
+ @GridDirectVersion(3)
+ /** Preload keys. */
+ private BitSet preloadKeys;
+
+ /**
+ * Empty constructor required for {@link Externalizable}.
+ */
+ public GridDhtTxPrepareRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ * @param topVer Topology version.
+ * @param tx Transaction.
+ * @param dhtWrites DHT writes.
+ * @param nearWrites Near writes.
+ * @param grpLockKey Group lock key if preparing group-lock transaction.
+ * @param partLock {@code True} if group-lock transaction locks partition.
+ * @param txNodes Transaction nodes mapping.
+ * @param nearXidVer Near transaction ID.
+ * @param last {@code True} if this is last prepare request for node.
+ */
+ public GridDhtTxPrepareRequest(
+ IgniteUuid futId,
+ IgniteUuid miniId,
+ long topVer,
+ GridDhtTxLocalAdapter<K, V> tx,
+ Collection<IgniteTxEntry<K, V>> dhtWrites,
+ Collection<IgniteTxEntry<K, V>> nearWrites,
+ IgniteTxKey grpLockKey,
+ boolean partLock,
+ Map<UUID, Collection<UUID>> txNodes,
+ GridCacheVersion nearXidVer,
+ boolean last,
+ UUID subjId,
+ int taskNameHash) {
+ super(tx, null, dhtWrites, grpLockKey, partLock, txNodes);
+
+ assert futId != null;
+ assert miniId != null;
+
+ this.topVer = topVer;
+ this.futId = futId;
+ this.nearWrites = nearWrites;
+ this.miniId = miniId;
+ this.nearXidVer = nearXidVer;
+ this.last = last;
+ this.subjId = subjId;
+ this.taskNameHash = taskNameHash;
+
+ invalidateNearEntries = new BitSet(dhtWrites == null ? 0 : dhtWrites.size());
+
+ nearNodeId = tx.nearNodeId();
+ }
+
+ /**
+ * @return {@code True} if this is last prepare request for node.
+ */
+ public boolean last() {
+ return last;
+ }
+
+ /**
+ * @return Near transaction ID.
+ */
+ public GridCacheVersion nearXidVersion() {
+ return nearXidVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean allowForStartup() {
+ return true;
+ }
+
+ /**
+ * @return Near node ID.
+ */
+ public UUID nearNodeId() {
+ return nearNodeId;
+ }
+
+ /**
+ * @return Subject ID.
+ */
+ @Nullable public UUID subjectId() {
+ return subjId;
+ }
+
+ /**
+ * @return Task name hash.
+ */
+ public int taskNameHash() {
+ return taskNameHash;
+ }
+
+ /**
+ * @return Near writes.
+ */
+ public Collection<IgniteTxEntry<K, V>> nearWrites() {
+ return nearWrites == null ? Collections.<IgniteTxEntry<K, V>>emptyList() : nearWrites;
+ }
+
+ /**
+ * @param idx Entry index to set invalidation flag.
+ * @param invalidate Invalidation flag value.
+ */
+ public void invalidateNearEntry(int idx, boolean invalidate) {
+ invalidateNearEntries.set(idx, invalidate);
+ }
+
+ /**
+ * @param idx Index to get invalidation flag value.
+ * @return Invalidation flag value.
+ */
+ public boolean invalidateNearEntry(int idx) {
+ return invalidateNearEntries.get(idx);
+ }
+
+ /**
+ * Marks last added key for preloading.
+ */
+ public void markKeyForPreload(int idx) {
+ if (preloadKeys == null)
+ preloadKeys = new BitSet();
+
+ preloadKeys.set(idx, true);
+ }
+
+ /**
+ * Checks whether entry info should be sent to primary node from backup.
+ *
+ * @param idx Index.
+ * @return {@code True} if value should be sent, {@code false} otherwise.
+ */
+ public boolean needPreloadKey(int idx) {
+ return preloadKeys != null && preloadKeys.get(idx);
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Mini future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @return Topology version.
+ */
+ @Override public long topologyVersion() {
+ return topVer;
+ }
+
+ /**
+ * Sets owner and its mapped version.
+ *
+ * @param key Key.
+ * @param ownerMapped Owner mapped version.
+ */
+ public void owned(IgniteTxKey<K> key, GridCacheVersion ownerMapped) {
+ if (owned == null)
+ owned = new GridLeanMap<>(3);
+
+ owned.put(key, ownerMapped);
+ }
+
+ /**
+ * @return Owned versions map.
+ */
+ public Map<IgniteTxKey<K>, GridCacheVersion> owned() {
+ return owned;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (ownedBytes == null && owned != null) {
+ ownedBytes = CU.marshal(ctx, owned);
+
+ if (ctx.deploymentEnabled()) {
+ for (IgniteTxKey<K> k : owned.keySet())
+ prepareObject(k, ctx);
+ }
+ }
+
+ if (nearWrites != null) {
+ marshalTx(nearWrites, ctx);
+
+ nearWritesBytes = new ArrayList<>(nearWrites.size());
+
+ for (IgniteTxEntry<K, V> e : nearWrites)
+ nearWritesBytes.add(ctx.marshaller().marshal(e));
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (ownedBytes != null && owned == null)
+ owned = ctx.marshaller().unmarshal(ownedBytes, ldr);
+
+ if (nearWritesBytes != null) {
+ nearWrites = new ArrayList<>(nearWritesBytes.size());
+
+ for (byte[] arr : nearWritesBytes)
+ nearWrites.add(ctx.marshaller().<IgniteTxEntry<K, V>>unmarshal(arr, ldr));
+
+ unmarshalTx(nearWrites, true, ctx, ldr);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtTxPrepareRequest.class, this, "super", super.toString());
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtTxPrepareRequest _clone = new GridDhtTxPrepareRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtTxPrepareRequest _clone = (GridDhtTxPrepareRequest)_msg;
+
+ _clone.nearNodeId = nearNodeId;
+ _clone.futId = futId;
+ _clone.miniId = miniId;
+ _clone.topVer = topVer;
+ _clone.invalidateNearEntries = invalidateNearEntries;
+ _clone.nearWrites = nearWrites;
+ _clone.nearWritesBytes = nearWritesBytes;
+ _clone.owned = owned;
+ _clone.ownedBytes = ownedBytes;
+ _clone.nearXidVer = nearXidVer;
+ _clone.last = last;
+ _clone.subjId = subjId;
+ _clone.taskNameHash = taskNameHash;
+ _clone.preloadKeys = preloadKeys;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 22:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 23:
- if (!commState.putBitSet(invalidateNearEntries))
++ if (!commState.putBitSet("invalidateNearEntries", invalidateNearEntries))
+ return false;
+
+ commState.idx++;
+
+ case 24:
- if (!commState.putBoolean(last))
++ if (!commState.putBoolean("last", last))
+ return false;
+
+ commState.idx++;
+
+ case 25:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 26:
- if (!commState.putUuid(nearNodeId))
++ if (!commState.putUuid("nearNodeId", nearNodeId))
+ return false;
+
+ commState.idx++;
+
+ case 27:
+ if (nearWritesBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(nearWritesBytes.size()))
++ if (!commState.putInt(null, nearWritesBytes.size()))
+ return false;
+
+ commState.it = nearWritesBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 28:
- if (!commState.putCacheVersion(nearXidVer))
++ if (!commState.putCacheVersion("nearXidVer", nearXidVer))
+ return false;
+
+ commState.idx++;
+
+ case 29:
- if (!commState.putByteArray(ownedBytes))
++ if (!commState.putByteArray("ownedBytes", ownedBytes))
+ return false;
+
+ commState.idx++;
+
+ case 30:
- if (!commState.putLong(topVer))
++ if (!commState.putLong("topVer", topVer))
+ return false;
+
+ commState.idx++;
+
+ case 31:
- if (!commState.putUuid(subjId))
++ if (!commState.putUuid("subjId", subjId))
+ return false;
+
+ commState.idx++;
+
+ case 32:
- if (!commState.putInt(taskNameHash))
++ if (!commState.putInt("taskNameHash", taskNameHash))
+ return false;
+
+ commState.idx++;
+
+ case 33:
- if (!commState.putBitSet(preloadKeys))
++ if (!commState.putBitSet("preloadKeys", preloadKeys))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 22:
- IgniteUuid futId0 = commState.getGridUuid();
++ futId = commState.getGridUuid("futId");
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ case 23:
- BitSet invalidateNearEntries0 = commState.getBitSet();
++ invalidateNearEntries = commState.getBitSet("invalidateNearEntries");
+
- if (invalidateNearEntries0 == BIT_SET_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- invalidateNearEntries = invalidateNearEntries0;
-
+ commState.idx++;
+
+ case 24:
- if (buf.remaining() < 1)
- return false;
++ last = commState.getBoolean("last");
+
- last = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 25:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 26:
- UUID nearNodeId0 = commState.getUuid();
++ nearNodeId = commState.getUuid("nearNodeId");
+
- if (nearNodeId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- nearNodeId = nearNodeId0;
-
+ commState.idx++;
+
+ case 27:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (nearWritesBytes == null)
+ nearWritesBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ nearWritesBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 28:
- GridCacheVersion nearXidVer0 = commState.getCacheVersion();
++ nearXidVer = commState.getCacheVersion("nearXidVer");
+
- if (nearXidVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- nearXidVer = nearXidVer0;
-
+ commState.idx++;
+
+ case 29:
- byte[] ownedBytes0 = commState.getByteArray();
++ ownedBytes = commState.getByteArray("ownedBytes");
+
- if (ownedBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- ownedBytes = ownedBytes0;
-
+ commState.idx++;
+
+ case 30:
- if (buf.remaining() < 8)
- return false;
++ topVer = commState.getLong("topVer");
+
- topVer = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 31:
- UUID subjId0 = commState.getUuid();
++ subjId = commState.getUuid("subjId");
+
- if (subjId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- subjId = subjId0;
-
+ commState.idx++;
+
+ case 32:
- if (buf.remaining() < 4)
- return false;
++ taskNameHash = commState.getInt("taskNameHash");
+
- taskNameHash = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 33:
- BitSet preloadKeys0 = commState.getBitSet();
++ preloadKeys = commState.getBitSet("preloadKeys");
+
- if (preloadKeys0 == BIT_SET_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- preloadKeys = preloadKeys0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 33;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
index 0000000,165e294..ec59dae
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
@@@ -1,0 -1,472 +1,468 @@@
+ /*
+ * 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.cache.distributed.dht;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * DHT transaction prepare response.
+ */
+ public class GridDhtTxPrepareResponse<K, V> extends GridDistributedTxPrepareResponse<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Evicted readers. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<IgniteTxKey<K>> nearEvicted;
+
+ /** */
+ @GridDirectCollection(byte[].class)
+ private Collection<byte[]> nearEvictedBytes;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /** Mini future ID. */
+ private IgniteUuid miniId;
+
+ /** Invalid partitions. */
+ @GridToStringInclude
+ @GridDirectCollection(int.class)
+ private Collection<Integer> invalidParts;
+
+ @GridDirectTransient
+ /** Preload entries. */
+ private List<GridCacheEntryInfo<K, V>> preloadEntries;
+
+ /** */
+ @GridDirectCollection(byte[].class)
+ @GridDirectVersion(1)
+ private List<byte[]> preloadEntriesBytes;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridDhtTxPrepareResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param xid Xid version.
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ */
+ public GridDhtTxPrepareResponse(GridCacheVersion xid, IgniteUuid futId, IgniteUuid miniId) {
+ super(xid);
+
+ assert futId != null;
+ assert miniId != null;
+
+ this.futId = futId;
+ this.miniId = miniId;
+ }
+
+ /**
+ * @param xid Xid version.
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ * @param err Error.
+ */
+ public GridDhtTxPrepareResponse(GridCacheVersion xid, IgniteUuid futId, IgniteUuid miniId, Throwable err) {
+ super(xid, err);
+
+ assert futId != null;
+ assert miniId != null;
+
+ this.futId = futId;
+ this.miniId = miniId;
+ }
+
+ /**
+ * @return Evicted readers.
+ */
+ public Collection<IgniteTxKey<K>> nearEvicted() {
+ return nearEvicted;
+ }
+
+ /**
+ * @param nearEvicted Evicted readers.
+ */
+ public void nearEvicted(Collection<IgniteTxKey<K>> nearEvicted) {
+ this.nearEvicted = nearEvicted;
+ }
+
+ /**
+ * @param nearEvictedBytes Near evicted bytes.
+ */
+ public void nearEvictedBytes(Collection<byte[]> nearEvictedBytes) {
+ this.nearEvictedBytes = nearEvictedBytes;
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Mini future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @return Invalid partitions.
+ */
+ public Collection<Integer> invalidPartitions() {
+ return invalidParts;
+ }
+
+ /**
+ * @param invalidParts Invalid partitions.
+ */
+ public void invalidPartitions(Collection<Integer> invalidParts) {
+ this.invalidParts = invalidParts;
+ }
+
+ /**
+ * Gets preload entries found on backup node.
+ *
+ * @return Collection of entry infos need to be preloaded.
+ */
+ public Collection<GridCacheEntryInfo<K, V>> preloadEntries() {
+ return preloadEntries == null ? Collections.<GridCacheEntryInfo<K, V>>emptyList() : preloadEntries;
+ }
+
+ /**
+ * Adds preload entry.
+ *
+ * @param info Info to add.
+ */
+ public void addPreloadEntry(GridCacheEntryInfo<K, V> info) {
+ if (preloadEntries == null)
+ preloadEntries = new ArrayList<>();
+
+ preloadEntries.add(info);
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (nearEvictedBytes == null)
+ nearEvictedBytes = marshalCollection(nearEvicted, ctx);
+
+ if (preloadEntriesBytes == null && preloadEntries != null)
+ preloadEntriesBytes = marshalCollection(preloadEntries, ctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ // Unmarshal even if deployment is disabled, since we could get bytes initially.
+ if (nearEvicted == null && nearEvictedBytes != null)
+ nearEvicted = unmarshalCollection(nearEvictedBytes, ctx, ldr);
+
+ if (preloadEntries == null && preloadEntriesBytes != null)
+ preloadEntries = unmarshalCollection(preloadEntriesBytes, ctx, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtTxPrepareResponse.class, this, "super", super.toString());
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtTxPrepareResponse _clone = new GridDhtTxPrepareResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtTxPrepareResponse _clone = (GridDhtTxPrepareResponse)_msg;
+
+ _clone.nearEvicted = nearEvicted;
+ _clone.nearEvictedBytes = nearEvictedBytes;
+ _clone.futId = futId;
+ _clone.miniId = miniId;
+ _clone.invalidParts = invalidParts;
+ _clone.preloadEntries = preloadEntries;
+ _clone.preloadEntriesBytes = preloadEntriesBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 10:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 11:
+ if (invalidParts != null) {
+ if (commState.it == null) {
- if (!commState.putInt(invalidParts.size()))
++ if (!commState.putInt(null, invalidParts.size()))
+ return false;
+
+ commState.it = invalidParts.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putInt((int)commState.cur))
++ if (!commState.putInt(null, (int)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 12:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 13:
+ if (nearEvictedBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(nearEvictedBytes.size()))
++ if (!commState.putInt(null, nearEvictedBytes.size()))
+ return false;
+
+ commState.it = nearEvictedBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 14:
+ if (preloadEntriesBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(preloadEntriesBytes.size()))
++ if (!commState.putInt(null, preloadEntriesBytes.size()))
+ return false;
+
+ commState.it = preloadEntriesBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 10:
- IgniteUuid futId0 = commState.getGridUuid();
++ futId = commState.getGridUuid("futId");
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ case 11:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (invalidParts == null)
+ invalidParts = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- if (buf.remaining() < 4)
- return false;
++ int _val = commState.getInt(null);
+
- int _val = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ invalidParts.add((Integer)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 12:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 13:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (nearEvictedBytes == null)
+ nearEvictedBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ nearEvictedBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 14:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (preloadEntriesBytes == null)
+ preloadEntriesBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ preloadEntriesBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 34;
+ }
+ }
[50/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java
index 0000000,8c07038..c09be9a
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/client/impl/connection/GridClientConnectionManagerAdapter.java
@@@ -1,0 -1,763 +1,699 @@@
+ /*
+ * 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.client.impl.connection;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.logger.java.*;
++import org.apache.ignite.plugin.security.*;
+ import org.apache.ignite.client.*;
+ import org.apache.ignite.client.impl.*;
+ import org.apache.ignite.client.util.*;
+ import org.apache.ignite.internal.processors.rest.client.message.*;
-import org.apache.ignite.plugin.security.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.nio.*;
+ import org.apache.ignite.internal.util.nio.ssl.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import javax.net.ssl.*;
+ import java.io.*;
+ import java.net.*;
+ import java.nio.*;
+ import java.util.*;
+ import java.util.concurrent.*;
+ import java.util.logging.*;
+
+ import static java.util.logging.Level.*;
+ import static org.apache.ignite.client.impl.connection.GridClientConnectionCloseReason.*;
+ import static org.apache.ignite.internal.GridNodeAttributes.*;
+
+ /**
+ * Cached connections manager.
+ */
+ abstract class GridClientConnectionManagerAdapter implements GridClientConnectionManager {
+ /** Count of reconnect retries before init considered failed. */
+ private static final int INIT_RETRY_CNT = 3;
+
+ /** Initialization retry interval. */
+ private static final int INIT_RETRY_INTERVAL = 1000;
+
+ /** Class logger. */
+ private final Logger log;
+
+ /** NIO server. */
+ private GridNioServer srv;
+
+ /** Active connections. */
+ private final ConcurrentMap<InetSocketAddress, GridClientConnection> conns = new ConcurrentHashMap<>();
+
+ /** Active connections of nodes. */
+ private final ConcurrentMap<UUID, GridClientConnection> nodeConns = new ConcurrentHashMap<>();
+
+ /** SSL context. */
+ private final SSLContext sslCtx;
+
+ /** Client configuration. */
+ protected final GridClientConfiguration cfg;
+
+ /** Topology. */
+ private final GridClientTopology top;
+
+ /** Client id. */
+ private final UUID clientId;
+
+ /** Router endpoints to use instead of topology info. */
+ private final Collection<InetSocketAddress> routers;
+
+ /** Closed flag. */
+ private volatile boolean closed;
+
+ /** Shared executor service. */
+ private final ExecutorService executor;
+
+ /** Endpoint striped lock. */
+ private final GridClientStripedLock endpointStripedLock = new GridClientStripedLock(16);
+
+ /** Service for ping requests, {@code null} if HTTP protocol is used. */
+ private final ScheduledExecutorService pingExecutor;
+
+ /** Marshaller ID. */
+ private final Byte marshId;
+
- /** Message writer. */
- @SuppressWarnings("FieldCanBeLocal")
- private final GridNioMessageWriter msgWriter = new GridNioMessageWriter() {
- @Override public boolean write(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, ByteBuffer buf) {
- assert msg != null;
- assert buf != null;
-
- msg.messageWriter(this, nodeId);
-
- return msg.writeTo(buf);
- }
-
- @Override public int writeFully(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg, OutputStream out,
- ByteBuffer buf) throws IOException {
- assert msg != null;
- assert out != null;
- assert buf != null;
- assert buf.hasArray();
-
- msg.messageWriter(this, nodeId);
-
- boolean finished = false;
- int cnt = 0;
-
- while (!finished) {
- finished = msg.writeTo(buf);
-
- out.write(buf.array(), 0, buf.position());
-
- cnt += buf.position();
-
- buf.clear();
- }
-
- return cnt;
- }
- };
-
+ /**
+ * @param clientId Client ID.
+ * @param sslCtx SSL context to enable secured connection or {@code null} to use unsecured one.
+ * @param cfg Client configuration.
+ * @param routers Routers or empty collection to use endpoints from topology info.
+ * @param top Topology.
+ * @param marshId Marshaller ID.
+ * @throws GridClientException In case of error.
+ */
+ @SuppressWarnings("unchecked")
+ protected GridClientConnectionManagerAdapter(UUID clientId,
+ SSLContext sslCtx,
+ GridClientConfiguration cfg,
+ Collection<InetSocketAddress> routers,
+ GridClientTopology top,
+ @Nullable Byte marshId)
+ throws GridClientException {
+ assert clientId != null : "clientId != null";
+ assert cfg != null : "cfg != null";
+ assert routers != null : "routers != null";
+ assert top != null : "top != null";
+
+ this.clientId = clientId;
+ this.sslCtx = sslCtx;
+ this.cfg = cfg;
+ this.routers = new ArrayList<>(routers);
+ this.top = top;
+
+ log = Logger.getLogger(getClass().getName());
+
+ executor = cfg.getExecutorService() != null ? cfg.getExecutorService() :
+ Executors.newCachedThreadPool(new GridClientThreadFactory("exec", true));
+
+ pingExecutor = cfg.getProtocol() == GridClientProtocol.TCP ? Executors.newScheduledThreadPool(
+ Runtime.getRuntime().availableProcessors(), new GridClientThreadFactory("exec", true)) : null;
+
+ this.marshId = marshId;
+
+ if (marshId == null && cfg.getMarshaller() == null)
+ throw new GridClientException("Failed to start client (marshaller is not configured).");
+
+ if (cfg.getProtocol() == GridClientProtocol.TCP) {
+ try {
+ IgniteLogger gridLog = new IgniteJavaLogger(false);
+
+ GridNioFilter[] filters;
+
- GridNioMessageReader msgReader = new GridNioMessageReader() {
- @Override public boolean read(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg,
- ByteBuffer buf) {
- assert msg != null;
- assert buf != null;
-
- msg.messageReader(this, nodeId);
-
- return msg.readFrom(buf);
- }
-
- @Nullable @Override public GridTcpMessageFactory messageFactory() {
- return null;
- }
- };
-
- GridNioFilter codecFilter = new GridNioCodecFilter(new NioParser(msgReader), gridLog, true);
++ GridNioFilter codecFilter = new GridNioCodecFilter(new NioParser(), gridLog, true);
+
+ if (sslCtx != null) {
+ GridNioSslFilter sslFilter = new GridNioSslFilter(sslCtx, gridLog);
+
+ sslFilter.directMode(true);
+ sslFilter.clientMode(true);
+
+ filters = new GridNioFilter[]{codecFilter, sslFilter};
+ }
+ else
+ filters = new GridNioFilter[]{codecFilter};
+
+ srv = GridNioServer.builder().address(U.getLocalHost())
+ .port(-1)
+ .listener(new NioListener(log))
+ .filters(filters)
+ .logger(gridLog)
+ .selectorCount(Runtime.getRuntime().availableProcessors())
+ .sendQueueLimit(1024)
+ .byteOrder(ByteOrder.nativeOrder())
+ .tcpNoDelay(cfg.isTcpNoDelay())
+ .directBuffer(true)
+ .directMode(true)
+ .socketReceiveBufferSize(0)
+ .socketSendBufferSize(0)
+ .idleTimeout(Long.MAX_VALUE)
+ .gridName("gridClient")
- .messageWriter(msgWriter)
+ .daemon(cfg.isDaemon())
+ .build();
+
+ srv.start();
+ }
+ catch (IOException | IgniteCheckedException e) {
+ throw new GridClientException("Failed to start connection server.", e);
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("BusyWait")
+ @Override public void init(Collection<InetSocketAddress> srvs) throws GridClientException, InterruptedException {
+ init0();
+
+ GridClientException firstEx = null;
+
+ for (int i = 0; i < INIT_RETRY_CNT; i++) {
+ Collection<InetSocketAddress> srvsCp = new ArrayList<>(srvs);
+
+ while (!srvsCp.isEmpty()) {
+ GridClientConnection conn = null;
+
+ try {
+ conn = connect(null, srvsCp);
+
+ conn.topology(cfg.isAutoFetchAttributes(), cfg.isAutoFetchMetrics(), null).get();
+
+ return;
+ }
+ catch (GridServerUnreachableException e) {
+ // No connection could be opened to any of initial addresses - exit to retry loop.
+ assert conn == null :
+ "GridClientConnectionResetException was thrown from GridClientConnection#topology";
+
+ if (firstEx == null)
+ firstEx = e;
+
+ break;
+ }
+ catch (GridClientConnectionResetException e) {
+ // Connection was established but topology update failed -
+ // trying other initial addresses if any.
+ assert conn != null : "GridClientConnectionResetException was thrown from connect()";
+
+ if (firstEx == null)
+ firstEx = e;
+
+ if (!srvsCp.remove(conn.serverAddress()))
+ // We have misbehaving collection or equals - just exit to avoid infinite loop.
+ break;
+ }
+ }
+
+ Thread.sleep(INIT_RETRY_INTERVAL);
+ }
+
+ for (GridClientConnection c : conns.values()) {
+ conns.remove(c.serverAddress(), c);
+
+ c.close(FAILED, false);
+ }
+
+ throw firstEx;
+ }
+
+ /**
+ * Additional initialization.
+ *
+ * @throws GridClientException In case of error.
+ */
+ protected abstract void init0() throws GridClientException;
+
+ /**
+ * Gets active communication facade.
+ *
+ * @param node Remote node to which connection should be established.
+ * @throws GridServerUnreachableException If none of the servers can be reached after the exception.
+ * @throws GridClientClosedException If client was closed manually.
+ * @throws InterruptedException If connection was interrupted.
+ */
+ @Override public GridClientConnection connection(GridClientNode node)
+ throws GridClientClosedException, GridServerUnreachableException, InterruptedException {
+ assert node != null;
+
+ // Use router's connections if defined.
+ if (!routers.isEmpty())
+ return connection(null, routers);
+
+ GridClientConnection conn = nodeConns.get(node.nodeId());
+
+ if (conn != null) {
+ // Ignore closed connections.
+ if (conn.closeIfIdle(cfg.getMaxConnectionIdleTime()))
+ closeIdle();
+ else
+ return conn;
+ }
+
+ // Use node's connection, if node is available over rest.
+ Collection<InetSocketAddress> endpoints = node.availableAddresses(cfg.getProtocol(), true);
+
+ List<InetSocketAddress> resolvedEndpoints = new ArrayList<>(endpoints.size());
+
+ for (InetSocketAddress endpoint : endpoints)
+ if (!endpoint.isUnresolved())
+ resolvedEndpoints.add(endpoint);
+
+ if (resolvedEndpoints.isEmpty()) {
+ throw new GridServerUnreachableException("No available endpoints to connect " +
+ "(is rest enabled for this node?): " + node);
+ }
+
+ boolean sameHost = node.attributes().isEmpty() ||
+ F.containsAny(U.allLocalMACs(), node.attribute(ATTR_MACS).toString().split(", "));
+
+ Collection<InetSocketAddress> srvs = new LinkedHashSet<>();
+
+ if (sameHost) {
+ Collections.sort(resolvedEndpoints, U.inetAddressesComparator(true));
+
+ srvs.addAll(resolvedEndpoints);
+ }
+ else {
+ for (InetSocketAddress endpoint : resolvedEndpoints)
+ if (!endpoint.getAddress().isLoopbackAddress())
+ srvs.add(endpoint);
+ }
+
+ return connection(node.nodeId(), srvs);
+ }
+
+ /**
+ * Returns connection to one of the given addresses.
+ *
+ * @param nodeId {@code UUID} of node for mapping with connection.
+ * {@code null} if no need of mapping.
+ * @param srvs Collection of addresses to connect to.
+ * @return Connection to use for operations, targeted for the given node.
+ * @throws GridServerUnreachableException If connection can't be established.
+ * @throws GridClientClosedException If connections manager has been closed already.
+ * @throws InterruptedException If connection was interrupted.
+ */
+ public GridClientConnection connection(@Nullable UUID nodeId, Collection<InetSocketAddress> srvs)
+ throws GridServerUnreachableException, GridClientClosedException, InterruptedException {
+ if (srvs == null || srvs.isEmpty())
+ throw new GridServerUnreachableException("Failed to establish connection to the grid" +
+ " (address list is empty).");
+
+ checkClosed();
+
+ // Search for existent connection.
+ for (InetSocketAddress endPoint : srvs) {
+ assert endPoint != null;
+
+ GridClientConnection conn = conns.get(endPoint);
+
+ if (conn == null)
+ continue;
+
+ // Ignore closed connections.
+ if (conn.closeIfIdle(cfg.getMaxConnectionIdleTime())) {
+ closeIdle();
+
+ continue;
+ }
+
+ if (nodeId != null)
+ nodeConns.put(nodeId, conn);
+
+ return conn;
+ }
+
+ return connect(nodeId, srvs);
+ }
+
+ /**
+ * Creates a connected facade and returns it. Called either from constructor or inside
+ * a write lock.
+ *
+ * @param nodeId {@code UUID} of node for mapping with connection.
+ * {@code null} if no need of mapping.
+ * @param srvs List of server addresses that this method will try to connect to.
+ * @return Established connection.
+ * @throws GridServerUnreachableException If none of the servers can be reached.
+ * @throws InterruptedException If connection was interrupted.
+ */
+ protected GridClientConnection connect(@Nullable UUID nodeId, Collection<InetSocketAddress> srvs)
+ throws GridServerUnreachableException, InterruptedException {
+ if (srvs.isEmpty())
+ throw new GridServerUnreachableException("Failed to establish connection to the grid node (address " +
+ "list is empty).");
+
+ Exception cause = null;
+
+ for (InetSocketAddress srv : srvs) {
+ try {
+ return connect(nodeId, srv);
+ }
+ catch (InterruptedException e) {
+ throw e;
+ }
+ catch (Exception e) {
+ if (cause == null)
+ cause = e;
+ else if (log.isLoggable(INFO))
+ log.info("Unable to connect to grid node [srvAddr=" + srv + ", msg=" + e.getMessage() + ']');
+ }
+ }
+
+ assert cause != null;
+
+ throw new GridServerUnreachableException("Failed to connect to any of the servers in list: " + srvs, cause);
+ }
+
+ /**
+ * Create new connection to specified server.
+ *
+ * @param nodeId {@code UUID} of node for mapping with connection.
+ * {@code null} if no need of mapping.
+ * @param addr Remote socket to connect.
+ * @return Established connection.
+ * @throws IOException If connection failed.
+ * @throws GridClientException If protocol error happened.
+ * @throws InterruptedException If thread was interrupted before connection was established.
+ */
+ protected GridClientConnection connect(@Nullable UUID nodeId, InetSocketAddress addr)
+ throws IOException, GridClientException, InterruptedException {
+ endpointStripedLock.lock(addr);
+
+ try {
+ GridClientConnection old = conns.get(addr);
+
+ if (old != null) {
+ if (old.isClosed()) {
+ conns.remove(addr, old);
+
+ if (nodeId != null)
+ nodeConns.remove(nodeId, old);
+ }
+ else {
+ if (nodeId != null)
+ nodeConns.put(nodeId, old);
+
+ return old;
+ }
+ }
+
+ GridSecurityCredentials cred = null;
+
+ try {
+ if (cfg.getSecurityCredentialsProvider() != null)
+ cred = cfg.getSecurityCredentialsProvider().credentials();
+ }
+ catch (IgniteCheckedException e) {
+ throw new GridClientException("Failed to obtain client credentials.", e);
+ }
+
+ GridClientConnection conn;
+
+ if (cfg.getProtocol() == GridClientProtocol.TCP) {
+ conn = new GridClientNioTcpConnection(srv, clientId, addr, sslCtx, pingExecutor,
+ cfg.getConnectTimeout(), cfg.getPingInterval(), cfg.getPingTimeout(),
+ cfg.isTcpNoDelay(), cfg.getMarshaller(), marshId, top, cred, keepPortablesThreadLocal());
+ }
+ else
+ throw new GridServerUnreachableException("Failed to create client (protocol is not supported): " +
+ cfg.getProtocol());
+
+ old = conns.putIfAbsent(addr, conn);
+
+ assert old == null;
+
+ if (nodeId != null)
+ nodeConns.put(nodeId, conn);
+
+ return conn;
+ }
+ finally {
+ endpointStripedLock.unlock(addr);
+ }
+ }
+
+ /**
+ * @return Get thread local used to enable keep portables mode.
+ */
+ protected ThreadLocal<Boolean> keepPortablesThreadLocal() {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void terminateConnection(GridClientConnection conn, GridClientNode node, Throwable e) {
+ if (log.isLoggable(Level.FINE))
+ log.fine("Connection with remote node was terminated [node=" + node + ", srvAddr=" +
+ conn.serverAddress() + ", errMsg=" + e.getMessage() + ']');
+
+ closeIdle();
+
+ conn.close(FAILED, false);
+ }
+
+ /**
+ * Closes all opened connections.
+ *
+ * @param waitCompletion If {@code true} waits for all pending requests to be proceeded.
+ */
+ @SuppressWarnings("TooBroadScope")
+ @Override public void stop(boolean waitCompletion) {
+ Collection<GridClientConnection> closeConns;
+
+ if (closed)
+ return;
+
+ // Mark manager as closed.
+ closed = true;
+
+ // Remove all connections from cache.
+ closeConns = new ArrayList<>(conns.values());
+
+ conns.clear();
+
+ nodeConns.clear();
+
+ // Close old connection outside the writer lock.
+ for (GridClientConnection conn : closeConns)
+ conn.close(CLIENT_CLOSED, waitCompletion);
+
+ if (pingExecutor != null)
+ GridClientUtils.shutdownNow(GridClientConnectionManager.class, pingExecutor, log);
+
+ GridClientUtils.shutdownNow(GridClientConnectionManager.class, executor, log);
+
+ if (srv != null)
+ srv.stop();
+ }
+
+ /**
+ * Close all connections idling for more then
+ * {@link GridClientConfiguration#getMaxConnectionIdleTime()} milliseconds.
+ */
+ @SuppressWarnings("ForLoopReplaceableByForEach")
+ private void closeIdle() {
+ for (Iterator<Map.Entry<UUID, GridClientConnection>> it = nodeConns.entrySet().iterator(); it.hasNext(); ) {
+ Map.Entry<UUID, GridClientConnection> entry = it.next();
+
+ GridClientConnection conn = entry.getValue();
+
+ if (conn.closeIfIdle(cfg.getMaxConnectionIdleTime())) {
+ conns.remove(conn.serverAddress(), conn);
+
+ nodeConns.remove(entry.getKey(), conn);
+ }
+ }
+
+ for (GridClientConnection conn : conns.values())
+ if (conn.closeIfIdle(cfg.getMaxConnectionIdleTime()))
+ conns.remove(conn.serverAddress(), conn);
+ }
+
+ /**
+ * Checks and throws an exception if this client was closed.
+ *
+ * @throws GridClientClosedException If client was closed.
+ */
+ private void checkClosed() throws GridClientClosedException {
+ if (closed)
+ throw new GridClientClosedException("Client was closed (no public methods of client can be used anymore).");
+ }
+
+ /**
+ */
+ private static class NioListener implements GridNioServerListener {
+ /** */
+ private final Logger log;
+
+ /**
+ * @param log Logger.
+ */
+ private NioListener(Logger log) {
+ this.log = log;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onConnected(GridNioSession ses) {
+ if (log.isLoggable(Level.FINE))
+ log.fine("Session connected: " + ses);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onDisconnected(GridNioSession ses, @Nullable Exception e) {
+ if (log.isLoggable(Level.FINE))
+ log.fine("Session disconnected: " + ses);
+
+ GridClientFutureAdapter<Boolean> handshakeFut =
+ ses.removeMeta(GridClientNioTcpConnection.SES_META_HANDSHAKE);
+
+ if (handshakeFut != null)
+ handshakeFut.onDone(
+ new GridClientConnectionResetException("Failed to perform handshake (connection failed)."));
+ else {
+ GridClientNioTcpConnection conn = ses.meta(GridClientNioTcpConnection.SES_META_CONN);
+
+ if (conn != null)
+ conn.close(FAILED, false);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onMessage(GridNioSession ses, Object msg) {
+ GridClientFutureAdapter<Boolean> handshakeFut =
+ ses.removeMeta(GridClientNioTcpConnection.SES_META_HANDSHAKE);
+
+ if (handshakeFut != null) {
+ assert msg instanceof GridClientHandshakeResponse;
+
+ handleHandshakeResponse(handshakeFut, (GridClientHandshakeResponse)msg);
+ }
+ else {
+ GridClientNioTcpConnection conn = ses.meta(GridClientNioTcpConnection.SES_META_CONN);
+
+ assert conn != null;
+
+ if (msg instanceof GridClientMessageWrapper) {
+ GridClientMessageWrapper req = (GridClientMessageWrapper)msg;
+
+ if (req.messageSize() != 0) {
+ assert req.message() != null;
+
+ conn.handleResponse(req);
+ }
+ else
+ conn.handlePingResponse();
+ }
+ else {
+ assert msg instanceof GridClientPingPacket : msg;
+
+ conn.handlePingResponse();
+ }
+ }
+ }
+
+ /**
+ * Handles client handshake response.
+ *
+ * @param handshakeFut Future.
+ * @param msg A handshake response.
+ */
+ private void handleHandshakeResponse(GridClientFutureAdapter<Boolean> handshakeFut,
+ GridClientHandshakeResponse msg) {
+ byte rc = msg.resultCode();
+
+ if (rc != GridClientHandshakeResponse.OK.resultCode()) {
+ handshakeFut.onDone(new GridClientHandshakeException(rc,
+ "Handshake failed due to internal error (see server log for more details)."));
+ }
+ else
+ handshakeFut.onDone(true);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onSessionWriteTimeout(GridNioSession ses) {
+ if (log.isLoggable(Level.FINE))
+ log.fine("Closing NIO session because of write timeout.");
+
+ ses.close();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onSessionIdleTimeout(GridNioSession ses) {
+ if (log.isLoggable(Level.FINE))
+ log.fine("Closing NIO session because of idle timeout.");
+
+ ses.close();
+ }
+ }
+
+ /**
+ *
+ */
+ private static class NioParser implements GridNioParser {
+ /** Message metadata key. */
+ private static final int MSG_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
+
- /** Message reader. */
- private final GridNioMessageReader msgReader;
-
- /**
- * @param msgReader Message reader.
- */
- NioParser(GridNioMessageReader msgReader) {
- this.msgReader = msgReader;
- }
-
+ /** {@inheritDoc} */
- @Nullable @Override public Object decode(GridNioSession ses, ByteBuffer buf) throws IOException, IgniteCheckedException {
++ @Nullable @Override public Object decode(GridNioSession ses, ByteBuffer buf)
++ throws IOException, IgniteCheckedException {
+ GridClientFutureAdapter<?> handshakeFut = ses.meta(GridClientNioTcpConnection.SES_META_HANDSHAKE);
+
+ if (handshakeFut != null) {
+ byte code = buf.get();
+
+ return new GridClientHandshakeResponse(code);
+ }
+
+ GridTcpCommunicationMessageAdapter msg = ses.removeMeta(MSG_META_KEY);
+
+ if (msg == null && buf.hasRemaining()) {
+ byte type = buf.get();
+
+ if (type == GridClientMessageWrapper.REQ_HEADER)
+ msg = new GridClientMessageWrapper();
+ else
+ throw new IOException("Invalid message type: " + type);
+ }
+
+ boolean finished = false;
+
+ if (buf.hasRemaining())
- finished = msgReader.read(null, msg, buf);
++ finished = msg.readFrom(buf);
+
+ if (finished)
+ return msg;
+ else {
+ ses.addMeta(MSG_META_KEY, msg);
+
+ return null;
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public ByteBuffer encode(GridNioSession ses, Object msg) throws IOException, IgniteCheckedException {
+ // No encoding needed for direct messages.
+ throw new UnsupportedEncodingException();
+ }
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java
index 0000000,ba2cc86..924f349
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java
@@@ -1,0 -1,215 +1,211 @@@
+ /*
+ * 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;
+
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Job cancellation request.
+ */
+ public class GridJobCancelRequest extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private IgniteUuid sesId;
+
+ /** */
+ private IgniteUuid jobId;
+
+ /** */
+ private boolean sys;
+
+ /**
+ * No-op constructor to support {@link Externalizable} interface.
+ * This constructor is not meant to be used for other purposes.
+ */
+ public GridJobCancelRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param sesId Task session ID.
+ */
+ public GridJobCancelRequest(IgniteUuid sesId) {
+ assert sesId != null;
+
+ this.sesId = sesId;
+ }
+
+ /**
+ * @param sesId Task session ID.
+ * @param jobId Job ID.
+ */
+ public GridJobCancelRequest(@Nullable IgniteUuid sesId, @Nullable IgniteUuid jobId) {
+ assert sesId != null || jobId != null;
+
+ this.sesId = sesId;
+ this.jobId = jobId;
+ }
+
+ /**
+ * @param sesId Session ID.
+ * @param jobId Job ID.
+ * @param sys System flag.
+ */
+ public GridJobCancelRequest(@Nullable IgniteUuid sesId, @Nullable IgniteUuid jobId, boolean sys) {
+ assert sesId != null || jobId != null;
+
+ this.sesId = sesId;
+ this.jobId = jobId;
+ this.sys = sys;
+ }
+
+ /**
+ * Gets execution ID of task to be cancelled.
+ *
+ * @return Execution ID of task to be cancelled.
+ */
+ @Nullable public IgniteUuid sessionId() {
+ return sesId;
+ }
+
+ /**
+ * Gets session ID of job to be cancelled. If {@code null}, then
+ * all jobs for the specified task execution ID will be cancelled.
+ *
+ * @return Execution ID of job to be cancelled.
+ */
+ @Nullable public IgniteUuid jobId() {
+ return jobId;
+ }
+
+ /**
+ * @return {@code True} if request to cancel is sent out of system when task
+ * has already been reduced and further results are no longer interesting.
+ */
+ public boolean system() {
+ return sys;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridJobCancelRequest _clone = new GridJobCancelRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridJobCancelRequest _clone = (GridJobCancelRequest)_msg;
+
+ _clone.sesId = sesId;
+ _clone.jobId = jobId;
+ _clone.sys = sys;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putGridUuid(jobId))
++ if (!commState.putGridUuid("jobId", jobId))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putGridUuid(sesId))
++ if (!commState.putGridUuid("sesId", sesId))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putBoolean(sys))
++ if (!commState.putBoolean("sys", sys))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- IgniteUuid jobId0 = commState.getGridUuid();
++ jobId = commState.getGridUuid("jobId");
+
- if (jobId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- jobId = jobId0;
-
+ commState.idx++;
+
+ case 1:
- IgniteUuid sesId0 = commState.getGridUuid();
++ sesId = commState.getGridUuid("sesId");
+
- if (sesId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- sesId = sesId0;
-
+ commState.idx++;
+
+ case 2:
- if (buf.remaining() < 1)
- return false;
++ sys = commState.getBoolean("sys");
+
- sys = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridJobCancelRequest.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
index 0000000,ae897e6..929f718
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
@@@ -1,0 -1,941 +1,919 @@@
+ /*
+ * 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;
+
+ import org.apache.ignite.compute.*;
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Job execution request.
+ */
+ public class GridJobExecuteRequest extends GridTcpCommunicationMessageAdapter implements GridTaskMessage {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Subject ID. */
+ private UUID subjId;
+
+ /** */
+ private IgniteUuid sesId;
+
+ /** */
+ private IgniteUuid jobId;
+
+ /** */
+ @GridToStringExclude
+ private byte[] jobBytes;
+
+ /** */
+ @GridToStringExclude
+ @GridDirectTransient
+ private ComputeJob job;
+
+ /** */
+ private long startTaskTime;
+
+ /** */
+ private long timeout;
+
+ /** */
+ private String taskName;
+
+ /** */
+ private String userVer;
+
+ /** */
+ private String taskClsName;
+
+ /** Node class loader participants. */
+ @GridToStringInclude
+ @GridDirectMap(keyType = UUID.class, valueType = IgniteUuid.class)
+ private Map<UUID, IgniteUuid> ldrParticipants;
+
+ /** */
+ @GridToStringExclude
+ private byte[] sesAttrsBytes;
+
+ /** */
+ @GridToStringExclude
+ @GridDirectTransient
+ private Map<Object, Object> sesAttrs;
+
+ /** */
+ @GridToStringExclude
+ private byte[] jobAttrsBytes;
+
+ /** */
+ @GridToStringExclude
+ @GridDirectTransient
+ private Map<? extends Serializable, ? extends Serializable> jobAttrs;
+
+ /** Checkpoint SPI name. */
+ private String cpSpi;
+
+ /** */
+ @GridDirectTransient
+ private Collection<ComputeJobSibling> siblings;
+
+ /** */
+ private byte[] siblingsBytes;
+
+ /** Transient since needs to hold local creation time. */
+ @GridDirectTransient
+ private long createTime0 = U.currentTimeMillis();
+
+ /** @deprecated need to remove and use only {@link #createTime0}. */
+ @Deprecated
+ private long createTime = createTime0;
+
+ /** */
+ private IgniteUuid clsLdrId;
+
+ /** */
+ private IgniteDeploymentMode depMode;
+
+ /** */
+ private boolean dynamicSiblings;
+
+ /** */
+ private boolean forceLocDep;
+
+ /** */
+ private boolean sesFullSup;
+
+ /** */
+ private boolean internal;
+
+ /** */
+ @GridDirectCollection(UUID.class)
+ private Collection<UUID> top;
+
+ /**
+ * No-op constructor to support {@link Externalizable} interface.
+ */
+ public GridJobExecuteRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param sesId Task session ID.
+ * @param jobId Job ID.
+ * @param taskName Task name.
+ * @param userVer Code version.
+ * @param taskClsName Fully qualified task name.
+ * @param jobBytes Job serialized body.
+ * @param job Job.
+ * @param startTaskTime Task execution start time.
+ * @param timeout Task execution timeout.
+ * @param top Topology.
+ * @param siblingsBytes Serialized collection of split siblings.
+ * @param siblings Collection of split siblings.
+ * @param sesAttrsBytes Map of session attributes.
+ * @param sesAttrs Session attributes.
+ * @param jobAttrsBytes Job context attributes.
+ * @param jobAttrs Job attributes.
+ * @param cpSpi Collision SPI.
+ * @param clsLdrId Task local class loader id.
+ * @param depMode Task deployment mode.
+ * @param dynamicSiblings {@code True} if siblings are dynamic.
+ * @param ldrParticipants Other node class loader IDs that can also load classes.
+ * @param forceLocDep {@code True} If remote node should ignore deployment settings.
+ * @param sesFullSup {@code True} if session attributes are disabled.
+ * @param internal {@code True} if internal job.
+ * @param subjId Subject ID.
+ */
+ public GridJobExecuteRequest(
+ IgniteUuid sesId,
+ IgniteUuid jobId,
+ String taskName,
+ String userVer,
+ String taskClsName,
+ byte[] jobBytes,
+ ComputeJob job,
+ long startTaskTime,
+ long timeout,
+ @Nullable Collection<UUID> top,
+ byte[] siblingsBytes,
+ Collection<ComputeJobSibling> siblings,
+ byte[] sesAttrsBytes,
+ Map<Object, Object> sesAttrs,
+ byte[] jobAttrsBytes,
+ Map<? extends Serializable, ? extends Serializable> jobAttrs,
+ String cpSpi,
+ IgniteUuid clsLdrId,
+ IgniteDeploymentMode depMode,
+ boolean dynamicSiblings,
+ Map<UUID, IgniteUuid> ldrParticipants,
+ boolean forceLocDep,
+ boolean sesFullSup,
+ boolean internal,
+ UUID subjId) {
+ this.top = top;
+ assert sesId != null;
+ assert jobId != null;
+ assert taskName != null;
+ assert taskClsName != null;
+ assert job != null || jobBytes != null;
+ assert sesAttrs != null || sesAttrsBytes != null || !sesFullSup;
+ assert jobAttrs != null || jobAttrsBytes != null;
+ assert clsLdrId != null;
+ assert userVer != null;
+ assert depMode != null;
+
+ this.sesId = sesId;
+ this.jobId = jobId;
+ this.taskName = taskName;
+ this.userVer = userVer;
+ this.taskClsName = taskClsName;
+ this.jobBytes = jobBytes;
+ this.job = job;
+ this.startTaskTime = startTaskTime;
+ this.timeout = timeout;
+ this.top = top;
+ this.siblingsBytes = siblingsBytes;
+ this.siblings = siblings;
+ this.sesAttrsBytes = sesAttrsBytes;
+ this.sesAttrs = sesAttrs;
+ this.jobAttrsBytes = jobAttrsBytes;
+ this.jobAttrs = jobAttrs;
+ this.clsLdrId = clsLdrId;
+ this.depMode = depMode;
+ this.dynamicSiblings = dynamicSiblings;
+ this.ldrParticipants = ldrParticipants;
+ this.forceLocDep = forceLocDep;
+ this.sesFullSup = sesFullSup;
+ this.internal = internal;
+ this.subjId = subjId;
+
+ this.cpSpi = cpSpi == null || cpSpi.isEmpty() ? null : cpSpi;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteUuid getSessionId() {
+ return sesId;
+ }
+
+ /**
+ * @return Job session ID.
+ */
+ public IgniteUuid getJobId() {
+ return jobId;
+ }
+
+ /**
+ * @return Task version.
+ */
+ public String getTaskClassName() {
+ return taskClsName;
+ }
+
+ /**
+ * @return Task name.
+ */
+ public String getTaskName() {
+ return taskName;
+ }
+
+ /**
+ * @return Task version.
+ */
+ public String getUserVersion() {
+ return userVer;
+ }
+
+ /**
+ * @return Serialized job bytes.
+ */
+ public byte[] getJobBytes() {
+ return jobBytes;
+ }
+
+ /**
+ * @return Grid job.
+ */
+ public ComputeJob getJob() {
+ return job;
+ }
+
+ /**
+ * @return Task start time.
+ */
+ public long getStartTaskTime() {
+ return startTaskTime;
+ }
+
+ /**
+ * @return Timeout.
+ */
+ public long getTimeout() {
+ return timeout;
+ }
+
+ /**
+ * Gets this instance creation time.
+ *
+ * @return This instance creation time.
+ */
+ public long getCreateTime() {
+ return createTime0;
+ }
+
+ /**
+ * @return Serialized collection of split siblings.
+ */
+ public byte[] getSiblingsBytes() {
+ return siblingsBytes;
+ }
+
+ /**
+ * @return Job siblings.
+ */
+ public Collection<ComputeJobSibling> getSiblings() {
+ return siblings;
+ }
+
+ /**
+ * @return Session attributes.
+ */
+ public byte[] getSessionAttributesBytes() {
+ return sesAttrsBytes;
+ }
+
+ /**
+ * @return Session attributes.
+ */
+ public Map<Object, Object> getSessionAttributes() {
+ return sesAttrs;
+ }
+
+ /**
+ * @return Job attributes.
+ */
+ public byte[] getJobAttributesBytes() {
+ return jobAttrsBytes;
+ }
+
+ /**
+ * @return Job attributes.
+ */
+ public Map<? extends Serializable, ? extends Serializable> getJobAttributes() {
+ return jobAttrs;
+ }
+
+ /**
+ * @return Checkpoint SPI name.
+ */
+ public String getCheckpointSpi() {
+ return cpSpi;
+ }
+
+ /**
+ * @return Task local class loader id.
+ */
+ public IgniteUuid getClassLoaderId() {
+ return clsLdrId;
+ }
+
+ /**
+ * @return Deployment mode.
+ */
+ public IgniteDeploymentMode getDeploymentMode() {
+ return depMode;
+ }
+
+ /**
+ * Returns true if siblings list is dynamic, i.e. task is continuous.
+ *
+ * @return True if siblings list is dynamic.
+ */
+ public boolean isDynamicSiblings() {
+ return dynamicSiblings;
+ }
+
+ /**
+ * @return Node class loader participant map.
+ */
+ public Map<UUID, IgniteUuid> getLoaderParticipants() {
+ return ldrParticipants;
+ }
+
+ /**
+ * @return Returns {@code true} if deployment should always be used.
+ */
+ public boolean isForceLocalDeployment() {
+ return forceLocDep;
+ }
+
+ /**
+ * @return Topology.
+ */
+ @Nullable public Collection<UUID> topology() {
+ return top;
+ }
+ /**
+ * @return {@code True} if session attributes are enabled.
+ */
+ public boolean isSessionFullSupport() {
+ return sesFullSup;
+ }
+
+ /**
+ * @return {@code True} if internal job.
+ */
+ public boolean isInternal() {
+ return internal;
+ }
+
+ /**
+ * @return Subject ID.
+ */
+ public UUID getSubjectId() {
+ return subjId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridJobExecuteRequest _clone = new GridJobExecuteRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridJobExecuteRequest _clone = (GridJobExecuteRequest)_msg;
+
+ _clone.subjId = subjId;
+ _clone.sesId = sesId;
+ _clone.jobId = jobId;
+ _clone.jobBytes = jobBytes;
+ _clone.job = job;
+ _clone.startTaskTime = startTaskTime;
+ _clone.timeout = timeout;
+ _clone.taskName = taskName;
+ _clone.userVer = userVer;
+ _clone.taskClsName = taskClsName;
+ _clone.ldrParticipants = ldrParticipants;
+ _clone.sesAttrsBytes = sesAttrsBytes;
+ _clone.sesAttrs = sesAttrs;
+ _clone.jobAttrsBytes = jobAttrsBytes;
+ _clone.jobAttrs = jobAttrs;
+ _clone.cpSpi = cpSpi;
+ _clone.siblings = siblings;
+ _clone.siblingsBytes = siblingsBytes;
+ _clone.createTime0 = createTime0;
+ _clone.createTime = createTime;
+ _clone.clsLdrId = clsLdrId;
+ _clone.depMode = depMode;
+ _clone.dynamicSiblings = dynamicSiblings;
+ _clone.forceLocDep = forceLocDep;
+ _clone.sesFullSup = sesFullSup;
+ _clone.internal = internal;
+ _clone.top = top;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putGridUuid(clsLdrId))
++ if (!commState.putGridUuid("clsLdrId", clsLdrId))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putString(cpSpi))
++ if (!commState.putString("cpSpi", cpSpi))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putLong(createTime))
++ if (!commState.putLong("createTime", createTime))
+ return false;
+
+ commState.idx++;
+
+ case 3:
- if (!commState.putEnum(depMode))
++ if (!commState.putEnum("depMode", depMode))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putBoolean(dynamicSiblings))
++ if (!commState.putBoolean("dynamicSiblings", dynamicSiblings))
+ return false;
+
+ commState.idx++;
+
+ case 5:
- if (!commState.putBoolean(forceLocDep))
++ if (!commState.putBoolean("forceLocDep", forceLocDep))
+ return false;
+
+ commState.idx++;
+
+ case 6:
- if (!commState.putBoolean(internal))
++ if (!commState.putBoolean("internal", internal))
+ return false;
+
+ commState.idx++;
+
+ case 7:
- if (!commState.putByteArray(jobAttrsBytes))
++ if (!commState.putByteArray("jobAttrsBytes", jobAttrsBytes))
+ return false;
+
+ commState.idx++;
+
+ case 8:
- if (!commState.putByteArray(jobBytes))
++ if (!commState.putByteArray("jobBytes", jobBytes))
+ return false;
+
+ commState.idx++;
+
+ case 9:
- if (!commState.putGridUuid(jobId))
++ if (!commState.putGridUuid("jobId", jobId))
+ return false;
+
+ commState.idx++;
+
+ case 10:
+ if (ldrParticipants != null) {
+ if (commState.it == null) {
- if (!commState.putInt(ldrParticipants.size()))
++ if (!commState.putInt(null, ldrParticipants.size()))
+ return false;
+
+ commState.it = ldrParticipants.entrySet().iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
+ Map.Entry<UUID, IgniteUuid> e = (Map.Entry<UUID, IgniteUuid>)commState.cur;
+
+ if (!commState.keyDone) {
- if (!commState.putUuid(e.getKey()))
++ if (!commState.putUuid(null, e.getKey()))
+ return false;
+
+ commState.keyDone = true;
+ }
+
- if (!commState.putGridUuid(e.getValue()))
++ if (!commState.putGridUuid(null, e.getValue()))
+ return false;
+
+ commState.keyDone = false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 11:
- if (!commState.putByteArray(sesAttrsBytes))
++ if (!commState.putByteArray("sesAttrsBytes", sesAttrsBytes))
+ return false;
+
+ commState.idx++;
+
+ case 12:
- if (!commState.putBoolean(sesFullSup))
++ if (!commState.putBoolean("sesFullSup", sesFullSup))
+ return false;
+
+ commState.idx++;
+
+ case 13:
- if (!commState.putGridUuid(sesId))
++ if (!commState.putGridUuid("sesId", sesId))
+ return false;
+
+ commState.idx++;
+
+ case 14:
- if (!commState.putByteArray(siblingsBytes))
++ if (!commState.putByteArray("siblingsBytes", siblingsBytes))
+ return false;
+
+ commState.idx++;
+
+ case 15:
- if (!commState.putLong(startTaskTime))
++ if (!commState.putLong("startTaskTime", startTaskTime))
+ return false;
+
+ commState.idx++;
+
+ case 16:
- if (!commState.putUuid(subjId))
++ if (!commState.putUuid("subjId", subjId))
+ return false;
+
+ commState.idx++;
+
+ case 17:
- if (!commState.putString(taskClsName))
++ if (!commState.putString("taskClsName", taskClsName))
+ return false;
+
+ commState.idx++;
+
+ case 18:
- if (!commState.putString(taskName))
++ if (!commState.putString("taskName", taskName))
+ return false;
+
+ commState.idx++;
+
+ case 19:
- if (!commState.putLong(timeout))
++ if (!commState.putLong("timeout", timeout))
+ return false;
+
+ commState.idx++;
+
+ case 20:
+ if (top != null) {
+ if (commState.it == null) {
- if (!commState.putInt(top.size()))
++ if (!commState.putInt(null, top.size()))
+ return false;
+
+ commState.it = top.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putUuid((UUID)commState.cur))
++ if (!commState.putUuid(null, (UUID)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 21:
- if (!commState.putString(userVer))
++ if (!commState.putString("userVer", userVer))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- IgniteUuid clsLdrId0 = commState.getGridUuid();
++ clsLdrId = commState.getGridUuid("clsLdrId");
+
- if (clsLdrId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- clsLdrId = clsLdrId0;
-
+ commState.idx++;
+
+ case 1:
- String cpSpi0 = commState.getString();
++ cpSpi = commState.getString("cpSpi");
+
- if (cpSpi0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- cpSpi = cpSpi0;
-
+ commState.idx++;
+
+ case 2:
- if (buf.remaining() < 8)
- return false;
++ createTime = commState.getLong("createTime");
+
- createTime = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 3:
- if (buf.remaining() < 1)
- return false;
++ byte depMode0 = commState.getByte("depMode");
+
- byte depMode0 = commState.getByte();
++ if (!commState.lastRead())
++ return false;
+
+ depMode = IgniteDeploymentMode.fromOrdinal(depMode0);
+
+ commState.idx++;
+
+ case 4:
- if (buf.remaining() < 1)
- return false;
++ dynamicSiblings = commState.getBoolean("dynamicSiblings");
+
- dynamicSiblings = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 5:
- if (buf.remaining() < 1)
- return false;
++ forceLocDep = commState.getBoolean("forceLocDep");
+
- forceLocDep = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 6:
- if (buf.remaining() < 1)
- return false;
++ internal = commState.getBoolean("internal");
+
- internal = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 7:
- byte[] jobAttrsBytes0 = commState.getByteArray();
++ jobAttrsBytes = commState.getByteArray("jobAttrsBytes");
+
- if (jobAttrsBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- jobAttrsBytes = jobAttrsBytes0;
-
+ commState.idx++;
+
+ case 8:
- byte[] jobBytes0 = commState.getByteArray();
++ jobBytes = commState.getByteArray("jobBytes");
+
- if (jobBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- jobBytes = jobBytes0;
-
+ commState.idx++;
+
+ case 9:
- IgniteUuid jobId0 = commState.getGridUuid();
++ jobId = commState.getGridUuid("jobId");
+
- if (jobId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- jobId = jobId0;
-
+ commState.idx++;
+
+ case 10:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (ldrParticipants == null)
+ ldrParticipants = new HashMap<>(commState.readSize, 1.0f);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
+ if (!commState.keyDone) {
- UUID _val = commState.getUuid();
++ UUID _val = commState.getUuid(null);
+
- if (_val == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ commState.cur = _val;
+ commState.keyDone = true;
+ }
+
- IgniteUuid _val = commState.getGridUuid();
++ IgniteUuid _val = commState.getGridUuid(null);
+
- if (_val == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ ldrParticipants.put((UUID)commState.cur, _val);
+
+ commState.keyDone = false;
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+ commState.cur = null;
+
+ commState.idx++;
+
+ case 11:
- byte[] sesAttrsBytes0 = commState.getByteArray();
++ sesAttrsBytes = commState.getByteArray("sesAttrsBytes");
+
- if (sesAttrsBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- sesAttrsBytes = sesAttrsBytes0;
-
+ commState.idx++;
+
+ case 12:
- if (buf.remaining() < 1)
- return false;
++ sesFullSup = commState.getBoolean("sesFullSup");
+
- sesFullSup = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 13:
- IgniteUuid sesId0 = commState.getGridUuid();
++ sesId = commState.getGridUuid("sesId");
+
- if (sesId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- sesId = sesId0;
-
+ commState.idx++;
+
+ case 14:
- byte[] siblingsBytes0 = commState.getByteArray();
++ siblingsBytes = commState.getByteArray("siblingsBytes");
+
- if (siblingsBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- siblingsBytes = siblingsBytes0;
-
+ commState.idx++;
+
+ case 15:
- if (buf.remaining() < 8)
- return false;
++ startTaskTime = commState.getLong("startTaskTime");
+
- startTaskTime = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 16:
+ UUID subjId0 = commState.getUuid();
+
+ if (subjId0 == UUID_NOT_READ)
+ return false;
+
+ subjId = subjId0;
+
+ commState.idx++;
+
+ case 17:
- String taskClsName0 = commState.getString();
++ String taskClsName0 = commState.getString("taskClsName");
+
- if (taskClsName0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- taskClsName = taskClsName0;
-
+ commState.idx++;
+
+ case 18:
- String taskName0 = commState.getString();
++ String taskName0 = commState.getString("taskName");
+
- if (taskName0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- taskName = taskName0;
-
+ commState.idx++;
+
+ case 19:
- if (buf.remaining() < 8)
- return false;
++ timeout = commState.getLong("timeout");
+
- timeout = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 20:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (top == null)
+ top = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- UUID _val = commState.getUuid();
++ UUID _val = commState.getUuid(null);
+
- if (_val == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ top.add((UUID)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 21:
- String userVer0 = commState.getString();
++ String userVer0 = commState.getString("userVer");
+
- if (userVer0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- userVer = userVer0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 81;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridJobExecuteRequest.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
index 0000000,d3e6e56..d2711a7
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
@@@ -1,0 -1,374 +1,362 @@@
+ /*
+ * 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;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Job execution response.
+ */
+ public class GridJobExecuteResponse extends GridTcpCommunicationMessageAdapter implements GridTaskMessage {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private UUID nodeId;
+
+ /** */
+ private IgniteUuid sesId;
+
+ /** */
+ private IgniteUuid jobId;
+
+ /** */
+ private byte[] gridExBytes;
+
+ /** */
+ @GridDirectTransient
+ private IgniteCheckedException gridEx;
+
+ /** */
+ private byte[] resBytes;
+
+ /** */
+ @GridDirectTransient
+ private Object res;
+
+ /** */
+ private byte[] jobAttrsBytes;
+
+ /** */
+ @GridDirectTransient
+ private Map<Object, Object> jobAttrs;
+
+ /** */
+ private boolean isCancelled;
+
+ /** */
+ @GridToStringExclude
+ @GridDirectTransient
+ private IgniteCheckedException fakeEx;
+
+ /**
+ * No-op constructor to support {@link Externalizable} interface. This
+ * constructor is not meant to be used for other purposes.
+ */
+ public GridJobExecuteResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param nodeId Sender node ID.
+ * @param sesId Task session ID
+ * @param jobId Job ID.
+ * @param gridExBytes Serialized grid exception.
+ * @param gridEx Grid exception.
+ * @param resBytes Serialized result.
+ * @param res Result.
+ * @param jobAttrsBytes Serialized job attributes.
+ * @param jobAttrs Job attributes.
+ * @param isCancelled Whether job was cancelled or not.
+ */
+ public GridJobExecuteResponse(UUID nodeId, IgniteUuid sesId, IgniteUuid jobId, byte[] gridExBytes,
+ IgniteCheckedException gridEx, byte[] resBytes, Object res, byte[] jobAttrsBytes,
+ Map<Object, Object> jobAttrs, boolean isCancelled) {
+ assert nodeId != null;
+ assert sesId != null;
+ assert jobId != null;
+
+ this.nodeId = nodeId;
+ this.sesId = sesId;
+ this.jobId = jobId;
+ this.gridExBytes = gridExBytes;
+ this.gridEx = gridEx;
+ this.resBytes = resBytes;
+ this.res = res;
+ this.jobAttrsBytes = jobAttrsBytes;
+ this.jobAttrs = jobAttrs;
+ this.isCancelled = isCancelled;
+ }
+
+ /**
+ * @return Task session ID.
+ */
+ @Override public IgniteUuid getSessionId() {
+ return sesId;
+ }
+
+ /**
+ * @return Job ID.
+ */
+ public IgniteUuid getJobId() {
+ return jobId;
+ }
+
+ /**
+ * @return Serialized job result.
+ */
+ @Nullable public byte[] getJobResultBytes() {
+ return resBytes;
+ }
+
+ /**
+ * @return Job result.
+ */
+ @Nullable public Object getJobResult() {
+ return res;
+ }
+
+ /**
+ * @return Serialized job exception.
+ */
+ @Nullable public byte[] getExceptionBytes() {
+ return gridExBytes;
+ }
+
+ /**
+ * @return Job exception.
+ */
+ @Nullable public IgniteCheckedException getException() {
+ return gridEx;
+ }
+
+ /**
+ * @return Serialized job attributes.
+ */
+ @Nullable public byte[] getJobAttributesBytes() {
+ return jobAttrsBytes;
+ }
+
+ /**
+ * @return Job attributes.
+ */
+ @Nullable public Map<Object, Object> getJobAttributes() {
+ return jobAttrs;
+ }
+
+ /**
+ * @return Job cancellation status.
+ */
+ public boolean isCancelled() {
+ return isCancelled;
+ }
+
+ /**
+ * @return Sender node ID.
+ */
+ public UUID getNodeId() {
+ return nodeId;
+ }
+
+ /**
+ * @return Fake exception.
+ */
+ public IgniteCheckedException getFakeException() {
+ return fakeEx;
+ }
+
+ /**
+ * @param fakeEx Fake exception.
+ */
+ public void setFakeException(IgniteCheckedException fakeEx) {
+ this.fakeEx = fakeEx;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridJobExecuteResponse _clone = new GridJobExecuteResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridJobExecuteResponse _clone = (GridJobExecuteResponse)_msg;
+
+ _clone.nodeId = nodeId;
+ _clone.sesId = sesId;
+ _clone.jobId = jobId;
+ _clone.gridExBytes = gridExBytes;
+ _clone.gridEx = gridEx;
+ _clone.resBytes = resBytes;
+ _clone.res = res;
+ _clone.jobAttrsBytes = jobAttrsBytes;
+ _clone.jobAttrs = jobAttrs;
+ _clone.isCancelled = isCancelled;
+ _clone.fakeEx = fakeEx;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putByteArray(gridExBytes))
++ if (!commState.putByteArray("gridExBytes", gridExBytes))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putBoolean(isCancelled))
++ if (!commState.putBoolean("isCancelled", isCancelled))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putByteArray(jobAttrsBytes))
++ if (!commState.putByteArray("jobAttrsBytes", jobAttrsBytes))
+ return false;
+
+ commState.idx++;
+
+ case 3:
- if (!commState.putGridUuid(jobId))
++ if (!commState.putGridUuid("jobId", jobId))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putUuid(nodeId))
++ if (!commState.putUuid("nodeId", nodeId))
+ return false;
+
+ commState.idx++;
+
+ case 5:
- if (!commState.putByteArray(resBytes))
++ if (!commState.putByteArray("resBytes", resBytes))
+ return false;
+
+ commState.idx++;
+
+ case 6:
- if (!commState.putGridUuid(sesId))
++ if (!commState.putGridUuid("sesId", sesId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- byte[] gridExBytes0 = commState.getByteArray();
++ gridExBytes = commState.getByteArray("gridExBytes");
+
- if (gridExBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- gridExBytes = gridExBytes0;
-
+ commState.idx++;
+
+ case 1:
- if (buf.remaining() < 1)
- return false;
++ isCancelled = commState.getBoolean("isCancelled");
+
- isCancelled = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 2:
- byte[] jobAttrsBytes0 = commState.getByteArray();
++ jobAttrsBytes = commState.getByteArray("jobAttrsBytes");
+
- if (jobAttrsBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- jobAttrsBytes = jobAttrsBytes0;
-
+ commState.idx++;
+
+ case 3:
- IgniteUuid jobId0 = commState.getGridUuid();
++ jobId = commState.getGridUuid("jobId");
+
- if (jobId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- jobId = jobId0;
-
+ commState.idx++;
+
+ case 4:
- UUID nodeId0 = commState.getUuid();
++ nodeId = commState.getUuid("nodeId");
+
- if (nodeId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- nodeId = nodeId0;
-
+ commState.idx++;
+
+ case 5:
- byte[] resBytes0 = commState.getByteArray();
++ resBytes = commState.getByteArray("resBytes");
+
- if (resBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- resBytes = resBytes0;
-
+ commState.idx++;
+
+ case 6:
- IgniteUuid sesId0 = commState.getGridUuid();
++ sesId = commState.getGridUuid("sesId");
+
- if (sesId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- sesId = sesId0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 2;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridJobExecuteResponse.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java
index 0000000,6c2d756..abe558f
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java
@@@ -1,0 -1,175 +1,171 @@@
+ /*
+ * 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;
+
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Job siblings request.
+ */
+ public class GridJobSiblingsRequest extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private IgniteUuid sesId;
+
+ /** */
+ @GridDirectTransient
+ private Object topic;
+
+ /** */
+ private byte[] topicBytes;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridJobSiblingsRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param sesId Session ID.
+ * @param topic Topic.
+ * @param topicBytes Serialized topic.
+ */
+ public GridJobSiblingsRequest(IgniteUuid sesId, Object topic, byte[] topicBytes) {
+ assert sesId != null;
+ assert topic != null || topicBytes != null;
+
+ this.sesId = sesId;
+ this.topic = topic;
+ this.topicBytes = topicBytes;
+ }
+
+ /**
+ * @return Session ID.
+ */
+ public IgniteUuid sessionId() {
+ return sesId;
+ }
+
+ /**
+ * @return Topic.
+ */
+ public Object topic() {
+ return topic;
+ }
+
+ /**
+ * @return Serialized topic.
+ */
+ public byte[] topicBytes() {
+ return topicBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridJobSiblingsRequest _clone = new GridJobSiblingsRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridJobSiblingsRequest _clone = (GridJobSiblingsRequest)_msg;
+
+ _clone.sesId = sesId;
+ _clone.topic = topic;
+ _clone.topicBytes = topicBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putGridUuid(sesId))
++ if (!commState.putGridUuid("sesId", sesId))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putByteArray(topicBytes))
++ if (!commState.putByteArray("topicBytes", topicBytes))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- IgniteUuid sesId0 = commState.getGridUuid();
++ sesId = commState.getGridUuid("sesId");
+
- if (sesId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- sesId = sesId0;
-
+ commState.idx++;
+
+ case 1:
- byte[] topicBytes0 = commState.getByteArray();
++ topicBytes = commState.getByteArray("topicBytes");
+
- if (topicBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- topicBytes = topicBytes0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 3;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridJobSiblingsRequest.class, this);
+ }
+ }
[40/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java
index 0000000,8750376..3c3c657
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java
@@@ -1,0 -1,221 +1,221 @@@
+ /*
+ * 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.cache.distributed.dht;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * DHT cache unlock request.
+ */
+ public class GridDhtUnlockRequest<K, V> extends GridDistributedUnlockRequest<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Near keys. */
+ @GridDirectCollection(byte[].class)
+ private List<byte[]> nearKeyBytes;
+
+ /** */
+ @GridDirectTransient
+ private List<K> nearKeys;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridDhtUnlockRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param dhtCnt Key count.
+ */
+ public GridDhtUnlockRequest(int cacheId, int dhtCnt) {
+ super(cacheId, dhtCnt);
+ }
+
+ /**
+ * @return Near keys.
+ */
+ public List<byte[]> nearKeyBytes() {
+ return nearKeyBytes != null ? nearKeyBytes : Collections.<byte[]>emptyList();
+ }
+
+ /**
+ * @return Near keys.
+ */
+ public List<K> nearKeys() {
+ return nearKeys;
+ }
+
+ /**
+ * Adds a Near key.
+ *
+ * @param key Key.
+ * @param keyBytes Key bytes.
+ * @param ctx Context.
+ * @throws IgniteCheckedException If failed.
+ */
+ public void addNearKey(K key, byte[] keyBytes, GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ if (ctx.deploymentEnabled())
+ prepareObject(key, ctx);
+
+ if (nearKeyBytes == null)
+ nearKeyBytes = new ArrayList<>();
+
+ nearKeyBytes.add(keyBytes);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (nearKeyBytes != null)
+ nearKeys = unmarshalCollection(nearKeyBytes, ctx, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtUnlockRequest.class, this);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtUnlockRequest _clone = new GridDhtUnlockRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtUnlockRequest _clone = (GridDhtUnlockRequest)_msg;
+
+ _clone.nearKeyBytes = nearKeyBytes;
+ _clone.nearKeys = nearKeys;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 9:
+ if (nearKeyBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(nearKeyBytes.size()))
++ if (!commState.putInt(null, nearKeyBytes.size()))
+ return false;
+
+ commState.it = nearKeyBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 9:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (nearKeyBytes == null)
+ nearKeyBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ nearKeyBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 35;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java
index 0000000,44a8857..04bef6a
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java
@@@ -1,0 -1,189 +1,189 @@@
+ /*
+ * 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.cache.distributed.dht.atomic;
+
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Deferred dht atomic update response.
+ */
+ public class GridDhtAtomicDeferredUpdateResponse<K, V> extends GridCacheMessage<K, V> implements GridCacheDeployable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Message index. */
+ public static final int CACHE_MSG_IDX = nextIndexId();
+
+ /** ACK future versions. */
+ @GridDirectCollection(GridCacheVersion.class)
+ private Collection<GridCacheVersion> futVers;
+
+ /** {@inheritDoc} */
+ @Override public int lookupIndex() {
+ return CACHE_MSG_IDX;
+ }
+
+ /**
+ * Empty constructor required by {@link Externalizable}
+ */
+ public GridDhtAtomicDeferredUpdateResponse() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param futVers Future versions.
+ */
+ public GridDhtAtomicDeferredUpdateResponse(int cacheId, Collection<GridCacheVersion> futVers) {
+ assert !F.isEmpty(futVers);
+
+ this.cacheId = cacheId;
+ this.futVers = futVers;
+ }
+
+ /**
+ * @return List of ACKed future versions.
+ */
+ public Collection<GridCacheVersion> futureVersions() {
+ return futVers;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtAtomicDeferredUpdateResponse _clone = new GridDhtAtomicDeferredUpdateResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtAtomicDeferredUpdateResponse _clone = (GridDhtAtomicDeferredUpdateResponse)_msg;
+
+ _clone.futVers = futVers;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
+ if (futVers != null) {
+ if (commState.it == null) {
- if (!commState.putInt(futVers.size()))
++ if (!commState.putInt(null, futVers.size()))
+ return false;
+
+ commState.it = futVers.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putCacheVersion((GridCacheVersion)commState.cur))
++ if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (futVers == null)
+ futVers = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheVersion _val = commState.getCacheVersion();
++ GridCacheVersion _val = commState.getCacheVersion(null);
+
- if (_val == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ futVers.add((GridCacheVersion)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 36;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
index 0000000,3b538c0..6f7ce44
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
@@@ -1,0 -1,1413 +1,1401 @@@
+ /*
+ * 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.cache.distributed.dht.atomic;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.cache.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import javax.cache.processor.*;
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Lite dht cache backup update request.
+ */
+ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K, V> implements GridCacheDeployable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Message index. */
+ public static final int CACHE_MSG_IDX = nextIndexId();
+
+ /** Node ID. */
+ private UUID nodeId;
+
+ /** Future version. */
+ private GridCacheVersion futVer;
+
+ /** Write version. */
+ private GridCacheVersion writeVer;
+
+ /** Topology version. */
+ private long topVer;
+
+ /** Keys to update. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private List<K> keys;
+
+ /** Key bytes. */
+ @GridToStringInclude
+ @GridDirectCollection(byte[].class)
+ private List<byte[]> keyBytes;
+
+ /** Values to update. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private List<V> vals;
+
+ /** Value bytes. */
+ @GridToStringInclude
+ @GridDirectCollection(GridCacheValueBytes.class)
+ private List<GridCacheValueBytes> valBytes;
+
+ /** DR versions. */
+ @GridDirectCollection(GridCacheVersion.class)
+ private List<GridCacheVersion> drVers;
+
+ /** TTLs. */
+ private GridLongList ttls;
+
+ /** DR expire time. */
+ private GridLongList drExpireTimes;
+
+ /** Near TTLs. */
+ private GridLongList nearTtls;
+
+ /** Near expire times. */
+ private GridLongList nearExpireTimes;
+
+ /** Write synchronization mode. */
+ private CacheWriteSynchronizationMode syncMode;
+
+ /** Keys to update. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private List<K> nearKeys;
+
+ /** Key bytes. */
+ @GridToStringInclude
+ @GridDirectCollection(byte[].class)
+ @GridDirectVersion(1)
+ private List<byte[]> nearKeyBytes;
+
+ /** Values to update. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private List<V> nearVals;
+
+ /** Value bytes. */
+ @GridToStringInclude
+ @GridDirectCollection(GridCacheValueBytes.class)
+ @GridDirectVersion(1)
+ private List<GridCacheValueBytes> nearValBytes;
+
+ /** Force transform backups flag. */
+ @GridDirectVersion(2)
+ private boolean forceTransformBackups;
+
+ /** Entry processors. */
+ @GridDirectTransient
+ private List<EntryProcessor<K, V, ?>> entryProcessors;
+
+ /** Entry processors bytes. */
+ @GridDirectCollection(byte[].class)
+ @GridDirectVersion(2)
+ private List<byte[]> entryProcessorsBytes;
+
+ /** Near entry processors. */
+ @GridDirectTransient
+ private List<EntryProcessor<K, V, ?>> nearEntryProcessors;
+
+ /** Near entry processors bytes. */
+ @GridDirectCollection(byte[].class)
+ @GridDirectVersion(2)
+ private List<byte[]> nearEntryProcessorsBytes;
+
+ /** Optional arguments for entry processor. */
+ @GridDirectTransient
+ private Object[] invokeArgs;
+
+ /** Entry processor arguments bytes. */
+ private byte[][] invokeArgsBytes;
+
+ /** Subject ID. */
+ @GridDirectVersion(3)
+ private UUID subjId;
+
+ /** Task name hash. */
+ @GridDirectVersion(4)
+ private int taskNameHash;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridDhtAtomicUpdateRequest() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param cacheId Cache ID.
+ * @param nodeId Node ID.
+ * @param futVer Future version.
+ * @param writeVer Write version for cache values.
+ * @param invokeArgs Optional arguments for entry processor.
+ * @param syncMode Cache write synchronization mode.
+ * @param topVer Topology version.
+ * @param forceTransformBackups Force transform backups flag.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash code.
+ */
+ public GridDhtAtomicUpdateRequest(
+ int cacheId,
+ UUID nodeId,
+ GridCacheVersion futVer,
+ GridCacheVersion writeVer,
+ CacheWriteSynchronizationMode syncMode,
+ long topVer,
+ boolean forceTransformBackups,
+ UUID subjId,
+ int taskNameHash,
+ Object[] invokeArgs
+ ) {
+ assert invokeArgs == null || forceTransformBackups;
+
+ this.cacheId = cacheId;
+ this.nodeId = nodeId;
+ this.futVer = futVer;
+ this.writeVer = writeVer;
+ this.syncMode = syncMode;
+ this.topVer = topVer;
+ this.forceTransformBackups = forceTransformBackups;
+ this.subjId = subjId;
+ this.taskNameHash = taskNameHash;
+ this.invokeArgs = invokeArgs;
+
+ keys = new ArrayList<>();
+ keyBytes = new ArrayList<>();
+
+ if (forceTransformBackups) {
+ entryProcessors = new ArrayList<>();
+ entryProcessorsBytes = new ArrayList<>();
+ }
+ else {
+ vals = new ArrayList<>();
+ valBytes = new ArrayList<>();
+ }
+ }
+
+ /**
+ * @return Force transform backups flag.
+ */
+ public boolean forceTransformBackups() {
+ return forceTransformBackups;
+ }
+
+ /**
+ * @param key Key to add.
+ * @param keyBytes Key bytes, if key was already serialized.
+ * @param val Value, {@code null} if should be removed.
+ * @param valBytes Value bytes, {@code null} if should be removed.
+ * @param entryProcessor Entry processor.
+ * @param ttl TTL (optional).
+ * @param drExpireTime DR expire time (optional).
+ * @param drVer DR version (optional).
+ */
+ public void addWriteValue(K key,
+ @Nullable byte[] keyBytes,
+ @Nullable V val,
+ @Nullable byte[] valBytes,
+ EntryProcessor<K, V, ?> entryProcessor,
+ long ttl,
+ long drExpireTime,
+ @Nullable GridCacheVersion drVer) {
+ keys.add(key);
+ this.keyBytes.add(keyBytes);
+
+ if (forceTransformBackups) {
+ assert entryProcessor != null;
+
+ entryProcessors.add(entryProcessor);
+ }
+ else {
+ vals.add(val);
+ this.valBytes.add(valBytes != null ? GridCacheValueBytes.marshaled(valBytes) : null);
+ }
+
+ // In case there is no DR, do not create the list.
+ if (drVer != null) {
+ if (drVers == null) {
+ drVers = new ArrayList<>();
+
+ for (int i = 0; i < keys.size() - 1; i++)
+ drVers.add(null);
+ }
+
+ drVers.add(drVer);
+ }
+ else if (drVers != null)
+ drVers.add(drVer);
+
+ if (ttl >= 0) {
+ if (ttls == null) {
+ ttls = new GridLongList(keys.size());
+
+ for (int i = 0; i < keys.size() - 1; i++)
+ ttls.add(-1);
+ }
+ }
+
+ if (ttls != null)
+ ttls.add(ttl);
+
+ if (drExpireTime >= 0) {
+ if (drExpireTimes == null) {
+ drExpireTimes = new GridLongList(keys.size());
+
+ for (int i = 0; i < keys.size() - 1; i++)
+ drExpireTimes.add(-1);
+ }
+ }
+
+ if (drExpireTimes != null)
+ drExpireTimes.add(drExpireTime);
+ }
+
+ /**
+ * @param key Key to add.
+ * @param keyBytes Key bytes, if key was already serialized.
+ * @param val Value, {@code null} if should be removed.
+ * @param valBytes Value bytes, {@code null} if should be removed.
+ * @param entryProcessor Entry processor.
+ * @param ttl TTL.
+ * @param expireTime Expire time.
+ */
+ public void addNearWriteValue(K key,
+ @Nullable byte[] keyBytes,
+ @Nullable V val,
+ @Nullable byte[] valBytes,
+ EntryProcessor<K, V, ?> entryProcessor,
+ long ttl,
+ long expireTime)
+ {
+ if (nearKeys == null) {
+ nearKeys = new ArrayList<>();
+ nearKeyBytes = new ArrayList<>();
+
+ if (forceTransformBackups) {
+ nearEntryProcessors = new ArrayList<>();
+ nearEntryProcessorsBytes = new ArrayList<>();
+ }
+ else {
+ nearVals = new ArrayList<>();
+ nearValBytes = new ArrayList<>();
+ }
+ }
+
+ nearKeys.add(key);
+ nearKeyBytes.add(keyBytes);
+
+ if (forceTransformBackups) {
+ assert entryProcessor != null;
+
+ nearEntryProcessors.add(entryProcessor);
+ }
+ else {
+ nearVals.add(val);
+ nearValBytes.add(valBytes != null ? GridCacheValueBytes.marshaled(valBytes) : null);
+ }
+
+ if (ttl >= 0) {
+ if (nearTtls == null) {
+ nearTtls = new GridLongList(nearKeys.size());
+
+ for (int i = 0; i < nearKeys.size() - 1; i++)
+ nearTtls.add(-1);
+ }
+ }
+
+ if (nearTtls != null)
+ nearTtls.add(ttl);
+
+ if (expireTime >= 0) {
+ if (nearExpireTimes == null) {
+ nearExpireTimes = new GridLongList(nearKeys.size());
+
+ for (int i = 0; i < nearKeys.size() - 1; i++)
+ nearExpireTimes.add(-1);
+ }
+ }
+
+ if (nearExpireTimes != null)
+ nearExpireTimes.add(expireTime);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int lookupIndex() {
+ return CACHE_MSG_IDX;
+ }
+
+ /**
+ * @return Node ID.
+ */
+ public UUID nodeId() {
+ return nodeId;
+ }
+
+ /**
+ * @return Subject ID.
+ */
+ public UUID subjectId() {
+ return subjId;
+ }
+
+ /**
+ * @return Task name.
+ */
+ public int taskNameHash() {
+ return taskNameHash;
+ }
+
+ /**
+ * @return Keys size.
+ */
+ public int size() {
+ return keys.size();
+ }
+
+ /**
+ * @return Keys size.
+ */
+ public int nearSize() {
+ return nearKeys != null ? nearKeys.size() : 0;
+ }
+
+ /**
+ * @return Version assigned on primary node.
+ */
+ public GridCacheVersion futureVersion() {
+ return futVer;
+ }
+
+ /**
+ * @return Write version.
+ */
+ public GridCacheVersion writeVersion() {
+ return writeVer;
+ }
+
+ /**
+ * @return Cache write synchronization mode.
+ */
+ public CacheWriteSynchronizationMode writeSynchronizationMode() {
+ return syncMode;
+ }
+
+ /**
+ * @return Topology version.
+ */
+ @Override public long topologyVersion() {
+ return topVer;
+ }
+
+ /**
+ * @return Keys.
+ */
+ public Collection<K> keys() {
+ return keys;
+ }
+
+ /**
+ * @param idx Key index.
+ * @return Key.
+ */
+ public K key(int idx) {
+ return keys.get(idx);
+ }
+
+ /**
+ * @param idx Near key index.
+ * @return Key.
+ */
+ public K nearKey(int idx) {
+ return nearKeys.get(idx);
+ }
+
+ /**
+ * @param idx Key index.
+ * @return Key bytes.
+ */
+ @Nullable public byte[] keyBytes(int idx) {
+ return keyBytes == null ? null : keyBytes.get(idx);
+ }
+
+ /**
+ * @param idx Near key index.
+ * @return Key bytes.
+ */
+ @Nullable public byte[] nearKeyBytes(int idx) {
+ return nearKeyBytes == null ? null : nearKeyBytes.get(idx);
+ }
+
+ /**
+ * @param idx Key index.
+ * @return Value.
+ */
+ @Nullable public V value(int idx) {
+ if (vals != null) {
+ V val = vals.get(idx);
+
+ if (val != null)
+ return val;
+ }
+
+ if (valBytes != null) {
+ GridCacheValueBytes valBytes0 = valBytes.get(idx);
+
+ if (valBytes0 != null && valBytes0.isPlain())
+ return (V)valBytes0.get();
+ }
+
+ return null;
+ }
+
+ /**
+ * @param idx Key index.
+ * @return Entry processor.
+ */
+ @Nullable public EntryProcessor<K, V, ?> entryProcessor(int idx) {
+ return entryProcessors == null ? null : entryProcessors.get(idx);
+ }
+
+ /**
+ * @param idx Near key index.
+ * @return Value.
+ */
+ @Nullable public V nearValue(int idx) {
+ if (nearVals != null) {
+ V val = nearVals.get(idx);
+
+ if (val != null)
+ return val;
+ }
+
+ if (nearValBytes != null) {
+ GridCacheValueBytes valBytes0 = nearValBytes.get(idx);
+
+ if (valBytes0 != null && valBytes0.isPlain())
+ return (V)valBytes0.get();
+ }
+
+ return null;
+ }
+
+ /**
+ * @param idx Key index.
+ * @return Transform closure.
+ */
+ @Nullable public EntryProcessor<K, V, ?> nearEntryProcessor(int idx) {
+ return nearEntryProcessors == null ? null : nearEntryProcessors.get(idx);
+ }
+
+ /**
+ * @param idx Key index.
+ * @return Value bytes.
+ */
+ @Nullable public byte[] valueBytes(int idx) {
+ if (valBytes != null) {
+ GridCacheValueBytes valBytes0 = valBytes.get(idx);
+
+ if (valBytes0 != null && !valBytes0.isPlain())
+ return valBytes0.get();
+ }
+
+ return null;
+ }
+
+ /**
+ * @param idx Near key index.
+ * @return Value bytes.
+ */
+ @Nullable public byte[] nearValueBytes(int idx) {
+ if (nearValBytes != null) {
+ GridCacheValueBytes valBytes0 = nearValBytes.get(idx);
+
+ if (valBytes0 != null && !valBytes0.isPlain())
+ return valBytes0.get();
+ }
+
+ return null;
+ }
+
+ /**
+ * @return DR versions.
+ */
+ @Nullable public List<GridCacheVersion> drVersions() {
+ return drVers;
+ }
+
+ /**
+ * @param idx Index.
+ * @return DR version.
+ */
+ @Nullable public GridCacheVersion drVersion(int idx) {
+ if (drVers != null) {
+ assert idx >= 0 && idx < drVers.size();
+
+ return drVers.get(idx);
+ }
+
+ return null;
+ }
+
+ /**
+ * @param idx Index.
+ * @return TTL.
+ */
+ public long ttl(int idx) {
+ if (ttls != null) {
+ assert idx >= 0 && idx < ttls.size();
+
+ return ttls.get(idx);
+ }
+
+ return -1L;
+ }
+
+ /**
+ * @param idx Index.
+ * @return TTL for near cache update.
+ */
+ public long nearTtl(int idx) {
+ if (nearTtls != null) {
+ assert idx >= 0 && idx < nearTtls.size();
+
+ return nearTtls.get(idx);
+ }
+
+ return -1L;
+ }
+
+ /**
+ * @return DR TTLs.
+ */
+ @Nullable public GridLongList drExpireTimes() {
+ return drExpireTimes;
+ }
+
+ /**
+ * @param idx Index.
+ * @return DR TTL.
+ */
+ public long drExpireTime(int idx) {
+ if (drExpireTimes != null) {
+ assert idx >= 0 && idx < drExpireTimes.size();
+
+ return drExpireTimes.get(idx);
+ }
+
+ return -1L;
+ }
+
+ /**
+ * @param idx Index.
+ * @return Expire time for near cache update.
+ */
+ public long nearExpireTime(int idx) {
+ if (nearExpireTimes != null) {
+ assert idx >= 0 && idx < nearExpireTimes.size();
+
+ return nearExpireTimes.get(idx);
+ }
+
+ return -1L;
+ }
+
+ /**
+ * @return Optional arguments for entry processor.
+ */
+ @Nullable public Object[] invokeArguments() {
+ return invokeArgs;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ keyBytes = marshalCollection(keys, ctx);
+ valBytes = marshalValuesCollection(vals, ctx);
+
+ if (forceTransformBackups) {
+ invokeArgsBytes = marshalInvokeArguments(invokeArgs, ctx);
+
+ entryProcessorsBytes = marshalCollection(entryProcessors, ctx);
+ }
+
+ nearKeyBytes = marshalCollection(nearKeys, ctx);
+ nearValBytes = marshalValuesCollection(nearVals, ctx);
+
+ if (forceTransformBackups)
+ nearEntryProcessorsBytes = marshalCollection(nearEntryProcessors, ctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ keys = unmarshalCollection(keyBytes, ctx, ldr);
+ vals = unmarshalValueBytesCollection(valBytes, ctx, ldr);
+
+ if (forceTransformBackups) {
+ entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
+
+ invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
+ }
+
+ nearKeys = unmarshalCollection(nearKeyBytes, ctx, ldr);
+ nearVals = unmarshalValueBytesCollection(nearValBytes, ctx, ldr);
+
+ if (forceTransformBackups)
+ nearEntryProcessors = unmarshalCollection(nearEntryProcessorsBytes, ctx, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtAtomicUpdateRequest _clone = new GridDhtAtomicUpdateRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtAtomicUpdateRequest _clone = (GridDhtAtomicUpdateRequest)_msg;
+
+ _clone.nodeId = nodeId;
+ _clone.futVer = futVer;
+ _clone.writeVer = writeVer;
+ _clone.topVer = topVer;
+ _clone.keys = keys;
+ _clone.keyBytes = keyBytes;
+ _clone.vals = vals;
+ _clone.valBytes = valBytes;
+ _clone.drVers = drVers;
+ _clone.ttls = ttls;
+ _clone.drExpireTimes = drExpireTimes;
+ _clone.nearTtls = nearTtls;
+ _clone.nearExpireTimes = nearExpireTimes;
+ _clone.syncMode = syncMode;
+ _clone.nearKeys = nearKeys;
+ _clone.nearKeyBytes = nearKeyBytes;
+ _clone.nearVals = nearVals;
+ _clone.nearValBytes = nearValBytes;
+ _clone.forceTransformBackups = forceTransformBackups;
+ _clone.entryProcessors = entryProcessors;
+ _clone.entryProcessorsBytes = entryProcessorsBytes;
+ _clone.nearEntryProcessors = nearEntryProcessors;
+ _clone.nearEntryProcessorsBytes = nearEntryProcessorsBytes;
+ _clone.invokeArgs = invokeArgs;
+ _clone.invokeArgsBytes = invokeArgsBytes;
+ _clone.subjId = subjId;
+ _clone.taskNameHash = taskNameHash;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
- if (!commState.putLongList(drExpireTimes))
++ if (!commState.putLongList("drExpireTimes", drExpireTimes))
+ return false;
+
+ commState.idx++;
+
+ case 4:
+ if (drVers != null) {
+ if (commState.it == null) {
- if (!commState.putInt(drVers.size()))
++ if (!commState.putInt(null, drVers.size()))
+ return false;
+
+ commState.it = drVers.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putCacheVersion((GridCacheVersion)commState.cur))
++ if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 5:
- if (!commState.putCacheVersion(futVer))
++ if (!commState.putCacheVersion("futVer", futVer))
+ return false;
+
+ commState.idx++;
+
+ case 6:
+ if (invokeArgsBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(invokeArgsBytes.length))
++ if (!commState.putInt(null, invokeArgsBytes.length))
+ return false;
+
+ commState.it = arrayIterator(invokeArgsBytes);
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 7:
+ if (keyBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(keyBytes.size()))
++ if (!commState.putInt(null, keyBytes.size()))
+ return false;
+
+ commState.it = keyBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 8:
- if (!commState.putLongList(nearExpireTimes))
++ if (!commState.putLongList("nearExpireTimes", nearExpireTimes))
+ return false;
+
+ commState.idx++;
+
+ case 9:
- if (!commState.putLongList(nearTtls))
++ if (!commState.putLongList("nearTtls", nearTtls))
+ return false;
+
+ commState.idx++;
+
+ case 10:
- if (!commState.putUuid(nodeId))
++ if (!commState.putUuid("nodeId", nodeId))
+ return false;
+
+ commState.idx++;
+
+ case 11:
- if (!commState.putEnum(syncMode))
++ if (!commState.putEnum("syncMode", syncMode))
+ return false;
+
+ commState.idx++;
+
+ case 12:
+ if (!commState.putLong(topVer))
+ return false;
+
+ commState.idx++;
+
+ case 13:
+ if (!commState.putLongList(ttls))
+ return false;
+
+ commState.idx++;
+
+ case 14:
+ if (valBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(valBytes.size()))
++ if (!commState.putInt(null, valBytes.size()))
+ return false;
+
+ commState.it = valBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putValueBytes((GridCacheValueBytes)commState.cur))
++ if (!commState.putValueBytes(null, (GridCacheValueBytes)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 15:
- if (!commState.putCacheVersion(writeVer))
++ if (!commState.putCacheVersion("writeVer", writeVer))
+ return false;
+
+ commState.idx++;
+
+ case 16:
+ if (nearKeyBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(nearKeyBytes.size()))
++ if (!commState.putInt(null, nearKeyBytes.size()))
+ return false;
+
+ commState.it = nearKeyBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 17:
+ if (nearValBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(nearValBytes.size()))
++ if (!commState.putInt(null, nearValBytes.size()))
+ return false;
+
+ commState.it = nearValBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putValueBytes((GridCacheValueBytes)commState.cur))
++ if (!commState.putValueBytes(null, (GridCacheValueBytes)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 18:
+ if (entryProcessorsBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(entryProcessorsBytes.size()))
++ if (!commState.putInt(null, entryProcessorsBytes.size()))
+ return false;
+
+ commState.it = entryProcessorsBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 19:
- if (!commState.putBoolean(forceTransformBackups))
++ if (!commState.putBoolean("forceTransformBackups", forceTransformBackups))
+ return false;
+
+ commState.idx++;
+
+ case 20:
+ if (nearEntryProcessorsBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(nearEntryProcessorsBytes.size()))
++ if (!commState.putInt(null, nearEntryProcessorsBytes.size()))
+ return false;
+
+ commState.it = nearEntryProcessorsBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 21:
- if (!commState.putUuid(subjId))
++ if (!commState.putUuid("subjId", subjId))
+ return false;
+
+ commState.idx++;
+
+ case 22:
- if (!commState.putInt(taskNameHash))
++ if (!commState.putInt("taskNameHash", taskNameHash))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
- GridLongList drExpireTimes0 = commState.getLongList();
++ drExpireTimes = commState.getLongList("drExpireTimes");
+
- if (drExpireTimes0 == LONG_LIST_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- drExpireTimes = drExpireTimes0;
-
+ commState.idx++;
+
+ case 4:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (drVers == null)
+ drVers = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheVersion _val = commState.getCacheVersion();
++ GridCacheVersion _val = commState.getCacheVersion(null);
+
- if (_val == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ drVers.add((GridCacheVersion)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 5:
- GridCacheVersion futVer0 = commState.getCacheVersion();
++ futVer = commState.getCacheVersion("futVer");
+
- if (futVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futVer = futVer0;
-
+ commState.idx++;
+
+ case 6:
+ if (commState.readSize == -1) {
+ if (buf.remaining() < 4)
+ return false;
+
+ commState.readSize = commState.getInt();
+ }
+
+ if (commState.readSize >= 0) {
+ if (invokeArgsBytes == null)
+ invokeArgsBytes = new byte[commState.readSize][];
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
+ if (_val == BYTE_ARR_NOT_READ)
+ return false;
+
+ invokeArgsBytes[i] = (byte[])_val;
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 7:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (keyBytes == null)
+ keyBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ keyBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 8:
+ GridLongList nearExpireTimes0 = commState.getLongList();
+
+ if (nearExpireTimes0 == LONG_LIST_NOT_READ)
+ return false;
+
+ nearExpireTimes = nearExpireTimes0;
+
+ commState.idx++;
+
+ case 9:
+ GridLongList nearTtls0 = commState.getLongList();
+
+ if (nearTtls0 == LONG_LIST_NOT_READ)
+ return false;
+
+ nearTtls = nearTtls0;
+
+ commState.idx++;
+
+ case 10:
- UUID nodeId0 = commState.getUuid();
++ UUID nodeId0 = commState.getUuid("nodeId");
+
- if (nodeId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- nodeId = nodeId0;
-
+ commState.idx++;
+
+ case 11:
- if (buf.remaining() < 1)
- return false;
++ byte syncMode0 = commState.getByte("syncMode");
+
- byte syncMode0 = commState.getByte();
++ if (!commState.lastRead())
++ return false;
+
+ syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncMode0);
+
+ commState.idx++;
+
+ case 12:
- if (buf.remaining() < 8)
- return false;
++ topVer = commState.getLong("topVer");
+
- topVer = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 13:
- GridLongList ttls0 = commState.getLongList();
++ ttls = commState.getLongList("ttls");
+
- if (ttls0 == LONG_LIST_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- ttls = ttls0;
-
+ commState.idx++;
+
+ case 14:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (valBytes == null)
+ valBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheValueBytes _val = commState.getValueBytes();
++ GridCacheValueBytes _val = commState.getValueBytes(null);
+
- if (_val == VAL_BYTES_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ valBytes.add((GridCacheValueBytes)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 15:
- GridCacheVersion writeVer0 = commState.getCacheVersion();
++ GridCacheVersion writeVer0 = commState.getCacheVersion("writeVer");
+
- if (writeVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- writeVer = writeVer0;
-
+ commState.idx++;
+
+ case 16:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (nearKeyBytes == null)
+ nearKeyBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ nearKeyBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 17:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (nearValBytes == null)
+ nearValBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheValueBytes _val = commState.getValueBytes();
++ GridCacheValueBytes _val = commState.getValueBytes(null);
+
- if (_val == VAL_BYTES_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ nearValBytes.add((GridCacheValueBytes)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 18:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (entryProcessorsBytes == null)
+ entryProcessorsBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ entryProcessorsBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 19:
- if (buf.remaining() < 1)
- return false;
++ forceTransformBackups = commState.getBoolean("forceTransformBackups");
+
- forceTransformBackups = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 20:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (nearEntryProcessorsBytes == null)
+ nearEntryProcessorsBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ nearEntryProcessorsBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 21:
- UUID subjId0 = commState.getUuid();
++ subjId = commState.getUuid("subjId");
+
- if (subjId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- subjId = subjId0;
-
+ commState.idx++;
+
+ case 22:
- if (buf.remaining() < 4)
- return false;
++ taskNameHash = commState.getInt("taskNameHash");
+
- taskNameHash = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 37;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtAtomicUpdateRequest.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
index 0000000,d4e328d..1ef4e54
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
@@@ -1,0 -1,354 +1,348 @@@
+ /*
+ * 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.cache.distributed.dht.atomic;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * DHT atomic cache backup update response.
+ */
+ public class GridDhtAtomicUpdateResponse<K, V> extends GridCacheMessage<K, V> implements GridCacheDeployable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Message index. */
+ public static final int CACHE_MSG_IDX = nextIndexId();
+
+ /** Future version. */
+ private GridCacheVersion futVer;
+
+ /** Failed keys. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<K> failedKeys;
+
+ /** Serialized failed keys. */
+ private byte[] failedKeysBytes;
+
+ /** Update error. */
+ @GridDirectTransient
+ private IgniteCheckedException err;
+
+ /** Serialized update error. */
+ private byte[] errBytes;
+
+ /** Evicted readers. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<K> nearEvicted;
+
+ /** Evicted reader key bytes. */
+ @GridDirectCollection(byte[].class)
+ @GridDirectVersion(1)
+ private Collection<byte[]> nearEvictedBytes;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridDhtAtomicUpdateResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param futVer Future version.
+ */
+ public GridDhtAtomicUpdateResponse(int cacheId, GridCacheVersion futVer) {
+ this.cacheId = cacheId;
+ this.futVer = futVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int lookupIndex() {
+ return CACHE_MSG_IDX;
+ }
+
+ /**
+ * @return Future version.
+ */
+ public GridCacheVersion futureVersion() {
+ return futVer;
+ }
+
+ /**
+ * @return Gets update error.
+ */
+ public IgniteCheckedException error() {
+ return err;
+ }
+
+ /**
+ * @return Failed keys.
+ */
+ public Collection<K> failedKeys() {
+ return failedKeys;
+ }
+
+ /**
+ * Adds key to collection of failed keys.
+ *
+ * @param key Key to add.
+ * @param e Error cause.
+ */
+ public void addFailedKey(K key, Throwable e) {
+ if (failedKeys == null)
+ failedKeys = new ArrayList<>();
+
+ failedKeys.add(key);
+
+ if (err == null)
+ err = new IgniteCheckedException("Failed to update keys on primary node.");
+
+ err.addSuppressed(e);
+ }
+
+ /**
+ * @return Evicted readers.
+ */
+ public Collection<K> nearEvicted() {
+ return nearEvicted;
+ }
+
+ /**
+ * Adds near evicted key..
+ *
+ * @param key Evicted key.
+ * @param bytes Bytes of evicted key.
+ */
+ public void addNearEvicted(K key, @Nullable byte[] bytes) {
+ if (nearEvicted == null)
+ nearEvicted = new ArrayList<>();
+
+ nearEvicted.add(key);
+
+ if (bytes != null) {
+ if (nearEvictedBytes == null)
+ nearEvictedBytes = new ArrayList<>();
+
+ nearEvictedBytes.add(bytes);
+ }
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ failedKeysBytes = ctx.marshaller().marshal(failedKeys);
+ errBytes = ctx.marshaller().marshal(err);
+
+ if (nearEvictedBytes == null)
+ nearEvictedBytes = marshalCollection(nearEvicted, ctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ failedKeys = ctx.marshaller().unmarshal(failedKeysBytes, ldr);
+ err = ctx.marshaller().unmarshal(errBytes, ldr);
+
+ if (nearEvicted == null && nearEvictedBytes != null)
+ nearEvicted = unmarshalCollection(nearEvictedBytes, ctx, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtAtomicUpdateResponse _clone = new GridDhtAtomicUpdateResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtAtomicUpdateResponse _clone = (GridDhtAtomicUpdateResponse)_msg;
+
+ _clone.futVer = futVer;
+ _clone.failedKeys = failedKeys;
+ _clone.failedKeysBytes = failedKeysBytes;
+ _clone.err = err;
+ _clone.errBytes = errBytes;
+ _clone.nearEvicted = nearEvicted;
+ _clone.nearEvictedBytes = nearEvictedBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
- if (!commState.putByteArray(errBytes))
++ if (!commState.putByteArray("errBytes", errBytes))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putByteArray(failedKeysBytes))
++ if (!commState.putByteArray("failedKeysBytes", failedKeysBytes))
+ return false;
+
+ commState.idx++;
+
+ case 5:
- if (!commState.putCacheVersion(futVer))
++ if (!commState.putCacheVersion("futVer", futVer))
+ return false;
+
+ commState.idx++;
+
+ case 6:
+ if (nearEvictedBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(nearEvictedBytes.size()))
++ if (!commState.putInt(null, nearEvictedBytes.size()))
+ return false;
+
+ commState.it = nearEvictedBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
- byte[] errBytes0 = commState.getByteArray();
++ errBytes = commState.getByteArray("errBytes");
+
- if (errBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- errBytes = errBytes0;
-
+ commState.idx++;
+
+ case 4:
- byte[] failedKeysBytes0 = commState.getByteArray();
++ failedKeysBytes = commState.getByteArray("failedKeysBytes");
+
- if (failedKeysBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- failedKeysBytes = failedKeysBytes0;
-
+ commState.idx++;
+
+ case 5:
- GridCacheVersion futVer0 = commState.getCacheVersion();
++ futVer = commState.getCacheVersion("futVer");
+
- if (futVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futVer = futVer0;
-
+ commState.idx++;
+
+ case 6:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (nearEvictedBytes == null)
+ nearEvictedBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ nearEvictedBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 38;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtAtomicUpdateResponse.class, this);
+ }
+ }
[42/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
index 0000000,7d5741f..11f454f
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
@@@ -1,0 -1,777 +1,771 @@@
+ /*
+ * 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.cache.distributed;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.transactions.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Transaction prepare request for optimistic and eventually consistent
+ * transactions.
+ */
+ public class GridDistributedTxPrepareRequest<K, V> extends GridDistributedBaseMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Thread ID. */
+ @GridToStringInclude
+ private long threadId;
+
+ /** Transaction concurrency. */
+ @GridToStringInclude
+ private IgniteTxConcurrency concurrency;
+
+ /** Transaction isolation. */
+ @GridToStringInclude
+ private IgniteTxIsolation isolation;
+
+ /** Commit version for EC transactions. */
+ @GridToStringInclude
+ private GridCacheVersion commitVer;
+
+ /** Transaction timeout. */
+ @GridToStringInclude
+ private long timeout;
+
+ /** Invalidation flag. */
+ @GridToStringInclude
+ private boolean invalidate;
+
+ /** Transaction read set. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<IgniteTxEntry<K, V>> reads;
+
+ /** */
+ @GridDirectCollection(byte[].class)
+ private Collection<byte[]> readsBytes;
+
+ /** Transaction write entries. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<IgniteTxEntry<K, V>> writes;
+
+ /** */
+ @GridDirectCollection(byte[].class)
+ private Collection<byte[]> writesBytes;
+
+ /** DHT versions to verify. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Map<IgniteTxKey<K>, GridCacheVersion> dhtVers;
+
+ /** Serialized map. */
+ @GridToStringExclude
+ private byte[] dhtVersBytes;
+
+ /** Group lock key, if any. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private IgniteTxKey grpLockKey;
+
+ /** Group lock key bytes. */
+ @GridToStringExclude
+ private byte[] grpLockKeyBytes;
+
+ /** Partition lock flag. */
+ private boolean partLock;
+
+ /** Expected transaction size. */
+ private int txSize;
+
+ /** Transaction nodes mapping (primary node -> related backup nodes). */
+ @GridDirectTransient
+ private Map<UUID, Collection<UUID>> txNodes;
+
+ /** */
+ private byte[] txNodesBytes;
+
+ /** System flag. */
+ private boolean sys;
+
+ /**
+ * Required by {@link Externalizable}.
+ */
+ public GridDistributedTxPrepareRequest() {
+ /* No-op. */
+ }
+
+ /**
+ * @param tx Cache transaction.
+ * @param reads Read entries.
+ * @param writes Write entries.
+ * @param grpLockKey Group lock key.
+ * @param partLock {@code True} if preparing group-lock transaction with partition lock.
+ * @param txNodes Transaction nodes mapping.
+ */
+ public GridDistributedTxPrepareRequest(
+ IgniteTxEx<K, V> tx,
+ @Nullable Collection<IgniteTxEntry<K, V>> reads,
+ Collection<IgniteTxEntry<K, V>> writes,
+ IgniteTxKey grpLockKey,
+ boolean partLock,
+ Map<UUID, Collection<UUID>> txNodes
+ ) {
+ super(tx.xidVersion(), 0);
+
+ commitVer = null;
+ threadId = tx.threadId();
+ concurrency = tx.concurrency();
+ isolation = tx.isolation();
+ timeout = tx.timeout();
+ invalidate = tx.isInvalidate();
+ txSize = tx.size();
+ sys = tx.system();
+
+ this.reads = reads;
+ this.writes = writes;
+ this.grpLockKey = grpLockKey;
+ this.partLock = partLock;
+ this.txNodes = txNodes;
+ }
+
+ /**
+ * @return Transaction nodes mapping.
+ */
+ public Map<UUID, Collection<UUID>> transactionNodes() {
+ return txNodes;
+ }
+
+ /**
+ * @return System flag.
+ */
+ public boolean system() {
+ return sys;
+ }
+
+ /**
+ * Adds version to be verified on remote node.
+ *
+ * @param key Key for which version is verified.
+ * @param dhtVer DHT version to check.
+ */
+ public void addDhtVersion(IgniteTxKey<K> key, @Nullable GridCacheVersion dhtVer) {
+ if (dhtVers == null)
+ dhtVers = new HashMap<>();
+
+ dhtVers.put(key, dhtVer);
+ }
+
+ /**
+ * @return Map of versions to be verified.
+ */
+ public Map<IgniteTxKey<K>, GridCacheVersion> dhtVersions() {
+ return dhtVers == null ? Collections.<IgniteTxKey<K>, GridCacheVersion>emptyMap() : dhtVers;
+ }
+
+ /**
+ * @return Thread ID.
+ */
+ public long threadId() {
+ return threadId;
+ }
+
+ /**
+ * @return Commit version.
+ */
+ public GridCacheVersion commitVersion() { return commitVer; }
+
+ /**
+ * @return Invalidate flag.
+ */
+ public boolean isInvalidate() { return invalidate; }
+
+ /**
+ * @return Transaction timeout.
+ */
+ public long timeout() {
+ return timeout;
+ }
+
+ /**
+ * @return Concurrency.
+ */
+ public IgniteTxConcurrency concurrency() {
+ return concurrency;
+ }
+
+ /**
+ * @return Isolation level.
+ */
+ public IgniteTxIsolation isolation() {
+ return isolation;
+ }
+
+ /**
+ * @return Read set.
+ */
+ public Collection<IgniteTxEntry<K, V>> reads() {
+ return reads;
+ }
+
+ /**
+ * @return Write entries.
+ */
+ public Collection<IgniteTxEntry<K, V>> writes() {
+ return writes;
+ }
+
+ /**
+ * @param reads Reads.
+ */
+ protected void reads(Collection<IgniteTxEntry<K, V>> reads) {
+ this.reads = reads;
+ }
+
+ /**
+ * @param writes Writes.
+ */
+ protected void writes(Collection<IgniteTxEntry<K, V>> writes) {
+ this.writes = writes;
+ }
+
+ /**
+ * @return Group lock key if preparing group-lock transaction.
+ */
+ @Nullable public IgniteTxKey groupLockKey() {
+ return grpLockKey;
+ }
+
+ /**
+ * @return {@code True} if preparing group-lock transaction with partition lock.
+ */
+ public boolean partitionLock() {
+ return partLock;
+ }
+
+ /**
+ * @return Expected transaction size.
+ */
+ public int txSize() {
+ return txSize;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (writes != null) {
+ marshalTx(writes, ctx);
+
+ writesBytes = new ArrayList<>(writes.size());
+
+ for (IgniteTxEntry<K, V> e : writes)
+ writesBytes.add(ctx.marshaller().marshal(e));
+ }
+
+ if (reads != null) {
+ marshalTx(reads, ctx);
+
+ readsBytes = new ArrayList<>(reads.size());
+
+ for (IgniteTxEntry<K, V> e : reads)
+ readsBytes.add(ctx.marshaller().marshal(e));
+ }
+
+ if (grpLockKey != null && grpLockKeyBytes == null)
+ grpLockKeyBytes = ctx.marshaller().marshal(grpLockKey);
+
+ if (dhtVers != null && dhtVersBytes == null)
+ dhtVersBytes = ctx.marshaller().marshal(dhtVers);
+
+ if (txNodes != null)
+ txNodesBytes = ctx.marshaller().marshal(txNodes);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (writesBytes != null) {
+ writes = new ArrayList<>(writesBytes.size());
+
+ for (byte[] arr : writesBytes)
+ writes.add(ctx.marshaller().<IgniteTxEntry<K, V>>unmarshal(arr, ldr));
+
+ unmarshalTx(writes, false, ctx, ldr);
+ }
+
+ if (readsBytes != null) {
+ reads = new ArrayList<>(readsBytes.size());
+
+ for (byte[] arr : readsBytes)
+ reads.add(ctx.marshaller().<IgniteTxEntry<K, V>>unmarshal(arr, ldr));
+
+ unmarshalTx(reads, false, ctx, ldr);
+ }
+
+ if (grpLockKeyBytes != null && grpLockKey == null)
+ grpLockKey = ctx.marshaller().unmarshal(grpLockKeyBytes, ldr);
+
+ if (dhtVersBytes != null && dhtVers == null)
+ dhtVers = ctx.marshaller().unmarshal(dhtVersBytes, ldr);
+
+ if (txNodesBytes != null)
+ txNodes = ctx.marshaller().unmarshal(txNodesBytes, ldr);
+ }
+
+ /**
+ *
+ * @param out Output.
+ * @param col Set to write.
+ * @throws IOException If write failed.
+ */
+ private void writeCollection(ObjectOutput out, Collection<IgniteTxEntry<K, V>> col) throws IOException {
+ boolean empty = F.isEmpty(col);
+
+ if (!empty) {
+ out.writeInt(col.size());
+
+ for (IgniteTxEntry<K, V> e : col) {
+ V val = e.value();
+ boolean hasWriteVal = e.hasWriteValue();
+ boolean hasReadVal = e.hasReadValue();
+
+ try {
+ // Don't serialize value if invalidate is set to true.
+ if (invalidate)
+ e.value(null, false, false);
+
+ out.writeObject(e);
+ }
+ finally {
+ // Set original value back.
+ e.value(val, hasWriteVal, hasReadVal);
+ }
+ }
+ }
+ else
+ out.writeInt(-1);
+ }
+
+ /**
+ * @param in Input.
+ * @return Deserialized set.
+ * @throws IOException If deserialization failed.
+ * @throws ClassNotFoundException If deserialized class could not be found.
+ */
+ @SuppressWarnings({"unchecked"})
+ @Nullable private Collection<IgniteTxEntry<K, V>> readCollection(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ List<IgniteTxEntry<K, V>> col = null;
+
+ int size = in.readInt();
+
+ // Check null flag.
+ if (size != -1) {
+ col = new ArrayList<>(size);
+
+ for (int i = 0; i < size; i++)
+ col.add((IgniteTxEntry<K, V>)in.readObject());
+ }
+
+ return col == null ? Collections.<IgniteTxEntry<K,V>>emptyList() : col;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors",
+ "OverriddenMethodCallDuringObjectConstruction"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDistributedTxPrepareRequest _clone = new GridDistributedTxPrepareRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDistributedTxPrepareRequest _clone = (GridDistributedTxPrepareRequest)_msg;
+
+ _clone.threadId = threadId;
+ _clone.concurrency = concurrency;
+ _clone.isolation = isolation;
+ _clone.commitVer = commitVer;
+ _clone.timeout = timeout;
+ _clone.invalidate = invalidate;
+ _clone.reads = reads;
+ _clone.readsBytes = readsBytes;
+ _clone.writes = writes;
+ _clone.writesBytes = writesBytes;
+ _clone.dhtVers = dhtVers;
+ _clone.dhtVersBytes = dhtVersBytes;
+ _clone.grpLockKey = grpLockKey;
+ _clone.grpLockKeyBytes = grpLockKeyBytes;
+ _clone.partLock = partLock;
+ _clone.txSize = txSize;
+ _clone.txNodes = txNodes;
+ _clone.txNodesBytes = txNodesBytes;
+ _clone.sys = sys;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 8:
- if (!commState.putCacheVersion(commitVer))
++ if (!commState.putCacheVersion("commitVer", commitVer))
+ return false;
+
+ commState.idx++;
+
+ case 9:
- if (!commState.putEnum(concurrency))
++ if (!commState.putEnum("concurrency", concurrency))
+ return false;
+
+ commState.idx++;
+
+ case 10:
- if (!commState.putByteArray(dhtVersBytes))
++ if (!commState.putByteArray("dhtVersBytes", dhtVersBytes))
+ return false;
+
+ commState.idx++;
+
+ case 11:
- if (!commState.putByteArray(grpLockKeyBytes))
++ if (!commState.putByteArray("grpLockKeyBytes", grpLockKeyBytes))
+ return false;
+
+ commState.idx++;
+
+ case 12:
- if (!commState.putBoolean(invalidate))
++ if (!commState.putBoolean("invalidate", invalidate))
+ return false;
+
+ commState.idx++;
+
+ case 13:
- if (!commState.putEnum(isolation))
++ if (!commState.putEnum("isolation", isolation))
+ return false;
+
+ commState.idx++;
+
+ case 14:
- if (!commState.putBoolean(partLock))
++ if (!commState.putBoolean("partLock", partLock))
+ return false;
+
+ commState.idx++;
+
+ case 15:
+ if (readsBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(readsBytes.size()))
++ if (!commState.putInt(null, readsBytes.size()))
+ return false;
+
+ commState.it = readsBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 16:
- if (!commState.putLong(threadId))
++ if (!commState.putBoolean("sys", sys))
+ return false;
+
+ commState.idx++;
+
+ case 17:
- if (!commState.putLong(timeout))
++ if (!commState.putLong("threadId", threadId))
+ return false;
+
+ commState.idx++;
+
+ case 18:
- if (!commState.putByteArray(txNodesBytes))
++ if (!commState.putLong("timeout", timeout))
+ return false;
+
+ commState.idx++;
+
+ case 19:
- if (!commState.putInt(txSize))
++ if (!commState.putByteArray("txNodesBytes", txNodesBytes))
+ return false;
+
+ commState.idx++;
+
+ case 20:
++ if (!commState.putInt("txSize", txSize))
++ return false;
++
++ commState.idx++;
++
++ case 21:
+ if (writesBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(writesBytes.size()))
++ if (!commState.putInt(null, writesBytes.size()))
+ return false;
+
+ commState.it = writesBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
- case 21:
- if (!commState.putBoolean(sys))
- return false;
-
- commState.idx++;
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 8:
- GridCacheVersion commitVer0 = commState.getCacheVersion();
++ commitVer = commState.getCacheVersion("commitVer");
+
- if (commitVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- commitVer = commitVer0;
-
+ commState.idx++;
+
+ case 9:
- if (buf.remaining() < 1)
- return false;
++ byte concurrency0 = commState.getByte("concurrency");
+
- byte concurrency0 = commState.getByte();
++ if (!commState.lastRead())
++ return false;
+
+ concurrency = IgniteTxConcurrency.fromOrdinal(concurrency0);
+
+ commState.idx++;
+
+ case 10:
- byte[] dhtVersBytes0 = commState.getByteArray();
++ dhtVersBytes = commState.getByteArray("dhtVersBytes");
+
- if (dhtVersBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- dhtVersBytes = dhtVersBytes0;
-
+ commState.idx++;
+
+ case 11:
- byte[] grpLockKeyBytes0 = commState.getByteArray();
++ grpLockKeyBytes = commState.getByteArray("grpLockKeyBytes");
+
- if (grpLockKeyBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- grpLockKeyBytes = grpLockKeyBytes0;
-
+ commState.idx++;
+
+ case 12:
- if (buf.remaining() < 1)
- return false;
++ invalidate = commState.getBoolean("invalidate");
+
- invalidate = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 13:
- if (buf.remaining() < 1)
- return false;
++ byte isolation0 = commState.getByte("isolation");
+
- byte isolation0 = commState.getByte();
++ if (!commState.lastRead())
++ return false;
+
+ isolation = IgniteTxIsolation.fromOrdinal(isolation0);
+
+ commState.idx++;
+
+ case 14:
- if (buf.remaining() < 1)
- return false;
++ partLock = commState.getBoolean("partLock");
+
- partLock = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 15:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (readsBytes == null)
+ readsBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ readsBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 16:
- if (buf.remaining() < 8)
- return false;
++ sys = commState.getBoolean("sys");
+
- threadId = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 17:
- if (buf.remaining() < 8)
- return false;
++ threadId = commState.getLong("threadId");
+
- timeout = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 18:
- byte[] txNodesBytes0 = commState.getByteArray();
++ timeout = commState.getLong("timeout");
+
- if (txNodesBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- txNodesBytes = txNodesBytes0;
-
+ commState.idx++;
+
+ case 19:
- if (buf.remaining() < 4)
- return false;
++ txNodesBytes = commState.getByteArray("txNodesBytes");
+
- txSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 20:
++ txSize = commState.getInt("txSize");
++
++ if (!commState.lastRead())
++ return false;
++
++ commState.idx++;
++
++ case 21:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (writesBytes == null)
+ writesBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ writesBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
- case 21:
- if (buf.remaining() < 1)
- return false;
-
- sys = commState.getBoolean();
-
- commState.idx++;
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 26;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return GridToStringBuilder.toString(GridDistributedTxPrepareRequest.class, this,
+ "super", super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
index 0000000,837f8b0..b61c667
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
@@@ -1,0 -1,251 +1,247 @@@
+ /*
+ * 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.cache.distributed;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Response to prepare request.
+ */
+ public class GridDistributedTxPrepareResponse<K, V> extends GridDistributedBaseMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Collections of local lock candidates. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Map<K, Collection<GridCacheMvccCandidate<K>>> cands;
+
+ /** */
+ private byte[] candsBytes;
+
+ /** Error. */
+ @GridToStringExclude
+ @GridDirectTransient
+ private Throwable err;
+
+ /** Serialized error. */
+ private byte[] errBytes;
+
+ /**
+ * Empty constructor (required by {@link Externalizable}).
+ */
+ public GridDistributedTxPrepareResponse() {
+ /* No-op. */
+ }
+
+ /**
+ * @param xid Transaction ID.
+ */
+ public GridDistributedTxPrepareResponse(GridCacheVersion xid) {
+ super(xid, 0);
+ }
+
+ /**
+ * @param xid Lock ID.
+ * @param err Error.
+ */
+ public GridDistributedTxPrepareResponse(GridCacheVersion xid, Throwable err) {
+ super(xid, 0);
+
+ this.err = err;
+ }
+
+ /**
+ * @return Error.
+ */
+ public Throwable error() {
+ return err;
+ }
+
+ /**
+ * @param err Error to set.
+ */
+ public void error(Throwable err) {
+ this.err = err;
+ }
+
+ /**
+ * @return Rollback flag.
+ */
+ public boolean isRollback() {
+ return err != null;
+ }
+
+ /**
+ * @param cands Candidates map to set.
+ */
+ public void candidates(Map<K, Collection<GridCacheMvccCandidate<K>>> cands) {
+ this.cands = cands;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (candsBytes == null && cands != null) {
+ if (ctx.deploymentEnabled()) {
+ for (K k : cands.keySet())
+ prepareObject(k, ctx);
+ }
+
+ candsBytes = CU.marshal(ctx, cands);
+ }
+
+ if (err != null)
+ errBytes = ctx.marshaller().marshal(err);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (candsBytes != null && cands == null)
+ cands = ctx.marshaller().unmarshal(candsBytes, ldr);
+
+ if (errBytes != null)
+ err = ctx.marshaller().unmarshal(errBytes, ldr);
+ }
+
+ /**
+ *
+ * @param key Candidates key.
+ * @return Collection of lock candidates at given index.
+ */
+ @Nullable public Collection<GridCacheMvccCandidate<K>> candidatesForKey(K key) {
+ assert key != null;
+
+ if (cands == null)
+ return null;
+
+ return cands.get(key);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors",
+ "OverriddenMethodCallDuringObjectConstruction"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDistributedTxPrepareResponse _clone = new GridDistributedTxPrepareResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDistributedTxPrepareResponse _clone = (GridDistributedTxPrepareResponse)_msg;
+
+ _clone.cands = cands;
+ _clone.candsBytes = candsBytes;
+ _clone.err = err;
+ _clone.errBytes = errBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 8:
- if (!commState.putByteArray(candsBytes))
++ if (!commState.putByteArray("candsBytes", candsBytes))
+ return false;
+
+ commState.idx++;
+
+ case 9:
- if (!commState.putByteArray(errBytes))
++ if (!commState.putByteArray("errBytes", errBytes))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 8:
- byte[] candsBytes0 = commState.getByteArray();
++ candsBytes = commState.getByteArray("candsBytes");
+
- if (candsBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- candsBytes = candsBytes0;
-
+ commState.idx++;
+
+ case 9:
- byte[] errBytes0 = commState.getByteArray();
++ errBytes = commState.getByteArray("errBytes");
+
- if (errBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- errBytes = errBytes0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 27;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return GridToStringBuilder.toString(GridDistributedTxPrepareResponse.class, this, "err",
+ err == null ? "null" : err.toString(), "super", super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java
index 0000000,7dcabd1..9971d88
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java
@@@ -1,0 -1,239 +1,239 @@@
+ /*
+ * 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.cache.distributed;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Lock request message.
+ */
+ public class GridDistributedUnlockRequest<K, V> extends GridDistributedBaseMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Keys to unlock. */
+ @GridDirectCollection(byte[].class)
+ private List<byte[]> keyBytes;
+
+ /** Keys. */
+ @GridDirectTransient
+ private List<K> keys;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridDistributedUnlockRequest() {
+ /* No-op. */
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param keyCnt Key count.
+ */
+ public GridDistributedUnlockRequest(int cacheId, int keyCnt) {
+ super(keyCnt);
+
+ this.cacheId = cacheId;
+ }
+
+ /**
+ * @return Key to lock.
+ */
+ public List<byte[]> keyBytes() {
+ return keyBytes;
+ }
+
+ /**
+ * @return Keys.
+ */
+ public List<K> keys() {
+ return keys;
+ }
+
+ /**
+ * @param key Key.
+ * @param bytes Key bytes.
+ * @param ctx Context.
+ * @throws IgniteCheckedException If failed.
+ */
+ public void addKey(K key, byte[] bytes, GridCacheContext<K, V> ctx) throws IgniteCheckedException {
+ boolean depEnabled = ctx.deploymentEnabled();
+
+ if (depEnabled)
+ prepareObject(key, ctx.shared());
+
+ if (keys == null)
+ keys = new ArrayList<>(keysCount());
+
+ keys.add(key);
+
+ if (keyBytes == null)
+ keyBytes = new ArrayList<>(keysCount());
+
+ keyBytes.add(bytes);
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (F.isEmpty(keyBytes) && !F.isEmpty(keys))
+ keyBytes = marshalCollection(keys, ctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (keys == null && !F.isEmpty(keyBytes))
+ keys = unmarshalCollection(keyBytes, ctx, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors",
+ "OverriddenMethodCallDuringObjectConstruction"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDistributedUnlockRequest _clone = new GridDistributedUnlockRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDistributedUnlockRequest _clone = (GridDistributedUnlockRequest)_msg;
+
+ _clone.keyBytes = keyBytes;
+ _clone.keys = keys;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 8:
+ if (keyBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(keyBytes.size()))
++ if (!commState.putInt(null, keyBytes.size()))
+ return false;
+
+ commState.it = keyBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 8:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (keyBytes == null)
+ keyBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ keyBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 28;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDistributedUnlockRequest.class, this, "keyBytesSize",
+ keyBytes == null ? 0 : keyBytes.size(), "super", super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java
index 0000000,4fffd45..50d8f1c
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java
@@@ -1,0 -1,139 +1,139 @@@
+ /*
+ * 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.cache.distributed.dht;
+
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.nio.*;
+
+ /**
+ * Affinity assignment request.
+ */
+ public class GridDhtAffinityAssignmentRequest<K, V> extends GridCacheMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Topology version being queried. */
+ private long topVer;
+
+ /**
+ * Empty constructor.
+ */
+ public GridDhtAffinityAssignmentRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param topVer Topology version.
+ */
+ public GridDhtAffinityAssignmentRequest(int cacheId, long topVer) {
+ this.cacheId = cacheId;
+ this.topVer = topVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean allowForStartup() {
+ return true;
+ }
+
+ /**
+ * @return Requested topology version.
+ */
+ @Override public long topologyVersion() {
+ return topVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 79;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtAffinityAssignmentRequest _clone = new GridDhtAffinityAssignmentRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtAffinityAssignmentRequest _clone = (GridDhtAffinityAssignmentRequest)_msg;
+
+ _clone.topVer = topVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
- if (!commState.putLong(topVer))
++ if (!commState.putLong("topVer", topVer))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
- if (buf.remaining() < 8)
- return false;
++ topVer = commState.getLong("topVer");
+
- topVer = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtAffinityAssignmentRequest.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentResponse.java
index 0000000,226bd00..669f5d0
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAffinityAssignmentResponse.java
@@@ -1,0 -1,196 +1,194 @@@
+ /*
+ * 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.cache.distributed.dht;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.cluster.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Affinity assignment response.
+ */
+ public class GridDhtAffinityAssignmentResponse<K, V> extends GridCacheMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Topology version. */
+ private long topVer;
+
+ /** Affinity assignment. */
+ @GridDirectTransient
+ @GridToStringInclude
+ private List<List<ClusterNode>> affAssignment;
+
+ /** Affinity assignment bytes. */
+ private byte[] affAssignmentBytes;
+
+ /**
+ * Empty constructor.
+ */
+ public GridDhtAffinityAssignmentResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param topVer Topology version.
+ * @param affAssignment Affinity assignment.
+ */
+ public GridDhtAffinityAssignmentResponse(int cacheId, long topVer, List<List<ClusterNode>> affAssignment) {
+ this.cacheId = cacheId;
+ this.topVer = topVer;
+ this.affAssignment = affAssignment;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean allowForStartup() {
+ return true;
+ }
+
+ /**
+ * @return Topology version.
+ */
+ @Override public long topologyVersion() {
+ return topVer;
+ }
+
+ /**
+ * @return Affinity assignment.
+ */
+ public List<List<ClusterNode>> affinityAssignment() {
+ return affAssignment;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 80;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtAffinityAssignmentResponse _clone = new GridDhtAffinityAssignmentResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtAffinityAssignmentResponse _clone = (GridDhtAffinityAssignmentResponse)_msg;
+
+ _clone.topVer = topVer;
+ _clone.affAssignment = affAssignment;
+ _clone.affAssignmentBytes = affAssignmentBytes;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (affAssignment != null)
+ affAssignmentBytes = ctx.marshaller().marshal(affAssignment);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (affAssignmentBytes != null)
+ affAssignment = ctx.marshaller().unmarshal(affAssignmentBytes, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
- if (!commState.putByteArray(affAssignmentBytes))
++ if (!commState.putByteArray("affAssignmentBytes", affAssignmentBytes))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putLong(topVer))
++ if (!commState.putLong("topVer", topVer))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
- byte[] affAssignmentBytes0 = commState.getByteArray();
++ affAssignmentBytes = commState.getByteArray("affAssignmentBytes");
+
- if (affAssignmentBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- affAssignmentBytes = affAssignmentBytes0;
-
+ commState.idx++;
+
+ case 4:
- if (buf.remaining() < 8)
- return false;
++ topVer = commState.getLong("topVer");
+
- topVer = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtAffinityAssignmentResponse.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
index 0000000,483fc2f..b5fe8b3
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
@@@ -1,0 -1,597 +1,587 @@@
+ /*
+ * 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.cache.distributed.dht;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.transactions.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * DHT lock request.
+ */
+ public class GridDhtLockRequest<K, V> extends GridDistributedLockRequest<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Near keys. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private List<K> nearKeys;
+
+ /** Near keys to lock. */
+ @GridToStringExclude
+ @GridDirectCollection(byte[].class)
+ private List<byte[]> nearKeyBytes;
+
+ /** Invalidate reader flags. */
+ private BitSet invalidateEntries;
+
+ /** Mini future ID. */
+ private IgniteUuid miniId;
+
+ /** Owner mapped version, if any. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Map<K, GridCacheVersion> owned;
+
+ /** Owner mapped version bytes. */
+ private byte[] ownedBytes;
+
+ /** Topology version. */
+ private long topVer;
+
+ /** Subject ID. */
+ @GridDirectVersion(1)
+ private UUID subjId;
+
+ /** Task name hash. */
+ @GridDirectVersion(2)
+ private int taskNameHash;
+
+ /** Indexes of keys needed to be preloaded. */
+ @GridDirectVersion(3)
+ private BitSet preloadKeys;
+
+ /** TTL for read operation. */
+ private long accessTtl;
+
+ /**
+ * Empty constructor required for {@link Externalizable}.
+ */
+ public GridDhtLockRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param nodeId Node ID.
+ * @param nearXidVer Near transaction ID.
+ * @param threadId Thread ID.
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ * @param lockVer Cache version.
+ * @param topVer Topology version.
+ * @param isInTx {@code True} if implicit transaction lock.
+ * @param isRead Indicates whether implicit lock is for read or write operation.
+ * @param isolation Transaction isolation.
+ * @param isInvalidate Invalidation flag.
+ * @param timeout Lock timeout.
+ * @param dhtCnt DHT count.
+ * @param nearCnt Near count.
+ * @param txSize Expected transaction size.
+ * @param grpLockKey Group lock key.
+ * @param partLock {@code True} if partition lock.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash code.
+ * @param accessTtl TTL for read operation.
+ */
+ public GridDhtLockRequest(
+ int cacheId,
+ UUID nodeId,
+ GridCacheVersion nearXidVer,
+ long threadId,
+ IgniteUuid futId,
+ IgniteUuid miniId,
+ GridCacheVersion lockVer,
+ long topVer,
+ boolean isInTx,
+ boolean isRead,
+ IgniteTxIsolation isolation,
+ boolean isInvalidate,
+ long timeout,
+ int dhtCnt,
+ int nearCnt,
+ int txSize,
+ @Nullable IgniteTxKey grpLockKey,
+ boolean partLock,
+ @Nullable UUID subjId,
+ int taskNameHash,
+ long accessTtl
+ ) {
+ super(cacheId,
+ nodeId,
+ nearXidVer,
+ threadId,
+ futId,
+ lockVer,
+ isInTx,
+ isRead,
+ isolation,
+ isInvalidate,
+ timeout,
+ dhtCnt == 0 ? nearCnt : dhtCnt,
+ txSize,
+ grpLockKey,
+ partLock);
+
+ this.topVer = topVer;
+
+ nearKeyBytes = nearCnt == 0 ? Collections.<byte[]>emptyList() : new ArrayList<byte[]>(nearCnt);
+ nearKeys = nearCnt == 0 ? Collections.<K>emptyList() : new ArrayList<K>(nearCnt);
+ invalidateEntries = new BitSet(dhtCnt == 0 ? nearCnt : dhtCnt);
+
+ assert miniId != null;
+
+ this.miniId = miniId;
+ this.subjId = subjId;
+ this.taskNameHash = taskNameHash;
+ this.accessTtl = accessTtl;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean allowForStartup() {
+ return true;
+ }
+
+ /**
+ * @return Near node ID.
+ */
+ public UUID nearNodeId() {
+ return nodeId();
+ }
+
+ /**
+ * @return Subject ID.
+ */
+ public UUID subjectId() {
+ return subjId;
+ }
+
+ /**
+ * @return Task name hash.
+ */
+ public int taskNameHash() {
+ return taskNameHash;
+ }
+
+ /**
+ * @return Topology version.
+ */
+ @Override public long topologyVersion() {
+ return topVer;
+ }
+
+ /**
+ * @return Near keys.
+ */
+ public List<byte[]> nearKeyBytes() {
+ return nearKeyBytes == null ? Collections.<byte[]>emptyList() : nearKeyBytes;
+ }
+
+ /**
+ * Adds a Near key.
+ *
+ * @param key Key.
+ * @param keyBytes Key bytes.
+ * @param ctx Context.
+ * @throws IgniteCheckedException If failed.
+ */
+ public void addNearKey(K key, byte[] keyBytes, GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ if (ctx.deploymentEnabled())
+ prepareObject(key, ctx);
+
+ nearKeys.add(key);
+
+ if (keyBytes != null)
+ nearKeyBytes.add(keyBytes);
+ }
+
+ /**
+ * @return Near keys.
+ */
+ public List<K> nearKeys() {
+ return nearKeys == null ? Collections.<K>emptyList() : nearKeys;
+ }
+
+ /**
+ * Adds a DHT key.
+ *
+ * @param key Key.
+ * @param keyBytes Key bytes.
+ * @param writeEntry Write entry.
+ * @param drVer DR version.
+ * @param invalidateEntry Flag indicating whether node should attempt to invalidate reader.
+ * @param ctx Context.
+ * @throws IgniteCheckedException If failed.
+ */
+ public void addDhtKey(
+ K key,
+ byte[] keyBytes,
+ IgniteTxEntry<K, V> writeEntry,
+ @Nullable GridCacheVersion drVer,
+ boolean invalidateEntry,
+ GridCacheContext<K, V> ctx
+ ) throws IgniteCheckedException {
+ invalidateEntries.set(idx, invalidateEntry);
+
+ addKeyBytes(key, keyBytes, writeEntry, false, null, drVer, ctx);
+ }
+
+ /**
+ * Marks last added key for preloading.
+ */
+ public void markLastKeyForPreload() {
+ assert idx > 0;
+
+ if (preloadKeys == null)
+ preloadKeys = new BitSet();
+
+ preloadKeys.set(idx - 1, true);
+ }
+
+ /**
+ * @param idx Key index.
+ * @return {@code True} if need to preload key with given index.
+ */
+ public boolean needPreloadKey(int idx) {
+ return preloadKeys != null && preloadKeys.get(idx);
+ }
+
+ /**
+ * Sets owner and its mapped version.
+ *
+ * @param key Key.
+ * @param keyBytes Key bytes.
+ * @param ownerMapped Owner mapped version.
+ */
+ public void owned(K key, byte[] keyBytes, GridCacheVersion ownerMapped) {
+ if (owned == null)
+ owned = new GridLeanMap<>(3);
+
+ owned.put(key, ownerMapped);
+ }
+
+ /**
+ * @param key Key.
+ * @return Owner and its mapped versions.
+ */
+ @Nullable public GridCacheVersion owned(K key) {
+ return owned == null ? null : owned.get(key);
+ }
+
+ /**
+ * @param idx Entry index to check.
+ * @return {@code True} if near entry should be invalidated.
+ */
+ public boolean invalidateNearEntry(int idx) {
+ return invalidateEntries.get(idx);
+ }
+
+ /**
+ * @return Mini ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @return TTL for read operation.
+ */
+ public long accessTtl() {
+ return accessTtl;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ assert F.isEmpty(nearKeys) || !F.isEmpty(nearKeyBytes);
+
+ if (owned != null)
+ ownedBytes = CU.marshal(ctx, owned);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (nearKeys == null && nearKeyBytes != null)
+ nearKeys = unmarshalCollection(nearKeyBytes, ctx, ldr);
+
+ if (ownedBytes != null)
+ owned = ctx.marshaller().unmarshal(ownedBytes, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtLockRequest _clone = new GridDhtLockRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtLockRequest _clone = (GridDhtLockRequest)_msg;
+
+ _clone.nearKeys = nearKeys;
+ _clone.nearKeyBytes = nearKeyBytes;
+ _clone.invalidateEntries = invalidateEntries;
+ _clone.miniId = miniId;
+ _clone.owned = owned;
+ _clone.ownedBytes = ownedBytes;
+ _clone.topVer = topVer;
+ _clone.subjId = subjId;
+ _clone.taskNameHash = taskNameHash;
+ _clone.preloadKeys = preloadKeys;
+ _clone.accessTtl = accessTtl;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 24:
- if (!commState.putBitSet(invalidateEntries))
++ if (!commState.putBitSet("invalidateEntries", invalidateEntries))
+ return false;
+
+ commState.idx++;
+
+ case 25:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 26:
+ if (nearKeyBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(nearKeyBytes.size()))
++ if (!commState.putInt(null, nearKeyBytes.size()))
+ return false;
+
+ commState.it = nearKeyBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 27:
- if (!commState.putByteArray(ownedBytes))
++ if (!commState.putByteArray("ownedBytes", ownedBytes))
+ return false;
+
+ commState.idx++;
+
+ case 28:
- if (!commState.putLong(topVer))
++ if (!commState.putLong("topVer", topVer))
+ return false;
+
+ commState.idx++;
+
+ case 29:
- if (!commState.putUuid(subjId))
++ if (!commState.putUuid("subjId", subjId))
+ return false;
+
+ commState.idx++;
+
+ case 30:
- if (!commState.putInt(taskNameHash))
++ if (!commState.putInt("taskNameHash", taskNameHash))
+ return false;
+
+ commState.idx++;
+
+ case 31:
- if (!commState.putBitSet(preloadKeys))
++ if (!commState.putBitSet("preloadKeys", preloadKeys))
+ return false;
+
+ commState.idx++;
+
+ case 32:
+ if (!commState.putLong(accessTtl))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 24:
- BitSet invalidateEntries0 = commState.getBitSet();
++ invalidateEntries = commState.getBitSet("invalidateEntries");
+
- if (invalidateEntries0 == BIT_SET_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- invalidateEntries = invalidateEntries0;
-
+ commState.idx++;
+
+ case 25:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 26:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (nearKeyBytes == null)
+ nearKeyBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ nearKeyBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 27:
- byte[] ownedBytes0 = commState.getByteArray();
++ ownedBytes = commState.getByteArray("ownedBytes");
+
- if (ownedBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- ownedBytes = ownedBytes0;
-
+ commState.idx++;
+
+ case 28:
- if (buf.remaining() < 8)
- return false;
++ topVer = commState.getLong("topVer");
+
- topVer = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 29:
- UUID subjId0 = commState.getUuid();
++ subjId = commState.getUuid("subjId");
+
- if (subjId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- subjId = subjId0;
-
+ commState.idx++;
+
+ case 30:
- if (buf.remaining() < 4)
- return false;
++ taskNameHash = commState.getInt("taskNameHash");
+
- taskNameHash = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 31:
- BitSet preloadKeys0 = commState.getBitSet();
++ preloadKeys = commState.getBitSet("preloadKeys");
+
- if (preloadKeys0 == BIT_SET_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- preloadKeys = preloadKeys0;
-
+ commState.idx++;
+
+ case 32:
+ if (buf.remaining() < 8)
+ return false;
+
+ accessTtl = commState.getLong();
+
+ commState.idx++;
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 29;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtLockRequest.class, this, "nearKeyBytesSize", nearKeyBytes.size(),
+ "super", super.toString());
+ }
+ }
[06/52] [abbrv] incubator-ignite git commit: minor
Posted by vk...@apache.org.
minor
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/535ca6f3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/535ca6f3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/535ca6f3
Branch: refs/heads/ignite-61
Commit: 535ca6f3b32f80df24325b3fcf6fb722b525e201
Parents: c5247ab
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jan 29 12:46:12 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jan 29 12:46:12 2015 +0300
----------------------------------------------------------------------
.../core/src/main/java/org/apache/ignite/internal/IgnitionEx.java | 3 ---
1 file changed, 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/535ca6f3/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index acab6d0..d962de0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -1144,9 +1144,6 @@ public class IgnitionEx {
/** */
private static final String[] EMPTY_STR_ARR = new String[0];
- /** Empty array of caches. */
- private static final CacheConfiguration[] EMPTY_CACHE_CONFIGS = new CacheConfiguration[0];
-
/** Grid name. */
private final String name;
[43/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
index 0000000,3189649..db47889
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
@@@ -1,0 -1,834 +1,822 @@@
+ /*
+ * 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.cache.distributed;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.transactions.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Lock request message.
+ */
+ public class GridDistributedLockRequest<K, V> extends GridDistributedBaseMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Sender node ID. */
+ private UUID nodeId;
+
+ /** Near transaction version. */
+ private GridCacheVersion nearXidVer;
+
+ /** Thread ID. */
+ private long threadId;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /** Max wait timeout. */
+ private long timeout;
+
+ /** Indicates whether lock is obtained within a scope of transaction. */
+ private boolean isInTx;
+
+ /** Invalidate flag for transactions. */
+ private boolean isInvalidate;
+
+ /** Indicates whether implicit lock so for read or write operation. */
+ private boolean isRead;
+
+ /** Transaction isolation. */
+ private IgniteTxIsolation isolation;
+
+ /** Key bytes for keys to lock. */
+ @GridDirectCollection(byte[].class)
+ private List<byte[]> keyBytes;
+
+ /** Keys. */
+ @GridDirectTransient
+ private List<K> keys;
+
+ /** Write entries. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private List<IgniteTxEntry<K, V>> writeEntries;
+
+ /** Serialized write entries. */
+ private byte[] writeEntriesBytes;
+
+ /** Array indicating whether value should be returned for a key. */
+ @GridToStringInclude
+ private boolean[] retVals;
+
+ /** Key-bytes index. */
+ @GridDirectTransient
+ protected int idx;
+
+ /** Key count. */
+ private int txSize;
+
+ /** Group lock key if this is a group-lock transaction. */
+ @GridDirectTransient
+ private IgniteTxKey grpLockKey;
+
+ /** Group lock key bytes. */
+ private byte[] grpLockKeyBytes;
+
+ /** Partition lock flag. Only if group-lock transaction. */
+ private boolean partLock;
+
+ /** DR versions. */
+ @GridToStringInclude
+ private GridCacheVersion[] drVersByIdx;
+
+ /**
+ * Empty constructor.
+ */
+ public GridDistributedLockRequest() {
+ /* No-op. */
+ }
+
+ /**
+ * @param nodeId Node ID.
+ * @param nearXidVer Near transaction ID.
+ * @param threadId Thread ID.
+ * @param futId Future ID.
+ * @param lockVer Cache version.
+ * @param isInTx {@code True} if implicit transaction lock.
+ * @param isRead Indicates whether implicit lock is for read or write operation.
+ * @param isolation Transaction isolation.
+ * @param isInvalidate Invalidation flag.
+ * @param timeout Lock timeout.
+ * @param keyCnt Number of keys.
+ * @param txSize Expected transaction size.
+ * @param grpLockKey Group lock key if this is a group-lock transaction.
+ * @param partLock {@code True} if this is a group-lock transaction request and whole partition is
+ * locked.
+ */
+ public GridDistributedLockRequest(
+ int cacheId,
+ UUID nodeId,
+ @Nullable GridCacheVersion nearXidVer,
+ long threadId,
+ IgniteUuid futId,
+ GridCacheVersion lockVer,
+ boolean isInTx,
+ boolean isRead,
+ IgniteTxIsolation isolation,
+ boolean isInvalidate,
+ long timeout,
+ int keyCnt,
+ int txSize,
+ @Nullable IgniteTxKey grpLockKey,
+ boolean partLock
+ ) {
+ super(lockVer, keyCnt);
+
+ assert keyCnt > 0;
+ assert futId != null;
+ assert !isInTx || isolation != null;
+
+ this.cacheId = cacheId;
+ this.nodeId = nodeId;
+ this.nearXidVer = nearXidVer;
+ this.threadId = threadId;
+ this.futId = futId;
+ this.isInTx = isInTx;
+ this.isRead = isRead;
+ this.isolation = isolation;
+ this.isInvalidate = isInvalidate;
+ this.timeout = timeout;
+ this.txSize = txSize;
+ this.grpLockKey = grpLockKey;
+ this.partLock = partLock;
+
+ retVals = new boolean[keyCnt];
+ }
+
+ /**
+ *
+ * @return Node ID.
+ */
+ public UUID nodeId() {
+ return nodeId;
+ }
+
+ /**
+ * @return Near transaction ID.
+ */
+ public GridCacheVersion nearXidVersion() {
+ return nearXidVer;
+ }
+
+ /**
+ *
+ * @return Owner node thread ID.
+ */
+ public long threadId() {
+ return threadId;
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return {@code True} if implicit transaction lock.
+ */
+ public boolean inTx() {
+ return isInTx;
+ }
+
+ /**
+ * @return Invalidate flag.
+ */
+ public boolean isInvalidate() {
+ return isInvalidate;
+ }
+
+ /**
+ * @return {@code True} if lock is implicit and for a read operation.
+ */
+ public boolean txRead() {
+ return isRead;
+ }
+
+ /**
+ * @param idx Key index.
+ * @return Flag indicating whether a value should be returned.
+ */
+ public boolean returnValue(int idx) {
+ return retVals[idx];
+ }
+
+ /**
+ * @return Return flags.
+ */
+ public boolean[] returnFlags() {
+ return retVals;
+ }
+
+ /**
+ * @return Transaction isolation or <tt>null</tt> if not in transaction.
+ */
+ public IgniteTxIsolation isolation() {
+ return isolation;
+ }
+
+ /**
+ *
+ * @return Key to lock.
+ */
+ public List<byte[]> keyBytes() {
+ return keyBytes;
+ }
+
+ /**
+ * @return Write entries list.
+ */
+ public List<IgniteTxEntry<K, V>> writeEntries() {
+ return writeEntries;
+ }
+
+ /**
+ * @return Tx size.
+ */
+ public int txSize() {
+ return txSize;
+ }
+
+ /**
+ * Adds a key.
+ *
+ * @param key Key.
+ * @param retVal Flag indicating whether value should be returned.
+ * @param keyBytes Key bytes.
+ * @param writeEntry Write entry.
+ * @param cands Candidates.
+ * @param drVer DR version.
+ * @param ctx Context.
+ * @throws IgniteCheckedException If failed.
+ */
+ public void addKeyBytes(
+ K key,
+ @Nullable byte[] keyBytes,
+ @Nullable IgniteTxEntry<K, V> writeEntry,
+ boolean retVal,
+ @Nullable Collection<GridCacheMvccCandidate<K>> cands,
+ @Nullable GridCacheVersion drVer,
+ GridCacheContext<K, V> ctx
+ ) throws IgniteCheckedException {
+ if (ctx.deploymentEnabled())
+ prepareObject(key, ctx.shared());
+
+ if (keyBytes != null) {
+ if (this.keyBytes == null)
+ this.keyBytes = new ArrayList<>(keysCount());
+
+ this.keyBytes.add(keyBytes);
+ }
+
+ if (keys == null)
+ keys = new ArrayList<>(keysCount());
+
+ keys.add(key);
+
+ candidatesByIndex(idx, cands);
+ drVersionByIndex(idx, drVer);
+
+ retVals[idx] = retVal;
+
+ if (writeEntry != null) {
+ if (writeEntries == null) {
+ assert idx == 0 : "Cannot start adding write entries in the middle of lock message [idx=" + idx +
+ ", writeEntry=" + writeEntry + ']';
+
+ writeEntries = new ArrayList<>(keysCount());
+ }
+
+ writeEntries.add(writeEntry);
+ }
+
+ idx++;
+ }
+
+ /**
+ * @return Unmarshalled keys.
+ */
+ public List<K> keys() {
+ return keys;
+ }
+
+ /**
+ * @return {@code True} if lock request for group-lock transaction.
+ */
+ public boolean groupLock() {
+ return grpLockKey != null;
+ }
+
+ /**
+ * @return Group lock key.
+ */
+ @Nullable public IgniteTxKey groupLockKey() {
+ return grpLockKey;
+ }
+
+ /**
+ * @return {@code True} if partition is locked in group-lock transaction.
+ */
+ public boolean partitionLock() {
+ return partLock;
+ }
+
+ /**
+ * @return Max lock wait time.
+ */
+ public long timeout() {
+ return timeout;
+ }
+
+ /**
+ * @param idx Key index.
+ * @param drVer DR version.
+ */
+ @SuppressWarnings({"unchecked"})
+ public void drVersionByIndex(int idx, GridCacheVersion drVer) {
+ assert idx < keysCount();
+
+ // If nothing to add.
+ if (drVer == null)
+ return;
+
+ if (drVersByIdx == null)
+ drVersByIdx = new GridCacheVersion[keysCount()];
+
+ drVersByIdx[idx] = drVer;
+ }
+
+ /**
+ * @param idx Key index.
+ * @return DR versions for given key.
+ */
+ public GridCacheVersion drVersionByIndex(int idx) {
+ return drVersByIdx == null ? null : drVersByIdx[idx];
+ }
+
+ /**
+ * @return All DR versions.
+ */
+ public GridCacheVersion[] drVersions() {
+ return drVersByIdx;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (grpLockKey != null && grpLockKeyBytes == null) {
+ if (ctx.deploymentEnabled())
+ prepareObject(grpLockKey, ctx);
+
+ grpLockKeyBytes = CU.marshal(ctx, grpLockKey);
+ }
+
+ if (writeEntries != null) {
+ marshalTx(writeEntries, ctx);
+
+ writeEntriesBytes = ctx.marshaller().marshal(writeEntries);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (keys == null)
+ keys = unmarshalCollection(keyBytes, ctx, ldr);
+
+ if (grpLockKey == null && grpLockKeyBytes != null)
+ grpLockKey = ctx.marshaller().unmarshal(grpLockKeyBytes, ldr);
+
+ if (writeEntriesBytes != null) {
+ writeEntries = ctx.marshaller().unmarshal(writeEntriesBytes, ldr);
+
+ unmarshalTx(writeEntries, false, ctx, ldr);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneCallsConstructors", "OverriddenMethodCallDuringObjectConstruction",
+ "CloneDoesntCallSuperClone"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDistributedLockRequest _clone = new GridDistributedLockRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDistributedLockRequest _clone = (GridDistributedLockRequest)_msg;
+
+ _clone.nodeId = nodeId;
+ _clone.nearXidVer = nearXidVer;
+ _clone.threadId = threadId;
+ _clone.futId = futId;
+ _clone.timeout = timeout;
+ _clone.isInTx = isInTx;
+ _clone.isInvalidate = isInvalidate;
+ _clone.isRead = isRead;
+ _clone.isolation = isolation;
+ _clone.keyBytes = keyBytes;
+ _clone.keys = keys;
+ _clone.writeEntries = writeEntries;
+ _clone.writeEntriesBytes = writeEntriesBytes;
+ _clone.retVals = retVals;
+ _clone.idx = idx;
+ _clone.txSize = txSize;
+ _clone.grpLockKey = grpLockKey;
+ _clone.grpLockKeyBytes = grpLockKeyBytes;
+ _clone.partLock = partLock;
+ _clone.drVersByIdx = drVersByIdx;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 8:
+ if (drVersByIdx != null) {
+ if (commState.it == null) {
- if (!commState.putInt(drVersByIdx.length))
++ if (!commState.putInt(null, drVersByIdx.length))
+ return false;
+
+ commState.it = arrayIterator(drVersByIdx);
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putCacheVersion((GridCacheVersion)commState.cur))
++ if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 9:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 10:
- if (!commState.putByteArray(grpLockKeyBytes))
++ if (!commState.putByteArray("grpLockKeyBytes", grpLockKeyBytes))
+ return false;
+
+ commState.idx++;
+
+ case 11:
- if (!commState.putBoolean(isInTx))
++ if (!commState.putBoolean("isInTx", isInTx))
+ return false;
+
+ commState.idx++;
+
+ case 12:
- if (!commState.putBoolean(isInvalidate))
++ if (!commState.putBoolean("isInvalidate", isInvalidate))
+ return false;
+
+ commState.idx++;
+
+ case 13:
- if (!commState.putBoolean(isRead))
++ if (!commState.putBoolean("isRead", isRead))
+ return false;
+
+ commState.idx++;
+
+ case 14:
- if (!commState.putEnum(isolation))
++ if (!commState.putEnum("isolation", isolation))
+ return false;
+
+ commState.idx++;
+
+ case 15:
+ if (keyBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(keyBytes.size()))
++ if (!commState.putInt(null, keyBytes.size()))
+ return false;
+
+ commState.it = keyBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 16:
- if (!commState.putCacheVersion(nearXidVer))
++ if (!commState.putCacheVersion("nearXidVer", nearXidVer))
+ return false;
+
+ commState.idx++;
+
+ case 17:
- if (!commState.putUuid(nodeId))
++ if (!commState.putUuid("nodeId", nodeId))
+ return false;
+
+ commState.idx++;
+
+ case 18:
- if (!commState.putBoolean(partLock))
++ if (!commState.putBoolean("partLock", partLock))
+ return false;
+
+ commState.idx++;
+
+ case 19:
- if (!commState.putBooleanArray(retVals))
++ if (!commState.putBooleanArray("retVals", retVals))
+ return false;
+
+ commState.idx++;
+
+ case 20:
- if (!commState.putLong(threadId))
++ if (!commState.putLong("threadId", threadId))
+ return false;
+
+ commState.idx++;
+
+ case 21:
- if (!commState.putLong(timeout))
++ if (!commState.putLong("timeout", timeout))
+ return false;
+
+ commState.idx++;
+
+ case 22:
- if (!commState.putInt(txSize))
++ if (!commState.putInt("txSize", txSize))
+ return false;
+
+ commState.idx++;
+
+ case 23:
- if (!commState.putByteArray(writeEntriesBytes))
++ if (!commState.putByteArray("writeEntriesBytes", writeEntriesBytes))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 8:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (drVersByIdx == null)
+ drVersByIdx = new GridCacheVersion[commState.readSize];
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheVersion _val = commState.getCacheVersion();
++ GridCacheVersion _val = commState.getCacheVersion(null);
+
- if (_val == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ drVersByIdx[i] = (GridCacheVersion)_val;
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 9:
- IgniteUuid futId0 = commState.getGridUuid();
++ futId = commState.getGridUuid("futId");
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ case 10:
- byte[] grpLockKeyBytes0 = commState.getByteArray();
++ grpLockKeyBytes = commState.getByteArray("grpLockKeyBytes");
+
- if (grpLockKeyBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- grpLockKeyBytes = grpLockKeyBytes0;
-
+ commState.idx++;
+
+ case 11:
- if (buf.remaining() < 1)
- return false;
++ isInTx = commState.getBoolean("isInTx");
+
- isInTx = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 12:
- if (buf.remaining() < 1)
- return false;
++ isInvalidate = commState.getBoolean("isInvalidate");
+
- isInvalidate = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 13:
- if (buf.remaining() < 1)
- return false;
++ isRead = commState.getBoolean("isRead");
+
- isRead = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 14:
- if (buf.remaining() < 1)
- return false;
++ byte isolation0 = commState.getByte("isolation");
+
- byte isolation0 = commState.getByte();
++ if (!commState.lastRead())
++ return false;
+
+ isolation = IgniteTxIsolation.fromOrdinal(isolation0);
+
+ commState.idx++;
+
+ case 15:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (keyBytes == null)
+ keyBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ keyBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 16:
- GridCacheVersion nearXidVer0 = commState.getCacheVersion();
++ nearXidVer = commState.getCacheVersion("nearXidVer");
+
- if (nearXidVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- nearXidVer = nearXidVer0;
-
+ commState.idx++;
+
+ case 17:
- UUID nodeId0 = commState.getUuid();
++ nodeId = commState.getUuid("nodeId");
+
- if (nodeId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- nodeId = nodeId0;
-
+ commState.idx++;
+
+ case 18:
- if (buf.remaining() < 1)
- return false;
++ partLock = commState.getBoolean("partLock");
+
- partLock = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 19:
- boolean[] retVals0 = commState.getBooleanArray();
++ retVals = commState.getBooleanArray("retVals");
+
- if (retVals0 == BOOLEAN_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- retVals = retVals0;
-
+ commState.idx++;
+
+ case 20:
- if (buf.remaining() < 8)
- return false;
++ threadId = commState.getLong("threadId");
+
- threadId = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 21:
- if (buf.remaining() < 8)
- return false;
++ timeout = commState.getLong("timeout");
+
- timeout = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 22:
- if (buf.remaining() < 4)
- return false;
++ txSize = commState.getInt("txSize");
+
- txSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 23:
- byte[] writeEntriesBytes0 = commState.getByteArray();
++ writeEntriesBytes = commState.getByteArray("writeEntriesBytes");
+
- if (writeEntriesBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- writeEntriesBytes = writeEntriesBytes0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 22;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDistributedLockRequest.class, this, "keysCnt", retVals.length,
+ "super", super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
index 0000000,e24c053..9287763
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
@@@ -1,0 -1,437 +1,433 @@@
+ /*
+ * 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.cache.distributed;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Lock response message.
+ */
+ public class GridDistributedLockResponse<K, V> extends GridDistributedBaseMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /** Error. */
+ @GridDirectTransient
+ private Throwable err;
+
+ /** Serialized error. */
+ private byte[] errBytes;
+
+ /** Value bytes. */
+ @GridDirectCollection(GridCacheValueBytes.class)
+ private List<GridCacheValueBytes> valBytes;
+
+ /** Values. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private List<V> vals;
+
+ /**
+ * Empty constructor (required by {@link Externalizable}).
+ */
+ public GridDistributedLockResponse() {
+ /* No-op. */
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param lockVer Lock version.
+ * @param futId Future ID.
+ * @param cnt Key count.
+ */
+ public GridDistributedLockResponse(int cacheId,
+ GridCacheVersion lockVer,
+ IgniteUuid futId,
+ int cnt) {
+ super(lockVer, cnt);
+
+ assert futId != null;
+
+ this.cacheId = cacheId;
+ this.futId = futId;
+
+ vals = new ArrayList<>(cnt);
+ valBytes = new ArrayList<>(cnt);
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param lockVer Lock ID.
+ * @param futId Future ID.
+ * @param err Error.
+ */
+ public GridDistributedLockResponse(int cacheId,
+ GridCacheVersion lockVer,
+ IgniteUuid futId,
+ Throwable err) {
+ super(lockVer, 0);
+
+ assert futId != null;
+
+ this.cacheId = cacheId;
+ this.futId = futId;
+ this.err = err;
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param lockVer Lock ID.
+ * @param futId Future ID.
+ * @param cnt Count.
+ * @param err Error.
+ */
+ public GridDistributedLockResponse(int cacheId,
+ GridCacheVersion lockVer,
+ IgniteUuid futId,
+ int cnt,
+ Throwable err) {
+ super(lockVer, cnt);
+
+ assert futId != null;
+
+ this.cacheId = cacheId;
+ this.futId = futId;
+ this.err = err;
+
+ vals = new ArrayList<>(cnt);
+ valBytes = new ArrayList<>(cnt);
+ }
+
+ /**
+ *
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Error.
+ */
+ public Throwable error() {
+ return err;
+ }
+
+ /**
+ * @param err Error to set.
+ */
+ public void error(Throwable err) {
+ this.err = err;
+ }
+
+ /**
+ * @param idx Index of locked flag.
+ * @return Value of locked flag at given index.
+ */
+ public boolean isCurrentlyLocked(int idx) {
+ assert idx >= 0;
+
+ Collection<GridCacheMvccCandidate<K>> cands = candidatesByIndex(idx);
+
+ for (GridCacheMvccCandidate<K> cand : cands)
+ if (cand.owner())
+ return true;
+
+ return false;
+ }
+
+ /**
+ * @param idx Candidates index.
+ * @param cands Collection of candidates.
+ * @param committedVers Committed versions relative to lock version.
+ * @param rolledbackVers Rolled back versions relative to lock version.
+ */
+ public void setCandidates(int idx, Collection<GridCacheMvccCandidate<K>> cands,
+ Collection<GridCacheVersion> committedVers, Collection<GridCacheVersion> rolledbackVers) {
+ assert idx >= 0;
+
+ completedVersions(committedVers, rolledbackVers);
+
+ candidatesByIndex(idx, cands);
+ }
+
+ /**
+ * @param idx Value index.
+ *
+ * @return Value bytes (possibly {@code null}).
+ */
+ @Nullable public byte[] valueBytes(int idx) {
+ if (!F.isEmpty(valBytes)) {
+ GridCacheValueBytes res = valBytes.get(idx);
+
+ if (res != null && !res.isPlain())
+ return res.get();
+ }
+
+ return null;
+ }
+
+ /**
+ * @param val Value.
+ * @param valBytes Value bytes (possibly {@code null}).
+ * @param ctx Context.
+ * @throws IgniteCheckedException If failed.
+ */
+ public void addValueBytes(V val, @Nullable byte[] valBytes, GridCacheContext<K, V> ctx) throws IgniteCheckedException {
+ if (ctx.deploymentEnabled())
+ prepareObject(val, ctx.shared());
+
+ GridCacheValueBytes vb = null;
+
+ if (val != null) {
+ vb = val instanceof byte[] ? GridCacheValueBytes.plain(val) : valBytes != null ?
+ GridCacheValueBytes.marshaled(valBytes) : null;
+ }
+ else if (valBytes != null)
+ vb = GridCacheValueBytes.marshaled(valBytes);
+
+ this.valBytes.add(vb);
+
+ vals.add(val);
+ }
+
+ /**
+ * @return Values size.
+ */
+ protected int valuesSize() {
+ return vals.size();
+ }
+
+ /**
+ * @param idx Index.
+ * @return Value for given index.
+ */
+ @Nullable public V value(int idx) {
+ if (!F.isEmpty(vals)) {
+ V res = vals.get(idx);
+
+ if (res != null)
+ return res;
+ }
+
+ // If there was no value in values collection, then it could be in value bytes collection in case of byte[].
+ if (!F.isEmpty(valBytes)) {
+ GridCacheValueBytes res = valBytes.get(idx);
+
+ if (res != null && res.isPlain())
+ return (V)res.get();
+ }
+
+ // Value is not found in both value and value bytes collections.
+ return null;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (F.isEmpty(valBytes) && !F.isEmpty(vals))
+ valBytes = marshalValuesCollection(vals, ctx);
+
+ if (err != null)
+ errBytes = ctx.marshaller().marshal(err);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (F.isEmpty(vals) && !F.isEmpty(valBytes))
+ vals = unmarshalValueBytesCollection(valBytes, ctx, ldr);
+
+ if (errBytes != null)
+ err = ctx.marshaller().unmarshal(errBytes, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors",
+ "OverriddenMethodCallDuringObjectConstruction"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDistributedLockResponse _clone = new GridDistributedLockResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDistributedLockResponse _clone = (GridDistributedLockResponse)_msg;
+
+ _clone.futId = futId;
+ _clone.err = err;
+ _clone.errBytes = errBytes;
+ _clone.valBytes = valBytes;
+ _clone.vals = vals;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 8:
- if (!commState.putByteArray(errBytes))
++ if (!commState.putByteArray("errBytes", errBytes))
+ return false;
+
+ commState.idx++;
+
+ case 9:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 10:
+ if (valBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(valBytes.size()))
++ if (!commState.putInt(null, valBytes.size()))
+ return false;
+
+ commState.it = valBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putValueBytes((GridCacheValueBytes)commState.cur))
++ if (!commState.putValueBytes(null, (GridCacheValueBytes)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 8:
- byte[] errBytes0 = commState.getByteArray();
++ errBytes = commState.getByteArray("errBytes");
+
- if (errBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- errBytes = errBytes0;
-
+ commState.idx++;
+
+ case 9:
- IgniteUuid futId0 = commState.getGridUuid();
++ futId = commState.getGridUuid("futId");
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ case 10:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (valBytes == null)
+ valBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheValueBytes _val = commState.getValueBytes();
++ GridCacheValueBytes _val = commState.getValueBytes(null);
+
- if (_val == VAL_BYTES_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ valBytes.add((GridCacheValueBytes)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 23;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDistributedLockResponse.class, this,
+ "valBytesLen", valBytes == null ? 0 : valBytes.size(),
+ "super", super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
index 0000000,fef3eda..8b84546
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
@@@ -1,0 -1,696 +1,692 @@@
+ /*
+ * 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.cache.distributed;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Transaction completion message.
+ */
+ public class GridDistributedTxFinishRequest<K, V> extends GridDistributedBaseMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /** Thread ID. */
+ private long threadId;
+
+ /** Commit version. */
+ private GridCacheVersion commitVer;
+
+ /** Invalidate flag. */
+ private boolean invalidate;
+
+ /** Commit flag. */
+ private boolean commit;
+
+ /** Sync commit flag. */
+ private boolean syncCommit;
+
+ /** Sync commit flag. */
+ private boolean syncRollback;
+
+ /** Min version used as base for completed versions. */
+ private GridCacheVersion baseVer;
+
+ /** Transaction write entries. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<IgniteTxEntry<K, V>> writeEntries;
+
+ /** */
+ @GridDirectCollection(byte[].class)
+ private Collection<byte[]> writeEntriesBytes;
+
+ /** Write entries which have not been transferred to nodes during lock request. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<IgniteTxEntry<K, V>> recoveryWrites;
+
+ /** */
+ @GridDirectCollection(byte[].class)
+ private Collection<byte[]> recoveryWritesBytes;
+
+ /** Expected txSize. */
+ private int txSize;
+
+ /** Group lock key. */
+ @GridDirectTransient
+ private IgniteTxKey grpLockKey;
+
+ /** Group lock key bytes. */
+ private byte[] grpLockKeyBytes;
+
+ /** System flag. */
+ private boolean sys;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridDistributedTxFinishRequest() {
+ /* No-op. */
+ }
+
+ /**
+ * @param xidVer Transaction ID.
+ * @param futId future ID.
+ * @param threadId Thread ID.
+ * @param commitVer Commit version.
+ * @param commit Commit flag.
+ * @param invalidate Invalidate flag.
+ * @param sys System flag.
+ * @param baseVer Base version.
+ * @param committedVers Committed versions.
+ * @param rolledbackVers Rolled back versions.
+ * @param txSize Expected transaction size.
+ * @param writeEntries Write entries.
+ * @param recoveryWrites Recover entries. In pessimistic mode entries which were not transferred to remote nodes
+ * with lock requests. {@code Null} for optimistic mode.
+ * @param grpLockKey Group lock key if this is a group-lock transaction.
+ */
+ public GridDistributedTxFinishRequest(
+ GridCacheVersion xidVer,
+ IgniteUuid futId,
+ @Nullable GridCacheVersion commitVer,
+ long threadId,
+ boolean commit,
+ boolean invalidate,
+ boolean sys,
+ boolean syncCommit,
+ boolean syncRollback,
+ GridCacheVersion baseVer,
+ Collection<GridCacheVersion> committedVers,
+ Collection<GridCacheVersion> rolledbackVers,
+ int txSize,
+ Collection<IgniteTxEntry<K, V>> writeEntries,
+ Collection<IgniteTxEntry<K, V>> recoveryWrites,
+ @Nullable IgniteTxKey grpLockKey
+ ) {
+ super(xidVer, writeEntries == null ? 0 : writeEntries.size());
+ assert xidVer != null;
+
+ this.futId = futId;
+ this.commitVer = commitVer;
+ this.threadId = threadId;
+ this.commit = commit;
+ this.invalidate = invalidate;
+ this.sys = sys;
+ this.syncCommit = syncCommit;
+ this.syncRollback = syncRollback;
+ this.baseVer = baseVer;
+ this.txSize = txSize;
+ this.writeEntries = writeEntries;
+ this.recoveryWrites = recoveryWrites;
+ this.grpLockKey = grpLockKey;
+
+ completedVersions(committedVers, rolledbackVers);
+ }
+
+ /**
+ * Clones write entries so that near entries are not passed to DHT cache.
+ */
+ public void cloneEntries() {
+ if (F.isEmpty(writeEntries))
+ return;
+
+ Collection<IgniteTxEntry<K, V>> cp = new ArrayList<>(writeEntries.size());
+
+ for (IgniteTxEntry<K, V> e : writeEntries) {
+ GridCacheContext<K, V> cacheCtx = e.context();
+
+ // Clone only if it is a near cache.
+ if (cacheCtx.isNear())
+ cp.add(e.cleanCopy(cacheCtx.nearTx().dht().context()));
+ else
+ cp.add(e);
+ }
+
+ writeEntries = cp;
+ }
+
+ /**
+ * @return System flag.
+ */
+ public boolean system() {
+ return sys;
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Thread ID.
+ */
+ public long threadId() {
+ return threadId;
+ }
+
+ /**
+ * @return Commit version.
+ */
+ public GridCacheVersion commitVersion() {
+ return commitVer;
+ }
+
+ /**
+ * @return Commit flag.
+ */
+ public boolean commit() {
+ return commit;
+ }
+
+ /**
+ *
+ * @return Invalidate flag.
+ */
+ public boolean isInvalidate() {
+ return invalidate;
+ }
+
+ /**
+ * @return Sync commit flag.
+ */
+ public boolean syncCommit() {
+ return syncCommit;
+ }
+
+ /**
+ * @return Sync rollback flag.
+ */
+ public boolean syncRollback() {
+ return syncRollback;
+ }
+
+ /**
+ * @return Base version.
+ */
+ public GridCacheVersion baseVersion() {
+ return baseVer;
+ }
+
+ /**
+ * @return Write entries.
+ */
+ public Collection<IgniteTxEntry<K, V>> writes() {
+ return writeEntries;
+ }
+
+ /**
+ * @return Recover entries.
+ */
+ public Collection<IgniteTxEntry<K, V>> recoveryWrites() {
+ return recoveryWrites;
+ }
+
+ /**
+ * @return Expected tx size.
+ */
+ public int txSize() {
+ return txSize;
+ }
+
+ /**
+ *
+ * @return {@code True} if reply is required.
+ */
+ public boolean replyRequired() {
+ return commit ? syncCommit : syncRollback;
+ }
+
+ /**
+ * @return {@code True} if group lock transaction.
+ */
+ public boolean groupLock() {
+ return grpLockKey != null;
+ }
+
+ /**
+ * @return Group lock key.
+ */
+ @Nullable public IgniteTxKey groupLockKey() {
+ return grpLockKey;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (writeEntries != null) {
+ marshalTx(writeEntries, ctx);
+
+ writeEntriesBytes = new ArrayList<>(writeEntries.size());
+
+ for (IgniteTxEntry<K, V> e : writeEntries)
+ writeEntriesBytes.add(ctx.marshaller().marshal(e));
+ }
+
+ if (recoveryWrites != null) {
+ marshalTx(recoveryWrites, ctx);
+
+ recoveryWritesBytes = new ArrayList<>(recoveryWrites.size());
+
+ for (IgniteTxEntry<K, V> e : recoveryWrites)
+ recoveryWritesBytes.add(ctx.marshaller().marshal(e));
+ }
+
+ if (grpLockKey != null && grpLockKeyBytes == null) {
+ if (ctx.deploymentEnabled())
+ prepareObject(grpLockKey, ctx);
+
+ grpLockKeyBytes = CU.marshal(ctx, grpLockKey);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (writeEntriesBytes != null) {
+ writeEntries = new ArrayList<>(writeEntriesBytes.size());
+
+ for (byte[] arr : writeEntriesBytes)
+ writeEntries.add(ctx.marshaller().<IgniteTxEntry<K, V>>unmarshal(arr, ldr));
+
+ unmarshalTx(writeEntries, false, ctx, ldr);
+ }
+
+ if (recoveryWritesBytes != null) {
+ recoveryWrites = new ArrayList<>(recoveryWritesBytes.size());
+
+ for (byte[] arr : recoveryWritesBytes)
+ recoveryWrites.add(ctx.marshaller().<IgniteTxEntry<K, V>>unmarshal(arr, ldr));
+
+ unmarshalTx(recoveryWrites, false, ctx, ldr);
+ }
+
+ if (grpLockKeyBytes != null && grpLockKey == null)
+ grpLockKey = ctx.marshaller().unmarshal(grpLockKeyBytes, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors",
+ "OverriddenMethodCallDuringObjectConstruction"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDistributedTxFinishRequest _clone = new GridDistributedTxFinishRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDistributedTxFinishRequest _clone = (GridDistributedTxFinishRequest)_msg;
+
+ _clone.futId = futId;
+ _clone.threadId = threadId;
+ _clone.commitVer = commitVer;
+ _clone.invalidate = invalidate;
+ _clone.commit = commit;
++ _clone.syncCommit = syncCommit;
++ _clone.syncRollback = syncRollback;
+ _clone.baseVer = baseVer;
+ _clone.writeEntries = writeEntries;
+ _clone.writeEntriesBytes = writeEntriesBytes;
+ _clone.recoveryWrites = recoveryWrites;
+ _clone.recoveryWritesBytes = recoveryWritesBytes;
+ _clone.txSize = txSize;
+ _clone.grpLockKey = grpLockKey;
+ _clone.grpLockKeyBytes = grpLockKeyBytes;
+ _clone.sys = sys;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 8:
- if (!commState.putCacheVersion(baseVer))
++ if (!commState.putCacheVersion("baseVer", baseVer))
+ return false;
+
+ commState.idx++;
+
+ case 9:
- if (!commState.putBoolean(commit))
++ if (!commState.putBoolean("commit", commit))
+ return false;
+
+ commState.idx++;
+
+ case 10:
- if (!commState.putCacheVersion(commitVer))
++ if (!commState.putCacheVersion("commitVer", commitVer))
+ return false;
+
+ commState.idx++;
+
+ case 11:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 12:
- if (!commState.putByteArray(grpLockKeyBytes))
++ if (!commState.putByteArray("grpLockKeyBytes", grpLockKeyBytes))
+ return false;
+
+ commState.idx++;
+
+ case 13:
- if (!commState.putBoolean(invalidate))
++ if (!commState.putBoolean("invalidate", invalidate))
+ return false;
+
+ commState.idx++;
+
+ case 14:
- if (!commState.putBoolean(syncCommit))
- return false;
-
- commState.idx++;
-
- case 15:
- if (!commState.putBoolean(syncRollback))
- return false;
-
- commState.idx++;
-
- case 16:
+ if (recoveryWritesBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(recoveryWritesBytes.size()))
++ if (!commState.putInt(null, recoveryWritesBytes.size()))
+ return false;
+
+ commState.it = recoveryWritesBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
++ case 15:
++ if (!commState.putBoolean("syncCommit", syncCommit))
++ return false;
++
++ commState.idx++;
++
++ case 16:
++ if (!commState.putBoolean("syncRollback", syncRollback))
++ return false;
++
++ commState.idx++;
++
+ case 17:
- if (!commState.putLong(threadId))
++ if (!commState.putBoolean("sys", sys))
+ return false;
+
+ commState.idx++;
+
+ case 18:
- if (!commState.putInt(txSize))
++ if (!commState.putLong("threadId", threadId))
+ return false;
+
+ commState.idx++;
+
+ case 19:
++ if (!commState.putInt("txSize", txSize))
++ return false;
++
++ commState.idx++;
++
++ case 20:
+ if (writeEntriesBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(writeEntriesBytes.size()))
++ if (!commState.putInt(null, writeEntriesBytes.size()))
+ return false;
+
+ commState.it = writeEntriesBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
- case 20:
- if (!commState.putBoolean(sys))
- return false;
-
- commState.idx++;
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 8:
- GridCacheVersion baseVer0 = commState.getCacheVersion();
++ baseVer = commState.getCacheVersion("baseVer");
+
- if (baseVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- baseVer = baseVer0;
-
+ commState.idx++;
+
+ case 9:
- if (buf.remaining() < 1)
- return false;
++ commit = commState.getBoolean("commit");
+
- commit = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 10:
- GridCacheVersion commitVer0 = commState.getCacheVersion();
++ commitVer = commState.getCacheVersion("commitVer");
+
- if (commitVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- commitVer = commitVer0;
-
+ commState.idx++;
+
+ case 11:
- IgniteUuid futId0 = commState.getGridUuid();
++ futId = commState.getGridUuid("futId");
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ case 12:
- byte[] grpLockKeyBytes0 = commState.getByteArray();
++ grpLockKeyBytes = commState.getByteArray("grpLockKeyBytes");
+
- if (grpLockKeyBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- grpLockKeyBytes = grpLockKeyBytes0;
-
+ commState.idx++;
+
+ case 13:
- if (buf.remaining() < 1)
- return false;
-
- invalidate = commState.getBoolean();
-
- commState.idx++;
-
- case 14:
- if (buf.remaining() < 1)
- return false;
-
- syncCommit = commState.getBoolean();
-
- commState.idx++;
++ invalidate = commState.getBoolean("invalidate");
+
- case 15:
- if (buf.remaining() < 1)
++ if (!commState.lastRead())
+ return false;
+
- syncRollback = commState.getBoolean();
-
+ commState.idx++;
+
- case 16:
++ case 14:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (recoveryWritesBytes == null)
+ recoveryWritesBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ recoveryWritesBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
- case 17:
- if (buf.remaining() < 8)
++ case 15:
++ syncCommit = commState.getBoolean("syncCommit");
++
++ if (!commState.lastRead())
+ return false;
+
- threadId = commState.getLong();
++ commState.idx++;
++
++ case 16:
++ syncRollback = commState.getBoolean("syncRollback");
++
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
- case 18:
- if (buf.remaining() < 4)
++ case 17:
++ sys = commState.getBoolean("sys");
++
++ if (!commState.lastRead())
+ return false;
+
- txSize = commState.getInt();
++ commState.idx++;
++
++ case 18:
++ threadId = commState.getLong("threadId");
++
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 19:
++ txSize = commState.getInt("txSize");
++
++ if (!commState.lastRead())
++ return false;
++
++ commState.idx++;
++
++ case 20:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (writeEntriesBytes == null)
+ writeEntriesBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ writeEntriesBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
- case 20:
- if (buf.remaining() < 1)
- return false;
-
- sys = commState.getBoolean();
-
- commState.idx++;
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 24;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return GridToStringBuilder.toString(GridDistributedTxFinishRequest.class, this,
+ "super", super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
index 0000000,02f8bb4..0b2acfa
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java
@@@ -1,0 -1,173 +1,169 @@@
+ /*
+ * 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.cache.distributed;
+
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Transaction finish response.
+ */
+ public class GridDistributedTxFinishResponse<K, V> extends GridCacheMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private GridCacheVersion txId;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridDistributedTxFinishResponse() {
+ /* No-op. */
+ }
+
+ /**
+ * @param txId Transaction id.
+ * @param futId Future ID.
+ */
+ public GridDistributedTxFinishResponse(GridCacheVersion txId, IgniteUuid futId) {
+ assert txId != null;
+ assert futId != null;
+
+ this.txId = txId;
+ this.futId = futId;
+ }
+
+ /**
+ *
+ * @return Transaction id.
+ */
+ public GridCacheVersion xid() {
+ return txId;
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors",
+ "OverriddenMethodCallDuringObjectConstruction"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDistributedTxFinishResponse _clone = new GridDistributedTxFinishResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDistributedTxFinishResponse _clone = (GridDistributedTxFinishResponse)_msg;
+
+ _clone.txId = txId;
+ _clone.futId = futId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putCacheVersion(txId))
++ if (!commState.putCacheVersion("txId", txId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
- IgniteUuid futId0 = commState.getGridUuid();
++ futId = commState.getGridUuid("futId");
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ case 4:
- GridCacheVersion txId0 = commState.getCacheVersion();
++ txId = commState.getCacheVersion("txId");
+
- if (txId0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- txId = txId0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 25;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return GridToStringBuilder.toString(GridDistributedTxFinishResponse.class, this);
+ }
+ }
[23/52] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'origin/sprint-1' into sprint-1
Posted by vk...@apache.org.
Merge remote-tracking branch 'origin/sprint-1' into sprint-1
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/580c36e6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/580c36e6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/580c36e6
Branch: refs/heads/ignite-61
Commit: 580c36e66625ad203dfa18e830649c64e3e531f0
Parents: 14ad3ea f30d79d
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Jan 29 22:31:25 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Jan 29 22:31:25 2015 +0700
----------------------------------------------------------------------
.../processors/cache/GridCacheAdapter.java | 16 ++-----
.../processors/cache/IgniteCacheProxy.java | 2 +-
.../GridCacheAbstractProjectionSelfTest.java | 50 ++++++++++++++++++++
.../commands/alert/VisorAlertCommand.scala | 2 +-
4 files changed, 55 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/580c36e6/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala
----------------------------------------------------------------------
[48/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 0000000,7854bd9..187f28c
mode 000000,100644..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
@@@ -1,0 -1,3322 +1,3322 @@@
+ /*
+ * 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;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.cache.*;
+ import org.apache.ignite.cache.affinity.*;
+ import org.apache.ignite.cluster.*;
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.internal.processors.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.portable.*;
+ import org.apache.ignite.internal.util.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.lifecycle.*;
+ import org.apache.ignite.marshaller.*;
+ import org.apache.ignite.marshaller.optimized.*;
+ import org.apache.ignite.mxbean.*;
+ import org.apache.ignite.plugin.*;
+ import org.apache.ignite.internal.product.*;
+ import org.apache.ignite.spi.*;
+ import org.apache.ignite.spi.authentication.*;
+ import org.apache.ignite.spi.authentication.noop.*;
+ import org.apache.ignite.hadoop.*;
+ import org.apache.ignite.internal.managers.*;
+ import org.apache.ignite.internal.managers.checkpoint.*;
+ import org.apache.ignite.internal.managers.collision.*;
+ import org.apache.ignite.internal.managers.communication.*;
+ import org.apache.ignite.internal.managers.deployment.*;
+ import org.apache.ignite.internal.managers.discovery.*;
+ import org.apache.ignite.internal.managers.eventstorage.*;
+ import org.apache.ignite.internal.managers.failover.*;
+ import org.apache.ignite.internal.managers.indexing.*;
+ import org.apache.ignite.internal.managers.loadbalancer.*;
+ import org.apache.ignite.internal.managers.securesession.*;
+ import org.apache.ignite.internal.managers.security.*;
+ import org.apache.ignite.internal.managers.swapspace.*;
+ import org.apache.ignite.internal.processors.affinity.*;
+ import org.apache.ignite.internal.processors.clock.*;
+ import org.apache.ignite.internal.processors.closure.*;
+ import org.apache.ignite.internal.processors.continuous.*;
+ import org.apache.ignite.internal.processors.dataload.*;
+ import org.apache.ignite.internal.processors.email.*;
+ import org.apache.ignite.internal.processors.interop.*;
+ import org.apache.ignite.internal.processors.job.*;
+ import org.apache.ignite.internal.processors.jobmetrics.*;
+ import org.apache.ignite.internal.processors.license.*;
+ import org.apache.ignite.internal.processors.offheap.*;
+ import org.apache.ignite.internal.processors.plugin.*;
+ import org.apache.ignite.internal.processors.port.*;
+ import org.apache.ignite.internal.processors.query.*;
+ import org.apache.ignite.internal.processors.resource.*;
+ import org.apache.ignite.internal.processors.rest.*;
+ import org.apache.ignite.internal.processors.segmentation.*;
+ import org.apache.ignite.internal.processors.service.*;
+ import org.apache.ignite.internal.processors.session.*;
+ import org.apache.ignite.internal.processors.streamer.*;
+ import org.apache.ignite.internal.processors.task.*;
+ import org.apache.ignite.internal.processors.timeout.*;
+ import org.apache.ignite.plugin.security.*;
+ import org.apache.ignite.spi.securesession.noop.*;
+ import org.apache.ignite.internal.util.future.*;
+ import org.apache.ignite.internal.util.lang.*;
+ import org.apache.ignite.internal.util.nodestart.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import javax.management.*;
+ import java.io.*;
+ import java.lang.management.*;
+ import java.lang.reflect.*;
+ import java.net.*;
+ import java.text.*;
+ import java.util.*;
+ import java.util.concurrent.*;
+ import java.util.concurrent.atomic.*;
+
+ import static org.apache.ignite.internal.GridKernalState.*;
+ import static org.apache.ignite.lifecycle.LifecycleEventType.*;
+ import static org.apache.ignite.IgniteSystemProperties.*;
+ import static org.apache.ignite.internal.IgniteComponentType.*;
+ import static org.apache.ignite.internal.GridNodeAttributes.*;
+ import static org.apache.ignite.internal.GridProductImpl.*;
+ import static org.apache.ignite.internal.processors.license.GridLicenseSubsystem.*;
+ import static org.apache.ignite.internal.util.nodestart.GridNodeStartUtils.*;
+
+ /**
+ * GridGain kernal.
+ * <p/>
+ * See <a href="http://en.wikipedia.org/wiki/Kernal">http://en.wikipedia.org/wiki/Kernal</a> for information on the
+ * misspelling.
+ */
+ public class IgniteKernal extends ClusterGroupAdapter implements IgniteEx, IgniteMXBean {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Compatible versions. */
+ private static final String COMPATIBLE_VERS = GridProperties.get("gridgain.compatible.vers");
+
+ /** GridGain site that is shown in log messages. */
+ static final String SITE = "www.gridgain.com";
+
+ /** System line separator. */
+ private static final String NL = U.nl();
+
+ /** Periodic version check delay. */
+ private static final long PERIODIC_VER_CHECK_DELAY = 1000 * 60 * 60; // Every hour.
+
+ /** Periodic version check delay. */
+ private static final long PERIODIC_VER_CHECK_CONN_TIMEOUT = 10 * 1000; // 10 seconds.
+
+ /** Periodic version check delay. */
+ private static final long PERIODIC_LIC_CHECK_DELAY = 1000 * 60; // Every minute.
+
+ /** Periodic starvation check interval. */
+ private static final long PERIODIC_STARVATION_CHECK_FREQ = 1000 * 30;
+
+ /** Shutdown delay in msec. when license violation detected. */
+ private static final int SHUTDOWN_DELAY = 60 * 1000;
+
+ /** */
+ private IgniteConfiguration cfg;
+
+ /** */
+ @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
+ @GridToStringExclude
+ private GridLoggerProxy log;
+
+ /** */
+ private String gridName;
+
+ /** */
+ @GridToStringExclude
+ private ObjectName kernalMBean;
+
+ /** */
+ @GridToStringExclude
+ private ObjectName locNodeMBean;
+
+ /** */
+ @GridToStringExclude
+ private ObjectName pubExecSvcMBean;
+
+ /** */
+ @GridToStringExclude
+ private ObjectName sysExecSvcMBean;
+
+ /** */
+ @GridToStringExclude
+ private ObjectName mgmtExecSvcMBean;
+
+ /** */
+ @GridToStringExclude
+ private ObjectName p2PExecSvcMBean;
+
+ /** */
+ @GridToStringExclude
+ private ObjectName restExecSvcMBean;
+
+ /** Kernal start timestamp. */
+ private long startTime = U.currentTimeMillis();
+
+ /** Spring context, potentially {@code null}. */
+ private GridSpringResourceContext rsrcCtx;
+
+ /** */
+ @GridToStringExclude
+ private Timer updateNtfTimer;
+
+ /** */
+ @GridToStringExclude
+ private Timer starveTimer;
+
+ /** */
+ @GridToStringExclude
+ private Timer licTimer;
+
+ /** */
+ @GridToStringExclude
+ private Timer metricsLogTimer;
+
+ /** Indicate error on grid stop. */
+ @GridToStringExclude
+ private boolean errOnStop;
+
+ /** Node local store. */
+ @GridToStringExclude
+ private ClusterNodeLocalMap nodeLoc;
+
+ /** Scheduler. */
+ @GridToStringExclude
+ private IgniteScheduler scheduler;
+
+ /** Grid security instance. */
+ @GridToStringExclude
+ private GridSecurity security;
+
+ /** Portables instance. */
+ @GridToStringExclude
+ private IgnitePortables portables;
+
+ /** Kernal gateway. */
+ @GridToStringExclude
+ private final AtomicReference<GridKernalGateway> gw = new AtomicReference<>();
+
+ /** Data Grid edition usage registered flag. */
+ @GridToStringExclude
+ private volatile boolean dbUsageRegistered;
+
+ /** */
+ @GridToStringExclude
+ private final Collection<String> compatibleVers;
+
+ /** Stop guard. */
+ @GridToStringExclude
+ private final AtomicBoolean stopGuard = new AtomicBoolean();
+
+ /**
+ * No-arg constructor is required by externalization.
+ */
+ public IgniteKernal() {
+ this(null);
+ }
+
+ /**
+ * @param rsrcCtx Optional Spring application context.
+ */
+ public IgniteKernal(@Nullable GridSpringResourceContext rsrcCtx) {
+ super(null, null, null, (IgnitePredicate<ClusterNode>)null);
+
+ this.rsrcCtx = rsrcCtx;
+
+ String[] compatibleVers = COMPATIBLE_VERS.split(",");
+
+ for (int i = 0; i < compatibleVers.length; i++)
+ compatibleVers[i] = compatibleVers[i].trim();
+
+ this.compatibleVers = Collections.unmodifiableList(Arrays.asList(compatibleVers));
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteCluster cluster() {
+ return this;
+ }
+
+ /** {@inheritDoc} */
+ @Override public final IgniteCompute compute(ClusterGroup prj) {
+ return ((ClusterGroupAdapter)prj).compute();
+ }
+
+ /** {@inheritDoc} */
+ @Override public final IgniteMessaging message(ClusterGroup prj) {
+ return ((ClusterGroupAdapter)prj).message();
+ }
+
+ /** {@inheritDoc} */
+ @Override public final IgniteEvents events(ClusterGroup prj) {
+ return ((ClusterGroupAdapter)prj).events();
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteManaged managed(ClusterGroup prj) {
+ return ((ClusterGroupAdapter)prj).managed();
+ }
+
+ /** {@inheritDoc} */
+ @Override public ExecutorService executorService(ClusterGroup prj) {
+ return ((ClusterGroupAdapter)prj).executorService();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String name() {
+ return gridName;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getCopyright() {
+ return ctx.product().copyright();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getLicenseFilePath() {
+ assert cfg != null;
+
+ return cfg.getLicenseUrl();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getStartTimestamp() {
+ return startTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getStartTimestampFormatted() {
+ return DateFormat.getDateTimeInstance().format(new Date(startTime));
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getUpTime() {
+ return U.currentTimeMillis() - startTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getUpTimeFormatted() {
+ return X.timeSpan2HMSM(U.currentTimeMillis() - startTime);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getFullVersion() {
+ return COMPOUND_VER + '-' + BUILD_TSTAMP_STR;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getCheckpointSpiFormatted() {
+ assert cfg != null;
+
+ return Arrays.toString(cfg.getCheckpointSpi());
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getSwapSpaceSpiFormatted() {
+ assert cfg != null;
+
+ return cfg.getSwapSpaceSpi().toString();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getCommunicationSpiFormatted() {
+ assert cfg != null;
+
+ return cfg.getCommunicationSpi().toString();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getDeploymentSpiFormatted() {
+ assert cfg != null;
+
+ return cfg.getDeploymentSpi().toString();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getDiscoverySpiFormatted() {
+ assert cfg != null;
+
+ return cfg.getDiscoverySpi().toString();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getEventStorageSpiFormatted() {
+ assert cfg != null;
+
+ return cfg.getEventStorageSpi().toString();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getCollisionSpiFormatted() {
+ assert cfg != null;
+
+ return cfg.getCollisionSpi().toString();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getFailoverSpiFormatted() {
+ assert cfg != null;
+
+ return Arrays.toString(cfg.getFailoverSpi());
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getLoadBalancingSpiFormatted() {
+ assert cfg != null;
+
+ return Arrays.toString(cfg.getLoadBalancingSpi());
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getAuthenticationSpiFormatted() {
+ assert cfg != null;
+
+ return cfg.getAuthenticationSpi().toString();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getSecureSessionSpiFormatted() {
+ assert cfg != null;
+
+ return cfg.getSecureSessionSpi().toString();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getOsInformation() {
+ return U.osString();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getJdkInformation() {
+ return U.jdkString();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getOsUser() {
+ return System.getProperty("user.name");
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getVmName() {
+ return ManagementFactory.getRuntimeMXBean().getName();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getInstanceName() {
+ return gridName;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getExecutorServiceFormatted() {
+ assert cfg != null;
+
+ return cfg.getExecutorService().toString();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getGridGainHome() {
+ assert cfg != null;
+
+ return cfg.getGridGainHome();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getGridLoggerFormatted() {
+ assert cfg != null;
+
+ return cfg.getGridLogger().toString();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getMBeanServerFormatted() {
+ assert cfg != null;
+
+ return cfg.getMBeanServer().toString();
+ }
+
+ /** {@inheritDoc} */
+ @Override public UUID getLocalNodeId() {
+ assert cfg != null;
+
+ return cfg.getNodeId();
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public Collection<String> getUserAttributesFormatted() {
+ assert cfg != null;
+
+ return F.transform(cfg.getUserAttributes().entrySet(), new C1<Map.Entry<String, ?>, String>() {
+ @Override public String apply(Map.Entry<String, ?> e) {
+ return e.getKey() + ", " + e.getValue().toString();
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isPeerClassLoadingEnabled() {
+ assert cfg != null;
+
+ return cfg.isPeerClassLoadingEnabled();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<String> getLifecycleBeansFormatted() {
+ LifecycleBean[] beans = cfg.getLifecycleBeans();
+
+ return F.isEmpty(beans) ? Collections.<String>emptyList() : F.transform(beans, F.<LifecycleBean>string());
+ }
+
+ /**
+ * @param attrs Current attributes.
+ * @param name New attribute name.
+ * @param val New attribute value.
+ * @throws IgniteCheckedException If duplicated SPI name found.
+ */
+ private void add(Map<String, Object> attrs, String name, @Nullable Serializable val) throws IgniteCheckedException {
+ assert attrs != null;
+ assert name != null;
+
+ if (attrs.put(name, val) != null) {
+ if (name.endsWith(ATTR_SPI_CLASS))
+ // User defined duplicated names for the different SPIs.
+ throw new IgniteCheckedException("Failed to set SPI attribute. Duplicated SPI name found: " +
+ name.substring(0, name.length() - ATTR_SPI_CLASS.length()));
+
+ // Otherwise it's a mistake of setting up duplicated attribute.
+ assert false : "Duplicate attribute: " + name;
+ }
+ }
+
+ /**
+ * Notifies life-cycle beans of grid event.
+ *
+ * @param evt Grid event.
+ * @throws IgniteCheckedException If user threw exception during start.
+ */
+ @SuppressWarnings({"CatchGenericClass"})
+ private void notifyLifecycleBeans(LifecycleEventType evt) throws IgniteCheckedException {
+ if (!cfg.isDaemon() && cfg.getLifecycleBeans() != null)
+ for (LifecycleBean bean : cfg.getLifecycleBeans())
+ if (bean != null)
+ bean.onLifecycleEvent(evt);
+ }
+
+ /**
+ * Notifies life-cycle beans of grid event.
+ *
+ * @param evt Grid event.
+ */
+ @SuppressWarnings({"CatchGenericClass"})
+ private void notifyLifecycleBeansEx(LifecycleEventType evt) {
+ try {
+ notifyLifecycleBeans(evt);
+ }
+ // Catch generic throwable to secure against user assertions.
+ catch (Throwable e) {
+ U.error(log, "Failed to notify lifecycle bean (safely ignored) [evt=" + evt +
+ ", gridName=" + gridName + ']', e);
+ }
+ }
+
+ /**
+ * @param cfg Grid configuration to use.
+ * @param utilityCachePool Utility cache pool.
+ * @param errHnd Error handler to use for notification about startup problems.
+ * @throws IgniteCheckedException Thrown in case of any errors.
+ */
+ @SuppressWarnings({"CatchGenericClass", "unchecked"})
+ public void start(final IgniteConfiguration cfg, ExecutorService utilityCachePool, GridAbsClosure errHnd)
+ throws IgniteCheckedException {
+ gw.compareAndSet(null, new GridKernalGatewayImpl(cfg.getGridName()));
+
+ GridKernalGateway gw = this.gw.get();
+
+ gw.writeLock();
+
+ try {
+ switch (gw.getState()) {
+ case STARTED: {
+ U.warn(log, "Grid has already been started (ignored).");
+
+ return;
+ }
+
+ case STARTING: {
+ U.warn(log, "Grid is already in process of being started (ignored).");
+
+ return;
+ }
+
+ case STOPPING: {
+ throw new IgniteCheckedException("Grid is in process of being stopped");
+ }
+
+ case STOPPED: {
+ break;
+ }
+ }
+
+ gw.setState(STARTING);
+ }
+ finally {
+ gw.writeUnlock();
+ }
+
+ assert cfg != null;
+
+ // Make sure we got proper configuration.
+ validateCommon(cfg);
+
+ gridName = cfg.getGridName();
+
+ this.cfg = cfg;
+
+ log = (GridLoggerProxy)cfg.getGridLogger().getLogger(getClass().getName() +
+ (gridName != null ? '%' + gridName : ""));
+
+ RuntimeMXBean rtBean = ManagementFactory.getRuntimeMXBean();
+
+ // Ack various information.
+ ackAsciiLogo();
+ ackConfigUrl();
+ ackDaemon();
+ ackOsInfo();
+ ackLanguageRuntime();
+ ackRemoteManagement();
+ ackVmArguments(rtBean);
+ ackClassPaths(rtBean);
+ ackSystemProperties();
+ ackEnvironmentVariables();
+ ackSmtpConfiguration();
+ ackCacheConfiguration();
+ ackP2pConfiguration();
+
+ // Run background network diagnostics.
+ GridDiagnostic.runBackgroundCheck(gridName, cfg.getExecutorService(), log);
+
+ boolean notifyEnabled = IgniteSystemProperties.getBoolean(GG_UPDATE_NOTIFIER, true);
+
+ GridUpdateNotifier verChecker0 = null;
+
+ if (notifyEnabled) {
+ try {
+ verChecker0 = new GridUpdateNotifier(gridName, VER, SITE, gw, false);
+
+ verChecker0.checkForNewVersion(cfg.getExecutorService(), log);
+ }
+ catch (IgniteCheckedException e) {
+ if (log.isDebugEnabled())
+ log.debug("Failed to create GridUpdateNotifier: " + e);
+ }
+ }
+
+ final GridUpdateNotifier verChecker = verChecker0;
+
+ // Ack 3-rd party licenses location.
+ if (log.isInfoEnabled() && cfg.getGridGainHome() != null)
+ log.info("3-rd party licenses can be found at: " + cfg.getGridGainHome() + File.separatorChar + "libs" +
+ File.separatorChar + "licenses");
+
+ // Check that user attributes are not conflicting
+ // with internally reserved names.
+ for (String name : cfg.getUserAttributes().keySet())
+ if (name.startsWith(ATTR_PREFIX))
+ throw new IgniteCheckedException("User attribute has illegal name: '" + name + "'. Note that all names " +
+ "starting with '" + ATTR_PREFIX + "' are reserved for internal use.");
+
+ // Ack local node user attributes.
+ logNodeUserAttributes();
+
+ // Ack configuration.
+ ackSpis();
+
+ Map<String, Object> attrs = createNodeAttributes(cfg, BUILD_TSTAMP_STR);
+
+ // Spin out SPIs & managers.
+ try {
+ GridKernalContextImpl ctx =
+ new GridKernalContextImpl(log, this, cfg, gw, utilityCachePool, ENT);
+
+ nodeLoc = new ClusterNodeLocalMapImpl(ctx);
+
+ U.onGridStart();
+
+ // Set context into rich adapter.
+ setKernalContext(ctx);
+
+ // Start and configure resource processor first as it contains resources used
+ // by all other managers and processors.
+ GridResourceProcessor rsrcProc = new GridResourceProcessor(ctx);
+
+ rsrcProc.setSpringContext(rsrcCtx);
+
+ ctx.product(new GridProductImpl(ctx, verChecker));
+
+ scheduler = new IgniteSchedulerImpl(ctx);
+
+ startProcessor(ctx, rsrcProc, attrs);
+
+ // Inject resources into lifecycle beans.
+ if (!cfg.isDaemon() && cfg.getLifecycleBeans() != null)
+ for (LifecycleBean bean : cfg.getLifecycleBeans())
+ if (bean != null)
+ rsrcProc.inject(bean);
+
+ // Lifecycle notification.
+ notifyLifecycleBeans(BEFORE_GRID_START);
+
+ // Starts lifecycle aware components.
+ U.startLifecycleAware(lifecycleAwares(cfg));
+
+ addHelper(ctx, GGFS_HELPER.create(F.isEmpty(cfg.getGgfsConfiguration())));
+
+ startProcessor(ctx, new IgnitePluginProcessor(ctx, cfg), attrs);
+
+ // Off-heap processor has no dependencies.
+ startProcessor(ctx, new GridOffHeapProcessor(ctx), attrs);
+
+ // Closure processor should be started before all others
+ // (except for resource processor), as many components can depend on it.
+ startProcessor(ctx, new GridClosureProcessor(ctx), attrs);
+
+ // Start some other processors (order & place is important).
+ startProcessor(ctx, (GridProcessor)EMAIL.create(ctx, cfg.getSmtpHost() == null), attrs);
+ startProcessor(ctx, new GridPortProcessor(ctx), attrs);
+ startProcessor(ctx, new GridJobMetricsProcessor(ctx), attrs);
+
+ // Timeout processor needs to be started before managers,
+ // as managers may depend on it.
+ startProcessor(ctx, new GridTimeoutProcessor(ctx), attrs);
+
+ // Start SPI managers.
+ // NOTE: that order matters as there are dependencies between managers.
+ startManager(ctx, createComponent(GridSecurityManager.class, ctx), attrs);
+ startManager(ctx, createComponent(GridSecureSessionManager.class, ctx), attrs);
+ startManager(ctx, new GridIoManager(ctx), attrs);
+ startManager(ctx, new GridCheckpointManager(ctx), attrs);
+
+ startManager(ctx, new GridEventStorageManager(ctx), attrs);
+ startManager(ctx, new GridDeploymentManager(ctx), attrs);
+ startManager(ctx, new GridLoadBalancerManager(ctx), attrs);
+ startManager(ctx, new GridFailoverManager(ctx), attrs);
+ startManager(ctx, new GridCollisionManager(ctx), attrs);
+ startManager(ctx, new GridSwapSpaceManager(ctx), attrs);
+ startManager(ctx, new GridIndexingManager(ctx), attrs);
+
+ ackSecurity(ctx);
+
+ // Start processors before discovery manager, so they will
+ // be able to start receiving messages once discovery completes.
+ startProcessor(ctx, new GridClockSyncProcessor(ctx), attrs);
+ startProcessor(ctx, createComponent(GridLicenseProcessor.class, ctx), attrs);
+ startProcessor(ctx, new GridAffinityProcessor(ctx), attrs);
+ startProcessor(ctx, createComponent(GridSegmentationProcessor.class, ctx), attrs);
+ startProcessor(ctx, new GridQueryProcessor(ctx), attrs);
+ startProcessor(ctx, new GridCacheProcessor(ctx), attrs);
+ startProcessor(ctx, new GridTaskSessionProcessor(ctx), attrs);
+ startProcessor(ctx, new GridJobProcessor(ctx), attrs);
+ startProcessor(ctx, new GridTaskProcessor(ctx), attrs);
+ startProcessor(ctx, (GridProcessor)SCHEDULE.createOptional(ctx), attrs);
+ startProcessor(ctx, createComponent(GridPortableProcessor.class, ctx), attrs);
+ startProcessor(ctx, createComponent(GridInteropProcessor.class, ctx), attrs);
+ startProcessor(ctx, new GridRestProcessor(ctx), attrs);
+ startProcessor(ctx, new GridDataLoaderProcessor(ctx), attrs);
+ startProcessor(ctx, new GridStreamProcessor(ctx), attrs);
+ startProcessor(ctx, (GridProcessor)GGFS.create(ctx, F.isEmpty(cfg.getGgfsConfiguration())), attrs);
+ startProcessor(ctx, new GridContinuousProcessor(ctx), attrs);
+ startProcessor(ctx, (GridProcessor)(cfg.isPeerClassLoadingEnabled() ?
+ IgniteComponentType.HADOOP.create(ctx, true): // No-op when peer class loading is enabled.
+ IgniteComponentType.HADOOP.createIfInClassPath(ctx, cfg.getHadoopConfiguration() != null)), attrs);
+ startProcessor(ctx, new GridServiceProcessor(ctx), attrs);
+
+ // Start plugins.
+ for (PluginProvider provider : ctx.plugins().allProviders()) {
+ ctx.add(new GridPluginComponent(provider));
+
+ provider.start(ctx.plugins().pluginContextForProvider(provider), attrs);
+ }
+
- ctx.createMessageFactory();
++ ctx.io().initMessageFactory();
+
+ if (ctx.isEnterprise()) {
+ security = new GridSecurityImpl(ctx);
+ portables = new GridPortablesImpl(ctx);
+ }
+
+ gw.writeLock();
+
+ try {
+ gw.setState(STARTED);
+
+ // Start discovery manager last to make sure that grid is fully initialized.
+ startManager(ctx, new GridDiscoveryManager(ctx), attrs);
+ }
+ finally {
+ gw.writeUnlock();
+ }
+
+ // Check whether physical RAM is not exceeded.
+ checkPhysicalRam();
+
+ // Suggest configuration optimizations.
+ suggestOptimizations(ctx, cfg);
+
+ if (!ctx.isEnterprise())
+ warnNotSupportedFeaturesForOs(cfg);
+
+ // Notify discovery manager the first to make sure that topology is discovered.
+ ctx.discovery().onKernalStart();
+
+ // Notify IO manager the second so further components can send and receive messages.
+ ctx.io().onKernalStart();
+
+ // Callbacks.
+ for (GridComponent comp : ctx) {
+ // Skip discovery manager.
+ if (comp instanceof GridDiscoveryManager)
+ continue;
+
+ // Skip IO manager.
+ if (comp instanceof GridIoManager)
+ continue;
+
+ comp.onKernalStart();
+ }
+
+ // Ack the license.
+ ctx.license().ackLicense();
+
+ // Register MBeans.
+ registerKernalMBean();
+ registerLocalNodeMBean();
+ registerExecutorMBeans();
+
+ // Lifecycle bean notifications.
+ notifyLifecycleBeans(AFTER_GRID_START);
+ }
+ catch (Throwable e) {
+ IgniteSpiVersionCheckException verCheckErr = X.cause(e, IgniteSpiVersionCheckException.class);
+
+ if (verCheckErr != null)
+ U.error(log, verCheckErr.getMessage());
+ else if (X.hasCause(e, InterruptedException.class, IgniteInterruptedException.class))
+ U.warn(log, "Grid startup routine has been interrupted (will rollback).");
+ else
+ U.error(log, "Got exception while starting (will rollback startup routine).", e);
+
+ errHnd.apply();
+
+ stop(true);
+
+ if (e instanceof IgniteCheckedException)
+ throw (IgniteCheckedException)e;
+ else
+ throw new IgniteCheckedException(e);
+ }
+
+ // Mark start timestamp.
+ startTime = U.currentTimeMillis();
+
+ // Ack latest version information.
+ if (verChecker != null)
+ verChecker.reportStatus(log);
+
+ if (notifyEnabled) {
+ assert verChecker != null;
+
+ verChecker.reportOnlyNew(true);
+ verChecker.licenseProcessor(ctx.license());
+
+ updateNtfTimer = new Timer("gridgain-update-notifier-timer");
+
+ // Setup periodic version check.
+ updateNtfTimer.scheduleAtFixedRate(new GridTimerTask() {
+ @Override public void safeRun() throws InterruptedException {
+ verChecker.topologySize(nodes().size());
+
+ verChecker.checkForNewVersion(cfg.getExecutorService(), log);
+
+ // Just wait for 10 secs.
+ Thread.sleep(PERIODIC_VER_CHECK_CONN_TIMEOUT);
+
+ // Report status if one is available.
+ // No-op if status is NOT available.
+ verChecker.reportStatus(log);
+ }
+ }, PERIODIC_VER_CHECK_DELAY, PERIODIC_VER_CHECK_DELAY);
+ }
+
+ String intervalStr = IgniteSystemProperties.getString(GG_STARVATION_CHECK_INTERVAL);
+
+ // Start starvation checker if enabled.
+ boolean starveCheck = !isDaemon() && !"0".equals(intervalStr);
+
+ if (starveCheck) {
+ final long interval = F.isEmpty(intervalStr) ? PERIODIC_STARVATION_CHECK_FREQ : Long.parseLong(intervalStr);
+
+ starveTimer = new Timer("gridgain-starvation-checker");
+
+ starveTimer.scheduleAtFixedRate(new GridTimerTask() {
+ /** Last completed task count. */
+ private long lastCompletedCnt;
+
+ @Override protected void safeRun() {
+ ExecutorService e = cfg.getExecutorService();
+
+ if (!(e instanceof ThreadPoolExecutor))
+ return;
+
+ ThreadPoolExecutor exec = (ThreadPoolExecutor)e;
+
+ long completedCnt = exec.getCompletedTaskCount();
+
+ // If all threads are active and no task has completed since last time and there is
+ // at least one waiting request, then it is possible starvation.
+ if (exec.getPoolSize() == exec.getActiveCount() && completedCnt == lastCompletedCnt &&
+ !exec.getQueue().isEmpty())
+ LT.warn(log, null, "Possible thread pool starvation detected (no task completed in last " +
+ interval + "ms, is executorService pool size large enough?)");
+
+ lastCompletedCnt = completedCnt;
+ }
+ }, interval, interval);
+ }
+
+ if (!isDaemon()) {
+ licTimer = new Timer("gridgain-license-checker");
+
+ // Setup periodic license check.
+ licTimer.scheduleAtFixedRate(new GridTimerTask() {
+ @Override public void safeRun() throws InterruptedException {
+ try {
+ ctx.license().checkLicense();
+ }
+ // This exception only happens when license processor was unable
+ // to resolve license violation on its own and this grid instance
+ // now needs to be shutdown.
+ //
+ // Note that in most production configurations the license will
+ // have certain grace period and license processor will attempt
+ // to reload the license during the grace period.
+ //
+ // This exception thrown here means that grace period, if any,
+ // has expired and license violation is still unresolved.
+ catch (IgniteProductLicenseException ignored) {
+ U.error(log, "License violation is unresolved. GridGain node will shutdown in " +
+ (SHUTDOWN_DELAY / 1000) + " sec.");
+ U.error(log, " ^-- Contact your support for immediate assistance (!)");
+
+ // Allow interruption to break from here since
+ // node is stopping anyways.
+ Thread.sleep(SHUTDOWN_DELAY);
+
+ G.stop(gridName, true);
+ }
+ // Safety net.
+ catch (Throwable e) {
+ U.error(log, "Unable to check the license due to system error.", e);
+ U.error(log, "Grid instance will be stopped...");
+
+ // Stop the grid if we get unknown license-related error.
+ // Should never happen. Practically an assertion...
+ G.stop(gridName, true);
+ }
+ }
+ }, PERIODIC_LIC_CHECK_DELAY, PERIODIC_LIC_CHECK_DELAY);
+ }
+
+ long metricsLogFreq = cfg.getMetricsLogFrequency();
+
+ if (metricsLogFreq > 0) {
+ metricsLogTimer = new Timer("gridgain-metrics-logger");
+
+ metricsLogTimer.scheduleAtFixedRate(new GridTimerTask() {
+ /** */
+ private final DecimalFormat dblFmt = new DecimalFormat("#.##");
+
+ @Override protected void safeRun() {
+ if (log.isInfoEnabled()) {
+ ClusterMetrics m = localNode().metrics();
+
+ double cpuLoadPct = m.getCurrentCpuLoad() * 100;
+ double avgCpuLoadPct = m.getAverageCpuLoad() * 100;
+ double gcPct = m.getCurrentGcCpuLoad() * 100;
+
+ long heapUsed = m.getHeapMemoryUsed();
+ long heapMax = m.getHeapMemoryMaximum();
+
+ long heapUsedInMBytes = heapUsed / 1024 / 1024;
+ long heapCommInMBytes = m.getHeapMemoryCommitted() / 1024 / 1024;
+
+ double freeHeapPct = heapMax > 0 ? ((double)((heapMax - heapUsed) * 100)) / heapMax : -1;
+
+ int hosts = 0;
+ int nodes = 0;
+ int cpus = 0;
+
+ try {
+ ClusterMetrics metrics = metrics();
+
+ Collection<ClusterNode> nodes0 = nodes();
+
+ hosts = U.neighborhood(nodes0).size();
+ nodes = nodes0.size();
+ cpus = metrics.getTotalCpus();
+ }
+ catch (IgniteCheckedException ignore) {
+ // No-op.
+ }
+
+ int pubPoolActiveThreads = 0;
+ int pubPoolIdleThreads = 0;
+ int pubPoolQSize = 0;
+
+ ExecutorService pubExec = cfg.getExecutorService();
+
+ if (pubExec instanceof ThreadPoolExecutor) {
+ ThreadPoolExecutor exec = (ThreadPoolExecutor)pubExec;
+
+ int poolSize = exec.getPoolSize();
+
+ pubPoolActiveThreads = Math.min(poolSize, exec.getActiveCount());
+ pubPoolIdleThreads = poolSize - pubPoolActiveThreads;
+ pubPoolQSize = exec.getQueue().size();
+ }
+
+ int sysPoolActiveThreads = 0;
+ int sysPoolIdleThreads = 0;
+ int sysPoolQSize = 0;
+
+ ExecutorService sysExec = cfg.getSystemExecutorService();
+
+ if (sysExec instanceof ThreadPoolExecutor) {
+ ThreadPoolExecutor exec = (ThreadPoolExecutor)sysExec;
+
+ int poolSize = exec.getPoolSize();
+
+ sysPoolActiveThreads = Math.min(poolSize, exec.getActiveCount());
+ sysPoolIdleThreads = poolSize - sysPoolActiveThreads;
+ sysPoolQSize = exec.getQueue().size();
+ }
+
+ String msg = NL +
+ "Metrics for local node (to disable set 'metricsLogFrequency' to 0)" + NL +
+ " ^-- H/N/C [hosts=" + hosts + ", nodes=" + nodes + ", CPUs=" + cpus + "]" + NL +
+ " ^-- CPU [cur=" + dblFmt.format(cpuLoadPct) + "%, avg=" +
+ dblFmt.format(avgCpuLoadPct) + "%, GC=" + dblFmt.format(gcPct) + "%]" + NL +
+ " ^-- Heap [used=" + dblFmt.format(heapUsedInMBytes) + "MB, free=" +
+ dblFmt.format(freeHeapPct) + "%, comm=" + dblFmt.format(heapCommInMBytes) + "MB]" + NL +
+ " ^-- Public thread pool [active=" + pubPoolActiveThreads + ", idle=" +
+ pubPoolIdleThreads + ", qSize=" + pubPoolQSize + "]" + NL +
+ " ^-- System thread pool [active=" + sysPoolActiveThreads + ", idle=" +
+ sysPoolIdleThreads + ", qSize=" + sysPoolQSize + "]" + NL +
+ " ^-- Outbound messages queue [size=" + m.getOutboundMessagesQueueSize() + "]";
+
+ log.info(msg);
+ }
+ }
+ }, metricsLogFreq, metricsLogFreq);
+ }
+
+ ctx.performance().logSuggestions(log, gridName);
+
+ ackBenchmarks();
+ ackVisor();
+
+ ackStart(rtBean);
+
+ if (!isDaemon())
+ ctx.discovery().ackTopology();
+
+ // Send node start email notification, if enabled.
+ if (isSmtpEnabled() && isAdminEmailsSet() && cfg.isLifeCycleEmailNotification()) {
+ SB sb = new SB();
+
+ for (GridPortRecord rec : ctx.ports().records())
+ sb.a(rec.protocol()).a(":").a(rec.port()).a(" ");
+
+ String nid = localNode().id().toString().toUpperCase();
+ String nid8 = U.id8(localNode().id()).toUpperCase();
+
+ IgniteProductLicense lic = ctx.license().license();
+
+ String body =
+ "GridGain node started with the following parameters:" + NL +
+ NL +
+ "----" + NL +
+ "GridGain ver. " + COMPOUND_VER + '#' + BUILD_TSTAMP_STR + "-sha1:" + REV_HASH + NL +
+ "Grid name: " + gridName + NL +
+ "Node ID: " + nid + NL +
+ "Node order: " + localNode().order() + NL +
+ "Node addresses: " + U.addressesAsString(localNode()) + NL +
+ "Local ports: " + sb + NL +
+ "OS name: " + U.osString() + NL +
+ "OS user: " + System.getProperty("user.name") + NL +
+ "CPU(s): " + localNode().metrics().getTotalCpus() + NL +
+ "Heap: " + U.heapSize(localNode(), 2) + "GB" + NL +
+ "JVM name: " + U.jvmName() + NL +
+ "JVM vendor: " + U.jvmVendor() + NL +
+ "JVM version: " + U.jvmVersion() + NL +
+ "VM name: " + rtBean.getName() + NL;
+
+ if (lic != null) {
+ body +=
+ "License ID: " + lic.id().toString().toUpperCase() + NL +
+ "Licensed to: " + lic.userOrganization() + NL;
+ }
+ else
+ assert !ENT;
+
+ body +=
+ "----" + NL +
+ NL +
+ "NOTE:" + NL +
+ "This message is sent automatically to all configured admin emails." + NL +
+ "To change this behavior use 'lifeCycleEmailNotify' grid configuration property." +
+ NL + NL +
+ "| " + SITE + NL +
+ "| support@gridgain.com" + NL;
+
+ sendAdminEmailAsync("GridGain node started: " + nid8, body, false);
+ }
+ }
+
+ /**
+ * Validates common configuration parameters.
+ *
+ * @param cfg Configuration.
+ */
+ private void validateCommon(IgniteConfiguration cfg) {
+ A.notNull(cfg.getNodeId(), "cfg.getNodeId()");
+
+ A.notNull(cfg.getMBeanServer(), "cfg.getMBeanServer()");
+ A.notNull(cfg.getGridLogger(), "cfg.getGridLogger()");
+ A.notNull(cfg.getMarshaller(), "cfg.getMarshaller()");
+ A.notNull(cfg.getExecutorService(), "cfg.getExecutorService()");
+ A.notNull(cfg.getUserAttributes(), "cfg.getUserAttributes()");
+
+ // All SPIs should be non-null.
+ A.notNull(cfg.getSwapSpaceSpi(), "cfg.getSwapSpaceSpi()");
+ A.notNull(cfg.getCheckpointSpi(), "cfg.getCheckpointSpi()");
+ A.notNull(cfg.getCommunicationSpi(), "cfg.getCommunicationSpi()");
+ A.notNull(cfg.getDeploymentSpi(), "cfg.getDeploymentSpi()");
+ A.notNull(cfg.getDiscoverySpi(), "cfg.getDiscoverySpi()");
+ A.notNull(cfg.getEventStorageSpi(), "cfg.getEventStorageSpi()");
+ A.notNull(cfg.getAuthenticationSpi(), "cfg.getAuthenticationSpi()");
+ A.notNull(cfg.getSecureSessionSpi(), "cfg.getSecureSessionSpi()");
+ A.notNull(cfg.getCollisionSpi(), "cfg.getCollisionSpi()");
+ A.notNull(cfg.getFailoverSpi(), "cfg.getFailoverSpi()");
+ A.notNull(cfg.getLoadBalancingSpi(), "cfg.getLoadBalancingSpi()");
+ A.notNull(cfg.getIndexingSpi(), "cfg.getIndexingSpi()");
+
+ A.ensure(cfg.getNetworkTimeout() > 0, "cfg.getNetworkTimeout() > 0");
+ A.ensure(cfg.getNetworkSendRetryDelay() > 0, "cfg.getNetworkSendRetryDelay() > 0");
+ A.ensure(cfg.getNetworkSendRetryCount() > 0, "cfg.getNetworkSendRetryCount() > 0");
+
+ if (!F.isEmpty(cfg.getPluginConfigurations())) {
+ for (PluginConfiguration pluginCfg : cfg.getPluginConfigurations())
+ A.notNull(pluginCfg.providerClass(), "PluginConfiguration.providerClass()");
+ }
+ }
+
+ /**
+ * Checks whether physical RAM is not exceeded.
+ */
+ @SuppressWarnings("ConstantConditions")
+ private void checkPhysicalRam() {
+ long ram = ctx.discovery().localNode().attribute(ATTR_PHY_RAM);
+
+ if (ram != -1) {
+ String macs = ctx.discovery().localNode().attribute(ATTR_MACS);
+
+ long totalHeap = 0;
+
+ for (ClusterNode node : ctx.discovery().allNodes()) {
+ if (macs.equals(node.attribute(ATTR_MACS))) {
+ long heap = node.metrics().getHeapMemoryMaximum();
+
+ if (heap != -1)
+ totalHeap += heap;
+ }
+ }
+
+ if (totalHeap > ram) {
+ U.quietAndWarn(log, "Attempting to start more nodes than physical RAM " +
+ "available on current host (this can cause significant slowdown)");
+ }
+ }
+ }
+
+ /**
+ * @param ctx Context.
+ * @param cfg Configuration to check for possible performance issues.
+ */
+ private void suggestOptimizations(GridKernalContext ctx, IgniteConfiguration cfg) {
+ GridPerformanceSuggestions perf = ctx.performance();
+
+ if (ctx.collision().enabled())
+ perf.add("Disable collision resolution (remove 'collisionSpi' from configuration)");
+
+ if (ctx.checkpoint().enabled())
+ perf.add("Disable checkpoints (remove 'checkpointSpi' from configuration)");
+
+ if (cfg.isPeerClassLoadingEnabled())
+ perf.add("Disable peer class loading (set 'peerClassLoadingEnabled' to false)");
+
+ if (cfg.isMarshalLocalJobs())
+ perf.add("Disable local jobs marshalling (set 'marshalLocalJobs' to false)");
+
+ if (cfg.getIncludeEventTypes() != null && cfg.getIncludeEventTypes().length != 0)
+ perf.add("Disable grid events (remove 'includeEventTypes' from configuration)");
+
+ if (IgniteOptimizedMarshaller.available() && !(cfg.getMarshaller() instanceof IgniteOptimizedMarshaller))
+ perf.add("Enable optimized marshaller (set 'marshaller' to " +
+ IgniteOptimizedMarshaller.class.getSimpleName() + ')');
+ }
+
+ /**
+ * Warns user about unsupported features which was configured in OS edition.
+ *
+ * @param cfg Grid configuration.
+ */
+ private void warnNotSupportedFeaturesForOs(IgniteConfiguration cfg) {
+ Collection<String> msgs = new ArrayList<>();
+
+ if (!F.isEmpty(cfg.getSegmentationResolvers()))
+ msgs.add("Network segmentation detection.");
+
+ if (cfg.getSecureSessionSpi() != null && !(cfg.getSecureSessionSpi() instanceof NoopSecureSessionSpi))
+ msgs.add("Secure session SPI.");
+
+ if (cfg.getAuthenticationSpi() != null && !(cfg.getAuthenticationSpi() instanceof NoopAuthenticationSpi))
+ msgs.add("Authentication SPI.");
+
+ if (!F.isEmpty(msgs)) {
+ U.quietAndInfo(log, "The following features are not supported in open source edition, " +
+ "related configuration settings will be ignored " +
+ "(consider downloading enterprise edition from http://www.gridgain.com):");
+
+ for (String s : msgs)
+ U.quietAndInfo(log, " ^-- " + s);
+
+ U.quietAndInfo(log, "");
+ }
+ }
+
+ /**
+ * Creates attributes map and fills it in.
+ *
+ * @param cfg Grid configuration.
+ * @param build Build string.
+ * @return Map of all node attributes.
+ * @throws IgniteCheckedException thrown if was unable to set up attribute.
+ */
+ @SuppressWarnings({"SuspiciousMethodCalls", "unchecked", "TypeMayBeWeakened"})
+ private Map<String, Object> createNodeAttributes(IgniteConfiguration cfg, String build) throws IgniteCheckedException {
+ Map<String, Object> attrs = new HashMap<>();
+
+ final String[] incProps = cfg.getIncludeProperties();
+
+ try {
+ // Stick all environment settings into node attributes.
+ attrs.putAll(F.view(System.getenv(), new P1<String>() {
+ @Override public boolean apply(String name) {
+ return incProps == null || U.containsStringArray(incProps, name, true) ||
+ U.isVisorNodeStartProperty(name) || U.isVisorRequiredProperty(name);
+ }
+ }));
+
+ if (log.isDebugEnabled())
+ log.debug("Added environment properties to node attributes.");
+ }
+ catch (SecurityException e) {
+ throw new IgniteCheckedException("Failed to add environment properties to node attributes due to " +
+ "security violation: " + e.getMessage());
+ }
+
+ try {
+ // Stick all system properties into node's attributes overwriting any
+ // identical names from environment properties.
+ for (Map.Entry<Object, Object> e : F.view(System.getProperties(), new P1<Object>() {
+ @Override public boolean apply(Object o) {
+ String name = (String)o;
+
+ return incProps == null || U.containsStringArray(incProps, name, true) ||
+ U.isVisorRequiredProperty(name);
+ }
+ }).entrySet()) {
+ Object val = attrs.get(e.getKey());
+
+ if (val != null && !val.equals(e.getValue()))
+ U.warn(log, "System property will override environment variable with the same name: "
+ + e.getKey());
+
+ attrs.put((String)e.getKey(), e.getValue());
+ }
+
+ if (log.isDebugEnabled())
+ log.debug("Added system properties to node attributes.");
+ }
+ catch (SecurityException e) {
+ throw new IgniteCheckedException("Failed to add system properties to node attributes due to security " +
+ "violation: " + e.getMessage());
+ }
+
+ // Add local network IPs and MACs.
+ String ips = F.concat(U.allLocalIps(), ", "); // Exclude loopbacks.
+ String macs = F.concat(U.allLocalMACs(), ", "); // Only enabled network interfaces.
+
+ // Ack network context.
+ if (log.isInfoEnabled()) {
+ log.info("Non-loopback local IPs: " + (F.isEmpty(ips) ? "N/A" : ips));
+ log.info("Enabled local MACs: " + (F.isEmpty(macs) ? "N/A" : macs));
+ }
+
+ // Warn about loopback.
+ if (ips.isEmpty() && macs.isEmpty())
+ U.warn(log, "GridGain is starting on loopback address... Only nodes on the same physical " +
+ "computer can participate in topology.",
+ "GridGain is starting on loopback address...");
+
+ // Stick in network context into attributes.
+ add(attrs, ATTR_IPS, (ips.isEmpty() ? "" : ips));
+ add(attrs, ATTR_MACS, (macs.isEmpty() ? "" : macs));
+
+ // Stick in some system level attributes
+ add(attrs, ATTR_JIT_NAME, U.getCompilerMx() == null ? "" : U.getCompilerMx().getName());
+ add(attrs, ATTR_BUILD_VER, COMPOUND_VER);
+ add(attrs, ATTR_BUILD_DATE, build);
+ add(attrs, ATTR_COMPATIBLE_VERS, (Serializable)compatibleVersions());
+ add(attrs, ATTR_MARSHALLER, cfg.getMarshaller().getClass().getName());
+ add(attrs, ATTR_USER_NAME, System.getProperty("user.name"));
+ add(attrs, ATTR_GRID_NAME, gridName);
+
+ add(attrs, ATTR_PEER_CLASSLOADING, cfg.isPeerClassLoadingEnabled());
+ add(attrs, ATTR_DEPLOYMENT_MODE, cfg.getDeploymentMode());
+ add(attrs, ATTR_LANG_RUNTIME, getLanguage());
+
+ add(attrs, ATTR_JVM_PID, U.jvmPid());
+
+ // Build a string from JVM arguments, because parameters with spaces are split.
+ SB jvmArgs = new SB(512);
+
+ for (String arg : U.jvmArgs()) {
+ if (arg.startsWith("-"))
+ jvmArgs.a("@@@");
+ else
+ jvmArgs.a(' ');
+
+ jvmArgs.a(arg);
+ }
+ // Add it to attributes.
+ add(attrs, ATTR_JVM_ARGS, jvmArgs.toString());
+
+ // Check daemon system property and override configuration if it's set.
+ if (isDaemon())
+ add(attrs, ATTR_DAEMON, "true");
+
+ // In case of the parsing error, JMX remote disabled or port not being set
+ // node attribute won't be set.
+ if (isJmxRemoteEnabled()) {
+ String portStr = System.getProperty("com.sun.management.jmxremote.port");
+
+ if (portStr != null)
+ try {
+ add(attrs, ATTR_JMX_PORT, Integer.parseInt(portStr));
+ }
+ catch (NumberFormatException ignore) {
+ // No-op.
+ }
+ }
+
+ // Whether restart is enabled and stick the attribute.
+ add(attrs, ATTR_RESTART_ENABLED, Boolean.toString(isRestartEnabled()));
+
+ // Save port range, port numbers will be stored by rest processor at runtime.
+ if (cfg.getClientConnectionConfiguration() != null)
+ add(attrs, ATTR_REST_PORT_RANGE, cfg.getClientConnectionConfiguration().getRestPortRange());
+
+ try {
+ AuthenticationSpi authSpi = cfg.getAuthenticationSpi();
+
+ boolean securityEnabled = authSpi != null && !U.hasAnnotation(authSpi.getClass(), IgniteSpiNoop.class);
+
+ GridSecurityCredentialsProvider provider = cfg.getSecurityCredentialsProvider();
+
+ if (provider != null) {
+ GridSecurityCredentials cred = provider.credentials();
+
+ if (cred != null)
+ add(attrs, ATTR_SECURITY_CREDENTIALS, cred);
+ else if (securityEnabled)
+ throw new IgniteCheckedException("Failed to start node (authentication SPI is configured, " +
+ "by security credentials provider returned null).");
+ }
+ else if (securityEnabled)
+ throw new IgniteCheckedException("Failed to start node (authentication SPI is configured, " +
+ "but security credentials provider is not set. Fix the configuration and restart the node).");
+ }
+ catch (IgniteCheckedException e) {
+ throw new IgniteCheckedException("Failed to create node security credentials", e);
+ }
+
+ // Stick in SPI versions and classes attributes.
+ addAttributes(attrs, cfg.getCollisionSpi());
+ addAttributes(attrs, cfg.getSwapSpaceSpi());
+ addAttributes(attrs, cfg.getDiscoverySpi());
+ addAttributes(attrs, cfg.getFailoverSpi());
+ addAttributes(attrs, cfg.getCommunicationSpi());
+ addAttributes(attrs, cfg.getEventStorageSpi());
+ addAttributes(attrs, cfg.getCheckpointSpi());
+ addAttributes(attrs, cfg.getLoadBalancingSpi());
+ addAttributes(attrs, cfg.getAuthenticationSpi());
+ addAttributes(attrs, cfg.getSecureSessionSpi());
+ addAttributes(attrs, cfg.getDeploymentSpi());
+
+ // Set user attributes for this node.
+ if (cfg.getUserAttributes() != null) {
+ for (Map.Entry<String, ?> e : cfg.getUserAttributes().entrySet()) {
+ if (attrs.containsKey(e.getKey()))
+ U.warn(log, "User or internal attribute has the same name as environment or system " +
+ "property and will take precedence: " + e.getKey());
+
+ attrs.put(e.getKey(), e.getValue());
+ }
+ }
+
+ return attrs;
+ }
+
+ /**
+ * Add SPI version and class attributes into node attributes.
+ *
+ * @param attrs Node attributes map to add SPI attributes to.
+ * @param spiList Collection of SPIs to get attributes from.
+ * @throws IgniteCheckedException Thrown if was unable to set up attribute.
+ */
+ private void addAttributes(Map<String, Object> attrs, IgniteSpi... spiList) throws IgniteCheckedException {
+ for (IgniteSpi spi : spiList) {
+ Class<? extends IgniteSpi> spiCls = spi.getClass();
+
+ add(attrs, U.spiAttribute(spi, ATTR_SPI_CLASS), spiCls.getName());
+ }
+ }
+
+ /** @throws IgniteCheckedException If registration failed. */
+ private void registerKernalMBean() throws IgniteCheckedException {
+ try {
+ kernalMBean = U.registerMBean(
+ cfg.getMBeanServer(),
+ cfg.getGridName(),
+ "Kernal",
+ getClass().getSimpleName(),
+ this,
+ IgniteMXBean.class);
+
+ if (log.isDebugEnabled())
+ log.debug("Registered kernal MBean: " + kernalMBean);
+ }
+ catch (JMException e) {
+ kernalMBean = null;
+
+ throw new IgniteCheckedException("Failed to register kernal MBean.", e);
+ }
+ }
+
+ /** @throws IgniteCheckedException If registration failed. */
+ private void registerLocalNodeMBean() throws IgniteCheckedException {
+ ClusterLocalNodeMetricsMXBean mbean = new ClusterLocalNodeMetricsMXBeanImpl(ctx.discovery().localNode());
+
+ try {
+ locNodeMBean = U.registerMBean(
+ cfg.getMBeanServer(),
+ cfg.getGridName(),
+ "Kernal",
+ mbean.getClass().getSimpleName(),
+ mbean,
+ ClusterLocalNodeMetricsMXBean.class);
+
+ if (log.isDebugEnabled())
+ log.debug("Registered local node MBean: " + locNodeMBean);
+ }
+ catch (JMException e) {
+ locNodeMBean = null;
+
+ throw new IgniteCheckedException("Failed to register local node MBean.", e);
+ }
+ }
+
+ /** @throws IgniteCheckedException If registration failed. */
+ private void registerExecutorMBeans() throws IgniteCheckedException {
+ pubExecSvcMBean = registerExecutorMBean(cfg.getExecutorService(), "GridExecutionExecutor");
+ sysExecSvcMBean = registerExecutorMBean(cfg.getSystemExecutorService(), "GridSystemExecutor");
+ mgmtExecSvcMBean = registerExecutorMBean(cfg.getManagementExecutorService(), "GridManagementExecutor");
+ p2PExecSvcMBean = registerExecutorMBean(cfg.getPeerClassLoadingExecutorService(), "GridClassLoadingExecutor");
+
+ ClientConnectionConfiguration clientCfg = cfg.getClientConnectionConfiguration();
+
+ if (clientCfg != null) {
+ restExecSvcMBean = clientCfg.getRestExecutorService() != null ?
+ registerExecutorMBean(clientCfg.getRestExecutorService(), "GridRestExecutor") : null;
+ }
+ }
+
+ /**
+ * @param exec Executor service to register.
+ * @param name Property name for executor.
+ * @return Name for created MBean.
+ * @throws IgniteCheckedException If registration failed.
+ */
+ private ObjectName registerExecutorMBean(ExecutorService exec, String name) throws IgniteCheckedException {
+ assert exec != null;
+
+ try {
+ ObjectName res = U.registerMBean(
+ cfg.getMBeanServer(),
+ cfg.getGridName(),
+ "Thread Pools",
+ name,
+ new IgniteThreadPoolMXBeanAdapter(exec),
+ IgniteThreadPoolMXBean.class);
+
+ if (log.isDebugEnabled())
+ log.debug("Registered executor service MBean: " + res);
+
+ return res;
+ }
+ catch (JMException e) {
+ throw new IgniteCheckedException("Failed to register executor service MBean [name=" + name + ", exec=" + exec + ']',
+ e);
+ }
+ }
+
+ /**
+ * Unregisters given mbean.
+ *
+ * @param mbean MBean to unregister.
+ * @return {@code True} if successfully unregistered, {@code false} otherwise.
+ */
+ private boolean unregisterMBean(@Nullable ObjectName mbean) {
+ if (mbean != null)
+ try {
+ cfg.getMBeanServer().unregisterMBean(mbean);
+
+ if (log.isDebugEnabled())
+ log.debug("Unregistered MBean: " + mbean);
+
+ return true;
+ }
+ catch (JMException e) {
+ U.error(log, "Failed to unregister MBean.", e);
+
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * @param ctx Kernal context.
+ * @param mgr Manager to start.
+ * @param attrs SPI attributes to set.
+ * @throws IgniteCheckedException Throw in case of any errors.
+ */
+ private void startManager(GridKernalContextImpl ctx, GridManager mgr, Map<String, Object> attrs)
+ throws IgniteCheckedException {
+ mgr.addSpiAttributes(attrs);
+
+ // Set all node attributes into discovery manager,
+ // so they can be distributed to all nodes.
+ if (mgr instanceof GridDiscoveryManager)
+ ((GridDiscoveryManager)mgr).setNodeAttributes(attrs, ctx.product().version());
+
+ // Add manager to registry before it starts to avoid
+ // cases when manager is started but registry does not
+ // have it yet.
+ ctx.add(mgr);
+
+ try {
+ mgr.start();
+ }
+ catch (IgniteCheckedException e) {
+ throw new IgniteCheckedException("Failed to start manager: " + mgr, e);
+ }
+ }
+
+ /**
+ * @param ctx Kernal context.
+ * @param proc Processor to start.
+ * @param attrs Attributes.
+ * @throws IgniteCheckedException Thrown in case of any error.
+ */
+ private void startProcessor(GridKernalContextImpl ctx, GridProcessor proc, Map<String, Object> attrs)
+ throws IgniteCheckedException {
+ ctx.add(proc);
+
+ try {
+ proc.start();
+
+ proc.addAttributes(attrs);
+ }
+ catch (IgniteCheckedException e) {
+ throw new IgniteCheckedException("Failed to start processor: " + proc, e);
+ }
+ }
+
+ /**
+ * Add helper.
+ *
+ * @param ctx Context.
+ * @param helper Helper.
+ */
+ private void addHelper(GridKernalContextImpl ctx, Object helper) {
+ ctx.addHelper(helper);
+ }
+
+ /**
+ * Gets "on" or "off" string for given boolean value.
+ *
+ * @param b Boolean value to convert.
+ * @return Result string.
+ */
+ private String onOff(boolean b) {
+ return b ? "on" : "off";
+ }
+
+ /**
+ *
+ * @return Whether or not REST is enabled.
+ */
+ private boolean isRestEnabled() {
+ assert cfg != null;
+
+ return cfg.getClientConnectionConfiguration() != null;
+ }
+
+ /**
+ * Acks remote management.
+ */
+ private void ackRemoteManagement() {
+ assert log != null;
+
+ if (!log.isInfoEnabled())
+ return;
+
+ SB sb = new SB();
+
+ sb.a("Remote Management [");
+
+ boolean on = isJmxRemoteEnabled();
+
+ sb.a("restart: ").a(onOff(isRestartEnabled())).a(", ");
+ sb.a("REST: ").a(onOff(isRestEnabled())).a(", ");
+ sb.a("JMX (");
+ sb.a("remote: ").a(onOff(on));
+
+ if (on) {
+ sb.a(", ");
+
+ sb.a("port: ").a(System.getProperty("com.sun.management.jmxremote.port", "<n/a>")).a(", ");
+ sb.a("auth: ").a(onOff(Boolean.getBoolean("com.sun.management.jmxremote.authenticate"))).a(", ");
+
+ // By default SSL is enabled, that's why additional check for null is needed.
+ // See http://docs.oracle.com/javase/6/docs/technotes/guides/management/agent.html
+ sb.a("ssl: ").a(onOff(Boolean.getBoolean("com.sun.management.jmxremote.ssl") ||
+ System.getProperty("com.sun.management.jmxremote.ssl") == null));
+ }
+
+ sb.a(")");
+
+ sb.a(']');
+
+ log.info(sb.toString());
+ }
+
+ /**
+ * Acks configuration URL.
+ */
+ private void ackConfigUrl() {
+ assert log != null;
+
+ if (log.isInfoEnabled())
+ log.info("Config URL: " + System.getProperty(GG_CONFIG_URL, "n/a"));
+ }
+
+ /**
+ * Acks Visor instructions.
+ */
+ private void ackVisor() {
+ assert log != null;
+
+ if (isDaemon())
+ return;
+
+ if (ctx.isEnterprise())
+ U.quietAndInfo(log, "To start GUI Management & Monitoring run ggvisorui.{sh|bat}");
+ else
+ U.quietAndInfo(log, "To start Console Management & Monitoring run ggvisorcmd.{sh|bat}");
+ }
+
+ /**
+ * Acks benchmarking instructions.
+ */
+ private void ackBenchmarks() {
+ if (!isDaemon())
+ U.quietAndInfo(log, "If running benchmarks, see http://bit.ly/GridGain-Benchmarking");
+ }
+
+ /**
+ * Acks ASCII-logo. Thanks to http://patorjk.com/software/taag
+ */
+ private void ackAsciiLogo() {
+ assert log != null;
+
+ String fileName = log.fileName();
+
+ if (System.getProperty(GG_NO_ASCII) == null) {
+ String ver = "ver. " + ACK_VER;
+
+ // Big thanks to: http://patorjk.com/software/taag
+ // Font name "Small Slant"
+ if (log.isQuiet()) {
+ U.quiet(false,
+ " __________ ________________ ",
+ " / _/ ___/ |/ / _/_ __/ __/ ",
+ " _/ // (_ / // / / / / _/ ",
+ "/___/\\___/_/|_/___/ /_/ /___/ ",
+ " ",
+ ver,
+ COPYRIGHT,
+ "",
+ "Quiet mode.");
+
+ if (fileName != null)
+ U.quiet(false, " ^-- Logging to file '" + fileName + '\'');
+
+ U.quiet(false,
+ " ^-- To see **FULL** console log here add -DGRIDGAIN_QUIET=false or \"-v\" to ggstart.{sh|bat}",
+ "");
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info(NL + NL +
+ ">>> __________ ________________ " + NL +
+ ">>> / _/ ___/ |/ / _/_ __/ __/ " + NL +
+ ">>> _/ // (_ / // / / / / _/ " + NL +
+ ">>> /___/\\___/_/|_/___/ /_/ /___/ " + NL +
+ ">>> " + NL +
+ ">>> " + ver + NL +
+ ">>> " + COPYRIGHT + NL
+ );
+ }
+ }
+ }
+
+ /**
+ * Prints start info.
+ *
+ * @param rtBean Java runtime bean.
+ */
+ private void ackStart(RuntimeMXBean rtBean) {
+ if (log.isQuiet()) {
+ U.quiet(false, "");
+ U.quiet(false, "GridGain node started OK (id=" + U.id8(localNode().id()) +
+ (F.isEmpty(gridName) ? "" : ", grid=" + gridName) + ')');
+ }
+
+ if (log.isInfoEnabled()) {
+ log.info("");
+
+ String ack = "GridGain ver. " + COMPOUND_VER + '#' + BUILD_TSTAMP_STR + "-sha1:" + REV_HASH;
+
+ String dash = U.dash(ack.length());
+
+ SB sb = new SB();
+
+ for (GridPortRecord rec : ctx.ports().records())
+ sb.a(rec.protocol()).a(":").a(rec.port()).a(" ");
+
+ String str =
+ NL + NL +
+ ">>> " + dash + NL +
+ ">>> " + ack + NL +
+ ">>> " + dash + NL +
+ ">>> OS name: " + U.osString() + NL +
+ ">>> CPU(s): " + localNode().metrics().getTotalCpus() + NL +
+ ">>> Heap: " + U.heapSize(localNode(), 2) + "GB" + NL +
+ ">>> VM name: " + rtBean.getName() + NL +
+ ">>> Grid name: " + gridName + NL +
+ ">>> Local node [" +
+ "ID=" + localNode().id().toString().toUpperCase() +
+ ", order=" + localNode().order() +
+ "]" + NL +
+ ">>> Local node addresses: " + U.addressesAsString(localNode()) + NL +
+ ">>> Local ports: " + sb + NL;
+
+ str += ">>> GridGain documentation: http://" + SITE + "/documentation" + NL;
+
+ log.info(str);
+ }
+ }
+
+ /**
+ * Logs out OS information.
+ */
+ private void ackOsInfo() {
+ assert log != null;
+
+ if (log.isInfoEnabled()) {
+ log.info("OS: " + U.osString());
+ log.info("OS user: " + System.getProperty("user.name"));
+ }
+ }
+
+ /**
+ * Logs out language runtime.
+ */
+ private void ackLanguageRuntime() {
+ assert log != null;
+
+ if (log.isInfoEnabled()) {
+ log.info("Language runtime: " + getLanguage());
+ log.info("VM information: " + U.jdkString());
+ log.info("VM total memory: " + U.heapSize(2) + "GB");
+ }
+ }
+
+ /**
+ * @return Language runtime.
+ */
+ @SuppressWarnings("ThrowableInstanceNeverThrown")
+ private String getLanguage() {
+ boolean scala = false;
+ boolean groovy = false;
+ boolean clojure = false;
+
+ for (StackTraceElement elem : Thread.currentThread().getStackTrace()) {
+ String s = elem.getClassName().toLowerCase();
+
+ if (s.contains("scala")) {
+ scala = true;
+
+ break;
+ }
+ else if (s.contains("groovy")) {
+ groovy = true;
+
+ break;
+ }
+ else if (s.contains("clojure")) {
+ clojure = true;
+
+ break;
+ }
+ }
+
+ if (scala) {
+ try (InputStream in = getClass().getResourceAsStream("/library.properties")) {
+ Properties props = new Properties();
+
+ if (in != null)
+ props.load(in);
+
+ return "Scala ver. " + props.getProperty("version.number", "<unknown>");
+ }
+ catch (Throwable ignore) {
+ return "Scala ver. <unknown>";
+ }
+ }
+
+ // How to get Groovy and Clojure version at runtime?!?
+ return groovy ? "Groovy" : clojure ? "Clojure" : U.jdkName() + " ver. " + U.jdkVersion();
+ }
+
+ /**
+ * Stops grid instance.
+ *
+ * @param cancel Whether or not to cancel running jobs.
+ */
+ public void stop(boolean cancel) {
+ // Make sure that thread stopping grid is not interrupted.
+ boolean interrupted = Thread.interrupted();
+
+ try {
+ stop0(cancel);
+ }
+ finally {
+ if (interrupted)
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ /**
+ * @param cancel Whether or not to cancel running jobs.
+ */
+ private void stop0(boolean cancel) {
+ String nid = getLocalNodeId().toString().toUpperCase();
+ String nid8 = U.id8(getLocalNodeId()).toUpperCase();
+
+ gw.compareAndSet(null, new GridKernalGatewayImpl(gridName));
+
+ GridKernalGateway gw = this.gw.get();
+
+ if (stopGuard.compareAndSet(false, true)) {
+ // Only one thread is allowed to perform stop sequence.
+ boolean firstStop = false;
+
+ GridKernalState state = gw.getState();
+
+ if (state == STARTED)
+ firstStop = true;
+ else if (state == STARTING)
+ U.warn(log, "Attempt to stop starting grid. This operation " +
+ "cannot be guaranteed to be successful.");
+
+ if (firstStop) {
+ // Notify lifecycle beans.
+ if (log.isDebugEnabled())
+ log.debug("Notifying lifecycle beans.");
+
+ notifyLifecycleBeansEx(LifecycleEventType.BEFORE_GRID_STOP);
+ }
+
+ IgniteEmailProcessorAdapter email = ctx.email();
+
+ List<GridComponent> comps = ctx.components();
+
+ // Callback component in reverse order while kernal is still functional
+ // if called in the same thread, at least.
+ for (ListIterator<GridComponent> it = comps.listIterator(comps.size()); it.hasPrevious();) {
+ GridComponent comp = it.previous();
+
+ try {
+ comp.onKernalStop(cancel);
+ }
+ catch (Throwable e) {
+ errOnStop = true;
+
+ U.error(log, "Failed to pre-stop processor: " + comp, e);
+ }
+ }
+
+ // Cancel update notification timer.
+ if (updateNtfTimer != null)
+ updateNtfTimer.cancel();
+
+ if (starveTimer != null)
+ starveTimer.cancel();
+
+ // Cancel license timer.
+ if (licTimer != null)
+ licTimer.cancel();
+
+ // Cancel metrics log timer.
+ if (metricsLogTimer != null)
+ metricsLogTimer.cancel();
+
+ gw.writeLock();
+
+ try {
+ assert gw.getState() == STARTED || gw.getState() == STARTING;
+
+ // No more kernal calls from this point on.
+ gw.setState(STOPPING);
+
+ // Clear node local store.
+ nodeLoc.clear();
+
+ if (log.isDebugEnabled())
+ log.debug("Grid " + (gridName == null ? "" : '\'' + gridName + "' ") + "is stopping.");
+ }
+ finally {
+ gw.writeUnlock();
+ }
+
+ // Unregister MBeans.
+ if (!(
+ unregisterMBean(pubExecSvcMBean) &
+ unregisterMBean(sysExecSvcMBean) &
+ unregisterMBean(mgmtExecSvcMBean) &
+ unregisterMBean(p2PExecSvcMBean) &
+ unregisterMBean(kernalMBean) &
+ unregisterMBean(locNodeMBean) &
+ unregisterMBean(restExecSvcMBean)
+ ))
+ errOnStop = false;
+
+ // Stop components in reverse order.
+ for (ListIterator<GridComponent> it = comps.listIterator(comps.size()); it.hasPrevious();) {
+ GridComponent comp = it.previous();
+
+ try {
+ comp.stop(cancel);
+
+ if (log.isDebugEnabled())
+ log.debug("Component stopped: " + comp);
+ }
+ catch (Throwable e) {
+ errOnStop = true;
+
+ U.error(log, "Failed to stop component (ignoring): " + comp, e);
+ }
+ }
+
+ // Stops lifecycle aware components.
+ U.stopLifecycleAware(log, lifecycleAwares(cfg));
+
+ // Lifecycle notification.
+ notifyLifecycleBeansEx(LifecycleEventType.AFTER_GRID_STOP);
+
+ // Clean internal class/classloader caches to avoid stopped contexts held in memory.
+ IgniteOptimizedMarshaller.clearCache();
+ IgniteMarshallerExclusions.clearCache();
+ GridEnumCache.clear();
+
+ gw.writeLock();
+
+ try {
+ gw.setState(STOPPED);
+ }
+ finally {
+ gw.writeUnlock();
+ }
+
+ // Ack stop.
+ if (log.isQuiet()) {
+ if (!errOnStop)
+ U.quiet(false, "GridGain node stopped OK [uptime=" +
+ X.timeSpan2HMSM(U.currentTimeMillis() - startTime) + ']');
+ else
+ U.quiet(true, "GridGain node stopped wih ERRORS [uptime=" +
+ X.timeSpan2HMSM(U.currentTimeMillis() - startTime) + ']');
+ }
+
+ if (log.isInfoEnabled())
+ if (!errOnStop) {
+ String ack = "GridGain ver. " + COMPOUND_VER + '#' + BUILD_TSTAMP_STR + "-sha1:" + REV_HASH +
+ " stopped OK";
+
+ String dash = U.dash(ack.length());
+
+ log.info(NL + NL +
+ ">>> " + dash + NL +
+ ">>> " + ack + NL +
+ ">>> " + dash + NL +
+ ">>> Grid name: " + gridName + NL +
+ ">>> Grid uptime: " + X.timeSpan2HMSM(U.currentTimeMillis() - startTime) +
+ NL +
+ NL);
+ }
+ else {
+ String ack = "GridGain ver. " + COMPOUND_VER + '#' + BUILD_TSTAMP_STR + "-sha1:" + REV_HASH +
+ " stopped with ERRORS";
+
+ String dash = U.dash(ack.length());
+
+ log.info(NL + NL +
+ ">>> " + ack + NL +
+ ">>> " + dash + NL +
+ ">>> Grid name: " + gridName + NL +
+ ">>> Grid uptime: " + X.timeSpan2HMSM(U.currentTimeMillis() - startTime) +
+ NL +
+ ">>> See log above for detailed error message." + NL +
+ ">>> Note that some errors during stop can prevent grid from" + NL +
+ ">>> maintaining correct topology since this node may have" + NL +
+ ">>> not exited grid properly." + NL +
+ NL);
+ }
+
+ // Send node start email notification, if enabled.
+ if (isSmtpEnabled() && isAdminEmailsSet() && cfg.isLifeCycleEmailNotification()) {
+ String errOk = errOnStop ? "with ERRORS" : "OK";
+
+ String headline = "GridGain ver. " + COMPOUND_VER + '#' + BUILD_TSTAMP_STR +
+ " stopped " + errOk + ":";
+ String subj = "GridGain node stopped " + errOk + ": " + nid8;
+
+ IgniteProductLicense lic = ctx.license() != null ? ctx.license().license() : null;
+
+ String body =
+ headline + NL + NL +
+ "----" + NL +
+ "GridGain ver. " + COMPOUND_VER + '#' + BUILD_TSTAMP_STR + "-sha1:" + REV_HASH + NL +
+ "Grid name: " + gridName + NL +
+ "Node ID: " + nid + NL +
+ "Node uptime: " + X.timeSpan2HMSM(U.currentTimeMillis() - startTime) + NL;
+
+ if (lic != null) {
+ body +=
+ "License ID: " + lic.id().toString().toUpperCase() + NL +
+ "Licensed to: " + lic.userOrganization() + NL;
+ }
+ else
+ assert !ENT;
+
+ body +=
+ "----" + NL +
+ NL +
+ "NOTE:" + NL +
+ "This message is sent automatically to all configured admin emails." + NL +
+ "To change this behavior use 'lifeCycleEmailNotify' grid configuration property.";
+
+ if (errOnStop)
+ body +=
+ NL + NL +
+ "NOTE:" + NL +
+ "See node's log for detailed error message." + NL +
+ "Some errors during stop can prevent grid from" + NL +
+ "maintaining correct topology since this node may " + NL +
+ "have not exited grid properly.";
+
+ body +=
+ NL + NL +
+ "| " + SITE + NL +
+ "| support@gridgain.com" + NL;
+
+ if (email != null) {
+ try {
+ email.sendNow(subj,
+ body,
+ false,
+ Arrays.asList(cfg.getAdminEmails()));
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to send lifecycle email notification.", e);
+ }
+ }
+ }
+
+ U.onGridStop();
+ }
+ else {
+ // Proper notification.
+ if (log.isDebugEnabled()) {
+ if (gw.getState() == STOPPED)
+ log.debug("Grid is already stopped. Nothing to do.");
+ else
+ log.debug("Grid is being stopped by another thread. Aborting this stop sequence " +
+ "allowing other thread to finish.");
+ }
+ }
+ }
+
+ /**
+ * USED ONLY FOR TESTING.
+ *
+ * @param <K> Key type.
+ * @param <V> Value type.
+ * @return Internal cache instance.
+ */
+ /*@java.test.only*/
+ public <K, V> GridCacheAdapter<K, V> internalCache() {
+ return internalCache(null);
+ }
+
+ /**
+ * USED ONLY FOR TESTING.
+ *
+ * @param name Cache name.
+ * @param <K> Key type.
+ * @param <V> Value type.
+ * @return Internal cache instance.
+ */
+ /*@java.test.only*/
+ public <K, V> GridCacheAdapter<K, V> internalCache(@Nullable String name) {
+ return ctx.cache().internalCache(name);
+ }
+
+ /**
+ * It's intended for use by internal marshalling implementation only.
+ *
+ * @return Kernal context.
+ */
+ public GridKernalContext context() {
+ return ctx;
+ }
+
+ /**
+ * Prints all system properties in debug mode.
+ */
+ private void ackSystemProperties() {
+ assert log != null;
+
+ if (log.isDebugEnabled())
+ for (Object key : U.asIterable(System.getProperties().keys()))
+ log.debug("System property [" + key + '=' + System.getProperty((String) key) + ']');
+ }
+
+ /**
+ * Prints all user attributes in info mode.
+ */
+ private void logNodeUserAttributes() {
+ assert log != null;
+
+ if (log.isInfoEnabled())
+ for (Map.Entry<?, ?> attr : cfg.getUserAttributes().entrySet())
+ log.info("Local node user attribute [" + attr.getKey() + '=' + attr.getValue() + ']');
+ }
+
+ /**
+ * Prints all environment variables in debug mode.
+ */
+ private void ackEnvironmentVariables() {
+ assert log != null;
+
+ if (log.isDebugEnabled())
+ for (Map.Entry<?, ?> envVar : System.getenv().entrySet())
+ log.debug("Environment variable [" + envVar.getKey() + '=' + envVar.getValue() + ']');
+ }
+
+ /**
+ * Acks daemon mode status.
+ */
+ private void ackDaemon() {
+ assert log != null;
+
+ if (log.isInfoEnabled())
+ log.info("Daemon mode: " + (isDaemon() ? "on" : "off"));
+ }
+
+ /**
+ *
+ * @return {@code True} is this node is daemon.
+ */
+ private boolean isDaemon() {
+ assert cfg != null;
+
+ return cfg.isDaemon() || "true".equalsIgnoreCase(System.getProperty(GG_DAEMON));
+ }
+
+ /**
+ * Whether or not remote JMX management is enabled for this node. Remote JMX management is
+ * enabled when the following system property is set:
+ * <ul>
+ * <li>{@code com.sun.management.jmxremote}</li>
+ * </ul>
+ *
+ * @return {@code True} if remote JMX management is enabled - {@code false} otherwise.
+ */
+ @Override public boolean isJmxRemoteEnabled() {
+ return System.getProperty("com.sun.management.jmxremote") != null;
+ }
+
+ /**
+ * Whether or not node restart is enabled. Node restart us supported when this node was started
+ * with {@code bin/ggstart.{sh|bat}} script using {@code -r} argument. Node can be
+ * programmatically restarted using {@link org.apache.ignite.Ignition#restart(boolean)}} method.
+ *
+ * @return {@code True} if restart mode is enabled, {@code false} otherwise.
+ * @see org.apache.ignite.Ignition#restart(boolean)
+ */
+ @Override public boolean isRestartEnabled() {
+ return System.getProperty(GG_SUCCESS_FILE) != null;
+ }
+
+ /**
+ * Whether or not SMTP is configured. Note that SMTP is considered configured if
+ * SMTP host is provided in configuration (see {@link org.apache.ignite.configuration.IgniteConfiguration#getSmtpHost()}.
+ * <p>
+ * If SMTP is not configured all emails notifications will be disabled.
+ *
+ * @return {@code True} if SMTP is configured - {@code false} otherwise.
+ * @see org.apache.ignite.configuration.IgniteConfiguration#getSmtpFromEmail()
+ * @see org.apache.ignite.configuration.IgniteConfiguration#getSmtpHost()
+ * @see org.apache.ignite.configuration.IgniteConfiguration#getSmtpPassword()
+ * @see org.apache.ignite.configuration.IgniteConfiguration#getSmtpPort()
+ * @see org.apache.ignite.configuration.IgniteConfiguration#getSmtpUsername()
+ * @see org.apache.ignite.configuration.IgniteConfiguration#isSmtpSsl()
+ * @see org.apache.ignite.configuration.IgniteConfiguration#isSmtpStartTls()
+ * @see #sendAdminEmailAsync(String, String, boolean)
+ */
+ @Override public boolean isSmtpEnabled() {
+ assert cfg != null;
+
+ return cfg.getSmtpHost() != null;
+ }
+
+ /**
+ * Prints all configuration properties in info mode and SPIs in debug mode.
+ */
+ private void ackSpis() {
+ assert log != null;
+
+ if (log.isDebugEnabled()) {
+ log.debug("+-------------+");
+ log.debug("START SPI LIST:");
+ log.debug("+-------------+");
+ log.debug("Grid checkpoint SPI : " + Arrays.toString(cfg.getCheckpointSpi()));
+ log.debug("Grid collision SPI : " + cfg.getCollisionSpi());
+ log.debug("Grid communication SPI : " + cfg.getCommunicationSpi());
+ log.debug("Grid deployment SPI : " + cfg.getDeploymentSpi());
+ log.debug("Grid discovery SPI : " + cfg.getDiscoverySpi());
+ log.debug("Grid event storage SPI : " + cfg.getEventStorageSpi());
+ log.debug("Grid failover SPI : " + Arrays.toString(cfg.getFailoverSpi()));
+ log.debug("Grid load balancing SPI : " + Arrays.toString(cfg.getLoadBalancingSpi()));
+ log.debug("Grid authentication SPI : " + cfg.getAuthenticationSpi());
+ log.debug("Grid secure session SPI : " + cfg.getSecureSessionSpi());
+ log.debug("Grid swap space SPI : " + cfg.getSwapSpaceSpi());
+ }
+ }
+
+ /**
+ *
+ */
+ private void ackCacheConfiguration() {
+ CacheConfiguration[] cacheCfgs = cfg.getCacheConfiguration();
+
+ if (cacheCfgs == null || cacheCfgs.length == 0)
+ U.w
<TRUNCATED>
[03/52] [abbrv] incubator-ignite git commit: GridNamedInstance ->
IgniteNamedInstance GridgainEx -> IgnitionEx
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5247ab3/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
index 776cda6..88dbef6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
@@ -888,7 +888,7 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
*/
protected Object readResolve() throws ObjectStreamException {
try {
- return GridGainEx.gridx(stash.get()).context();
+ return IgnitionEx.gridx(stash.get()).context();
}
catch (IllegalStateException e) {
throw U.withCause(new InvalidObjectException(e.getMessage()), e);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5247ab3/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java
index 042e3ec..d8e6816 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java
@@ -200,7 +200,7 @@ public class GridLoggerProxy implements IgniteLogger, LifecycleAware, Externaliz
String gridNameR = t.get1();
Object ctgrR = t.get2();
- return GridGainEx.gridx(gridNameR).log().getLogger(ctgrR);
+ return IgnitionEx.gridx(gridNameR).log().getLogger(ctgrR);
}
catch (IllegalStateException e) {
throw U.withCause(new InvalidObjectException(e.getMessage()), e);
[21/52] [abbrv] incubator-ignite git commit: Tests: Fix compile
Posted by vk...@apache.org.
Tests: Fix compile
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f30d79d1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f30d79d1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f30d79d1
Branch: refs/heads/ignite-61
Commit: f30d79d1f4b71833fea763fdacfe5f15300e4aa2
Parents: 4009aaa
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jan 29 18:29:51 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jan 29 18:29:51 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f30d79d1/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala
index 1899ca4..8047b8a 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala
@@ -17,7 +17,7 @@
package org.apache.ignite.visor.commands.alert
-import org.apache.ignite.internal.util.{IgniteUtils => U}
+import org.apache.ignite.internal.util.IgniteUtils
import org.apache.ignite.internal.util.lang.{GridFunc => F}
import org.apache.ignite._
[47/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
index 0000000,c7e7e81..a5c5e47
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
@@@ -1,0 -1,612 +1,612 @@@
+ /*
+ * 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.managers;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.cache.*;
+ import org.apache.ignite.cluster.*;
+ import org.apache.ignite.events.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.plugin.extensions.communication.*;
++import org.apache.ignite.plugin.security.*;
+ import org.apache.ignite.spi.*;
+ import org.apache.ignite.internal.managers.communication.*;
+ import org.apache.ignite.internal.managers.eventstorage.*;
-import org.apache.ignite.plugin.security.*;
+ import org.apache.ignite.spi.swapspace.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import javax.cache.expiry.*;
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ import static java.util.Arrays.*;
+ import static java.util.concurrent.TimeUnit.*;
+ import static org.apache.ignite.internal.managers.communication.GridIoPolicy.*;
+
+ /**
+ * Convenience adapter for grid managers.
+ *
+ * @param <T> SPI wrapped by this manager.
+ *
+ */
+ public abstract class GridManagerAdapter<T extends IgniteSpi> implements GridManager {
+ /** Kernal context. */
+ @GridToStringExclude
+ protected final GridKernalContext ctx;
+
+ /** Logger. */
+ @GridToStringExclude
+ protected final IgniteLogger log;
+
+ /** Set of SPIs for this manager. */
+ @GridToStringExclude
+ private final T[] spis;
+
+ /** Checks is SPI implementation is {@code NO-OP} or not. */
+ private final boolean enabled;
+
+ /**
+ * @param ctx Kernal context.
+ * @param spis Specific SPI instance.
+ */
+ protected GridManagerAdapter(GridKernalContext ctx, T... spis) {
+ assert spis != null;
+ assert spis.length > 0;
+ assert ctx != null;
+
+ this.ctx = ctx;
+ this.spis = spis;
+
+ boolean enabled = false;
+
+ for (int i = 0; i < spis.length; i++) {
+ if (!U.hasAnnotation(this.spis[i].getClass(), IgniteSpiNoop.class))
+ enabled = true;
+ }
+
+ this.enabled = enabled;
+
+ log = ctx.log(getClass());
+ }
+
+ /**
+ * Gets wrapped SPI.
+ *
+ * @return Wrapped SPI.
+ */
+ protected final T getSpi() {
+ return spis[0];
+ }
+
+ /**
+ * @param name SPI name
+ * @return SPI for given name. If {@code null} or empty, then 1st SPI on the list
+ * is returned.
+ */
+ protected final T getSpi(@Nullable String name) {
+ if (F.isEmpty(name))
+ return spis[0];
+
+ // Loop through SPI's, not proxies, because
+ // proxy.getName() is more expensive than spi.getName().
+ for (T t : spis) {
+ if (t.getName().equals(name))
+ return t;
+ }
+
+ throw new IgniteException("Failed to find SPI for name: " + name);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean enabled() {
+ return enabled;
+ }
+
+ /**
+ * @return Configured SPI's.
+ */
+ protected final T[] getSpis() {
+ return spis;
+ }
+
+ /** {@inheritDoc} */
+ @Override public final void addSpiAttributes(Map<String, Object> attrs) throws IgniteCheckedException {
+ for (T spi : spis) {
+ // Inject all spi resources.
+ ctx.resource().inject(spi);
+
+ // Inject SPI internal objects.
+ inject(spi);
+
+ try {
+ Map<String, Object> retval = spi.getNodeAttributes();
+
+ if (retval != null) {
+ for (Map.Entry<String, Object> e : retval.entrySet()) {
+ if (attrs.containsKey(e.getKey()))
+ throw new IgniteCheckedException("SPI attribute collision for attribute [spi=" + spi +
+ ", attr=" + e.getKey() + ']' +
+ ". Attribute set by one SPI implementation has the same name (name collision) as " +
+ "attribute set by other SPI implementation. Such overriding is not allowed. " +
+ "Please check your GridGain configuration and/or SPI implementation to avoid " +
+ "attribute name collisions.");
+
+ attrs.put(e.getKey(), e.getValue());
+ }
+ }
+ }
+ catch (IgniteSpiException e) {
+ throw new IgniteCheckedException("Failed to get SPI attributes.", e);
+ }
+ }
+ }
+
+ /**
+ * @param spi SPI whose internal objects need to be injected.
+ * @throws IgniteCheckedException If injection failed.
+ */
+ private void inject(IgniteSpi spi) throws IgniteCheckedException {
+ if (spi instanceof IgniteSpiAdapter) {
+ Collection<Object> injectables = ((IgniteSpiAdapter)spi).injectables();
+
+ if (!F.isEmpty(injectables))
+ for (Object o : injectables)
+ ctx.resource().injectGeneric(o);
+ }
+ }
+
+ /**
+ * @param spi SPI whose internal objects need to be injected.
+ * @throws IgniteCheckedException If injection failed.
+ */
+ private void cleanup(IgniteSpi spi) throws IgniteCheckedException {
+ if (spi instanceof IgniteSpiAdapter) {
+ Collection<Object> injectables = ((IgniteSpiAdapter)spi).injectables();
+
+ if (!F.isEmpty(injectables))
+ for (Object o : injectables)
+ ctx.resource().cleanupGeneric(o);
+ }
+ }
+
+ /**
+ * Starts wrapped SPI.
+ *
+ * @throws IgniteCheckedException If wrapped SPI could not be started.
+ */
+ protected final void startSpi() throws IgniteCheckedException {
+ Collection<String> names = U.newHashSet(spis.length);
+
+ for (T spi : spis) {
+ // Print-out all SPI parameters only in DEBUG mode.
+ if (log.isDebugEnabled())
+ log.debug("Starting SPI: " + spi);
+
+ if (names.contains(spi.getName()))
+ throw new IgniteCheckedException("Duplicate SPI name (need to explicitly configure 'setName()' property): " +
+ spi.getName());
+
+ names.add(spi.getName());
+
+ if (log.isDebugEnabled())
+ log.debug("Starting SPI implementation: " + spi.getClass().getName());
+
+ try {
+ spi.spiStart(ctx.gridName());
+ }
+ catch (IgniteSpiException e) {
+ throw new IgniteCheckedException("Failed to start SPI: " + spi, e);
+ }
+
+ if (log.isDebugEnabled())
+ log.debug("SPI module started OK: " + spi.getClass().getName());
+ }
+ }
+
+ /**
+ * Stops wrapped SPI.
+ *
+ * @throws IgniteCheckedException If underlying SPI could not be stopped.
+ */
+ protected final void stopSpi() throws IgniteCheckedException {
+ for (T spi : spis) {
+ if (log.isDebugEnabled())
+ log.debug("Stopping SPI: " + spi);
+
+ try {
+ spi.spiStop();
+
+ if (log.isDebugEnabled())
+ log.debug("SPI module stopped OK: " + spi.getClass().getName());
+ }
+ catch (IgniteSpiException e) {
+ throw new IgniteCheckedException("Failed to stop SPI: " + spi, e);
+ }
+
+ try {
+ cleanup(spi);
+
+ ctx.resource().cleanup(spi);
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to remove injected resources from SPI (ignoring): " + spi, e);
+ }
+ }
+ }
+
+ /**
+ * @return Uniformly formatted ack string.
+ */
+ protected final String startInfo() {
+ return "Manager started ok: " + getClass().getName();
+ }
+
+ /**
+ * @return Uniformly formatted ack string.
+ */
+ protected final String stopInfo() {
+ return "Manager stopped ok: " + getClass().getName();
+ }
+
+ /** {@inheritDoc} */
+ @Override public final void onKernalStart() throws IgniteCheckedException {
+ for (final IgniteSpi spi : spis) {
+ try {
+ spi.onContextInitialized(new IgniteSpiContext() {
+ @Override public Collection<ClusterNode> remoteNodes() {
+ return ctx.discovery().remoteNodes();
+ }
+
+ @Override public Collection<ClusterNode> nodes() {
+ return ctx.discovery().allNodes();
+ }
+
+ @Override public ClusterNode localNode() {
+ return ctx.discovery().localNode();
+ }
+
+ @Override public Collection<ClusterNode> remoteDaemonNodes() {
+ final Collection<ClusterNode> all = ctx.discovery().daemonNodes();
+
+ return !localNode().isDaemon() ?
+ all :
+ F.view(all, new IgnitePredicate<ClusterNode>() {
+ @Override public boolean apply(ClusterNode n) {
+ return n.isDaemon();
+ }
+ });
+ }
+
+ @Nullable @Override public ClusterNode node(UUID nodeId) {
+ A.notNull(nodeId, "nodeId");
+
+ return ctx.discovery().node(nodeId);
+ }
+
+ @Override public boolean pingNode(UUID nodeId) {
+ A.notNull(nodeId, "nodeId");
+
+ return ctx.discovery().pingNode(nodeId);
+ }
+
+ @Override public void send(ClusterNode node, Serializable msg, String topic)
+ throws IgniteSpiException {
+ A.notNull(node, "node");
+ A.notNull(msg, "msg");
+ A.notNull(topic, "topic");
+
+ try {
+ if (msg instanceof GridTcpCommunicationMessageAdapter)
+ ctx.io().send(node, topic, (GridTcpCommunicationMessageAdapter)msg, SYSTEM_POOL);
+ else
+ ctx.io().sendUserMessage(asList(node), msg, topic, false, 0);
+ }
+ catch (IgniteCheckedException e) {
+ throw unwrapException(e);
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override public void addMessageListener(GridMessageListener lsnr, String topic) {
+ A.notNull(lsnr, "lsnr");
+ A.notNull(topic, "topic");
+
+ ctx.io().addMessageListener(topic, lsnr);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override public boolean removeMessageListener(GridMessageListener lsnr, String topic) {
+ A.notNull(lsnr, "lsnr");
+ A.notNull(topic, "topic");
+
+ return ctx.io().removeMessageListener(topic, lsnr);
+ }
+
+ @Override public void addLocalEventListener(GridLocalEventListener lsnr, int... types) {
+ A.notNull(lsnr, "lsnr");
+
+ ctx.event().addLocalEventListener(lsnr, types);
+ }
+
+ @Override public boolean removeLocalEventListener(GridLocalEventListener lsnr) {
+ A.notNull(lsnr, "lsnr");
+
+ return ctx.event().removeLocalEventListener(lsnr);
+ }
+
+ @Override public boolean isEventRecordable(int... types) {
+ for (int t : types)
+ if (!ctx.event().isRecordable(t))
+ return false;
+
+ return true;
+ }
+
+ @Override public void recordEvent(IgniteEvent evt) {
+ A.notNull(evt, "evt");
+
+ if (ctx.event().isRecordable(evt.type()))
+ ctx.event().record(evt);
+ }
+
+ @Override public void registerPort(int port, IgnitePortProtocol proto) {
+ ctx.ports().registerPort(port, proto, spi.getClass());
+ }
+
+ @Override public void deregisterPort(int port, IgnitePortProtocol proto) {
+ ctx.ports().deregisterPort(port, proto, spi.getClass());
+ }
+
+ @Override public void deregisterPorts() {
+ ctx.ports().deregisterPorts(spi.getClass());
+ }
+
+ @Nullable @Override public <K, V> V get(String cacheName, K key) throws IgniteCheckedException {
+ return ctx.cache().<K, V>cache(cacheName).get(key);
+ }
+
+ @Nullable @Override public <K, V> V put(String cacheName, K key, V val, long ttl)
+ throws IgniteCheckedException {
+ if (ttl > 0) {
+ ExpiryPolicy plc = new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl));
+
+ IgniteCache<K, V> cache = ctx.cache().<K, V>publicJCache(cacheName).withExpiryPolicy(plc);
+
+ return cache.getAndPut(key, val);
+ }
+ else
+ return ctx.cache().<K, V>cache(cacheName).put(key, val);
+ }
+
+ @Nullable @Override public <K, V> V putIfAbsent(String cacheName, K key, V val, long ttl)
+ throws IgniteCheckedException {
+ if (ttl > 0) {
+ ExpiryPolicy plc = new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl));
+
+ IgniteCache<K, V> cache = ctx.cache().<K, V>publicJCache(cacheName).withExpiryPolicy(plc);
+
+ return cache.getAndPutIfAbsent(key, val);
+ }
+ else
+ return ctx.cache().<K, V>cache(cacheName).putIfAbsent(key, val);
+ }
+
+ @Nullable @Override public <K, V> V remove(String cacheName, K key) throws IgniteCheckedException {
+ return ctx.cache().<K, V>cache(cacheName).remove(key);
+ }
+
+ @Override public <K> boolean containsKey(String cacheName, K key) {
+ return ctx.cache().cache(cacheName).containsKey(key);
+ }
+
+ @Override public void writeToSwap(String spaceName, Object key, @Nullable Object val,
+ @Nullable ClassLoader ldr) throws IgniteCheckedException {
+ assert ctx.swap().enabled();
+
+ ctx.swap().write(spaceName, key, val, ldr);
+ }
+
+ @Nullable @Override public <T> T readFromOffheap(String spaceName, int part, Object key,
+ byte[] keyBytes, @Nullable ClassLoader ldr) throws IgniteCheckedException {
+ return ctx.offheap().getValue(spaceName, part, key, keyBytes, ldr);
+ }
+
+ @Override public boolean removeFromOffheap(@Nullable String spaceName, int part, Object key,
+ @Nullable byte[] keyBytes) throws IgniteCheckedException {
+ return ctx.offheap().removex(spaceName, part, key, keyBytes);
+ }
+
+ @Override public void writeToOffheap(@Nullable String spaceName, int part, Object key,
+ @Nullable byte[] keyBytes, Object val, @Nullable byte[] valBytes, @Nullable ClassLoader ldr)
+ throws IgniteCheckedException {
+ ctx.offheap().put(spaceName, part, key, keyBytes, valBytes != null ? valBytes :
+ ctx.config().getMarshaller().marshal(val));
+ }
+
+ @SuppressWarnings({"unchecked"})
+ @Nullable @Override public <T> T readFromSwap(String spaceName, SwapKey key,
+ @Nullable ClassLoader ldr) throws IgniteCheckedException {
+ assert ctx.swap().enabled();
+
+ return ctx.swap().readValue(spaceName, key, ldr);
+ }
+
+ @Override public int partition(String cacheName, Object key) {
+ return ctx.cache().cache(cacheName).affinity().partition(key);
+ }
+
+ @Override public void removeFromSwap(String spaceName, Object key,
+ @Nullable ClassLoader ldr) throws IgniteCheckedException {
+ assert ctx.swap().enabled();
+
+ ctx.swap().remove(spaceName, key, null, ldr);
+ }
+
+ @Override public IgniteSpiNodeValidationResult validateNode(ClusterNode node) {
+ for (GridComponent comp : ctx) {
+ IgniteSpiNodeValidationResult err = comp.validateNode(node);
+
+ if (err != null)
+ return err;
+ }
+
+ return null;
+ }
+
+ @Override public boolean writeDelta(UUID nodeId, Object msg, ByteBuffer buf) {
+ for (MessageCallback patcher : ctx.plugins().extensions(MessageCallback.class)) {
+ if (!patcher.onSend(nodeId, msg, buf))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override public boolean readDelta(UUID nodeId, Class<?> msgCls, ByteBuffer buf) {
+ for (MessageCallback patcher : ctx.plugins().extensions(MessageCallback.class)) {
+ if (!patcher.onReceive(nodeId, msgCls, buf))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override public Collection<GridSecuritySubject> authenticatedSubjects() throws IgniteCheckedException {
+ return ctx.grid().security().authenticatedSubjects();
+ }
+
+ @Override public GridSecuritySubject authenticatedSubject(UUID subjId) throws IgniteCheckedException {
+ return ctx.grid().security().authenticatedSubject(subjId);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Nullable @Override public <V> V readValueFromOffheapAndSwap(@Nullable String spaceName,
+ Object key, @Nullable ClassLoader ldr) throws IgniteCheckedException {
+ GridCache<Object, V> cache = ctx.cache().cache(spaceName);
+
+ GridCacheContext cctx = ((GridCacheProxyImpl)cache).context();
+
+ if (cctx.isNear())
+ cctx = cctx.near().dht().context();
+
+ GridCacheSwapEntry e = cctx.swap().read(key);
+
+ return e != null ? (V)e.value() : null;
+ }
+
- @Override public GridTcpMessageFactory messageFactory() {
- return ctx.messageFactory();
++ @Override public MessageFactory messageFactory() {
++ return ctx.io().messageFactory();
+ }
+
+ /**
+ * @param e Exception to handle.
+ * @return GridSpiException Converted exception.
+ */
+ private IgniteSpiException unwrapException(IgniteCheckedException e) {
+ // Avoid double-wrapping.
+ if (e.getCause() instanceof IgniteSpiException)
+ return (IgniteSpiException)e.getCause();
+
+ return new IgniteSpiException("Failed to execute SPI context method.", e);
+ }
+ });
+ }
+ catch (IgniteSpiException e) {
+ throw new IgniteCheckedException("Failed to initialize SPI context.", e);
+ }
+ }
+
+ onKernalStart0();
+ }
+
+ /** {@inheritDoc} */
+ @Override public final void onKernalStop(boolean cancel) {
+ onKernalStop0(cancel);
+
+ for (IgniteSpi spi : spis)
+ spi.onContextDestroyed();
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public Object collectDiscoveryData(UUID nodeId) {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onDiscoveryDataReceived(Object data) {
+ // No-op.
+ }
+
+ /**
+ * @throws IgniteCheckedException If failed.
+ */
+ protected void onKernalStart0() throws IgniteCheckedException {
+ // No-op.
+ }
+
+ /**
+ * @param cancel Cancel flag.
+ */
+ protected void onKernalStop0(boolean cancel) {
+ // No-op.
+ }
+
+ /**
+ * Throws exception with uniform error message if given parameter's assertion condition
+ * is {@code false}.
+ *
+ * @param cond Assertion condition to check.
+ * @param condDesc Description of failed condition. Note that this description should include
+ * JavaBean name of the property (<b>not</b> a variable name) as well condition in
+ * Java syntax like, for example:
+ * <pre name="code" class="java">
+ * ...
+ * assertParameter(dirPath != null, "dirPath != null");
+ * ...
+ * </pre>
+ * Note that in case when variable name is the same as JavaBean property you
+ * can just copy Java condition expression into description as a string.
+ * @throws IgniteCheckedException Thrown if given condition is {@code false}
+ */
+ protected final void assertParameter(boolean cond, String condDesc) throws IgniteCheckedException {
+ if (!cond)
+ throw new IgniteCheckedException("Grid configuration parameter failed condition check: " + condDesc);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void printMemoryStats() {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public IgniteSpiNodeValidationResult validateNode(ClusterNode node) {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public final String toString() {
+ return S.toString(GridManagerAdapter.class, this, "name", getClass().getName());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java
index 0000000,a5cdd2b..8cfecaa
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java
@@@ -1,0 -1,191 +1,185 @@@
+ /*
+ * 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.managers.checkpoint;
+
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * This class defines checkpoint request.
+ */
+ public class GridCheckpointRequest extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private IgniteUuid sesId;
+
+ /** */
+ private String key;
+
+ /** */
+ private String cpSpi;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridCheckpointRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param sesId Task session ID.
+ * @param key Checkpoint key.
+ * @param cpSpi Checkpoint SPI.
+ */
+ public GridCheckpointRequest(IgniteUuid sesId, String key, String cpSpi) {
+ assert sesId != null;
+ assert key != null;
+
+ this.sesId = sesId;
+ this.key = key;
+
+ this.cpSpi = cpSpi == null || cpSpi.isEmpty() ? null : cpSpi;
+ }
+
+ /**
+ * @return Session ID.
+ */
+ public IgniteUuid getSessionId() {
+ return sesId;
+ }
+
+ /**
+ * @return Checkpoint key.
+ */
+ public String getKey() {
+ return key;
+ }
+
+ /**
+ * @return Checkpoint SPI.
+ */
+ public String getCheckpointSpi() {
+ return cpSpi;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridCheckpointRequest _clone = new GridCheckpointRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridCheckpointRequest _clone = (GridCheckpointRequest)_msg;
+
+ _clone.sesId = sesId;
+ _clone.key = key;
+ _clone.cpSpi = cpSpi;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putString(cpSpi))
++ if (!commState.putString("cpSpi", cpSpi))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putString(key))
++ if (!commState.putString("key", key))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putGridUuid(sesId))
++ if (!commState.putGridUuid("sesId", sesId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- String cpSpi0 = commState.getString();
++ cpSpi = commState.getString("cpSpi");
+
- if (cpSpi0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- cpSpi = cpSpi0;
-
+ commState.idx++;
+
+ case 1:
- String key0 = commState.getString();
++ key = commState.getString("key");
+
- if (key0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- key = key0;
-
+ commState.idx++;
+
+ case 2:
- IgniteUuid sesId0 = commState.getGridUuid();
++ sesId = commState.getGridUuid("sesId");
+
- if (sesId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- sesId = sesId0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 7;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridCheckpointRequest.class, this);
+ }
+ }
[18/52] [abbrv] incubator-ignite git commit: ignite-146 changes to
flags
Posted by vk...@apache.org.
ignite-146 changes to flags
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7eebc7e0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7eebc7e0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7eebc7e0
Branch: refs/heads/ignite-61
Commit: 7eebc7e0878e7cb7687315e0bdc4467ec1bdc26d
Parents: 25fb8e5
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jan 29 15:56:51 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Thu Jan 29 17:22:35 2015 +0300
----------------------------------------------------------------------
.../processors/cache/IgniteCacheProxy.java | 22 +++++++++++++-------
.../service/GridServiceProcessor.java | 2 +-
.../GridCacheReturnValueTransferSelfTest.java | 2 +-
.../cache/IgniteCacheInvokeAbstractTest.java | 4 ++--
...GridCacheValueConsistencyAtomicSelfTest.java | 2 +-
.../cache/GridCacheCommandHandlerSelfTest.java | 4 ++--
6 files changed, 21 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7eebc7e0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 743e5b9..dd7b781 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -143,7 +143,7 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter<IgniteCach
/** {@inheritDoc} */
@Override public IgniteCache<K, V> withSkipStore() {
- return flagsOn(CacheFlag.SKIP_STORE);
+ return flagOn(CacheFlag.SKIP_STORE);
}
/** {@inheritDoc} */
@@ -1018,21 +1018,27 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter<IgniteCach
}
/**
- * @param flags Flags to turn on (if empty, then no-op).
+ * @param flag Flag to turn on.
* @return Cache with given flags enabled.
*/
- public IgniteCache<K, V> flagsOn(@Nullable CacheFlag... flags) {
+ public IgniteCache<K, V> flagOn(CacheFlag flag) {
GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
try {
- Set<CacheFlag> res = EnumSet.noneOf(CacheFlag.class);
+ Set<CacheFlag> res;
- Set<CacheFlag> flags0 = prj !=null ? prj.flags() : null;
+ Set<CacheFlag> flags0 = prj != null ? prj.flags() : null;
- if (flags0 != null && !flags0.isEmpty())
- res.addAll(flags0);
+ if (flags0 != null) {
+ if (flags0.contains(flag))
+ return this;
- res.addAll(EnumSet.copyOf(F.asList(flags)));
+ res = EnumSet.copyOf(flags0);
+ }
+ else
+ res = EnumSet.noneOf(CacheFlag.class);
+
+ res.add(flag);
GridCacheProjectionImpl<K, V> prj0 = new GridCacheProjectionImpl<>(
(prj != null ? prj : delegate),
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7eebc7e0/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index 8db40b9..4bcad37 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@ -481,7 +481,7 @@ public class GridServiceProcessor extends GridProcessorAdapter {
ManagedServiceDescriptorImpl desc = new ManagedServiceDescriptorImpl(dep);
try {
- GridServiceAssignments assigns = (GridServiceAssignments)cache.//flagsOn(CacheFlag.GET_PRIMARY).
+ GridServiceAssignments assigns = (GridServiceAssignments)cache.//flagOn(CacheFlag.GET_PRIMARY).
get(new GridServiceAssignmentsKey(dep.configuration().getName()));
if (assigns != null) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7eebc7e0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java
index 7657842..d70bc82 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java
@@ -141,7 +141,7 @@ public class GridCacheReturnValueTransferSelfTest extends GridCommonAbstractTest
IgniteCache<Integer, TestObject> cache = grid(2).jcache(null);
if (backups > 0 && atomicityMode == ATOMIC)
- cache = ((IgniteCacheProxy<Integer, TestObject>)cache).flagsOn(FORCE_TRANSFORM_BACKUP);
+ cache = ((IgniteCacheProxy<Integer, TestObject>)cache).flagOn(FORCE_TRANSFORM_BACKUP);
for (int i = 0; i < 100; i++)
cache.put(i, new TestObject());
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7eebc7e0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
index 784bd38..ca760e9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
@@ -57,7 +57,7 @@ public abstract class IgniteCacheInvokeAbstractTest extends IgniteCacheAbstractT
invoke(cache, OPTIMISTIC);
}
else if (gridCount() > 1) {
- cache = ((IgniteCacheProxy<Integer, Integer>)cache).flagsOn(FORCE_TRANSFORM_BACKUP);
+ cache = ((IgniteCacheProxy<Integer, Integer>)cache).flagOn(FORCE_TRANSFORM_BACKUP);
invoke(cache, null);
}
@@ -186,7 +186,7 @@ public abstract class IgniteCacheInvokeAbstractTest extends IgniteCacheAbstractT
invokeAll(cache, OPTIMISTIC);
}
else if (gridCount() > 1) {
- cache = ((IgniteCacheProxy<Integer, Integer>)cache).flagsOn(FORCE_TRANSFORM_BACKUP);
+ cache = ((IgniteCacheProxy<Integer, Integer>)cache).flagOn(FORCE_TRANSFORM_BACKUP);
invokeAll(cache, null);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7eebc7e0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
index 41fb81d..0ea0852 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
@@ -74,7 +74,7 @@ public class GridCacheValueConsistencyAtomicSelfTest extends GridCacheValueConsi
IgniteCache<Integer, Integer> cache = grid(idx).jcache(null);
- cache = ((IgniteCacheProxy<Integer, Integer>)cache).flagsOn(FORCE_TRANSFORM_BACKUP);
+ cache = ((IgniteCacheProxy<Integer, Integer>)cache).flagOn(FORCE_TRANSFORM_BACKUP);
cache.invoke(i, new Transformer(i));
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7eebc7e0/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java
index d36726c..7a1765b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java
@@ -248,8 +248,8 @@ public class GridCacheCommandHandlerSelfTest extends GridCommonAbstractTest {
return fut;
}
- // Rewriting flagsOn result to keep intercepting invocations after it.
- else if ("flagsOn".equals(mtd.getName()))
+ // Rewriting flagOn result to keep intercepting invocations after it.
+ else if ("flagOn".equals(mtd.getName()))
return proxy;
else if ("forSubjectId".equals(mtd.getName()))
return proxy;
[07/52] [abbrv] incubator-ignite git commit: #Tests: fix
ignite-readme.pdf
Posted by vk...@apache.org.
#Tests: fix ignite-readme.pdf
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/45353228
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/45353228
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/45353228
Branch: refs/heads/ignite-61
Commit: 45353228310224dbf4f86fb7b278e315b87bd0b2
Parents: d5bef13
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jan 29 12:49:22 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jan 29 12:49:22 2015 +0300
----------------------------------------------------------------------
assembly/release-base-fabric.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/45353228/assembly/release-base-fabric.xml
----------------------------------------------------------------------
diff --git a/assembly/release-base-fabric.xml b/assembly/release-base-fabric.xml
index a13c6dc..bd70839 100644
--- a/assembly/release-base-fabric.xml
+++ b/assembly/release-base-fabric.xml
@@ -29,7 +29,7 @@
</file>
<file>
- <source>docs/gridgain_readme.pdf</source>
+ <source>docs/ignite_readme.pdf</source>
<outputDirectory>/docs</outputDirectory>
</file>
</files>
[19/52] [abbrv] incubator-ignite git commit: Fix IgniteCacheIterator
Posted by vk...@apache.org.
Fix IgniteCacheIterator
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9900ae49
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9900ae49
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9900ae49
Branch: refs/heads/ignite-61
Commit: 9900ae49ba2b839eb3c549bb95cdf397743a8303
Parents: 4535322
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jan 29 18:14:08 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jan 29 18:14:08 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheAdapter.java | 16 ++-----
.../processors/cache/IgniteCacheProxy.java | 2 +-
.../GridCacheAbstractProjectionSelfTest.java | 50 ++++++++++++++++++++
3 files changed, 54 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9900ae49/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 92d2039..1c04d29 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -3887,10 +3887,10 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
}
/**
- * @param prj Projection.
+ * @param delegate Cache proxy.
* @return Distributed ignite cache iterator.
*/
- public Iterator<Cache.Entry<K, V>> igniteIterator(final GridCacheProjectionImpl<K, V> prj) {
+ public Iterator<Cache.Entry<K, V>> igniteIterator(final IgniteCacheProxy<K, V> delegate) {
CacheQueryFuture<Map.Entry<K, V>> fut = queries().createScanQuery(null)
.keepAll(false)
.execute();
@@ -3901,17 +3901,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
}
@Override protected void remove(Cache.Entry<K, V> item) {
- GridCacheProjectionImpl<K, V> prev = ctx.gate().enter(prj);
-
- try {
- GridCacheAdapter.this.removex(item.getKey());
- }
- catch (IgniteCheckedException e) {
- throw new CacheException(e);
- }
- finally {
- ctx.gate().leave(prev);
- }
+ delegate.remove(item.getKey());
}
});
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9900ae49/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 743e5b9..0bb2543 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -943,7 +943,7 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter<IgniteCach
GridCacheProjectionImpl<K, V> prev = gate.enter(prj);
try {
- return ((GridCacheAdapter)delegate).igniteIterator(prj);
+ return ctx.cache().igniteIterator(this);
}
finally {
gate.leave(prev);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9900ae49/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractProjectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractProjectionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractProjectionSelfTest.java
index 6337339..acdeede 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractProjectionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractProjectionSelfTest.java
@@ -617,6 +617,56 @@ public abstract class GridCacheAbstractProjectionSelfTest extends GridCacheAbstr
/**
* @throws Exception if failed.
*/
+ public void testSkipStoreIterator() throws Exception {
+ assertNull(cache().put("1", 100500));
+
+ IgniteCache<String, Integer> c = jcache().withSkipStore();
+
+ Iterator i = c.iterator();
+
+ assertTrue(i.hasNext());
+
+ i.next();
+
+ i.remove();
+
+ i = c.iterator();
+
+ assertFalse(i.hasNext());
+
+ assertNull(c.get("1"));
+
+ assertEquals(100500, map.get("1"));
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ public void testNotSkipStoreIterator() throws Exception {
+ assertNull(cache().put("1", 100500));
+
+ IgniteCache<String, Integer> c = jcache();
+
+ Iterator i = c.iterator();
+
+ assertTrue(i.hasNext());
+
+ i.next();
+
+ i.remove();
+
+ i = c.iterator();
+
+ assertFalse(i.hasNext());
+
+ assertNull(c.get("1"));
+
+ assertNull(map.get("1"));
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
// TODO: enable when GG-7579 is fixed.
public void _testSkipStoreFlagMultinode() throws Exception {
final int nGrids = 3;
[37/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
index 0000000,9833165..77dd8f6
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
@@@ -1,0 -1,423 +1,413 @@@
+ /*
+ * 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.cache.distributed.near;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Get response.
+ */
+ public class GridNearGetResponse<K, V> extends GridCacheMessage<K, V> implements GridCacheDeployable,
+ GridCacheVersionable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /** Sub ID. */
+ private IgniteUuid miniId;
+
+ /** Version. */
+ private GridCacheVersion ver;
+
+ /** Result. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<GridCacheEntryInfo<K, V>> entries;
+
+ /** */
+ private byte[] entriesBytes;
+
+ /** Keys to retry due to ownership shift. */
+ @GridToStringInclude
+ @GridDirectCollection(int.class)
+ private Collection<Integer> invalidParts = new GridLeanSet<>();
+
+ /** Topology version if invalid partitions is not empty. */
+ private long topVer;
+
+ /** Error. */
+ @GridDirectTransient
+ private Throwable err;
+
+ /** Serialized error. */
+ private byte[] errBytes;
+
+ /**
+ * Empty constructor required for {@link Externalizable}.
+ */
+ public GridNearGetResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param futId Future ID.
+ * @param miniId Sub ID.
+ * @param ver Version.
+ */
+ public GridNearGetResponse(
+ int cacheId,
+ IgniteUuid futId,
+ IgniteUuid miniId,
+ GridCacheVersion ver
+ ) {
+ assert futId != null;
+ assert miniId != null;
+ assert ver != null;
+
+ this.cacheId = cacheId;
+ this.futId = futId;
+ this.miniId = miniId;
+ this.ver = ver;
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Sub ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridCacheVersion version() {
+ return ver;
+ }
+
+ /**
+ * @return Entries.
+ */
+ public Collection<GridCacheEntryInfo<K, V>> entries() {
+ return entries;
+ }
+
+ /**
+ * @param entries Entries.
+ */
+ public void entries(Collection<GridCacheEntryInfo<K, V>> entries) {
+ this.entries = entries;
+ }
+
+ /**
+ * @return Failed filter set.
+ */
+ public Collection<Integer> invalidPartitions() {
+ return invalidParts;
+ }
+
+ /**
+ * @param invalidParts Partitions to retry due to ownership shift.
+ * @param topVer Topology version.
+ */
+ public void invalidPartitions(Collection<Integer> invalidParts, long topVer) {
+ this.invalidParts = invalidParts;
+ this.topVer = topVer;
+ }
+
+ /**
+ * @return Topology version if this response has invalid partitions.
+ */
+ @Override public long topologyVersion() {
+ return topVer;
+ }
+
+ /**
+ * @return Error.
+ */
+ public Throwable error() {
+ return err;
+ }
+
+ /**
+ * @param err Error.
+ */
+ public void error(Throwable err) {
+ this.err = err;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (entries != null) {
+ marshalInfos(entries, ctx);
+
+ entriesBytes = ctx.marshaller().marshal(entries);
+ }
+
+ if (err != null)
+ errBytes = ctx.marshaller().marshal(err);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (entriesBytes != null) {
+ entries = ctx.marshaller().unmarshal(entriesBytes, ldr);
+
+ unmarshalInfos(entries, ctx.cacheContext(cacheId()), ldr);
+ }
+
+ if (errBytes != null)
+ err = ctx.marshaller().unmarshal(errBytes, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridNearGetResponse _clone = new GridNearGetResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridNearGetResponse _clone = (GridNearGetResponse)_msg;
+
+ _clone.futId = futId;
+ _clone.miniId = miniId;
+ _clone.ver = ver;
+ _clone.entries = entries;
+ _clone.entriesBytes = entriesBytes;
+ _clone.invalidParts = invalidParts;
+ _clone.topVer = topVer;
+ _clone.err = err;
+ _clone.errBytes = errBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
- if (!commState.putByteArray(entriesBytes))
++ if (!commState.putByteArray("entriesBytes", entriesBytes))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putByteArray(errBytes))
++ if (!commState.putByteArray("errBytes", errBytes))
+ return false;
+
+ commState.idx++;
+
+ case 5:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 6:
+ if (invalidParts != null) {
+ if (commState.it == null) {
- if (!commState.putInt(invalidParts.size()))
++ if (!commState.putInt(null, invalidParts.size()))
+ return false;
+
+ commState.it = invalidParts.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putInt((int)commState.cur))
++ if (!commState.putInt(null, (int)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 7:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 8:
- if (!commState.putLong(topVer))
++ if (!commState.putLong("topVer", topVer))
+ return false;
+
+ commState.idx++;
+
+ case 9:
- if (!commState.putCacheVersion(ver))
++ if (!commState.putCacheVersion("ver", ver))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
- byte[] entriesBytes0 = commState.getByteArray();
++ entriesBytes = commState.getByteArray("entriesBytes");
+
- if (entriesBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- entriesBytes = entriesBytes0;
-
+ commState.idx++;
+
+ case 4:
- byte[] errBytes0 = commState.getByteArray();
++ errBytes = commState.getByteArray("errBytes");
+
- if (errBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- errBytes = errBytes0;
-
+ commState.idx++;
+
+ case 5:
- IgniteUuid futId0 = commState.getGridUuid();
++ futId = commState.getGridUuid("futId");
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ case 6:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (invalidParts == null)
+ invalidParts = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- if (buf.remaining() < 4)
- return false;
++ int _val = commState.getInt(null);
+
- int _val = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ invalidParts.add((Integer)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 7:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 8:
- if (buf.remaining() < 8)
- return false;
++ topVer = commState.getLong("topVer");
+
- topVer = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 9:
- GridCacheVersion ver0 = commState.getCacheVersion();
++ ver = commState.getCacheVersion("ver");
+
- if (ver0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- ver = ver0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 49;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridNearGetResponse.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
index 0000000,601bd82..2d8e08f
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
@@@ -1,0 -1,667 +1,666 @@@
+ /*
+ * 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.cache.distributed.near;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.cache.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.transactions.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Near cache lock request.
+ */
+ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Topology version. */
+ private long topVer;
+
+ /** Mini future ID. */
+ private IgniteUuid miniId;
+
+ /** Filter. */
+ private byte[][] filterBytes;
+
+ /** Filter. */
+ @GridDirectTransient
+ private IgnitePredicate<CacheEntry<K, V>>[] filter;
+
+ /** Implicit flag. */
+ private boolean implicitTx;
+
+ /** Implicit transaction with one key flag. */
+ private boolean implicitSingleTx;
+
+ /** One phase commit flag. */
+ private boolean onePhaseCommit;
+
+ /** Array of mapped DHT versions for this entry. */
+ @GridToStringInclude
+ private GridCacheVersion[] dhtVers;
+
+ /** Subject ID. */
+ @GridDirectVersion(1)
+ private UUID subjId;
+
+ /** Task name hash. */
+ @GridDirectVersion(2)
+ private int taskNameHash;
+
+ /** Has transforms flag. */
+ @GridDirectVersion(3)
+ private boolean hasTransforms;
+
+ /** Sync commit flag. */
+ private boolean syncCommit;
+
+ /** TTL for read operation. */
+ private long accessTtl;
+
+ /**
+ * Empty constructor required for {@link Externalizable}.
+ */
+ public GridNearLockRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param topVer Topology version.
+ * @param nodeId Node ID.
+ * @param threadId Thread ID.
+ * @param futId Future ID.
+ * @param lockVer Cache version.
+ * @param isInTx {@code True} if implicit transaction lock.
+ * @param implicitTx Flag to indicate that transaction is implicit.
+ * @param implicitSingleTx Implicit-transaction-with-one-key flag.
+ * @param isRead Indicates whether implicit lock is for read or write operation.
+ * @param isolation Transaction isolation.
+ * @param isInvalidate Invalidation flag.
+ * @param timeout Lock timeout.
+ * @param keyCnt Number of keys.
+ * @param txSize Expected transaction size.
+ * @param syncCommit Synchronous commit flag.
+ * @param grpLockKey Group lock key if this is a group-lock transaction.
+ * @param partLock If partition is locked.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash code.
+ * @param accessTtl TTL for read operation.
+ */
+ public GridNearLockRequest(
+ int cacheId,
+ long topVer,
+ UUID nodeId,
+ long threadId,
+ IgniteUuid futId,
+ GridCacheVersion lockVer,
+ boolean isInTx,
+ boolean implicitTx,
+ boolean implicitSingleTx,
+ boolean isRead,
+ IgniteTxIsolation isolation,
+ boolean isInvalidate,
+ long timeout,
+ int keyCnt,
+ int txSize,
+ boolean syncCommit,
+ @Nullable IgniteTxKey grpLockKey,
+ boolean partLock,
+ @Nullable UUID subjId,
+ int taskNameHash,
+ long accessTtl
+ ) {
+ super(
+ cacheId,
+ nodeId,
+ lockVer,
+ threadId,
+ futId,
+ lockVer,
+ isInTx,
+ isRead,
+ isolation,
+ isInvalidate,
+ timeout,
+ keyCnt,
+ txSize,
+ grpLockKey,
+ partLock);
+
+ assert topVer > 0;
+
+ this.topVer = topVer;
+ this.implicitTx = implicitTx;
+ this.implicitSingleTx = implicitSingleTx;
+ this.syncCommit = syncCommit;
+ this.subjId = subjId;
+ this.taskNameHash = taskNameHash;
+ this.accessTtl = accessTtl;
+
+ dhtVers = new GridCacheVersion[keyCnt];
+ }
+
+ /**
+ * @return Topology version.
+ */
+ @Override public long topologyVersion() {
+ return topVer;
+ }
+
+ /**
+ * @return Subject ID.
+ */
+ public UUID subjectId() {
+ return subjId;
+ }
+
+ /**
+ * @return Task name hash.q
+ */
+ public int taskNameHash() {
+ return taskNameHash;
+ }
+
+ /**
+ * @return Implicit transaction flag.
+ */
+ public boolean implicitTx() {
+ return implicitTx;
+ }
+
+ /**
+ * @return Implicit-transaction-with-one-key flag.
+ */
+ public boolean implicitSingleTx() {
+ return implicitSingleTx;
+ }
+
+ /**
+ * @return One phase commit flag.
+ */
+ public boolean onePhaseCommit() {
+ return onePhaseCommit;
+ }
+
+ /**
+ * @param onePhaseCommit One phase commit flag.
+ */
+ public void onePhaseCommit(boolean onePhaseCommit) {
+ this.onePhaseCommit = onePhaseCommit;
+ }
+
+ /**
+ * @return Sync commit flag.
+ */
+ public boolean syncCommit() {
+ return syncCommit;
+ }
+
+ /**
+ * @return Filter.
+ */
+ public IgnitePredicate<CacheEntry<K, V>>[] filter() {
+ return filter;
+ }
+
+ /**
+ * @param filter Filter.
+ * @param ctx Context.
+ * @throws IgniteCheckedException If failed.
+ */
+ public void filter(IgnitePredicate<CacheEntry<K, V>>[] filter, GridCacheContext<K, V> ctx)
+ throws IgniteCheckedException {
+ this.filter = filter;
+ }
+
+ /**
+ * @return Mini future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @param miniId Mini future Id.
+ */
+ public void miniId(IgniteUuid miniId) {
+ this.miniId = miniId;
+ }
+
+ /**
+ * @param hasTransforms {@code True} if originating transaction has transform entries.
+ */
+ public void hasTransforms(boolean hasTransforms) {
+ this.hasTransforms = hasTransforms;
+ }
+
+ /**
+ * @return {@code True} if originating transaction has transform entries.
+ */
+ public boolean hasTransforms() {
+ return hasTransforms;
+ }
+
+ /**
+ * Adds a key.
+ *
+ * @param key Key.
+ * @param retVal Flag indicating whether value should be returned.
+ * @param keyBytes Key bytes.
+ * @param dhtVer DHT version.
+ * @param writeEntry Write entry if implicit transaction mapped on one node.
+ * @param drVer DR version.
+ * @param ctx Context.
+ * @throws IgniteCheckedException If failed.
+ */
+ public void addKeyBytes(
+ K key,
+ byte[] keyBytes,
+ boolean retVal,
+ @Nullable GridCacheVersion dhtVer,
+ @Nullable IgniteTxEntry<K, V> writeEntry,
+ @Nullable GridCacheVersion drVer,
+ GridCacheContext<K, V> ctx
+ ) throws IgniteCheckedException {
+ dhtVers[idx] = dhtVer;
+
+ // Delegate to super.
+ addKeyBytes(key, keyBytes, writeEntry, retVal, null, drVer, ctx);
+ }
+
+ /**
+ * @param idx Index of the key.
+ * @return DHT version for key at given index.
+ */
+ public GridCacheVersion dhtVersion(int idx) {
+ return dhtVers[idx];
+ }
+
+ /** {@inheritDoc} */
+ @Override protected boolean transferExpiryPolicy() {
+ return true;
+ }
+
+ /**
+ * @return TTL for read operation.
+ */
+ public long accessTtl() {
+ return accessTtl;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (filterBytes == null)
+ filterBytes = marshalFilter(filter, ctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (filter == null && filterBytes != null)
+ filter = unmarshalFilter(filterBytes, ctx, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridNearLockRequest _clone = new GridNearLockRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridNearLockRequest _clone = (GridNearLockRequest)_msg;
+
+ _clone.topVer = topVer;
+ _clone.miniId = miniId;
+ _clone.filterBytes = filterBytes;
+ _clone.filter = filter;
+ _clone.implicitTx = implicitTx;
+ _clone.implicitSingleTx = implicitSingleTx;
+ _clone.onePhaseCommit = onePhaseCommit;
+ _clone.dhtVers = dhtVers;
+ _clone.subjId = subjId;
+ _clone.taskNameHash = taskNameHash;
+ _clone.hasTransforms = hasTransforms;
+ _clone.syncCommit = syncCommit;
+ _clone.accessTtl = accessTtl;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 24:
+ if (dhtVers != null) {
+ if (commState.it == null) {
- if (!commState.putInt(dhtVers.length))
++ if (!commState.putInt(null, dhtVers.length))
+ return false;
+
+ commState.it = arrayIterator(dhtVers);
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putCacheVersion((GridCacheVersion)commState.cur))
++ if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 25:
+ if (filterBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(filterBytes.length))
++ if (!commState.putInt(null, filterBytes.length))
+ return false;
+
+ commState.it = arrayIterator(filterBytes);
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 26:
- if (!commState.putBoolean(implicitSingleTx))
++ if (!commState.putBoolean("implicitSingleTx", implicitSingleTx))
+ return false;
+
+ commState.idx++;
+
+ case 27:
- if (!commState.putBoolean(implicitTx))
++ if (!commState.putBoolean("implicitTx", implicitTx))
+ return false;
+
+ commState.idx++;
+
+ case 28:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 29:
- if (!commState.putBoolean(onePhaseCommit))
++ if (!commState.putBoolean("onePhaseCommit", onePhaseCommit))
+ return false;
+
+ commState.idx++;
+
+ case 30:
- if (!commState.putLong(topVer))
++ if (!commState.putBoolean("syncCommit", syncCommit))
+ return false;
+
+ commState.idx++;
+
+ case 31:
- if (!commState.putUuid(subjId))
++ if (!commState.putLong("topVer", topVer))
+ return false;
+
+ commState.idx++;
+
+ case 32:
- if (!commState.putInt(taskNameHash))
++ if (!commState.putUuid("subjId", subjId))
+ return false;
+
+ commState.idx++;
+
+ case 33:
- if (!commState.putBoolean(hasTransforms))
++ if (!commState.putInt("taskNameHash", taskNameHash))
+ return false;
+
+ commState.idx++;
+
+ case 34:
- if (!commState.putBoolean(syncCommit))
++ if (!commState.putBoolean("hasTransforms", hasTransforms))
+ return false;
+
+ commState.idx++;
+
+ case 35:
- if (!commState.putLong(accessTtl))
++ if (!commState.putLong("accessTtl", accessTtl))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 24:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (dhtVers == null)
+ dhtVers = new GridCacheVersion[commState.readSize];
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheVersion _val = commState.getCacheVersion();
++ GridCacheVersion _val = commState.getCacheVersion(null);
+
- if (_val == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ dhtVers[i] = (GridCacheVersion)_val;
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 25:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (filterBytes == null)
+ filterBytes = new byte[commState.readSize][];
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ filterBytes[i] = (byte[])_val;
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 26:
- if (buf.remaining() < 1)
- return false;
++ implicitSingleTx = commState.getBoolean("implicitSingleTx");
+
- implicitSingleTx = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 27:
- if (buf.remaining() < 1)
- return false;
++ implicitTx = commState.getBoolean("implicitTx");
+
- implicitTx = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 28:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 29:
- if (buf.remaining() < 1)
- return false;
++ onePhaseCommit = commState.getBoolean("onePhaseCommit");
+
- onePhaseCommit = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 30:
- if (buf.remaining() < 8)
- return false;
++ syncCommit = commState.getBoolean("syncCommit");
+
- topVer = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 31:
- UUID subjId0 = commState.getUuid();
++ topVer = commState.getLong("topVer");
+
- if (subjId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- subjId = subjId0;
-
+ commState.idx++;
+
+ case 32:
- if (buf.remaining() < 4)
- return false;
++ subjId = commState.getUuid("subjId");
+
- taskNameHash = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 33:
- if (buf.remaining() < 1)
- return false;
++ taskNameHash = commState.getInt("taskNameHash");
+
- hasTransforms = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 34:
- if (buf.remaining() < 1)
++ hasTransforms = commState.getBoolean("hasTransforms");
++
++ if (!commState.lastRead())
+ return false;
+
- syncCommit = commState.getBoolean();
++ syncCommit = commState.getBoolean(null);
+
+ commState.idx++;
+
+ case 35:
+ if (buf.remaining() < 8)
+ return false;
+
- accessTtl = commState.getLong();
++ accessTtl = commState.getLong(null);
+
+ commState.idx++;
++
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 50;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridNearLockRequest.class, this, "filter", Arrays.toString(filter),
+ "super", super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
index 0000000,392b19c..98cbe8e
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
@@@ -1,0 -1,450 +1,446 @@@
+ /*
+ * 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.cache.distributed.near;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Near cache lock response.
+ */
+ public class GridNearLockResponse<K, V> extends GridDistributedLockResponse<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Collection of versions that are pending and less than lock version. */
+ @GridToStringInclude
+ @GridDirectCollection(GridCacheVersion.class)
+ private Collection<GridCacheVersion> pending;
+
+ /** */
+ private IgniteUuid miniId;
+
+ /** DHT versions. */
+ @GridToStringInclude
+ private GridCacheVersion[] dhtVers;
+
+ /** DHT candidate versions. */
+ @GridToStringInclude
+ private GridCacheVersion[] mappedVers;
+
+ /** Filter evaluation results for fast-commit transactions. */
+ private boolean[] filterRes;
+
+ /**
+ * Empty constructor (required by {@link Externalizable}).
+ */
+ public GridNearLockResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param lockVer Lock ID.
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ * @param filterRes {@code True} if need to allocate array for filter evaluation results.
+ * @param cnt Count.
+ * @param err Error.
+ */
+ public GridNearLockResponse(
+ int cacheId,
+ GridCacheVersion lockVer,
+ IgniteUuid futId,
+ IgniteUuid miniId,
+ boolean filterRes,
+ int cnt,
+ Throwable err
+ ) {
+ super(cacheId, lockVer, futId, cnt, err);
+
+ assert miniId != null;
+
+ this.miniId = miniId;
+
+ dhtVers = new GridCacheVersion[cnt];
+ mappedVers = new GridCacheVersion[cnt];
+
+ if (filterRes)
+ this.filterRes = new boolean[cnt];
+ }
+
+ /**
+ * Gets pending versions that are less than {@link #version()}.
+ *
+ * @return Pending versions.
+ */
+ public Collection<GridCacheVersion> pending() {
+ return pending;
+ }
+
+ /**
+ * Sets pending versions that are less than {@link #version()}.
+ *
+ * @param pending Pending versions.
+ */
+ public void pending(Collection<GridCacheVersion> pending) {
+ this.pending = pending;
+ }
+
+ /**
+ * @return Mini future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @param idx Index.
+ * @return DHT version.
+ */
+ public GridCacheVersion dhtVersion(int idx) {
+ return dhtVers == null ? null : dhtVers[idx];
+ }
+
+ /**
+ * Returns DHT candidate version for acquired near lock on DHT node.
+ *
+ * @param idx Key index.
+ * @return DHT version.
+ */
+ public GridCacheVersion mappedVersion(int idx) {
+ return mappedVers == null ? null : mappedVers[idx];
+ }
+
+ /**
+ * Gets filter evaluation result for fast-commit transaction.
+ *
+ * @param idx Result index.
+ * @return {@code True} if filter passed on primary node, {@code false} otherwise.
+ */
+ public boolean filterResult(int idx) {
+ assert filterRes != null : "Should not call filterResult for non-fast-commit transactions.";
+
+ return filterRes[idx];
+ }
+
+ /**
+ * @param val Value.
+ * @param valBytes Value bytes (possibly {@code null}).
+ * @param filterPassed Boolean flag indicating whether filter passed for fast-commit transaction.
+ * @param dhtVer DHT version.
+ * @param mappedVer Mapped version.
+ * @param ctx Context.
+ * @throws IgniteCheckedException If failed.
+ */
+ public void addValueBytes(
+ @Nullable V val,
+ @Nullable byte[] valBytes,
+ boolean filterPassed,
+ @Nullable GridCacheVersion dhtVer,
+ @Nullable GridCacheVersion mappedVer,
+ GridCacheContext<K, V> ctx
+ ) throws IgniteCheckedException {
+ int idx = valuesSize();
+
+ dhtVers[idx] = dhtVer;
+ mappedVers[idx] = mappedVer;
+
+ if (filterRes != null)
+ filterRes[idx] = filterPassed;
+
+ // Delegate to super.
+ addValueBytes(val, valBytes, ctx);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridNearLockResponse _clone = new GridNearLockResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridNearLockResponse _clone = (GridNearLockResponse)_msg;
+
+ _clone.pending = pending;
+ _clone.miniId = miniId;
+ _clone.dhtVers = dhtVers;
+ _clone.mappedVers = mappedVers;
+ _clone.filterRes = filterRes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 11:
+ if (dhtVers != null) {
+ if (commState.it == null) {
- if (!commState.putInt(dhtVers.length))
++ if (!commState.putInt(null, dhtVers.length))
+ return false;
+
+ commState.it = arrayIterator(dhtVers);
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putCacheVersion((GridCacheVersion)commState.cur))
++ if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 12:
- if (!commState.putBooleanArray(filterRes))
++ if (!commState.putBooleanArray("filterRes", filterRes))
+ return false;
+
+ commState.idx++;
+
+ case 13:
+ if (mappedVers != null) {
+ if (commState.it == null) {
- if (!commState.putInt(mappedVers.length))
++ if (!commState.putInt(null, mappedVers.length))
+ return false;
+
+ commState.it = arrayIterator(mappedVers);
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putCacheVersion((GridCacheVersion)commState.cur))
++ if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 14:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 15:
+ if (pending != null) {
+ if (commState.it == null) {
- if (!commState.putInt(pending.size()))
++ if (!commState.putInt(null, pending.size()))
+ return false;
+
+ commState.it = pending.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putCacheVersion((GridCacheVersion)commState.cur))
++ if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 11:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (dhtVers == null)
+ dhtVers = new GridCacheVersion[commState.readSize];
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheVersion _val = commState.getCacheVersion();
++ GridCacheVersion _val = commState.getCacheVersion(null);
+
- if (_val == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ dhtVers[i] = (GridCacheVersion)_val;
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 12:
- boolean[] filterRes0 = commState.getBooleanArray();
++ filterRes = commState.getBooleanArray("filterRes");
+
- if (filterRes0 == BOOLEAN_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- filterRes = filterRes0;
-
+ commState.idx++;
+
+ case 13:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (mappedVers == null)
+ mappedVers = new GridCacheVersion[commState.readSize];
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheVersion _val = commState.getCacheVersion();
++ GridCacheVersion _val = commState.getCacheVersion(null);
+
- if (_val == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ mappedVers[i] = (GridCacheVersion)_val;
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 14:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 15:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (pending == null)
+ pending = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheVersion _val = commState.getCacheVersion();
++ GridCacheVersion _val = commState.getCacheVersion(null);
+
- if (_val == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ pending.add((GridCacheVersion)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 51;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridNearLockResponse.class, this, super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
index 0000000,2e63a8c..f4cb518
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
@@@ -1,0 -1,317 +1,315 @@@
+ /*
+ * 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.cache.distributed.near;
+
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Near transaction finish request.
+ */
+ public class GridNearTxFinishRequest<K, V> extends GridDistributedTxFinishRequest<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Mini future ID. */
+ private IgniteUuid miniId;
+
+ /** Explicit lock flag. */
+ private boolean explicitLock;
+
+ /** Store enabled flag. */
+ private boolean storeEnabled;
+
+ /** Topology version. */
+ private long topVer;
+
+ /** Subject ID. */
+ @GridDirectVersion(1)
+ private UUID subjId;
+
+ /** Task name hash. */
+ @GridDirectVersion(2)
+ private int taskNameHash;
+
+ /**
+ * Empty constructor required for {@link Externalizable}.
+ */
+ public GridNearTxFinishRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param futId Future ID.
+ * @param xidVer Transaction ID.
+ * @param threadId Thread ID.
+ * @param commit Commit flag.
+ * @param invalidate Invalidate flag.
+ * @param sys System flag.
+ * @param explicitLock Explicit lock flag.
+ * @param storeEnabled Store enabled flag.
+ * @param topVer Topology version.
+ * @param baseVer Base version.
+ * @param committedVers Committed versions.
+ * @param rolledbackVers Rolled back versions.
+ * @param txSize Expected transaction size.
+ * @param writeEntries Write entries.
+ * @param recoverEntries Recover entries.
+ */
+ public GridNearTxFinishRequest(
+ IgniteUuid futId,
+ GridCacheVersion xidVer,
+ long threadId,
+ boolean commit,
+ boolean invalidate,
+ boolean sys,
+ boolean syncCommit,
+ boolean syncRollback,
+ boolean explicitLock,
+ boolean storeEnabled,
+ long topVer,
+ GridCacheVersion baseVer,
+ Collection<GridCacheVersion> committedVers,
+ Collection<GridCacheVersion> rolledbackVers,
+ int txSize,
+ Collection<IgniteTxEntry<K, V>> writeEntries,
+ Collection<IgniteTxEntry<K, V>> recoverEntries,
+ @Nullable UUID subjId,
+ int taskNameHash) {
+ super(xidVer, futId, null, threadId, commit, invalidate, sys, syncCommit, syncRollback, baseVer, committedVers,
+ rolledbackVers, txSize, writeEntries, recoverEntries, null);
+
+ this.explicitLock = explicitLock;
+ this.storeEnabled = storeEnabled;
+ this.topVer = topVer;
+ this.subjId = subjId;
+ this.taskNameHash = taskNameHash;
+ }
+
+ /**
+ * @return Explicit lock flag.
+ */
+ public boolean explicitLock() {
+ return explicitLock;
+ }
+
+ /**
+ * @return Store enabled flag.
+ */
+ public boolean storeEnabled() {
+ return storeEnabled;
+ }
+
+ /**
+ * @return Mini future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @param miniId Mini future ID.
+ */
+ public void miniId(IgniteUuid miniId) {
+ this.miniId = miniId;
+ }
+
+ /**
+ * @return Subject ID.
+ */
+ @Nullable public UUID subjectId() {
+ return subjId;
+ }
+
+ /**
+ * @return Task name hash.
+ */
+ public int taskNameHash() {
+ return taskNameHash;
+ }
+
+ /**
+ * @return Topology version.
+ */
+ @Override public long topologyVersion() {
+ return topVer;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridNearTxFinishRequest _clone = new GridNearTxFinishRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridNearTxFinishRequest _clone = (GridNearTxFinishRequest)_msg;
+
+ _clone.miniId = miniId;
+ _clone.explicitLock = explicitLock;
+ _clone.storeEnabled = storeEnabled;
+ _clone.topVer = topVer;
+ _clone.subjId = subjId;
+ _clone.taskNameHash = taskNameHash;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 21:
- if (!commState.putBoolean(explicitLock))
++ if (!commState.putBoolean("explicitLock", explicitLock))
+ return false;
+
+ commState.idx++;
+
+ case 22:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 23:
- if (!commState.putLong(topVer))
++ if (!commState.putBoolean("storeEnabled", storeEnabled))
+ return false;
+
+ commState.idx++;
+
+ case 24:
- if (!commState.putUuid(subjId))
++ if (!commState.putLong("topVer", topVer))
+ return false;
+
+ commState.idx++;
+
+ case 25:
- if (!commState.putInt(taskNameHash))
++ if (!commState.putUuid("subjId", subjId))
+ return false;
+
+ commState.idx++;
+
+ case 26:
- if (!commState.putBoolean(storeEnabled))
++ if (!commState.putInt("taskNameHash", taskNameHash))
+ return false;
+
+ commState.idx++;
++
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 21:
- if (buf.remaining() < 1)
- return false;
++ explicitLock = commState.getBoolean("explicitLock");
+
- explicitLock = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 22:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 23:
- if (buf.remaining() < 8)
- return false;
++ storeEnabled = commState.getBoolean("storeEnabled");
+
- topVer = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 24:
- UUID subjId0 = commState.getUuid();
++ topVer = commState.getLong("topVer");
+
- if (subjId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- subjId = subjId0;
-
+ commState.idx++;
+
+ case 25:
- if (buf.remaining() < 4)
- return false;
++ subjId = commState.getUuid("subjId");
+
- taskNameHash = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 26:
- if (buf.remaining() < 1)
- return false;
++ taskNameHash = commState.getInt("taskNameHash");
+
- storeEnabled = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
++
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 52;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return GridToStringBuilder.toString(GridNearTxFinishRequest.class, this, "super", super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
index 0000000,b61f2ef..22c68e9
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
@@@ -1,0 -1,228 +1,224 @@@
+ /*
+ * 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.cache.distributed.near;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Reply for synchronous phase 2.
+ */
+ public class GridNearTxFinishResponse<K, V> extends GridDistributedTxFinishResponse<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Heuristic error. */
+ @GridDirectTransient
+ private Throwable err;
+
+ /** Serialized error. */
+ private byte[] errBytes;
+
+ /** Mini future ID. */
+ private IgniteUuid miniId;
+
+ /** Near tx thread ID. */
+ private long nearThreadId;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridNearTxFinishResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param xid Xid version.
+ * @param nearThreadId Near tx thread ID.
+ * @param futId Future ID.
+ * @param miniId Mini future Id.
+ * @param err Error.
+ */
+ public GridNearTxFinishResponse(GridCacheVersion xid, long nearThreadId, IgniteUuid futId, IgniteUuid miniId,
+ @Nullable Throwable err) {
+ super(xid, futId);
+
+ assert miniId != null;
+
+ this.nearThreadId = nearThreadId;
+ this.miniId = miniId;
+ this.err = err;
+ }
+
+ /**
+ * @return Error.
+ */
+ @Nullable public Throwable error() {
+ return err;
+ }
+
+ /**
+ * @return Mini future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @return Near thread ID.
+ */
+ public long threadId() {
+ return nearThreadId;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (err != null)
+ errBytes = ctx.marshaller().marshal(err);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (errBytes != null)
+ err = ctx.marshaller().unmarshal(errBytes, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridNearTxFinishResponse _clone = new GridNearTxFinishResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridNearTxFinishResponse _clone = (GridNearTxFinishResponse)_msg;
+
+ _clone.err = err;
+ _clone.errBytes = errBytes;
+ _clone.miniId = miniId;
+ _clone.nearThreadId = nearThreadId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 5:
- if (!commState.putByteArray(errBytes))
++ if (!commState.putByteArray("errBytes", errBytes))
+ return false;
+
+ commState.idx++;
+
+ case 6:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 7:
- if (!commState.putLong(nearThreadId))
++ if (!commState.putLong("nearThreadId", nearThreadId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 5:
- byte[] errBytes0 = commState.getByteArray();
++ errBytes = commState.getByteArray("errBytes");
+
- if (errBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- errBytes = errBytes0;
-
+ commState.idx++;
+
+ case 6:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 7:
- if (buf.remaining() < 8)
- return false;
++ nearThreadId = commState.getLong("nearThreadId");
+
- nearThreadId = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 53;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridNearTxFinishResponse.class, this, "super", super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
index 0000000,8aecfe0..e0bc216
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
@@@ -1,0 -1,449 +1,444 @@@
+ /*
+ * 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.cache.distributed.near;
+
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Near transaction prepare request.
+ */
+ public class GridNearTxPrepareRequest<K, V> extends GridDistributedTxPrepareRequest<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /** Mini future ID. */
+ private IgniteUuid miniId;
+
+ /** Near mapping flag. */
+ private boolean near;
+
+ /** Topology version. */
+ private long topVer;
+
+ /** {@code True} if this last prepare request for node. */
+ private boolean last;
+
+ /** IDs of backup nodes receiving last prepare request during this prepare. */
+ @GridDirectCollection(UUID.class)
+ private Collection<UUID> lastBackups;
+
+ /** Subject ID. */
+ @GridDirectVersion(1)
+ private UUID subjId;
+
+ /** Task name hash. */
+ @GridDirectVersion(2)
+ private int taskNameHash;
+
+ /**
+ * Empty constructor required for {@link Externalizable}.
+ */
+ public GridNearTxPrepareRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param futId Future ID.
+ * @param topVer Topology version.
+ * @param tx Transaction.
+ * @param reads Read entries.
+ * @param writes Write entries.
+ * @param grpLockKey Group lock key if preparing group-lock transaction.
+ * @param partLock {@code True} if preparing group-lock transaction with partition lock.
+ * @param near {@code True} if mapping is for near caches.
+ * @param txNodes Transaction nodes mapping.
+ * @param last {@code True} if this last prepare request for node.
+ * @param lastBackups IDs of backup nodes receiving last prepare request during this prepare.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash.
+ */
+ public GridNearTxPrepareRequest(
+ IgniteUuid futId,
+ long topVer,
+ IgniteTxEx<K, V> tx,
+ Collection<IgniteTxEntry<K, V>> reads,
+ Collection<IgniteTxEntry<K, V>> writes,
+ IgniteTxKey grpLockKey,
+ boolean partLock,
+ boolean near,
+ Map<UUID, Collection<UUID>> txNodes,
+ boolean last,
+ Collection<UUID> lastBackups,
+ @Nullable UUID subjId,
+ int taskNameHash
+ ) {
+ super(tx, reads, writes, grpLockKey, partLock, txNodes);
+
+ assert futId != null;
+
+ this.futId = futId;
+ this.topVer = topVer;
+ this.near = near;
+ this.last = last;
+ this.lastBackups = lastBackups;
+ this.subjId = subjId;
+ this.taskNameHash = taskNameHash;
+ }
+
+ /**
+ * @return IDs of backup nodes receiving last prepare request during this prepare.
+ */
+ public Collection<UUID> lastBackups() {
+ return lastBackups;
+ }
+
+ /**
+ * @return {@code True} if this last prepare request for node.
+ */
+ public boolean last() {
+ return last;
+ }
+
+ /**
+ * @return {@code True} if mapping is for near-enabled caches.
+ */
+ public boolean near() {
+ return near;
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Mini future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @param miniId Mini future ID.
+ */
+ public void miniId(IgniteUuid miniId) {
+ this.miniId = miniId;
+ }
+
+ /**
+ * @return Subject ID.
+ */
+ @Nullable public UUID subjectId() {
+ return subjId;
+ }
+
+ /**
+ * @return Task name hash.
+ */
+ public int taskNameHash() {
+ return taskNameHash;
+ }
+
+ /**
+ * @return Topology version.
+ */
+ @Override public long topologyVersion() {
+ return topVer;
+ }
+
+ /**
+ *
+ */
+ public void cloneEntries() {
+ reads(cloneEntries(reads()));
+ writes(cloneEntries(writes()));
+ }
+
+ /**
+ * Clones entries so that tx entries with initialized near entries are not passed to DHT transaction.
+ * Used only when local part of prepare is invoked.
+ *
+ * @param c Collection of entries to clone.
+ * @return Cloned collection.
+ */
+ private Collection<IgniteTxEntry<K, V>> cloneEntries(Collection<IgniteTxEntry<K, V>> c) {
+ if (F.isEmpty(c))
+ return c;
+
+ Collection<IgniteTxEntry<K, V>> cp = new ArrayList<>(c.size());
+
+ for (IgniteTxEntry<K, V> e : c) {
+ GridCacheContext<K, V> cacheCtx = e.context();
+
+ // Clone only if it is a near cache.
+ if (cacheCtx.isNear())
+ cp.add(e.cleanCopy(cacheCtx.nearTx().dht().context()));
+ else
+ cp.add(e);
+ }
+
+ return cp;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected boolean transferExpiryPolicy() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridNearTxPrepareRequest _clone = new GridNearTxPrepareRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridNearTxPrepareRequest _clone = (GridNearTxPrepareRequest)_msg;
+
+ _clone.futId = futId;
+ _clone.miniId = miniId;
++ _clone.near = near;
+ _clone.topVer = topVer;
+ _clone.last = last;
+ _clone.lastBackups = lastBackups;
+ _clone.subjId = subjId;
+ _clone.taskNameHash = taskNameHash;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 22:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 23:
- if (!commState.putBoolean(last))
++ if (!commState.putBoolean("last", last))
+ return false;
+
+ commState.idx++;
+
+ case 24:
+ if (lastBackups != null) {
+ if (commState.it == null) {
- if (!commState.putInt(lastBackups.size()))
++ if (!commState.putInt(null, lastBackups.size()))
+ return false;
+
+ commState.it = lastBackups.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putUuid((UUID)commState.cur))
++ if (!commState.putUuid(null, (UUID)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 25:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 26:
- if (!commState.putBoolean(near))
++ if (!commState.putBoolean("near", near))
+ return false;
+
+ commState.idx++;
+
+ case 27:
- if (!commState.putLong(topVer))
++ if (!commState.putLong("topVer", topVer))
+ return false;
+
+ commState.idx++;
+
+ case 28:
- if (!commState.putUuid(subjId))
++ if (!commState.putUuid("subjId", subjId))
+ return false;
+
+ commState.idx++;
+
+ case 29:
- if (!commState.putInt(taskNameHash))
++ if (!commState.putInt("taskNameHash", taskNameHash))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 22:
- IgniteUuid futId0 = commState.getGridUuid();
++ futId = commState.getGridUuid("futId");
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ case 23:
- if (buf.remaining() < 1)
- return false;
++ last = commState.getBoolean("last");
+
- last = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 24:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (lastBackups == null)
+ lastBackups = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- UUID _val = commState.getUuid();
++ UUID _val = commState.getUuid(null);
+
- if (_val == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ lastBackups.add((UUID)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 25:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 26:
- if (buf.remaining() < 1)
- return false;
++ near = commState.getBoolean("near");
+
- near = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 27:
- if (buf.remaining() < 8)
- return false;
++ topVer = commState.getLong("topVer");
+
- topVer = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 28:
- UUID subjId0 = commState.getUuid();
++ subjId = commState.getUuid("subjId");
+
- if (subjId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- subjId = subjId0;
-
+ commState.idx++;
+
+ case 29:
- if (buf.remaining() < 4)
- return false;
++ taskNameHash = commState.getInt("taskNameHash");
+
- taskNameHash = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 54;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridNearTxPrepareRequest.class, this, super.toString());
+ }
+ }
[51/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
Merge branch 'sprint-1' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Conflicts:
modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageFactory.java
modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java
modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
modules/core/src/main/java/org/gridgain/client/impl/connection/GridClientConnectionManagerAdapter.java
modules/core/src/main/java/org/gridgain/grid/kernal/GridJobCancelRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteRequestV2.java
modules/core/src/main/java/org/gridgain/grid/kernal/GridJobExecuteResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/GridJobSiblingsResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/GridKernal.java
modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContext.java
modules/core/src/main/java/org/gridgain/grid/kernal/GridKernalContextImpl.java
modules/core/src/main/java/org/gridgain/grid/kernal/GridPluginContext.java
modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskCancelRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/GridTaskSessionRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/managers/GridManagerAdapter.java
modules/core/src/main/java/org/gridgain/grid/kernal/managers/checkpoint/GridCheckpointRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoManager.java
modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoMessage.java
modules/core/src/main/java/org/gridgain/grid/kernal/managers/communication/GridIoUserMessage.java
modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentInfoBean.java
modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/managers/deployment/GridDeploymentResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/managers/eventstorage/GridEventStorageMessage.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheEvictionResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMessage.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedBaseMessage.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedLockResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxFinishResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/GridDistributedUnlockRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtAffinityAssignmentRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtAffinityAssignmentResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtLockResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtUnlockRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearGetResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearLockResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxFinishResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearUnlockRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/query/GridCacheQueryResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/clock/GridClockDeltaSnapshotMessage.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/continuous/GridContinuousMessage.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/dataload/GridDataLoadResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAckMessage.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlockKey.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsBlocksMessage.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsCommunicationMessage.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDeleteMessage.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFileAffinityRange.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFragmentizerResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsSyncMessage.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/plugin/IgnitePluginProcessor.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/portable/GridPortableOutputStream.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientMessageWrapper.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/client/message/GridClientPingPacketWrapper.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/handlers/task/GridTaskResultResponse.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/rest/protocols/tcp/GridTcpRestProtocol.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerCancelRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerExecutionRequest.java
modules/core/src/main/java/org/gridgain/grid/kernal/processors/streamer/GridStreamerResponse.java
modules/core/src/main/java/org/gridgain/grid/util/GridLongList.java
modules/core/src/main/java/org/gridgain/grid/util/GridUtils.java
modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageAdapter.java
modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageFactory.java
modules/core/src/main/java/org/gridgain/grid/util/direct/GridTcpCommunicationMessageState.java
modules/core/src/main/java/org/gridgain/grid/util/ipc/GridIpcToNioAdapter.java
modules/core/src/main/java/org/gridgain/grid/util/nio/GridDirectParser.java
modules/core/src/main/java/org/gridgain/grid/util/nio/GridNioServer.java
modules/core/src/main/java/org/gridgain/grid/util/nio/GridShmemCommunicationClient.java
modules/core/src/main/java/org/gridgain/grid/util/nio/GridTcpCommunicationClient.java
modules/core/src/test/java/org/gridgain/grid/kernal/managers/communication/GridCommunicationSendMessageSelfTest.java
modules/core/src/test/java/org/gridgain/testframework/GridSpiTestContext.java
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3dbb6acc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3dbb6acc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3dbb6acc
Branch: refs/heads/ignite-61
Commit: 3dbb6acc206b321f5b08cfc510292a272f88b0e9
Parents: 2c4a36c 9550905
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Thu Jan 29 23:17:21 2015 -0800
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Thu Jan 29 23:17:21 2015 -0800
----------------------------------------------------------------------
LICENSE.txt | 229 +
NOTICE.txt | 21 +
apache-2.0.txt | 202 -
assembly/core-jar.xml | 36 +-
assembly/dependencies-fabric.xml | 32 +-
assembly/dependencies-hadoop.xml | 32 +-
assembly/dependencies-optional-fabric.xml | 32 +-
assembly/dependencies-optional-hadoop.xml | 32 +-
assembly/dependencies-visor-console.xml | 32 +-
assembly/dependencies-visor-trial.xml | 32 +-
assembly/docfiles/javadoc.css | 36 +-
assembly/docfiles/tools.js | 24 +-
assembly/libs/readme.txt | 121 +-
assembly/release-base-fabric.xml | 34 +-
assembly/release-base.xml | 34 +-
assembly/release-fabric.xml | 36 +-
assembly/release-hadoop.xml | 38 +-
assembly/test.xml | 36 +-
bin/ggrouter.bat | 24 +-
bin/ggrouter.sh | 24 +-
bin/ggstart.bat | 24 +-
bin/ggstart.sh | 24 +-
bin/ggvisorcmd.bat | 24 +-
bin/ggvisorcmd.sh | 26 +-
bin/include/functions.sh | 21 +-
bin/include/hadoop-classpath.bat | 20 +-
bin/include/hadoop-classpath.sh | 20 +-
bin/include/parseargs.bat | 25 +-
bin/include/parseargs.sh | 24 +-
bin/include/service.sh | 20 +-
bin/include/setenv.bat | 20 +-
bin/include/setenv.sh | 20 +-
bin/include/target-classpath.bat | 20 +-
bin/include/target-classpath.sh | 20 +-
bin/setup-hadoop.bat | 20 +-
bin/setup-hadoop.sh | 24 +-
config/default-config.xml | 22 +-
config/fabric/default-config.xml | 28 +-
config/gridgain-log4j.xml | 24 +-
config/hadoop/default-config.xml | 34 +-
config/java.util.logging.properties | 22 +-
config/router/default-router.xml | 26 +-
docs/core-site.gridgain.xml | 65 -
docs/core-site.ignite.xml | 89 +
docs/gridgain_readme.md | 149 -
docs/gridgain_readme.pdf | Bin 407698 -> 0 bytes
docs/hadoop_readme.md | 80 +-
docs/hadoop_readme.pdf | Bin 411788 -> 82297 bytes
docs/hive-site.gridgain.xml | 33 -
docs/hive-site.ignite.xml | 36 +
docs/ignite_readme.md | 100 +
docs/ignite_readme.pdf | Bin 0 -> 76810 bytes
docs/mapred-site.gridgain.xml | 62 -
docs/mapred-site.ignite.xml | 79 +
examples/config/example-cache.xml | 37 +-
examples/config/example-compute.xml | 31 +-
examples/config/example-streamer.xml | 51 +-
examples/config/filesystem/core-site.xml | 26 +-
examples/config/filesystem/example-ggfs.xml | 37 +-
examples/config/filesystem/readme.txt | 4 +-
.../hibernate/example-hibernate-L2-cache.xml | 44 +-
examples/config/hibernate/readme.txt | 4 +-
examples/config/servlet/WEB-INF/web.xml | 23 +-
examples/config/servlet/readme.txt | 2 +-
examples/pom-standalone.xml | 72 +-
examples/pom.xml | 27 +-
examples/rest/http-rest-example.php | 22 +-
examples/rest/memcache-rest-example.php | 22 +-
.../ignite/examples/ComputeNodeStartup.java | 35 +
.../apache/ignite/examples/ExamplesUtils.java | 99 +
.../compute/ComputeBroadcastExample.java | 114 +
.../compute/ComputeCallableExample.java | 79 +
.../examples/compute/ComputeClosureExample.java | 77 +
.../compute/ComputeContinuousMapperExample.java | 162 +
.../compute/ComputeExecutorServiceExample.java | 71 +
.../ComputeFibonacciContinuationExample.java | 189 +
.../compute/ComputeProjectionExample.java | 94 +
.../examples/compute/ComputeReducerExample.java | 89 +
.../compute/ComputeRunnableExample.java | 75 +
.../compute/ComputeScheduleExample.java | 86 +
.../examples/compute/ComputeTaskMapExample.java | 113 +
.../compute/ComputeTaskSplitExample.java | 102 +
.../failover/ComputeFailoverExample.java | 143 +
.../failover/ComputeFailoverNodeStartup.java | 77 +
.../examples/compute/failover/package.html | 23 +
.../examples/compute/montecarlo/Credit.java | 110 +
.../compute/montecarlo/CreditRiskExample.java | 153 +
.../compute/montecarlo/CreditRiskManager.java | 153 +
.../examples/compute/montecarlo/package.html | 24 +
.../apache/ignite/examples/compute/package.html | 23 +
.../examples/datagrid/CacheAffinityExample.java | 138 +
.../examples/datagrid/CacheApiExample.java | 170 +
.../datagrid/CacheContinuousQueryExample.java | 97 +
.../datagrid/CacheDataLoaderExample.java | 86 +
.../examples/datagrid/CacheEventsExample.java | 95 +
.../examples/datagrid/CacheNodeStartup.java | 35 +
.../datagrid/CachePopularNumbersExample.java | 179 +
.../examples/datagrid/CachePutGetExample.java | 114 +
.../examples/datagrid/CacheQueryExample.java | 476 +
.../datagrid/CacheTransactionExample.java | 148 +
.../datastructures/CacheAtomicLongExample.java | 78 +
.../CacheAtomicReferenceExample.java | 126 +
.../CacheAtomicSequenceExample.java | 112 +
.../CacheAtomicStampedExample.java | 132 +
.../CacheCountDownLatchExample.java | 112 +
.../datastructures/CacheQueueExample.java | 214 +
.../datastructures/CacheSetExample.java | 193 +
.../datagrid/datastructures/package.html | 23 +
.../hibernate/HibernateL2CacheExample.java | 204 +
.../HibernateL2CacheExampleNodeStartup.java | 97 +
.../examples/datagrid/hibernate/Post.java | 126 +
.../examples/datagrid/hibernate/User.java | 151 +
.../examples/datagrid/hibernate/package.html | 23 +
.../ignite/examples/datagrid/package.html | 23 +
.../starschema/CacheStarSchemaExample.java | 227 +
.../datagrid/starschema/DimProduct.java | 100 +
.../examples/datagrid/starschema/DimStore.java | 100 +
.../datagrid/starschema/FactPurchase.java | 102 +
.../examples/datagrid/starschema/package.html | 24 +
.../store/CacheNodeWithStoreStartup.java | 89 +
.../datagrid/store/CacheStoreExample.java | 88 +
.../store/CacheStoreLoadDataExample.java | 76 +
.../ignite/examples/datagrid/store/Person.java | 103 +
.../store/dummy/CacheDummyPersonStore.java | 112 +
.../examples/datagrid/store/dummy/package.html | 24 +
.../hibernate/CacheHibernatePersonStore.java | 278 +
.../datagrid/store/hibernate/Person.hbm.xml | 32 +
.../datagrid/store/hibernate/hibernate.cfg.xml | 44 +
.../datagrid/store/hibernate/package.html | 24 +
.../store/jdbc/CacheJdbcPersonStore.java | 305 +
.../examples/datagrid/store/jdbc/package.html | 24 +
.../ignite/examples/datagrid/store/package.html | 24 +
.../ignite/examples/events/EventsExample.java | 144 +
.../apache/ignite/examples/events/package.html | 24 +
.../ignite/examples/ggfs/GgfsExample.java | 278 +
.../examples/ggfs/GgfsMapReduceExample.java | 249 +
.../ignite/examples/ggfs/GgfsNodeStartup.java | 41 +
.../apache/ignite/examples/ggfs/package.html | 23 +
.../examples/messaging/MessagingExample.java | 174 +
.../messaging/MessagingPingPongExample.java | 133 +
.../MessagingPingPongListenActorExample.java | 107 +
.../ignite/examples/messaging/package.html | 24 +
.../client/memcache/MemcacheRestExample.java | 127 +
.../MemcacheRestExampleNodeStartup.java | 99 +
.../examples/misc/client/memcache/package.html | 23 +
.../ignite/examples/misc/client/package.html | 24 +
.../misc/deployment/DeploymentExample.java | 129 +
.../examples/misc/deployment/package.html | 24 +
.../misc/lifecycle/LifecycleExample.java | 92 +
.../ignite/examples/misc/lifecycle/package.html | 24 +
.../apache/ignite/examples/misc/package.html | 24 +
.../misc/springbean/SpringBeanExample.java | 88 +
.../examples/misc/springbean/package.html | 24 +
.../examples/misc/springbean/spring-bean.xml | 70 +
.../org/apache/ignite/examples/package.html | 24 +
.../examples/services/ServicesExample.java | 161 +
.../examples/services/SimpleMapService.java | 49 +
.../examples/services/SimpleMapServiceImpl.java | 71 +
.../streaming/StreamingCheckInExample.java | 582 +
.../streaming/StreamingNodeStartup.java | 35 +
.../StreamingPopularNumbersExample.java | 251 +
.../streaming/StreamingPriceBarsExample.java | 453 +
.../StreamingRunningAverageExample.java | 248 +
.../ignite/examples/streaming/package.html | 24 +
.../gridgain/examples/ComputeNodeStartup.java | 28 -
.../org/gridgain/examples/ExamplesUtils.java | 91 -
.../compute/ComputeBroadcastExample.java | 107 -
.../compute/ComputeCallableExample.java | 72 -
.../examples/compute/ComputeClosureExample.java | 70 -
.../compute/ComputeContinuousMapperExample.java | 155 -
.../compute/ComputeExecutorServiceExample.java | 64 -
.../ComputeFibonacciContinuationExample.java | 181 -
.../compute/ComputeProjectionExample.java | 87 -
.../examples/compute/ComputeReducerExample.java | 82 -
.../compute/ComputeRunnableExample.java | 67 -
.../compute/ComputeScheduleExample.java | 79 -
.../examples/compute/ComputeTaskMapExample.java | 97 -
.../compute/ComputeTaskSplitExample.java | 86 -
.../failover/ComputeFailoverExample.java | 136 -
.../failover/ComputeFailoverNodeStartup.java | 70 -
.../examples/compute/failover/package.html | 15 -
.../examples/compute/montecarlo/Credit.java | 102 -
.../compute/montecarlo/CreditRiskExample.java | 146 -
.../compute/montecarlo/CreditRiskManager.java | 145 -
.../examples/compute/montecarlo/package.html | 15 -
.../org/gridgain/examples/compute/package.html | 15 -
.../examples/datagrid/CacheAffinityExample.java | 131 -
.../examples/datagrid/CacheApiExample.java | 165 -
.../datagrid/CacheContinuousQueryExample.java | 90 -
.../datagrid/CacheDataLoaderExample.java | 74 -
.../examples/datagrid/CacheEventsExample.java | 88 -
.../examples/datagrid/CacheNodeStartup.java | 28 -
.../datagrid/CachePopularNumbersExample.java | 168 -
.../examples/datagrid/CachePutGetExample.java | 107 -
.../examples/datagrid/CacheQueryExample.java | 469 -
.../datagrid/CacheTransactionExample.java | 140 -
.../datastructures/CacheAtomicLongExample.java | 71 -
.../CacheAtomicReferenceExample.java | 119 -
.../CacheAtomicSequenceExample.java | 105 -
.../CacheAtomicStampedExample.java | 125 -
.../CacheCountDownLatchExample.java | 105 -
.../datastructures/CacheQueueExample.java | 207 -
.../datastructures/CacheSetExample.java | 186 -
.../datagrid/datastructures/package.html | 15 -
.../hibernate/HibernateL2CacheExample.java | 197 -
.../HibernateL2CacheExampleNodeStartup.java | 90 -
.../examples/datagrid/hibernate/Post.java | 118 -
.../examples/datagrid/hibernate/User.java | 143 -
.../examples/datagrid/hibernate/package.html | 15 -
.../org/gridgain/examples/datagrid/package.html | 15 -
.../starschema/CacheStarSchemaExample.java | 220 -
.../datagrid/starschema/DimProduct.java | 93 -
.../examples/datagrid/starschema/DimStore.java | 93 -
.../datagrid/starschema/FactPurchase.java | 95 -
.../examples/datagrid/starschema/package.html | 15 -
.../store/CacheNodeWithStoreStartup.java | 74 -
.../datagrid/store/CacheStoreExample.java | 80 -
.../store/CacheStoreLoadDataExample.java | 69 -
.../examples/datagrid/store/Person.java | 95 -
.../store/dummy/CacheDummyPersonStore.java | 86 -
.../examples/datagrid/store/dummy/package.html | 15 -
.../hibernate/CacheHibernatePersonStore.java | 244 -
.../datagrid/store/hibernate/Person.hbm.xml | 15 -
.../datagrid/store/hibernate/hibernate.cfg.xml | 38 -
.../datagrid/store/hibernate/package.html | 15 -
.../store/jdbc/CacheJdbcPersonStore.java | 271 -
.../examples/datagrid/store/jdbc/package.html | 15 -
.../examples/datagrid/store/package.html | 15 -
.../gridgain/examples/events/EventsExample.java | 137 -
.../org/gridgain/examples/events/package.html | 15 -
.../org/gridgain/examples/ggfs/GgfsExample.java | 271 -
.../examples/ggfs/GgfsMapReduceExample.java | 242 -
.../gridgain/examples/ggfs/GgfsNodeStartup.java | 34 -
.../org/gridgain/examples/ggfs/package.html | 15 -
.../examples/messaging/MessagingExample.java | 167 -
.../messaging/MessagingPingPongExample.java | 126 -
.../MessagingPingPongListenActorExample.java | 100 -
.../gridgain/examples/messaging/package.html | 15 -
.../client/memcache/MemcacheRestExample.java | 119 -
.../MemcacheRestExampleNodeStartup.java | 92 -
.../examples/misc/client/memcache/package.html | 15 -
.../gridgain/examples/misc/client/package.html | 15 -
.../misc/deployment/DeploymentExample.java | 122 -
.../examples/misc/deployment/package.html | 15 -
.../misc/lifecycle/LifecycleExample.java | 85 -
.../examples/misc/lifecycle/package.html | 15 -
.../org/gridgain/examples/misc/package.html | 15 -
.../misc/springbean/SpringBeanExample.java | 81 -
.../examples/misc/springbean/package.html | 15 -
.../examples/misc/springbean/spring-bean.xml | 67 -
.../java/org/gridgain/examples/package.html | 15 -
.../examples/services/ServicesExample.java | 153 -
.../examples/services/SimpleMapService.java | 41 -
.../examples/services/SimpleMapServiceImpl.java | 63 -
.../streaming/StreamingCheckInExample.java | 575 -
.../streaming/StreamingNodeStartup.java | 28 -
.../StreamingPopularNumbersExample.java | 244 -
.../streaming/StreamingPriceBarsExample.java | 446 -
.../StreamingRunningAverageExample.java | 241 -
.../gridgain/examples/streaming/package.html | 15 -
.../org/gridgain/examples/ComputeExample.java | 22 +-
.../org/gridgain/examples/MessagingExample.java | 24 +-
.../examples/ScalarCacheAffinityExample1.scala | 124 +
.../examples/ScalarCacheAffinityExample2.scala | 116 +
.../ScalarCacheAffinitySimpleExample.scala | 83 +
.../scalar/examples/ScalarCacheExample.scala | 150 +
.../ScalarCachePopularNumbersExample.scala | 115 +
.../examples/ScalarCacheQueryExample.scala | 205 +
.../scalar/examples/ScalarClosureExample.scala | 97 +
.../examples/ScalarContinuationExample.scala | 161 +
.../examples/ScalarCreditRiskExample.scala | 246 +
.../scalar/examples/ScalarJvmCloudExample.scala | 95 +
.../examples/ScalarPiCalculationExample.scala | 55 +
.../scalar/examples/ScalarPingPongExample.scala | 157 +
.../scalar/examples/ScalarPrimeExample.scala | 134 +
.../scalar/examples/ScalarScheduleExample.scala | 63 +
.../examples/ScalarSnowflakeSchemaExample.scala | 293 +
.../scalar/examples/ScalarTaskExample.scala | 52 +
.../examples/ScalarWorldShortestMapReduce.scala | 39 +
.../examples/ScalarCacheAffinityExample1.scala | 114 -
.../examples/ScalarCacheAffinityExample2.scala | 108 -
.../ScalarCacheAffinitySimpleExample.scala | 71 -
.../scalar/examples/ScalarCacheExample.scala | 137 -
.../ScalarCachePopularNumbersExample.scala | 120 -
.../examples/ScalarCacheQueryExample.scala | 194 -
.../scalar/examples/ScalarClosureExample.scala | 93 -
.../examples/ScalarContinuationExample.scala | 152 -
.../examples/ScalarCreditRiskExample.scala | 239 -
.../scalar/examples/ScalarJvmCloudExample.scala | 77 -
.../examples/ScalarPiCalculationExample.scala | 48 -
.../scalar/examples/ScalarPingPongExample.scala | 150 -
.../scalar/examples/ScalarPrimeExample.scala | 126 -
.../scalar/examples/ScalarScheduleExample.scala | 57 -
.../examples/ScalarSnowflakeSchemaExample.scala | 265 -
.../examples/ScalarStartStopExample.scala | 67 -
.../scalar/examples/ScalarTaskExample.scala | 44 -
.../examples/ScalarWorldShortestMapReduce.scala | 33 -
.../GridBasicExamplesMultiNodeSelfTest.java | 28 +
.../examples/GridBasicExamplesSelfTest.java | 82 +
.../GridCacheExamplesMultiNodeSelfTest.java | 48 +
.../examples/GridCacheExamplesSelfTest.java | 155 +
...heStoreLoadDataExampleMultiNodeSelfTest.java | 39 +
.../GridCheckpointExamplesSelfTest.java | 45 +
...idContinuationExamplesMultiNodeSelfTest.java | 28 +
.../GridContinuationExamplesSelfTest.java | 33 +
...ntinuousMapperExamplesMultiNodeSelfTest.java | 28 +
.../GridContinuousMapperExamplesSelfTest.java | 33 +
...GridDeploymentExamplesMultiNodeSelfTest.java | 30 +
.../GridDeploymentExamplesSelfTest.java | 33 +
.../GridEventsExamplesMultiNodeSelfTest.java | 28 +
.../examples/GridEventsExamplesSelfTest.java | 33 +
...ibernateL2CacheExampleMultiNodeSelfTest.java | 31 +
.../GridHibernateL2CacheExampleSelfTest.java | 33 +
.../examples/GridLifecycleExamplesSelfTest.java | 33 +
...idMemcacheRestExamplesMultiNodeSelfTest.java | 31 +
.../GridMemcacheRestExamplesSelfTest.java | 41 +
.../examples/GridMessagingExamplesSelfTest.java | 52 +
...GridMonteCarloExamplesMultiNodeSelfTest.java | 28 +
.../GridMonteCarloExamplesSelfTest.java | 74 +
.../examples/GridProjectionExampleSelfTest.java | 39 +
.../GridSpringBeanExamplesSelfTest.java | 33 +
.../GridTaskExamplesMultiNodeSelfTest.java | 28 +
.../examples/GridTaskExamplesSelfTest.java | 40 +
.../examples/IgniteFsExamplesSelfTest.java | 51 +
.../testsuites/IgniteExamplesSelfTestSuite.java | 74 +
.../GridBasicExamplesMultiNodeSelfTest.java | 20 -
.../examples/GridBasicExamplesSelfTest.java | 74 -
.../GridCacheExamplesMultiNodeSelfTest.java | 40 -
.../examples/GridCacheExamplesSelfTest.java | 147 -
...heStoreLoadDataExampleMultiNodeSelfTest.java | 31 -
.../GridCheckpointExamplesSelfTest.java | 28 -
...idContinuationExamplesMultiNodeSelfTest.java | 20 -
.../GridContinuationExamplesSelfTest.java | 25 -
...ntinuousMapperExamplesMultiNodeSelfTest.java | 20 -
.../GridContinuousMapperExamplesSelfTest.java | 25 -
...GridDeploymentExamplesMultiNodeSelfTest.java | 22 -
.../GridDeploymentExamplesSelfTest.java | 25 -
.../GridEventsExamplesMultiNodeSelfTest.java | 20 -
.../examples/GridEventsExamplesSelfTest.java | 25 -
.../examples/GridGgfsExamplesSelfTest.java | 59 -
...ibernateL2CacheExampleMultiNodeSelfTest.java | 23 -
.../GridHibernateL2CacheExampleSelfTest.java | 25 -
.../examples/GridLifecycleExamplesSelfTest.java | 25 -
...idMemcacheRestExamplesMultiNodeSelfTest.java | 23 -
.../GridMemcacheRestExamplesSelfTest.java | 33 -
.../examples/GridMessagingExamplesSelfTest.java | 44 -
...GridMonteCarloExamplesMultiNodeSelfTest.java | 20 -
.../GridMonteCarloExamplesSelfTest.java | 66 -
.../examples/GridProjectionExampleSelfTest.java | 31 -
.../GridSpringBeanExamplesSelfTest.java | 16 -
.../GridTaskExamplesMultiNodeSelfTest.java | 20 -
.../examples/GridTaskExamplesSelfTest.java | 32 -
.../testsuites/GridExamplesSelfTestSuite.java | 66 -
.../ScalarExamplesMultiNodeSelfTest.scala | 33 +
.../tests/examples/ScalarExamplesSelfTest.scala | 113 +
.../ScalarExamplesSelfTestSuite.scala | 38 +
.../ScalarExamplesMultiNodeSelfTest.scala | 27 -
.../tests/examples/ScalarExamplesSelfTest.scala | 112 -
.../ScalarExamplesSelfTestSuite.scala | 33 -
ipc/readme.txt | 4 +-
ipc/shmem/Makefile.am | 2 +-
ipc/shmem/Makefile.in | 2 +-
ipc/shmem/configure | 4 +-
ipc/shmem/configure.ac | 2 +-
ipc/shmem/ggshmem/Makefile.am | 23 -
ipc/shmem/ggshmem/Makefile.in | 589 -
..._util_ipc_shmem_GridIpcSharedMemoryUtils.cpp | 874 --
ipc/shmem/igniteshmem/Makefile.am | 23 +
ipc/shmem/igniteshmem/Makefile.in | 589 +
...rnal_util_ipc_shmem_IpcSharedMemoryUtils.cpp | 882 ++
ipc/shmem/include/Makefile.am | 2 +-
ipc/shmem/include/Makefile.in | 2 +-
...ternal_util_ipc_shmem_IpcSharedMemoryUtils.h | 117 +
...id_util_ipc_shmem_GridIpcSharedMemoryUtils.h | 117 -
ipc/shmem/readme.txt | 17 +-
modules/aop/pom.xml | 22 +-
modules/aop/readme.txt | 16 +-
.../aop/aspectj/GridifyAspectJAspect.java | 123 +
.../aspectj/GridifySetToSetAspectJAspect.java | 134 +
.../aspectj/GridifySetToValueAspectJAspect.java | 134 +
.../compute/gridify/aop/aspectj/package.html | 24 +
.../aop/spring/GridifySetToSetSpringAspect.java | 129 +
.../spring/GridifySetToValueSpringAspect.java | 129 +
.../gridify/aop/spring/GridifySpringAspect.java | 118 +
.../aop/spring/GridifySpringEnhancer.java | 81 +
.../aop/spring/GridifySpringPointcut.java | 136 +
.../compute/gridify/aop/spring/package.html | 23 +
.../aop/aspectj/GridifyAspectJAspect.java | 116 -
.../aspectj/GridifySetToSetAspectJAspect.java | 127 -
.../aspectj/GridifySetToValueAspectJAspect.java | 127 -
.../compute/gridify/aop/aspectj/package.html | 15 -
.../aop/spring/GridifySetToSetSpringAspect.java | 122 -
.../spring/GridifySetToValueSpringAspect.java | 122 -
.../gridify/aop/spring/GridifySpringAspect.java | 111 -
.../aop/spring/GridifySpringEnhancer.java | 74 -
.../aop/spring/GridifySpringPointcut.java | 128 -
.../compute/gridify/aop/spring/package.html | 15 -
.../test/config/aop/aspectj/META-INF/aop.xml | 32 +-
.../config/aop/jboss/jboss-gridgain-aop.xml | 22 +-
.../apache/ignite/gridify/AbstractAopTest.java | 734 +
.../apache/ignite/gridify/BasicAopSelfTest.java | 77 +
.../ignite/gridify/GridifySetToSetTarget.java | 372 +
.../gridify/GridifySetToSetTargetInterface.java | 109 +
.../ignite/gridify/GridifySetToValueTarget.java | 199 +
.../GridifySetToValueTargetInterface.java | 100 +
.../GridifySetToXXXNonSpringAopSelfTest.java | 203 +
.../GridifySetToXXXSpringAopSelfTest.java | 204 +
.../ignite/gridify/NonSpringAopSelfTest.java | 57 +
.../ignite/gridify/SpringAopSelfTest.java | 52 +
.../apache/ignite/gridify/TestAopTarget.java | 138 +
.../ignite/gridify/TestAopTargetInterface.java | 87 +
.../ignite/gridify/TestGridifyException.java | 38 +
.../apache/ignite/gridify/TestGridifyJob.java | 67 +
.../apache/ignite/gridify/TestGridifyTask.java | 47 +
.../gridify/hierarchy/GridifyHierarchyTest.java | 51 +
.../ignite/gridify/hierarchy/SuperTarget.java | 53 +
.../apache/ignite/gridify/hierarchy/Target.java | 45 +
.../ignite/gridify/hierarchy/package.html | 23 +
.../java/org/apache/ignite/gridify/package.html | 23 +
.../ignite/gridify/test_resource.properties | 18 +
.../optimized/OptimizedMarshallerAopTest.java | 104 +
.../apache/ignite/p2p/P2PGridifySelfTest.java | 241 +
.../testsuites/IgniteAopSelfTestSuite.java | 52 +
.../singlesplit/SingleSplitTestJobTarget.java | 46 +
.../direct/singlesplit/SingleSplitTestTask.java | 94 +
.../singlesplit/SingleSplitsLoadTest.java | 135 +
.../loadtests/direct/singlesplit/package.html | 24 +
.../gridify/GridifyLoadTestJobTarget.java | 37 +
.../loadtests/gridify/GridifyLoadTestTask.java | 70 +
.../gridify/GridifySingleSplitLoadTest.java | 157 +
.../grid/gridify/GridAbstractAopTest.java | 726 -
.../grid/gridify/GridBasicAopSelfTest.java | 69 -
.../grid/gridify/GridNonSpringAopSelfTest.java | 49 -
.../grid/gridify/GridSpringAopSelfTest.java | 44 -
.../grid/gridify/GridTestAopTarget.java | 130 -
.../gridify/GridTestAopTargetInterface.java | 79 -
.../grid/gridify/GridTestGridifyException.java | 30 -
.../grid/gridify/GridTestGridifyJob.java | 60 -
.../grid/gridify/GridTestGridifyTask.java | 38 -
.../grid/gridify/GridifySetToSetTarget.java | 364 -
.../gridify/GridifySetToSetTargetInterface.java | 101 -
.../grid/gridify/GridifySetToValueTarget.java | 191 -
.../GridifySetToValueTargetInterface.java | 92 -
.../GridifySetToXXXNonSpringAopSelfTest.java | 195 -
.../GridifySetToXXXSpringAopSelfTest.java | 196 -
.../grid/gridify/hierarchy/GridSuperTarget.java | 45 -
.../grid/gridify/hierarchy/GridTarget.java | 37 -
.../gridify/hierarchy/GridifyHierarchyTest.java | 43 -
.../grid/gridify/hierarchy/package.html | 15 -
.../java/org/gridgain/grid/gridify/package.html | 15 -
.../grid/gridify/test_resource.properties | 10 -
.../GridOptimizedMarshallerAopTest.java | 97 -
.../grid/p2p/GridP2PGridifySelfTest.java | 233 -
.../GridSingleSplitTestJobTarget.java | 38 -
.../singlesplit/GridSingleSplitTestTask.java | 86 -
.../singlesplit/GridSingleSplitsLoadTest.java | 128 -
.../loadtests/direct/singlesplit/package.html | 15 -
.../gridify/GridifyLoadTestJobTarget.java | 29 -
.../loadtests/gridify/GridifyLoadTestTask.java | 62 -
.../gridify/GridifySingleSplitLoadTest.java | 149 -
.../testsuites/GridAopSelfTestSuite.java | 44 -
.../org/test/gridify/ExternalAopTarget.java | 134 +
.../test/gridify/ExternalGridifyException.java | 38 +
.../org/test/gridify/ExternalGridifyTask.java | 79 +
.../gridify/ExternalNonSpringAopSelfTest.java | 539 +
.../org/test/gridify/GridExternalAopTarget.java | 126 -
.../gridify/GridExternalGridifyException.java | 30 -
.../test/gridify/GridExternalGridifyTask.java | 72 -
.../GridExternalNonSpringAopSelfTest.java | 531 -
.../src/test/java/org/test/gridify/package.html | 24 +-
.../org/test/gridify/test_resource.properties | 20 +-
modules/aws/pom.xml | 21 +-
modules/aws/readme.txt | 16 +-
.../spi/checkpoint/s3/GridS3CheckpointData.java | 82 -
.../spi/checkpoint/s3/GridS3CheckpointSpi.java | 676 -
.../checkpoint/s3/GridS3CheckpointSpiMBean.java | 51 -
.../spi/checkpoint/s3/GridS3TimeData.java | 71 -
.../spi/checkpoint/s3/S3CheckpointData.java | 90 +
.../spi/checkpoint/s3/S3CheckpointSpi.java | 678 +
.../spi/checkpoint/s3/S3CheckpointSpiMBean.java | 59 +
.../ignite/spi/checkpoint/s3/S3TimeData.java | 79 +
.../ignite/spi/checkpoint/s3/package.html | 25 +-
.../ipfinder/s3/GridTcpDiscoveryS3IpFinder.java | 312 -
.../tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java | 319 +
.../spi/discovery/tcp/ipfinder/s3/package.html | 24 +-
.../s3/GridS3CheckpointManagerSelfTest.java | 58 -
.../s3/GridS3CheckpointSpiConfigSelfTest.java | 16 -
.../s3/GridS3CheckpointSpiSelfTest.java | 207 -
.../GridS3CheckpointSpiStartStopSelfTest.java | 33 -
.../s3/GridS3SessionCheckpointSelfTest.java | 42 -
.../s3/S3CheckpointManagerSelfTest.java | 66 +
.../s3/S3CheckpointSpiConfigSelfTest.java | 33 +
.../checkpoint/s3/S3CheckpointSpiSelfTest.java | 214 +
.../s3/S3CheckpointSpiStartStopSelfTest.java | 41 +
.../s3/S3SessionCheckpointSelfTest.java | 50 +
.../ignite/spi/checkpoint/s3/package.html | 25 +-
.../s3/GridTcpDiscoveryS3IpFinderSelfTest.java | 64 -
.../s3/TcpDiscoveryS3IpFinderSelfTest.java | 72 +
.../spi/discovery/tcp/ipfinder/s3/package.html | 24 +-
.../ignite/testsuites/IgniteS3TestSuite.java | 69 +
.../testsuites/bamboo/GridS3TestSuite.java | 61 -
.../config/grid-client-config.properties | 17 +
.../config/grid-client-spring-config.xml | 30 +-
modules/clients/php/src/GridClient.php | 22 +-
modules/clients/php/src/GridClientCompute.php | 22 +-
.../php/src/GridClientComputeBalancer.php | 22 +-
modules/clients/php/src/GridClientData.php | 22 +-
.../clients/php/src/GridClientDataAffinity.php | 22 +-
modules/clients/php/src/GridClientNode.php | 22 +-
.../clients/php/src/GridClientNodeFilter.php | 22 +-
modules/clients/pom.xml | 22 +-
modules/clients/src/test/bin/start-nodes-ssh.sh | 20 +-
modules/clients/src/test/bin/start-nodes.sh | 20 +-
modules/clients/src/test/bin/stop-nodes.sh | 20 +-
.../ClientAbstractMultiThreadedSelfTest.java | 617 +
.../client/ClientDefaultCacheSelfTest.java | 156 +
.../ignite/client/ClientGetAffinityTask.java | 64 +
.../apache/ignite/client/ClientHttpTask.java | 59 +
.../apache/ignite/client/ClientNodeStartup.java | 57 +
.../client/ClientPortableArgumentTask.java | 53 +
.../ignite/client/ClientPutPortableTask.java | 44 +
.../client/ClientReconnectionSelfTest.java | 235 +
.../ignite/client/ClientSslNodeStartup.java | 59 +
.../ignite/client/ClientStartNodeTask.java | 180 +
.../ignite/client/ClientStopNodeTask.java | 127 +
.../ignite/client/ClientStringLengthTask.java | 73 +
.../client/ClientTcpMultiThreadedSelfTest.java | 45 +
.../ClientTcpSslAuthenticationSelfTest.java | 265 +
.../ClientTcpSslMultiThreadedSelfTest.java | 46 +
.../org/apache/ignite/client/ClientTcpTask.java | 73 +
...skExecutionAfterTopologyRestartSelfTest.java | 75 +
.../ignite/client/ClientTestPortable.java | 490 +
.../ClientTestPortableAffinityKeyTask.java | 85 +
.../ignite/client/ClientTestRestServer.java | 275 +
.../client/ClientTopologyCacheSelfTest.java | 289 +
.../org/apache/ignite/client/HashMapStore.java | 53 +
.../org/apache/ignite/client/SleepTestTask.java | 68 +
.../client/TaskSingleJobSplitAdapter.java | 75 +
.../client/impl/ClientCacheFlagsCodecTest.java | 83 +
.../client/impl/ClientComputeImplSelfTest.java | 167 +
.../client/impl/ClientDataImplSelfTest.java | 268 +
.../impl/ClientFutureAdapterSelfTest.java | 115 +
.../impl/ClientPartitionAffinitySelfTest.java | 406 +
.../ClientPropertiesConfigurationSelfTest.java | 232 +
.../ClientAbstractConnectivitySelfTest.java | 303 +
.../ClientAbstractMultiNodeSelfTest.java | 857 ++
.../integration/ClientAbstractSelfTest.java | 1604 ++
.../integration/ClientPreferDirectSelfTest.java | 193 +
.../ClientTcpConnectivitySelfTest.java | 75 +
.../ClientTcpDirectMultiNodeSelfTest.java | 55 +
.../integration/ClientTcpDirectSelfTest.java | 58 +
.../integration/ClientTcpMultiNodeSelfTest.java | 35 +
.../client/integration/ClientTcpSelfTest.java | 46 +
.../ClientTcpSslDirectMultiNodeSelfTest.java | 62 +
.../integration/ClientTcpSslDirectSelfTest.java | 59 +
.../ClientTcpSslMultiNodeSelfTest.java | 42 +
.../integration/ClientTcpSslSelfTest.java | 47 +
.../ClientTcpUnreachableMultiNodeSelfTest.java | 146 +
.../ignite/client/integration/package.html | 24 +
.../client/router/ClientFailedInitSelfTest.java | 275 +
.../client/router/RouterFactorySelfTest.java | 107 +
.../router/TcpRouterAbstractSelfTest.java | 125 +
.../router/TcpRouterMultiNodeSelfTest.java | 110 +
.../ignite/client/router/TcpRouterSelfTest.java | 35 +
.../client/router/TcpSslRouterSelfTest.java | 48 +
.../apache/ignite/client/router/package.html | 24 +
.../testsuites/IgniteRouterTestSuite.java | 41 +
.../client/suite/IgniteClientTestSuite.java | 118 +
.../ignite/client/util/ClientByteUtilsTest.java | 172 +
.../util/ClientConsistentHashSelfTest.java | 281 +
.../client/util/ClientJavaHasherSelfTest.java | 84 +
.../internal/TaskEventSubjectIdSelfTest.java | 392 +
.../rest/AbstractRestProcessorSelfTest.java | 97 +
.../rest/ClientMemcachedProtocolSelfTest.java | 443 +
.../JettyRestProcessorAbstractSelfTest.java | 724 +
.../rest/JettyRestProcessorSignedSelfTest.java | 103 +
.../JettyRestProcessorUnsignedSelfTest.java | 36 +
.../rest/MemcacheRestProcessorTest.java | 76 +
.../rest/RestBinaryProtocolSelfTest.java | 634 +
.../rest/RestMemcacheProtocolSelfTest.java | 332 +
.../rest/RestProcessorMultiStartSelfTest.java | 55 +
.../rest/RestProcessorStartSelfTest.java | 164 +
.../processors/rest/RestProcessorTest.java | 346 +
.../rest/TaskCommandHandlerSelfTest.java | 211 +
.../processors/rest/TestBinaryClient.java | 651 +
.../processors/rest/TestMemcacheClient.java | 898 ++
.../internal/processors/rest/TestTask1.java | 52 +
.../internal/processors/rest/TestTask2.java | 54 +
.../rest/protocols/tcp/MockNioSession.java | 155 +
.../protocols/tcp/TcpRestParserSelfTest.java | 451 +
.../ignite/jdbc/JdbcComplexQuerySelfTest.java | 316 +
.../ignite/jdbc/JdbcConnectionSelfTest.java | 219 +
.../ignite/jdbc/JdbcEmptyCacheSelfTest.java | 136 +
.../ignite/jdbc/JdbcLocalCachesSelfTest.java | 158 +
.../ignite/jdbc/JdbcMetadataSelfTest.java | 336 +
.../jdbc/JdbcPreparedStatementSelfTest.java | 726 +
.../ignite/jdbc/JdbcResultSetSelfTest.java | 715 +
.../ignite/jdbc/JdbcStatementSelfTest.java | 286 +
.../jdbc/suite/IgniteJdbcDriverTestSuite.java | 45 +
.../loadtests/client/ClientCacheBenchmark.java | 259 +
.../client/ClientMarshallerBenchmarkTest.java | 156 +
.../loadtests/client/ClientTcpSslLoadTest.java | 83 +
...GridClientAbstractMultiThreadedSelfTest.java | 610 -
.../client/GridClientDefaultCacheSelfTest.java | 149 -
.../client/GridClientGetAffinityTask.java | 57 -
.../org/gridgain/client/GridClientHttpTask.java | 51 -
.../gridgain/client/GridClientNodeStartup.java | 50 -
.../client/GridClientPortableArgumentTask.java | 45 -
.../client/GridClientPutPortableTask.java | 37 -
.../client/GridClientReconnectionSelfTest.java | 227 -
.../client/GridClientSslNodeStartup.java | 52 -
.../client/GridClientStartNodeTask.java | 173 -
.../gridgain/client/GridClientStopNodeTask.java | 120 -
.../client/GridClientStringLengthTask.java | 65 -
.../GridClientTcpMultiThreadedSelfTest.java | 37 -
.../GridClientTcpSslAuthenticationSelfTest.java | 257 -
.../GridClientTcpSslMultiThreadedSelfTest.java | 38 -
.../org/gridgain/client/GridClientTcpTask.java | 65 -
...skExecutionAfterTopologyRestartSelfTest.java | 67 -
.../gridgain/client/GridClientTestPortable.java | 482 -
.../GridClientTestPortableAffinityKeyTask.java | 78 -
.../client/GridClientTestRestServer.java | 268 -
.../client/GridClientTopologyCacheSelfTest.java | 281 -
.../org/gridgain/client/GridHashMapStore.java | 51 -
.../org/gridgain/client/GridSleepTestTask.java | 51 -
.../client/GridTaskSingleJobSplitAdapter.java | 67 -
.../impl/GridClientCacheFlagsCodecTest.java | 74 -
.../impl/GridClientComputeImplSelfTest.java | 159 -
.../client/impl/GridClientDataImplSelfTest.java | 260 -
.../impl/GridClientFutureAdapterSelfTest.java | 107 -
.../GridClientPartitionAffinitySelfTest.java | 398 -
...idClientPropertiesConfigurationSelfTest.java | 224 -
.../GridClientAbstractConnectivitySelfTest.java | 295 -
.../GridClientAbstractMultiNodeSelfTest.java | 852 --
.../integration/GridClientAbstractSelfTest.java | 1589 --
.../GridClientPreferDirectSelfTest.java | 186 -
.../GridClientTcpConnectivitySelfTest.java | 67 -
.../GridClientTcpDirectMultiNodeSelfTest.java | 47 -
.../GridClientTcpDirectSelfTest.java | 50 -
.../GridClientTcpMultiNodeSelfTest.java | 27 -
.../integration/GridClientTcpSelfTest.java | 38 -
...GridClientTcpSslDirectMultiNodeSelfTest.java | 54 -
.../GridClientTcpSslDirectSelfTest.java | 51 -
.../GridClientTcpSslMultiNodeSelfTest.java | 34 -
.../integration/GridClientTcpSslSelfTest.java | 39 -
...idClientTcpUnreachableMultiNodeSelfTest.java | 138 -
.../gridgain/client/integration/package.html | 15 -
.../router/GridClientFailedInitSelfTest.java | 268 -
.../router/GridRouterFactorySelfTest.java | 99 -
.../router/GridTcpRouterAbstractSelfTest.java | 117 -
.../router/GridTcpRouterMultiNodeSelfTest.java | 93 -
.../client/router/GridTcpRouterSelfTest.java | 18 -
.../client/router/GridTcpSslRouterSelfTest.java | 32 -
.../org/gridgain/client/router/package.html | 15 -
.../router/testsuites/GridRouterTestSuite.java | 33 -
.../client/suite/GridClientTestSuite.java | 110 -
.../client/util/GridClientByteUtilsTest.java | 164 -
.../util/GridClientConsistentHashSelfTest.java | 273 -
.../util/GridClientJavaHasherSelfTest.java | 76 -
.../kernal/GridTaskEventSubjectIdSelfTest.java | 385 -
.../rest/GridAbstractRestProcessorSelfTest.java | 87 -
.../GridClientMemcachedProtocolSelfTest.java | 435 -
.../GridJettyRestProcessorAbstractSelfTest.java | 716 -
.../GridJettyRestProcessorSignedSelfTest.java | 95 -
.../GridJettyRestProcessorUnsignedSelfTest.java | 28 -
.../rest/GridMemcacheRestProcessorTest.java | 68 -
.../rest/GridRestBinaryProtocolSelfTest.java | 625 -
.../rest/GridRestMemcacheProtocolSelfTest.java | 324 -
.../GridRestProcessorMultiStartSelfTest.java | 47 -
.../rest/GridRestProcessorStartSelfTest.java | 155 -
.../processors/rest/GridRestProcessorTest.java | 338 -
.../rest/GridTaskCommandHandlerSelfTest.java | 204 -
.../processors/rest/GridTestBinaryClient.java | 644 -
.../processors/rest/GridTestMemcacheClient.java | 891 --
.../grid/kernal/processors/rest/TestTask1.java | 44 -
.../grid/kernal/processors/rest/TestTask2.java | 46 -
.../rest/protocols/tcp/GridMockNioSession.java | 146 -
.../tcp/GridTcpRestParserSelfTest.java | 443 -
.../jdbc/GridJdbcComplexQuerySelfTest.java | 308 -
.../jdbc/GridJdbcConnectionSelfTest.java | 211 -
.../jdbc/GridJdbcEmptyCacheSelfTest.java | 128 -
.../jdbc/GridJdbcLocalCachesSelfTest.java | 150 -
.../gridgain/jdbc/GridJdbcMetadataSelfTest.java | 328 -
.../jdbc/GridJdbcPreparedStatementSelfTest.java | 718 -
.../jdbc/GridJdbcResultSetSelfTest.java | 707 -
.../jdbc/GridJdbcStatementSelfTest.java | 278 -
.../jdbc/suite/GridJdbcDriverTestSuite.java | 37 -
.../client/GridClientCacheBenchmark.java | 251 -
.../GridClientMarshallerBenchmarkTest.java | 148 -
.../client/GridClientTcpSslLoadTest.java | 75 -
.../src/test/resources/jetty/rest-jetty-ssl.xml | 22 +-
.../src/test/resources/jetty/rest-jetty.xml | 22 +-
.../test/resources/jetty/router-jetty-ssl.xml | 22 +-
.../src/test/resources/jetty/router-jetty.xml | 22 +-
modules/clients/src/test/resources/log4j.xml | 24 +-
.../clients/src/test/resources/spring-cache.xml | 36 +-
.../src/test/resources/spring-router-ssl.xml | 28 +-
.../src/test/resources/spring-router.xml | 26 +-
.../src/test/resources/spring-server-node.xml | 56 +-
.../test/resources/spring-server-ssl-node.xml | 50 +-
modules/core/pom.xml | 24 +-
.../java/META-INF/native/linux64/libggshmem.so | Bin 138023 -> 0 bytes
.../META-INF/native/linux64/libigniteshmem.so | Bin 0 -> 138345 bytes
.../java/META-INF/native/osx/libggshmem.dylib | Bin 32940 -> 0 bytes
.../META-INF/native/osx/libigniteshmem.dylib | Bin 0 -> 33116 bytes
.../services/javax.cache.spi.CachingProvider | 1 +
.../src/main/java/org/apache/ignite/Ignite.java | 43 +-
.../ignite/IgniteAuthenticationException.java | 35 +
.../apache/ignite/IgniteBasicWarmupClosure.java | 560 +
.../java/org/apache/ignite/IgniteCache.java | 292 +-
.../apache/ignite/IgniteCheckedException.java | 26 +-
.../java/org/apache/ignite/IgniteCluster.java | 47 +-
.../java/org/apache/ignite/IgniteCompute.java | 33 +-
.../org/apache/ignite/IgniteDataLoader.java | 82 +-
.../ignite/IgniteDeploymentException.java | 57 +
.../java/org/apache/ignite/IgniteEvents.java | 45 +-
.../java/org/apache/ignite/IgniteException.java | 28 +-
.../main/java/org/apache/ignite/IgniteFs.java | 34 +-
.../ignite/IgniteIllegalStateException.java | 84 +
.../ignite/IgniteInterruptedException.java | 56 +
.../java/org/apache/ignite/IgniteLogger.java | 24 +-
.../java/org/apache/ignite/IgniteManaged.java | 53 +-
.../java/org/apache/ignite/IgniteMessaging.java | 28 +-
.../java/org/apache/ignite/IgnitePortables.java | 39 +-
.../java/org/apache/ignite/IgniteScheduler.java | 28 +-
.../java/org/apache/ignite/IgniteState.java | 22 +-
.../java/org/apache/ignite/IgniteStreamer.java | 23 +-
.../apache/ignite/IgniteSystemProperties.java | 41 +-
.../org/apache/ignite/IgniteTransactions.java | 36 +-
.../main/java/org/apache/ignite/Ignition.java | 75 +-
.../CacheAtomicUpdateTimeoutException.java | 47 +
.../ignite/cache/CacheAtomicWriteOrderMode.java | 64 +
.../apache/ignite/cache/CacheAtomicityMode.java | 79 +
.../apache/ignite/cache/CacheConfiguration.java | 1803 ++-
.../ignite/cache/CacheDistributionMode.java | 69 +
.../org/apache/ignite/cache/CacheEntry.java | 622 +
.../apache/ignite/cache/CacheEntryEvent.java | 77 +-
.../java/org/apache/ignite/cache/CacheFlag.java | 69 -
.../apache/ignite/cache/CacheInterceptor.java | 120 +
.../ignite/cache/CacheInterceptorAdapter.java | 52 +
.../org/apache/ignite/cache/CacheManager.java | 442 +
.../apache/ignite/cache/CacheMemoryMode.java | 59 +
.../org/apache/ignite/cache/CacheMetrics.java | 455 +
.../java/org/apache/ignite/cache/CacheMode.java | 73 +
.../java/org/apache/ignite/cache/CacheName.java | 41 +
.../cache/CachePartialUpdateException.java | 44 +
.../org/apache/ignite/cache/CachePeekMode.java | 32 +-
.../apache/ignite/cache/CachePreloadMode.java | 67 +
.../apache/ignite/cache/CacheProjection.java | 1920 +++
.../cache/CacheWriteSynchronizationMode.java | 69 +
.../apache/ignite/cache/CachingProvider.java | 189 +
.../java/org/apache/ignite/cache/GridCache.java | 282 +
.../apache/ignite/cache/GridCachePeekMode.java | 85 +
.../ignite/cache/GridCacheVersionedEntry.java | 82 +
.../ignite/cache/affinity/CacheAffinity.java | 257 +
.../cache/affinity/CacheAffinityFunction.java | 111 +
.../affinity/CacheAffinityFunctionContext.java | 71 +
.../ignite/cache/affinity/CacheAffinityKey.java | 189 +
.../cache/affinity/CacheAffinityKeyMapped.java | 156 +
.../cache/affinity/CacheAffinityKeyMapper.java | 64 +
.../CacheAffinityNodeAddressHashResolver.java | 39 +
.../affinity/CacheAffinityNodeHashResolver.java | 43 +
.../CacheAffinityNodeIdHashResolver.java | 40 +
.../CacheCentralizedAffinityFunction.java | 31 +
.../CacheConsistentHashAffinityFunction.java | 702 +
.../cache/affinity/consistenthash/package.html | 24 +
.../fair/CachePartitionFairAffinity.java | 805 +
.../ignite/cache/affinity/fair/package.html | 24 +
.../apache/ignite/cache/affinity/package.html | 24 +
.../CacheRendezvousAffinityFunction.java | 502 +
.../cache/affinity/rendezvous/package.html | 23 +
.../ignite/cache/cloner/CacheBasicCloner.java | 34 +
.../apache/ignite/cache/cloner/CacheCloner.java | 58 +
.../ignite/cache/cloner/CacheDeepCloner.java | 87 +
.../org/apache/ignite/cache/cloner/package.html | 24 +
.../cache/datastructures/CacheAtomicLong.java | 157 +
.../datastructures/CacheAtomicReference.java | 93 +
.../datastructures/CacheAtomicSequence.java | 130 +
.../datastructures/CacheAtomicStamped.java | 121 +
.../datastructures/CacheCountDownLatch.java | 226 +
.../CacheDataStructureInvalidException.java | 66 +
...cheDataStructureInvalidRuntimeException.java | 66 +
.../CacheDataStructureRemovedException.java | 61 +
...cheDataStructureRemovedRuntimeException.java | 61 +
.../datastructures/CacheDataStructures.java | 220 +
.../ignite/cache/datastructures/CacheQueue.java | 182 +
.../ignite/cache/datastructures/CacheSet.java | 61 +
.../ignite/cache/datastructures/package.html | 24 +
.../cache/eviction/CacheEvictionFilter.java | 40 +
.../cache/eviction/CacheEvictionPolicy.java | 53 +
.../ignite/cache/eviction/EvictableEntry.java | 24 +-
.../eviction/fifo/CacheFifoEvictionPolicy.java | 207 +
.../fifo/CacheFifoEvictionPolicyMBean.java | 58 +
.../ignite/cache/eviction/fifo/package.html | 23 +
.../eviction/ggfs/CacheGgfsEvictionFilter.java | 34 +
.../CacheGgfsPerBlockLruEvictionPolicy.java | 353 +
...CacheGgfsPerBlockLruEvictionPolicyMBean.java | 93 +
.../ignite/cache/eviction/ggfs/package.html | 23 +
.../eviction/lru/CacheLruEvictionPolicy.java | 193 +
.../lru/CacheLruEvictionPolicyMBean.java | 58 +
.../ignite/cache/eviction/lru/package.html | 23 +
.../apache/ignite/cache/eviction/package.html | 23 +
.../random/CacheRandomEvictionPolicy.java | 118 +
.../random/CacheRandomEvictionPolicyMBean.java | 42 +
.../ignite/cache/eviction/random/package.html | 23 +
.../java/org/apache/ignite/cache/package.html | 24 +
.../cache/query/CacheContinuousQuery.java | 341 +
.../cache/query/CacheContinuousQueryEntry.java | 49 +
.../apache/ignite/cache/query/CacheQueries.java | 152 +
.../apache/ignite/cache/query/CacheQuery.java | 295 +
.../cache/query/CacheQueryConfiguration.java | 203 +
.../ignite/cache/query/CacheQueryFuture.java | 66 +
.../cache/query/CacheQueryGroupIndex.java | 58 +
.../ignite/cache/query/CacheQueryMetrics.java | 60 +
.../ignite/cache/query/CacheQuerySqlField.java | 133 +
.../cache/query/CacheQuerySqlFunction.java | 69 +
.../ignite/cache/query/CacheQueryTextField.java | 33 +
.../ignite/cache/query/CacheQueryType.java | 47 +
.../cache/query/CacheQueryTypeMetadata.java | 196 +
.../cache/query/CacheQueryTypeResolver.java | 32 +
.../cache/query/QueryAffinityPredicate.java | 24 +-
.../cache/query/QueryContinuousPredicate.java | 30 +-
.../apache/ignite/cache/query/QueryCursor.java | 22 +-
.../ignite/cache/query/QueryPredicate.java | 24 +-
.../apache/ignite/cache/query/QueryReducer.java | 22 +-
.../ignite/cache/query/QuerySqlPredicate.java | 24 +-
.../ignite/cache/query/QueryTextPredicate.java | 24 +-
.../query/annotations/QueryGroupIndex.java | 22 +-
.../cache/query/annotations/QuerySqlField.java | 26 +-
.../query/annotations/QuerySqlFunction.java | 24 +-
.../cache/query/annotations/QueryTextField.java | 26 +-
.../org/apache/ignite/cache/query/package.html | 23 +
.../cache/store/CacheLoadOnlyStoreAdapter.java | 323 +
.../ignite/cache/store/CacheLocalStore.java | 31 +
.../apache/ignite/cache/store/CacheStore.java | 178 +
.../ignite/cache/store/CacheStoreAdapter.java | 94 +
.../cache/store/CacheStoreBalancingWrapper.java | 296 +
.../ignite/cache/store/CacheStoreSession.java | 43 +
.../cache/store/jdbc/CacheJdbcBlobStore.java | 584 +
.../apache/ignite/cache/store/jdbc/package.html | 24 +
.../org/apache/ignite/cache/store/package.html | 23 +
.../org/apache/ignite/client/GridClient.java | 148 +
.../GridClientAuthenticationException.java | 35 +
.../ignite/client/GridClientCacheFlag.java | 65 +
.../ignite/client/GridClientCacheMode.java | 32 +
.../client/GridClientClosedException.java | 35 +
.../apache/ignite/client/GridClientCompute.java | 476 +
.../ignite/client/GridClientConfiguration.java | 868 ++
.../apache/ignite/client/GridClientData.java | 443 +
.../ignite/client/GridClientDataAffinity.java | 39 +
.../client/GridClientDataConfiguration.java | 118 +
.../ignite/client/GridClientDataMetrics.java | 77 +
.../client/GridClientDisconnectedException.java | 36 +
.../ignite/client/GridClientException.java | 111 +
.../apache/ignite/client/GridClientFactory.java | 138 +
.../apache/ignite/client/GridClientFuture.java | 68 +
.../ignite/client/GridClientFutureListener.java | 30 +
.../GridClientFutureTimeoutException.java | 45 +
.../client/GridClientHandshakeException.java | 48 +
.../apache/ignite/client/GridClientNode.java | 152 +
.../ignite/client/GridClientNodeMetrics.java | 524 +
.../client/GridClientPartitionAffinity.java | 369 +
.../ignite/client/GridClientPredicate.java | 38 +
.../ignite/client/GridClientProtocol.java | 30 +
.../client/GridClientTopologyListener.java | 41 +
.../client/GridServerUnreachableException.java | 45 +
.../balancer/GridClientBalancerAdapter.java | 76 +
.../client/balancer/GridClientLoadBalancer.java | 44 +
.../balancer/GridClientRandomBalancer.java | 75 +
.../balancer/GridClientRoundRobinBalancer.java | 111 +
.../apache/ignite/client/balancer/package.html | 24 +
.../impl/GridClientAbstractProjection.java | 458 +
.../client/impl/GridClientAndPredicate.java | 52 +
.../client/impl/GridClientComputeImpl.java | 293 +
.../ignite/client/impl/GridClientDataImpl.java | 389 +
.../impl/GridClientDataMetricsAdapter.java | 160 +
.../client/impl/GridClientFutureAdapter.java | 349 +
.../client/impl/GridClientFutureCallback.java | 35 +
.../ignite/client/impl/GridClientImpl.java | 524 +
.../ignite/client/impl/GridClientNodeImpl.java | 411 +
.../impl/GridClientNodeMetricsAdapter.java | 990 ++
.../client/impl/GridClientThreadFactory.java | 62 +
.../impl/connection/GridClientConnection.java | 531 +
.../GridClientConnectionCloseReason.java | 32 +
.../connection/GridClientConnectionManager.java | 71 +
.../GridClientConnectionManagerAdapter.java | 699 +
.../GridClientConnectionManagerOsImpl.java | 47 +
.../GridClientConnectionResetException.java | 48 +
.../connection/GridClientNioTcpConnection.java | 1159 ++
.../impl/connection/GridClientTopology.java | 450 +
.../GridConnectionIdleClosedException.java | 36 +
.../org/apache/ignite/client/impl/package.html | 23 +
.../client/marshaller/GridClientMarshaller.java | 45 +
.../marshaller/jdk/GridClientJdkMarshaller.java | 68 +
.../ignite/client/marshaller/jdk/package.html | 24 +
.../GridClientOptimizedMarshaller.java | 103 +
.../client/marshaller/optimized/package.html | 24 +
.../ignite/client/marshaller/package.html | 23 +
.../java/org/apache/ignite/client/package.html | 23 +
.../ignite/client/router/GridRouterFactory.java | 121 +
.../ignite/client/router/GridTcpRouter.java | 76 +
.../router/GridTcpRouterConfiguration.java | 306 +
.../client/router/GridTcpRouterMBean.java | 88 +
.../router/impl/GridRouterClientImpl.java | 200 +
.../impl/GridRouterCommandLineStartup.java | 164 +
.../client/router/impl/GridTcpRouterImpl.java | 348 +
.../impl/GridTcpRouterNioListenerAdapter.java | 203 +
.../impl/GridTcpRouterNioListenerOsImpl.java | 38 +
.../router/impl/GridTcpRouterNioParser.java | 109 +
.../ignite/client/router/impl/package.html | 23 +
.../apache/ignite/client/router/package.html | 23 +
.../client/ssl/GridSslBasicContextFactory.java | 438 +
.../client/ssl/GridSslContextFactory.java | 36 +
.../org/apache/ignite/client/ssl/package.html | 24 +
.../client/util/GridClientConsistentHash.java | 440 +
.../client/util/GridClientStripedLock.java | 135 +
.../ignite/client/util/GridClientUtils.java | 171 +
.../client/util/GridConcurrentHashSet.java | 113 +
.../org/apache/ignite/client/util/package.html | 24 +
.../org/apache/ignite/cluster/ClusterGroup.java | 23 +-
.../cluster/ClusterGroupEmptyException.java | 22 +-
.../apache/ignite/cluster/ClusterMetrics.java | 719 +-
.../org/apache/ignite/cluster/ClusterNode.java | 37 +-
.../ignite/cluster/ClusterNodeLocalMap.java | 25 +-
.../ignite/cluster/ClusterNodeMetrics.java | 687 -
.../cluster/ClusterTopologyException.java | 22 +-
.../ComputeExecutionRejectedException.java | 22 +-
.../org/apache/ignite/compute/ComputeJob.java | 33 +-
.../ignite/compute/ComputeJobAdapter.java | 24 +-
.../ignite/compute/ComputeJobAfterSend.java | 22 +-
.../compute/ComputeJobBeforeFailover.java | 22 +-
.../ignite/compute/ComputeJobContext.java | 22 +-
.../ignite/compute/ComputeJobContinuation.java | 22 +-
.../compute/ComputeJobContinuationAdapter.java | 22 +-
.../compute/ComputeJobFailoverException.java | 22 +-
.../compute/ComputeJobMasterLeaveAware.java | 17 +
.../apache/ignite/compute/ComputeJobResult.java | 22 +-
.../ignite/compute/ComputeJobResultPolicy.java | 22 +-
.../ignite/compute/ComputeJobSibling.java | 25 +-
.../ignite/compute/ComputeLoadBalancer.java | 29 +-
.../org/apache/ignite/compute/ComputeTask.java | 39 +-
.../ignite/compute/ComputeTaskAdapter.java | 31 +-
.../compute/ComputeTaskCancelledException.java | 22 +-
.../compute/ComputeTaskContinuousMapper.java | 30 +-
.../ignite/compute/ComputeTaskFuture.java | 26 +-
.../ignite/compute/ComputeTaskMapAsync.java | 22 +-
.../apache/ignite/compute/ComputeTaskName.java | 22 +-
.../compute/ComputeTaskNoResultCache.java | 22 +-
.../ignite/compute/ComputeTaskSession.java | 31 +-
.../ComputeTaskSessionAttributeListener.java | 22 +-
.../compute/ComputeTaskSessionFullSupport.java | 22 +-
.../ignite/compute/ComputeTaskSessionScope.java | 22 +-
.../apache/ignite/compute/ComputeTaskSpis.java | 22 +-
.../ignite/compute/ComputeTaskSplitAdapter.java | 26 +-
.../compute/ComputeTaskTimeoutException.java | 22 +-
.../compute/ComputeUserUndeclaredException.java | 22 +-
.../apache/ignite/compute/gridify/Gridify.java | 22 +-
.../ignite/compute/gridify/GridifyArgument.java | 22 +-
.../ignite/compute/gridify/GridifyInput.java | 22 +-
.../compute/gridify/GridifyInterceptor.java | 22 +-
.../compute/gridify/GridifyNodeFilter.java | 22 +-
.../gridify/GridifyRuntimeException.java | 22 +-
.../ignite/compute/gridify/GridifySetToSet.java | 22 +-
.../compute/gridify/GridifySetToValue.java | 22 +-
.../compute/gridify/GridifyTaskAdapter.java | 22 +-
.../gridify/GridifyTaskSplitAdapter.java | 22 +-
.../gridify/aop/GridifyArgumentAdapter.java | 24 +-
.../gridify/aop/GridifyDefaultRangeTask.java | 31 +-
.../compute/gridify/aop/GridifyDefaultTask.java | 29 +-
.../aop/GridifySetToSetAbstractAspect.java | 29 +-
.../aop/GridifySetToValueAbstractAspect.java | 29 +-
.../ignite/compute/gridify/aop/package.html | 24 +-
.../apache/ignite/compute/gridify/package.html | 24 +-
.../java/org/apache/ignite/compute/package.html | 25 +-
.../ClientConnectionConfiguration.java | 24 +-
.../configuration/ClientMessageInterceptor.java | 22 +-
.../configuration/GridQueryConfiguration.java | 27 +-
.../configuration/IgniteAddressResolver.java | 22 +-
.../configuration/IgniteConfiguration.java | 67 +-
.../configuration/IgniteDeploymentMode.java | 57 +-
.../TransactionsConfiguration.java | 22 +-
.../dataload/IgniteDataLoadCacheUpdater.java | 29 +-
.../org/apache/ignite/dataload/package.html | 24 +-
.../events/IgniteAuthenticationEvent.java | 26 +-
.../ignite/events/IgniteAuthorizationEvent.java | 24 +-
.../apache/ignite/events/IgniteCacheEvent.java | 26 +-
.../events/IgniteCachePreloadingEvent.java | 24 +-
.../events/IgniteCacheQueryExecutedEvent.java | 40 +-
.../events/IgniteCacheQueryReadEvent.java | 40 +-
.../ignite/events/IgniteCheckpointEvent.java | 24 +-
.../ignite/events/IgniteDeploymentEvent.java | 24 +-
.../ignite/events/IgniteDiscoveryEvent.java | 26 +-
.../org/apache/ignite/events/IgniteEvent.java | 22 +-
.../ignite/events/IgniteEventAdapter.java | 24 +-
.../ignite/events/IgniteEventLocalOrder.java | 22 +-
.../apache/ignite/events/IgniteEventType.java | 24 +-
.../org/apache/ignite/events/IgniteFsEvent.java | 26 +-
.../apache/ignite/events/IgniteJobEvent.java | 24 +-
.../ignite/events/IgniteLicenseEvent.java | 24 +-
.../ignite/events/IgniteSecureSessionEvent.java | 24 +-
.../ignite/events/IgniteSwapSpaceEvent.java | 19 +-
.../apache/ignite/events/IgniteTaskEvent.java | 24 +-
.../java/org/apache/ignite/events/package.html | 24 +-
.../apache/ignite/fs/IgniteFsBlockLocation.java | 22 +-
...IgniteFsConcurrentModificationException.java | 22 +-
.../apache/ignite/fs/IgniteFsConfiguration.java | 28 +-
.../fs/IgniteFsCorruptedFileException.java | 22 +-
.../org/apache/ignite/fs/IgniteFsException.java | 22 +-
.../java/org/apache/ignite/fs/IgniteFsFile.java | 22 +-
.../fs/IgniteFsFileNotFoundException.java | 22 +-
.../apache/ignite/fs/IgniteFsFileSystem.java | 22 +-
.../fs/IgniteFsGroupDataBlocksKeyMapper.java | 28 +-
.../apache/ignite/fs/IgniteFsInputStream.java | 22 +-
.../fs/IgniteFsInvalidHdfsVersionException.java | 22 +-
.../ignite/fs/IgniteFsInvalidPathException.java | 22 +-
.../org/apache/ignite/fs/IgniteFsMetrics.java | 22 +-
.../java/org/apache/ignite/fs/IgniteFsMode.java | 22 +-
.../ignite/fs/IgniteFsOutOfSpaceException.java | 22 +-
.../apache/ignite/fs/IgniteFsOutputStream.java | 22 +-
.../fs/IgniteFsParentNotDirectoryException.java | 22 +-
.../java/org/apache/ignite/fs/IgniteFsPath.java | 28 +-
.../fs/IgniteFsPathAlreadyExistsException.java | 22 +-
.../apache/ignite/fs/IgniteFsPathSummary.java | 24 +-
.../org/apache/ignite/fs/IgniteFsReader.java | 22 +-
.../ignite/fs/mapreduce/IgniteFsFileRange.java | 24 +-
.../IgniteFsInputStreamJobAdapter.java | 25 +-
.../apache/ignite/fs/mapreduce/IgniteFsJob.java | 23 +-
.../ignite/fs/mapreduce/IgniteFsJobAdapter.java | 22 +-
.../fs/mapreduce/IgniteFsRangeInputStream.java | 24 +-
.../fs/mapreduce/IgniteFsRecordResolver.java | 23 +-
.../ignite/fs/mapreduce/IgniteFsTask.java | 31 +-
.../ignite/fs/mapreduce/IgniteFsTaskArgs.java | 22 +-
.../mapreduce/IgniteFsTaskNoReduceAdapter.java | 22 +-
.../org/apache/ignite/fs/mapreduce/package.html | 24 +-
.../IgniteFsByteDelimiterRecordResolver.java | 29 +-
.../IgniteFsFixedLengthRecordResolver.java | 25 +-
.../records/IgniteFsNewLineRecordResolver.java | 24 +-
.../IgniteFsStringDelimiterRecordResolver.java | 24 +-
.../ignite/fs/mapreduce/records/package.html | 25 +-
.../main/java/org/apache/ignite/fs/package.html | 25 +-
.../org/apache/ignite/hadoop/GridHadoop.java | 86 +
.../ignite/hadoop/GridHadoopConfiguration.java | 172 +
.../apache/ignite/hadoop/GridHadoopCounter.java | 44 +
.../ignite/hadoop/GridHadoopCounterWriter.java | 36 +
.../ignite/hadoop/GridHadoopCounters.java | 49 +
.../ignite/hadoop/GridHadoopFileBlock.java | 162 +
.../ignite/hadoop/GridHadoopInputSplit.java | 54 +
.../org/apache/ignite/hadoop/GridHadoopJob.java | 102 +
.../apache/ignite/hadoop/GridHadoopJobId.java | 102 +
.../apache/ignite/hadoop/GridHadoopJobInfo.java | 83 +
.../ignite/hadoop/GridHadoopJobPhase.java | 38 +
.../ignite/hadoop/GridHadoopJobProperty.java | 138 +
.../ignite/hadoop/GridHadoopJobStatus.java | 207 +
.../ignite/hadoop/GridHadoopMapReducePlan.java | 80 +
.../hadoop/GridHadoopMapReducePlanner.java | 40 +
.../ignite/hadoop/GridHadoopPartitioner.java | 33 +
.../ignite/hadoop/GridHadoopSerialization.java | 54 +
.../apache/ignite/hadoop/GridHadoopTask.java | 72 +
.../ignite/hadoop/GridHadoopTaskContext.java | 189 +
.../ignite/hadoop/GridHadoopTaskInfo.java | 153 +
.../ignite/hadoop/GridHadoopTaskInput.java | 55 +
.../ignite/hadoop/GridHadoopTaskOutput.java | 40 +
.../ignite/hadoop/GridHadoopTaskType.java | 56 +
.../java/org/apache/ignite/hadoop/package.html | 24 +
.../ignite/internal/ClusterGroupAdapter.java | 851 ++
.../apache/ignite/internal/ClusterGroupEx.java | 35 +
.../ClusterLocalNodeMetricsMXBeanImpl.java | 309 +
.../ignite/internal/ClusterMetricsSnapshot.java | 1397 ++
.../internal/ClusterNodeLocalMapImpl.java | 103 +
.../ignite/internal/GridClosureCallMode.java | 61 +
.../apache/ignite/internal/GridComponent.java | 96 +
.../apache/ignite/internal/GridDiagnostic.java | 172 +
.../ignite/internal/GridDirectCollection.java | 32 +
.../apache/ignite/internal/GridDirectMap.java | 37 +
.../ignite/internal/GridDirectTransient.java | 29 +
.../ignite/internal/GridDirectVersion.java | 32 +
.../internal/GridEventConsumeHandler.java | 415 +
.../ignite/internal/GridInternalException.java | 69 +
.../ignite/internal/GridInternalWrapper.java | 30 +
.../ignite/internal/GridJobCancelRequest.java | 211 +
.../ignite/internal/GridJobContextImpl.java | 282 +
.../ignite/internal/GridJobExecuteRequest.java | 919 ++
.../ignite/internal/GridJobExecuteResponse.java | 362 +
.../ignite/internal/GridJobResultImpl.java | 182 +
.../ignite/internal/GridJobSessionImpl.java | 288 +
.../ignite/internal/GridJobSiblingImpl.java | 190 +
.../ignite/internal/GridJobSiblingsRequest.java | 171 +
.../internal/GridJobSiblingsResponse.java | 149 +
.../ignite/internal/GridKernalContext.java | 503 +
.../ignite/internal/GridKernalContextImpl.java | 836 ++
.../ignite/internal/GridKernalGateway.java | 131 +
.../ignite/internal/GridKernalGatewayImpl.java | 227 +
.../apache/ignite/internal/GridKernalState.java | 51 +
.../apache/ignite/internal/GridKillTask.java | 105 +
.../apache/ignite/internal/GridLoggerProxy.java | 217 +
.../internal/GridMessageListenHandler.java | 200 +
.../ignite/internal/GridNodeAttributes.java | 145 +
.../internal/GridNodeOrderComparator.java | 36 +
.../internal/GridPerformanceSuggestions.java | 90 +
.../ignite/internal/GridPluginComponent.java | 97 +
.../ignite/internal/GridPluginContext.java | 102 +
.../ignite/internal/GridPortablesImpl.java | 174 +
.../apache/ignite/internal/GridProductImpl.java | 191 +
.../apache/ignite/internal/GridProperties.java | 82 +
.../ignite/internal/GridProxyListener.java | 51 +
.../ignite/internal/GridTaskCancelRequest.java | 132 +
.../ignite/internal/GridTaskFutureImpl.java | 122 +
.../apache/ignite/internal/GridTaskMessage.java | 30 +
.../ignite/internal/GridTaskNameHashKey.java | 75 +
.../ignite/internal/GridTaskSessionImpl.java | 839 ++
.../internal/GridTaskSessionInternal.java | 69 +
.../ignite/internal/GridTaskSessionRequest.java | 200 +
.../org/apache/ignite/internal/GridTopic.java | 832 ++
.../ignite/internal/GridUpdateNotifier.java | 376 +
.../ignite/internal/IgniteClusterAsyncImpl.java | 233 +
.../ignite/internal/IgniteComponentType.java | 283 +
.../ignite/internal/IgniteComputeImpl.java | 468 +
.../ignite/internal/IgniteEventsImpl.java | 296 +
.../org/apache/ignite/internal/IgniteEx.java | 143 +
.../ignite/internal/IgniteInternalFuture.java | 190 +
.../apache/ignite/internal/IgniteKernal.java | 3322 +++++
.../ignite/internal/IgniteManagedImpl.java | 264 +
.../ignite/internal/IgniteMessagingImpl.java | 223 +
.../ignite/internal/IgniteSchedulerImpl.java | 140 +
.../internal/IgniteThreadPoolMXBeanAdapter.java | 129 +
.../ignite/internal/IgniteTransactionsEx.java | 41 +
.../org/apache/ignite/internal/IgnitionEx.java | 2396 +++
.../ignite/internal/IgnitionMXBeanAdapter.java | 59 +
.../internal/executor/GridExecutorService.java | 735 +
.../ignite/internal/executor/package.html | 23 +
.../fs/common/GridGgfsControlResponse.java | 633 +
.../fs/common/GridGgfsDataInputStream.java | 40 +
.../fs/common/GridGgfsDataOutputStream.java | 43 +
.../fs/common/GridGgfsHandshakeRequest.java | 93 +
.../internal/fs/common/GridGgfsIpcCommand.java | 98 +
.../internal/fs/common/GridGgfsLogger.java | 767 +
.../internal/fs/common/GridGgfsMarshaller.java | 374 +
.../internal/fs/common/GridGgfsMessage.java | 41 +
.../fs/common/GridGgfsPathControlRequest.java | 238 +
.../fs/common/GridGgfsStatusRequest.java | 35 +
.../fs/common/GridGgfsStreamControlRequest.java | 101 +
.../ignite/internal/fs/common/package.html | 23 +
.../ignite/internal/managers/GridManager.java | 46 +
.../internal/managers/GridManagerAdapter.java | 612 +
.../managers/GridNoopManagerAdapter.java | 88 +
.../checkpoint/GridCheckpointManager.java | 447 +
.../checkpoint/GridCheckpointRequest.java | 185 +
.../internal/managers/checkpoint/package.html | 23 +
.../GridCollisionJobContextAdapter.java | 62 +
.../collision/GridCollisionManager.java | 133 +
.../internal/managers/collision/package.html | 23 +
.../communication/GridDisconnectListener.java | 34 +
.../managers/communication/GridIoManager.java | 2153 +++
.../managers/communication/GridIoMessage.java | 344 +
.../managers/communication/GridIoPolicy.java | 57 +
.../communication/GridIoUserMessage.java | 435 +
.../communication/GridMessageListener.java | 34 +
.../managers/communication/package.html | 23 +
.../managers/deployment/GridDeployment.java | 775 +
.../deployment/GridDeploymentClassLoader.java | 801 +
.../deployment/GridDeploymentCommunication.java | 485 +
.../managers/deployment/GridDeploymentInfo.java | 58 +
.../deployment/GridDeploymentInfoBean.java | 355 +
.../deployment/GridDeploymentLocalStore.java | 557 +
.../deployment/GridDeploymentManager.java | 614 +
.../deployment/GridDeploymentMetadata.java | 290 +
.../GridDeploymentPerLoaderStore.java | 521 +
.../GridDeploymentPerVersionStore.java | 1281 ++
.../deployment/GridDeploymentRequest.java | 330 +
.../deployment/GridDeploymentResponse.java | 208 +
.../deployment/GridDeploymentStore.java | 98 +
.../deployment/GridDeploymentStoreAdapter.java | 158 +
.../internal/managers/deployment/package.html | 23 +
.../protocol/gg/GridProtocolHandler.java | 53 +
.../protocol/gg/GridUrlConnection.java | 74 +
.../deployment/protocol/gg/package.html | 23 +
.../discovery/GridDiscoveryManager.java | 2178 +++
.../GridDiscoveryTopologySnapshot.java | 62 +
.../managers/discovery/GridLocalMetrics.java | 216 +
.../internal/managers/discovery/package.html | 23 +
.../eventstorage/GridEventStorageManager.java | 1152 ++
.../eventstorage/GridEventStorageMessage.java | 523 +
.../eventstorage/GridLocalEventListener.java | 39 +
.../internal/managers/eventstorage/package.html | 23 +
.../failover/GridFailoverContextImpl.java | 82 +
.../managers/failover/GridFailoverManager.java | 66 +
.../internal/managers/failover/package.html | 24 +
.../managers/indexing/GridIndexingManager.java | 232 +
.../internal/managers/indexing/package.html | 24 +
.../loadbalancer/GridLoadBalancerAdapter.java | 50 +
.../loadbalancer/GridLoadBalancerManager.java | 163 +
.../internal/managers/loadbalancer/package.html | 23 +
.../ignite/internal/managers/package.html | 23 +
.../securesession/GridSecureSession.java | 54 +
.../securesession/GridSecureSessionManager.java | 54 +
.../os/GridOsSecureSessionManager.java | 56 +
.../managers/securesession/os/package.html | 23 +
.../managers/securesession/package.html | 23 +
.../security/GridAllowAllPermissionSet.java | 55 +
.../managers/security/GridSecurityContext.java | 248 +
.../managers/security/GridSecurityImpl.java | 84 +
.../managers/security/GridSecurityManager.java | 93 +
.../security/GridSecuritySubjectAdapter.java | 131 +
.../security/os/GridOsSecurityManager.java | 97 +
.../internal/managers/security/os/package.html | 23 +
.../internal/managers/security/package.html | 23 +
.../swapspace/GridSwapSpaceManager.java | 426 +
.../internal/managers/swapspace/package.html | 23 +
.../internal/mxbean/IgniteStandardMXBean.java | 277 +
.../apache/ignite/internal/mxbean/package.html | 24 +
.../org/apache/ignite/internal/package.html | 24 +
.../internal/processors/GridProcessor.java | 38 +
.../processors/GridProcessorAdapter.java | 125 +
.../affinity/GridAffinityAssignment.java | 174 +
.../affinity/GridAffinityAssignmentCache.java | 408 +
.../affinity/GridAffinityMessage.java | 164 +
.../affinity/GridAffinityProcessor.java | 832 ++
.../processors/affinity/GridAffinityUtils.java | 187 +
.../GridCacheAffinityFunctionContextImpl.java | 83 +
.../internal/processors/affinity/package.html | 23 +
.../processors/cache/CacheEntryImpl.java | 64 +
.../internal/processors/cache/CacheFlag.java | 110 +
.../processors/cache/CacheFlagException.java | 67 +
.../processors/cache/CacheInvokeEntry.java | 100 +
.../processors/cache/CacheInvokeResult.java | 104 +
.../cache/CacheIteratorConverter.java | 39 +
.../processors/cache/CacheLockImpl.java | 204 +
.../processors/cache/CacheMetricsImpl.java | 586 +
.../cache/CacheMetricsMXBeanImpl.java | 310 +
.../processors/cache/CacheMetricsSnapshot.java | 518 +
.../CachePartialUpdateCheckedException.java | 64 +
.../cache/CacheStorePartialUpdateException.java | 48 +
.../cache/CacheWeakQueryIteratorsHolder.java | 228 +
.../processors/cache/GridCacheAdapter.java | 5807 ++++++++
.../cache/GridCacheAffinityManager.java | 378 +
.../processors/cache/GridCacheAtomicFuture.java | 47 +
.../cache/GridCacheAtomicVersionComparator.java | 60 +
.../processors/cache/GridCacheAttributes.java | 634 +
.../cache/GridCacheBatchSwapEntry.java | 90 +
.../cache/GridCacheClearAllRunnable.java | 174 +
.../cache/GridCacheConcurrentMap.java | 2418 +++
.../processors/cache/GridCacheContext.java | 1912 +++
.../GridCacheDefaultAffinityKeyMapper.java | 136 +
.../processors/cache/GridCacheDeployable.java | 37 +
.../cache/GridCacheDeploymentManager.java | 951 ++
.../processors/cache/GridCacheEntryEx.java | 1000 ++
.../processors/cache/GridCacheEntryImpl.java | 729 +
.../processors/cache/GridCacheEntryInfo.java | 335 +
.../GridCacheEntryInfoCollectSwapListener.java | 88 +
.../cache/GridCacheEntryRedeployException.java | 35 +
.../cache/GridCacheEntryRemovedException.java | 28 +
.../processors/cache/GridCacheEntrySet.java | 111 +
.../processors/cache/GridCacheEventManager.java | 254 +
.../cache/GridCacheEvictionEntry.java | 494 +
.../cache/GridCacheEvictionManager.java | 2041 +++
.../cache/GridCacheEvictionRequest.java | 250 +
.../cache/GridCacheEvictionResponse.java | 281 +
.../cache/GridCacheExplicitLockSpan.java | 279 +
.../cache/GridCacheFilterEvaluationEntry.java | 400 +
.../cache/GridCacheFilterFailedException.java | 58 +
.../processors/cache/GridCacheFuture.java | 63 +
.../processors/cache/GridCacheGateway.java | 155 +
.../cache/GridCacheIndexUpdateException.java | 45 +
.../processors/cache/GridCacheInternal.java | 27 +
.../processors/cache/GridCacheIoManager.java | 848 ++
.../processors/cache/GridCacheIterator.java | 86 +
.../processors/cache/GridCacheKeySet.java | 110 +
.../cache/GridCacheLoaderWriterStore.java | 140 +
.../cache/GridCacheLockTimeoutException.java | 35 +
.../processors/cache/GridCacheLogger.java | 188 +
.../processors/cache/GridCacheManager.java | 57 +
.../cache/GridCacheManagerAdapter.java | 166 +
.../processors/cache/GridCacheMapAdapter.java | 173 +
.../processors/cache/GridCacheMapEntry.java | 4276 ++++++
.../cache/GridCacheMapEntryFactory.java | 39 +
.../processors/cache/GridCacheMessage.java | 732 +
.../cache/GridCacheMultiTxFuture.java | 146 +
.../processors/cache/GridCacheMvcc.java | 1259 ++
.../processors/cache/GridCacheMvccCallback.java | 53 +
.../cache/GridCacheMvccCandidate.java | 708 +
.../processors/cache/GridCacheMvccFuture.java | 30 +
.../processors/cache/GridCacheMvccManager.java | 1180 ++
.../cache/GridCacheOffheapSwapEntry.java | 194 +
.../processors/cache/GridCacheOperation.java | 60 +
.../GridCachePartitionExchangeManager.java | 1023 ++
.../processors/cache/GridCachePreloader.java | 129 +
.../cache/GridCachePreloaderAdapter.java | 141 +
.../processors/cache/GridCacheProcessor.java | 1893 +++
.../processors/cache/GridCacheProjectionEx.java | 456 +
.../cache/GridCacheProjectionImpl.java | 1438 ++
.../processors/cache/GridCacheProxy.java | 27 +
.../processors/cache/GridCacheProxyImpl.java | 1918 +++
.../processors/cache/GridCacheReturn.java | 170 +
.../cache/GridCacheSharedContext.java | 507 +
.../cache/GridCacheSharedManager.java | 57 +
.../cache/GridCacheSharedManagerAdapter.java | 166 +
.../processors/cache/GridCacheStoreManager.java | 1141 ++
.../processors/cache/GridCacheSwapEntry.java | 82 +
.../cache/GridCacheSwapEntryImpl.java | 345 +
.../processors/cache/GridCacheSwapListener.java | 31 +
.../processors/cache/GridCacheSwapManager.java | 1616 ++
.../processors/cache/GridCacheTtlManager.java | 219 +
.../cache/GridCacheUpdateAtomicResult.java | 162 +
.../cache/GridCacheUpdateTxResult.java | 64 +
.../processors/cache/GridCacheUtilityKey.java | 45 +
.../processors/cache/GridCacheUtils.java | 1684 +++
.../processors/cache/GridCacheValueBytes.java | 120 +
.../cache/GridCacheValueCollection.java | 167 +
.../cache/GridCacheWriteBehindStore.java | 1022 ++
.../processors/cache/GridPartitionLockKey.java | 104 +
.../cache/IgniteCacheExpiryPolicy.java | 74 +
.../processors/cache/IgniteCacheProxy.java | 785 +-
.../cache/affinity/GridCacheAffinityImpl.java | 222 +
.../cache/affinity/GridCacheAffinityProxy.java | 262 +
.../GridAtomicCacheQueueImpl.java | 256 +
.../GridCacheAnnotationHelper.java | 240 +
.../datastructures/GridCacheAtomicLongEx.java | 32 +
.../datastructures/GridCacheAtomicLongImpl.java | 527 +
.../GridCacheAtomicLongValue.java | 84 +
.../GridCacheAtomicReferenceEx.java | 32 +
.../GridCacheAtomicReferenceImpl.java | 320 +
.../GridCacheAtomicReferenceValue.java | 106 +
.../GridCacheAtomicSequenceEx.java | 32 +
.../GridCacheAtomicSequenceImpl.java | 517 +
.../GridCacheAtomicSequenceValue.java | 84 +
.../GridCacheAtomicStampedEx.java | 32 +
.../GridCacheAtomicStampedImpl.java | 350 +
.../GridCacheAtomicStampedValue.java | 135 +
.../GridCacheCountDownLatchEx.java | 39 +
.../GridCacheCountDownLatchImpl.java | 359 +
.../GridCacheCountDownLatchValue.java | 115 +
.../GridCacheDataStructuresImpl.java | 119 +
.../GridCacheDataStructuresManager.java | 1592 ++
.../GridCacheDataStructuresProxy.java | 267 +
.../datastructures/GridCacheInternalKey.java | 31 +
.../GridCacheInternalKeyImpl.java | 89 +
.../datastructures/GridCacheQueueAdapter.java | 1007 ++
.../datastructures/GridCacheQueueHeader.java | 199 +
.../datastructures/GridCacheQueueHeaderKey.java | 88 +
.../datastructures/GridCacheQueueItemKey.java | 121 +
.../datastructures/GridCacheQueueProxy.java | 746 +
.../datastructures/GridCacheRemovable.java | 37 +
.../datastructures/GridCacheSetHeader.java | 85 +
.../datastructures/GridCacheSetHeaderKey.java | 88 +
.../cache/datastructures/GridCacheSetImpl.java | 576 +
.../datastructures/GridCacheSetItemKey.java | 109 +
.../cache/datastructures/GridCacheSetProxy.java | 537 +
.../datastructures/GridSetQueryPredicate.java | 115 +
.../GridTransactionalCacheQueueImpl.java | 262 +
.../distributed/GridCacheCommittedTxInfo.java | 112 +
.../distributed/GridCacheMappedVersion.java | 33 +
...ridCacheOptimisticCheckPreparedTxFuture.java | 390 +
...idCacheOptimisticCheckPreparedTxRequest.java | 221 +
...dCacheOptimisticCheckPreparedTxResponse.java | 194 +
.../GridCachePerThreadTxCommitBuffer.java | 186 +
...dCachePessimisticCheckCommittedTxFuture.java | 382 +
...CachePessimisticCheckCommittedTxRequest.java | 284 +
...achePessimisticCheckCommittedTxResponse.java | 226 +
.../distributed/GridCacheTtlUpdateRequest.java | 501 +
.../distributed/GridCacheTxCommitBuffer.java | 60 +
.../distributed/GridCacheTxFinishSync.java | 292 +
.../distributed/GridDistributedBaseMessage.java | 451 +
.../GridDistributedCacheAdapter.java | 129 +
.../distributed/GridDistributedCacheEntry.java | 851 ++
.../GridDistributedLockCancelledException.java | 40 +
.../distributed/GridDistributedLockRequest.java | 822 ++
.../GridDistributedLockResponse.java | 433 +
.../GridDistributedTxFinishRequest.java | 692 +
.../GridDistributedTxFinishResponse.java | 169 +
.../distributed/GridDistributedTxMapping.java | 303 +
.../GridDistributedTxPrepareRequest.java | 771 +
.../GridDistributedTxPrepareResponse.java | 247 +
.../GridDistributedTxRemoteAdapter.java | 790 +
.../GridDistributedUnlockRequest.java | 239 +
.../GridPartitionedCacheEntryImpl.java | 423 +
.../IgniteExternalizableExpiryPolicy.java | 174 +
.../dht/GridClientPartitionTopology.java | 816 ++
.../dht/GridDhtAffinityAssignmentRequest.java | 139 +
.../dht/GridDhtAffinityAssignmentResponse.java | 194 +
.../dht/GridDhtAssignmentFetchFuture.java | 183 +
.../cache/distributed/dht/GridDhtCache.java | 99 +
.../distributed/dht/GridDhtCacheAdapter.java | 1018 ++
.../distributed/dht/GridDhtCacheEntry.java | 762 +
.../distributed/dht/GridDhtCacheEntryImpl.java | 172 +
.../distributed/dht/GridDhtEmbeddedFuture.java | 92 +
.../distributed/dht/GridDhtFinishedFuture.java | 66 +
.../cache/distributed/dht/GridDhtFuture.java | 36 +
.../cache/distributed/dht/GridDhtGetFuture.java | 453 +
.../dht/GridDhtInvalidPartitionException.java | 51 +
.../distributed/dht/GridDhtLocalPartition.java | 596 +
.../distributed/dht/GridDhtLockFuture.java | 1237 ++
.../distributed/dht/GridDhtLockRequest.java | 587 +
.../distributed/dht/GridDhtLockResponse.java | 452 +
.../distributed/dht/GridDhtPartitionState.java | 55 +
.../dht/GridDhtPartitionTopology.java | 207 +
.../dht/GridDhtPartitionTopologyImpl.java | 1195 ++
.../distributed/dht/GridDhtTopologyFuture.java | 44 +
.../dht/GridDhtTransactionalCacheAdapter.java | 1494 ++
.../distributed/dht/GridDhtTxFinishFuture.java | 534 +
.../distributed/dht/GridDhtTxFinishRequest.java | 695 +
.../dht/GridDhtTxFinishResponse.java | 143 +
.../cache/distributed/dht/GridDhtTxLocal.java | 658 +
.../distributed/dht/GridDhtTxLocalAdapter.java | 833 ++
.../cache/distributed/dht/GridDhtTxMapping.java | 169 +
.../distributed/dht/GridDhtTxPrepareFuture.java | 1076 ++
.../dht/GridDhtTxPrepareRequest.java | 598 +
.../dht/GridDhtTxPrepareResponse.java | 468 +
.../cache/distributed/dht/GridDhtTxRemote.java | 333 +
.../distributed/dht/GridDhtUnlockRequest.java | 221 +
.../distributed/dht/GridNoStorageCacheMap.java | 109 +
.../dht/GridPartitionedGetFuture.java | 724 +
.../dht/atomic/GridDhtAtomicCache.java | 3038 ++++
.../dht/atomic/GridDhtAtomicCacheEntry.java | 75 +
.../GridDhtAtomicDeferredUpdateResponse.java | 189 +
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 443 +
.../dht/atomic/GridDhtAtomicUpdateRequest.java | 1401 ++
.../dht/atomic/GridDhtAtomicUpdateResponse.java | 348 +
.../dht/atomic/GridNearAtomicUpdateFuture.java | 906 ++
.../dht/atomic/GridNearAtomicUpdateRequest.java | 1115 ++
.../atomic/GridNearAtomicUpdateResponse.java | 782 +
.../dht/colocated/GridDhtColocatedCache.java | 825 ++
.../colocated/GridDhtColocatedCacheEntry.java | 67 +
.../colocated/GridDhtColocatedLockFuture.java | 1335 ++
.../colocated/GridDhtDetachedCacheEntry.java | 109 +
.../dht/preloader/GridDhtForceKeysFuture.java | 566 +
.../dht/preloader/GridDhtForceKeysRequest.java | 329 +
.../dht/preloader/GridDhtForceKeysResponse.java | 333 +
.../GridDhtPartitionDemandMessage.java | 388 +
.../preloader/GridDhtPartitionDemandPool.java | 1132 ++
.../preloader/GridDhtPartitionExchangeId.java | 151 +
.../dht/preloader/GridDhtPartitionFullMap.java | 238 +
.../dht/preloader/GridDhtPartitionMap.java | 159 +
.../GridDhtPartitionSupplyMessage.java | 517 +
.../preloader/GridDhtPartitionSupplyPool.java | 567 +
.../GridDhtPartitionsAbstractMessage.java | 154 +
.../GridDhtPartitionsExchangeFuture.java | 1107 ++
.../preloader/GridDhtPartitionsFullMessage.java | 255 +
.../GridDhtPartitionsSingleMessage.java | 175 +
.../GridDhtPartitionsSingleRequest.java | 101 +
.../dht/preloader/GridDhtPreloader.java | 573 +
.../preloader/GridDhtPreloaderAssignments.java | 73 +
.../distributed/near/GridNearAtomicCache.java | 688 +
.../distributed/near/GridNearCacheAdapter.java | 787 +
.../near/GridNearCacheClearAllRunnable.java | 63 +
.../distributed/near/GridNearCacheEntry.java | 628 +
.../distributed/near/GridNearGetFuture.java | 877 ++
.../distributed/near/GridNearGetRequest.java | 588 +
.../distributed/near/GridNearGetResponse.java | 413 +
.../distributed/near/GridNearLockFuture.java | 1472 ++
.../distributed/near/GridNearLockMapping.java | 116 +
.../distributed/near/GridNearLockRequest.java | 666 +
.../distributed/near/GridNearLockResponse.java | 446 +
.../near/GridNearTransactionalCache.java | 701 +
.../near/GridNearTxFinishFuture.java | 502 +
.../near/GridNearTxFinishRequest.java | 315 +
.../near/GridNearTxFinishResponse.java | 224 +
.../cache/distributed/near/GridNearTxLocal.java | 1303 ++
.../near/GridNearTxPrepareFuture.java | 900 ++
.../near/GridNearTxPrepareRequest.java | 444 +
.../near/GridNearTxPrepareResponse.java | 505 +
.../distributed/near/GridNearTxRemote.java | 393 +
.../distributed/near/GridNearUnlockRequest.java | 103 +
.../cache/dr/GridCacheDrExpirationInfo.java | 90 +
.../processors/cache/dr/GridCacheDrInfo.java | 103 +
.../processors/cache/dr/GridCacheDrManager.java | 109 +
.../cache/dr/os/GridOsCacheDrManager.java | 112 +
.../extras/GridCacheAttributesEntryExtras.java | 84 +
.../GridCacheAttributesMvccEntryExtras.java | 102 +
...dCacheAttributesMvccObsoleteEntryExtras.java | 120 +
...cheAttributesMvccObsoleteTtlEntryExtras.java | 147 +
.../GridCacheAttributesMvccTtlEntryExtras.java | 131 +
.../GridCacheAttributesObsoleteEntryExtras.java | 102 +
...idCacheAttributesObsoleteTtlEntryExtras.java | 131 +
.../GridCacheAttributesTtlEntryExtras.java | 113 +
.../cache/extras/GridCacheEntryExtras.java | 83 +
.../extras/GridCacheEntryExtrasAdapter.java | 52 +
.../cache/extras/GridCacheMvccEntryExtras.java | 83 +
.../GridCacheMvccObsoleteEntryExtras.java | 100 +
.../GridCacheMvccObsoleteTtlEntryExtras.java | 130 +
.../extras/GridCacheMvccTtlEntryExtras.java | 113 +
.../extras/GridCacheObsoleteEntryExtras.java | 83 +
.../extras/GridCacheObsoleteTtlEntryExtras.java | 112 +
.../cache/extras/GridCacheTtlEntryExtras.java | 94 +
.../cache/jta/CacheJtaManagerAdapter.java | 50 +
.../cache/jta/CacheNoopJtaManager.java | 42 +
.../processors/cache/local/GridLocalCache.java | 207 +
.../cache/local/GridLocalCacheEntry.java | 387 +
.../cache/local/GridLocalLockCallback.java | 38 +
.../cache/local/GridLocalLockFuture.java | 452 +
.../processors/cache/local/GridLocalTx.java | 206 +
.../cache/local/GridLocalTxFuture.java | 351 +
.../local/atomic/GridLocalAtomicCache.java | 1583 ++
.../GridCacheDistributedFieldsQueryFuture.java | 105 +
.../query/GridCacheDistributedQueryFuture.java | 258 +
.../query/GridCacheDistributedQueryManager.java | 771 +
.../query/GridCacheFieldsQueryErrorFuture.java | 53 +
.../query/GridCacheLocalFieldsQueryFuture.java | 85 +
.../cache/query/GridCacheLocalQueryFuture.java | 141 +
.../cache/query/GridCacheLocalQueryManager.java | 145 +
.../cache/query/GridCacheQueriesEx.java | 68 +
.../cache/query/GridCacheQueriesImpl.java | 265 +
.../cache/query/GridCacheQueriesProxy.java | 298 +
.../cache/query/GridCacheQueryAdapter.java | 504 +
.../cache/query/GridCacheQueryBean.java | 90 +
.../cache/query/GridCacheQueryErrorFuture.java | 52 +
.../query/GridCacheQueryFutureAdapter.java | 561 +
.../cache/query/GridCacheQueryInfo.java | 184 +
.../cache/query/GridCacheQueryManager.java | 3162 ++++
.../query/GridCacheQueryMetadataAware.java | 33 +
.../query/GridCacheQueryMetricsAdapter.java | 150 +
.../cache/query/GridCacheQueryMetricsKey.java | 117 +
.../cache/query/GridCacheQueryRequest.java | 800 +
.../cache/query/GridCacheQueryResponse.java | 443 +
.../query/GridCacheQueryResponseEntry.java | 114 +
.../cache/query/GridCacheQueryType.java | 70 +
.../cache/query/GridCacheSqlIndexMetadata.java | 59 +
.../cache/query/GridCacheSqlMetadata.java | 89 +
.../cache/query/GridCacheSqlQuery.java | 99 +
.../cache/query/GridCacheSqlResult.java | 21 +
.../cache/query/GridCacheTwoStepQuery.java | 74 +
.../GridCacheContinuousQueryAdapter.java | 384 +
.../GridCacheContinuousQueryEntry.java | 766 +
.../GridCacheContinuousQueryFilterEx.java | 33 +
.../GridCacheContinuousQueryHandler.java | 557 +
.../GridCacheContinuousQueryListener.java | 41 +
.../GridCacheContinuousQueryManager.java | 783 +
.../jdbc/GridCacheQueryJdbcMetadataTask.java | 166 +
.../query/jdbc/GridCacheQueryJdbcTask.java | 342 +
.../jdbc/GridCacheQueryJdbcValidationTask.java | 64 +
.../transactions/IgniteTransactionsImpl.java | 252 +
.../cache/transactions/IgniteTxAdapter.java | 1617 ++
.../cache/transactions/IgniteTxEntry.java | 1142 ++
.../cache/transactions/IgniteTxEx.java | 541 +
.../cache/transactions/IgniteTxHandler.java | 1520 ++
.../cache/transactions/IgniteTxKey.java | 105 +
.../transactions/IgniteTxLocalAdapter.java | 3627 +++++
.../cache/transactions/IgniteTxLocalEx.java | 182 +
.../cache/transactions/IgniteTxManager.java | 2224 +++
.../cache/transactions/IgniteTxMap.java | 187 +
.../transactions/IgniteTxMetricsAdapter.java | 116 +
.../cache/transactions/IgniteTxProxy.java | 27 +
.../cache/transactions/IgniteTxProxyImpl.java | 314 +
.../cache/transactions/IgniteTxRemoteEx.java | 47 +
.../version/GridCachePlainVersionedEntry.java | 131 +
.../version/GridCacheRawVersionedEntry.java | 238 +
.../cache/version/GridCacheVersion.java | 256 +
...ridCacheVersionAbstractConflictResolver.java | 56 +
.../GridCacheVersionConflictContext.java | 73 +
.../GridCacheVersionConflictContextImpl.java | 188 +
.../GridCacheVersionConflictResolver.java | 59 +
.../cache/version/GridCacheVersionEx.java | 104 +
.../cache/version/GridCacheVersionManager.java | 282 +
.../cache/version/GridCacheVersionable.java | 28 +
.../version/GridCacheVersionedEntryEx.java | 31 +
.../clock/GridClockDeltaSnapshot.java | 231 +
.../clock/GridClockDeltaSnapshotMessage.java | 224 +
.../processors/clock/GridClockDeltaVersion.java | 117 +
.../processors/clock/GridClockMessage.java | 171 +
.../processors/clock/GridClockServer.java | 206 +
.../processors/clock/GridClockSource.java | 30 +
.../clock/GridClockSyncProcessor.java | 458 +
.../processors/clock/GridJvmClockSource.java | 28 +
.../processors/closure/GridClosurePolicy.java | 51 +
.../closure/GridClosureProcessor.java | 2050 +++
.../closure/GridPeerDeployAwareTaskAdapter.java | 60 +
.../internal/processors/closure/package.html | 23 +
.../continuous/GridContinuousHandler.java | 105 +
.../continuous/GridContinuousMessage.java | 252 +
.../continuous/GridContinuousMessageType.java | 56 +
.../continuous/GridContinuousProcessor.java | 1845 +++
.../dataload/GridDataLoadCacheUpdaters.java | 292 +
.../dataload/GridDataLoadRequest.java | 534 +
.../dataload/GridDataLoadResponse.java | 179 +
.../dataload/GridDataLoadUpdateJob.java | 120 +
.../dataload/GridDataLoaderFuture.java | 75 +
.../dataload/GridDataLoaderProcessor.java | 317 +
.../dataload/IgniteDataLoaderImpl.java | 1359 ++
.../internal/processors/dataload/package.html | 23 +
.../dr/GridDrDataLoadCacheUpdater.java | 77 +
.../internal/processors/dr/GridDrType.java | 38 +
.../ignite/internal/processors/dr/package.html | 25 +
.../processors/email/GridEmailHolder.java | 111 +
.../email/IgniteEmailProcessorAdapter.java | 84 +
.../email/IgniteNoopEmailProcessor.java | 55 +
.../internal/processors/email/package.html | 24 +
.../processors/fs/GridGgfsAckMessage.java | 208 +
.../processors/fs/GridGgfsAsyncImpl.java | 293 +
.../processors/fs/GridGgfsAttributes.java | 186 +
.../processors/fs/GridGgfsBlockKey.java | 275 +
.../fs/GridGgfsBlockLocationImpl.java | 258 +
.../processors/fs/GridGgfsBlocksMessage.java | 254 +
.../processors/fs/GridGgfsClientSession.java | 75 +
.../fs/GridGgfsCommunicationMessage.java | 75 +
.../internal/processors/fs/GridGgfsContext.java | 205 +
.../processors/fs/GridGgfsDataManager.java | 1918 +++
.../processors/fs/GridGgfsDeleteMessage.java | 202 +
.../processors/fs/GridGgfsDeleteWorker.java | 350 +
.../fs/GridGgfsDirectoryNotEmptyException.java | 44 +
.../internal/processors/fs/GridGgfsEx.java | 143 +
.../fs/GridGgfsFileAffinityRange.java | 394 +
.../processors/fs/GridGgfsFileInfo.java | 568 +
.../internal/processors/fs/GridGgfsFileMap.java | 361 +
.../processors/fs/GridGgfsFileWorker.java | 182 +
.../processors/fs/GridGgfsFileWorkerBatch.java | 235 +
.../processors/fs/GridGgfsFileWorkerTask.java | 32 +
.../fs/GridGgfsFragmentizerManager.java | 829 ++
.../fs/GridGgfsFragmentizerRequest.java | 210 +
.../fs/GridGgfsFragmentizerResponse.java | 129 +
.../fs/GridGgfsHandshakeResponse.java | 122 +
.../internal/processors/fs/GridGgfsImpl.java | 2152 +++
.../fs/GridGgfsInputStreamAdapter.java | 49 +
.../fs/GridGgfsInputStreamDescriptor.java | 78 +
.../processors/fs/GridGgfsInputStreamImpl.java | 533 +
.../fs/GridGgfsInvalidRangeException.java | 43 +
.../processors/fs/GridGgfsIpcHandler.java | 564 +
.../internal/processors/fs/GridGgfsJobImpl.java | 117 +
.../processors/fs/GridGgfsListingEntry.java | 197 +
.../processors/fs/GridGgfsLocalMetrics.java | 212 +
.../internal/processors/fs/GridGgfsManager.java | 155 +
.../processors/fs/GridGgfsMetaManager.java | 2993 ++++
.../processors/fs/GridGgfsModeResolver.java | 177 +
.../internal/processors/fs/GridGgfsPaths.java | 124 +
.../processors/fs/GridGgfsSamplingKey.java | 83 +
.../GridGgfsSecondaryInputStreamDescriptor.java | 59 +
...GridGgfsSecondaryOutputStreamDescriptor.java | 74 +
.../internal/processors/fs/GridGgfsServer.java | 427 +
.../processors/fs/GridGgfsServerHandler.java | 57 +
.../processors/fs/GridGgfsServerManager.java | 211 +
.../internal/processors/fs/GridGgfsStatus.java | 76 +
.../processors/fs/GridGgfsSyncMessage.java | 161 +
.../internal/processors/fs/GridGgfsThread.java | 82 +
.../processors/fs/IgniteFsFileImpl.java | 245 +
.../internal/processors/fs/IgniteFsHelper.java | 49 +
.../processors/fs/IgniteFsHelperImpl.java | 54 +
.../processors/fs/IgniteFsMetricsAdapter.java | 239 +
.../processors/fs/IgniteFsNoopHelper.java | 41 +
.../processors/fs/IgniteFsNoopProcessor.java | 71 +
.../fs/IgniteFsOutputStreamAdapter.java | 263 +
.../processors/fs/IgniteFsOutputStreamImpl.java | 505 +
.../processors/fs/IgniteFsProcessor.java | 463 +
.../processors/fs/IgniteFsProcessorAdapter.java | 80 +
.../processors/fs/IgniteFsTaskArgsImpl.java | 135 +
.../ignite/internal/processors/fs/package.html | 23 +
.../hadoop/IgniteHadoopNoopProcessor.java | 75 +
.../hadoop/IgniteHadoopProcessorAdapter.java | 95 +
.../processors/interop/GridInteropAware.java | 49 +
.../interop/GridInteropProcessor.java | 82 +
.../interop/GridInteropProcessorAdapter.java | 31 +
.../processors/interop/GridInteropTarget.java | 109 +
.../interop/os/GridOsInteropProcessor.java | 80 +
.../internal/processors/interop/os/package.html | 23 +
.../internal/processors/interop/package.html | 23 +
.../processors/job/GridJobEventListener.java | 40 +
.../processors/job/GridJobHoldListener.java | 36 +
.../processors/job/GridJobProcessor.java | 1859 +++
.../internal/processors/job/GridJobWorker.java | 888 ++
.../ignite/internal/processors/job/package.html | 23 +
.../processors/jobmetrics/GridJobMetrics.java | 448 +
.../jobmetrics/GridJobMetricsProcessor.java | 404 +
.../jobmetrics/GridJobMetricsSnapshot.java | 227 +
.../internal/processors/jobmetrics/package.html | 24 +
.../license/GridLicenseProcessor.java | 69 +
.../license/GridLicenseSubsystem.java | 53 +
.../license/GridLicenseUseRegistry.java | 90 +
.../license/os/GridOsLicenseProcessor.java | 66 +
.../internal/processors/license/os/package.html | 23 +
.../internal/processors/license/package.html | 24 +
.../offheap/GridOffHeapProcessor.java | 326 +
.../ignite/internal/processors/package.html | 23 +
.../plugin/IgnitePluginProcessor.java | 211 +
.../processors/port/GridPortListener.java | 28 +
.../processors/port/GridPortProcessor.java | 195 +
.../processors/port/GridPortRecord.java | 72 +
.../internal/processors/port/package.html | 24 +
.../portable/GridPortableInputStream.java | 177 +
.../portable/GridPortableOutputStream.java | 165 +
.../portable/GridPortableProcessor.java | 150 +
.../processors/portable/GridPortableStream.java | 53 +
.../portable/os/GridOsPortableProcessor.java | 126 +
.../processors/portable/os/package.html | 23 +
.../internal/processors/portable/package.html | 23 +
.../query/GridQueryFieldMetadata.java | 54 +
.../processors/query/GridQueryFieldsResult.java | 42 +
.../query/GridQueryFieldsResultAdapter.java | 57 +
.../query/GridQueryIndexDescriptor.java | 50 +
.../processors/query/GridQueryIndexType.java | 32 +
.../processors/query/GridQueryIndexing.java | 189 +
.../processors/query/GridQueryProcessor.java | 1716 +++
.../query/GridQueryTypeDescriptor.java | 86 +
.../resource/GridResourceBasicInjector.java | 71 +
.../processors/resource/GridResourceField.java | 71 +
.../resource/GridResourceInjector.java | 56 +
.../processors/resource/GridResourceIoc.java | 437 +
.../GridResourceJobContextInjector.java | 54 +
.../resource/GridResourceLoggerInjector.java | 68 +
.../processors/resource/GridResourceMethod.java | 71 +
.../resource/GridResourceProcessor.java | 607 +
.../resource/GridResourceServiceInjector.java | 84 +
.../processors/resource/GridResourceUtils.java | 106 +
.../resource/GridSpringResourceContext.java | 48 +
.../internal/processors/resource/package.html | 23 +
.../processors/rest/GridRestCommand.java | 160 +
.../processors/rest/GridRestProcessor.java | 697 +
.../processors/rest/GridRestProtocol.java | 59 +
.../rest/GridRestProtocolHandler.java | 40 +
.../processors/rest/GridRestResponse.java | 177 +
.../message/GridClientAbstractMessage.java | 117 +
.../GridClientAuthenticationRequest.java | 85 +
.../message/GridClientCacheQueryRequest.java | 414 +
.../client/message/GridClientCacheRequest.java | 319 +
.../message/GridClientGetMetaDataRequest.java | 64 +
.../message/GridClientHandshakeRequest.java | 108 +
.../GridClientHandshakeRequestWrapper.java | 127 +
.../message/GridClientHandshakeResponse.java | 66 +
.../GridClientHandshakeResponseWrapper.java | 116 +
.../client/message/GridClientLogRequest.java | 141 +
.../rest/client/message/GridClientMessage.java | 82 +
.../message/GridClientMessageWrapper.java | 258 +
.../message/GridClientMetaDataResponse.java | 57 +
.../rest/client/message/GridClientNodeBean.java | 342 +
.../message/GridClientNodeMetricsBean.java | 1578 ++
.../client/message/GridClientPingPacket.java | 37 +
.../message/GridClientPingPacketWrapper.java | 102 +
.../message/GridClientPortableMetaData.java | 93 +
.../message/GridClientPutMetaDataRequest.java | 64 +
.../rest/client/message/GridClientResponse.java | 145 +
.../client/message/GridClientTaskRequest.java | 152 +
.../message/GridClientTaskResultBean.java | 147 +
.../message/GridClientTopologyRequest.java | 174 +
.../rest/client/message/GridRouterRequest.java | 57 +
.../rest/client/message/GridRouterResponse.java | 84 +
.../processors/rest/client/message/package.html | 23 +
.../rest/handlers/GridRestCommandHandler.java | 40 +
.../handlers/GridRestCommandHandlerAdapter.java | 51 +
.../cache/GridCacheClientQueryResult.java | 119 +
.../handlers/cache/GridCacheCommandHandler.java | 1152 ++
.../cache/GridCacheQueryCommandHandler.java | 493 +
.../handlers/cache/GridCacheRestMetrics.java | 142 +
.../handlers/cache/GridCacheRestResponse.java | 67 +
.../processors/rest/handlers/cache/package.html | 23 +
.../handlers/log/GridLogCommandHandler.java | 306 +
.../processors/rest/handlers/log/package.html | 23 +
.../metadata/GridPortableMetadataHandler.java | 103 +
.../processors/rest/handlers/package.html | 23 +
.../handlers/task/GridTaskCommandHandler.java | 638 +
.../handlers/task/GridTaskResultRequest.java | 181 +
.../handlers/task/GridTaskResultResponse.java | 229 +
.../top/GridTopologyCommandHandler.java | 334 +
.../processors/rest/handlers/top/package.html | 23 +
.../version/GridVersionCommandHandler.java | 59 +
.../rest/handlers/version/package.html | 23 +
.../internal/processors/rest/package.html | 23 +
.../rest/protocols/GridRestProtocolAdapter.java | 196 +
.../processors/rest/protocols/package.html | 23 +
.../protocols/tcp/GridClientPacketType.java | 32 +
.../protocols/tcp/GridMemcachedMessage.java | 485 +
.../tcp/GridMemcachedMessageWrapper.java | 282 +
.../tcp/GridTcpMemcachedNioListener.java | 441 +
.../protocols/tcp/GridTcpRestDirectParser.java | 515 +
.../protocols/tcp/GridTcpRestNioListener.java | 385 +
.../rest/protocols/tcp/GridTcpRestParser.java | 878 ++
.../rest/protocols/tcp/GridTcpRestProtocol.java | 280 +
.../processors/rest/protocols/tcp/package.html | 23 +
.../rest/request/GridRestCacheQueryRequest.java | 143 +
.../rest/request/GridRestCacheRequest.java | 182 +
.../rest/request/GridRestLogRequest.java | 81 +
.../GridRestPortableGetMetaDataRequest.java | 44 +
.../GridRestPortablePutMetaDataRequest.java | 44 +
.../rest/request/GridRestRequest.java | 167 +
.../rest/request/GridRestTaskRequest.java | 134 +
.../rest/request/GridRestTopologyRequest.java | 100 +
.../processors/rest/request/package.html | 23 +
.../schedule/GridScheduleStatistics.java | 182 +
.../schedule/IgniteNoopScheduleProcessor.java | 54 +
.../IgniteScheduleProcessorAdapter.java | 53 +
.../internal/processors/schedule/package.html | 24 +
.../segmentation/GridSegmentationProcessor.java | 51 +
.../os/GridOsSegmentationProcessor.java | 39 +
.../processors/segmentation/package.html | 23 +
.../service/GridServiceAssignments.java | 135 +
.../service/GridServiceAssignmentsKey.java | 63 +
.../service/GridServiceDeployment.java | 95 +
.../service/GridServiceDeploymentFuture.java | 56 +
.../service/GridServiceDeploymentKey.java | 63 +
.../GridServiceMethodNotFoundException.java | 43 +
.../service/GridServiceMethodReflectKey.java | 77 +
.../service/GridServiceNotFoundException.java | 40 +
.../service/GridServiceProcessor.java | 1289 ++
.../processors/service/GridServiceProxy.java | 380 +
.../service/ManagedServiceContextImpl.java | 156 +
.../service/ManagedServiceDescriptorImpl.java | 101 +
.../session/GridTaskSessionProcessor.java | 178 +
.../internal/processors/session/package.html | 24 +
.../spring/IgniteSpringProcessor.java | 73 +
.../streamer/GridStreamProcessor.java | 360 +
.../streamer/GridStreamerAttributes.java | 127 +
.../streamer/GridStreamerCancelRequest.java | 121 +
.../streamer/GridStreamerContextDelegate.java | 106 +
.../streamer/GridStreamerContextImpl.java | 205 +
.../streamer/GridStreamerExecutionBatch.java | 185 +
.../streamer/GridStreamerExecutionRequest.java | 374 +
.../streamer/GridStreamerResponse.java | 156 +
.../GridStreamerRouteFailedException.java | 36 +
.../GridStreamerStageExecutionFuture.java | 362 +
.../streamer/GridStreamerWindowIterator.java | 40 +
.../processors/streamer/IgniteStreamerEx.java | 95 +
.../processors/streamer/IgniteStreamerImpl.java | 1415 ++
.../streamer/StreamerMBeanAdapter.java | 116 +
.../streamer/StreamerMetricsAdapter.java | 272 +
.../streamer/StreamerMetricsHolder.java | 424 +
.../streamer/StreamerStageMBeanAdapter.java | 101 +
.../streamer/StreamerStageMetricsAdapter.java | 135 +
.../streamer/StreamerStageMetricsHolder.java | 167 +
.../streamer/StreamerStageWrapper.java | 92 +
.../streamer/StreamerWindowMetricsAdapter.java | 65 +
.../streamer/StreamerWindowMetricsHolder.java | 50 +
.../internal/processors/streamer/package.html | 23 +
.../task/GridStreamerBroadcastTask.java | 138 +
.../streamer/task/GridStreamerQueryTask.java | 141 +
.../streamer/task/GridStreamerReduceTask.java | 145 +
.../internal/processors/task/GridInternal.java | 35 +
.../processors/task/GridTaskEventListener.java | 56 +
.../processors/task/GridTaskProcessor.java | 1288 ++
.../task/GridTaskThreadContextKey.java | 38 +
.../processors/task/GridTaskWorker.java | 1372 ++
.../internal/processors/task/package.html | 23 +
.../processors/timeout/GridTimeoutObject.java | 40 +
.../timeout/GridTimeoutObjectAdapter.java | 61 +
.../timeout/GridTimeoutProcessor.java | 173 +
.../internal/processors/timeout/package.html | 23 +
.../version/GridVersionConverter.java | 46 +
.../ignite/internal/product/IgniteProduct.java | 67 +
.../internal/product/IgniteProductLicense.java | 183 +
.../product/IgniteProductLicenseException.java | 70 +
.../apache/ignite/internal/product/package.html | 23 +
.../internal/tck/TCKMBeanServerBuilder.java | 118 +
.../org/apache/ignite/internal/util/F0.java | 368 +
.../internal/util/GridAnnotationsCache.java | 84 +
.../ignite/internal/util/GridArgumentCheck.java | 149 +
.../internal/util/GridAtomicInitializer.java | 112 +
.../ignite/internal/util/GridAtomicInteger.java | 249 +
.../ignite/internal/util/GridAtomicLong.java | 249 +
.../GridBoundedConcurrentLinkedHashMap.java | 124 +
.../GridBoundedConcurrentLinkedHashSet.java | 162 +
.../util/GridBoundedConcurrentOrderedMap.java | 242 +
.../util/GridBoundedConcurrentOrderedSet.java | 179 +
.../internal/util/GridBoundedLinkedHashMap.java | 129 +
.../internal/util/GridBoundedLinkedHashSet.java | 207 +
.../ignite/internal/util/GridBusyLock.java | 83 +
.../ignite/internal/util/GridByteArrayList.java | 412 +
.../internal/util/GridCircularBuffer.java | 230 +
.../internal/util/GridClassLoaderCache.java | 131 +
.../internal/util/GridClientByteUtils.java | 238 +
.../util/GridCloseableIteratorAdapter.java | 110 +
.../util/GridCloseableIteratorAdapterEx.java | 127 +
.../ignite/internal/util/GridCollections.java | 644 +
.../internal/util/GridConcurrentFactory.java | 110 +
.../internal/util/GridConcurrentHashSet.java | 119 +
.../util/GridConcurrentLinkedHashSet.java | 131 +
.../util/GridConcurrentPhantomHashSet.java | 402 +
.../util/GridConcurrentSkipListSet.java | 302 +
.../util/GridConcurrentWeakHashSet.java | 402 +
.../internal/util/GridConfigurationFinder.java | 151 +
.../internal/util/GridConsistentHash.java | 672 +
.../apache/ignite/internal/util/GridDebug.java | 303 +
.../util/GridEmptyCloseableIterator.java | 43 +
.../ignite/internal/util/GridEmptyIterator.java | 51 +
.../ignite/internal/util/GridEnumCache.java | 57 +
.../internal/util/GridExecutionStatistics.java | 105 +
.../internal/util/GridFixedSizeInputStream.java | 85 +
.../ignite/internal/util/GridHandleTable.java | 199 +
.../internal/util/GridIdentityHashSet.java | 63 +
.../ignite/internal/util/GridJavaProcess.java | 259 +
.../ignite/internal/util/GridKeyLock.java | 154 +
.../ignite/internal/util/GridLeanMap.java | 1266 ++
.../ignite/internal/util/GridLeanSet.java | 83 +
.../ignite/internal/util/GridListSet.java | 529 +
.../ignite/internal/util/GridLogThrottle.java | 221 +
.../ignite/internal/util/GridLongList.java | 504 +
.../apache/ignite/internal/util/GridMutex.java | 55 +
.../apache/ignite/internal/util/GridQueue.java | 348 +
.../apache/ignite/internal/util/GridRandom.java | 57 +
.../internal/util/GridReflectionCache.java | 251 +
.../util/GridSerializableCollection.java | 33 +
.../internal/util/GridSerializableFuture.java | 28 +
.../internal/util/GridSerializableIterable.java | 28 +
.../internal/util/GridSerializableIterator.java | 29 +
.../internal/util/GridSerializableList.java | 33 +
.../internal/util/GridSerializableMap.java | 37 +
.../internal/util/GridSerializableSet.java | 37 +
.../ignite/internal/util/GridSetWrapper.java | 136 +
.../ignite/internal/util/GridSnapshotLock.java | 219 +
.../util/GridSpiCloseableIteratorWrapper.java | 58 +
.../ignite/internal/util/GridSpinBusyLock.java | 84 +
.../internal/util/GridSpinReadWriteLock.java | 413 +
.../ignite/internal/util/GridStringBuilder.java | 447 +
.../internal/util/GridStringBuilderFactory.java | 98 +
.../ignite/internal/util/GridStripedLock.java | 143 +
.../internal/util/GridStripedReadWriteLock.java | 100 +
.../internal/util/GridSynchronizedMap.java | 100 +
.../ignite/internal/util/GridThreadLocal.java | 175 +
.../ignite/internal/util/GridThreadLocalEx.java | 210 +
.../apache/ignite/internal/util/GridTimer.java | 154 +
.../ignite/internal/util/GridTimerTask.java | 40 +
.../apache/ignite/internal/util/GridUnsafe.java | 61 +
.../ignite/internal/util/GridUuidCache.java | 59 +
.../ignite/internal/util/GridWeakIterator.java | 55 +
.../ignite/internal/util/IgniteUtils.java | 9174 ++++++++++++
.../GridTcpCommunicationMessageAdapter.java | 206 +
.../GridTcpCommunicationMessageFactory.java | 359 +
.../GridTcpCommunicationMessageProducer.java | 31 +
.../GridTcpCommunicationMessageState.java | 774 +
.../util/direct/GridTcpMessageFactory.java | 29 +
.../util/future/GridCompoundFuture.java | 383 +
.../util/future/GridCompoundIdentityFuture.java | 68 +
.../util/future/GridEmbeddedFuture.java | 321 +
.../util/future/GridFinishedFuture.java | 224 +
.../util/future/GridFinishedFutureEx.java | 197 +
.../internal/util/future/GridFutureAdapter.java | 626 +
.../util/future/GridFutureAdapterEx.java | 516 +
.../util/future/GridFutureChainListener.java | 72 +
.../ignite/internal/util/future/package.html | 23 +
.../util/gridify/GridifyArgumentBuilder.java | 186 +
.../util/gridify/GridifyJobAdapter.java | 107 +
.../util/gridify/GridifyRangeArgument.java | 103 +
.../internal/util/gridify/GridifyUtils.java | 521 +
.../ignite/internal/util/gridify/package.html | 23 +
.../util/io/GridByteArrayInputStream.java | 209 +
.../util/io/GridByteArrayOutputStream.java | 167 +
.../ignite/internal/util/io/GridDataInput.java | 132 +
.../ignite/internal/util/io/GridDataOutput.java | 119 +
.../internal/util/io/GridFilenameUtils.java | 1560 ++
.../util/io/GridReversedLinesFileReader.java | 333 +
.../internal/util/io/GridUnsafeDataInput.java | 603 +
.../internal/util/io/GridUnsafeDataOutput.java | 500 +
.../ignite/internal/util/ipc/IpcEndpoint.java | 49 +
.../util/ipc/IpcEndpointBindException.java | 47 +
.../internal/util/ipc/IpcEndpointFactory.java | 84 +
.../internal/util/ipc/IpcEndpointType.java | 29 +
.../internal/util/ipc/IpcServerEndpoint.java | 73 +
.../util/ipc/IpcServerEndpointDeserializer.java | 66 +
.../internal/util/ipc/IpcToNioAdapter.java | 241 +
.../util/ipc/loopback/IpcClientTcpEndpoint.java | 87 +
.../util/ipc/loopback/IpcServerTcpEndpoint.java | 179 +
.../internal/util/ipc/loopback/package.html | 23 +
.../ignite/internal/util/ipc/package.html | 23 +
.../shmem/IpcOutOfSystemResourcesException.java | 59 +
.../shmem/IpcSharedMemoryClientEndpoint.java | 336 +
.../ipc/shmem/IpcSharedMemoryInitRequest.java | 67 +
.../ipc/shmem/IpcSharedMemoryInitResponse.java | 171 +
.../ipc/shmem/IpcSharedMemoryInputStream.java | 99 +
.../ipc/shmem/IpcSharedMemoryNativeLoader.java | 261 +
...cSharedMemoryOperationTimedoutException.java | 59 +
.../ipc/shmem/IpcSharedMemoryOutputStream.java | 80 +
.../shmem/IpcSharedMemoryServerEndpoint.java | 707 +
.../util/ipc/shmem/IpcSharedMemorySpace.java | 374 +
.../util/ipc/shmem/IpcSharedMemoryUtils.java | 242 +
.../ignite/internal/util/ipc/shmem/package.html | 23 +
.../internal/util/lang/GridAbsClosure.java | 52 +
.../internal/util/lang/GridAbsClosureX.java | 48 +
.../internal/util/lang/GridAbsPredicate.java | 44 +
.../internal/util/lang/GridAbsPredicateX.java | 46 +
.../util/lang/GridCloseableIterator.java | 62 +
.../ignite/internal/util/lang/GridClosure3.java | 52 +
.../internal/util/lang/GridClosure3X.java | 51 +
.../util/lang/GridClosureException.java | 50 +
.../util/lang/GridComputeJobWrapper.java | 98 +
.../util/lang/GridFilteredIterator.java | 87 +
.../ignite/internal/util/lang/GridFunc.java | 8609 +++++++++++
.../internal/util/lang/GridInClosure3.java | 49 +
.../internal/util/lang/GridInClosure3X.java | 50 +
.../ignite/internal/util/lang/GridIterable.java | 35 +
.../internal/util/lang/GridIterableAdapter.java | 120 +
.../ignite/internal/util/lang/GridIterator.java | 67 +
.../internal/util/lang/GridIteratorAdapter.java | 66 +
.../ignite/internal/util/lang/GridMapEntry.java | 92 +
.../util/lang/GridMetadataAwareAdapter.java | 437 +
.../internal/util/lang/GridNodePredicate.java | 156 +
.../internal/util/lang/GridPeerDeployAware.java | 52 +
.../util/lang/GridPeerDeployAwareAdapter.java | 69 +
.../internal/util/lang/GridPlainAbsClosure.java | 33 +
.../internal/util/lang/GridPlainCallable.java | 27 +
.../internal/util/lang/GridPlainClosure.java | 32 +
.../internal/util/lang/GridPlainClosure2.java | 33 +
.../internal/util/lang/GridPlainFuture.java | 79 +
.../util/lang/GridPlainFutureAdapter.java | 299 +
.../internal/util/lang/GridPlainInClosure.java | 31 +
.../internal/util/lang/GridPlainOutClosure.java | 31 +
.../internal/util/lang/GridPlainRunnable.java | 25 +
.../internal/util/lang/GridPredicate3.java | 57 +
.../internal/util/lang/GridPredicate3X.java | 51 +
.../ignite/internal/util/lang/GridTriple.java | 54 +
.../ignite/internal/util/lang/GridTuple.java | 147 +
.../ignite/internal/util/lang/GridTuple3.java | 226 +
.../ignite/internal/util/lang/GridTuple4.java | 257 +
.../ignite/internal/util/lang/GridTuple5.java | 288 +
.../ignite/internal/util/lang/GridTuple6.java | 322 +
.../ignite/internal/util/lang/GridTupleV.java | 188 +
.../internal/util/lang/IgniteClosure2X.java | 53 +
.../internal/util/lang/IgniteClosureX.java | 52 +
.../internal/util/lang/IgniteInClosure2X.java | 52 +
.../internal/util/lang/IgniteInClosureX.java | 51 +
.../internal/util/lang/IgniteOutClosureX.java | 50 +
.../ignite/internal/util/lang/IgnitePair.java | 53 +
.../internal/util/lang/IgnitePredicate2X.java | 53 +
.../internal/util/lang/IgnitePredicateX.java | 52 +
.../internal/util/lang/IgniteReducer2.java | 53 +
.../internal/util/lang/IgniteReducer2X.java | 50 +
.../internal/util/lang/IgniteReducer3.java | 55 +
.../internal/util/lang/IgniteReducer3X.java | 50 +
.../internal/util/lang/IgniteReducerX.java | 51 +
.../nio/GridAbstractCommunicationClient.java | 112 +
.../internal/util/nio/GridBufferedParser.java | 96 +
.../util/nio/GridCommunicationClient.java | 112 +
.../nio/GridConnectionBytesVerifyFilter.java | 139 +
.../internal/util/nio/GridDirectParser.java | 78 +
.../util/nio/GridNioAsyncNotifyFilter.java | 141 +
.../util/nio/GridNioBackPressureControl.java | 56 +
.../internal/util/nio/GridNioCodecFilter.java | 139 +
.../util/nio/GridNioEmbeddedFuture.java | 72 +
.../internal/util/nio/GridNioException.java | 58 +
.../ignite/internal/util/nio/GridNioFilter.java | 244 +
.../internal/util/nio/GridNioFilterAdapter.java | 183 +
.../internal/util/nio/GridNioFilterChain.java | 292 +
.../util/nio/GridNioFinishedFuture.java | 116 +
.../ignite/internal/util/nio/GridNioFuture.java | 120 +
.../internal/util/nio/GridNioFutureImpl.java | 326 +
.../internal/util/nio/GridNioMessageReader.java | 42 +
.../util/nio/GridNioMessageTracker.java | 121 +
.../internal/util/nio/GridNioMessageWriter.java | 49 +
.../util/nio/GridNioMetricsListener.java | 33 +
.../ignite/internal/util/nio/GridNioParser.java | 62 +
.../util/nio/GridNioRecoveryDescriptor.java | 364 +
.../ignite/internal/util/nio/GridNioServer.java | 2276 +++
.../internal/util/nio/GridNioServerBuffer.java | 117 +
.../util/nio/GridNioServerListener.java | 64 +
.../util/nio/GridNioServerListenerAdapter.java | 33 +
.../internal/util/nio/GridNioSession.java | 168 +
.../internal/util/nio/GridNioSessionImpl.java | 312 +
.../util/nio/GridNioSessionMetaKey.java | 66 +
.../util/nio/GridSelectorNioSessionImpl.java | 297 +
.../util/nio/GridShmemCommunicationClient.java | 140 +
.../util/nio/GridTcpCommunicationClient.java | 548 +
.../util/nio/GridTcpNioCommunicationClient.java | 163 +
.../ignite/internal/util/nio/package.html | 23 +
.../internal/util/nio/ssl/GridNioSslFilter.java | 418 +
.../util/nio/ssl/GridNioSslHandler.java | 615 +
.../ignite/internal/util/nio/ssl/package.html | 23 +
.../util/nodestart/GridNodeCallable.java | 29 +
.../util/nodestart/GridNodeStartUtils.java | 390 +
.../nodestart/GridRemoteStartSpecification.java | 279 +
.../util/nodestart/IgniteSshProcessor.java | 34 +
.../internal/util/offheap/GridOffHeapEvent.java | 47 +
.../util/offheap/GridOffHeapEventListener.java | 26 +
.../util/offheap/GridOffHeapEvictListener.java | 33 +
.../internal/util/offheap/GridOffHeapMap.java | 200 +
.../util/offheap/GridOffHeapMapFactory.java | 225 +
.../GridOffHeapOutOfMemoryException.java | 50 +
.../util/offheap/GridOffHeapPartitionedMap.java | 218 +
.../offheap/unsafe/GridOffHeapSmartPointer.java | 38 +
.../unsafe/GridOffHeapSmartPointerFactory.java | 29 +
.../offheap/unsafe/GridOffHeapSnapTreeMap.java | 4457 ++++++
.../unsafe/GridUnsafeCompoundMemory.java | 35 +
.../util/offheap/unsafe/GridUnsafeGuard.java | 374 +
.../util/offheap/unsafe/GridUnsafeLru.java | 627 +
.../offheap/unsafe/GridUnsafeLruPoller.java | 30 +
.../util/offheap/unsafe/GridUnsafeMap.java | 1743 +++
.../util/offheap/unsafe/GridUnsafeMemory.java | 721 +
.../unsafe/GridUnsafePartitionedMap.java | 423 +
.../apache/ignite/internal/util/package.html | 24 +
.../util/portable/PortableRawReaderEx.java | 32 +
.../util/portable/PortableRawWriterEx.java | 43 +
.../util/portscanner/GridJmxPortFinder.java | 176 +
.../internal/util/portscanner/package.html | 23 +
.../apache/ignite/internal/util/scala/impl.java | 35 +
.../ignite/internal/util/scala/package.html | 24 +
.../util/snaptree/CopyOnWriteManager.java | 390 +
.../ignite/internal/util/snaptree/Epoch.java | 131 +
.../internal/util/snaptree/EpochNode.java | 432 +
.../internal/util/snaptree/SnapTreeMap.java | 2897 ++++
.../ignite/internal/util/snaptree/package.html | 24 +
.../internal/util/test/GridTestPrintStream.java | 293 +
.../util/test/GridTestPrintStreamFactory.java | 128 +
.../ignite/internal/util/test/package.html | 24 +
.../util/tostring/GridToStringBuilder.java | 588 +
.../tostring/GridToStringClassDescriptor.java | 85 +
.../util/tostring/GridToStringExclude.java | 32 +
.../tostring/GridToStringFieldDescriptor.java | 53 +
.../util/tostring/GridToStringInclude.java | 32 +
.../util/tostring/GridToStringOrder.java | 37 +
.../util/tostring/GridToStringThreadLocal.java | 55 +
.../ignite/internal/util/tostring/package.html | 23 +
.../apache/ignite/internal/util/typedef/C1.java | 32 +
.../apache/ignite/internal/util/typedef/C2.java | 33 +
.../apache/ignite/internal/util/typedef/C3.java | 35 +
.../apache/ignite/internal/util/typedef/CA.java | 32 +
.../ignite/internal/util/typedef/CAX.java | 32 +
.../ignite/internal/util/typedef/CI1.java | 31 +
.../ignite/internal/util/typedef/CI2.java | 32 +
.../ignite/internal/util/typedef/CI3.java | 32 +
.../ignite/internal/util/typedef/CIX1.java | 33 +
.../ignite/internal/util/typedef/CIX2.java | 32 +
.../ignite/internal/util/typedef/CIX3.java | 29 +
.../apache/ignite/internal/util/typedef/CO.java | 31 +
.../ignite/internal/util/typedef/COX.java | 33 +
.../ignite/internal/util/typedef/CX1.java | 34 +
.../ignite/internal/util/typedef/CX2.java | 35 +
.../ignite/internal/util/typedef/CX3.java | 33 +
.../apache/ignite/internal/util/typedef/F.java | 29 +
.../apache/ignite/internal/util/typedef/G.java | 29 +
.../apache/ignite/internal/util/typedef/P1.java | 31 +
.../apache/ignite/internal/util/typedef/P2.java | 32 +
.../apache/ignite/internal/util/typedef/P3.java | 32 +
.../apache/ignite/internal/util/typedef/PA.java | 29 +
.../ignite/internal/util/typedef/PAX.java | 29 +
.../ignite/internal/util/typedef/PCE.java | 33 +
.../apache/ignite/internal/util/typedef/PE.java | 33 +
.../ignite/internal/util/typedef/PKV.java | 31 +
.../apache/ignite/internal/util/typedef/PN.java | 33 +
.../ignite/internal/util/typedef/PX1.java | 33 +
.../ignite/internal/util/typedef/PX2.java | 34 +
.../ignite/internal/util/typedef/PX3.java | 32 +
.../apache/ignite/internal/util/typedef/R1.java | 32 +
.../apache/ignite/internal/util/typedef/R2.java | 31 +
.../apache/ignite/internal/util/typedef/R3.java | 31 +
.../ignite/internal/util/typedef/RX1.java | 34 +
.../ignite/internal/util/typedef/RX2.java | 34 +
.../ignite/internal/util/typedef/RX3.java | 34 +
.../apache/ignite/internal/util/typedef/T1.java | 51 +
.../apache/ignite/internal/util/typedef/T2.java | 52 +
.../apache/ignite/internal/util/typedef/T3.java | 52 +
.../apache/ignite/internal/util/typedef/T4.java | 53 +
.../apache/ignite/internal/util/typedef/T5.java | 54 +
.../apache/ignite/internal/util/typedef/T6.java | 55 +
.../apache/ignite/internal/util/typedef/X.java | 936 ++
.../internal/util/typedef/internal/A.java | 28 +
.../internal/util/typedef/internal/CU.java | 30 +
.../internal/util/typedef/internal/D.java | 28 +
.../internal/util/typedef/internal/GPC.java | 27 +
.../internal/util/typedef/internal/GPR.java | 27 +
.../internal/util/typedef/internal/LT.java | 28 +
.../internal/util/typedef/internal/S.java | 28 +
.../internal/util/typedef/internal/SB.java | 63 +
.../internal/util/typedef/internal/U.java | 28 +
.../internal/util/typedef/internal/package.html | 23 +
.../ignite/internal/util/typedef/package.html | 23 +
.../ignite/internal/util/worker/GridWorker.java | 304 +
.../internal/util/worker/GridWorkerFuture.java | 70 +
.../util/worker/GridWorkerListener.java | 35 +
.../util/worker/GridWorkerListenerAdapter.java | 33 +
.../internal/util/worker/GridWorkerPool.java | 116 +
.../ignite/internal/util/worker/package.html | 24 +
.../apache/ignite/internal/visor/VisorJob.java | 77 +
.../internal/visor/VisorMultiNodeTask.java | 127 +
.../ignite/internal/visor/VisorOneNodeTask.java | 42 +
.../internal/visor/VisorTaskArgument.java | 106 +
.../ignite/internal/visor/cache/VisorCache.java | 484 +
.../cache/VisorCacheAffinityConfiguration.java | 171 +
.../cache/VisorCacheAggregatedMetrics.java | 471 +
.../visor/cache/VisorCacheClearTask.java | 88 +
.../visor/cache/VisorCacheCompactTask.java | 86 +
.../visor/cache/VisorCacheConfiguration.java | 664 +
.../cache/VisorCacheDefaultConfiguration.java | 158 +
.../visor/cache/VisorCacheDgcConfiguration.java | 97 +
.../cache/VisorCacheEvictionConfiguration.java | 215 +
.../visor/cache/VisorCacheLoadTask.java | 88 +
.../visor/cache/VisorCacheMetadataTask.java | 76 +
.../internal/visor/cache/VisorCacheMetrics.java | 267 +
.../cache/VisorCacheMetricsCollectorTask.java | 112 +
.../cache/VisorCacheNearConfiguration.java | 123 +
.../cache/VisorCachePreloadConfiguration.java | 155 +
.../visor/cache/VisorCachePreloadTask.java | 77 +
.../visor/cache/VisorCacheQueryMetrics.java | 102 +
.../visor/cache/VisorCacheResetMetricsTask.java | 69 +
.../cache/VisorCacheStoreConfiguration.java | 90 +
.../visor/cache/VisorCacheSwapBackupsTask.java | 90 +
.../VisorCacheWriteBehindConfiguration.java | 137 +
.../compute/VisorComputeCancelSessionsTask.java | 89 +
.../compute/VisorComputeMonitoringHolder.java | 118 +
.../compute/VisorComputeResetMetricsTask.java | 65 +
.../VisorComputeToggleMonitoringTask.java | 112 +
.../visor/debug/VisorThreadDumpTask.java | 75 +
.../internal/visor/debug/VisorThreadInfo.java | 328 +
.../visor/debug/VisorThreadLockInfo.java | 73 +
.../visor/debug/VisorThreadMonitorInfo.java | 72 +
.../event/VisorGridAuthenticationEvent.java | 106 +
.../event/VisorGridAuthorizationEvent.java | 89 +
.../visor/event/VisorGridDeploymentEvent.java | 74 +
.../visor/event/VisorGridDiscoveryEvent.java | 100 +
.../internal/visor/event/VisorGridEvent.java | 130 +
.../visor/event/VisorGridEventsLost.java | 45 +
.../internal/visor/event/VisorGridJobEvent.java | 113 +
.../visor/event/VisorGridLicenseEvent.java | 74 +
.../event/VisorGridSecuritySessionEvent.java | 91 +
.../visor/event/VisorGridTaskEvent.java | 113 +
.../internal/visor/file/VisorFileBlock.java | 114 +
.../internal/visor/file/VisorFileBlockTask.java | 126 +
.../visor/file/VisorLatestTextFilesTask.java | 98 +
.../ignite/internal/visor/ggfs/VisorGgfs.java | 113 +
.../internal/visor/ggfs/VisorGgfsEndpoint.java | 106 +
.../visor/ggfs/VisorGgfsFormatTask.java | 70 +
.../internal/visor/ggfs/VisorGgfsMetrics.java | 350 +
.../internal/visor/ggfs/VisorGgfsProfiler.java | 88 +
.../visor/ggfs/VisorGgfsProfilerClearTask.java | 111 +
.../visor/ggfs/VisorGgfsProfilerEntry.java | 238 +
.../visor/ggfs/VisorGgfsProfilerTask.java | 504 +
.../VisorGgfsProfilerUniformityCounters.java | 197 +
.../visor/ggfs/VisorGgfsResetMetricsTask.java | 73 +
.../visor/ggfs/VisorGgfsSamplingStateTask.java | 74 +
.../ignite/internal/visor/log/VisorLogFile.java | 87 +
.../visor/log/VisorLogSearchResult.java | 156 +
.../internal/visor/log/VisorLogSearchTask.java | 270 +
.../internal/visor/misc/VisorAckTask.java | 76 +
.../visor/misc/VisorLatestVersionTask.java | 63 +
.../internal/visor/misc/VisorNopTask.java | 90 +
.../visor/misc/VisorResolveHostNameTask.java | 104 +
.../visor/node/VisorBasicConfiguration.java | 451 +
.../visor/node/VisorEmailConfiguration.java | 177 +
.../node/VisorExecutorServiceConfiguration.java | 200 +
.../visor/node/VisorGgfsConfiguration.java | 573 +
.../visor/node/VisorGridConfiguration.java | 361 +
.../visor/node/VisorLifecycleConfiguration.java | 87 +
.../visor/node/VisorMetricsConfiguration.java | 95 +
.../VisorNodeConfigurationCollectorJob.java | 47 +
.../VisorNodeConfigurationCollectorTask.java | 35 +
.../visor/node/VisorNodeDataCollectorJob.java | 218 +
.../node/VisorNodeDataCollectorJobResult.java | 158 +
.../visor/node/VisorNodeDataCollectorTask.java | 127 +
.../node/VisorNodeDataCollectorTaskArg.java | 140 +
.../node/VisorNodeDataCollectorTaskResult.java | 184 +
.../node/VisorNodeEventsCollectorTask.java | 365 +
.../internal/visor/node/VisorNodeGcTask.java | 100 +
.../internal/visor/node/VisorNodePingTask.java | 81 +
.../visor/node/VisorNodeRestartTask.java | 78 +
.../internal/visor/node/VisorNodeStopTask.java | 78 +
.../node/VisorPeerToPeerConfiguration.java | 105 +
.../visor/node/VisorRestConfiguration.java | 221 +
.../node/VisorSegmentationConfiguration.java | 141 +
.../visor/node/VisorSpisConfiguration.java | 334 +
.../visor/portable/VisorPortableMetadata.java | 72 +
.../VisorPortableMetadataCollectorTask.java | 94 +
.../portable/VisorPortableMetadataField.java | 71 +
.../visor/query/VisorQueryCleanupTask.java | 102 +
.../internal/visor/query/VisorQueryField.java | 66 +
.../visor/query/VisorQueryNextPageTask.java | 117 +
.../internal/visor/query/VisorQueryResult.java | 79 +
.../visor/query/VisorQueryResultEx.java | 88 +
.../internal/visor/query/VisorQueryTask.java | 310 +
.../internal/visor/query/VisorQueryUtils.java | 204 +
.../internal/visor/streamer/VisorStreamer.java | 104 +
.../streamer/VisorStreamerConfiguration.java | 178 +
.../visor/streamer/VisorStreamerMetrics.java | 350 +
.../streamer/VisorStreamerMetricsResetTask.java | 75 +
.../visor/streamer/VisorStreamerResetTask.java | 75 +
.../streamer/VisorStreamerStageMetrics.java | 277 +
.../internal/visor/util/VisorMimeTypes.java | 1004 ++
.../internal/visor/util/VisorTaskUtils.java | 830 ++
.../ignite/interop/InteropConfiguration.java | 30 +
.../java/org/apache/ignite/interop/package.html | 15 +
.../ignite/jdbc/IgniteJdbcConnection.java | 547 +
.../ignite/jdbc/IgniteJdbcConnectionInfo.java | 91 +
.../ignite/jdbc/IgniteJdbcDatabaseMetadata.java | 1314 ++
.../apache/ignite/jdbc/IgniteJdbcDriver.java | 482 +
.../jdbc/IgniteJdbcPreparedStatement.java | 411 +
.../apache/ignite/jdbc/IgniteJdbcResultSet.java | 1520 ++
.../jdbc/IgniteJdbcResultSetMetadata.java | 172 +
.../apache/ignite/jdbc/IgniteJdbcStatement.java | 449 +
.../java/org/apache/ignite/jdbc/package.html | 23 +
.../java/org/apache/ignite/jdbc/typedef/JU.java | 28 +
.../org/apache/ignite/jdbc/typedef/package.html | 23 +
.../ignite/jdbc/util/IgniteJdbcUtils.java | 232 +
.../org/apache/ignite/jdbc/util/package.html | 23 +
.../apache/ignite/lang/IgniteAsyncSupport.java | 28 +-
.../ignite/lang/IgniteAsyncSupportAdapter.java | 47 +-
.../ignite/lang/IgniteAsyncSupported.java | 24 +-
.../org/apache/ignite/lang/IgniteBiClosure.java | 22 +-
.../apache/ignite/lang/IgniteBiInClosure.java | 22 +-
.../apache/ignite/lang/IgniteBiPredicate.java | 22 +-
.../org/apache/ignite/lang/IgniteBiTuple.java | 28 +-
.../org/apache/ignite/lang/IgniteCallable.java | 22 +-
.../org/apache/ignite/lang/IgniteClosure.java | 22 +-
.../org/apache/ignite/lang/IgniteFuture.java | 182 -
.../lang/IgniteFutureCancelledException.java | 22 +-
.../lang/IgniteFutureTimeoutException.java | 22 +-
.../org/apache/ignite/lang/IgniteInClosure.java | 22 +-
.../ignite/lang/IgniteNotPeerDeployable.java | 41 +
.../apache/ignite/lang/IgniteOutClosure.java | 22 +-
.../org/apache/ignite/lang/IgnitePredicate.java | 26 +-
.../ignite/lang/IgniteProductVersion.java | 291 +
.../org/apache/ignite/lang/IgniteReducer.java | 22 +-
.../org/apache/ignite/lang/IgniteRunnable.java | 22 +-
.../java/org/apache/ignite/lang/IgniteUuid.java | 28 +-
.../java/org/apache/ignite/lang/package.html | 24 +-
.../apache/ignite/lifecycle/IgniteListener.java | 22 +-
.../apache/ignite/lifecycle/LifecycleAware.java | 22 +-
.../apache/ignite/lifecycle/LifecycleBean.java | 35 +-
.../ignite/lifecycle/LifecycleEventType.java | 22 +-
.../ignite/logger/IgniteLoggerNodeIdAware.java | 22 +-
.../apache/ignite/logger/IgniteNullLogger.java | 22 +-
.../ignite/logger/java/IgniteJavaLogger.java | 30 +-
.../java/IgniteJavaLoggerFileHandler.java | 26 +-
.../logger/java/IgniteJavaLoggerFormatter.java | 24 +-
.../org/apache/ignite/logger/java/package.html | 24 +-
.../java/org/apache/ignite/logger/package.html | 24 +-
.../apache/ignite/managed/ManagedService.java | 26 +-
.../managed/ManagedServiceConfiguration.java | 26 +-
.../ignite/managed/ManagedServiceContext.java | 22 +-
.../managed/ManagedServiceDescriptor.java | 22 +-
.../java/org/apache/ignite/managed/package.html | 25 +-
.../marshaller/IgniteAbstractMarshaller.java | 28 +-
.../ignite/marshaller/IgniteMarshaller.java | 51 +-
.../marshaller/IgniteMarshallerExclusions.java | 30 +-
.../marshaller/jdk/IgniteJdkMarshaller.java | 51 +-
.../IgniteJdkMarshallerDummySerializable.java | 22 +-
.../IgniteJdkMarshallerInputStreamWrapper.java | 22 +-
.../IgniteJdkMarshallerObjectInputStream.java | 22 +-
.../IgniteJdkMarshallerObjectOutputStream.java | 22 +-
.../IgniteJdkMarshallerOutputStreamWrapper.java | 22 +-
.../apache/ignite/marshaller/jdk/package.html | 25 +-
.../IgniteOptimizedClassDescriptor.java | 26 +-
.../optimized/IgniteOptimizedClassResolver.java | 30 +-
.../optimized/IgniteOptimizedFieldType.java | 22 +-
.../optimized/IgniteOptimizedMarshallable.java | 22 +-
.../optimized/IgniteOptimizedMarshaller.java | 55 +-
.../IgniteOptimizedMarshallerUtils.java | 26 +-
.../IgniteOptimizedObjectInputStream.java | 30 +-
.../IgniteOptimizedObjectOutputStream.java | 28 +-
.../IgniteOptimizedObjectStreamRegistry.java | 41 +-
.../optimized-classnames.previous.properties | 17 +
.../optimized/optimized-classnames.properties | 17 +
.../ignite/marshaller/optimized/package.html | 25 +-
.../org/apache/ignite/marshaller/package.html | 24 +-
.../org/apache/ignite/mbean/IgniteMBean.java | 378 -
.../ignite/mbean/IgniteMBeanDescription.java | 26 -
.../IgniteMBeanParametersDescriptions.java | 26 -
.../mbean/IgniteMBeanParametersNames.java | 26 -
.../ignite/mbean/IgniteStandardMBean.java | 267 -
.../ignite/mbean/IgniteThreadPoolMBean.java | 144 -
.../org/apache/ignite/mbean/IgnitionMBean.java | 143 -
.../java/org/apache/ignite/mbean/package.html | 15 -
.../ignite/messaging/MessagingListenActor.java | 25 +-
.../org/apache/ignite/messaging/package.html | 25 +-
.../ignite/mxbean/CacheMetricsMXBean.java | 245 +
.../mxbean/ClusterLocalNodeMetricsMXBean.java | 240 +
.../org/apache/ignite/mxbean/IgniteMXBean.java | 386 +
.../ignite/mxbean/IgniteMXBeanDescription.java | 34 +
.../IgniteMXBeanParametersDescriptions.java | 34 +
.../mxbean/IgniteMXBeanParametersNames.java | 34 +
.../ignite/mxbean/IgniteThreadPoolMXBean.java | 152 +
.../apache/ignite/mxbean/IgnitionMXBean.java | 151 +
.../java/org/apache/ignite/mxbean/package.html | 23 +
.../main/java/org/apache/ignite/package.html | 23 +
.../apache/ignite/plugin/IgniteExtension.java | 22 +-
.../ignite/plugin/IgniteExtensionRegistry.java | 22 +-
.../org/apache/ignite/plugin/IgnitePlugin.java | 22 +-
.../ignite/plugin/PluginConfiguration.java | 22 +-
.../org/apache/ignite/plugin/PluginContext.java | 24 +-
.../ignite/plugin/PluginNotFoundException.java | 22 +-
.../apache/ignite/plugin/PluginProvider.java | 22 +-
.../plugin/PluginValidationException.java | 23 +-
.../communication/MessageCallback.java | 22 +-
.../communication/MessageFactory.java | 23 -
.../extensions/discovery/DiscoveryCallback.java | 22 +-
.../ignite/plugin/security/GridSecurity.java | 22 +-
.../security/GridSecurityCredentials.java | 28 +-
.../GridSecurityCredentialsBasicProvider.java | 22 +-
.../GridSecurityCredentialsProvider.java | 22 +-
.../plugin/security/GridSecurityException.java | 22 +-
.../plugin/security/GridSecurityPermission.java | 22 +-
.../security/GridSecurityPermissionSet.java | 22 +-
.../plugin/security/GridSecuritySubject.java | 22 +-
.../security/GridSecuritySubjectType.java | 22 +-
.../apache/ignite/plugin/security/package.html | 24 +-
.../segmentation/GridSegmentationPolicy.java | 22 +-
.../segmentation/GridSegmentationResolver.java | 22 +-
.../ignite/plugin/segmentation/package.html | 25 +-
.../ignite/portables/PortableBuilder.java | 22 +-
.../ignite/portables/PortableConfiguration.java | 24 +-
.../ignite/portables/PortableException.java | 22 +-
.../ignite/portables/PortableIdMapper.java | 22 +-
.../PortableInvalidClassException.java | 22 +-
.../ignite/portables/PortableMarshalAware.java | 22 +-
.../ignite/portables/PortableMetadata.java | 22 +-
.../apache/ignite/portables/PortableObject.java | 28 +-
.../ignite/portables/PortableRawReader.java | 24 +-
.../ignite/portables/PortableRawWriter.java | 22 +-
.../apache/ignite/portables/PortableReader.java | 22 +-
.../ignite/portables/PortableSerializer.java | 22 +-
.../portables/PortableTypeConfiguration.java | 24 +-
.../apache/ignite/portables/PortableWriter.java | 22 +-
.../org/apache/ignite/portables/package.html | 24 +-
.../apache/ignite/product/IgniteProduct.java | 58 -
.../ignite/product/IgniteProductLicense.java | 175 -
.../product/IgniteProductLicenseException.java | 62 -
.../ignite/product/IgniteProductVersion.java | 283 -
.../java/org/apache/ignite/product/package.html | 15 -
.../IgniteAddressResolverResource.java | 50 -
.../resources/IgniteCacheNameResource.java | 35 +-
.../IgniteExecutorServiceResource.java | 58 -
.../ignite/resources/IgniteHomeResource.java | 57 -
.../resources/IgniteInstanceResource.java | 39 +-
.../resources/IgniteJobContextResource.java | 32 +-
.../resources/IgniteLoadBalancerResource.java | 36 +-
.../resources/IgniteLocalHostResource.java | 58 -
.../resources/IgniteLocalNodeIdResource.java | 58 -
.../ignite/resources/IgniteLoggerResource.java | 31 +-
.../resources/IgniteMBeanServerResource.java | 27 +-
.../resources/IgniteMarshallerResource.java | 57 -
.../ignite/resources/IgniteNameResource.java | 57 -
.../ignite/resources/IgniteServiceResource.java | 26 +-
.../IgniteSpringApplicationContextResource.java | 27 +-
.../ignite/resources/IgniteSpringResource.java | 40 +-
.../IgniteTaskContinuousMapperResource.java | 32 +-
.../resources/IgniteTaskSessionResource.java | 32 +-
.../ignite/resources/IgniteUserResource.java | 124 -
.../resources/IgniteUserResourceOnDeployed.java | 46 -
.../IgniteUserResourceOnUndeployed.java | 45 -
.../org/apache/ignite/resources/package.html | 24 +-
.../ignite/scheduler/SchedulerFuture.java | 33 +-
.../org/apache/ignite/scheduler/package.html | 24 +-
.../apache/ignite/spi/IgnitePortProtocol.java | 22 +-
.../java/org/apache/ignite/spi/IgniteSpi.java | 32 +-
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 55 +-
.../ignite/spi/IgniteSpiCloseableIterator.java | 22 +-
.../ignite/spi/IgniteSpiConfiguration.java | 22 +-
.../ignite/spi/IgniteSpiConsistencyChecked.java | 22 +-
.../org/apache/ignite/spi/IgniteSpiContext.java | 26 +-
.../apache/ignite/spi/IgniteSpiException.java | 22 +-
.../ignite/spi/IgniteSpiManagementMBean.java | 38 +-
.../ignite/spi/IgniteSpiMultiException.java | 22 +-
.../spi/IgniteSpiMultipleInstancesSupport.java | 22 +-
.../spi/IgniteSpiNodeValidationResult.java | 22 +-
.../org/apache/ignite/spi/IgniteSpiNoop.java | 22 +-
.../org/apache/ignite/spi/IgniteSpiThread.java | 24 +-
.../ignite/spi/IgniteSpiThreadFactory.java | 22 +-
.../spi/IgniteSpiVersionCheckException.java | 22 +-
.../AuthenticationAclProvider.java | 22 +-
.../authentication/AuthenticationContext.java | 22 +-
.../AuthenticationContextAdapter.java | 22 +-
.../spi/authentication/AuthenticationSpi.java | 22 +-
.../noop/NoopAuthenticationSpi.java | 28 +-
.../noop/NoopAuthenticationSpiMBean.java | 26 +-
.../ignite/spi/authentication/noop/package.html | 24 +-
.../ignite/spi/authentication/package.html | 24 +-
.../spi/checkpoint/CheckpointListener.java | 22 +-
.../ignite/spi/checkpoint/CheckpointSpi.java | 22 +-
.../checkpoint/cache/CacheCheckpointSpi.java | 24 +-
.../cache/CacheCheckpointSpiMBean.java | 23 +-
.../ignite/spi/checkpoint/cache/package.html | 24 +-
.../spi/checkpoint/jdbc/JdbcCheckpointSpi.java | 26 +-
.../checkpoint/jdbc/JdbcCheckpointSpiMBean.java | 48 +-
.../ignite/spi/checkpoint/jdbc/package.html | 24 +-
.../spi/checkpoint/noop/NoopCheckpointSpi.java | 24 +-
.../ignite/spi/checkpoint/noop/package.html | 24 +-
.../apache/ignite/spi/checkpoint/package.html | 25 +-
.../sharedfs/SharedFsCheckpointData.java | 24 +-
.../sharedfs/SharedFsCheckpointSpi.java | 39 +-
.../sharedfs/SharedFsCheckpointSpiMBean.java | 30 +-
.../checkpoint/sharedfs/SharedFsTimeData.java | 24 +-
.../sharedfs/SharedFsTimeoutTask.java | 25 +-
.../spi/checkpoint/sharedfs/SharedFsUtils.java | 25 +-
.../ignite/spi/checkpoint/sharedfs/package.html | 24 +-
.../ignite/spi/collision/CollisionContext.java | 22 +-
.../collision/CollisionExternalListener.java | 22 +-
.../spi/collision/CollisionJobContext.java | 22 +-
.../ignite/spi/collision/CollisionSpi.java | 22 +-
.../fifoqueue/FifoQueueCollisionSpi.java | 24 +-
.../fifoqueue/FifoQueueCollisionSpiMBean.java | 42 +-
.../ignite/spi/collision/fifoqueue/package.html | 24 +-
.../jobstealing/JobStealingCollisionSpi.java | 32 +-
.../JobStealingCollisionSpiMBean.java | 60 +-
.../jobstealing/JobStealingDisabled.java | 22 +-
.../jobstealing/JobStealingRequest.java | 26 +-
.../spi/collision/jobstealing/package.html | 24 +-
.../spi/collision/noop/NoopCollisionSpi.java | 24 +-
.../ignite/spi/collision/noop/package.html | 24 +-
.../apache/ignite/spi/collision/package.html | 24 +-
.../PriorityQueueCollisionSpi.java | 42 +-
.../PriorityQueueCollisionSpiMBean.java | 58 +-
.../spi/collision/priorityqueue/package.html | 24 +-
.../communication/CommunicationListener.java | 22 +-
.../spi/communication/CommunicationSpi.java | 22 +-
.../ignite/spi/communication/package.html | 24 +-
.../communication/tcp/TcpCommunicationSpi.java | 115 +-
.../tcp/TcpCommunicationSpiMBean.java | 77 +-
.../ignite/spi/communication/tcp/package.html | 24 +-
.../spi/deployment/DeploymentListener.java | 22 +-
.../spi/deployment/DeploymentResource.java | 22 +-
.../deployment/DeploymentResourceAdapter.java | 24 +-
.../ignite/spi/deployment/DeploymentSpi.java | 22 +-
.../IgnoreIfPeerClassLoadingDisabled.java | 22 +-
.../deployment/local/LocalDeploymentSpi.java | 28 +-
.../local/LocalDeploymentSpiMBean.java | 26 +-
.../ignite/spi/deployment/local/package.html | 24 +-
.../apache/ignite/spi/deployment/package.html | 24 +-
.../spi/discovery/DiscoveryMetricsHelper.java | 360 -
.../spi/discovery/DiscoveryMetricsProvider.java | 26 +-
.../discovery/DiscoveryNodeMetricsAdapter.java | 1060 --
.../ignite/spi/discovery/DiscoverySpi.java | 24 +-
.../spi/discovery/DiscoverySpiDataExchange.java | 22 +-
.../discovery/DiscoverySpiHistorySupport.java | 22 +-
.../spi/discovery/DiscoverySpiListener.java | 22 +-
.../DiscoverySpiNodeAuthenticator.java | 24 +-
.../spi/discovery/DiscoverySpiOrderSupport.java | 22 +-
.../apache/ignite/spi/discovery/package.html | 24 +-
.../discovery/tcp/TcpClientDiscoverySpi.java | 95 +-
.../tcp/TcpClientDiscoverySpiMBean.java | 58 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 176 +-
.../discovery/tcp/TcpDiscoverySpiAdapter.java | 64 +-
.../spi/discovery/tcp/TcpDiscoverySpiMBean.java | 86 +-
.../tcp/internal/TcpDiscoveryNode.java | 51 +-
.../tcp/internal/TcpDiscoveryNodesRing.java | 28 +-
.../tcp/internal/TcpDiscoverySpiState.java | 22 +-
.../tcp/internal/TcpDiscoveryStatistics.java | 30 +-
.../spi/discovery/tcp/internal/package.html | 24 +-
.../tcp/ipfinder/TcpDiscoveryIpFinder.java | 22 +-
.../ipfinder/TcpDiscoveryIpFinderAdapter.java | 26 +-
.../ipfinder/jdbc/TcpDiscoveryJdbcIpFinder.java | 31 +-
.../discovery/tcp/ipfinder/jdbc/package.html | 24 +-
.../TcpDiscoveryMulticastIpFinder.java | 41 +-
.../tcp/ipfinder/multicast/package.html | 24 +-
.../spi/discovery/tcp/ipfinder/package.html | 24 +-
.../sharedfs/TcpDiscoverySharedFsIpFinder.java | 31 +-
.../tcp/ipfinder/sharedfs/package.html | 24 +-
.../tcp/ipfinder/vm/TcpDiscoveryVmIpFinder.java | 28 +-
.../spi/discovery/tcp/ipfinder/vm/package.html | 24 +-
.../messages/TcpDiscoveryAbstractMessage.java | 26 +-
.../messages/TcpDiscoveryAuthFailedMessage.java | 24 +-
.../TcpDiscoveryCheckFailedMessage.java | 24 +-
.../TcpDiscoveryClientReconnectMessage.java | 26 +-
.../messages/TcpDiscoveryDiscardMessage.java | 24 +-
.../TcpDiscoveryDuplicateIdMessage.java | 24 +-
.../messages/TcpDiscoveryEnsureDelivery.java | 22 +-
.../messages/TcpDiscoveryHandshakeRequest.java | 24 +-
.../messages/TcpDiscoveryHandshakeResponse.java | 24 +-
.../messages/TcpDiscoveryHeartbeatMessage.java | 64 +-
.../TcpDiscoveryJoinRequestMessage.java | 24 +-
.../TcpDiscoveryLoopbackProblemMessage.java | 24 +-
.../TcpDiscoveryNodeAddFinishedMessage.java | 24 +-
.../messages/TcpDiscoveryNodeAddedMessage.java | 26 +-
.../messages/TcpDiscoveryNodeFailedMessage.java | 24 +-
.../messages/TcpDiscoveryNodeLeftMessage.java | 24 +-
.../tcp/messages/TcpDiscoveryPingRequest.java | 24 +-
.../tcp/messages/TcpDiscoveryPingResponse.java | 22 +-
.../messages/TcpDiscoveryRedirectToClient.java | 22 +-
.../TcpDiscoveryStatusCheckMessage.java | 24 +-
.../spi/discovery/tcp/messages/package.html | 24 +-
.../ignite/spi/discovery/tcp/package.html | 24 +-
.../spi/eventstorage/EventStorageSpi.java | 22 +-
.../memory/MemoryEventStorageSpi.java | 26 +-
.../memory/MemoryEventStorageSpiMBean.java | 34 +-
.../ignite/spi/eventstorage/memory/package.html | 25 +-
.../apache/ignite/spi/eventstorage/package.html | 25 +-
.../ignite/spi/failover/FailoverContext.java | 22 +-
.../apache/ignite/spi/failover/FailoverSpi.java | 22 +-
.../spi/failover/always/AlwaysFailoverSpi.java | 27 +-
.../failover/always/AlwaysFailoverSpiMBean.java | 30 +-
.../ignite/spi/failover/always/package.html | 24 +-
.../jobstealing/JobStealingFailoverSpi.java | 27 +-
.../JobStealingFailoverSpiMBean.java | 32 +-
.../spi/failover/jobstealing/package.html | 25 +-
.../spi/failover/never/NeverFailoverSpi.java | 24 +-
.../failover/never/NeverFailoverSpiMBean.java | 26 +-
.../ignite/spi/failover/never/package.html | 24 +-
.../org/apache/ignite/spi/failover/package.html | 25 +-
.../spi/indexing/GridIndexingQueryFilter.java | 22 +-
.../ignite/spi/indexing/GridIndexingSpi.java | 22 +-
.../spi/indexing/GridNoopIndexingSpi.java | 22 +-
.../org/apache/ignite/spi/indexing/package.html | 24 +-
.../spi/loadbalancing/LoadBalancingSpi.java | 30 +-
.../adaptive/AdaptiveCpuLoadProbe.java | 26 +-
.../adaptive/AdaptiveJobCountLoadProbe.java | 26 +-
.../adaptive/AdaptiveLoadBalancingSpi.java | 33 +-
.../adaptive/AdaptiveLoadBalancingSpiMBean.java | 28 +-
.../adaptive/AdaptiveLoadProbe.java | 22 +-
.../AdaptiveProcessingTimeLoadProbe.java | 26 +-
.../spi/loadbalancing/adaptive/package.html | 25 +-
.../ignite/spi/loadbalancing/package.html | 24 +-
.../RoundRobinGlobalLoadBalancer.java | 29 +-
.../roundrobin/RoundRobinLoadBalancingSpi.java | 37 +-
.../RoundRobinLoadBalancingSpiMBean.java | 28 +-
.../RoundRobinPerTaskLoadBalancer.java | 22 +-
.../spi/loadbalancing/roundrobin/package.html | 24 +-
.../WeightedRandomLoadBalancingSpi.java | 36 +-
.../WeightedRandomLoadBalancingSpiMBean.java | 30 +-
.../loadbalancing/weightedrandom/package.html | 25 +-
.../java/org/apache/ignite/spi/package.html | 25 +-
.../spi/securesession/SecureSessionSpi.java | 22 +-
.../noop/NoopSecureSessionSpi.java | 24 +-
.../noop/NoopSecureSessionSpiMBean.java | 26 +-
.../ignite/spi/securesession/noop/package.html | 24 +-
.../ignite/spi/securesession/package.html | 25 +-
.../ignite/spi/swapspace/SwapContext.java | 24 +-
.../apache/ignite/spi/swapspace/SwapKey.java | 26 +-
.../ignite/spi/swapspace/SwapSpaceSpi.java | 22 +-
.../spi/swapspace/SwapSpaceSpiListener.java | 22 +-
.../spi/swapspace/file/FileSwapArray.java | 22 +-
.../spi/swapspace/file/FileSwapSpaceSpi.java | 54 +-
.../swapspace/file/FileSwapSpaceSpiMBean.java | 36 +-
.../ignite/spi/swapspace/file/package.html | 24 +-
.../spi/swapspace/noop/NoopSwapSpaceSpi.java | 26 +-
.../ignite/spi/swapspace/noop/package.html | 24 +-
.../apache/ignite/spi/swapspace/package.html | 24 +-
.../ignite/startup/BasicWarmupClosure.java | 561 +
.../ignite/startup/cmdline/AboutDialog.java | 22 +-
.../CommandLineRandomNumberGenerator.java | 22 +-
.../startup/cmdline/CommandLineStartup.java | 32 +-
.../startup/cmdline/CommandLineTransformer.java | 22 +-
.../apache/ignite/startup/cmdline/package.html | 24 +-
.../org/apache/ignite/startup/package-info.java | 17 +
.../ignite/streamer/StreamerConfiguration.java | 26 +-
.../apache/ignite/streamer/StreamerContext.java | 22 +-
.../ignite/streamer/StreamerEventRouter.java | 22 +-
.../streamer/StreamerEventRouterAdapter.java | 26 +-
.../streamer/StreamerFailureListener.java | 22 +-
.../apache/ignite/streamer/StreamerMBean.java | 58 +-
.../apache/ignite/streamer/StreamerMetrics.java | 22 +-
.../apache/ignite/streamer/StreamerStage.java | 22 +-
.../ignite/streamer/StreamerStageMBean.java | 48 +-
.../ignite/streamer/StreamerStageMetrics.java | 22 +-
.../apache/ignite/streamer/StreamerWindow.java | 22 +-
.../ignite/streamer/StreamerWindowMBean.java | 34 +-
.../ignite/streamer/StreamerWindowMetrics.java | 22 +-
.../ignite/streamer/index/StreamerIndex.java | 22 +-
.../streamer/index/StreamerIndexEntry.java | 22 +-
.../streamer/index/StreamerIndexPolicy.java | 22 +-
.../streamer/index/StreamerIndexProvider.java | 22 +-
.../index/StreamerIndexProviderAdapter.java | 28 +-
.../index/StreamerIndexProviderMBean.java | 36 +-
.../streamer/index/StreamerIndexUpdateSync.java | 24 +-
.../streamer/index/StreamerIndexUpdater.java | 22 +-
.../index/hash/StreamerHashIndexProvider.java | 26 +-
.../ignite/streamer/index/hash/package.html | 24 +-
.../apache/ignite/streamer/index/package.html | 24 +-
.../index/tree/StreamerTreeIndexProvider.java | 28 +-
.../ignite/streamer/index/tree/package.html | 25 +-
.../org/apache/ignite/streamer/package.html | 24 +-
.../router/StreamerAffinityEventRouter.java | 28 +-
.../StreamerCacheAffinityEventRouter.java | 28 +-
.../router/StreamerLocalEventRouter.java | 24 +-
.../router/StreamerRandomEventRouter.java | 24 +-
.../router/StreamerRoundRobinEventRouter.java | 22 +-
.../apache/ignite/streamer/router/package.html | 24 +-
.../window/StreamerBoundedSizeBatchWindow.java | 41 +-
.../window/StreamerBoundedSizeSortedWindow.java | 28 +-
.../window/StreamerBoundedSizeWindow.java | 24 +-
.../StreamerBoundedSizeWindowAdapter.java | 28 +-
.../window/StreamerBoundedTimeBatchWindow.java | 41 +-
.../window/StreamerBoundedTimeWindow.java | 30 +-
.../window/StreamerUnboundedWindow.java | 24 +-
.../streamer/window/StreamerWindowAdapter.java | 30 +-
.../apache/ignite/streamer/window/package.html | 24 +-
.../thread/IgniteStripedThreadPoolExecutor.java | 24 +-
.../org/apache/ignite/thread/IgniteThread.java | 26 +-
.../ignite/thread/IgniteThreadFactory.java | 22 +-
.../ignite/thread/IgniteThreadPoolExecutor.java | 22 +-
.../java/org/apache/ignite/thread/package.html | 24 +-
.../apache/ignite/transactions/IgniteTx.java | 74 +-
.../transactions/IgniteTxConcurrency.java | 24 +-
.../IgniteTxHeuristicException.java | 22 +-
.../ignite/transactions/IgniteTxIsolation.java | 22 +-
.../ignite/transactions/IgniteTxMetrics.java | 22 +-
.../IgniteTxOptimisticException.java | 22 +-
.../transactions/IgniteTxRollbackException.java | 22 +-
.../ignite/transactions/IgniteTxState.java | 22 +-
.../transactions/IgniteTxSynchronization.java | 25 +-
.../transactions/IgniteTxTimeoutException.java | 22 +-
.../java/org/gridgain/client/GridClient.java | 140 -
.../GridClientAuthenticationException.java | 27 -
.../gridgain/client/GridClientCacheFlag.java | 57 -
.../gridgain/client/GridClientCacheMode.java | 23 -
.../client/GridClientClosedException.java | 26 -
.../org/gridgain/client/GridClientCompute.java | 468 -
.../client/GridClientConfiguration.java | 860 --
.../org/gridgain/client/GridClientData.java | 435 -
.../gridgain/client/GridClientDataAffinity.java | 31 -
.../client/GridClientDataConfiguration.java | 109 -
.../gridgain/client/GridClientDataMetrics.java | 69 -
.../client/GridClientDisconnectedException.java | 28 -
.../gridgain/client/GridClientException.java | 103 -
.../org/gridgain/client/GridClientFactory.java | 130 -
.../org/gridgain/client/GridClientFuture.java | 60 -
.../client/GridClientFutureListener.java | 22 -
.../GridClientFutureTimeoutException.java | 36 -
.../client/GridClientHandshakeException.java | 40 -
.../org/gridgain/client/GridClientNode.java | 144 -
.../gridgain/client/GridClientNodeMetrics.java | 516 -
.../client/GridClientPartitionAffinity.java | 361 -
.../gridgain/client/GridClientPredicate.java | 30 -
.../org/gridgain/client/GridClientProtocol.java | 22 -
.../client/GridClientTopologyListener.java | 33 -
.../client/GridServerUnreachableException.java | 36 -
.../balancer/GridClientBalancerAdapter.java | 68 -
.../client/balancer/GridClientLoadBalancer.java | 36 -
.../balancer/GridClientRandomBalancer.java | 66 -
.../balancer/GridClientRoundRobinBalancer.java | 102 -
.../org/gridgain/client/balancer/package.html | 15 -
.../impl/GridClientAbstractProjection.java | 449 -
.../client/impl/GridClientAndPredicate.java | 43 -
.../client/impl/GridClientComputeImpl.java | 284 -
.../client/impl/GridClientDataImpl.java | 380 -
.../impl/GridClientDataMetricsAdapter.java | 152 -
.../client/impl/GridClientFutureAdapter.java | 341 -
.../client/impl/GridClientFutureCallback.java | 27 -
.../gridgain/client/impl/GridClientImpl.java | 515 -
.../client/impl/GridClientNodeImpl.java | 402 -
.../impl/GridClientNodeMetricsAdapter.java | 982 --
.../client/impl/GridClientThreadFactory.java | 54 -
.../impl/connection/GridClientConnection.java | 522 -
.../GridClientConnectionCloseReason.java | 24 -
.../connection/GridClientConnectionManager.java | 54 -
.../GridClientConnectionManagerAdapter.java | 691 -
.../GridClientConnectionManagerOsImpl.java | 39 -
.../GridClientConnectionResetException.java | 39 -
.../connection/GridClientNioTcpConnection.java | 1151 --
.../impl/connection/GridClientTopology.java | 441 -
.../GridConnectionIdleClosedException.java | 27 -
.../java/org/gridgain/client/impl/package.html | 15 -
.../client/marshaller/GridClientMarshaller.java | 37 -
.../marshaller/jdk/GridClientJdkMarshaller.java | 60 -
.../gridgain/client/marshaller/jdk/package.html | 15 -
.../GridClientOptimizedMarshaller.java | 96 -
.../client/marshaller/optimized/package.html | 15 -
.../org/gridgain/client/marshaller/package.html | 15 -
.../main/java/org/gridgain/client/package.html | 15 -
.../client/router/GridRouterFactory.java | 113 -
.../gridgain/client/router/GridTcpRouter.java | 68 -
.../router/GridTcpRouterConfiguration.java | 289 -
.../client/router/GridTcpRouterMBean.java | 80 -
.../router/impl/GridRouterClientImpl.java | 192 -
.../impl/GridRouterCommandLineStartup.java | 157 -
.../client/router/impl/GridTcpRouterImpl.java | 341 -
.../impl/GridTcpRouterNioListenerAdapter.java | 195 -
.../impl/GridTcpRouterNioListenerOsImpl.java | 30 -
.../router/impl/GridTcpRouterNioParser.java | 101 -
.../gridgain/client/router/impl/package.html | 15 -
.../org/gridgain/client/router/package.html | 15 -
.../client/ssl/GridSslBasicContextFactory.java | 430 -
.../client/ssl/GridSslContextFactory.java | 28 -
.../java/org/gridgain/client/ssl/package.html | 15 -
.../client/util/GridClientConsistentHash.java | 432 -
.../client/util/GridClientStripedLock.java | 127 -
.../gridgain/client/util/GridClientUtils.java | 164 -
.../client/util/GridConcurrentHashSet.java | 104 -
.../java/org/gridgain/client/util/package.html | 15 -
.../grid/GridAuthenticationException.java | 29 -
.../gridgain/grid/GridBasicWarmupClosure.java | 551 -
.../gridgain/grid/GridDeploymentException.java | 50 -
.../grid/GridIllegalStateException.java | 76 -
.../gridgain/grid/GridInterruptedException.java | 50 -
.../org/gridgain/grid/GridMetadataAware.java | 179 -
.../gridgain/grid/GridNotPeerDeployable.java | 33 -
.../java/org/gridgain/grid/cache/GridCache.java | 271 -
.../GridCacheAtomicUpdateTimeoutException.java | 39 -
.../cache/GridCacheAtomicWriteOrderMode.java | 56 -
.../grid/cache/GridCacheAtomicityMode.java | 71 -
.../grid/cache/GridCacheConfiguration.java | 1732 ---
.../grid/cache/GridCacheDistributionMode.java | 61 -
.../org/gridgain/grid/cache/GridCacheEntry.java | 561 -
.../org/gridgain/grid/cache/GridCacheFlag.java | 102 -
.../grid/cache/GridCacheFlagException.java | 59 -
.../grid/cache/GridCacheInterceptor.java | 112 -
.../grid/cache/GridCacheInterceptorAdapter.java | 44 -
.../org/gridgain/grid/cache/GridCacheMBean.java | 287 -
.../grid/cache/GridCacheMemoryMode.java | 53 -
.../gridgain/grid/cache/GridCacheMetrics.java | 95 -
.../org/gridgain/grid/cache/GridCacheMode.java | 66 -
.../org/gridgain/grid/cache/GridCacheName.java | 35 -
.../cache/GridCachePartialUpdateException.java | 55 -
.../gridgain/grid/cache/GridCachePeekMode.java | 77 -
.../grid/cache/GridCachePreloadMode.java | 60 -
.../grid/cache/GridCacheProjection.java | 2091 ---
.../GridCacheWriteSynchronizationMode.java | 61 -
.../grid/cache/affinity/GridCacheAffinity.java | 254 -
.../affinity/GridCacheAffinityFunction.java | 103 -
.../GridCacheAffinityFunctionContext.java | 63 -
.../cache/affinity/GridCacheAffinityKey.java | 181 -
.../affinity/GridCacheAffinityKeyMapped.java | 150 -
.../affinity/GridCacheAffinityKeyMapper.java | 56 -
...ridCacheAffinityNodeAddressHashResolver.java | 31 -
.../GridCacheAffinityNodeHashResolver.java | 35 -
.../GridCacheAffinityNodeIdHashResolver.java | 32 -
.../GridCacheCentralizedAffinityFunction.java | 23 -
...GridCacheConsistentHashAffinityFunction.java | 695 -
.../cache/affinity/consistenthash/package.html | 15 -
.../fair/GridCachePartitionFairAffinity.java | 797 -
.../grid/cache/affinity/fair/package.html | 15 -
.../gridgain/grid/cache/affinity/package.html | 15 -
.../GridCacheRendezvousAffinityFunction.java | 495 -
.../grid/cache/affinity/rendezvous/package.html | 15 -
.../grid/cache/cloner/GridCacheBasicCloner.java | 26 -
.../grid/cache/cloner/GridCacheCloner.java | 50 -
.../grid/cache/cloner/GridCacheDeepCloner.java | 79 -
.../org/gridgain/grid/cache/cloner/package.html | 15 -
.../datastructures/GridCacheAtomicLong.java | 149 -
.../GridCacheAtomicReference.java | 85 -
.../datastructures/GridCacheAtomicSequence.java | 122 -
.../datastructures/GridCacheAtomicStamped.java | 113 -
.../datastructures/GridCacheCountDownLatch.java | 219 -
.../GridCacheDataStructureInvalidException.java | 58 -
...cheDataStructureInvalidRuntimeException.java | 58 -
.../GridCacheDataStructureRemovedException.java | 53 -
...cheDataStructureRemovedRuntimeException.java | 53 -
.../datastructures/GridCacheDataStructures.java | 213 -
.../cache/datastructures/GridCacheQueue.java | 174 -
.../grid/cache/datastructures/GridCacheSet.java | 53 -
.../grid/cache/datastructures/package.html | 15 -
.../cache/eviction/GridCacheEvictionFilter.java | 32 -
.../cache/eviction/GridCacheEvictionPolicy.java | 48 -
.../fifo/GridCacheFifoEvictionPolicy.java | 202 -
.../fifo/GridCacheFifoEvictionPolicyMBean.java | 50 -
.../grid/cache/eviction/fifo/package.html | 15 -
.../ggfs/GridCacheGgfsEvictionFilter.java | 26 -
.../GridCacheGgfsPerBlockLruEvictionPolicy.java | 345 -
...CacheGgfsPerBlockLruEvictionPolicyMBean.java | 85 -
.../grid/cache/eviction/ggfs/package.html | 15 -
.../lru/GridCacheLruEvictionPolicy.java | 185 -
.../lru/GridCacheLruEvictionPolicyMBean.java | 50 -
.../grid/cache/eviction/lru/package.html | 15 -
.../gridgain/grid/cache/eviction/package.html | 15 -
.../random/GridCacheRandomEvictionPolicy.java | 113 -
.../GridCacheRandomEvictionPolicyMBean.java | 34 -
.../grid/cache/eviction/random/package.html | 15 -
.../java/org/gridgain/grid/cache/package.html | 15 -
.../cache/query/GridCacheContinuousQuery.java | 334 -
.../query/GridCacheContinuousQueryEntry.java | 41 -
.../grid/cache/query/GridCacheQueries.java | 143 -
.../grid/cache/query/GridCacheQuery.java | 289 -
.../query/GridCacheQueryConfiguration.java | 195 -
.../grid/cache/query/GridCacheQueryFuture.java | 58 -
.../cache/query/GridCacheQueryGroupIndex.java | 50 -
.../grid/cache/query/GridCacheQueryMetrics.java | 52 -
.../cache/query/GridCacheQuerySqlField.java | 125 -
.../cache/query/GridCacheQuerySqlFunction.java | 61 -
.../cache/query/GridCacheQueryTextField.java | 25 -
.../grid/cache/query/GridCacheQueryType.java | 39 -
.../cache/query/GridCacheQueryTypeMetadata.java | 188 -
.../cache/query/GridCacheQueryTypeResolver.java | 24 -
.../org/gridgain/grid/cache/query/package.html | 15 -
.../store/GridCacheLoadOnlyStoreAdapter.java | 320 -
.../grid/cache/store/GridCacheLocalStore.java | 23 -
.../grid/cache/store/GridCacheStore.java | 212 -
.../grid/cache/store/GridCacheStoreAdapter.java | 92 -
.../store/GridCacheStoreBalancingWrapper.java | 270 -
.../store/jdbc/GridCacheJdbcBlobStore.java | 544 -
.../gridgain/grid/cache/store/jdbc/package.html | 15 -
.../org/gridgain/grid/cache/store/package.html | 15 -
.../grid/dotnet/GridDotNetConfiguration.java | 95 -
.../dotnet/GridDotNetPortableConfiguration.java | 211 -
.../GridDotNetPortableTypeConfiguration.java | 224 -
.../java/org/gridgain/grid/dotnet/package.html | 15 -
.../org/gridgain/grid/hadoop/GridHadoop.java | 78 -
.../grid/hadoop/GridHadoopConfiguration.java | 164 -
.../gridgain/grid/hadoop/GridHadoopCounter.java | 36 -
.../grid/hadoop/GridHadoopCounterWriter.java | 28 -
.../grid/hadoop/GridHadoopCounters.java | 41 -
.../grid/hadoop/GridHadoopFileBlock.java | 154 -
.../grid/hadoop/GridHadoopInputSplit.java | 46 -
.../org/gridgain/grid/hadoop/GridHadoopJob.java | 94 -
.../gridgain/grid/hadoop/GridHadoopJobId.java | 94 -
.../gridgain/grid/hadoop/GridHadoopJobInfo.java | 76 -
.../grid/hadoop/GridHadoopJobPhase.java | 30 -
.../grid/hadoop/GridHadoopJobProperty.java | 130 -
.../grid/hadoop/GridHadoopJobStatus.java | 199 -
.../grid/hadoop/GridHadoopMapReducePlan.java | 72 -
.../grid/hadoop/GridHadoopMapReducePlanner.java | 32 -
.../grid/hadoop/GridHadoopPartitioner.java | 25 -
.../grid/hadoop/GridHadoopSerialization.java | 46 -
.../gridgain/grid/hadoop/GridHadoopTask.java | 65 -
.../grid/hadoop/GridHadoopTaskContext.java | 181 -
.../grid/hadoop/GridHadoopTaskInfo.java | 145 -
.../grid/hadoop/GridHadoopTaskInput.java | 47 -
.../grid/hadoop/GridHadoopTaskOutput.java | 32 -
.../grid/hadoop/GridHadoopTaskType.java | 48 -
.../java/org/gridgain/grid/hadoop/package.html | 15 -
.../grid/kernal/ClusterGroupAdapter.java | 844 --
.../gridgain/grid/kernal/ClusterGroupEx.java | 27 -
.../grid/kernal/ClusterLocalNodeMetrics.java | 303 -
.../grid/kernal/ClusterMetricsImpl.java | 805 -
.../grid/kernal/ClusterNodeLocalMapImpl.java | 175 -
.../grid/kernal/ClusterNodeMetricsMBean.java | 21 -
.../grid/kernal/GridClosureCallMode.java | 53 -
.../org/gridgain/grid/kernal/GridComponent.java | 88 -
.../gridgain/grid/kernal/GridComponentType.java | 275 -
.../gridgain/grid/kernal/GridDiagnostic.java | 164 -
.../grid/kernal/GridDirectCollection.java | 24 -
.../org/gridgain/grid/kernal/GridDirectMap.java | 29 -
.../grid/kernal/GridDirectTransient.java | 21 -
.../gridgain/grid/kernal/GridDirectVersion.java | 24 -
.../grid/kernal/GridEventConsumeHandler.java | 408 -
.../java/org/gridgain/grid/kernal/GridEx.java | 135 -
.../org/gridgain/grid/kernal/GridGainEx.java | 2356 ---
.../grid/kernal/GridInternalException.java | 61 -
.../grid/kernal/GridInternalWrapper.java | 22 -
.../grid/kernal/GridJobCancelRequest.java | 203 -
.../grid/kernal/GridJobContextImpl.java | 276 -
.../grid/kernal/GridJobExecuteRequest.java | 888 --
.../grid/kernal/GridJobExecuteRequestV2.java | 175 -
.../grid/kernal/GridJobExecuteResponse.java | 354 -
.../gridgain/grid/kernal/GridJobResultImpl.java | 174 -
.../grid/kernal/GridJobSessionImpl.java | 280 -
.../grid/kernal/GridJobSiblingImpl.java | 183 -
.../grid/kernal/GridJobSiblingsRequest.java | 163 -
.../grid/kernal/GridJobSiblingsResponse.java | 141 -
.../org/gridgain/grid/kernal/GridKernal.java | 3308 -----
.../gridgain/grid/kernal/GridKernalContext.java | 496 -
.../grid/kernal/GridKernalContextImpl.java | 830 --
.../gridgain/grid/kernal/GridKernalGateway.java | 123 -
.../grid/kernal/GridKernalGatewayImpl.java | 221 -
.../gridgain/grid/kernal/GridKernalState.java | 43 -
.../org/gridgain/grid/kernal/GridKillTask.java | 97 -
.../gridgain/grid/kernal/GridLoggerProxy.java | 212 -
.../grid/kernal/GridMessageListenHandler.java | 193 -
.../grid/kernal/GridNodeAttributes.java | 140 -
.../grid/kernal/GridNodeOrderComparator.java | 28 -
.../grid/kernal/GridPerformanceSuggestions.java | 82 -
.../grid/kernal/GridPluginComponent.java | 88 -
.../gridgain/grid/kernal/GridPluginContext.java | 93 -
.../gridgain/grid/kernal/GridPortablesImpl.java | 166 -
.../gridgain/grid/kernal/GridProductImpl.java | 182 -
.../gridgain/grid/kernal/GridProperties.java | 74 -
.../gridgain/grid/kernal/GridProxyListener.java | 43 -
.../grid/kernal/GridTaskCancelRequest.java | 124 -
.../grid/kernal/GridTaskFutureImpl.java | 114 -
.../gridgain/grid/kernal/GridTaskMessage.java | 22 -
.../grid/kernal/GridTaskNameHashKey.java | 67 -
.../grid/kernal/GridTaskSessionImpl.java | 831 --
.../grid/kernal/GridTaskSessionInternal.java | 61 -
.../grid/kernal/GridTaskSessionRequest.java | 192 -
.../org/gridgain/grid/kernal/GridTopic.java | 821 --
.../grid/kernal/GridUpdateNotifier.java | 369 -
.../grid/kernal/IgniteClusterAsyncImpl.java | 231 -
.../gridgain/grid/kernal/IgniteComputeImpl.java | 469 -
.../gridgain/grid/kernal/IgniteEventsImpl.java | 292 -
.../gridgain/grid/kernal/IgniteManagedImpl.java | 257 -
.../grid/kernal/IgniteMessagingImpl.java | 214 -
.../grid/kernal/IgniteSchedulerImpl.java | 133 -
.../kernal/IgniteThreadPoolMBeanAdapter.java | 141 -
.../grid/kernal/IgniteTransactionsEx.java | 34 -
.../grid/kernal/IgnitionMBeanAdapter.java | 51 -
.../kernal/executor/GridExecutorService.java | 729 -
.../gridgain/grid/kernal/executor/package.html | 15 -
.../ggfs/common/GridGgfsControlResponse.java | 625 -
.../ggfs/common/GridGgfsDataInputStream.java | 32 -
.../ggfs/common/GridGgfsDataOutputStream.java | 35 -
.../ggfs/common/GridGgfsHandshakeRequest.java | 85 -
.../kernal/ggfs/common/GridGgfsIpcCommand.java | 90 -
.../grid/kernal/ggfs/common/GridGgfsLogger.java | 759 -
.../kernal/ggfs/common/GridGgfsMarshaller.java | 366 -
.../kernal/ggfs/common/GridGgfsMessage.java | 33 -
.../ggfs/common/GridGgfsPathControlRequest.java | 230 -
.../ggfs/common/GridGgfsStatusRequest.java | 27 -
.../common/GridGgfsStreamControlRequest.java | 93 -
.../grid/kernal/ggfs/common/package.html | 15 -
.../grid/kernal/managers/GridManager.java | 38 -
.../kernal/managers/GridManagerAdapter.java | 598 -
.../kernal/managers/GridNoopManagerAdapter.java | 80 -
.../checkpoint/GridCheckpointManager.java | 439 -
.../checkpoint/GridCheckpointRequest.java | 177 -
.../kernal/managers/checkpoint/package.html | 15 -
.../GridCollisionJobContextAdapter.java | 54 -
.../collision/GridCollisionManager.java | 125 -
.../grid/kernal/managers/collision/package.html | 15 -
.../communication/GridDisconnectListener.java | 26 -
.../managers/communication/GridIoManager.java | 2308 ---
.../managers/communication/GridIoMessage.java | 349 -
.../managers/communication/GridIoPolicy.java | 49 -
.../communication/GridIoUserMessage.java | 427 -
.../communication/GridMessageListener.java | 26 -
.../kernal/managers/communication/package.html | 15 -
.../managers/deployment/GridDeployment.java | 767 -
.../deployment/GridDeploymentClassLoader.java | 794 -
.../deployment/GridDeploymentCommunication.java | 478 -
.../managers/deployment/GridDeploymentInfo.java | 50 -
.../deployment/GridDeploymentInfoBean.java | 347 -
.../deployment/GridDeploymentLocalStore.java | 550 -
.../deployment/GridDeploymentManager.java | 606 -
.../deployment/GridDeploymentMetadata.java | 282 -
.../GridDeploymentPerLoaderStore.java | 513 -
.../GridDeploymentPerVersionStore.java | 1273 --
.../deployment/GridDeploymentRequest.java | 322 -
.../deployment/GridDeploymentResponse.java | 200 -
.../deployment/GridDeploymentStore.java | 90 -
.../deployment/GridDeploymentStoreAdapter.java | 151 -
.../kernal/managers/deployment/package.html | 15 -
.../protocol/gg/GridProtocolHandler.java | 45 -
.../protocol/gg/GridUrlConnection.java | 66 -
.../deployment/protocol/gg/package.html | 15 -
.../discovery/GridDiscoveryManager.java | 2172 ---
.../GridDiscoveryTopologySnapshot.java | 54 -
.../managers/discovery/GridLocalMetrics.java | 208 -
.../grid/kernal/managers/discovery/package.html | 15 -
.../eventstorage/GridEventStorageManager.java | 1145 --
.../eventstorage/GridEventStorageMessage.java | 515 -
.../eventstorage/GridLocalEventListener.java | 31 -
.../kernal/managers/eventstorage/package.html | 15 -
.../failover/GridFailoverContextImpl.java | 74 -
.../managers/failover/GridFailoverManager.java | 58 -
.../grid/kernal/managers/failover/package.html | 15 -
.../managers/indexing/GridIndexingManager.java | 224 -
.../grid/kernal/managers/indexing/package.html | 15 -
.../loadbalancer/GridLoadBalancerAdapter.java | 44 -
.../loadbalancer/GridLoadBalancerManager.java | 155 -
.../kernal/managers/loadbalancer/package.html | 15 -
.../gridgain/grid/kernal/managers/package.html | 15 -
.../securesession/GridSecureSession.java | 46 -
.../securesession/GridSecureSessionManager.java | 46 -
.../os/GridOsSecureSessionManager.java | 48 -
.../managers/securesession/os/package.html | 15 -
.../kernal/managers/securesession/package.html | 15 -
.../security/GridAllowAllPermissionSet.java | 47 -
.../managers/security/GridSecurityContext.java | 240 -
.../managers/security/GridSecurityImpl.java | 76 -
.../managers/security/GridSecurityManager.java | 85 -
.../security/GridSecuritySubjectAdapter.java | 123 -
.../security/os/GridOsSecurityManager.java | 89 -
.../kernal/managers/security/os/package.html | 15 -
.../grid/kernal/managers/security/package.html | 15 -
.../swapspace/GridSwapSpaceManager.java | 418 -
.../grid/kernal/managers/swapspace/package.html | 15 -
.../java/org/gridgain/grid/kernal/package.html | 15 -
.../grid/kernal/processors/GridProcessor.java | 30 -
.../kernal/processors/GridProcessorAdapter.java | 118 -
.../affinity/GridAffinityAssignment.java | 160 -
.../affinity/GridAffinityAssignmentCache.java | 401 -
.../affinity/GridAffinityMessage.java | 156 -
.../affinity/GridAffinityProcessor.java | 520 -
.../processors/affinity/GridAffinityUtils.java | 181 -
.../GridCacheAffinityFunctionContextImpl.java | 75 -
.../kernal/processors/affinity/package.html | 15 -
.../processors/cache/GridCacheAdapter.java | 4778 ------
.../cache/GridCacheAffinityManager.java | 370 -
.../processors/cache/GridCacheAtomicFuture.java | 39 -
.../cache/GridCacheAtomicVersionComparator.java | 50 -
.../processors/cache/GridCacheAttributes.java | 598 -
.../cache/GridCacheBatchSwapEntry.java | 81 -
.../cache/GridCacheClearAllRunnable.java | 166 -
.../cache/GridCacheConcurrentMap.java | 2411 ---
.../processors/cache/GridCacheContext.java | 1807 ---
.../GridCacheDefaultAffinityKeyMapper.java | 129 -
.../processors/cache/GridCacheDeployable.java | 29 -
.../cache/GridCacheDeploymentManager.java | 943 --
.../processors/cache/GridCacheEntryEx.java | 888 --
.../processors/cache/GridCacheEntryImpl.java | 772 -
.../processors/cache/GridCacheEntryInfo.java | 326 -
.../GridCacheEntryInfoCollectSwapListener.java | 81 -
.../cache/GridCacheEntryRedeployException.java | 27 -
.../cache/GridCacheEntryRemovedException.java | 20 -
.../processors/cache/GridCacheEntrySet.java | 104 -
.../processors/cache/GridCacheEventManager.java | 246 -
.../cache/GridCacheEvictionEntry.java | 523 -
.../cache/GridCacheEvictionManager.java | 2030 ---
.../cache/GridCacheEvictionRequest.java | 241 -
.../cache/GridCacheEvictionResponse.java | 273 -
.../cache/GridCacheExplicitLockSpan.java | 270 -
.../cache/GridCacheFilterEvaluationEntry.java | 429 -
.../cache/GridCacheFilterFailedException.java | 50 -
.../processors/cache/GridCacheFuture.java | 53 -
.../processors/cache/GridCacheGateway.java | 145 -
.../cache/GridCacheIndexUpdateException.java | 37 -
.../processors/cache/GridCacheInternal.java | 19 -
.../processors/cache/GridCacheIoManager.java | 858 --
.../processors/cache/GridCacheIterator.java | 78 -
.../processors/cache/GridCacheKeySet.java | 103 -
.../cache/GridCacheLockTimeoutException.java | 25 -
.../processors/cache/GridCacheLogger.java | 181 -
.../processors/cache/GridCacheMBeanAdapter.java | 209 -
.../processors/cache/GridCacheManager.java | 49 -
.../cache/GridCacheManagerAdapter.java | 159 -
.../processors/cache/GridCacheMapAdapter.java | 166 -
.../processors/cache/GridCacheMapEntry.java | 4149 ------
.../cache/GridCacheMapEntryFactory.java | 31 -
.../processors/cache/GridCacheMessage.java | 659 -
.../cache/GridCacheMetricsAdapter.java | 252 -
.../cache/GridCacheMultiTxFuture.java | 138 -
.../kernal/processors/cache/GridCacheMvcc.java | 1250 --
.../processors/cache/GridCacheMvccCallback.java | 36 -
.../cache/GridCacheMvccCandidate.java | 699 -
.../processors/cache/GridCacheMvccFuture.java | 22 -
.../processors/cache/GridCacheMvccManager.java | 1171 --
.../cache/GridCacheOffheapSwapEntry.java | 187 -
.../processors/cache/GridCacheOperation.java | 52 -
.../GridCachePartitionExchangeManager.java | 1015 --
.../processors/cache/GridCachePreloader.java | 120 -
.../cache/GridCachePreloaderAdapter.java | 133 -
.../processors/cache/GridCacheProcessor.java | 1852 ---
.../processors/cache/GridCacheProjectionEx.java | 384 -
.../cache/GridCacheProjectionImpl.java | 1386 --
.../kernal/processors/cache/GridCacheProxy.java | 19 -
.../processors/cache/GridCacheProxyImpl.java | 1886 ---
.../processors/cache/GridCacheReturn.java | 167 -
.../cache/GridCacheSharedContext.java | 500 -
.../cache/GridCacheSharedManager.java | 49 -
.../cache/GridCacheSharedManagerAdapter.java | 159 -
.../processors/cache/GridCacheStoreManager.java | 509 -
.../processors/cache/GridCacheSwapEntry.java | 73 -
.../cache/GridCacheSwapEntryImpl.java | 336 -
.../processors/cache/GridCacheSwapListener.java | 23 -
.../processors/cache/GridCacheSwapManager.java | 1607 --
.../cache/GridCacheTransformComputeClosure.java | 68 -
.../processors/cache/GridCacheTtlManager.java | 208 -
.../cache/GridCacheUpdateAtomicResult.java | 139 -
.../cache/GridCacheUpdateTxResult.java | 56 -
.../processors/cache/GridCacheUtilityKey.java | 37 -
.../kernal/processors/cache/GridCacheUtils.java | 1651 ---
.../processors/cache/GridCacheValueBytes.java | 112 -
.../cache/GridCacheValueCollection.java | 159 -
.../processors/cache/GridCacheVersion.java | 248 -
.../processors/cache/GridCacheVersionEx.java | 87 -
.../cache/GridCacheVersionManager.java | 273 -
.../processors/cache/GridCacheVersionable.java | 20 -
.../cache/GridCacheWriteBehindStore.java | 1002 --
.../processors/cache/GridDrResolveResult.java | 55 -
.../processors/cache/GridPartitionLockKey.java | 96 -
.../cache/affinity/GridCacheAffinityImpl.java | 214 -
.../cache/affinity/GridCacheAffinityProxy.java | 254 -
.../GridAtomicCacheQueueImpl.java | 251 -
.../GridCacheAnnotationHelper.java | 232 -
.../datastructures/GridCacheAtomicLongEx.java | 24 -
.../datastructures/GridCacheAtomicLongImpl.java | 519 -
.../GridCacheAtomicLongValue.java | 76 -
.../GridCacheAtomicReferenceEx.java | 25 -
.../GridCacheAtomicReferenceImpl.java | 312 -
.../GridCacheAtomicReferenceValue.java | 98 -
.../GridCacheAtomicSequenceEx.java | 24 -
.../GridCacheAtomicSequenceImpl.java | 508 -
.../GridCacheAtomicSequenceValue.java | 76 -
.../GridCacheAtomicStampedEx.java | 24 -
.../GridCacheAtomicStampedImpl.java | 342 -
.../GridCacheAtomicStampedValue.java | 127 -
.../GridCacheCountDownLatchEx.java | 31 -
.../GridCacheCountDownLatchImpl.java | 351 -
.../GridCacheCountDownLatchValue.java | 107 -
.../GridCacheDataStructuresImpl.java | 111 -
.../GridCacheDataStructuresManager.java | 1575 --
.../GridCacheDataStructuresProxy.java | 259 -
.../datastructures/GridCacheInternalKey.java | 23 -
.../GridCacheInternalKeyImpl.java | 81 -
.../datastructures/GridCacheQueueAdapter.java | 952 --
.../datastructures/GridCacheQueueHeader.java | 191 -
.../datastructures/GridCacheQueueHeaderKey.java | 80 -
.../datastructures/GridCacheQueueItemKey.java | 113 -
.../datastructures/GridCacheQueueProxy.java | 738 -
.../datastructures/GridCacheRemovable.java | 29 -
.../datastructures/GridCacheSetHeader.java | 77 -
.../datastructures/GridCacheSetHeaderKey.java | 80 -
.../cache/datastructures/GridCacheSetImpl.java | 716 -
.../datastructures/GridCacheSetItemKey.java | 101 -
.../cache/datastructures/GridCacheSetProxy.java | 530 -
.../datastructures/GridSetQueryPredicate.java | 108 -
.../GridTransactionalCacheQueueImpl.java | 235 -
.../distributed/GridCacheCommittedTxInfo.java | 104 -
.../distributed/GridCacheMappedVersion.java | 25 -
...ridCacheOptimisticCheckPreparedTxFuture.java | 380 -
...idCacheOptimisticCheckPreparedTxRequest.java | 213 -
...dCacheOptimisticCheckPreparedTxResponse.java | 186 -
.../GridCachePerThreadTxCommitBuffer.java | 177 -
...dCachePessimisticCheckCommittedTxFuture.java | 372 -
...CachePessimisticCheckCommittedTxRequest.java | 276 -
...achePessimisticCheckCommittedTxResponse.java | 217 -
.../distributed/GridCacheTxCommitBuffer.java | 52 -
.../distributed/GridCacheTxFinishSync.java | 285 -
.../distributed/GridDistributedBaseMessage.java | 442 -
.../GridDistributedCacheAdapter.java | 111 -
.../distributed/GridDistributedCacheEntry.java | 842 --
.../GridDistributedLockCancelledException.java | 32 -
.../distributed/GridDistributedLockRequest.java | 813 -
.../GridDistributedLockResponse.java | 411 -
.../GridDistributedTxFinishRequest.java | 683 -
.../GridDistributedTxFinishResponse.java | 160 -
.../distributed/GridDistributedTxMapping.java | 294 -
.../GridDistributedTxPrepareRequest.java | 762 -
.../GridDistributedTxPrepareResponse.java | 238 -
.../GridDistributedTxRemoteAdapter.java | 801 -
.../GridDistributedUnlockRequest.java | 231 -
.../GridPartitionedCacheEntryImpl.java | 562 -
.../dht/GridClientPartitionTopology.java | 809 -
.../dht/GridDhtAffinityAssignmentRequest.java | 131 -
.../dht/GridDhtAffinityAssignmentResponse.java | 186 -
.../dht/GridDhtAssignmentFetchFuture.java | 176 -
.../cache/distributed/dht/GridDhtCache.java | 95 -
.../distributed/dht/GridDhtCacheAdapter.java | 754 -
.../distributed/dht/GridDhtCacheEntry.java | 752 -
.../distributed/dht/GridDhtCacheEntryImpl.java | 164 -
.../distributed/dht/GridDhtEmbeddedFuture.java | 84 -
.../distributed/dht/GridDhtFinishedFuture.java | 58 -
.../cache/distributed/dht/GridDhtFuture.java | 28 -
.../cache/distributed/dht/GridDhtGetFuture.java | 389 -
.../dht/GridDhtInvalidPartitionException.java | 43 -
.../distributed/dht/GridDhtLocalPartition.java | 587 -
.../distributed/dht/GridDhtLockFuture.java | 1217 --
.../distributed/dht/GridDhtLockRequest.java | 534 -
.../distributed/dht/GridDhtLockResponse.java | 443 -
.../distributed/dht/GridDhtPartitionState.java | 47 -
.../dht/GridDhtPartitionTopology.java | 199 -
.../dht/GridDhtPartitionTopologyImpl.java | 1188 --
.../distributed/dht/GridDhtTopologyFuture.java | 36 -
.../dht/GridDhtTransactionalCacheAdapter.java | 1451 --
.../distributed/dht/GridDhtTxFinishFuture.java | 502 -
.../distributed/dht/GridDhtTxFinishRequest.java | 591 -
.../dht/GridDhtTxFinishResponse.java | 135 -
.../cache/distributed/dht/GridDhtTxLocal.java | 643 -
.../distributed/dht/GridDhtTxLocalAdapter.java | 785 -
.../cache/distributed/dht/GridDhtTxMapping.java | 161 -
.../distributed/dht/GridDhtTxPrepareFuture.java | 1067 --
.../dht/GridDhtTxPrepareRequest.java | 589 -
.../dht/GridDhtTxPrepareResponse.java | 459 -
.../cache/distributed/dht/GridDhtTxRemote.java | 307 -
.../distributed/dht/GridDhtUnlockRequest.java | 213 -
.../distributed/dht/GridNoStorageCacheMap.java | 101 -
.../dht/GridPartitionedGetFuture.java | 680 -
.../dht/atomic/GridDhtAtomicCache.java | 2557 ----
.../dht/atomic/GridDhtAtomicCacheEntry.java | 67 -
.../GridDhtAtomicDeferredUpdateResponse.java | 180 -
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 410 -
.../dht/atomic/GridDhtAtomicUpdateRequest.java | 1230 --
.../dht/atomic/GridDhtAtomicUpdateResponse.java | 339 -
.../dht/atomic/GridNearAtomicUpdateFuture.java | 839 --
.../dht/atomic/GridNearAtomicUpdateRequest.java | 1008 --
.../atomic/GridNearAtomicUpdateResponse.java | 700 -
.../dht/colocated/GridDhtColocatedCache.java | 713 -
.../colocated/GridDhtColocatedCacheEntry.java | 59 -
.../colocated/GridDhtColocatedLockFuture.java | 1282 --
.../colocated/GridDhtDetachedCacheEntry.java | 100 -
.../dht/preloader/GridDhtForceKeysFuture.java | 558 -
.../dht/preloader/GridDhtForceKeysRequest.java | 321 -
.../dht/preloader/GridDhtForceKeysResponse.java | 325 -
.../GridDhtPartitionDemandMessage.java | 380 -
.../preloader/GridDhtPartitionDemandPool.java | 1133 --
.../preloader/GridDhtPartitionExchangeId.java | 143 -
.../dht/preloader/GridDhtPartitionFullMap.java | 230 -
.../dht/preloader/GridDhtPartitionMap.java | 151 -
.../GridDhtPartitionSupplyMessage.java | 509 -
.../preloader/GridDhtPartitionSupplyPool.java | 568 -
.../GridDhtPartitionsAbstractMessage.java | 145 -
.../GridDhtPartitionsExchangeFuture.java | 1099 --
.../preloader/GridDhtPartitionsFullMessage.java | 246 -
.../GridDhtPartitionsSingleMessage.java | 166 -
.../GridDhtPartitionsSingleRequest.java | 93 -
.../dht/preloader/GridDhtPreloader.java | 564 -
.../preloader/GridDhtPreloaderAssignments.java | 65 -
.../distributed/near/GridNearAtomicCache.java | 628 -
.../distributed/near/GridNearCacheAdapter.java | 749 -
.../near/GridNearCacheClearAllRunnable.java | 54 -
.../distributed/near/GridNearCacheEntry.java | 617 -
.../distributed/near/GridNearGetFuture.java | 823 --
.../distributed/near/GridNearGetRequest.java | 522 -
.../distributed/near/GridNearGetResponse.java | 404 -
.../distributed/near/GridNearLockFuture.java | 1453 --
.../distributed/near/GridNearLockMapping.java | 108 -
.../distributed/near/GridNearLockRequest.java | 619 -
.../distributed/near/GridNearLockResponse.java | 436 -
.../near/GridNearTransactionalCache.java | 653 -
.../near/GridNearTxFinishFuture.java | 492 -
.../near/GridNearTxFinishRequest.java | 307 -
.../near/GridNearTxFinishResponse.java | 215 -
.../cache/distributed/near/GridNearTxLocal.java | 1195 --
.../near/GridNearTxPrepareFuture.java | 890 --
.../near/GridNearTxPrepareRequest.java | 429 -
.../near/GridNearTxPrepareResponse.java | 496 -
.../distributed/near/GridNearTxRemote.java | 378 -
.../distributed/near/GridNearUnlockRequest.java | 95 -
.../cache/dr/GridCacheDrExpirationInfo.java | 82 -
.../processors/cache/dr/GridCacheDrInfo.java | 95 -
.../processors/cache/dr/GridCacheDrManager.java | 135 -
.../cache/dr/os/GridOsCacheDrManager.java | 118 -
.../extras/GridCacheAttributesEntryExtras.java | 75 -
.../GridCacheAttributesMvccEntryExtras.java | 93 -
...dCacheAttributesMvccObsoleteEntryExtras.java | 111 -
...cheAttributesMvccObsoleteTtlEntryExtras.java | 138 -
.../GridCacheAttributesMvccTtlEntryExtras.java | 122 -
.../GridCacheAttributesObsoleteEntryExtras.java | 93 -
...idCacheAttributesObsoleteTtlEntryExtras.java | 122 -
.../GridCacheAttributesTtlEntryExtras.java | 104 -
.../cache/extras/GridCacheEntryExtras.java | 74 -
.../extras/GridCacheEntryExtrasAdapter.java | 43 -
.../cache/extras/GridCacheMvccEntryExtras.java | 74 -
.../GridCacheMvccObsoleteEntryExtras.java | 91 -
.../GridCacheMvccObsoleteTtlEntryExtras.java | 121 -
.../extras/GridCacheMvccTtlEntryExtras.java | 104 -
.../extras/GridCacheObsoleteEntryExtras.java | 74 -
.../extras/GridCacheObsoleteTtlEntryExtras.java | 103 -
.../cache/extras/GridCacheTtlEntryExtras.java | 85 -
.../cache/jta/GridCacheJtaManagerAdapter.java | 42 -
.../cache/jta/GridCacheNoopJtaManager.java | 34 -
.../processors/cache/local/GridLocalCache.java | 192 -
.../cache/local/GridLocalCacheEntry.java | 378 -
.../cache/local/GridLocalLockCallback.java | 21 -
.../cache/local/GridLocalLockFuture.java | 443 -
.../processors/cache/local/GridLocalTx.java | 197 -
.../cache/local/GridLocalTxFuture.java | 342 -
.../local/atomic/GridLocalAtomicCache.java | 1325 --
.../GridCacheDistributedFieldsQueryFuture.java | 97 -
.../query/GridCacheDistributedQueryFuture.java | 251 -
.../query/GridCacheDistributedQueryManager.java | 786 -
.../query/GridCacheFieldsQueryErrorFuture.java | 46 -
.../query/GridCacheLocalFieldsQueryFuture.java | 77 -
.../cache/query/GridCacheLocalQueryFuture.java | 132 -
.../cache/query/GridCacheLocalQueryManager.java | 137 -
.../cache/query/GridCacheQueriesEx.java | 44 -
.../cache/query/GridCacheQueriesImpl.java | 241 -
.../cache/query/GridCacheQueriesProxy.java | 265 -
.../cache/query/GridCacheQueryAdapter.java | 500 -
.../cache/query/GridCacheQueryBean.java | 82 -
.../cache/query/GridCacheQueryErrorFuture.java | 44 -
.../query/GridCacheQueryFutureAdapter.java | 551 -
.../cache/query/GridCacheQueryInfo.java | 176 -
.../cache/query/GridCacheQueryManager.java | 3191 ----
.../query/GridCacheQueryMetadataAware.java | 25 -
.../query/GridCacheQueryMetricsAdapter.java | 142 -
.../cache/query/GridCacheQueryMetricsKey.java | 109 -
.../cache/query/GridCacheQueryRequest.java | 792 -
.../cache/query/GridCacheQueryResponse.java | 435 -
.../query/GridCacheQueryResponseEntry.java | 106 -
.../cache/query/GridCacheQueryType.java | 63 -
.../cache/query/GridCacheSqlIndexMetadata.java | 51 -
.../cache/query/GridCacheSqlMetadata.java | 81 -
.../GridCacheContinuousQueryAdapter.java | 352 -
.../GridCacheContinuousQueryEntry.java | 755 -
.../GridCacheContinuousQueryHandler.java | 487 -
.../GridCacheContinuousQueryHandlerV2.java | 75 -
.../GridCacheContinuousQueryListener.java | 28 -
.../GridCacheContinuousQueryManager.java | 271 -
.../jdbc/GridCacheQueryJdbcMetadataTask.java | 159 -
.../query/jdbc/GridCacheQueryJdbcTask.java | 335 -
.../jdbc/GridCacheQueryJdbcValidationTask.java | 57 -
.../transactions/IgniteTransactionsImpl.java | 245 -
.../cache/transactions/IgniteTxAdapter.java | 1548 --
.../cache/transactions/IgniteTxEntry.java | 1060 --
.../cache/transactions/IgniteTxEx.java | 526 -
.../cache/transactions/IgniteTxHandler.java | 1493 --
.../cache/transactions/IgniteTxKey.java | 97 -
.../transactions/IgniteTxLocalAdapter.java | 3179 ----
.../cache/transactions/IgniteTxLocalEx.java | 162 -
.../cache/transactions/IgniteTxManager.java | 2213 ---
.../cache/transactions/IgniteTxMap.java | 179 -
.../transactions/IgniteTxMetricsAdapter.java | 108 -
.../cache/transactions/IgniteTxProxy.java | 19 -
.../cache/transactions/IgniteTxProxyImpl.java | 364 -
.../cache/transactions/IgniteTxRemoteEx.java | 39 -
.../clock/GridClockDeltaSnapshot.java | 223 -
.../clock/GridClockDeltaSnapshotMessage.java | 216 -
.../processors/clock/GridClockDeltaVersion.java | 109 -
.../processors/clock/GridClockMessage.java | 163 -
.../processors/clock/GridClockServer.java | 199 -
.../processors/clock/GridClockSource.java | 22 -
.../clock/GridClockSyncProcessor.java | 451 -
.../processors/clock/GridJvmClockSource.java | 20 -
.../processors/closure/GridClosurePolicy.java | 43 -
.../closure/GridClosureProcessor.java | 1736 ---
.../GridMasterLeaveAwareComputeJobAdapter.java | 28 -
.../closure/GridPeerDeployAwareTaskAdapter.java | 45 -
.../grid/kernal/processors/closure/package.html | 15 -
.../continuous/GridContinuousHandler.java | 97 -
.../continuous/GridContinuousMessage.java | 208 -
.../continuous/GridContinuousMessageType.java | 45 -
.../continuous/GridContinuousProcessor.java | 1710 ---
.../dataload/GridDataLoadCacheUpdaters.java | 281 -
.../dataload/GridDataLoadRequest.java | 498 -
.../dataload/GridDataLoadResponse.java | 171 -
.../dataload/GridDataLoadUpdateJob.java | 97 -
.../dataload/GridDataLoaderFuture.java | 68 -
.../dataload/GridDataLoaderProcessor.java | 306 -
.../dataload/IgniteDataLoaderImpl.java | 1326 --
.../kernal/processors/dataload/package.html | 15 -
.../dr/GridDrDataLoadCacheUpdater.java | 70 -
.../grid/kernal/processors/dr/GridDrType.java | 30 -
.../processors/dr/GridRawVersionedEntry.java | 202 -
.../processors/dr/GridVersionedEntry.java | 72 -
.../grid/kernal/processors/dr/package.html | 17 -
.../processors/email/GridEmailHolder.java | 103 -
.../email/GridEmailProcessorAdapter.java | 78 -
.../email/GridNoopEmailProcessor.java | 48 -
.../grid/kernal/processors/email/package.html | 15 -
.../processors/ggfs/GridGgfsAckMessage.java | 200 -
.../processors/ggfs/GridGgfsAsyncImpl.java | 290 -
.../processors/ggfs/GridGgfsAttributes.java | 178 -
.../processors/ggfs/GridGgfsBlockKey.java | 267 -
.../ggfs/GridGgfsBlockLocationImpl.java | 250 -
.../processors/ggfs/GridGgfsBlocksMessage.java | 246 -
.../processors/ggfs/GridGgfsClientSession.java | 67 -
.../ggfs/GridGgfsCommunicationMessage.java | 67 -
.../kernal/processors/ggfs/GridGgfsContext.java | 197 -
.../processors/ggfs/GridGgfsDataManager.java | 1910 ---
.../processors/ggfs/GridGgfsDeleteMessage.java | 194 -
.../processors/ggfs/GridGgfsDeleteWorker.java | 343 -
.../GridGgfsDirectoryNotEmptyException.java | 36 -
.../grid/kernal/processors/ggfs/GridGgfsEx.java | 135 -
.../ggfs/GridGgfsFileAffinityRange.java | 386 -
.../processors/ggfs/GridGgfsFileInfo.java | 560 -
.../kernal/processors/ggfs/GridGgfsFileMap.java | 353 -
.../processors/ggfs/GridGgfsFileWorker.java | 174 -
.../ggfs/GridGgfsFileWorkerBatch.java | 228 -
.../processors/ggfs/GridGgfsFileWorkerTask.java | 24 -
.../ggfs/GridGgfsFragmentizerManager.java | 822 --
.../ggfs/GridGgfsFragmentizerRequest.java | 202 -
.../ggfs/GridGgfsFragmentizerResponse.java | 121 -
.../ggfs/GridGgfsHandshakeResponse.java | 114 -
.../kernal/processors/ggfs/GridGgfsHelper.java | 41 -
.../processors/ggfs/GridGgfsHelperImpl.java | 46 -
.../kernal/processors/ggfs/GridGgfsImpl.java | 2145 ---
.../ggfs/GridGgfsInputStreamAdapter.java | 41 -
.../ggfs/GridGgfsInputStreamDescriptor.java | 70 -
.../ggfs/GridGgfsInputStreamImpl.java | 525 -
.../ggfs/GridGgfsInvalidRangeException.java | 35 -
.../processors/ggfs/GridGgfsIpcHandler.java | 557 -
.../kernal/processors/ggfs/GridGgfsJobImpl.java | 110 -
.../processors/ggfs/GridGgfsListingEntry.java | 189 -
.../processors/ggfs/GridGgfsLocalMetrics.java | 204 -
.../kernal/processors/ggfs/GridGgfsManager.java | 148 -
.../processors/ggfs/GridGgfsMetaManager.java | 2968 ----
.../processors/ggfs/GridGgfsModeResolver.java | 169 -
.../kernal/processors/ggfs/GridGgfsPaths.java | 116 -
.../processors/ggfs/GridGgfsProcessor.java | 456 -
.../ggfs/GridGgfsProcessorAdapter.java | 72 -
.../processors/ggfs/GridGgfsSamplingKey.java | 75 -
.../GridGgfsSecondaryInputStreamDescriptor.java | 51 -
...GridGgfsSecondaryOutputStreamDescriptor.java | 66 -
.../kernal/processors/ggfs/GridGgfsServer.java | 420 -
.../processors/ggfs/GridGgfsServerHandler.java | 49 -
.../processors/ggfs/GridGgfsServerManager.java | 203 -
.../kernal/processors/ggfs/GridGgfsStatus.java | 68 -
.../processors/ggfs/GridGgfsSyncMessage.java | 153 -
.../kernal/processors/ggfs/GridGgfsThread.java | 74 -
.../processors/ggfs/GridNoopGgfsHelper.java | 34 -
.../processors/ggfs/GridNoopGgfsProcessor.java | 63 -
.../processors/ggfs/IgniteFsFileImpl.java | 237 -
.../processors/ggfs/IgniteFsMetricsAdapter.java | 231 -
.../ggfs/IgniteFsOutputStreamAdapter.java | 255 -
.../ggfs/IgniteFsOutputStreamImpl.java | 497 -
.../processors/ggfs/IgniteFsTaskArgsImpl.java | 127 -
.../grid/kernal/processors/ggfs/package.html | 15 -
.../hadoop/GridHadoopNoopProcessor.java | 68 -
.../hadoop/GridHadoopProcessorAdapter.java | 88 -
.../processors/interop/GridInteropAware.java | 41 -
.../interop/GridInteropProcessor.java | 74 -
.../interop/GridInteropProcessorAdapter.java | 26 -
.../processors/interop/GridInteropTarget.java | 101 -
.../interop/os/GridOsInteropProcessor.java | 73 -
.../kernal/processors/interop/os/package.html | 15 -
.../grid/kernal/processors/interop/package.html | 15 -
.../processors/job/GridJobEventListener.java | 32 -
.../processors/job/GridJobHoldListener.java | 28 -
.../kernal/processors/job/GridJobProcessor.java | 1865 ---
.../kernal/processors/job/GridJobWorker.java | 887 --
.../grid/kernal/processors/job/package.html | 15 -
.../processors/jobmetrics/GridJobMetrics.java | 440 -
.../jobmetrics/GridJobMetricsProcessor.java | 396 -
.../jobmetrics/GridJobMetricsSnapshot.java | 219 -
.../kernal/processors/jobmetrics/package.html | 15 -
.../license/GridLicenseProcessor.java | 61 -
.../license/GridLicenseSubsystem.java | 45 -
.../license/GridLicenseUseRegistry.java | 82 -
.../license/os/GridOsLicenseProcessor.java | 58 -
.../kernal/processors/license/os/package.html | 15 -
.../grid/kernal/processors/license/package.html | 15 -
.../offheap/GridOffHeapProcessor.java | 318 -
.../grid/kernal/processors/package.html | 15 -
.../plugin/IgnitePluginProcessor.java | 203 -
.../processors/port/GridPortListener.java | 20 -
.../processors/port/GridPortProcessor.java | 188 -
.../kernal/processors/port/GridPortRecord.java | 64 -
.../grid/kernal/processors/port/package.html | 15 -
.../portable/GridPortableInputStream.java | 169 -
.../portable/GridPortableOutputStream.java | 157 -
.../portable/GridPortableProcessor.java | 142 -
.../processors/portable/GridPortableStream.java | 45 -
.../portable/os/GridOsPortableProcessor.java | 118 -
.../kernal/processors/portable/os/package.html | 15 -
.../kernal/processors/portable/package.html | 15 -
.../query/GridQueryFieldMetadata.java | 46 -
.../processors/query/GridQueryFieldsResult.java | 34 -
.../query/GridQueryFieldsResultAdapter.java | 49 -
.../query/GridQueryIndexDescriptor.java | 42 -
.../processors/query/GridQueryIndexType.java | 24 -
.../processors/query/GridQueryIndexing.java | 162 -
.../processors/query/GridQueryProcessor.java | 1673 ---
.../query/GridQueryTypeDescriptor.java | 78 -
.../resource/GridResourceBasicInjector.java | 63 -
.../resource/GridResourceCustomInjector.java | 547 -
.../processors/resource/GridResourceField.java | 63 -
.../resource/GridResourceInjector.java | 48 -
.../processors/resource/GridResourceIoc.java | 429 -
.../GridResourceJobContextInjector.java | 46 -
.../resource/GridResourceLoggerInjector.java | 61 -
.../processors/resource/GridResourceMethod.java | 63 -
.../resource/GridResourceProcessor.java | 778 -
.../resource/GridResourceServiceInjector.java | 77 -
.../processors/resource/GridResourceUtils.java | 96 -
.../resource/GridSpringResourceContext.java | 40 -
.../kernal/processors/resource/package.html | 15 -
.../kernal/processors/rest/GridRestCommand.java | 152 -
.../processors/rest/GridRestProcessor.java | 689 -
.../processors/rest/GridRestProtocol.java | 51 -
.../rest/GridRestProtocolHandler.java | 32 -
.../processors/rest/GridRestResponse.java | 169 -
.../message/GridClientAbstractMessage.java | 108 -
.../GridClientAuthenticationRequest.java | 77 -
.../message/GridClientCacheQueryRequest.java | 406 -
.../client/message/GridClientCacheRequest.java | 310 -
.../message/GridClientGetMetaDataRequest.java | 56 -
.../message/GridClientHandshakeRequest.java | 100 -
.../GridClientHandshakeRequestWrapper.java | 119 -
.../message/GridClientHandshakeResponse.java | 58 -
.../GridClientHandshakeResponseWrapper.java | 108 -
.../client/message/GridClientLogRequest.java | 133 -
.../rest/client/message/GridClientMessage.java | 73 -
.../message/GridClientMessageWrapper.java | 250 -
.../message/GridClientMetaDataResponse.java | 49 -
.../rest/client/message/GridClientNodeBean.java | 334 -
.../message/GridClientNodeMetricsBean.java | 1570 --
.../client/message/GridClientPingPacket.java | 29 -
.../message/GridClientPingPacketWrapper.java | 94 -
.../message/GridClientPortableMetaData.java | 85 -
.../message/GridClientPutMetaDataRequest.java | 56 -
.../rest/client/message/GridClientResponse.java | 137 -
.../client/message/GridClientTaskRequest.java | 144 -
.../message/GridClientTaskResultBean.java | 139 -
.../message/GridClientTopologyRequest.java | 166 -
.../rest/client/message/GridRouterRequest.java | 49 -
.../rest/client/message/GridRouterResponse.java | 76 -
.../processors/rest/client/message/package.html | 15 -
.../rest/handlers/GridRestCommandHandler.java | 32 -
.../handlers/GridRestCommandHandlerAdapter.java | 43 -
.../cache/GridCacheClientQueryResult.java | 111 -
.../handlers/cache/GridCacheCommandHandler.java | 1151 --
.../cache/GridCacheQueryCommandHandler.java | 486 -
.../handlers/cache/GridCacheRestMetrics.java | 207 -
.../handlers/cache/GridCacheRestResponse.java | 59 -
.../processors/rest/handlers/cache/package.html | 15 -
.../handlers/log/GridLogCommandHandler.java | 299 -
.../processors/rest/handlers/log/package.html | 15 -
.../metadata/GridPortableMetadataHandler.java | 97 -
.../processors/rest/handlers/package.html | 15 -
.../handlers/task/GridTaskCommandHandler.java | 631 -
.../handlers/task/GridTaskResultRequest.java | 173 -
.../handlers/task/GridTaskResultResponse.java | 221 -
.../top/GridTopologyCommandHandler.java | 326 -
.../processors/rest/handlers/top/package.html | 15 -
.../version/GridVersionCommandHandler.java | 52 -
.../rest/handlers/version/package.html | 15 -
.../grid/kernal/processors/rest/package.html | 15 -
.../rest/protocols/GridRestProtocolAdapter.java | 189 -
.../processors/rest/protocols/package.html | 15 -
.../protocols/tcp/GridClientPacketType.java | 24 -
.../protocols/tcp/GridMemcachedMessage.java | 477 -
.../tcp/GridMemcachedMessageWrapper.java | 274 -
.../tcp/GridTcpMemcachedNioListener.java | 435 -
.../protocols/tcp/GridTcpRestDirectParser.java | 507 -
.../protocols/tcp/GridTcpRestNioListener.java | 379 -
.../rest/protocols/tcp/GridTcpRestParser.java | 869 --
.../rest/protocols/tcp/GridTcpRestProtocol.java | 272 -
.../processors/rest/protocols/tcp/package.html | 15 -
.../rest/request/GridRestCacheQueryRequest.java | 135 -
.../rest/request/GridRestCacheRequest.java | 174 -
.../rest/request/GridRestLogRequest.java | 73 -
.../GridRestPortableGetMetaDataRequest.java | 36 -
.../GridRestPortablePutMetaDataRequest.java | 36 -
.../rest/request/GridRestRequest.java | 159 -
.../rest/request/GridRestTaskRequest.java | 126 -
.../rest/request/GridRestTopologyRequest.java | 92 -
.../kernal/processors/rest/request/package.html | 15 -
.../schedule/GridNoopScheduleProcessor.java | 46 -
.../schedule/GridScheduleProcessorAdapter.java | 45 -
.../schedule/GridScheduleStatistics.java | 174 -
.../kernal/processors/schedule/package.html | 15 -
.../segmentation/GridSegmentationProcessor.java | 43 -
.../os/GridOsSegmentationProcessor.java | 31 -
.../kernal/processors/segmentation/package.html | 15 -
.../service/GridServiceAssignments.java | 127 -
.../service/GridServiceAssignmentsKey.java | 55 -
.../service/GridServiceDeployment.java | 87 -
.../service/GridServiceDeploymentFuture.java | 48 -
.../service/GridServiceDeploymentKey.java | 55 -
.../GridServiceMethodNotFoundException.java | 35 -
.../service/GridServiceMethodReflectKey.java | 69 -
.../service/GridServiceNotFoundException.java | 32 -
.../service/GridServiceProcessor.java | 1282 --
.../processors/service/GridServiceProxy.java | 373 -
.../service/ManagedServiceContextImpl.java | 148 -
.../service/ManagedServiceDescriptorImpl.java | 93 -
.../session/GridTaskSessionProcessor.java | 170 -
.../grid/kernal/processors/session/package.html | 16 -
.../processors/spring/GridSpringProcessor.java | 66 -
.../streamer/GridStreamProcessor.java | 353 -
.../streamer/GridStreamerAttributes.java | 119 -
.../streamer/GridStreamerCancelRequest.java | 113 -
.../streamer/GridStreamerContextDelegate.java | 98 -
.../streamer/GridStreamerContextImpl.java | 197 -
.../streamer/GridStreamerExecutionBatch.java | 177 -
.../streamer/GridStreamerExecutionRequest.java | 366 -
.../streamer/GridStreamerResponse.java | 148 -
.../GridStreamerRouteFailedException.java | 28 -
.../GridStreamerStageExecutionFuture.java | 355 -
.../streamer/GridStreamerWindowIterator.java | 32 -
.../processors/streamer/IgniteStreamerEx.java | 88 -
.../processors/streamer/IgniteStreamerImpl.java | 1408 --
.../streamer/StreamerMBeanAdapter.java | 108 -
.../streamer/StreamerMetricsAdapter.java | 264 -
.../streamer/StreamerMetricsHolder.java | 416 -
.../streamer/StreamerStageMBeanAdapter.java | 93 -
.../streamer/StreamerStageMetricsAdapter.java | 127 -
.../streamer/StreamerStageMetricsHolder.java | 159 -
.../streamer/StreamerStageWrapper.java | 84 -
.../streamer/StreamerWindowMetricsAdapter.java | 57 -
.../streamer/StreamerWindowMetricsHolder.java | 42 -
.../kernal/processors/streamer/package.html | 15 -
.../task/GridStreamerBroadcastTask.java | 131 -
.../streamer/task/GridStreamerQueryTask.java | 134 -
.../streamer/task/GridStreamerReduceTask.java | 138 -
.../kernal/processors/task/GridInternal.java | 27 -
.../processors/task/GridTaskEventListener.java | 47 -
.../processors/task/GridTaskProcessor.java | 1288 --
.../task/GridTaskThreadContextKey.java | 30 -
.../kernal/processors/task/GridTaskWorker.java | 1390 --
.../grid/kernal/processors/task/package.html | 15 -
.../processors/timeout/GridTimeoutObject.java | 32 -
.../timeout/GridTimeoutObjectAdapter.java | 53 -
.../timeout/GridTimeoutProcessor.java | 165 -
.../grid/kernal/processors/timeout/package.html | 15 -
.../version/GridVersionConverter.java | 38 -
.../gridgain/grid/kernal/visor/VisorJob.java | 69 -
.../grid/kernal/visor/VisorMultiNodeTask.java | 119 -
.../grid/kernal/visor/VisorOneNodeTask.java | 34 -
.../grid/kernal/visor/VisorTaskArgument.java | 98 -
.../grid/kernal/visor/cache/VisorCache.java | 477 -
.../cache/VisorCacheAffinityConfiguration.java | 163 -
.../cache/VisorCacheAggregatedMetrics.java | 463 -
.../kernal/visor/cache/VisorCacheClearTask.java | 80 -
.../visor/cache/VisorCacheCompactTask.java | 78 -
.../visor/cache/VisorCacheConfiguration.java | 674 -
.../cache/VisorCacheDefaultConfiguration.java | 150 -
.../visor/cache/VisorCacheDgcConfiguration.java | 89 -
.../cache/VisorCacheEvictionConfiguration.java | 207 -
.../kernal/visor/cache/VisorCacheLoadTask.java | 80 -
.../visor/cache/VisorCacheMetadataTask.java | 68 -
.../kernal/visor/cache/VisorCacheMetrics.java | 262 -
.../cache/VisorCacheMetricsCollectorTask.java | 104 -
.../cache/VisorCacheNearConfiguration.java | 115 -
.../cache/VisorCachePreloadConfiguration.java | 147 -
.../visor/cache/VisorCachePreloadTask.java | 69 -
.../visor/cache/VisorCacheQueryMetrics.java | 94 -
.../visor/cache/VisorCacheResetMetricsTask.java | 61 -
.../cache/VisorCacheStoreConfiguration.java | 82 -
.../visor/cache/VisorCacheSwapBackupsTask.java | 82 -
.../VisorCacheWriteBehindConfiguration.java | 129 -
.../compute/VisorComputeCancelSessionsTask.java | 82 -
.../compute/VisorComputeMonitoringHolder.java | 110 -
.../compute/VisorComputeResetMetricsTask.java | 57 -
.../VisorComputeToggleMonitoringTask.java | 104 -
.../kernal/visor/debug/VisorThreadDumpTask.java | 67 -
.../kernal/visor/debug/VisorThreadInfo.java | 320 -
.../kernal/visor/debug/VisorThreadLockInfo.java | 65 -
.../visor/debug/VisorThreadMonitorInfo.java | 64 -
.../event/VisorGridAuthenticationEvent.java | 98 -
.../event/VisorGridAuthorizationEvent.java | 81 -
.../visor/event/VisorGridDeploymentEvent.java | 66 -
.../visor/event/VisorGridDiscoveryEvent.java | 92 -
.../grid/kernal/visor/event/VisorGridEvent.java | 122 -
.../kernal/visor/event/VisorGridEventsLost.java | 37 -
.../kernal/visor/event/VisorGridJobEvent.java | 105 -
.../visor/event/VisorGridLicenseEvent.java | 66 -
.../event/VisorGridSecuritySessionEvent.java | 83 -
.../kernal/visor/event/VisorGridTaskEvent.java | 105 -
.../grid/kernal/visor/file/VisorFileBlock.java | 106 -
.../kernal/visor/file/VisorFileBlockTask.java | 118 -
.../visor/file/VisorLatestTextFilesTask.java | 90 -
.../grid/kernal/visor/ggfs/VisorGgfs.java | 106 -
.../kernal/visor/ggfs/VisorGgfsEndpoint.java | 98 -
.../kernal/visor/ggfs/VisorGgfsFormatTask.java | 62 -
.../kernal/visor/ggfs/VisorGgfsMetrics.java | 342 -
.../kernal/visor/ggfs/VisorGgfsProfiler.java | 80 -
.../visor/ggfs/VisorGgfsProfilerClearTask.java | 104 -
.../visor/ggfs/VisorGgfsProfilerEntry.java | 230 -
.../visor/ggfs/VisorGgfsProfilerTask.java | 496 -
.../VisorGgfsProfilerUniformityCounters.java | 189 -
.../visor/ggfs/VisorGgfsResetMetricsTask.java | 65 -
.../visor/ggfs/VisorGgfsSamplingStateTask.java | 66 -
.../grid/kernal/visor/log/VisorLogFile.java | 79 -
.../kernal/visor/log/VisorLogSearchResult.java | 148 -
.../kernal/visor/log/VisorLogSearchTask.java | 262 -
.../grid/kernal/visor/misc/VisorAckTask.java | 68 -
.../visor/misc/VisorLatestVersionTask.java | 55 -
.../grid/kernal/visor/misc/VisorNopTask.java | 82 -
.../visor/misc/VisorResolveHostNameTask.java | 96 -
.../visor/node/VisorBasicConfiguration.java | 443 -
.../visor/node/VisorEmailConfiguration.java | 169 -
.../node/VisorExecutorServiceConfiguration.java | 192 -
.../visor/node/VisorGgfsConfiguration.java | 565 -
.../visor/node/VisorGridConfiguration.java | 353 -
.../visor/node/VisorLifecycleConfiguration.java | 79 -
.../visor/node/VisorMetricsConfiguration.java | 87 -
.../VisorNodeConfigurationCollectorJob.java | 30 -
.../VisorNodeConfigurationCollectorTask.java | 27 -
.../visor/node/VisorNodeDataCollectorJob.java | 202 -
.../node/VisorNodeDataCollectorJobResult.java | 141 -
.../visor/node/VisorNodeDataCollectorTask.java | 119 -
.../node/VisorNodeDataCollectorTaskArg.java | 123 -
.../node/VisorNodeDataCollectorTaskResult.java | 167 -
.../node/VisorNodeEventsCollectorTask.java | 357 -
.../grid/kernal/visor/node/VisorNodeGcTask.java | 92 -
.../kernal/visor/node/VisorNodePingTask.java | 73 -
.../kernal/visor/node/VisorNodeRestartTask.java | 71 -
.../kernal/visor/node/VisorNodeStopTask.java | 71 -
.../node/VisorPeerToPeerConfiguration.java | 97 -
.../visor/node/VisorRestConfiguration.java | 213 -
.../node/VisorSegmentationConfiguration.java | 133 -
.../visor/node/VisorSpisConfiguration.java | 326 -
.../visor/portable/VisorPortableMetadata.java | 64 -
.../VisorPortableMetadataCollectorTask.java | 87 -
.../portable/VisorPortableMetadataField.java | 63 -
.../visor/query/VisorQueryCleanupTask.java | 94 -
.../kernal/visor/query/VisorQueryField.java | 58 -
.../visor/query/VisorQueryNextPageTask.java | 109 -
.../kernal/visor/query/VisorQueryResult.java | 71 -
.../kernal/visor/query/VisorQueryResultEx.java | 80 -
.../grid/kernal/visor/query/VisorQueryTask.java | 291 -
.../kernal/visor/query/VisorQueryUtils.java | 196 -
.../kernal/visor/streamer/VisorStreamer.java | 96 -
.../streamer/VisorStreamerConfiguration.java | 170 -
.../visor/streamer/VisorStreamerMetrics.java | 342 -
.../streamer/VisorStreamerMetricsResetTask.java | 68 -
.../visor/streamer/VisorStreamerResetTask.java | 68 -
.../streamer/VisorStreamerStageMetrics.java | 269 -
.../grid/kernal/visor/util/VisorMimeTypes.java | 1004 --
.../grid/kernal/visor/util/VisorTaskUtils.java | 823 --
.../main/java/org/gridgain/grid/package.html | 15 -
.../main/java/org/gridgain/grid/util/F0.java | 360 -
.../grid/util/GridAnnotationsCache.java | 76 -
.../gridgain/grid/util/GridArgumentCheck.java | 141 -
.../grid/util/GridAtomicInitializer.java | 105 -
.../gridgain/grid/util/GridAtomicInteger.java | 241 -
.../org/gridgain/grid/util/GridAtomicLong.java | 241 -
.../GridBoundedConcurrentLinkedHashMap.java | 116 -
.../GridBoundedConcurrentLinkedHashSet.java | 154 -
.../util/GridBoundedConcurrentOrderedMap.java | 234 -
.../util/GridBoundedConcurrentOrderedSet.java | 171 -
.../grid/util/GridBoundedLinkedHashMap.java | 121 -
.../grid/util/GridBoundedLinkedHashSet.java | 199 -
.../org/gridgain/grid/util/GridBusyLock.java | 75 -
.../gridgain/grid/util/GridByteArrayList.java | 404 -
.../gridgain/grid/util/GridCircularBuffer.java | 222 -
.../grid/util/GridClassLoaderCache.java | 123 -
.../gridgain/grid/util/GridClientByteUtils.java | 230 -
.../grid/util/GridCloseableIteratorAdapter.java | 102 -
.../util/GridCloseableIteratorAdapterEx.java | 119 -
.../org/gridgain/grid/util/GridCollections.java | 636 -
.../grid/util/GridConcurrentFactory.java | 101 -
.../grid/util/GridConcurrentHashSet.java | 111 -
.../grid/util/GridConcurrentLinkedHashSet.java | 123 -
.../grid/util/GridConcurrentPhantomHashSet.java | 394 -
.../grid/util/GridConcurrentSkipListSet.java | 294 -
.../grid/util/GridConcurrentWeakHashSet.java | 394 -
.../grid/util/GridConfigurationFinder.java | 143 -
.../gridgain/grid/util/GridConsistentHash.java | 664 -
.../java/org/gridgain/grid/util/GridDebug.java | 295 -
.../grid/util/GridEmptyCloseableIterator.java | 34 -
.../gridgain/grid/util/GridEmptyIterator.java | 43 -
.../org/gridgain/grid/util/GridEnumCache.java | 49 -
.../grid/util/GridExecutionStatistics.java | 97 -
.../grid/util/GridFixedSizeInputStream.java | 77 -
.../org/gridgain/grid/util/GridHandleTable.java | 190 -
.../gridgain/grid/util/GridIdentityHashSet.java | 55 -
.../org/gridgain/grid/util/GridJavaProcess.java | 251 -
.../org/gridgain/grid/util/GridKeyLock.java | 146 -
.../org/gridgain/grid/util/GridLeanMap.java | 1258 --
.../org/gridgain/grid/util/GridLeanSet.java | 75 -
.../org/gridgain/grid/util/GridListSet.java | 521 -
.../org/gridgain/grid/util/GridLogThrottle.java | 213 -
.../org/gridgain/grid/util/GridLongList.java | 496 -
.../java/org/gridgain/grid/util/GridMutex.java | 47 -
.../java/org/gridgain/grid/util/GridQueue.java | 340 -
.../java/org/gridgain/grid/util/GridRandom.java | 49 -
.../gridgain/grid/util/GridReflectionCache.java | 242 -
.../grid/util/GridSerializableCollection.java | 25 -
.../grid/util/GridSerializableFuture.java | 20 -
.../grid/util/GridSerializableIterable.java | 20 -
.../grid/util/GridSerializableIterator.java | 21 -
.../grid/util/GridSerializableList.java | 25 -
.../gridgain/grid/util/GridSerializableMap.java | 29 -
.../gridgain/grid/util/GridSerializableSet.java | 29 -
.../org/gridgain/grid/util/GridSetWrapper.java | 128 -
.../gridgain/grid/util/GridSnapshotLock.java | 211 -
.../util/GridSpiCloseableIteratorWrapper.java | 49 -
.../gridgain/grid/util/GridSpinBusyLock.java | 76 -
.../grid/util/GridSpinReadWriteLock.java | 405 -
.../gridgain/grid/util/GridStringBuilder.java | 439 -
.../grid/util/GridStringBuilderFactory.java | 90 -
.../org/gridgain/grid/util/GridStripedLock.java | 126 -
.../grid/util/GridStripedReadWriteLock.java | 83 -
.../gridgain/grid/util/GridSynchronizedMap.java | 92 -
.../org/gridgain/grid/util/GridThreadLocal.java | 167 -
.../gridgain/grid/util/GridThreadLocalEx.java | 202 -
.../java/org/gridgain/grid/util/GridTimer.java | 146 -
.../org/gridgain/grid/util/GridTimerTask.java | 32 -
.../java/org/gridgain/grid/util/GridUnsafe.java | 53 -
.../java/org/gridgain/grid/util/GridUtils.java | 9120 ------------
.../org/gridgain/grid/util/GridUuidCache.java | 51 -
.../gridgain/grid/util/GridWeakIterator.java | 38 -
.../GridTcpCommunicationMessageAdapter.java | 198 -
.../GridTcpCommunicationMessageFactory.java | 351 -
.../GridTcpCommunicationMessageProducer.java | 23 -
.../GridTcpCommunicationMessageState.java | 766 -
.../grid/util/future/GridCompoundFuture.java | 375 -
.../util/future/GridCompoundIdentityFuture.java | 60 -
.../grid/util/future/GridEmbeddedFuture.java | 314 -
.../grid/util/future/GridFinishedFuture.java | 217 -
.../grid/util/future/GridFinishedFutureEx.java | 188 -
.../grid/util/future/GridFutureAdapter.java | 619 -
.../grid/util/future/GridFutureAdapterEx.java | 508 -
.../util/future/GridFutureChainListener.java | 64 -
.../org/gridgain/grid/util/future/package.html | 15 -
.../util/gridify/GridifyArgumentBuilder.java | 178 -
.../grid/util/gridify/GridifyJobAdapter.java | 99 -
.../grid/util/gridify/GridifyRangeArgument.java | 95 -
.../grid/util/gridify/GridifyUtils.java | 513 -
.../org/gridgain/grid/util/gridify/package.html | 15 -
.../grid/util/io/GridByteArrayInputStream.java | 201 -
.../grid/util/io/GridByteArrayOutputStream.java | 159 -
.../gridgain/grid/util/io/GridDataInput.java | 124 -
.../gridgain/grid/util/io/GridDataOutput.java | 111 -
.../grid/util/io/GridFilenameUtils.java | 1559 --
.../util/io/GridReversedLinesFileReader.java | 333 -
.../grid/util/io/GridUnsafeDataInput.java | 595 -
.../grid/util/io/GridUnsafeDataOutput.java | 492 -
.../gridgain/grid/util/ipc/GridIpcEndpoint.java | 41 -
.../util/ipc/GridIpcEndpointBindException.java | 39 -
.../grid/util/ipc/GridIpcEndpointFactory.java | 77 -
.../grid/util/ipc/GridIpcEndpointType.java | 21 -
.../grid/util/ipc/GridIpcServerEndpoint.java | 65 -
.../ipc/GridIpcServerEndpointDeserializer.java | 58 -
.../grid/util/ipc/GridIpcToNioAdapter.java | 234 -
.../ipc/loopback/GridIpcClientTcpEndpoint.java | 79 -
.../ipc/loopback/GridIpcServerTcpEndpoint.java | 172 -
.../grid/util/ipc/loopback/package.html | 15 -
.../org/gridgain/grid/util/ipc/package.html | 15 -
.../GridIpcOutOfSystemResourcesException.java | 51 -
.../GridIpcSharedMemoryClientEndpoint.java | 329 -
.../shmem/GridIpcSharedMemoryInitRequest.java | 59 -
.../shmem/GridIpcSharedMemoryInitResponse.java | 163 -
.../shmem/GridIpcSharedMemoryInputStream.java | 91 -
.../shmem/GridIpcSharedMemoryNativeLoader.java | 235 -
...cSharedMemoryOperationTimedoutException.java | 51 -
.../shmem/GridIpcSharedMemoryOutputStream.java | 72 -
.../GridIpcSharedMemoryServerEndpoint.java | 683 -
.../ipc/shmem/GridIpcSharedMemorySpace.java | 366 -
.../ipc/shmem/GridIpcSharedMemoryUtils.java | 234 -
.../gridgain/grid/util/ipc/shmem/package.html | 15 -
.../gridgain/grid/util/lang/GridAbsClosure.java | 44 -
.../grid/util/lang/GridAbsClosureX.java | 40 -
.../grid/util/lang/GridAbsPredicate.java | 36 -
.../grid/util/lang/GridAbsPredicateX.java | 38 -
.../grid/util/lang/GridCloseableIterator.java | 54 -
.../gridgain/grid/util/lang/GridClosure3.java | 44 -
.../gridgain/grid/util/lang/GridClosure3X.java | 43 -
.../grid/util/lang/GridClosureException.java | 42 -
.../grid/util/lang/GridComputeJobWrapper.java | 98 -
.../grid/util/lang/GridFilteredIterator.java | 79 -
.../org/gridgain/grid/util/lang/GridFunc.java | 8747 -----------
.../gridgain/grid/util/lang/GridInClosure3.java | 41 -
.../grid/util/lang/GridInClosure3X.java | 42 -
.../gridgain/grid/util/lang/GridIterable.java | 27 -
.../grid/util/lang/GridIterableAdapter.java | 112 -
.../gridgain/grid/util/lang/GridIterator.java | 59 -
.../grid/util/lang/GridIteratorAdapter.java | 58 -
.../gridgain/grid/util/lang/GridMapEntry.java | 84 -
.../util/lang/GridMetadataAwareAdapter.java | 336 -
.../grid/util/lang/GridNodePredicate.java | 148 -
.../grid/util/lang/GridPeerDeployAware.java | 44 -
.../util/lang/GridPeerDeployAwareAdapter.java | 61 -
.../grid/util/lang/GridPlainAbsClosure.java | 25 -
.../grid/util/lang/GridPlainCallable.java | 19 -
.../grid/util/lang/GridPlainClosure.java | 24 -
.../grid/util/lang/GridPlainClosure2.java | 25 -
.../grid/util/lang/GridPlainFuture.java | 71 -
.../grid/util/lang/GridPlainFutureAdapter.java | 291 -
.../grid/util/lang/GridPlainInClosure.java | 23 -
.../grid/util/lang/GridPlainOutClosure.java | 23 -
.../grid/util/lang/GridPlainRunnable.java | 17 -
.../gridgain/grid/util/lang/GridPredicate3.java | 49 -
.../grid/util/lang/GridPredicate3X.java | 43 -
.../org/gridgain/grid/util/lang/GridTriple.java | 46 -
.../org/gridgain/grid/util/lang/GridTuple.java | 139 -
.../org/gridgain/grid/util/lang/GridTuple3.java | 218 -
.../org/gridgain/grid/util/lang/GridTuple4.java | 249 -
.../org/gridgain/grid/util/lang/GridTuple5.java | 280 -
.../org/gridgain/grid/util/lang/GridTuple6.java | 314 -
.../org/gridgain/grid/util/lang/GridTupleV.java | 181 -
.../grid/util/lang/IgniteClosure2X.java | 45 -
.../gridgain/grid/util/lang/IgniteClosureX.java | 44 -
.../grid/util/lang/IgniteInClosure2X.java | 44 -
.../grid/util/lang/IgniteInClosureX.java | 43 -
.../grid/util/lang/IgniteOutClosureX.java | 42 -
.../org/gridgain/grid/util/lang/IgnitePair.java | 45 -
.../grid/util/lang/IgnitePredicate2X.java | 45 -
.../grid/util/lang/IgnitePredicateX.java | 44 -
.../gridgain/grid/util/lang/IgniteReducer2.java | 45 -
.../grid/util/lang/IgniteReducer2X.java | 42 -
.../gridgain/grid/util/lang/IgniteReducer3.java | 47 -
.../grid/util/lang/IgniteReducer3X.java | 42 -
.../gridgain/grid/util/lang/IgniteReducerX.java | 43 -
.../nio/GridAbstractCommunicationClient.java | 104 -
.../grid/util/nio/GridBufferedParser.java | 87 -
.../grid/util/nio/GridCommunicationClient.java | 104 -
.../nio/GridConnectionBytesVerifyFilter.java | 132 -
.../grid/util/nio/GridDirectParser.java | 70 -
.../grid/util/nio/GridNioAsyncNotifyFilter.java | 134 -
.../util/nio/GridNioBackPressureControl.java | 48 -
.../grid/util/nio/GridNioCodecFilter.java | 132 -
.../grid/util/nio/GridNioEmbeddedFuture.java | 64 -
.../grid/util/nio/GridNioException.java | 50 -
.../gridgain/grid/util/nio/GridNioFilter.java | 236 -
.../grid/util/nio/GridNioFilterAdapter.java | 175 -
.../grid/util/nio/GridNioFilterChain.java | 285 -
.../grid/util/nio/GridNioFinishedFuture.java | 107 -
.../gridgain/grid/util/nio/GridNioFuture.java | 113 -
.../grid/util/nio/GridNioFutureImpl.java | 319 -
.../grid/util/nio/GridNioMessageTracker.java | 113 -
.../grid/util/nio/GridNioMetricsListener.java | 25 -
.../gridgain/grid/util/nio/GridNioParser.java | 53 -
.../util/nio/GridNioRecoveryDescriptor.java | 356 -
.../gridgain/grid/util/nio/GridNioServer.java | 2269 ---
.../grid/util/nio/GridNioServerBuffer.java | 109 -
.../grid/util/nio/GridNioServerListener.java | 55 -
.../util/nio/GridNioServerListenerAdapter.java | 25 -
.../gridgain/grid/util/nio/GridNioSession.java | 159 -
.../grid/util/nio/GridNioSessionImpl.java | 304 -
.../grid/util/nio/GridNioSessionMetaKey.java | 58 -
.../util/nio/GridSelectorNioSessionImpl.java | 289 -
.../util/nio/GridShmemCommunicationClient.java | 132 -
.../util/nio/GridTcpCommunicationClient.java | 540 -
.../util/nio/GridTcpNioCommunicationClient.java | 155 -
.../org/gridgain/grid/util/nio/package.html | 15 -
.../grid/util/nio/ssl/GridNioSslFilter.java | 411 -
.../grid/util/nio/ssl/GridNioSslHandler.java | 608 -
.../org/gridgain/grid/util/nio/ssl/package.html | 15 -
.../grid/util/nodestart/GridNodeCallable.java | 21 -
.../grid/util/nodestart/GridNodeStartUtils.java | 383 -
.../nodestart/GridRemoteStartSpecification.java | 271 -
.../grid/util/nodestart/GridSshProcessor.java | 26 -
.../grid/util/offheap/GridOffHeapEvent.java | 39 -
.../util/offheap/GridOffHeapEventListener.java | 18 -
.../util/offheap/GridOffHeapEvictListener.java | 25 -
.../grid/util/offheap/GridOffHeapMap.java | 192 -
.../util/offheap/GridOffHeapMapFactory.java | 217 -
.../GridOffHeapOutOfMemoryException.java | 42 -
.../util/offheap/GridOffHeapPartitionedMap.java | 210 -
.../offheap/unsafe/GridOffHeapSmartPointer.java | 30 -
.../unsafe/GridOffHeapSmartPointerFactory.java | 21 -
.../offheap/unsafe/GridOffHeapSnapTreeMap.java | 4467 ------
.../unsafe/GridUnsafeCompoundMemory.java | 27 -
.../util/offheap/unsafe/GridUnsafeGuard.java | 366 -
.../grid/util/offheap/unsafe/GridUnsafeLru.java | 619 -
.../offheap/unsafe/GridUnsafeLruPoller.java | 22 -
.../grid/util/offheap/unsafe/GridUnsafeMap.java | 1735 ---
.../util/offheap/unsafe/GridUnsafeMemory.java | 713 -
.../unsafe/GridUnsafePartitionedMap.java | 416 -
.../java/org/gridgain/grid/util/package.html | 15 -
.../grid/util/portable/PortableRawReaderEx.java | 24 -
.../grid/util/portable/PortableRawWriterEx.java | 35 -
.../util/portscanner/GridJmxPortFinder.java | 168 -
.../gridgain/grid/util/portscanner/package.html | 15 -
.../java/org/gridgain/grid/util/scala/impl.java | 27 -
.../org/gridgain/grid/util/scala/package.html | 15 -
.../grid/util/snaptree/CopyOnWriteManager.java | 390 -
.../org/gridgain/grid/util/snaptree/Epoch.java | 131 -
.../gridgain/grid/util/snaptree/EpochNode.java | 432 -
.../grid/util/snaptree/SnapTreeMap.java | 2897 ----
.../gridgain/grid/util/snaptree/package.html | 15 -
.../grid/util/test/GridTestPrintStream.java | 285 -
.../util/test/GridTestPrintStreamFactory.java | 120 -
.../org/gridgain/grid/util/test/package.html | 15 -
.../grid/util/tostring/GridToStringBuilder.java | 580 -
.../tostring/GridToStringClassDescriptor.java | 77 -
.../grid/util/tostring/GridToStringExclude.java | 24 -
.../tostring/GridToStringFieldDescriptor.java | 45 -
.../grid/util/tostring/GridToStringInclude.java | 24 -
.../grid/util/tostring/GridToStringOrder.java | 29 -
.../util/tostring/GridToStringThreadLocal.java | 47 -
.../gridgain/grid/util/tostring/package.html | 15 -
.../java/org/gridgain/grid/util/typedef/C1.java | 24 -
.../java/org/gridgain/grid/util/typedef/C2.java | 25 -
.../java/org/gridgain/grid/util/typedef/C3.java | 27 -
.../java/org/gridgain/grid/util/typedef/CA.java | 24 -
.../org/gridgain/grid/util/typedef/CAX.java | 24 -
.../org/gridgain/grid/util/typedef/CI1.java | 23 -
.../org/gridgain/grid/util/typedef/CI2.java | 24 -
.../org/gridgain/grid/util/typedef/CI3.java | 24 -
.../org/gridgain/grid/util/typedef/CIX1.java | 25 -
.../org/gridgain/grid/util/typedef/CIX2.java | 24 -
.../org/gridgain/grid/util/typedef/CIX3.java | 21 -
.../java/org/gridgain/grid/util/typedef/CO.java | 23 -
.../org/gridgain/grid/util/typedef/COX.java | 25 -
.../org/gridgain/grid/util/typedef/CX1.java | 26 -
.../org/gridgain/grid/util/typedef/CX2.java | 27 -
.../org/gridgain/grid/util/typedef/CX3.java | 25 -
.../java/org/gridgain/grid/util/typedef/F.java | 21 -
.../java/org/gridgain/grid/util/typedef/G.java | 21 -
.../java/org/gridgain/grid/util/typedef/P1.java | 23 -
.../java/org/gridgain/grid/util/typedef/P2.java | 24 -
.../java/org/gridgain/grid/util/typedef/P3.java | 24 -
.../java/org/gridgain/grid/util/typedef/PA.java | 21 -
.../org/gridgain/grid/util/typedef/PAX.java | 21 -
.../org/gridgain/grid/util/typedef/PCE.java | 25 -
.../java/org/gridgain/grid/util/typedef/PE.java | 25 -
.../org/gridgain/grid/util/typedef/PKV.java | 23 -
.../java/org/gridgain/grid/util/typedef/PN.java | 25 -
.../org/gridgain/grid/util/typedef/PX1.java | 25 -
.../org/gridgain/grid/util/typedef/PX2.java | 26 -
.../org/gridgain/grid/util/typedef/PX3.java | 24 -
.../java/org/gridgain/grid/util/typedef/R1.java | 24 -
.../java/org/gridgain/grid/util/typedef/R2.java | 23 -
.../java/org/gridgain/grid/util/typedef/R3.java | 23 -
.../org/gridgain/grid/util/typedef/RX1.java | 26 -
.../org/gridgain/grid/util/typedef/RX2.java | 26 -
.../org/gridgain/grid/util/typedef/RX3.java | 26 -
.../java/org/gridgain/grid/util/typedef/T1.java | 43 -
.../java/org/gridgain/grid/util/typedef/T2.java | 44 -
.../java/org/gridgain/grid/util/typedef/T3.java | 44 -
.../java/org/gridgain/grid/util/typedef/T4.java | 45 -
.../java/org/gridgain/grid/util/typedef/T5.java | 46 -
.../java/org/gridgain/grid/util/typedef/T6.java | 47 -
.../java/org/gridgain/grid/util/typedef/X.java | 929 --
.../gridgain/grid/util/typedef/internal/A.java | 20 -
.../gridgain/grid/util/typedef/internal/CU.java | 22 -
.../gridgain/grid/util/typedef/internal/D.java | 20 -
.../grid/util/typedef/internal/GPC.java | 19 -
.../grid/util/typedef/internal/GPR.java | 19 -
.../gridgain/grid/util/typedef/internal/LT.java | 20 -
.../gridgain/grid/util/typedef/internal/S.java | 20 -
.../gridgain/grid/util/typedef/internal/SB.java | 55 -
.../gridgain/grid/util/typedef/internal/U.java | 20 -
.../grid/util/typedef/internal/package.html | 15 -
.../org/gridgain/grid/util/typedef/package.html | 15 -
.../gridgain/grid/util/worker/GridWorker.java | 297 -
.../grid/util/worker/GridWorkerFuture.java | 62 -
.../grid/util/worker/GridWorkerListener.java | 27 -
.../util/worker/GridWorkerListenerAdapter.java | 25 -
.../grid/util/worker/GridWorkerPool.java | 109 -
.../org/gridgain/grid/util/worker/package.html | 15 -
.../org/gridgain/jdbc/GridJdbcConnection.java | 539 -
.../gridgain/jdbc/GridJdbcConnectionInfo.java | 83 -
.../gridgain/jdbc/GridJdbcDatabaseMetadata.java | 1306 --
.../java/org/gridgain/jdbc/GridJdbcDriver.java | 475 -
.../jdbc/GridJdbcPreparedStatement.java | 403 -
.../org/gridgain/jdbc/GridJdbcResultSet.java | 1512 --
.../jdbc/GridJdbcResultSetMetadata.java | 164 -
.../org/gridgain/jdbc/GridJdbcStatement.java | 441 -
.../main/java/org/gridgain/jdbc/package.html | 15 -
.../main/java/org/gridgain/jdbc/typedef/JU.java | 20 -
.../java/org/gridgain/jdbc/typedef/package.html | 15 -
.../org/gridgain/jdbc/util/GridJdbcUtils.java | 225 -
.../java/org/gridgain/jdbc/util/package.html | 15 -
.../core/src/main/resources/gridgain.properties | 5 -
.../core/src/main/resources/ignite.properties | 22 +
.../core/src/test/bin/start-nodes-custom.bat | 20 +-
modules/core/src/test/bin/start-nodes-custom.sh | 19 +-
.../spring-cache-client-benchmark-1.xml | 28 +-
.../spring-cache-client-benchmark-2.xml | 28 +-
.../spring-cache-client-benchmark-3.xml | 28 +-
.../core/src/test/config/cache-load.properties | 17 +
.../test/config/default-spring-url-testing.xml | 22 +-
.../core/src/test/config/discovery-stress.xml | 30 +-
modules/core/src/test/config/example-cache.xml | 26 +-
.../core/src/test/config/examples.properties | 17 +
modules/core/src/test/config/ggfs-loopback.xml | 69 +-
.../core/src/test/config/ggfs-no-endpoint.xml | 193 -
modules/core/src/test/config/ggfs-shmem.xml | 69 +-
.../hadoop/core-site-loopback-secondary.xml | 21 +-
.../test/config/hadoop/core-site-loopback.xml | 21 +-
.../test/config/hadoop/core-site-secondary.xml | 21 +-
.../core/src/test/config/hadoop/core-site.xml | 21 +-
.../src/test/config/io-manager-benchmark.xml | 24 +-
.../src/test/config/job-loadtest/client.xml | 17 +
.../config/job-loadtest/job-loadtest.properties | 17 +
.../src/test/config/job-loadtest/server.xml | 17 +
modules/core/src/test/config/jobs-load-base.xml | 19 +-
.../core/src/test/config/jobs-load-client.xml | 17 +
.../core/src/test/config/jobs-load-server.xml | 17 +
.../src/test/config/load/cache-benchmark.xml | 28 +-
.../test/config/load/cache-client-benchmark.xml | 28 +-
.../config/load/dsi-49-server-production.xml | 25 +-
.../core/src/test/config/load/dsi-load-base.xml | 38 +-
.../src/test/config/load/dsi-load-client.xml | 26 +-
.../src/test/config/load/dsi-load-server.xml | 30 +-
.../src/test/config/load/merge-sort-base.xml | 24 +-
.../test/config/load/mongo-multinode-foster.xml | 28 +-
.../test/config/loaders/grid-cfg-2-grids.xml | 22 +-
.../core/src/test/config/loaders/grid-cfg.xml | 22 +-
modules/core/src/test/config/log4j-test.xml | 22 +-
.../core/src/test/config/spring-cache-load.xml | 24 +-
.../config/spring-cache-put-remove-load.xml | 24 +-
.../core/src/test/config/spring-cache-swap.xml | 26 +-
.../src/test/config/spring-cache-teststore.xml | 28 +-
.../core/src/test/config/spring-multicache.xml | 58 +-
.../src/test/config/spring-start-nodes-attr.xml | 24 +-
.../core/src/test/config/spring-start-nodes.xml | 24 +-
.../average/spring-streamer-average-base.xml | 32 +-
.../average/spring-streamer-average-local.xml | 22 +-
.../average/spring-streamer-average-random.xml | 22 +-
.../config/streamer/spring-streamer-base.xml | 22 +-
modules/core/src/test/config/tests.properties | 23 +-
.../test/config/websession/spring-cache-1.xml | 30 +-
.../test/config/websession/spring-cache-2.xml | 30 +-
.../test/config/websession/spring-cache-3.xml | 30 +-
.../GridCacheAffinityBackupsSelfTest.java | 112 +
.../ignite/GridSuppressedExceptionSelfTest.java | 141 +
.../java/org/apache/ignite/GridTestIoUtils.java | 198 +
.../java/org/apache/ignite/GridTestJob.java | 51 +
.../org/apache/ignite/GridTestJobContext.java | 103 +
.../org/apache/ignite/GridTestJobResult.java | 91 +
.../org/apache/ignite/GridTestNodeStartup.java | 49 +
.../apache/ignite/GridTestStoreNodeStartup.java | 58 +
.../java/org/apache/ignite/GridTestTask.java | 53 +
.../org/apache/ignite/GridTestTaskSession.java | 235 +
.../ignite/IgniteCacheAffinitySelfTest.java | 283 +
.../IgniteExceptionHelpLinksSelfTest.java | 105 +
.../IgniteExternalizableAbstractTest.java | 41 +
...CachePartitionFairAffinityNodesSelfTest.java | 242 +
.../GridCachePartitionFairAffinitySelfTest.java | 261 +
.../store/GridCacheBalancingStoreSelfTest.java | 200 +
.../GridCacheLoadOnlyStoreAdapterSelfTest.java | 114 +
.../cache/store/GridGeneratingTestStore.java | 102 +
...CacheJdbcBlobStoreMultithreadedSelfTest.java | 248 +
.../jdbc/GridCacheJdbcBlobStoreSelfTest.java | 51 +
.../apache/ignite/cache/store/jdbc/package.html | 23 +
.../org/apache/ignite/cache/store/package.html | 23 +
.../fs/GridGgfsEventsAbstractSelfTest.java | 849 ++
.../GridGgfsFragmentizerAbstractSelfTest.java | 168 +
.../ignite/fs/GridGgfsFragmentizerSelfTest.java | 268 +
.../GridGgfsFragmentizerTopologySelfTest.java | 49 +
.../apache/ignite/fs/GridGgfsPathSelfTest.java | 162 +
.../ignite/fs/GridGgfsTestInputGenerator.java | 51 +
.../ignite/internal/ClusterMetricsSelfTest.java | 233 +
.../internal/ClusterNodeMetricsSelfTest.java | 246 +
.../ignite/internal/GridAffinityMappedTest.java | 164 +
.../internal/GridAffinityP2PSelfTest.java | 205 +
.../ignite/internal/GridAffinitySelfTest.java | 118 +
.../GridAlwaysFailoverSpiFailSelfTest.java | 159 +
.../internal/GridCacheProjectionRemoveTest.java | 41 +
.../internal/GridCancelOnGridStopSelfTest.java | 107 +
.../internal/GridCancelUnusedJobSelfTest.java | 220 +
.../GridCancelledJobsMetricsSelfTest.java | 214 +
.../GridCollisionJobsContextSelfTest.java | 112 +
.../internal/GridCommunicationSelfTest.java | 121 +
.../GridContinuousJobAnnotationSelfTest.java | 215 +
.../GridContinuousJobSiblingsSelfTest.java | 145 +
.../internal/GridContinuousTaskSelfTest.java | 348 +
.../GridDeploymentMultiThreadedSelfTest.java | 121 +
.../ignite/internal/GridDeploymentSelfTest.java | 535 +
.../internal/GridDiscoveryEventSelfTest.java | 420 +
.../ignite/internal/GridDiscoverySelfTest.java | 417 +
.../GridEventStorageCheckAllEventsSelfTest.java | 433 +
...ventStorageRuntimeConfigurationSelfTest.java | 347 +
.../internal/GridEventStorageSelfTest.java | 268 +
.../internal/GridFactoryVmShutdownTest.java | 101 +
.../GridFailedInputParametersSelfTest.java | 154 +
.../GridFailoverCustomTopologySelfTest.java | 188 +
.../ignite/internal/GridFailoverSelfTest.java | 151 +
.../GridFailoverTaskWithPredicateSelfTest.java | 252 +
.../internal/GridFailoverTopologySelfTest.java | 160 +
.../ignite/internal/GridHomePathSelfTest.java | 75 +
.../GridJobCheckpointCleanupSelfTest.java | 164 +
.../GridJobCollisionCancelSelfTest.java | 276 +
.../ignite/internal/GridJobContextSelfTest.java | 121 +
.../GridJobMasterLeaveAwareSelfTest.java | 801 +
.../internal/GridJobStealingSelfTest.java | 439 +
.../GridJobStealingZeroActiveJobsSelfTest.java | 169 +
.../internal/GridJobSubjectIdSelfTest.java | 153 +
.../GridKernalConcurrentAccessStopSelfTest.java | 63 +
.../ignite/internal/GridKernalTestUtils.java | 44 +
.../internal/GridLifecycleAwareSelfTest.java | 196 +
.../internal/GridLifecycleBeanSelfTest.java | 312 +
.../internal/GridListenActorSelfTest.java | 232 +
.../GridLocalEventListenerSelfTest.java | 73 +
.../internal/GridManagementJobSelfTest.java | 167 +
.../internal/GridMultipleJobsSelfTest.java | 231 +
.../internal/GridMultipleSpisSelfTest.java | 302 +
.../GridMultipleVersionsDeploymentSelfTest.java | 306 +
.../GridMultithreadedJobStealingSelfTest.java | 240 +
.../ignite/internal/GridNodeFilterSelfTest.java | 78 +
.../ignite/internal/GridNodeLocalSelfTest.java | 65 +
.../GridNodeVisorAttributesSelfTest.java | 114 +
.../internal/GridNonHistoryMetricsSelfTest.java | 124 +
.../internal/GridProjectionAbstractTest.java | 768 +
.../GridProjectionForCachesSelfTest.java | 256 +
...ectionLocalJobMultipleArgumentsSelfTest.java | 156 +
.../ignite/internal/GridProjectionSelfTest.java | 145 +
.../ignite/internal/GridReduceSelfTest.java | 194 +
.../internal/GridReleaseTypeSelfTest.java | 134 +
.../internal/GridRuntimeExceptionSelfTest.java | 302 +
.../internal/GridSameVmStartupSelfTest.java | 107 +
.../apache/ignite/internal/GridSelfTest.java | 166 +
.../internal/GridSpiExceptionSelfTest.java | 174 +
.../ignite/internal/GridStartStopSelfTest.java | 182 +
.../apache/ignite/internal/GridStartupMain.java | 57 +
.../apache/ignite/internal/GridStartupTest.java | 69 +
.../internal/GridStopWithCancelSelfTest.java | 122 +
.../internal/GridStopWithWaitSelfTest.java | 263 +
.../GridTaskCancelSingleNodeSelfTest.java | 185 +
.../GridTaskContinuousMapperSelfTest.java | 331 +
.../GridTaskExecutionContextSelfTest.java | 178 +
.../internal/GridTaskExecutionSelfTest.java | 68 +
.../internal/GridTaskFailoverSelfTest.java | 117 +
.../GridTaskFutureImplStopGridSelfTest.java | 212 +
.../GridTaskInstanceExecutionSelfTest.java | 121 +
.../internal/GridTaskInstantiationSelfTest.java | 117 +
.../internal/GridTaskJobRejectSelfTest.java | 160 +
.../internal/GridTaskListenerSelfTest.java | 106 +
.../internal/GridTaskMapAsyncSelfTest.java | 141 +
.../GridTaskNameAnnotationSelfTest.java | 124 +
.../internal/GridTaskResultCacheSelfTest.java | 129 +
.../internal/GridTaskTimeoutSelfTest.java | 223 +
.../GridTopicExternalizableSelfTest.java | 165 +
.../GridTopologyBuildVersionSelfTest.java | 101 +
.../internal/GridUpdateNotifierSelfTest.java | 91 +
.../ignite/internal/GridVersionSelfTest.java | 69 +
.../internal/IgniteExecutorServiceTest.java | 315 +
...gniteExplicitImplicitDeploymentSelfTest.java | 476 +
.../managers/GridManagerStopSelfTest.java | 225 +
.../managers/GridNoopManagerSelfTest.java | 96 +
.../GridCheckpointManagerAbstractSelfTest.java | 755 +
.../GridCheckpointManagerSelfTest.java | 68 +
.../checkpoint/GridCheckpointTaskSelfTest.java | 233 +
.../internal/managers/checkpoint/package.html | 23 +
...idCommunicationManagerListenersSelfTest.java | 158 +
.../GridCommunicationSendMessageSelfTest.java | 173 +
.../communication/GridIoManagerSelfTest.java | 249 +
.../managers/communication/package.html | 23 +
.../GridDeploymentManagerStopSelfTest.java | 99 +
.../GridDeploymentMessageCountSelfTest.java | 210 +
.../managers/deployment/GridTestDeployment.java | 39 +
.../internal/managers/deployment/package.html | 23 +
.../GridDiscoveryManagerAliveCacheSelfTest.java | 237 +
.../GridDiscoveryManagerAttributesSelfTest.java | 171 +
.../discovery/GridDiscoveryManagerSelfTest.java | 154 +
.../events/GridEventStorageManagerSelfTest.java | 126 +
.../ignite/internal/managers/package.html | 23 +
.../GridSwapSpaceCustomLocalValue.java | 85 +
.../swapspace/GridSwapSpaceManagerSelfTest.java | 164 +
.../internal/managers/swapspace/package.html | 23 +
.../org/apache/ignite/internal/package.html | 24 +
.../GridAffinityProcessorAbstractSelfTest.java | 194 +
...AffinityProcessorConsistentHashSelfTest.java | 31 +
...GridAffinityProcessorRendezvousSelfTest.java | 31 +
...ridCacheAbstractByteArrayValuesSelfTest.java | 83 +
.../GridCacheAbstractFailoverSelfTest.java | 432 +
.../cache/GridCacheAbstractFlagsTest.java | 98 +
...cheAbstractFullApiMultithreadedSelfTest.java | 403 +
.../cache/GridCacheAbstractFullApiSelfTest.java | 5507 +++++++
.../GridCacheAbstractIteratorsSelfTest.java | 349 +
.../cache/GridCacheAbstractMetricsSelfTest.java | 902 ++
.../GridCacheAbstractProjectionSelfTest.java | 884 ++
.../GridCacheAbstractRemoveFailureTest.java | 322 +
.../cache/GridCacheAbstractSelfTest.java | 603 +
.../cache/GridCacheAbstractTxReadTest.java | 137 +
.../cache/GridCacheAffinityApiSelfTest.java | 361 +
.../cache/GridCacheAffinityMapperSelfTest.java | 132 +
.../cache/GridCacheAffinityRoutingSelfTest.java | 689 +
.../cache/GridCacheAlwaysEvictionPolicy.java | 34 +
.../GridCacheAsyncOperationsLimitSelfTest.java | 76 +
.../GridCacheAtomicMessageCountSelfTest.java | 233 +
.../cache/GridCacheBasicApiAbstractTest.java | 696 +
.../cache/GridCacheBasicStoreAbstractTest.java | 589 +
...acheBasicStoreMultithreadedAbstractTest.java | 132 +
.../cache/GridCacheClearAllSelfTest.java | 335 +
...dCacheColocatedTxStoreExceptionSelfTest.java | 38 +
.../cache/GridCacheConcurrentMapSelfTest.java | 384 +
.../cache/GridCacheConcurrentMapTest.java | 137 +
.../GridCacheConcurrentTxMultiNodeTest.java | 856 ++
...idCacheConfigurationConsistencySelfTest.java | 1073 ++
...ridCacheConfigurationValidationSelfTest.java | 196 +
.../GridCacheDaemonNodeAbstractSelfTest.java | 189 +
.../GridCacheDeploymentOffHeapSelfTest.java | 42 +
.../cache/GridCacheDeploymentSelfTest.java | 485 +
.../cache/GridCacheEntryMemorySizeSelfTest.java | 314 +
.../cache/GridCacheEntryVersionSelfTest.java | 159 +
.../GridCacheEvictionEventAbstractTest.java | 121 +
.../GridCacheExAbstractFullApiSelfTest.java | 103 +
.../GridCacheFieldsQueryNoDataSelfTest.java | 82 +
.../GridCacheFinishPartitionsSelfTest.java | 320 +
...CacheFullTextQueryMultithreadedSelfTest.java | 156 +
.../cache/GridCacheGenericTestStore.java | 274 +
...idCacheGetAndTransformStoreAbstractTest.java | 176 +
.../cache/GridCacheGlobalClearAllSelfTest.java | 167 +
.../GridCacheGroupLockAbstractSelfTest.java | 1333 ++
...heGroupLockFailoverOptimisticTxSelfTest.java | 28 +
.../GridCacheGroupLockFailoverSelfTest.java | 533 +
...CacheGroupLockMultiNodeAbstractSelfTest.java | 28 +
.../cache/GridCacheGroupLockPutTask.java | 157 +
.../cache/GridCacheIncrementTransformTest.java | 233 +
.../GridCacheInterceptorAbstractSelfTest.java | 1648 +++
...cheInterceptorAtomicNearEnabledSelfTest.java | 32 +
...erceptorAtomicPrimaryWriteOrderSelfTest.java | 45 +
...omicReplicatedPrimaryWriteOrderSelfTest.java | 46 +
...acheInterceptorAtomicReplicatedSelfTest.java | 45 +
.../GridCacheInterceptorAtomicSelfTest.java | 45 +
...ceptorAtomicWithStoreReplicatedSelfTest.java | 29 +
...CacheInterceptorAtomicWithStoreSelfTest.java | 28 +
...GridCacheInterceptorLocalAtomicSelfTest.java | 50 +
...InterceptorLocalAtomicWithStoreSelfTest.java | 28 +
.../GridCacheInterceptorLocalSelfTest.java | 44 +
...dCacheInterceptorLocalWithStoreSelfTest.java | 28 +
...GridCacheInterceptorNearEnabledSelfTest.java | 30 +
.../GridCacheInterceptorReplicatedSelfTest.java | 39 +
...eInterceptorReplicatedWithStoreSelfTest.java | 28 +
.../cache/GridCacheInterceptorSelfTest.java | 39 +
.../GridCacheInterceptorWithStoreSelfTest.java | 28 +
.../cache/GridCacheIteratorPerformanceTest.java | 277 +
.../GridCacheKeyCheckNearEnabledSelfTest.java | 30 +
.../cache/GridCacheKeyCheckSelfTest.java | 205 +
.../processors/cache/GridCacheLeakTest.java | 150 +
.../cache/GridCacheLifecycleAwareSelfTest.java | 367 +
.../GridCacheLocalTxStoreExceptionSelfTest.java | 37 +
.../cache/GridCacheLuceneQueryIndexTest.java | 465 +
.../GridCacheMarshallerTxAbstractTest.java | 132 +
.../cache/GridCacheMemoryModeSelfTest.java | 268 +
.../GridCacheMissingCommitVersionSelfTest.java | 128 +
...GridCacheMixedPartitionExchangeSelfTest.java | 152 +
.../cache/GridCacheMultiUpdateLockSelfTest.java | 202 +
...ridCacheMultinodeUpdateAbstractSelfTest.java | 134 +
...ultinodeUpdateAtomicNearEnabledSelfTest.java | 39 +
.../GridCacheMultinodeUpdateAtomicSelfTest.java | 38 +
...inodeUpdateNearEnabledNoBackupsSelfTest.java | 39 +
...CacheMultinodeUpdateNearEnabledSelfTest.java | 40 +
.../cache/GridCacheMultinodeUpdateSelfTest.java | 39 +
.../cache/GridCacheMvccFlagsTest.java | 142 +
.../cache/GridCacheMvccManagerSelfTest.java | 115 +
.../cache/GridCacheMvccPartitionedSelfTest.java | 688 +
.../processors/cache/GridCacheMvccSelfTest.java | 1851 +++
.../GridCacheNearTxStoreExceptionSelfTest.java | 32 +
.../cache/GridCacheNestedTxAbstractTest.java | 284 +
.../cache/GridCacheObjectToStringSelfTest.java | 193 +
...ffHeapAtomicMultiThreadedUpdateSelfTest.java | 33 +
...HeapMultiThreadedUpdateAbstractSelfTest.java | 399 +
...CacheOffHeapMultiThreadedUpdateSelfTest.java | 270 +
.../cache/GridCacheOffHeapSelfTest.java | 654 +
.../processors/cache/GridCacheOffHeapTest.java | 257 +
.../GridCacheOffHeapTieredAbstractSelfTest.java | 685 +
.../GridCacheOffHeapTieredAtomicSelfTest.java | 32 +
...heOffHeapTieredEvictionAbstractSelfTest.java | 422 +
...acheOffHeapTieredEvictionAtomicSelfTest.java | 32 +
.../GridCacheOffHeapTieredEvictionSelfTest.java | 33 +
.../cache/GridCacheOffHeapTieredSelfTest.java | 33 +
.../cache/GridCacheOffheapUpdateSelfTest.java | 139 +
.../GridCacheOrderedPreloadingSelfTest.java | 157 +
.../cache/GridCacheP2PUndeploySelfTest.java | 305 +
.../GridCachePartitionedAffinitySpreadTest.java | 167 +
.../cache/GridCachePartitionedGetSelfTest.java | 252 +
...hePartitionedProjectionAffinitySelfTest.java | 118 +
.../cache/GridCachePartitionedWritesTest.java | 148 +
.../GridCachePreloadingEvictionsSelfTest.java | 261 +
.../cache/GridCachePutAllFailoverSelfTest.java | 708 +
.../processors/cache/GridCachePutAllTask.java | 132 +
.../cache/GridCacheQueryEmbeddedValue.java | 49 +
.../cache/GridCacheQueryIndexSelfTest.java | 124 +
.../GridCacheQueryIndexingDisabledSelfTest.java | 98 +
.../GridCacheQueryInternalKeysSelfTest.java | 112 +
.../GridCacheReferenceCleanupSelfTest.java | 502 +
.../cache/GridCacheReloadSelfTest.java | 178 +
...ridCacheReplicatedSynchronousCommitTest.java | 202 +
...CacheReplicatedTxStoreExceptionSelfTest.java | 38 +
.../GridCacheReturnValueTransferSelfTest.java | 206 +
.../cache/GridCacheSlowTxWarnTest.java | 147 +
.../processors/cache/GridCacheStopSelfTest.java | 201 +
.../cache/GridCacheStorePutxSelfTest.java | 159 +
.../cache/GridCacheStoreValueBytesSelfTest.java | 111 +
.../cache/GridCacheSwapPreloadSelfTest.java | 223 +
.../cache/GridCacheSwapReloadSelfTest.java | 240 +
.../processors/cache/GridCacheTestEntryEx.java | 826 ++
.../processors/cache/GridCacheTestKey.java | 64 +
.../processors/cache/GridCacheTestStore.java | 334 +
.../processors/cache/GridCacheTestValue.java | 77 +
.../processors/cache/GridCacheTestValue2.java | 67 +
...cheTransactionalAbstractMetricsSelfTest.java | 284 +
.../cache/GridCacheTtlManagerLoadTest.java | 84 +
.../cache/GridCacheTtlManagerSelfTest.java | 120 +
.../cache/GridCacheUtilsSelfTest.java | 261 +
.../GridCacheValueBytesPreloadingSelfTest.java | 151 +
...idCacheValueConsistencyAbstractSelfTest.java | 322 +
...istencyTransactionalNearEnabledSelfTest.java | 31 +
...heValueConsistencyTransactionalSelfTest.java | 37 +
.../GridCacheVariableTopologySelfTest.java | 191 +
.../cache/GridCacheVersionSelfTest.java | 103 +
...idCacheWriteBehindStoreAbstractSelfTest.java | 189 +
.../GridCacheWriteBehindStoreAbstractTest.java | 358 +
.../GridCacheWriteBehindStoreLocalTest.java | 30 +
...heWriteBehindStoreMultithreadedSelfTest.java | 164 +
...BehindStorePartitionedMultiNodeSelfTest.java | 216 +
...ridCacheWriteBehindStorePartitionedTest.java | 30 +
...GridCacheWriteBehindStoreReplicatedTest.java | 30 +
.../GridCacheWriteBehindStoreSelfTest.java | 267 +
.../cache/IgniteCacheAbstractTest.java | 255 +
.../cache/IgniteCacheAtomicInvokeTest.java | 55 +
.../cache/IgniteCacheAtomicLocalInvokeTest.java | 49 +
...niteCacheAtomicLocalWithStoreInvokeTest.java | 30 +
.../IgniteCacheAtomicNearEnabledInvokeTest.java | 32 +
...eCacheAtomicPrimaryWriteOrderInvokeTest.java | 55 +
...micPrimaryWriteOrderWithStoreInvokeTest.java | 31 +
.../IgniteCacheEntryListenerAbstractTest.java | 1005 ++
...IgniteCacheEntryListenerAtomicLocalTest.java | 49 +
...eCacheEntryListenerAtomicReplicatedTest.java | 32 +
.../IgniteCacheEntryListenerAtomicTest.java | 55 +
...eCacheEntryListenerEagerTtlDisabledTest.java | 29 +
.../IgniteCacheEntryListenerTxLocalTest.java | 49 +
...gniteCacheEntryListenerTxReplicatedTest.java | 32 +
.../cache/IgniteCacheEntryListenerTxTest.java | 49 +
.../IgniteCacheInterceptorSelfTestSuite.java | 56 +
.../cache/IgniteCacheInvokeAbstractTest.java | 655 +
.../cache/IgniteCacheInvokeReadThroughTest.java | 121 +
.../processors/cache/IgniteCacheTest.java | 113 -
.../cache/IgniteCacheTxInvokeTest.java | 49 +
.../cache/IgniteCacheTxLocalInvokeTest.java | 49 +
.../IgniteCacheTxNearEnabledInvokeTest.java | 32 +
.../cache/IgniteCachingProviderSelfTest.java | 131 +
.../processors/cache/IgniteTxAbstractTest.java | 492 +
.../IgniteTxConcurrentGetAbstractTest.java | 142 +
.../IgniteTxExceptionAbstractSelfTest.java | 648 +
.../cache/IgniteTxMultiNodeAbstractTest.java | 926 ++
.../IgniteTxMultiThreadedAbstractTest.java | 283 +
.../cache/IgniteTxReentryAbstractSelfTest.java | 177 +
.../IgniteTxSingleThreadedAbstractTest.java | 137 +
.../IgniteTxStoreExceptionAbstractSelfTest.java | 658 +
...eAbstractDataStructuresFailoverSelfTest.java | 995 ++
...actQueueFailoverDataConsistencySelfTest.java | 378 +
.../GridCacheAtomicLongApiSelfTest.java | 484 +
...CacheAtomicReferenceApiSelfAbstractTest.java | 213 +
...cheAtomicReferenceMultiNodeAbstractTest.java | 201 +
...idCacheAtomicStampedApiSelfAbstractTest.java | 153 +
.../GridCacheCountDownLatchSelfTest.java | 410 +
.../GridCacheMultiNodeDataStructureTest.java | 78 +
.../GridCacheQueueApiSelfAbstractTest.java | 712 +
.../GridCacheQueueCleanupSelfTest.java | 234 +
...ridCacheQueueJoinedNodeSelfAbstractTest.java | 306 +
...GridCacheQueueMultiNodeAbstractSelfTest.java | 832 ++
...dCacheQueueMultiNodeConsistencySelfTest.java | 255 +
...CacheQueueRotativeMultiNodeAbstractTest.java | 441 +
.../GridCacheSequenceApiSelfAbstractTest.java | 572 +
...dCacheSequenceMultiNodeAbstractSelfTest.java | 289 +
.../GridCacheSetAbstractSelfTest.java | 896 ++
.../GridCacheSetFailoverAbstractSelfTest.java | 245 +
.../GridCacheLocalAtomicQueueApiSelfTest.java | 39 +
.../local/GridCacheLocalAtomicSetSelfTest.java | 44 +
.../local/GridCacheLocalQueueApiSelfTest.java | 44 +
.../GridCacheLocalSequenceApiSelfTest.java | 46 +
.../local/GridCacheLocalSetSelfTest.java | 38 +
...dCachePartitionedAtomicQueueApiSelfTest.java | 41 +
...ionedAtomicQueueCreateMultiNodeSelfTest.java | 39 +
...micQueueFailoverDataConsistencySelfTest.java | 34 +
...PartitionedAtomicQueueMultiNodeSelfTest.java | 41 +
...itionedAtomicQueueRotativeMultiNodeTest.java | 42 +
...hePartitionedAtomicReferenceApiSelfTest.java | 48 +
...PartitionedAtomicReferenceMultiNodeTest.java | 46 +
...titionedAtomicSequenceMultiThreadedTest.java | 359 +
...chePartitionedAtomicSetFailoverSelfTest.java | 39 +
.../GridCachePartitionedAtomicSetSelfTest.java | 49 +
...achePartitionedAtomicStampedApiSelfTest.java | 52 +
...rtitionedDataStructuresFailoverSelfTest.java | 34 +
...GridCachePartitionedNodeRestartSelfTest.java | 68 +
...idCachePartitionedNodeRestartTxSelfTest.java | 294 +
.../GridCachePartitionedQueueApiSelfTest.java | 52 +
...PartitionedQueueCreateMultiNodeSelfTest.java | 194 +
...dCachePartitionedQueueEntryMoveSelfTest.java | 254 +
...nedQueueFailoverDataConsistencySelfTest.java | 27 +
...CachePartitionedQueueJoinedNodeSelfTest.java | 52 +
...dCachePartitionedQueueMultiNodeSelfTest.java | 50 +
...hePartitionedQueueRotativeMultiNodeTest.java | 49 +
...GridCachePartitionedSequenceApiSelfTest.java | 51 +
...chePartitionedSequenceMultiNodeSelfTest.java | 51 +
...GridCachePartitionedSetFailoverSelfTest.java | 33 +
.../GridCachePartitionedSetSelfTest.java | 33 +
...cheReplicatedAtomicReferenceApiSelfTest.java | 45 +
...eReplicatedAtomicReferenceMultiNodeTest.java | 45 +
...CacheReplicatedAtomicStampedApiSelfTest.java | 44 +
...eplicatedDataStructuresFailoverSelfTest.java | 34 +
.../GridCacheReplicatedQueueApiSelfTest.java | 47 +
...idCacheReplicatedQueueMultiNodeSelfTest.java | 47 +
...cheReplicatedQueueRotativeMultiNodeTest.java | 47 +
.../GridCacheReplicatedSequenceApiSelfTest.java | 46 +
...acheReplicatedSequenceMultiNodeSelfTest.java | 46 +
.../GridCacheReplicatedSetSelfTest.java | 33 +
...tractDistributedByteArrayValuesSelfTest.java | 389 +
.../GridCacheAbstractJobExecutionTest.java | 183 +
.../GridCacheAbstractNodeRestartSelfTest.java | 886 ++
...tractPartitionedByteArrayValuesSelfTest.java | 100 +
.../GridCacheAbstractPrimarySyncSelfTest.java | 108 +
.../GridCacheAtomicTimeoutSelfTest.java | 295 +
.../GridCacheBasicOpAbstractTest.java | 389 +
.../GridCacheClientModesAbstractSelfTest.java | 209 +
.../GridCacheEntrySetAbstractSelfTest.java | 117 +
...acheEntrySetIterationPreloadingSelfTest.java | 90 +
.../distributed/GridCacheEventAbstractTest.java | 964 ++
...heExpiredEntriesPreloadAbstractSelfTest.java | 118 +
.../distributed/GridCacheLockAbstractTest.java | 476 +
.../distributed/GridCacheMixedModeSelfTest.java | 81 +
.../GridCacheModuloAffinityFunction.java | 200 +
.../GridCacheMultiNodeAbstractTest.java | 491 +
.../GridCacheMultiNodeLockAbstractTest.java | 649 +
...dCacheMultithreadedFailoverAbstractTest.java | 606 +
.../GridCacheNodeFailureAbstractTest.java | 296 +
...dCachePartitionedAffinityFilterSelfTest.java | 144 +
...chePartitionedReloadAllAbstractSelfTest.java | 248 +
.../GridCachePreloadEventsAbstractSelfTest.java | 131 +
.../GridCachePreloadLifecycleAbstractTest.java | 231 +
...GridCachePreloadRestartAbstractSelfTest.java | 322 +
.../GridCacheTransformEventSelfTest.java | 609 +
.../IgniteCrossCacheTxStoreSelfTest.java | 288 +
...iteTxConsistencyRestartAbstractSelfTest.java | 202 +
...xOriginatingNodeFailureAbstractSelfTest.java | 305 +
...cOriginatingNodeFailureAbstractSelfTest.java | 503 +
.../IgniteTxPreloadAbstractTest.java | 220 +
.../IgniteTxTimeoutAbstractTest.java | 155 +
...tPartitionedOnlyByteArrayValuesSelfTest.java | 168 +
...heAbstractTransformWriteThroughSelfTest.java | 336 +
...acheAtomicExpiredEntriesPreloadSelfTest.java | 45 +
.../dht/GridCacheAtomicFullApiSelfTest.java | 109 +
.../dht/GridCacheAtomicNearCacheSelfTest.java | 820 ++
...idCacheAtomicNearEnabledFullApiSelfTest.java | 32 +
...EnabledPrimaryWriteOrderFullApiSelfTest.java | 33 +
...eAtomicPrimaryWriteOrderFullApiSelfTest.java | 32 +
...tomicPrimaryWriteOrderReloadAllSelfTest.java | 32 +
.../dht/GridCacheAtomicReloadAllSelfTest.java | 38 +
.../dht/GridCacheClientOnlySelfTest.java | 38 +
.../dht/GridCacheColocatedDebugTest.java | 981 ++
.../dht/GridCacheColocatedFailoverSelfTest.java | 39 +
...eColocatedOptimisticTransactionSelfTest.java | 156 +
...ridCacheColocatedPreloadRestartSelfTest.java | 30 +
.../GridCacheColocatedPrimarySyncSelfTest.java | 33 +
.../GridCacheColocatedReloadAllSelfTest.java | 30 +
.../GridCacheColocatedTxExceptionSelfTest.java | 39 +
...ssimisticOriginatingNodeFailureSelfTest.java | 49 +
...dCacheColocatedTxSingleThreadedSelfTest.java | 107 +
.../GridCacheDaemonNodePartitionedSelfTest.java | 31 +
...cheDhtAtomicEvictionNearReadersSelfTest.java | 32 +
.../GridCacheDhtAtomicRemoveFailureTest.java | 50 +
.../dht/GridCacheDhtEntrySelfTest.java | 314 +
.../dht/GridCacheDhtEntrySetSelfTest.java | 45 +
...GridCacheDhtEvictionNearReadersSelfTest.java | 297 +
.../dht/GridCacheDhtEvictionSelfTest.java | 363 +
.../GridCacheDhtEvictionsDisabledSelfTest.java | 125 +
...idCacheDhtExpiredEntriesPreloadSelfTest.java | 39 +
.../dht/GridCacheDhtInternalEntrySelfTest.java | 225 +
.../dht/GridCacheDhtMappingSelfTest.java | 105 +
.../dht/GridCacheDhtMultiBackupTest.java | 135 +
.../dht/GridCacheDhtPreloadBigDataSelfTest.java | 228 +
.../dht/GridCacheDhtPreloadDelayedSelfTest.java | 459 +
.../GridCacheDhtPreloadDisabledSelfTest.java | 278 +
.../GridCacheDhtPreloadMessageCountTest.java | 175 +
...ridCacheDhtPreloadMultiThreadedSelfTest.java | 175 +
.../dht/GridCacheDhtPreloadOffHeapSelfTest.java | 39 +
.../dht/GridCacheDhtPreloadPutGetSelfTest.java | 275 +
.../dht/GridCacheDhtPreloadSelfTest.java | 675 +
.../GridCacheDhtPreloadStartStopSelfTest.java | 268 +
.../dht/GridCacheDhtPreloadUnloadSelfTest.java | 321 +
.../dht/GridCacheDhtRemoveFailureTest.java | 44 +
.../distributed/dht/GridCacheDhtTestUtils.java | 231 +
.../dht/GridCacheDhtTxPreloadSelfTest.java | 44 +
.../GridCacheExColocatedFullApiSelfTest.java | 33 +
.../dht/GridCacheGlobalLoadTest.java | 229 +
.../GridCacheGroupLockColocatedSelfTest.java | 38 +
...acheGroupLockMultiNodeColocatedSelfTest.java | 29 +
...cheGroupLockPartitionedAbstractSelfTest.java | 136 +
...ockPartitionedMultiNodeAbstractSelfTest.java | 173 +
...ePartitionedNearDisabledFullApiSelfTest.java | 33 +
...ePartitionedNearDisabledMetricsSelfTest.java | 119 +
...nedNearDisabledMultiNodeFullApiSelfTest.java | 34 +
...bledMultiNodeP2PDisabledFullApiSelfTest.java | 34 +
...ionedNearDisabledOffHeapFullApiSelfTest.java | 29 +
...DisabledOffHeapMultiNodeFullApiSelfTest.java | 29 +
...isabledTxOriginatingNodeFailureSelfTest.java | 31 +
...dOnlyP2PDisabledByteArrayValuesSelfTest.java | 29 +
...edOnlyP2PEnabledByteArrayValuesSelfTest.java | 29 +
...dCachePartitionedOnlyProjectionSelfTest.java | 32 +
...idCachePartitionedPreloadEventsSelfTest.java | 124 +
...dCachePartitionedTopologyChangeSelfTest.java | 596 +
...ransformWriteThroughBatchUpdateSelfTest.java | 29 +
...itionedTxOriginatingNodeFailureSelfTest.java | 161 +
...ridCachePartitionedUnloadEventsSelfTest.java | 151 +
...teTxConsistencyColocatedRestartSelfTest.java | 36 +
.../dht/IgniteTxReentryColocatedSelfTest.java | 79 +
...eAtomicInvalidPartitionHandlingSelfTest.java | 326 +
.../atomic/GridCacheAtomicPreloadSelfTest.java | 214 +
...lueConsistencyAtomicNearEnabledSelfTest.java | 38 +
...micPrimaryWriteOrderNearEnabledSelfTest.java | 39 +
...GridCacheValueConsistencyAtomicSelfTest.java | 139 +
...tNearPartitionedByteArrayValuesSelfTest.java | 34 +
...unctionExcludeNeighborsAbstractSelfTest.java | 184 +
...tomicClientOnlyMultiNodeFullApiSelfTest.java | 501 +
...OnlyMultiNodeP2PDisabledFullApiSelfTest.java | 35 +
...GridCacheAtomicMultiNodeFullApiSelfTest.java | 68 +
...omicMultiNodeP2PDisabledFullApiSelfTest.java | 66 +
...omicNearEnabledMultiNodeFullApiSelfTest.java | 32 +
...imaryWriteOrderMultiNodeFullApiSelfTest.java | 33 +
...ridCacheAtomicNearEvictionEventSelfTest.java | 39 +
.../GridCacheAtomicNearEvictionSelfTest.java | 32 +
.../GridCacheAtomicNearMultiNodeSelfTest.java | 32 +
...eAtomicNearOnlyMultiNodeFullApiSelfTest.java | 192 +
...OnlyMultiNodeP2PDisabledFullApiSelfTest.java | 35 +
.../near/GridCacheAtomicNearOnlySelfTest.java | 32 +
.../GridCacheAtomicNearReadersSelfTest.java | 32 +
.../GridCacheAtomicNearRemoveFailureTest.java | 51 +
.../GridCacheAtomicOffHeapFullApiSelfTest.java | 65 +
...heAtomicOffHeapMultiNodeFullApiSelfTest.java | 66 +
...idCacheAtomicPartitionedMetricsSelfTest.java | 64 +
...AtomicPartitionedTckMetricsSelfTestImpl.java | 183 +
...imaryWriteOrderMultiNodeFullApiSelfTest.java | 32 +
...rderMultiNodeP2PDisabledFullApiSelfTest.java | 33 +
...cPrimaryWriteOrderNearRemoveFailureTest.java | 51 +
...PrimaryWriteOrderOffHeapFullApiSelfTest.java | 32 +
...ityOrderOffHeapMultiNodeFullApiSelfTest.java | 33 +
...ffinityFunctionExcludeNeighborsSelfTest.java | 32 +
.../near/GridCacheExNearFullApiSelfTest.java | 39 +
.../near/GridCacheGetStoreErrorSelfTest.java | 151 +
...GridCacheGroupLockMultiNodeNearSelfTest.java | 30 +
.../near/GridCacheGroupLockNearSelfTest.java | 38 +
.../GridCacheNearEvictionEventSelfTest.java | 48 +
.../near/GridCacheNearEvictionSelfTest.java | 186 +
...dCacheNearExpiredEntriesPreloadSelfTest.java | 39 +
.../near/GridCacheNearJobExecutionSelfTest.java | 48 +
.../near/GridCacheNearMetricsSelfTest.java | 406 +
.../near/GridCacheNearMultiGetSelfTest.java | 308 +
.../near/GridCacheNearMultiNodeSelfTest.java | 974 ++
.../near/GridCacheNearOneNodeSelfTest.java | 394 +
...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 423 +
...OnlyMultiNodeP2PDisabledFullApiSelfTest.java | 34 +
.../near/GridCacheNearOnlySelfTest.java | 68 +
.../near/GridCacheNearOnlyTopologySelfTest.java | 233 +
.../GridCacheNearPartitionedClearSelfTest.java | 155 +
...ionedP2PDisabledByteArrayValuesSelfTest.java | 29 +
...tionedP2PEnabledByteArrayValuesSelfTest.java | 29 +
.../GridCacheNearPreloadRestartSelfTest.java | 30 +
.../near/GridCacheNearPrimarySyncSelfTest.java | 33 +
.../GridCacheNearReaderPreloadSelfTest.java | 199 +
.../near/GridCacheNearReadersSelfTest.java | 589 +
.../near/GridCacheNearReloadAllSelfTest.java | 30 +
.../near/GridCacheNearRemoveFailureTest.java | 44 +
.../near/GridCacheNearTxExceptionSelfTest.java | 33 +
.../near/GridCacheNearTxMultiNodeSelfTest.java | 246 +
...ssimisticOriginatingNodeFailureSelfTest.java | 49 +
.../near/GridCacheNearTxPreloadSelfTest.java | 44 +
...AffinityExcludeNeighborsPerformanceTest.java | 254 +
...rtitionedAffinityHashIdResolverSelfTest.java | 97 +
.../GridCachePartitionedAffinitySelfTest.java | 515 +
...ionedAtomicGetAndTransformStoreSelfTest.java | 33 +
.../near/GridCachePartitionedBasicApiTest.java | 47 +
.../GridCachePartitionedBasicOpSelfTest.java | 67 +
...ePartitionedBasicStoreMultiNodeSelfTest.java | 357 +
.../GridCachePartitionedBasicStoreSelfTest.java | 33 +
...ionedClientOnlyNoPrimaryFullApiSelfTest.java | 67 +
.../GridCachePartitionedEntryLockSelfTest.java | 112 +
.../near/GridCachePartitionedEventSelfTest.java | 59 +
.../GridCachePartitionedEvictionSelfTest.java | 216 +
...titionedExplicitLockNodeFailureSelfTest.java | 164 +
.../GridCachePartitionedFailoverSelfTest.java | 33 +
...GridCachePartitionedFilteredPutSelfTest.java | 165 +
.../near/GridCachePartitionedFlagsTest.java | 41 +
...PartitionedFullApiMultithreadedSelfTest.java | 38 +
.../GridCachePartitionedFullApiSelfTest.java | 251 +
...PartitionedGetAndTransformStoreSelfTest.java | 34 +
.../GridCachePartitionedIteratorsSelfTest.java | 43 +
.../GridCachePartitionedLoadCacheSelfTest.java | 178 +
.../near/GridCachePartitionedLockSelfTest.java | 86 +
.../GridCachePartitionedMetricsSelfTest.java | 60 +
...achePartitionedMultiNodeCounterSelfTest.java | 779 +
...achePartitionedMultiNodeFullApiSelfTest.java | 597 +
...idCachePartitionedMultiNodeLockSelfTest.java | 78 +
...onedMultiNodeP2PDisabledFullApiSelfTest.java | 35 +
.../GridCachePartitionedMultiNodeSelfTest.java | 48 +
...ePartitionedMultiThreadedPutGetSelfTest.java | 204 +
...NearDisabledBasicStoreMultiNodeSelfTest.java | 33 +
...itionedNearOnlyNoPrimaryFullApiSelfTest.java | 31 +
.../near/GridCachePartitionedNestedTxTest.java | 50 +
...GridCachePartitionedNodeFailureSelfTest.java | 50 +
.../GridCachePartitionedNodeRestartTest.java | 131 +
...dCachePartitionedOffHeapFullApiSelfTest.java | 28 +
...titionedOffHeapMultiNodeFullApiSelfTest.java | 28 +
...ePartitionedOptimisticTxNodeRestartTest.java | 127 +
...achePartitionedPreloadLifecycleSelfTest.java | 278 +
.../GridCachePartitionedProjectionSelfTest.java | 155 +
...hePartitionedQueryMultiThreadedSelfTest.java | 304 +
.../GridCachePartitionedStorePutSelfTest.java | 148 +
...GridCachePartitionedTxConcurrentGetTest.java | 46 +
...GridCachePartitionedTxMultiNodeSelfTest.java | 81 +
...CachePartitionedTxMultiThreadedSelfTest.java | 105 +
.../near/GridCachePartitionedTxReadTest.java | 33 +
.../GridCachePartitionedTxSalvageSelfTest.java | 283 +
...achePartitionedTxSingleThreadedSelfTest.java | 106 +
.../GridCachePartitionedTxTimeoutSelfTest.java | 67 +
.../near/GridCachePutArrayValueSelfTest.java | 116 +
...idCacheRendezvousAffinityClientSelfTest.java | 105 +
...ffinityFunctionExcludeNeighborsSelfTest.java | 32 +
.../near/GridPartitionedBackupLoadSelfTest.java | 165 +
.../near/IgniteTxReentryNearSelfTest.java | 79 +
...stractReplicatedByteArrayValuesSelfTest.java | 84 +
...ridCacheAtomicReplicatedMetricsSelfTest.java | 59 +
.../GridCacheDaemonNodeReplicatedSelfTest.java | 31 +
.../GridCacheExReplicatedFullApiSelfTest.java | 33 +
...cheGroupLockMultiNodeReplicatedSelfTest.java | 45 +
.../GridCacheGroupLockReplicatedSelfTest.java | 39 +
...ridCacheReplicatedAtomicFullApiSelfTest.java | 42 +
...catedAtomicGetAndTransformStoreSelfTest.java | 33 +
...eplicatedAtomicMultiNodeFullApiSelfTest.java | 59 +
...imaryWriteOrderMultiNodeFullApiSelfTest.java | 33 +
.../GridCacheReplicatedBasicApiTest.java | 42 +
.../GridCacheReplicatedBasicOpSelfTest.java | 42 +
.../GridCacheReplicatedBasicStoreSelfTest.java | 33 +
.../GridCacheReplicatedClientOnlySelfTest.java | 42 +
.../GridCacheReplicatedEntrySetSelfTest.java | 33 +
.../GridCacheReplicatedEventSelfTest.java | 38 +
...ridCacheReplicatedEvictionEventSelfTest.java | 38 +
.../GridCacheReplicatedEvictionSelfTest.java | 131 +
.../GridCacheReplicatedFailoverSelfTest.java | 33 +
.../GridCacheReplicatedFlagsTest.java | 28 +
...eReplicatedFullApiMultithreadedSelfTest.java | 38 +
...ReplicatedFullApiMultithreadedSelfTest1.java | 1980 +++
.../GridCacheReplicatedFullApiSelfTest.java | 57 +
...eReplicatedGetAndTransformStoreSelfTest.java | 39 +
.../GridCacheReplicatedInvalidateSelfTest.java | 244 +
.../GridCacheReplicatedIteratorsSelfTest.java | 43 +
.../GridCacheReplicatedJobExecutionTest.java | 45 +
.../GridCacheReplicatedLockSelfTest.java | 33 +
.../GridCacheReplicatedMarshallerTxTest.java | 47 +
.../GridCacheReplicatedMetricsSelfTest.java | 54 +
...CacheReplicatedMultiNodeFullApiSelfTest.java | 28 +
...ridCacheReplicatedMultiNodeLockSelfTest.java | 42 +
...atedMultiNodeP2PDisabledFullApiSelfTest.java | 35 +
.../GridCacheReplicatedMultiNodeSelfTest.java | 42 +
...licatedNearOnlyMultiNodeFullApiSelfTest.java | 39 +
.../GridCacheReplicatedNearOnlySelfTest.java | 42 +
.../GridCacheReplicatedNodeFailureSelfTest.java | 46 +
.../GridCacheReplicatedNodeRestartSelfTest.java | 54 +
...idCacheReplicatedOffHeapFullApiSelfTest.java | 28 +
...plicatedOffHeapMultiNodeFullApiSelfTest.java | 28 +
...catedP2PDisabledByteArrayValuesSelfTest.java | 29 +
...icatedP2PEnabledByteArrayValuesSelfTest.java | 29 +
...ridCacheReplicatedPreloadEventsSelfTest.java | 32 +
.../GridCacheReplicatedProjectionSelfTest.java | 66 +
...dezvousAffinityMultiNodeFullApiSelfTest.java | 35 +
.../GridCacheReplicatedTxConcurrentGetTest.java | 45 +
.../GridCacheReplicatedTxExceptionSelfTest.java | 39 +
...GridCacheReplicatedTxMultiNodeBasicTest.java | 81 +
...dCacheReplicatedTxMultiThreadedSelfTest.java | 111 +
...licatedTxOriginatingNodeFailureSelfTest.java | 37 +
...ssimisticOriginatingNodeFailureSelfTest.java | 47 +
.../GridCacheReplicatedTxReadTest.java | 33 +
...CacheReplicatedTxSingleThreadedSelfTest.java | 102 +
.../GridCacheReplicatedTxTimeoutSelfTest.java | 60 +
...idCacheReplicatedUnswapAdvancedSelfTest.java | 171 +
.../GridCacheSyncReplicatedPreloadSelfTest.java | 165 +
.../replicated/GridReplicatedTxPreloadTest.java | 33 +
...CacheReplicatedPreloadLifecycleSelfTest.java | 293 +
...idCacheReplicatedPreloadOffHeapSelfTest.java | 39 +
.../GridCacheReplicatedPreloadSelfTest.java | 582 +
...eplicatedPreloadStartStopEventsSelfTest.java | 95 +
...GridCacheReplicatedPreloadUndeploysTest.java | 87 +
.../GridCacheBatchEvictUnswapSelfTest.java | 194 +
...heConcurrentEvictionConsistencySelfTest.java | 267 +
.../GridCacheConcurrentEvictionsSelfTest.java | 183 +
.../GridCacheDistributedEvictionsSelfTest.java | 265 +
.../GridCacheEmptyEntriesAbstractSelfTest.java | 304 +
.../GridCacheEmptyEntriesLocalSelfTest.java | 41 +
...ridCacheEmptyEntriesPartitionedSelfTest.java | 41 +
.../eviction/GridCacheEvictionAbstractTest.java | 462 +
.../GridCacheEvictionFilterSelfTest.java | 249 +
.../GridCacheEvictionLockUnlockSelfTest.java | 178 +
.../GridCacheEvictionTouchSelfTest.java | 347 +
.../cache/eviction/GridCacheMockEntry.java | 366 +
...cheSynchronousEvictionsFailoverSelfTest.java | 160 +
.../GridCacheFifoEvictionPolicySelfTest.java | 380 +
.../lru/GridCacheLruEvictionPolicySelfTest.java | 426 +
.../GridCacheLruNearEvictionPolicySelfTest.java | 136 +
...heNearOnlyLruNearEvictionPolicySelfTest.java | 167 +
.../GridCacheRandomEvictionPolicySelfTest.java | 265 +
.../IgniteCacheAtomicExpiryPolicyTest.java | 55 +
.../IgniteCacheAtomicLocalExpiryPolicyTest.java | 49 +
...AtomicPrimaryWriteOrderExpiryPolicyTest.java | 32 +
...maryWriteOrderWithStoreExpiryPolicyTest.java | 31 +
...teCacheAtomicReplicatedExpiryPolicyTest.java | 32 +
...iteCacheAtomicWithStoreExpiryPolicyTest.java | 30 +
.../IgniteCacheExpiryPolicyAbstractTest.java | 958 ++
.../IgniteCacheExpiryPolicyTestSuite.java | 47 +
.../expiry/IgniteCacheTxExpiryPolicyTest.java | 49 +
.../IgniteCacheTxLocalExpiryPolicyTest.java | 49 +
...IgniteCacheTxReplicatedExpiryPolicyTest.java | 32 +
.../IgniteCacheTxWithStoreExpiryPolicyTest.java | 30 +
.../IgniteCacheAtomicLoadAllTest.java | 55 +
.../IgniteCacheAtomicLoaderWriterTest.java | 55 +
.../IgniteCacheAtomicLocalLoadAllTest.java | 49 +
...CacheAtomicLocalNoLoadPreviousValueTest.java | 49 +
...IgniteCacheAtomicLocalNoReadThroughTest.java | 49 +
...gniteCacheAtomicLocalNoWriteThroughTest.java | 49 +
...tomicNearEnabledNoLoadPreviousValueTest.java | 32 +
...CacheAtomicNearEnabledNoReadThroughTest.java | 32 +
...acheAtomicNearEnabledNoWriteThroughTest.java | 32 +
...gniteCacheAtomicNoLoadPreviousValueTest.java | 55 +
.../IgniteCacheAtomicNoReadThroughTest.java | 55 +
.../IgniteCacheAtomicNoWriteThroughTest.java | 55 +
.../IgniteCacheAtomicStoreSessionTest.java | 55 +
.../IgniteCacheLoadAllAbstractTest.java | 236 +
.../IgniteCacheLoaderWriterAbstractTest.java | 377 +
...iteCacheNoLoadPreviousValueAbstractTest.java | 211 +
.../IgniteCacheNoReadThroughAbstractTest.java | 321 +
.../IgniteCacheNoWriteThroughAbstractTest.java | 345 +
.../IgniteCacheStoreSessionAbstractTest.java | 303 +
.../integration/IgniteCacheTxLoadAllTest.java | 49 +
.../IgniteCacheTxLoaderWriterTest.java | 49 +
.../IgniteCacheTxLocalLoadAllTest.java | 49 +
...niteCacheTxLocalNoLoadPreviousValueTest.java | 49 +
.../IgniteCacheTxLocalNoReadThroughTest.java | 49 +
.../IgniteCacheTxLocalNoWriteThroughTest.java | 49 +
...cheTxNearEnabledNoLoadPreviousValueTest.java | 32 +
...niteCacheTxNearEnabledNoReadThroughTest.java | 32 +
...iteCacheTxNearEnabledNoWriteThroughTest.java | 32 +
.../IgniteCacheTxNoLoadPreviousValueTest.java | 49 +
.../IgniteCacheTxNoReadThroughTest.java | 49 +
.../IgniteCacheTxNoWriteThroughTest.java | 49 +
.../IgniteCacheTxStoreSessionTest.java | 287 +
...dCacheAtomicLocalMetricsNoStoreSelfTest.java | 29 +
.../GridCacheAtomicLocalMetricsSelfTest.java | 59 +
...dCacheAtomicLocalTckMetricsSelfTestImpl.java | 161 +
.../local/GridCacheDaemonNodeLocalSelfTest.java | 64 +
.../local/GridCacheExLocalFullApiSelfTest.java | 30 +
.../GridCacheLocalAtomicBasicStoreSelfTest.java | 32 +
.../GridCacheLocalAtomicFullApiSelfTest.java | 42 +
...LocalAtomicGetAndTransformStoreSelfTest.java | 33 +
...dCacheLocalAtomicOffHeapFullApiSelfTest.java | 42 +
.../GridCacheLocalAtomicProjectionSelfTest.java | 32 +
.../local/GridCacheLocalBasicApiSelfTest.java | 42 +
...cheLocalBasicStoreMultithreadedSelfTest.java | 30 +
.../local/GridCacheLocalBasicStoreSelfTest.java | 33 +
.../GridCacheLocalByteArrayValuesSelfTest.java | 258 +
.../local/GridCacheLocalEventSelfTest.java | 38 +
.../GridCacheLocalEvictionEventSelfTest.java | 38 +
...dCacheLocalFullApiMultithreadedSelfTest.java | 38 +
.../local/GridCacheLocalFullApiSelfTest.java | 141 +
...dCacheLocalGetAndTransformStoreSelfTest.java | 33 +
.../local/GridCacheLocalIteratorsSelfTest.java | 172 +
.../local/GridCacheLocalLoadAllSelfTest.java | 111 +
.../cache/local/GridCacheLocalLockSelfTest.java | 322 +
.../local/GridCacheLocalMetricsSelfTest.java | 55 +
.../GridCacheLocalMultithreadedSelfTest.java | 348 +
.../GridCacheLocalOffHeapFullApiSelfTest.java | 28 +
.../local/GridCacheLocalProjectionSelfTest.java | 38 +
.../GridCacheLocalTxExceptionSelfTest.java | 38 +
.../GridCacheLocalTxMultiThreadedSelfTest.java | 91 +
.../cache/local/GridCacheLocalTxReadTest.java | 33 +
.../GridCacheLocalTxSingleThreadedSelfTest.java | 86 +
.../local/GridCacheLocalTxTimeoutSelfTest.java | 164 +
.../GridCacheSwapScanQueryAbstractSelfTest.java | 445 +
.../query/GridCacheSwapScanQuerySelfTest.java | 28 +
.../cache/query/GridCircularQueueTest.java | 119 +
...ridCacheContinuousQueryAbstractSelfTest.java | 1538 ++
...ontinuousQueryAtomicNearEnabledSelfTest.java | 32 +
...ontinuousQueryAtomicP2PDisabledSelfTest.java | 29 +
.../GridCacheContinuousQueryAtomicSelfTest.java | 43 +
...CacheContinuousQueryLocalAtomicSelfTest.java | 32 +
.../GridCacheContinuousQueryLocalSelfTest.java | 37 +
...eContinuousQueryPartitionedOnlySelfTest.java | 48 +
...uousQueryPartitionedP2PDisabledSelfTest.java | 29 +
...CacheContinuousQueryPartitionedSelfTest.java | 37 +
...ContinuousQueryReplicatedAtomicSelfTest.java | 37 +
...nuousQueryReplicatedP2PDisabledSelfTest.java | 28 +
...dCacheContinuousQueryReplicatedSelfTest.java | 82 +
...dCacheAbstractReduceFieldsQuerySelfTest.java | 426 +
...ridCacheReduceFieldsQueryAtomicSelfTest.java | 38 +
...GridCacheReduceFieldsQueryLocalSelfTest.java | 37 +
...cheReduceFieldsQueryPartitionedSelfTest.java | 58 +
...acheReduceFieldsQueryReplicatedSelfTest.java | 37 +
.../clock/GridTimeSyncProcessorSelfTest.java | 223 +
.../closure/GridClosureProcessorRemoteTest.java | 119 +
.../closure/GridClosureProcessorSelfTest.java | 542 +
.../internal/processors/closure/package.html | 23 +
.../continuous/GridEventConsumeSelfTest.java | 1079 ++
.../continuous/GridMessageListenSelfTest.java | 489 +
.../dataload/GridDataLoaderImplSelfTest.java | 215 +
.../dataload/GridDataLoaderPerformanceTest.java | 215 +
.../GridDataLoaderProcessorSelfTest.java | 884 ++
...heGgfsPerBlockLruEvictionPolicySelfTest.java | 489 +
.../processors/fs/GridGgfsAbstractSelfTest.java | 2453 ++++
.../fs/GridGgfsAttributesSelfTest.java | 75 +
.../processors/fs/GridGgfsCacheSelfTest.java | 133 +
.../fs/GridGgfsCommonAbstractTest.java | 67 +
.../fs/GridGgfsDataManagerSelfTest.java | 600 +
.../fs/GridGgfsDualAbstractSelfTest.java | 1601 ++
.../fs/GridGgfsDualAsyncSelfTest.java | 32 +
.../processors/fs/GridGgfsDualSyncSelfTest.java | 32 +
.../processors/fs/GridGgfsFileInfoSelfTest.java | 88 +
.../processors/fs/GridGgfsFileMapSelfTest.java | 337 +
...GgfsGroupDataBlockKeyMapperHashSelfTest.java | 136 +
.../fs/GridGgfsMetaManagerSelfTest.java | 470 +
.../processors/fs/GridGgfsMetricsSelfTest.java | 536 +
.../fs/GridGgfsModeResolverSelfTest.java | 77 +
.../processors/fs/GridGgfsModesSelfTest.java | 604 +
.../GridGgfsPrimaryOffheapTieredSelfTest.java | 33 +
.../GridGgfsPrimaryOffheapValuesSelfTest.java | 33 +
.../processors/fs/GridGgfsPrimarySelfTest.java | 32 +
.../fs/GridGgfsProcessorSelfTest.java | 977 ++
.../fs/GridGgfsProcessorValidationSelfTest.java | 535 +
...IpcEndpointRegistrationAbstractSelfTest.java | 185 +
...dpointRegistrationOnLinuxAndMacSelfTest.java | 50 +
...pcEndpointRegistrationOnWindowsSelfTest.java | 53 +
.../processors/fs/GridGgfsSizeSelfTest.java | 875 ++
.../processors/fs/GridGgfsStreamsSelfTest.java | 472 +
.../processors/fs/GridGgfsTaskSelfTest.java | 317 +
.../processors/fs/GridGgfsTestInputStream.java | 66 +
.../ignite/internal/processors/fs/package.html | 23 +
.../GridGgfsAbstractRecordResolverSelfTest.java | 187 +
...GgfsByteDelimiterRecordResolverSelfTest.java | 335 +
...idGgfsFixedLengthRecordResolverSelfTest.java | 147 +
...sNewLineDelimiterRecordResolverSelfTest.java | 129 +
...fsStringDelimiterRecordResolverSelfTest.java | 137 +
.../GridJobMetricsProcessorLoadTest.java | 89 +
.../port/GridPortProcessorSelfTest.java | 129 +
.../cache/GridCacheCommandHandlerSelfTest.java | 262 +
.../processors/service/DummyService.java | 148 +
.../GridServiceProcessorAbstractSelfTest.java | 676 +
...ServiceProcessorMultiNodeConfigSelfTest.java | 200 +
.../GridServiceProcessorMultiNodeSelfTest.java | 170 +
.../GridServiceProcessorProxySelfTest.java | 376 +
.../GridServiceProcessorSingleNodeSelfTest.java | 57 +
.../GridServiceReassignmentSelfTest.java | 211 +
.../streamer/GridStreamerEvictionSelfTest.java | 164 +
.../streamer/GridStreamerFailoverSelfTest.java | 267 +
.../GridStreamerLifecycleAwareSelfTest.java | 212 +
.../streamer/GridStreamerSelfTest.java | 795 +
.../processors/streamer/GridTestStage.java | 54 +
.../streamer/GridTestStreamerEventRouter.java | 49 +
.../ignite/internal/processors/streamer/SC.java | 31 +
.../timeout/GridTimeoutProcessorSelfTest.java | 610 +
.../product/GridProductVersionSelfTest.java | 111 +
.../apache/ignite/internal/updatestatus.html | 28 +
...artupWithSpecifiedWorkDirectorySelfTest.java | 163 +
...tartupWithUndefinedGridGainHomeSelfTest.java | 106 +
.../internal/util/GridTestClockTimer.java | 39 +
.../internal/util/IgniteUtilsSelfTest.java | 728 +
.../util/future/GridCompoundFutureSelfTest.java | 204 +
.../util/future/GridEmbeddedFutureSelfTest.java | 138 +
.../util/future/GridFinishedFutureSelfTest.java | 103 +
.../util/future/GridFutureAdapterSelfTest.java | 442 +
.../future/GridFutureListenPerformanceTest.java | 108 +
.../util/future/GridFutureQueueTest.java | 183 +
.../nio/GridNioEmbeddedFutureSelfTest.java | 59 +
.../util/future/nio/GridNioFutureSelfTest.java | 210 +
...GridUnsafeDataOutputArraySizingSelfTest.java | 161 +
.../IpcServerEndpointDeserializerSelfTest.java | 160 +
.../ipc/shmem/GgfsSharedMemoryTestClient.java | 76 +
.../ipc/shmem/GgfsSharedMemoryTestServer.java | 71 +
.../IpcSharedMemoryCrashDetectionSelfTest.java | 500 +
.../ipc/shmem/IpcSharedMemoryFakeClient.java | 36 +
.../IpcSharedMemoryNativeLoaderSelfTest.java | 78 +
.../ipc/shmem/IpcSharedMemoryNodeStartup.java | 87 +
.../ipc/shmem/IpcSharedMemorySpaceSelfTest.java | 267 +
.../ipc/shmem/IpcSharedMemoryUtilsSelfTest.java | 84 +
.../LoadWithCorruptedLibFileTestRunner.java | 65 +
.../IpcSharedMemoryBenchmarkParty.java | 35 +
.../IpcSharedMemoryBenchmarkReader.java | 133 +
.../IpcSharedMemoryBenchmarkWriter.java | 125 +
.../internal/util/nio/GridNioSelfTest.java | 1441 ++
.../util/nio/GridNioSessionMetaKeySelfTest.java | 58 +
.../internal/util/nio/GridNioSslSelfTest.java | 88 +
.../internal/util/nio/GridRoundTripTest.java | 226 +
.../nio/impl/GridNioFilterChainSelfTest.java | 390 +
.../ignite/internal/util/nio/package.html | 23 +
.../util/offheap/GridByteArrayWrapper.java | 63 +
.../offheap/GridOffHeapMapAbstractSelfTest.java | 813 +
.../GridOffHeapMapPerformanceAbstractTest.java | 289 +
...idOffHeapPartitionedMapAbstractSelfTest.java | 1134 ++
...apPartitionedMapPerformanceAbstractTest.java | 429 +
.../unsafe/GridOffheapSnapTreeSelfTest.java | 321 +
.../unsafe/GridUnsafeMapPerformanceTest.java | 30 +
.../offheap/unsafe/GridUnsafeMapSelfTest.java | 30 +
.../unsafe/GridUnsafeMemorySelfTest.java | 542 +
...GridUnsafePartitionedMapPerformanceTest.java | 32 +
.../GridUnsafePartitionedMapSelfTest.java | 30 +
.../unsafe/GridUnsafeStripedLruSefTest.java | 229 +
.../tostring/GridToStringBuilderSelfTest.java | 205 +
.../ignite/internal/util/tostring/package.html | 23 +
.../ignite/jvmtest/BlockingQueueTest.java | 144 +
.../ignite/jvmtest/ConcurrentMapTest.java | 193 +
.../org/apache/ignite/jvmtest/FileIOTest.java | 138 +
.../apache/ignite/jvmtest/FileLocksTest.java | 121 +
.../ignite/jvmtest/LinkedHashMapTest.java | 87 +
.../ignite/jvmtest/MultipleFileIOTest.java | 134 +
.../ignite/jvmtest/NetworkFailureTest.java | 370 +
.../QueueSizeCounterMultiThreadedTest.java | 102 +
.../jvmtest/ReadWriteLockMultiThreadedTest.java | 207 +
.../org/apache/ignite/jvmtest/RegExpTest.java | 56 +
.../jvmtest/ServerSocketMultiThreadedTest.java | 102 +
.../ignite/lang/GridBasicPerformanceTest.java | 1077 ++
.../ignite/lang/GridByteArrayListSelfTest.java | 213 +
.../ignite/lang/GridFuncPerformanceTest.java | 100 +
.../apache/ignite/lang/GridFuncSelfTest.java | 3254 ++++
.../lang/GridFutureListenPerformanceTest.java | 112 +
.../GridImmutableCollectionsPerfomanceTest.java | 120 +
.../lang/GridMetadataAwareAdapterSelfTest.java | 118 +
.../ignite/lang/GridSetWrapperSelfTest.java | 224 +
.../lang/GridSystemCurrentTimeMillisTest.java | 107 +
.../ignite/lang/GridThreadPriorityTest.java | 72 +
.../apache/ignite/lang/GridTupleSelfTest.java | 164 +
.../org/apache/ignite/lang/GridXSelfTest.java | 262 +
.../apache/ignite/lang/IgniteUuidSelfTest.java | 325 +
.../java/org/apache/ignite/lang/package.html | 23 +
...dBoundedConcurrentLinkedHashMapSelfTest.java | 55 +
...GridBoundedConcurrentOrderedMapSelfTest.java | 81 +
.../GridCircularBufferPerformanceTest.java | 226 +
.../lang/utils/GridCircularBufferSelfTest.java | 176 +
.../utils/GridConcurrentHashMapSelfTest.java | 109 +
.../GridConcurrentLinkedHashMapSelfTest.java | 246 +
.../GridConcurrentWeakHashSetSelfTest.java | 394 +
.../lang/utils/GridConsistentHashSelfTest.java | 332 +
.../lang/utils/GridLeanMapPerformanceTest.java | 84 +
.../ignite/lang/utils/GridLeanMapSelfTest.java | 658 +
.../ignite/lang/utils/GridListSetSelfTest.java | 286 +
.../ignite/lang/utils/GridPCollectionsTest.java | 54 +
.../lang/utils/GridStripedLockSelfTest.java | 200 +
.../ignite/lang/utils/GridTrieMapSelfTest.java | 242 +
.../org/apache/ignite/lang/utils/package.html | 24 +
.../ignite/loadtest/GridLoadTestStatistics.java | 210 +
.../loadtest/GridSingleExecutionTest.java | 324 +
.../org/apache/ignite/loadtest/package.html | 23 +
...idFileSwapSpaceSpiMultithreadedLoadTest.java | 247 +
.../loadtests/GridCacheLoadPopulationTask.java | 152 +
.../loadtests/GridCacheMultiNodeLoadTest.java | 106 +
.../cache/GridCacheAbstractLoadTest.java | 376 +
...ridCacheAffinityTransactionsOffHeapTest.java | 258 +
.../loadtests/cache/GridCacheBenchmark.java | 202 +
.../cache/GridCacheDataStructuresLoadTest.java | 364 +
.../cache/GridCacheGroupLockComparisonTest.java | 203 +
.../loadtests/cache/GridCacheLoadTest.java | 161 +
.../cache/GridCachePutRemoveLoadTest.java | 373 +
.../cache/GridCacheSingleNodeLoadTest.java | 184 +
.../loadtests/cache/GridCacheSwapLoadTest.java | 311 +
.../GridCacheWriteBehindStoreLoadTest.java | 210 +
.../capacity/GridCapacityLoadTest.java | 95 +
.../capacity/spring-capacity-cache.xml | 124 +
.../colocation/GridTestCacheStore.java | 134 +
.../loadtests/colocation/GridTestConstants.java | 35 +
.../loadtests/colocation/GridTestKey.java | 92 +
.../colocation/GridTestLifecycleBean.java | 41 +
.../loadtests/colocation/GridTestMain.java | 207 +
.../loadtests/colocation/spring-colocation.xml | 182 +
.../communication/GridIoManagerBenchmark.java | 337 +
.../communication/GridIoManagerBenchmark0.java | 469 +
.../GridTcpCommunicationBenchmark.java | 586 +
.../communication/GridTestMessage.java | 135 +
.../GridContinuousOperationsLoadTest.java | 211 +
.../GridCachePartitionedAtomicLongLoadTest.java | 129 +
.../direct/multisplit/GridLoadTestJob.java | 58 +
.../multisplit/GridLoadTestJobTarget.java | 33 +
.../direct/multisplit/GridLoadTestTask.java | 83 +
.../multisplit/GridMultiSplitsLoadTest.java | 160 +
.../GridMultiSplitsRedeployLoadTest.java | 162 +
.../loadtests/direct/multisplit/package.html | 24 +
.../GridSingleSplitNewNodesTestJobTarget.java | 50 +
.../GridSingleSplitNewNodesTestTask.java | 95 +
...ridSingleSplitsNewNodesAbstractLoadTest.java | 188 +
...idSingleSplitsNewNodesMulticastLoadTest.java | 45 +
.../loadtests/direct/newnodes/package.html | 24 +
.../GridSingleSplitsRedeployLoadTest.java | 174 +
.../loadtests/direct/redeploy/package.html | 24 +
.../direct/session/GridSessionLoadTest.java | 112 +
.../direct/session/GridSessionLoadTestJob.java | 76 +
.../direct/session/GridSessionLoadTestTask.java | 136 +
.../loadtests/direct/session/package.html | 24 +
.../direct/stealing/GridStealingLoadTest.java | 154 +
.../stealing/GridStealingLoadTestJob.java | 61 +
.../stealing/GridStealingLoadTestTask.java | 96 +
.../loadtests/direct/stealing/package.html | 24 +
.../loadtests/discovery/GridGcTimeoutTest.java | 63 +
.../ignite/loadtests/dsi/GridDsiClient.java | 419 +
.../loadtests/dsi/GridDsiLifecycleBean.java | 59 +
.../ignite/loadtests/dsi/GridDsiMessage.java | 74 +
.../ignite/loadtests/dsi/GridDsiPerfJob.java | 341 +
.../ignite/loadtests/dsi/GridDsiRequest.java | 93 +
.../loadtests/dsi/GridDsiRequestTask.java | 41 +
.../ignite/loadtests/dsi/GridDsiResponse.java | 87 +
.../loadtests/dsi/GridDsiResponseTask.java | 41 +
.../ignite/loadtests/dsi/GridDsiSession.java | 84 +
.../cacheget/GridBenchmarkCacheGetLoadTest.java | 119 +
.../apache/ignite/loadtests/dsi/package.html | 23 +
...dBoundedConcurrentLinkedHashSetLoadTest.java | 118 +
.../loadtests/hashmap/GridCacheTestContext.java | 73 +
.../loadtests/hashmap/GridHashMapLoadTest.java | 101 +
.../job/GridJobExecutionLoadTestClient.java | 219 +
...GridJobExecutionLoadTestClientSemaphore.java | 240 +
.../job/GridJobExecutionLoadTestJob.java | 48 +
.../job/GridJobExecutionLoadTestServer.java | 40 +
.../job/GridJobExecutionLoadTestTask.java | 50 +
.../job/GridJobExecutionSingleNodeLoadTest.java | 237 +
...JobExecutionSingleNodeSemaphoreLoadTest.java | 227 +
.../ignite/loadtests/job/GridJobLoadTest.java | 201 +
.../loadtests/job/GridJobLoadTestJob.java | 162 +
.../loadtests/job/GridJobLoadTestParams.java | 84 +
.../loadtests/job/GridJobLoadTestSubmitter.java | 142 +
.../loadtests/job/GridJobLoadTestTask.java | 73 +
.../apache/ignite/loadtests/job/package.html | 23 +
.../GridConcurrentLinkedHashMapBenchmark.java | 238 +
.../mapper/GridContinuousMapperLoadTest1.java | 50 +
.../mapper/GridContinuousMapperLoadTest2.java | 91 +
.../mapper/GridContinuousMapperTask1.java | 149 +
.../mapper/GridContinuousMapperTask2.java | 87 +
.../loadtests/mapper/GridNodeStartup.java | 55 +
.../ignite/loadtests/mapper/TestObject.java | 58 +
.../mergesort/GridMergeSortLoadTask.java | 188 +
.../mergesort/GridMergeSortLoadTest.java | 143 +
.../loadtests/nio/GridNioBenchmarkClient.java | 167 +
.../loadtests/nio/GridNioBenchmarkTest.java | 119 +
.../GridOffHeapMapPerformanceAbstractTest.java | 290 +
...apPartitionedMapPerformanceAbstractTest.java | 430 +
.../unsafe/GridUnsafeMapPerformanceTest.java | 30 +
...GridUnsafePartitionedMapPerformanceTest.java | 32 +
.../ignite/loadtests/streamer/EventClosure.java | 60 +
.../streamer/GridStreamerBenchmark.java | 140 +
.../streamer/GridStreamerIndexLoadTest.java | 179 +
.../loadtests/streamer/GridStreamerLoad.java | 62 +
.../ignite/loadtests/streamer/IndexUpdater.java | 46 +
.../ignite/loadtests/streamer/QueryClosure.java | 106 +
.../loadtests/streamer/average/TestAverage.java | 70 +
.../loadtests/streamer/average/TestStage.java | 65 +
.../swap/GridSwapEvictAllBenchmark.java | 299 +
.../loadtests/util/GridCumulativeAverage.java | 63 +
.../ignite/loadtests/util/GridLoadTestArgs.java | 283 +
.../ignite/logger/java/GridJavaLoggerTest.java | 65 +
.../org/apache/ignite/logger/java/package.html | 23 +
.../marshaller/GridMarshallerAbstractTest.java | 1043 ++
.../GridMarshallerExternalizableBean.java | 63 +
.../GridMarshallerPerformanceTest.java | 514 +
.../marshaller/GridMarshallerResourceBean.java | 103 +
.../GridMarshallerTestAbstractBean.java | 40 +
.../marshaller/GridMarshallerTestBean.java | 148 +
.../GridMarshallerTestInheritedBean.java | 25 +
.../jdk/GridJdkMarshallerSelfTest.java | 33 +
.../apache/ignite/marshaller/jdk/package.html | 23 +
.../GridOptimizedMarshallerEnumSelfTest.java | 22 +-
.../GridOptimizedMarshallerSelfTest.java | 24 +-
.../optimized/GridOptimizedMarshallerTest.java | 27 +-
.../GridOptimizedObjectStreamSelfTest.java | 32 +-
.../GridTestTcpDiscoveryIpFinderAdapter.java | 22 +-
.../ignite/marshaller/optimized/package.html | 24 +-
.../org/apache/ignite/marshaller/package.html | 23 +
...GridMessagingNoPeerClassLoadingSelfTest.java | 90 +
.../ignite/messaging/GridMessagingSelfTest.java | 1088 ++
.../p2p/GridAbstractMultinodeRedeployTest.java | 125 +
...MultinodeRedeployContinuousModeSelfTest.java | 37 +
...idMultinodeRedeployIsolatedModeSelfTest.java | 37 +
...ridMultinodeRedeployPrivateModeSelfTest.java | 37 +
...GridMultinodeRedeploySharedModeSelfTest.java | 37 +
.../ignite/p2p/GridP2PClassLoadingSelfTest.java | 157 +
.../GridP2PContinuousDeploymentSelfTest.java | 118 +
.../GridP2PDifferentClassLoaderSelfTest.java | 220 +
.../p2p/GridP2PDoubleDeploymentSelfTest.java | 140 +
.../p2p/GridP2PHotRedeploymentSelfTest.java | 232 +
.../p2p/GridP2PJobClassLoaderSelfTest.java | 141 +
.../p2p/GridP2PLocalDeploymentSelfTest.java | 254 +
.../GridP2PMissedResourceCacheSizeSelfTest.java | 292 +
.../ignite/p2p/GridP2PNodeLeftSelfTest.java | 120 +
.../p2p/GridP2PRecursionTaskSelfTest.java | 193 +
.../p2p/GridP2PRemoteClassLoadersSelfTest.java | 282 +
.../p2p/GridP2PSameClassLoaderSelfTest.java | 163 +
.../org/apache/ignite/p2p/GridP2PTestJob.java | 128 +
.../org/apache/ignite/p2p/GridP2PTestTask.java | 82 +
.../p2p/GridP2PTestTaskExecutionTest.java | 50 +
.../ignite/p2p/GridP2PTimeoutSelfTest.java | 205 +
.../ignite/p2p/GridP2PUndeploySelfTest.java | 237 +
.../ignite/p2p/GridSwapSpaceCustomKey.java | 58 +
.../ignite/p2p/GridSwapSpaceCustomValue.java | 64 +
.../java/org/apache/ignite/p2p/p2p.properties | 1 +
.../java/org/apache/ignite/p2p/package.html | 23 +
.../test/java/org/apache/ignite/package.html | 23 +
...SessionCancelSiblingsFromFutureSelfTest.java | 280 +
...ridSessionCancelSiblingsFromJobSelfTest.java | 291 +
...idSessionCancelSiblingsFromTaskSelfTest.java | 298 +
.../GridSessionCheckpointAbstractSelfTest.java | 231 +
.../session/GridSessionCheckpointSelfTest.java | 96 +
.../GridSessionCollisionSpiSelfTest.java | 143 +
...idSessionFutureWaitJobAttributeSelfTest.java | 251 +
...dSessionFutureWaitTaskAttributeSelfTest.java | 250 +
.../session/GridSessionJobFailoverSelfTest.java | 162 +
...GridSessionJobWaitTaskAttributeSelfTest.java | 220 +
.../ignite/session/GridSessionLoadSelfTest.java | 267 +
.../GridSessionSetFutureAttributeSelfTest.java | 254 +
...nSetFutureAttributeWaitListenerSelfTest.java | 242 +
.../GridSessionSetJobAttribute2SelfTest.java | 134 +
...GridSessionSetJobAttributeOrderSelfTest.java | 153 +
.../GridSessionSetJobAttributeSelfTest.java | 209 +
...sionSetJobAttributeWaitListenerSelfTest.java | 244 +
.../GridSessionSetTaskAttributeSelfTest.java | 197 +
...GridSessionTaskWaitJobAttributeSelfTest.java | 190 +
.../GridSessionWaitAttributeSelfTest.java | 480 +
.../ignite/session/GridThreadSerialNumber.java | 40 +
.../java/org/apache/ignite/session/package.html | 24 +
.../spi/GridSpiLocalHostInjectionTest.java | 156 +
.../spi/GridSpiStartStopAbstractTest.java | 80 +
.../org/apache/ignite/spi/GridTcpForwarder.java | 169 +
.../spi/GridTcpSpiForwardingSelfTest.java | 163 +
.../GridCheckpointSpiAbstractTest.java | 26 +-
.../spi/checkpoint/GridCheckpointTestState.java | 22 +-
.../GridCacheCheckpointSpiConfigSelfTest.java | 19 +-
...idCacheCheckpointSpiSecondCacheSelfTest.java | 34 +-
.../cache/GridCacheCheckpointSpiSelfTest.java | 19 +-
...GridCacheCheckpointSpiStartStopSelfTest.java | 21 +-
.../ignite/spi/checkpoint/cache/package.html | 25 +-
.../GridJdbcCheckpointSpiConfigSelfTest.java | 24 +-
...idJdbcCheckpointSpiCustomConfigSelfTest.java | 24 +-
...dJdbcCheckpointSpiDefaultConfigSelfTest.java | 24 +-
.../GridJdbcCheckpointSpiStartStopSelfTest.java | 26 +-
.../ignite/spi/checkpoint/jdbc/package.html | 25 +-
.../apache/ignite/spi/checkpoint/package.html | 25 +-
...GridSharedFsCheckpointSpiConfigSelfTest.java | 24 +-
...redFsCheckpointSpiMultiThreadedSelfTest.java | 36 +-
...heckpointSpiMultipleDirectoriesSelfTest.java | 27 +-
.../GridSharedFsCheckpointSpiSelfTest.java | 26 +-
...dSharedFsCheckpointSpiStartStopSelfTest.java | 26 +-
.../ignite/spi/checkpoint/sharedfs/package.html | 24 +-
.../spi/collision/GridCollisionTestContext.java | 22 +-
.../collision/GridTestCollisionJobContext.java | 24 +-
.../collision/GridTestCollisionTaskSession.java | 25 +-
...GridFifoQueueCollisionSpiConfigSelfTest.java | 24 +-
.../GridFifoQueueCollisionSpiSelfTest.java | 26 +-
...dFifoQueueCollisionSpiStartStopSelfTest.java | 26 +-
.../ignite/spi/collision/fifoqueue/package.html | 24 +-
...bStealingCollisionSpiAttributesSelfTest.java | 36 +-
...idJobStealingCollisionSpiConfigSelfTest.java | 24 +-
...alingCollisionSpiCustomTopologySelfTest.java | 36 +-
.../GridJobStealingCollisionSpiSelfTest.java | 38 +-
...obStealingCollisionSpiStartStopSelfTest.java | 32 +-
.../spi/collision/jobstealing/package.html | 24 +-
.../apache/ignite/spi/collision/package.html | 24 +-
...PriorityQueueCollisionSpiConfigSelfTest.java | 24 +-
.../GridPriorityQueueCollisionSpiSelfTest.java | 26 +-
...orityQueueCollisionSpiStartStopSelfTest.java | 26 +-
.../spi/collision/priorityqueue/package.html | 24 +-
.../GridAbstractCommunicationSelfTest.java | 36 +-
.../spi/communication/GridTestMessage.java | 26 +-
.../ignite/spi/communication/package.html | 25 +-
.../tcp/GridCacheDhtLockBackupSelfTest.java | 79 +-
.../tcp/GridOrderedMessageCancelSelfTest.java | 211 -
.../GridTcpCommunicationSpiAbstractTest.java | 30 +-
...mmunicationSpiConcurrentConnectSelfTest.java | 39 +-
.../GridTcpCommunicationSpiConfigSelfTest.java | 24 +-
.../tcp/GridTcpCommunicationSpiLanTest.java | 37 +-
...cpCommunicationSpiMultithreadedSelfTest.java | 52 +-
...pCommunicationSpiMultithreadedShmemTest.java | 22 +-
...ommunicationSpiMultithreadedTcpSelfTest.java | 22 +-
...dTcpCommunicationSpiRecoveryAckSelfTest.java | 36 +-
...GridTcpCommunicationSpiRecoverySelfTest.java | 43 +-
.../GridTcpCommunicationSpiShmemSelfTest.java | 24 +-
...ridTcpCommunicationSpiStartStopSelfTest.java | 28 +-
...cpCommunicationSpiTcpNoDelayOffSelfTest.java | 22 +-
.../tcp/GridTcpCommunicationSpiTcpSelfTest.java | 24 +-
.../ignite/spi/communication/tcp/package.html | 24 +-
.../local/GridLocalDeploymentSpiSelfTest.java | 24 +-
...GridLocalDeploymentSpiStartStopSelfTest.java | 26 +-
.../ignite/spi/deployment/local/package.html | 24 +-
...ClusterMetricsSnapshotSerializeSelfTest.java | 170 +
...ridAbstractDiscoveryRandomStartStopTest.java | 26 +-
.../GridAbstractDiscoverySelfTest.java | 34 +-
.../discovery/GridAbstractDiscoveryTest.java | 26 +-
.../GridDiscoveryMetricsHelperSelfTest.java | 141 -
.../apache/ignite/spi/discovery/package.html | 24 +-
.../tcp/GridTcpClientDiscoverySelfTest.java | 38 +-
.../GridTcpDiscoveryConcurrentStartTest.java | 24 +-
...GridTcpDiscoveryMarshallerCheckSelfTest.java | 24 +-
.../tcp/GridTcpDiscoveryMultiThreadedTest.java | 35 +-
.../discovery/tcp/GridTcpDiscoverySelfTest.java | 49 +-
.../GridTcpDiscoverySnapshotHistoryTest.java | 26 +-
.../tcp/GridTcpDiscoverySpiConfigSelfTest.java | 24 +-
.../GridTcpDiscoverySpiRandomStartStopTest.java | 24 +-
.../tcp/GridTcpDiscoverySpiSelfTest.java | 24 +-
.../GridTcpDiscoverySpiStartStopSelfTest.java | 28 +-
.../GridTcpDiscoverySpiWildcardSelfTest.java | 24 +-
...ridTcpDiscoveryIpFinderAbstractSelfTest.java | 26 +-
.../GridTcpDiscoveryJdbcIpFinderSelfTest.java | 22 +-
.../discovery/tcp/ipfinder/jdbc/package.html | 24 +-
...idTcpDiscoveryMulticastIpFinderSelfTest.java | 24 +-
.../spi/discovery/tcp/ipfinder/package.html | 25 +-
...ridTcpDiscoverySharedFsIpFinderSelfTest.java | 22 +-
.../tcp/ipfinder/sharedfs/package.html | 24 +-
.../vm/GridTcpDiscoveryVmIpFinderSelfTest.java | 22 +-
.../spi/discovery/tcp/ipfinder/vm/package.html | 24 +-
.../ignite/spi/discovery/tcp/package.html | 24 +-
...MemoryEventStorageMultiThreadedSelfTest.java | 28 +-
...GridMemoryEventStorageSpiConfigSelfTest.java | 24 +-
.../GridMemoryEventStorageSpiSelfTest.java | 26 +-
...dMemoryEventStorageSpiStartStopSelfTest.java | 26 +-
.../ignite/spi/eventstorage/memory/package.html | 24 +-
.../spi/failover/GridFailoverTestContext.java | 22 +-
.../GridAlwaysFailoverSpiConfigSelfTest.java | 24 +-
.../always/GridAlwaysFailoverSpiSelfTest.java | 28 +-
.../GridAlwaysFailoverSpiStartStopSelfTest.java | 26 +-
.../ignite/spi/failover/always/package.html | 24 +-
...ridJobStealingFailoverSpiConfigSelfTest.java | 24 +-
...idJobStealingFailoverSpiOneNodeSelfTest.java | 32 +-
.../GridJobStealingFailoverSpiSelfTest.java | 32 +-
...JobStealingFailoverSpiStartStopSelfTest.java | 30 +-
.../spi/failover/jobstealing/package.html | 24 +-
.../never/GridNeverFailoverSpiSelfTest.java | 28 +-
.../GridNeverFailoverSpiStartStopSelfTest.java | 26 +-
.../ignite/spi/failover/never/package.html | 24 +-
.../org/apache/ignite/spi/failover/package.html | 25 +-
...dAdaptiveLoadBalancingSpiConfigSelfTest.java | 24 +-
...iveLoadBalancingSpiMultipleNodeSelfTest.java | 28 +-
.../GridAdaptiveLoadBalancingSpiSelfTest.java | 28 +-
...aptiveLoadBalancingSpiStartStopSelfTest.java | 26 +-
.../spi/loadbalancing/adaptive/package.html | 24 +-
.../ignite/spi/loadbalancing/package.html | 24 +-
...alancingNotPerTaskMultithreadedSelfTest.java | 28 +-
...dRobinLoadBalancingSpiLocalNodeSelfTest.java | 26 +-
...inLoadBalancingSpiMultipleNodesSelfTest.java | 28 +-
...RobinLoadBalancingSpiNotPerTaskSelfTest.java | 27 +-
...dRobinLoadBalancingSpiStartStopSelfTest.java | 26 +-
...nLoadBalancingSpiTopologyChangeSelfTest.java | 28 +-
.../roundrobin/GridRoundRobinTestUtils.java | 23 +-
.../spi/loadbalancing/roundrobin/package.html | 24 +-
...tedRandomLoadBalancingSpiConfigSelfTest.java | 24 +-
...dWeightedRandomLoadBalancingSpiSelfTest.java | 28 +-
...RandomLoadBalancingSpiStartStopSelfTest.java | 26 +-
...dRandomLoadBalancingSpiWeightedSelfTest.java | 30 +-
.../loadbalancing/weightedrandom/package.html | 24 +-
.../java/org/apache/ignite/spi/package.html | 24 +
.../GridSwapSpaceSpiAbstractSelfTest.java | 28 +-
.../file/GridFileSwapCompactionSelfTest.java | 26 +-
.../file/GridFileSwapSpaceSpiSelfTest.java | 33 +-
.../inmemory/GridTestSwapSpaceSpi.java | 24 +-
.../noop/GridNoopSwapSpaceSpiSelfTest.java | 24 +-
.../apache/ignite/spi/swapspace/package.html | 24 +-
.../startup/GridRandomCommandLineLoader.java | 400 +
.../ignite/startup/GridVmNodesStarter.java | 271 +
.../cmdline/GridCommandLineLoaderTest.java | 28 +-
.../GridCommandLineTransformerSelfTest.java | 26 +-
.../apache/ignite/startup/cmdline/package.html | 24 +-
.../java/org/apache/ignite/startup/package.html | 23 +
.../startup/servlet/GridServletLoaderTest.java | 171 +
.../apache/ignite/startup/servlet/package.html | 23 +
.../GridCacheStoreValueBytesNode.java | 140 +
.../GridCacheStoreValueBytesTest.java | 341 +
.../index/GridStreamerIndexSelfTest.java | 43 +-
.../window/GridStreamerWindowSelfTest.java | 36 +-
.../ignite/testframework/GridFileLock.java | 110 +
.../testframework/GridJarClassLoader.java | 178 +
.../ignite/testframework/GridLoadTestUtils.java | 152 +
.../testframework/GridSpiTestContext.java | 564 +
.../ignite/testframework/GridStringLogger.java | 167 +
.../testframework/GridTestClassLoader.java | 110 +
.../GridTestExternalClassLoader.java | 194 +
.../ignite/testframework/GridTestNode.java | 254 +
.../GridTestSafeThreadFactory.java | 213 +
.../ignite/testframework/GridTestThread.java | 147 +
.../ignite/testframework/GridTestUtils.java | 1438 ++
.../config/GridTestProperties.java | 304 +
.../ignite/testframework/config/package.html | 23 +
.../http/GridEmbeddedHttpServer.java | 189 +
.../ignite/testframework/http/package.html | 23 +
.../testframework/junits/GridAbstractTest.java | 1434 ++
.../testframework/junits/GridTestIgnite.java | 230 +
.../junits/GridTestKernalContext.java | 85 +
.../testframework/junits/GridTestResources.java | 255 +
.../cache/GridAbstractCacheStoreSelfTest.java | 564 +
.../junits/cache/TestCacheSession.java | 65 +
.../cache/TestThreadLocalCacheSession.java | 65 +
.../junits/common/GridAbstractExamplesTest.java | 79 +
.../GridAbstractLifecycleAwareSelfTest.java | 127 +
.../junits/common/GridCommonAbstractTest.java | 676 +
.../junits/common/GridCommonTest.java | 36 +
.../testframework/junits/common/package.html | 23 +
.../logger/GridLog4jRollingFileAppender.java | 114 +
.../junits/logger/GridTestLog4jLogger.java | 514 +
.../ignite/testframework/junits/package.html | 24 +
.../junits/spi/GridSpiAbstractConfigTest.java | 110 +
.../junits/spi/GridSpiAbstractTest.java | 692 +
.../testframework/junits/spi/GridSpiTest.java | 62 +
.../junits/spi/GridSpiTestConfig.java | 48 +
.../testframework/junits/spi/package.html | 23 +
.../apache/ignite/testframework/package.html | 23 +
.../ignite/testsuites/IgniteBasicTestSuite.java | 81 +
.../IgniteCacheDataStructuresSelfTestSuite.java | 99 +
.../IgniteCacheEvictionSelfTestSuite.java | 62 +
.../IgniteCacheFailoverTestSuite.java | 56 +
.../IgniteCacheFullApiSelfTestSuite.java | 119 +
.../IgniteCacheGroupLockSelfTestSuite.java | 48 +
.../IgniteCacheIteratorsSelfTestSuite.java | 42 +
.../IgniteCacheMetricsSelfTestSuite.java | 51 +
.../IgniteCacheNearOnlySelfTestSuite.java | 45 +
.../testsuites/IgniteCacheRestartTestSuite.java | 49 +
.../ignite/testsuites/IgniteCacheTestSuite.java | 375 +
.../IgniteCacheTxRecoverySelfTestSuite.java | 46 +
.../IgniteCacheWriteBehindTestSuite.java | 45 +
.../testsuites/IgniteComputeGridTestSuite.java | 98 +
.../IgniteContinuousTaskSelfTestSuite.java | 42 +
.../IgniteExternalizableSelfTestSuite.java | 37 +
.../ignite/testsuites/IgniteFsTestSuite.java | 79 +
.../IgniteIpcSharedMemorySelfTestSuite.java | 41 +
.../IgniteJobMetricsSelfTestSuite.java | 38 +
.../testsuites/IgniteKernalSelfTestSuite.java | 80 +
.../testsuites/IgniteLangSelfTestSuite.java | 71 +
.../testsuites/IgniteLoggingSelfTestSuite.java | 38 +
.../IgniteMarshallerSelfTestSuite.java | 45 +
.../testsuites/IgniteP2PSelfTestSuite.java | 54 +
.../testsuites/IgniteRestHandlerTestSuite.java | 38 +
.../IgniteSpiCheckpointSelfTestSuite.java | 56 +
.../IgniteSpiCollisionSelfTestSuite.java | 55 +
.../IgniteSpiCommunicationSelfTestSuite.java | 52 +
.../IgniteSpiDeploymentSelfTestSuite.java | 40 +
.../IgniteSpiDiscoverySelfTestSuite.java | 56 +
.../IgniteSpiEventStorageSelfTestSuite.java | 41 +
.../IgniteSpiFailoverSelfTestSuite.java | 53 +
.../IgniteSpiIndexingSelfTestSuite.java | 38 +
.../IgniteSpiLoadBalancingSelfTestSuite.java | 64 +
.../IgniteSpiSwapSpaceSelfTestSuite.java | 41 +
.../ignite/testsuites/IgniteSpiTestSuite.java | 69 +
.../testsuites/IgniteStartUpTestSuite.java | 38 +
.../testsuites/IgniteStreamerSelfTestSuite.java | 46 +
.../IgniteTaskSessionSelfTestSuite.java | 56 +
.../IgniteTimeoutProcessorSelfTestSuite.java | 38 +
.../testsuites/IgniteUtilSelfTestSuite.java | 72 +
.../org/apache/ignite/testsuites/package.html | 24 +
.../GridThreadPoolExecutorServiceSelfTest.java | 187 +
.../apache/ignite/thread/GridThreadTest.java | 52 +
...dConcurrentLinkedDequeMultiThreadedTest.java | 101 +
.../util/GridConcurrentLinkedDequeSelfTest.java | 236 +
...rrentLinkedHashMapMultiThreadedSelfTest.java | 551 +
.../apache/ignite/util/GridIndexFillTest.java | 256 +
.../apache/ignite/util/GridLogThrottleTest.java | 123 +
.../ignite/util/GridLongListSelfTest.java | 153 +
.../apache/ignite/util/GridQueueSelfTest.java | 71 +
.../apache/ignite/util/GridRandomSelfTest.java | 69 +
.../ignite/util/GridSnapshotLockSelfTest.java | 113 +
.../util/GridSpinReadWriteLockSelfTest.java | 144 +
.../util/GridStringBuilderFactorySelfTest.java | 72 +
.../util/GridTopologyHeapSizeSelfTest.java | 120 +
.../apache/ignite/util/GridTransientTest.java | 68 +
.../ignite/util/mbeans/GridMBeanSelfTest.java | 345 +
.../java/org/apache/ignite/util/package.html | 24 +
.../GridCacheStoreValueBytesNode.java | 132 -
.../GridCacheStoreValueBytesTest.java | 332 -
.../grid/GridCacheAffinityBackupsSelfTest.java | 103 -
.../grid/GridExceptionHelpLinksSelfTest.java | 89 -
.../grid/GridExternalizableAbstractTest.java | 33 -
.../grid/GridSuppressedExceptionSelfTest.java | 133 -
.../java/org/gridgain/grid/GridTestIoUtils.java | 190 -
.../java/org/gridgain/grid/GridTestJob.java | 43 -
.../org/gridgain/grid/GridTestJobContext.java | 96 -
.../org/gridgain/grid/GridTestJobResult.java | 84 -
.../org/gridgain/grid/GridTestNodeStartup.java | 41 -
.../gridgain/grid/GridTestStoreNodeStartup.java | 50 -
.../java/org/gridgain/grid/GridTestTask.java | 46 -
.../org/gridgain/grid/GridTestTaskSession.java | 227 -
...CachePartitionFairAffinityNodesSelfTest.java | 234 -
.../GridCachePartitionFairAffinitySelfTest.java | 253 -
.../store/GridCacheBalancingStoreSelfTest.java | 192 -
.../GridCacheLoadOnlyStoreAdapterSelfTest.java | 100 -
.../cache/store/GridGeneratingTestStore.java | 96 -
...CacheJdbcBlobStoreMultithreadedSelfTest.java | 235 -
.../jdbc/GridCacheJdbcBlobStoreSelfTest.java | 43 -
.../gridgain/grid/cache/store/jdbc/package.html | 15 -
.../org/gridgain/grid/cache/store/package.html | 15 -
.../ggfs/GridGgfsEventsAbstractSelfTest.java | 843 --
.../GridGgfsFragmentizerAbstractSelfTest.java | 161 -
.../grid/ggfs/GridGgfsFragmentizerSelfTest.java | 261 -
.../GridGgfsFragmentizerTopologySelfTest.java | 42 -
.../grid/ggfs/GridGgfsPathSelfTest.java | 155 -
.../grid/ggfs/GridGgfsTestInputGenerator.java | 43 -
.../grid/kernal/ClusterMetricsSelfTest.java | 346 -
.../grid/kernal/ClusterNodeMetricsSelfTest.java | 239 -
.../grid/kernal/GridAffinityMappedTest.java | 157 -
.../grid/kernal/GridAffinityP2PSelfTest.java | 197 -
.../grid/kernal/GridAffinitySelfTest.java | 111 -
.../GridAlwaysFailoverSpiFailSelfTest.java | 152 -
.../kernal/GridCacheProjectionRemoveTest.java | 33 -
.../kernal/GridCancelOnGridStopSelfTest.java | 100 -
.../kernal/GridCancelUnusedJobSelfTest.java | 213 -
.../GridCancelledJobsMetricsSelfTest.java | 207 -
.../GridCollisionJobsContextSelfTest.java | 105 -
.../grid/kernal/GridCommunicationSelfTest.java | 114 -
.../GridContinuousJobAnnotationSelfTest.java | 208 -
.../GridContinuousJobSiblingsSelfTest.java | 138 -
.../grid/kernal/GridContinuousTaskSelfTest.java | 341 -
.../GridDeploymentMultiThreadedSelfTest.java | 114 -
.../grid/kernal/GridDeploymentSelfTest.java | 528 -
.../grid/kernal/GridDiscoveryEventSelfTest.java | 413 -
.../grid/kernal/GridDiscoverySelfTest.java | 410 -
.../GridEventStorageCheckAllEventsSelfTest.java | 426 -
...ventStorageRuntimeConfigurationSelfTest.java | 340 -
.../grid/kernal/GridEventStorageSelfTest.java | 261 -
.../grid/kernal/GridExecutorServiceTest.java | 306 -
.../GridExplicitImplicitDeploymentSelfTest.java | 467 -
.../grid/kernal/GridFactoryVmShutdownTest.java | 94 -
.../GridFailedInputParametersSelfTest.java | 147 -
.../GridFailoverCustomTopologySelfTest.java | 173 -
.../grid/kernal/GridFailoverSelfTest.java | 142 -
.../GridFailoverTaskWithPredicateSelfTest.java | 239 -
.../kernal/GridFailoverTopologySelfTest.java | 147 -
.../grid/kernal/GridHomePathSelfTest.java | 66 -
.../GridJobCheckpointCleanupSelfTest.java | 148 -
.../kernal/GridJobCollisionCancelSelfTest.java | 268 -
.../grid/kernal/GridJobContextSelfTest.java | 112 -
.../kernal/GridJobMasterLeaveAwareSelfTest.java | 799 -
.../grid/kernal/GridJobStealingSelfTest.java | 432 -
.../GridJobStealingZeroActiveJobsSelfTest.java | 162 -
.../grid/kernal/GridJobSubjectIdSelfTest.java | 145 -
.../GridKernalConcurrentAccessStopSelfTest.java | 55 -
.../grid/kernal/GridKernalTestUtils.java | 36 -
.../grid/kernal/GridLifecycleAwareSelfTest.java | 188 -
.../grid/kernal/GridLifecycleBeanSelfTest.java | 305 -
.../grid/kernal/GridListenActorSelfTest.java | 224 -
.../kernal/GridLocalEventListenerSelfTest.java | 65 -
.../grid/kernal/GridManagementJobSelfTest.java | 150 -
.../grid/kernal/GridMultipleJobsSelfTest.java | 224 -
.../grid/kernal/GridMultipleSpisSelfTest.java | 295 -
.../GridMultipleVersionsDeploymentSelfTest.java | 293 -
.../GridMultithreadedJobStealingSelfTest.java | 233 -
.../grid/kernal/GridNodeFilterSelfTest.java | 70 -
.../grid/kernal/GridNodeLocalSelfTest.java | 57 -
.../kernal/GridNodeVisorAttributesSelfTest.java | 106 -
.../kernal/GridNonHistoryMetricsSelfTest.java | 117 -
.../grid/kernal/GridProjectionAbstractTest.java | 761 -
.../kernal/GridProjectionForCachesSelfTest.java | 248 -
...ectionLocalJobMultipleArgumentsSelfTest.java | 148 -
.../grid/kernal/GridProjectionSelfTest.java | 137 -
.../grid/kernal/GridReduceSelfTest.java | 186 -
.../grid/kernal/GridReleaseTypeSelfTest.java | 126 -
.../kernal/GridRuntimeExceptionSelfTest.java | 295 -
.../grid/kernal/GridSameVmStartupSelfTest.java | 99 -
.../org/gridgain/grid/kernal/GridSelfTest.java | 158 -
.../grid/kernal/GridSpiExceptionSelfTest.java | 167 -
.../grid/kernal/GridStartStopSelfTest.java | 173 -
.../gridgain/grid/kernal/GridStartupMain.java | 49 -
.../gridgain/grid/kernal/GridStartupTest.java | 61 -
.../grid/kernal/GridStopWithCancelSelfTest.java | 115 -
.../grid/kernal/GridStopWithWaitSelfTest.java | 250 -
.../GridTaskCancelSingleNodeSelfTest.java | 178 -
.../GridTaskContinuousMapperSelfTest.java | 324 -
.../GridTaskExecutionContextSelfTest.java | 171 -
.../grid/kernal/GridTaskExecutionSelfTest.java | 61 -
.../grid/kernal/GridTaskFailoverSelfTest.java | 109 -
.../GridTaskFutureImplStopGridSelfTest.java | 206 -
.../GridTaskInstanceExecutionSelfTest.java | 114 -
.../kernal/GridTaskInstantiationSelfTest.java | 109 -
.../grid/kernal/GridTaskJobRejectSelfTest.java | 153 -
.../grid/kernal/GridTaskListenerSelfTest.java | 99 -
.../grid/kernal/GridTaskMapAsyncSelfTest.java | 134 -
.../kernal/GridTaskNameAnnotationSelfTest.java | 116 -
.../kernal/GridTaskResultCacheSelfTest.java | 122 -
.../grid/kernal/GridTaskTimeoutSelfTest.java | 215 -
.../kernal/GridTopicExternalizableSelfTest.java | 157 -
.../GridTopologyBuildVersionSelfTest.java | 93 -
.../grid/kernal/GridUpdateNotifierSelfTest.java | 83 -
.../grid/kernal/GridVersionSelfTest.java | 61 -
.../managers/GridManagerStopSelfTest.java | 217 -
.../managers/GridNoopManagerSelfTest.java | 88 -
.../GridCheckpointManagerAbstractSelfTest.java | 748 -
.../GridCheckpointManagerSelfTest.java | 60 -
.../checkpoint/GridCheckpointTaskSelfTest.java | 224 -
.../kernal/managers/checkpoint/package.html | 15 -
...idCommunicationManagerListenersSelfTest.java | 151 -
.../GridCommunicationSendMessageSelfTest.java | 165 -
.../communication/GridIoManagerSelfTest.java | 241 -
.../kernal/managers/communication/package.html | 15 -
.../GridDeploymentManagerStopSelfTest.java | 91 -
.../GridDeploymentMessageCountSelfTest.java | 202 -
.../managers/deployment/GridTestDeployment.java | 31 -
.../kernal/managers/deployment/package.html | 15 -
.../GridDiscoveryManagerAliveCacheSelfTest.java | 229 -
.../GridDiscoveryManagerAttributesSelfTest.java | 164 -
.../discovery/GridDiscoveryManagerSelfTest.java | 146 -
.../events/GridEventStorageManagerSelfTest.java | 117 -
.../gridgain/grid/kernal/managers/package.html | 15 -
.../GridSwapSpaceCustomLocalValue.java | 77 -
.../swapspace/GridSwapSpaceManagerSelfTest.java | 156 -
.../grid/kernal/managers/swapspace/package.html | 15 -
.../java/org/gridgain/grid/kernal/package.html | 15 -
.../GridAffinityProcessorAbstractSelfTest.java | 186 -
...AffinityProcessorConsistentHashSelfTest.java | 23 -
...GridAffinityProcessorRendezvousSelfTest.java | 23 -
...ridCacheAbstractByteArrayValuesSelfTest.java | 75 -
.../GridCacheAbstractFailoverSelfTest.java | 422 -
.../cache/GridCacheAbstractFlagsTest.java | 81 -
...cheAbstractFullApiMultithreadedSelfTest.java | 394 -
.../cache/GridCacheAbstractFullApiSelfTest.java | 5188 -------
.../GridCacheAbstractIteratorsSelfTest.java | 341 -
.../cache/GridCacheAbstractMetricsSelfTest.java | 210 -
.../GridCacheAbstractProjectionSelfTest.java | 826 --
.../GridCacheAbstractRemoveFailureTest.java | 314 -
.../cache/GridCacheAbstractSelfTest.java | 567 -
.../cache/GridCacheAbstractTtlSelfTest.java | 96 -
.../cache/GridCacheAbstractTxReadTest.java | 128 -
.../cache/GridCacheAffinityApiSelfTest.java | 353 -
.../cache/GridCacheAffinityMapperSelfTest.java | 124 -
.../cache/GridCacheAffinityRoutingSelfTest.java | 682 -
.../cache/GridCacheAlwaysEvictionPolicy.java | 26 -
.../GridCacheAsyncOperationsLimitSelfTest.java | 68 -
.../GridCacheAtomicMessageCountSelfTest.java | 225 -
.../cache/GridCacheBasicApiAbstractTest.java | 573 -
.../cache/GridCacheBasicStoreAbstractTest.java | 576 -
...acheBasicStoreMultithreadedAbstractTest.java | 120 -
.../cache/GridCacheClearAllSelfTest.java | 327 -
...dCacheColocatedTxStoreExceptionSelfTest.java | 30 -
.../cache/GridCacheConcurrentMapSelfTest.java | 376 -
.../cache/GridCacheConcurrentMapTest.java | 129 -
.../GridCacheConcurrentTxMultiNodeTest.java | 848 --
...idCacheConfigurationConsistencySelfTest.java | 1034 --
...ridCacheConfigurationValidationSelfTest.java | 188 -
.../GridCacheDaemonNodeAbstractSelfTest.java | 181 -
.../GridCacheDeploymentOffHeapSelfTest.java | 34 -
.../cache/GridCacheDeploymentSelfTest.java | 477 -
.../cache/GridCacheEntryMemorySizeSelfTest.java | 306 -
.../cache/GridCacheEntryVersionSelfTest.java | 150 -
.../GridCacheEvictionEventAbstractTest.java | 113 -
.../GridCacheExAbstractFullApiSelfTest.java | 95 -
.../GridCacheFieldsQueryNoDataSelfTest.java | 74 -
.../GridCacheFinishPartitionsSelfTest.java | 303 -
...CacheFullTextQueryMultithreadedSelfTest.java | 148 -
.../cache/GridCacheGenericTestStore.java | 261 -
...idCacheGetAndTransformStoreAbstractTest.java | 156 -
.../cache/GridCacheGlobalClearAllSelfTest.java | 159 -
.../GridCacheGroupLockAbstractSelfTest.java | 1287 --
...heGroupLockFailoverOptimisticTxSelfTest.java | 20 -
.../GridCacheGroupLockFailoverSelfTest.java | 524 -
...CacheGroupLockMultiNodeAbstractSelfTest.java | 20 -
.../cache/GridCacheGroupLockPutTask.java | 149 -
.../cache/GridCacheIncrementTransformTest.java | 221 -
.../GridCacheInterceptorAbstractSelfTest.java | 1667 ---
...cheInterceptorAtomicNearEnabledSelfTest.java | 23 -
...erceptorAtomicPrimaryWriteOrderSelfTest.java | 37 -
...omicReplicatedPrimaryWriteOrderSelfTest.java | 38 -
...acheInterceptorAtomicReplicatedSelfTest.java | 37 -
.../GridCacheInterceptorAtomicSelfTest.java | 37 -
...ceptorAtomicWithStoreReplicatedSelfTest.java | 23 -
...CacheInterceptorAtomicWithStoreSelfTest.java | 22 -
...GridCacheInterceptorLocalAtomicSelfTest.java | 42 -
...InterceptorLocalAtomicWithStoreSelfTest.java | 22 -
.../GridCacheInterceptorLocalSelfTest.java | 36 -
...dCacheInterceptorLocalWithStoreSelfTest.java | 22 -
...GridCacheInterceptorNearEnabledSelfTest.java | 22 -
.../GridCacheInterceptorReplicatedSelfTest.java | 31 -
...eInterceptorReplicatedWithStoreSelfTest.java | 22 -
.../cache/GridCacheInterceptorSelfTest.java | 31 -
.../GridCacheInterceptorSelfTestSuite.java | 48 -
.../GridCacheInterceptorWithStoreSelfTest.java | 22 -
.../cache/GridCacheIteratorPerformanceTest.java | 269 -
.../GridCacheKeyCheckNearEnabledSelfTest.java | 22 -
.../cache/GridCacheKeyCheckSelfTest.java | 197 -
.../processors/cache/GridCacheLeakTest.java | 142 -
.../cache/GridCacheLifecycleAwareSelfTest.java | 340 -
.../GridCacheLocalTxStoreExceptionSelfTest.java | 29 -
.../cache/GridCacheLuceneQueryIndexTest.java | 457 -
.../GridCacheMarshallerTxAbstractTest.java | 124 -
.../cache/GridCacheMemoryModeSelfTest.java | 261 -
.../GridCacheMissingCommitVersionSelfTest.java | 119 -
...GridCacheMixedPartitionExchangeSelfTest.java | 144 -
.../cache/GridCacheMultiUpdateLockSelfTest.java | 195 -
...ridCacheMultinodeUpdateAbstractSelfTest.java | 120 -
...ultinodeUpdateAtomicNearEnabledSelfTest.java | 31 -
.../GridCacheMultinodeUpdateAtomicSelfTest.java | 30 -
...inodeUpdateNearEnabledNoBackupsSelfTest.java | 31 -
...CacheMultinodeUpdateNearEnabledSelfTest.java | 32 -
.../cache/GridCacheMultinodeUpdateSelfTest.java | 31 -
.../cache/GridCacheMvccFlagsTest.java | 133 -
.../cache/GridCacheMvccManagerSelfTest.java | 107 -
.../cache/GridCacheMvccPartitionedSelfTest.java | 679 -
.../processors/cache/GridCacheMvccSelfTest.java | 1842 ---
.../GridCacheNearTxStoreExceptionSelfTest.java | 24 -
.../cache/GridCacheNestedTxAbstractTest.java | 281 -
.../cache/GridCacheObjectToStringSelfTest.java | 185 -
...ffHeapAtomicMultiThreadedUpdateSelfTest.java | 25 -
...HeapMultiThreadedUpdateAbstractSelfTest.java | 381 -
...CacheOffHeapMultiThreadedUpdateSelfTest.java | 259 -
.../cache/GridCacheOffHeapSelfTest.java | 646 -
.../processors/cache/GridCacheOffHeapTest.java | 249 -
.../GridCacheOffHeapTieredAbstractSelfTest.java | 684 -
.../GridCacheOffHeapTieredAtomicSelfTest.java | 24 -
...heOffHeapTieredEvictionAbstractSelfTest.java | 406 -
...acheOffHeapTieredEvictionAtomicSelfTest.java | 24 -
.../GridCacheOffHeapTieredEvictionSelfTest.java | 25 -
.../cache/GridCacheOffHeapTieredSelfTest.java | 25 -
.../cache/GridCacheOffheapUpdateSelfTest.java | 131 -
.../GridCacheOrderedPreloadingSelfTest.java | 149 -
.../cache/GridCacheP2PUndeploySelfTest.java | 298 -
.../GridCachePartitionedAffinitySpreadTest.java | 159 -
.../cache/GridCachePartitionedGetSelfTest.java | 244 -
...hePartitionedProjectionAffinitySelfTest.java | 110 -
.../cache/GridCachePartitionedWritesTest.java | 134 -
.../GridCachePreloadingEvictionsSelfTest.java | 254 -
.../cache/GridCachePutAllFailoverSelfTest.java | 690 -
.../processors/cache/GridCachePutAllTask.java | 116 -
.../cache/GridCacheQueryEmbeddedValue.java | 41 -
.../cache/GridCacheQueryIndexSelfTest.java | 116 -
.../GridCacheQueryIndexingDisabledSelfTest.java | 89 -
.../GridCacheQueryInternalKeysSelfTest.java | 104 -
.../GridCacheReferenceCleanupSelfTest.java | 494 -
.../GridCacheRefreshAheadAbstractSelfTest.java | 169 -
.../cache/GridCacheReloadSelfTest.java | 156 -
...ridCacheReplicatedSynchronousCommitTest.java | 194 -
...CacheReplicatedTxStoreExceptionSelfTest.java | 30 -
.../GridCacheReturnValueTransferSelfTest.java | 185 -
.../cache/GridCacheSlowTxWarnTest.java | 139 -
.../processors/cache/GridCacheStopSelfTest.java | 193 -
.../cache/GridCacheStorePutxSelfTest.java | 152 -
.../cache/GridCacheStoreValueBytesSelfTest.java | 103 -
.../cache/GridCacheSwapPreloadSelfTest.java | 215 -
.../cache/GridCacheSwapReloadSelfTest.java | 231 -
.../processors/cache/GridCacheTestEntryEx.java | 768 -
.../processors/cache/GridCacheTestKey.java | 56 -
.../processors/cache/GridCacheTestStore.java | 316 -
.../processors/cache/GridCacheTestValue.java | 69 -
.../processors/cache/GridCacheTestValue2.java | 59 -
...cheTransactionalAbstractMetricsSelfTest.java | 272 -
.../cache/GridCacheTtlManagerLoadTest.java | 77 -
.../cache/GridCacheTtlManagerSelfTest.java | 116 -
.../cache/GridCacheUtilsSelfTest.java | 253 -
.../GridCacheValueBytesPreloadingSelfTest.java | 143 -
...idCacheValueConsistencyAbstractSelfTest.java | 314 -
...istencyTransactionalNearEnabledSelfTest.java | 23 -
...heValueConsistencyTransactionalSelfTest.java | 29 -
.../GridCacheVariableTopologySelfTest.java | 183 -
.../cache/GridCacheVersionSelfTest.java | 72 -
...idCacheWriteBehindStoreAbstractSelfTest.java | 181 -
.../GridCacheWriteBehindStoreAbstractTest.java | 345 -
.../GridCacheWriteBehindStoreLocalTest.java | 21 -
...heWriteBehindStoreMultithreadedSelfTest.java | 154 -
...BehindStorePartitionedMultiNodeSelfTest.java | 199 -
...ridCacheWriteBehindStorePartitionedTest.java | 21 -
...GridCacheWriteBehindStoreReplicatedTest.java | 21 -
.../GridCacheWriteBehindStoreSelfTest.java | 266 -
.../processors/cache/IgniteTxAbstractTest.java | 484 -
.../IgniteTxConcurrentGetAbstractTest.java | 134 -
.../IgniteTxExceptionAbstractSelfTest.java | 631 -
.../cache/IgniteTxMultiNodeAbstractTest.java | 918 --
.../IgniteTxMultiThreadedAbstractTest.java | 275 -
.../cache/IgniteTxReentryAbstractSelfTest.java | 169 -
.../IgniteTxSingleThreadedAbstractTest.java | 129 -
.../IgniteTxStoreExceptionAbstractSelfTest.java | 631 -
...eAbstractDataStructuresFailoverSelfTest.java | 986 --
...actQueueFailoverDataConsistencySelfTest.java | 365 -
.../GridCacheAtomicLongApiSelfTest.java | 476 -
...CacheAtomicReferenceApiSelfAbstractTest.java | 179 -
...cheAtomicReferenceMultiNodeAbstractTest.java | 194 -
...idCacheAtomicStampedApiSelfAbstractTest.java | 145 -
.../GridCacheCountDownLatchSelfTest.java | 402 -
.../GridCacheMultiNodeDataStructureTest.java | 71 -
.../GridCacheQueueApiSelfAbstractTest.java | 704 -
.../GridCacheQueueCleanupSelfTest.java | 227 -
...ridCacheQueueJoinedNodeSelfAbstractTest.java | 298 -
...GridCacheQueueMultiNodeAbstractSelfTest.java | 824 --
...dCacheQueueMultiNodeConsistencySelfTest.java | 247 -
...CacheQueueRotativeMultiNodeAbstractTest.java | 434 -
.../GridCacheSequenceApiSelfAbstractTest.java | 564 -
...dCacheSequenceMultiNodeAbstractSelfTest.java | 282 -
.../GridCacheSetAbstractSelfTest.java | 889 --
.../GridCacheSetFailoverAbstractSelfTest.java | 231 -
.../GridCacheLocalAtomicQueueApiSelfTest.java | 31 -
.../local/GridCacheLocalAtomicSetSelfTest.java | 36 -
.../local/GridCacheLocalQueueApiSelfTest.java | 36 -
.../GridCacheLocalSequenceApiSelfTest.java | 38 -
.../local/GridCacheLocalSetSelfTest.java | 30 -
...dCachePartitionedAtomicQueueApiSelfTest.java | 33 -
...ionedAtomicQueueCreateMultiNodeSelfTest.java | 31 -
...micQueueFailoverDataConsistencySelfTest.java | 26 -
...PartitionedAtomicQueueMultiNodeSelfTest.java | 33 -
...itionedAtomicQueueRotativeMultiNodeTest.java | 34 -
...hePartitionedAtomicReferenceApiSelfTest.java | 40 -
...PartitionedAtomicReferenceMultiNodeTest.java | 39 -
...titionedAtomicSequenceMultiThreadedTest.java | 351 -
...chePartitionedAtomicSetFailoverSelfTest.java | 31 -
.../GridCachePartitionedAtomicSetSelfTest.java | 41 -
...achePartitionedAtomicStampedApiSelfTest.java | 44 -
...rtitionedDataStructuresFailoverSelfTest.java | 26 -
...GridCachePartitionedNodeRestartSelfTest.java | 60 -
...idCachePartitionedNodeRestartTxSelfTest.java | 286 -
.../GridCachePartitionedQueueApiSelfTest.java | 44 -
...PartitionedQueueCreateMultiNodeSelfTest.java | 186 -
...dCachePartitionedQueueEntryMoveSelfTest.java | 247 -
...nedQueueFailoverDataConsistencySelfTest.java | 19 -
...CachePartitionedQueueJoinedNodeSelfTest.java | 43 -
...dCachePartitionedQueueMultiNodeSelfTest.java | 42 -
...hePartitionedQueueRotativeMultiNodeTest.java | 41 -
...GridCachePartitionedSequenceApiSelfTest.java | 43 -
...chePartitionedSequenceMultiNodeSelfTest.java | 43 -
...GridCachePartitionedSetFailoverSelfTest.java | 25 -
.../GridCachePartitionedSetSelfTest.java | 25 -
...cheReplicatedAtomicReferenceApiSelfTest.java | 37 -
...eReplicatedAtomicReferenceMultiNodeTest.java | 37 -
...CacheReplicatedAtomicStampedApiSelfTest.java | 36 -
...eplicatedDataStructuresFailoverSelfTest.java | 26 -
.../GridCacheReplicatedQueueApiSelfTest.java | 39 -
...idCacheReplicatedQueueMultiNodeSelfTest.java | 39 -
...cheReplicatedQueueRotativeMultiNodeTest.java | 39 -
.../GridCacheReplicatedSequenceApiSelfTest.java | 38 -
...acheReplicatedSequenceMultiNodeSelfTest.java | 38 -
.../GridCacheReplicatedSetSelfTest.java | 25 -
...tractDistributedByteArrayValuesSelfTest.java | 381 -
.../GridCacheAbstractJobExecutionTest.java | 175 -
.../GridCacheAbstractNodeRestartSelfTest.java | 878 --
...tractPartitionedByteArrayValuesSelfTest.java | 92 -
.../GridCacheAbstractPrimarySyncSelfTest.java | 100 -
.../GridCacheAtomicTimeoutSelfTest.java | 289 -
.../GridCacheBasicOpAbstractTest.java | 388 -
.../GridCacheClientModesAbstractSelfTest.java | 193 -
.../GridCacheEntrySetAbstractSelfTest.java | 109 -
...acheEntrySetIterationPreloadingSelfTest.java | 82 -
.../distributed/GridCacheEventAbstractTest.java | 956 --
...heExpiredEntriesPreloadAbstractSelfTest.java | 106 -
.../distributed/GridCacheLockAbstractTest.java | 455 -
.../distributed/GridCacheMixedModeSelfTest.java | 73 -
.../GridCacheModuloAffinityFunction.java | 192 -
.../GridCacheMultiNodeAbstractTest.java | 482 -
.../GridCacheMultiNodeLockAbstractTest.java | 687 -
...dCacheMultithreadedFailoverAbstractTest.java | 598 -
.../GridCacheNodeFailureAbstractTest.java | 288 -
...dCachePartitionedAffinityFilterSelfTest.java | 136 -
...chePartitionedReloadAllAbstractSelfTest.java | 230 -
.../GridCachePreloadEventsAbstractSelfTest.java | 123 -
.../GridCachePreloadLifecycleAbstractTest.java | 223 -
...GridCachePreloadRestartAbstractSelfTest.java | 314 -
.../GridCacheTransformEventSelfTest.java | 579 -
...iteTxConsistencyRestartAbstractSelfTest.java | 194 -
...xOriginatingNodeFailureAbstractSelfTest.java | 295 -
...cOriginatingNodeFailureAbstractSelfTest.java | 493 -
.../IgniteTxPreloadAbstractTest.java | 192 -
.../IgniteTxTimeoutAbstractTest.java | 147 -
...tPartitionedOnlyByteArrayValuesSelfTest.java | 160 -
...heAbstractTransformWriteThroughSelfTest.java | 312 -
...acheAtomicExpiredEntriesPreloadSelfTest.java | 37 -
.../dht/GridCacheAtomicFullApiSelfTest.java | 92 -
.../dht/GridCacheAtomicNearCacheSelfTest.java | 809 -
...idCacheAtomicNearEnabledFullApiSelfTest.java | 24 -
...EnabledPrimaryWriteOrderFullApiSelfTest.java | 25 -
...eAtomicPrimaryWriteOrderFullApiSelfTest.java | 24 -
...tomicPrimaryWriteOrderReloadAllSelfTest.java | 24 -
.../dht/GridCacheAtomicReloadAllSelfTest.java | 30 -
.../dht/GridCacheClientOnlySelfTest.java | 30 -
.../dht/GridCacheColocatedDebugTest.java | 950 --
.../dht/GridCacheColocatedFailoverSelfTest.java | 31 -
...eColocatedOptimisticTransactionSelfTest.java | 148 -
...ridCacheColocatedPreloadRestartSelfTest.java | 22 -
.../GridCacheColocatedPrimarySyncSelfTest.java | 25 -
.../GridCacheColocatedRefreshAheadSelfTest.java | 46 -
.../GridCacheColocatedReloadAllSelfTest.java | 22 -
.../GridCacheColocatedTxExceptionSelfTest.java | 31 -
...ssimisticOriginatingNodeFailureSelfTest.java | 41 -
...dCacheColocatedTxSingleThreadedSelfTest.java | 99 -
.../GridCacheDaemonNodePartitionedSelfTest.java | 23 -
...cheDhtAtomicEvictionNearReadersSelfTest.java | 24 -
.../GridCacheDhtAtomicRemoveFailureTest.java | 43 -
.../dht/GridCacheDhtEntrySelfTest.java | 306 -
.../dht/GridCacheDhtEntrySetSelfTest.java | 38 -
...GridCacheDhtEvictionNearReadersSelfTest.java | 290 -
.../dht/GridCacheDhtEvictionSelfTest.java | 356 -
.../GridCacheDhtEvictionsDisabledSelfTest.java | 117 -
...idCacheDhtExpiredEntriesPreloadSelfTest.java | 31 -
.../dht/GridCacheDhtInternalEntrySelfTest.java | 218 -
.../dht/GridCacheDhtMappingSelfTest.java | 97 -
.../dht/GridCacheDhtMultiBackupTest.java | 128 -
.../dht/GridCacheDhtPreloadBigDataSelfTest.java | 221 -
.../dht/GridCacheDhtPreloadDelayedSelfTest.java | 452 -
.../GridCacheDhtPreloadDisabledSelfTest.java | 271 -
.../GridCacheDhtPreloadMessageCountTest.java | 167 -
...ridCacheDhtPreloadMultiThreadedSelfTest.java | 167 -
.../dht/GridCacheDhtPreloadOffHeapSelfTest.java | 31 -
.../dht/GridCacheDhtPreloadPutGetSelfTest.java | 267 -
.../dht/GridCacheDhtPreloadSelfTest.java | 667 -
.../GridCacheDhtPreloadStartStopSelfTest.java | 262 -
.../dht/GridCacheDhtPreloadUnloadSelfTest.java | 314 -
.../dht/GridCacheDhtRemoveFailureTest.java | 36 -
.../distributed/dht/GridCacheDhtTestUtils.java | 224 -
.../dht/GridCacheDhtTxPreloadSelfTest.java | 36 -
.../GridCacheExColocatedFullApiSelfTest.java | 25 -
.../GridCacheGroupLockColocatedSelfTest.java | 30 -
...acheGroupLockMultiNodeColocatedSelfTest.java | 21 -
...cheGroupLockPartitionedAbstractSelfTest.java | 128 -
...ockPartitionedMultiNodeAbstractSelfTest.java | 165 -
...ePartitionedNearDisabledFullApiSelfTest.java | 25 -
...ePartitionedNearDisabledMetricsSelfTest.java | 111 -
...nedNearDisabledMultiNodeFullApiSelfTest.java | 26 -
...bledMultiNodeP2PDisabledFullApiSelfTest.java | 26 -
...ionedNearDisabledOffHeapFullApiSelfTest.java | 21 -
...DisabledOffHeapMultiNodeFullApiSelfTest.java | 21 -
...isabledTxOriginatingNodeFailureSelfTest.java | 24 -
...dOnlyP2PDisabledByteArrayValuesSelfTest.java | 21 -
...edOnlyP2PEnabledByteArrayValuesSelfTest.java | 21 -
...dCachePartitionedOnlyProjectionSelfTest.java | 24 -
...idCachePartitionedPreloadEventsSelfTest.java | 116 -
...ridCachePartitionedRefreshAheadSelfTest.java | 46 -
...dCachePartitionedTopologyChangeSelfTest.java | 592 -
...ransformWriteThroughBatchUpdateSelfTest.java | 21 -
...itionedTxOriginatingNodeFailureSelfTest.java | 153 -
...ridCachePartitionedUnloadEventsSelfTest.java | 143 -
...teTxConsistencyColocatedRestartSelfTest.java | 28 -
.../dht/IgniteTxReentryColocatedSelfTest.java | 71 -
...eAtomicInvalidPartitionHandlingSelfTest.java | 318 -
.../atomic/GridCacheAtomicPreloadSelfTest.java | 206 -
...lueConsistencyAtomicNearEnabledSelfTest.java | 30 -
...micPrimaryWriteOrderNearEnabledSelfTest.java | 31 -
...GridCacheValueConsistencyAtomicSelfTest.java | 121 -
...tNearPartitionedByteArrayValuesSelfTest.java | 26 -
...unctionExcludeNeighborsAbstractSelfTest.java | 176 -
...tomicClientOnlyMultiNodeFullApiSelfTest.java | 501 -
...OnlyMultiNodeP2PDisabledFullApiSelfTest.java | 27 -
...GridCacheAtomicMultiNodeFullApiSelfTest.java | 60 -
...omicMultiNodeP2PDisabledFullApiSelfTest.java | 58 -
...omicNearEnabledMultiNodeFullApiSelfTest.java | 24 -
...imaryWriteOrderMultiNodeFullApiSelfTest.java | 25 -
...ridCacheAtomicNearEvictionEventSelfTest.java | 31 -
.../GridCacheAtomicNearEvictionSelfTest.java | 24 -
.../GridCacheAtomicNearMultiNodeSelfTest.java | 24 -
...eAtomicNearOnlyMultiNodeFullApiSelfTest.java | 188 -
...OnlyMultiNodeP2PDisabledFullApiSelfTest.java | 27 -
.../near/GridCacheAtomicNearOnlySelfTest.java | 24 -
.../GridCacheAtomicNearReadersSelfTest.java | 24 -
.../GridCacheAtomicNearRemoveFailureTest.java | 43 -
.../GridCacheAtomicOffHeapFullApiSelfTest.java | 57 -
...heAtomicOffHeapMultiNodeFullApiSelfTest.java | 58 -
...idCacheAtomicPartitionedMetricsSelfTest.java | 56 -
...imaryWriteOrderMultiNodeFullApiSelfTest.java | 24 -
...rderMultiNodeP2PDisabledFullApiSelfTest.java | 25 -
...cPrimaryWriteOrderNearRemoveFailureTest.java | 43 -
...PrimaryWriteOrderOffHeapFullApiSelfTest.java | 24 -
...ityOrderOffHeapMultiNodeFullApiSelfTest.java | 25 -
...ffinityFunctionExcludeNeighborsSelfTest.java | 24 -
.../near/GridCacheExNearFullApiSelfTest.java | 31 -
.../near/GridCacheGetStoreErrorSelfTest.java | 139 -
...GridCacheGroupLockMultiNodeNearSelfTest.java | 22 -
.../near/GridCacheGroupLockNearSelfTest.java | 30 -
.../GridCacheNearEvictionEventSelfTest.java | 40 -
.../near/GridCacheNearEvictionSelfTest.java | 178 -
...dCacheNearExpiredEntriesPreloadSelfTest.java | 31 -
.../near/GridCacheNearJobExecutionSelfTest.java | 40 -
.../near/GridCacheNearMetricsSelfTest.java | 387 -
.../near/GridCacheNearMultiGetSelfTest.java | 300 -
.../near/GridCacheNearMultiNodeSelfTest.java | 954 --
.../near/GridCacheNearOneNodeSelfTest.java | 374 -
...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 457 -
...OnlyMultiNodeP2PDisabledFullApiSelfTest.java | 26 -
.../near/GridCacheNearOnlySelfTest.java | 60 -
.../near/GridCacheNearOnlyTopologySelfTest.java | 225 -
.../GridCacheNearPartitionedClearSelfTest.java | 142 -
...ionedP2PDisabledByteArrayValuesSelfTest.java | 21 -
...tionedP2PEnabledByteArrayValuesSelfTest.java | 21 -
.../GridCacheNearPreloadRestartSelfTest.java | 22 -
.../near/GridCacheNearPrimarySyncSelfTest.java | 25 -
.../GridCacheNearReaderPreloadSelfTest.java | 192 -
.../near/GridCacheNearReadersSelfTest.java | 576 -
.../near/GridCacheNearReloadAllSelfTest.java | 22 -
.../near/GridCacheNearRemoveFailureTest.java | 37 -
.../near/GridCacheNearTxExceptionSelfTest.java | 25 -
.../near/GridCacheNearTxMultiNodeSelfTest.java | 237 -
...ssimisticOriginatingNodeFailureSelfTest.java | 41 -
.../near/GridCacheNearTxPreloadSelfTest.java | 36 -
...AffinityExcludeNeighborsPerformanceTest.java | 246 -
...rtitionedAffinityHashIdResolverSelfTest.java | 89 -
.../GridCachePartitionedAffinitySelfTest.java | 508 -
...ionedAtomicGetAndTransformStoreSelfTest.java | 25 -
.../near/GridCachePartitionedBasicApiTest.java | 39 -
.../GridCachePartitionedBasicOpSelfTest.java | 59 -
...ePartitionedBasicStoreMultiNodeSelfTest.java | 344 -
.../GridCachePartitionedBasicStoreSelfTest.java | 25 -
...ionedClientOnlyNoPrimaryFullApiSelfTest.java | 59 -
.../GridCachePartitionedEntryLockSelfTest.java | 103 -
.../near/GridCachePartitionedEventSelfTest.java | 52 -
.../GridCachePartitionedEvictionSelfTest.java | 200 -
...titionedExplicitLockNodeFailureSelfTest.java | 156 -
.../GridCachePartitionedFailoverSelfTest.java | 25 -
...GridCachePartitionedFilteredPutSelfTest.java | 157 -
.../near/GridCachePartitionedFlagsTest.java | 24 -
...PartitionedFullApiMultithreadedSelfTest.java | 30 -
.../GridCachePartitionedFullApiSelfTest.java | 243 -
...PartitionedGetAndTransformStoreSelfTest.java | 26 -
.../GridCachePartitionedIteratorsSelfTest.java | 35 -
.../GridCachePartitionedLoadCacheSelfTest.java | 136 -
.../near/GridCachePartitionedLockSelfTest.java | 94 -
.../GridCachePartitionedMetricsSelfTest.java | 52 -
...achePartitionedMultiNodeCounterSelfTest.java | 771 -
...achePartitionedMultiNodeFullApiSelfTest.java | 588 -
...idCachePartitionedMultiNodeLockSelfTest.java | 80 -
...onedMultiNodeP2PDisabledFullApiSelfTest.java | 27 -
.../GridCachePartitionedMultiNodeSelfTest.java | 40 -
...ePartitionedMultiThreadedPutGetSelfTest.java | 196 -
...NearDisabledBasicStoreMultiNodeSelfTest.java | 25 -
...itionedNearOnlyNoPrimaryFullApiSelfTest.java | 23 -
.../near/GridCachePartitionedNestedTxTest.java | 42 -
...GridCachePartitionedNodeFailureSelfTest.java | 42 -
.../GridCachePartitionedNodeRestartTest.java | 123 -
...dCachePartitionedOffHeapFullApiSelfTest.java | 20 -
...titionedOffHeapMultiNodeFullApiSelfTest.java | 20 -
...ePartitionedOptimisticTxNodeRestartTest.java | 119 -
...achePartitionedPreloadLifecycleSelfTest.java | 270 -
.../GridCachePartitionedProjectionSelfTest.java | 147 -
...hePartitionedQueryMultiThreadedSelfTest.java | 296 -
.../GridCachePartitionedStorePutSelfTest.java | 139 -
.../near/GridCachePartitionedTtlSelfTest.java | 25 -
...GridCachePartitionedTxConcurrentGetTest.java | 38 -
...GridCachePartitionedTxMultiNodeSelfTest.java | 73 -
...CachePartitionedTxMultiThreadedSelfTest.java | 97 -
.../near/GridCachePartitionedTxReadTest.java | 24 -
.../GridCachePartitionedTxSalvageSelfTest.java | 276 -
...achePartitionedTxSingleThreadedSelfTest.java | 98 -
.../GridCachePartitionedTxTimeoutSelfTest.java | 59 -
.../near/GridCachePutArrayValueSelfTest.java | 108 -
...idCacheRendezvousAffinityClientSelfTest.java | 97 -
...ffinityFunctionExcludeNeighborsSelfTest.java | 24 -
.../near/GridPartitionedBackupLoadSelfTest.java | 156 -
.../near/IgniteTxReentryNearSelfTest.java | 71 -
...stractReplicatedByteArrayValuesSelfTest.java | 76 -
...ridCacheAtomicReplicatedMetricsSelfTest.java | 51 -
.../GridCacheDaemonNodeReplicatedSelfTest.java | 23 -
.../GridCacheExReplicatedFullApiSelfTest.java | 25 -
...cheGroupLockMultiNodeReplicatedSelfTest.java | 37 -
.../GridCacheGroupLockReplicatedSelfTest.java | 31 -
...ridCacheReplicatedAtomicFullApiSelfTest.java | 34 -
...catedAtomicGetAndTransformStoreSelfTest.java | 25 -
...eplicatedAtomicMultiNodeFullApiSelfTest.java | 51 -
...imaryWriteOrderMultiNodeFullApiSelfTest.java | 25 -
.../GridCacheReplicatedBasicApiTest.java | 34 -
.../GridCacheReplicatedBasicOpSelfTest.java | 34 -
.../GridCacheReplicatedBasicStoreSelfTest.java | 25 -
.../GridCacheReplicatedClientOnlySelfTest.java | 34 -
.../GridCacheReplicatedEntrySetSelfTest.java | 25 -
.../GridCacheReplicatedEventSelfTest.java | 30 -
...ridCacheReplicatedEvictionEventSelfTest.java | 30 -
.../GridCacheReplicatedEvictionSelfTest.java | 122 -
.../GridCacheReplicatedFailoverSelfTest.java | 25 -
.../GridCacheReplicatedFlagsTest.java | 11 -
...eReplicatedFullApiMultithreadedSelfTest.java | 30 -
...ReplicatedFullApiMultithreadedSelfTest1.java | 1972 ---
.../GridCacheReplicatedFullApiSelfTest.java | 49 -
...eReplicatedGetAndTransformStoreSelfTest.java | 31 -
.../GridCacheReplicatedInvalidateSelfTest.java | 236 -
.../GridCacheReplicatedIteratorsSelfTest.java | 35 -
.../GridCacheReplicatedJobExecutionTest.java | 37 -
.../GridCacheReplicatedLockSelfTest.java | 25 -
.../GridCacheReplicatedMarshallerTxTest.java | 39 -
.../GridCacheReplicatedMetricsSelfTest.java | 46 -
...CacheReplicatedMultiNodeFullApiSelfTest.java | 20 -
...ridCacheReplicatedMultiNodeLockSelfTest.java | 34 -
...atedMultiNodeP2PDisabledFullApiSelfTest.java | 27 -
.../GridCacheReplicatedMultiNodeSelfTest.java | 34 -
...licatedNearOnlyMultiNodeFullApiSelfTest.java | 31 -
.../GridCacheReplicatedNearOnlySelfTest.java | 34 -
.../GridCacheReplicatedNodeFailureSelfTest.java | 38 -
.../GridCacheReplicatedNodeRestartSelfTest.java | 46 -
...idCacheReplicatedOffHeapFullApiSelfTest.java | 20 -
...plicatedOffHeapMultiNodeFullApiSelfTest.java | 20 -
...catedP2PDisabledByteArrayValuesSelfTest.java | 21 -
...icatedP2PEnabledByteArrayValuesSelfTest.java | 21 -
...ridCacheReplicatedPreloadEventsSelfTest.java | 24 -
.../GridCacheReplicatedProjectionSelfTest.java | 58 -
...GridCacheReplicatedRefreshAheadSelfTest.java | 43 -
...dezvousAffinityMultiNodeFullApiSelfTest.java | 27 -
.../GridCacheReplicatedTtlSelfTest.java | 24 -
.../GridCacheReplicatedTxConcurrentGetTest.java | 37 -
.../GridCacheReplicatedTxExceptionSelfTest.java | 31 -
...GridCacheReplicatedTxMultiNodeBasicTest.java | 73 -
...dCacheReplicatedTxMultiThreadedSelfTest.java | 103 -
...licatedTxOriginatingNodeFailureSelfTest.java | 29 -
...ssimisticOriginatingNodeFailureSelfTest.java | 39 -
.../GridCacheReplicatedTxReadTest.java | 24 -
...CacheReplicatedTxSingleThreadedSelfTest.java | 94 -
.../GridCacheReplicatedTxTimeoutSelfTest.java | 52 -
...idCacheReplicatedUnswapAdvancedSelfTest.java | 163 -
.../GridCacheSyncReplicatedPreloadSelfTest.java | 158 -
.../replicated/GridReplicatedTxPreloadTest.java | 25 -
...CacheReplicatedPreloadLifecycleSelfTest.java | 285 -
...idCacheReplicatedPreloadOffHeapSelfTest.java | 30 -
.../GridCacheReplicatedPreloadSelfTest.java | 574 -
...eplicatedPreloadStartStopEventsSelfTest.java | 87 -
...GridCacheReplicatedPreloadUndeploysTest.java | 79 -
.../GridCacheBatchEvictUnswapSelfTest.java | 167 -
...heConcurrentEvictionConsistencySelfTest.java | 259 -
.../GridCacheConcurrentEvictionsSelfTest.java | 175 -
.../GridCacheDistributedEvictionsSelfTest.java | 257 -
.../GridCacheEmptyEntriesAbstractSelfTest.java | 288 -
.../GridCacheEmptyEntriesLocalSelfTest.java | 33 -
...ridCacheEmptyEntriesPartitionedSelfTest.java | 33 -
.../eviction/GridCacheEvictionAbstractTest.java | 454 -
.../GridCacheEvictionFilterSelfTest.java | 241 -
.../GridCacheEvictionLockUnlockSelfTest.java | 166 -
.../GridCacheEvictionTouchSelfTest.java | 329 -
.../cache/eviction/GridCacheMockEntry.java | 360 -
...cheSynchronousEvictionsFailoverSelfTest.java | 152 -
.../GridCacheFifoEvictionPolicySelfTest.java | 372 -
.../lru/GridCacheLruEvictionPolicySelfTest.java | 418 -
.../GridCacheLruNearEvictionPolicySelfTest.java | 128 -
...heNearOnlyLruNearEvictionPolicySelfTest.java | 159 -
.../GridCacheRandomEvictionPolicySelfTest.java | 258 -
...dCacheAtomicLocalMetricsNoStoreSelfTest.java | 21 -
.../GridCacheAtomicLocalMetricsSelfTest.java | 51 -
.../local/GridCacheDaemonNodeLocalSelfTest.java | 57 -
.../local/GridCacheExLocalFullApiSelfTest.java | 22 -
.../GridCacheLocalAtomicBasicStoreSelfTest.java | 24 -
.../GridCacheLocalAtomicFullApiSelfTest.java | 34 -
...LocalAtomicGetAndTransformStoreSelfTest.java | 25 -
...dCacheLocalAtomicOffHeapFullApiSelfTest.java | 34 -
.../GridCacheLocalAtomicProjectionSelfTest.java | 24 -
.../local/GridCacheLocalBasicApiSelfTest.java | 34 -
...cheLocalBasicStoreMultithreadedSelfTest.java | 22 -
.../local/GridCacheLocalBasicStoreSelfTest.java | 25 -
.../GridCacheLocalByteArrayValuesSelfTest.java | 250 -
.../local/GridCacheLocalEventSelfTest.java | 30 -
.../GridCacheLocalEvictionEventSelfTest.java | 30 -
...dCacheLocalFullApiMultithreadedSelfTest.java | 30 -
.../local/GridCacheLocalFullApiSelfTest.java | 133 -
...dCacheLocalGetAndTransformStoreSelfTest.java | 25 -
.../local/GridCacheLocalIteratorsSelfTest.java | 164 -
.../local/GridCacheLocalLoadAllSelfTest.java | 102 -
.../cache/local/GridCacheLocalLockSelfTest.java | 308 -
.../local/GridCacheLocalMetricsSelfTest.java | 47 -
.../GridCacheLocalMultithreadedSelfTest.java | 444 -
.../GridCacheLocalOffHeapFullApiSelfTest.java | 20 -
.../local/GridCacheLocalProjectionSelfTest.java | 30 -
.../GridCacheLocalRefreshAheadSelfTest.java | 43 -
.../cache/local/GridCacheLocalTtlSelfTest.java | 25 -
.../GridCacheLocalTxExceptionSelfTest.java | 30 -
.../GridCacheLocalTxMultiThreadedSelfTest.java | 83 -
.../cache/local/GridCacheLocalTxReadTest.java | 24 -
.../GridCacheLocalTxSingleThreadedSelfTest.java | 78 -
.../local/GridCacheLocalTxTimeoutSelfTest.java | 156 -
.../GridCacheSwapScanQueryAbstractSelfTest.java | 437 -
.../query/GridCacheSwapScanQuerySelfTest.java | 20 -
.../cache/query/GridCircularQueueTest.java | 111 -
...ridCacheContinuousQueryAbstractSelfTest.java | 1527 --
...ontinuousQueryAtomicNearEnabledSelfTest.java | 24 -
...ontinuousQueryAtomicP2PDisabledSelfTest.java | 21 -
.../GridCacheContinuousQueryAtomicSelfTest.java | 35 -
...CacheContinuousQueryLocalAtomicSelfTest.java | 24 -
.../GridCacheContinuousQueryLocalSelfTest.java | 29 -
...eContinuousQueryPartitionedOnlySelfTest.java | 40 -
...uousQueryPartitionedP2PDisabledSelfTest.java | 21 -
...CacheContinuousQueryPartitionedSelfTest.java | 29 -
...ContinuousQueryReplicatedAtomicSelfTest.java | 29 -
...nuousQueryReplicatedP2PDisabledSelfTest.java | 20 -
...dCacheContinuousQueryReplicatedSelfTest.java | 74 -
...dCacheAbstractReduceFieldsQuerySelfTest.java | 418 -
...ridCacheReduceFieldsQueryAtomicSelfTest.java | 30 -
...GridCacheReduceFieldsQueryLocalSelfTest.java | 29 -
...cheReduceFieldsQueryPartitionedSelfTest.java | 50 -
...acheReduceFieldsQueryReplicatedSelfTest.java | 29 -
.../clock/GridTimeSyncProcessorSelfTest.java | 216 -
.../closure/GridClosureProcessorRemoteTest.java | 111 -
.../closure/GridClosureProcessorSelfTest.java | 534 -
.../grid/kernal/processors/closure/package.html | 15 -
.../continuous/GridEventConsumeSelfTest.java | 1072 --
.../continuous/GridMessageListenSelfTest.java | 490 -
.../dataload/GridDataLoaderImplSelfTest.java | 207 -
.../dataload/GridDataLoaderPerformanceTest.java | 207 -
.../GridDataLoaderProcessorSelfTest.java | 776 -
...heGgfsPerBlockLruEvictionPolicySelfTest.java | 485 -
.../ggfs/GridGgfsAbstractSelfTest.java | 2440 ---
.../ggfs/GridGgfsAttributesSelfTest.java | 67 -
.../processors/ggfs/GridGgfsCacheSelfTest.java | 125 -
.../ggfs/GridGgfsCommonAbstractTest.java | 59 -
.../ggfs/GridGgfsDataManagerSelfTest.java | 591 -
.../ggfs/GridGgfsDualAbstractSelfTest.java | 1593 --
.../ggfs/GridGgfsDualAsyncSelfTest.java | 24 -
.../ggfs/GridGgfsDualSyncSelfTest.java | 24 -
.../ggfs/GridGgfsFileInfoSelfTest.java | 80 -
.../ggfs/GridGgfsFileMapSelfTest.java | 329 -
...GgfsGroupDataBlockKeyMapperHashSelfTest.java | 128 -
.../ggfs/GridGgfsMetaManagerSelfTest.java | 458 -
.../ggfs/GridGgfsMetricsSelfTest.java | 526 -
.../ggfs/GridGgfsModeResolverSelfTest.java | 69 -
.../processors/ggfs/GridGgfsModesSelfTest.java | 594 -
.../GridGgfsPrimaryOffheapTieredSelfTest.java | 25 -
.../GridGgfsPrimaryOffheapValuesSelfTest.java | 25 -
.../ggfs/GridGgfsPrimarySelfTest.java | 24 -
.../ggfs/GridGgfsProcessorSelfTest.java | 970 --
.../GridGgfsProcessorValidationSelfTest.java | 527 -
...IpcEndpointRegistrationAbstractSelfTest.java | 162 -
...dpointRegistrationOnLinuxAndMacSelfTest.java | 42 -
...pcEndpointRegistrationOnWindowsSelfTest.java | 46 -
.../processors/ggfs/GridGgfsSizeSelfTest.java | 867 --
.../ggfs/GridGgfsStreamsSelfTest.java | 465 -
.../processors/ggfs/GridGgfsTaskSelfTest.java | 309 -
.../ggfs/GridGgfsTestInputStream.java | 58 -
.../grid/kernal/processors/ggfs/package.html | 15 -
.../GridGgfsAbstractRecordResolverSelfTest.java | 179 -
...GgfsByteDelimiterRecordResolverSelfTest.java | 327 -
...idGgfsFixedLengthRecordResolverSelfTest.java | 139 -
...sNewLineDelimiterRecordResolverSelfTest.java | 121 -
...fsStringDelimiterRecordResolverSelfTest.java | 129 -
.../GridJobMetricsProcessorLoadTest.java | 81 -
.../port/GridPortProcessorSelfTest.java | 121 -
.../cache/GridCacheCommandHandlerSelfTest.java | 255 -
.../kernal/processors/service/DummyService.java | 140 -
.../GridServiceProcessorAbstractSelfTest.java | 669 -
...ServiceProcessorMultiNodeConfigSelfTest.java | 192 -
.../GridServiceProcessorMultiNodeSelfTest.java | 162 -
.../GridServiceProcessorProxySelfTest.java | 368 -
.../GridServiceProcessorSingleNodeSelfTest.java | 50 -
.../GridServiceReassignmentSelfTest.java | 204 -
.../streamer/GridStreamerEvictionSelfTest.java | 156 -
.../streamer/GridStreamerFailoverSelfTest.java | 259 -
.../GridStreamerLifecycleAwareSelfTest.java | 204 -
.../streamer/GridStreamerSelfTest.java | 788 -
.../processors/streamer/GridTestStage.java | 46 -
.../streamer/GridTestStreamerEventRouter.java | 41 -
.../grid/kernal/processors/streamer/SC.java | 23 -
.../timeout/GridTimeoutProcessorSelfTest.java | 601 -
.../org/gridgain/grid/kernal/updatestatus.html | 14 -
.../grid/lang/GridBasicPerformanceTest.java | 1069 --
.../grid/lang/GridByteArrayListSelfTest.java | 205 -
.../grid/lang/GridFuncPerformanceTest.java | 93 -
.../gridgain/grid/lang/GridFuncSelfTest.java | 3247 ----
.../lang/GridFutureListenPerformanceTest.java | 104 -
.../GridImmutableCollectionsPerfomanceTest.java | 112 -
.../lang/GridMetadataAwareAdapterSelfTest.java | 110 -
.../grid/lang/GridSetWrapperSelfTest.java | 216 -
.../lang/GridSystemCurrentTimeMillisTest.java | 99 -
.../grid/lang/GridThreadPriorityTest.java | 64 -
.../gridgain/grid/lang/GridTupleSelfTest.java | 242 -
.../org/gridgain/grid/lang/GridXSelfTest.java | 254 -
.../gridgain/grid/lang/IgniteUuidSelfTest.java | 315 -
.../java/org/gridgain/grid/lang/package.html | 15 -
...dBoundedConcurrentLinkedHashMapSelfTest.java | 47 -
...GridBoundedConcurrentOrderedMapSelfTest.java | 73 -
.../GridCircularBufferPerformanceTest.java | 218 -
.../lang/utils/GridCircularBufferSelfTest.java | 168 -
.../utils/GridConcurrentHashMapSelfTest.java | 101 -
.../GridConcurrentLinkedHashMapSelfTest.java | 237 -
.../GridConcurrentWeakHashSetSelfTest.java | 386 -
.../lang/utils/GridConsistentHashSelfTest.java | 324 -
.../lang/utils/GridLeanMapPerformanceTest.java | 76 -
.../grid/lang/utils/GridLeanMapSelfTest.java | 650 -
.../grid/lang/utils/GridListSetSelfTest.java | 278 -
.../grid/lang/utils/GridPCollectionsTest.java | 46 -
.../lang/utils/GridStripedLockSelfTest.java | 192 -
.../grid/lang/utils/GridTrieMapSelfTest.java | 234 -
.../org/gridgain/grid/lang/utils/package.html | 15 -
.../grid/loadtest/GridLoadTestStatistics.java | 202 -
.../grid/loadtest/GridSingleExecutionTest.java | 317 -
.../org/gridgain/grid/loadtest/package.html | 15 -
...idFileSwapSpaceSpiMultithreadedLoadTest.java | 239 -
.../grid/logger/java/GridJavaLoggerTest.java | 56 -
.../org/gridgain/grid/logger/java/package.html | 15 -
.../marshaller/GridMarshallerAbstractTest.java | 1033 --
.../GridMarshallerExternalizableBean.java | 55 -
.../GridMarshallerPerformanceTest.java | 506 -
.../marshaller/GridMarshallerResourceBean.java | 97 -
.../GridMarshallerTestAbstractBean.java | 32 -
.../grid/marshaller/GridMarshallerTestBean.java | 140 -
.../GridMarshallerTestInheritedBean.java | 17 -
.../jdk/GridJdkMarshallerSelfTest.java | 27 -
.../gridgain/grid/marshaller/jdk/package.html | 15 -
.../org/gridgain/grid/marshaller/package.html | 15 -
...GridMessagingNoPeerClassLoadingSelfTest.java | 82 -
.../grid/messaging/GridMessagingSelfTest.java | 1071 --
.../p2p/GridAbstractMultinodeRedeployTest.java | 118 -
...MultinodeRedeployContinuousModeSelfTest.java | 29 -
...idMultinodeRedeployIsolatedModeSelfTest.java | 29 -
...ridMultinodeRedeployPrivateModeSelfTest.java | 29 -
...GridMultinodeRedeploySharedModeSelfTest.java | 29 -
.../grid/p2p/GridP2PClassLoadingSelfTest.java | 149 -
.../GridP2PContinuousDeploymentSelfTest.java | 110 -
.../GridP2PDifferentClassLoaderSelfTest.java | 213 -
.../p2p/GridP2PDoubleDeploymentSelfTest.java | 132 -
.../p2p/GridP2PHotRedeploymentSelfTest.java | 225 -
.../grid/p2p/GridP2PJobClassLoaderSelfTest.java | 149 -
.../p2p/GridP2PLocalDeploymentSelfTest.java | 277 -
.../GridP2PMissedResourceCacheSizeSelfTest.java | 285 -
.../grid/p2p/GridP2PNodeLeftSelfTest.java | 126 -
.../grid/p2p/GridP2PRecursionTaskSelfTest.java | 186 -
.../p2p/GridP2PRemoteClassLoadersSelfTest.java | 275 -
.../p2p/GridP2PSameClassLoaderSelfTest.java | 171 -
.../org/gridgain/grid/p2p/GridP2PTestJob.java | 121 -
.../org/gridgain/grid/p2p/GridP2PTestTask.java | 73 -
.../grid/p2p/GridP2PTestTaskExecutionTest.java | 34 -
.../grid/p2p/GridP2PTimeoutSelfTest.java | 198 -
.../grid/p2p/GridP2PUndeploySelfTest.java | 229 -
.../grid/p2p/GridSwapSpaceCustomKey.java | 50 -
.../grid/p2p/GridSwapSpaceCustomValue.java | 56 -
.../java/org/gridgain/grid/p2p/p2p.properties | 1 -
.../java/org/gridgain/grid/p2p/package.html | 15 -
.../test/java/org/gridgain/grid/package.html | 15 -
.../product/GridProductVersionSelfTest.java | 103 -
...SessionCancelSiblingsFromFutureSelfTest.java | 273 -
...ridSessionCancelSiblingsFromJobSelfTest.java | 284 -
...idSessionCancelSiblingsFromTaskSelfTest.java | 291 -
.../GridSessionCheckpointAbstractSelfTest.java | 223 -
.../session/GridSessionCheckpointSelfTest.java | 88 -
.../GridSessionCollisionSpiSelfTest.java | 136 -
...idSessionFutureWaitJobAttributeSelfTest.java | 244 -
...dSessionFutureWaitTaskAttributeSelfTest.java | 243 -
.../session/GridSessionJobFailoverSelfTest.java | 158 -
...GridSessionJobWaitTaskAttributeSelfTest.java | 213 -
.../grid/session/GridSessionLoadSelfTest.java | 257 -
.../GridSessionSetFutureAttributeSelfTest.java | 247 -
...nSetFutureAttributeWaitListenerSelfTest.java | 235 -
.../GridSessionSetJobAttribute2SelfTest.java | 127 -
...GridSessionSetJobAttributeOrderSelfTest.java | 146 -
.../GridSessionSetJobAttributeSelfTest.java | 202 -
...sionSetJobAttributeWaitListenerSelfTest.java | 237 -
.../GridSessionSetTaskAttributeSelfTest.java | 190 -
...GridSessionTaskWaitJobAttributeSelfTest.java | 183 -
.../GridSessionWaitAttributeSelfTest.java | 473 -
.../grid/session/GridThreadSerialNumber.java | 32 -
.../java/org/gridgain/grid/session/package.html | 15 -
.../grid/spi/GridSpiLocalHostInjectionTest.java | 148 -
.../grid/spi/GridSpiStartStopAbstractTest.java | 72 -
.../org/gridgain/grid/spi/GridTcpForwarder.java | 161 -
.../grid/spi/GridTcpSpiForwardingSelfTest.java | 156 -
.../java/org/gridgain/grid/spi/package.html | 15 -
.../startup/servlet/GridServletLoaderTest.java | 163 -
.../gridgain/grid/startup/servlet/package.html | 15 -
.../GridThreadPoolExecutorServiceSelfTest.java | 180 -
.../gridgain/grid/thread/GridThreadTest.java | 45 -
...dConcurrentLinkedDequeMultiThreadedTest.java | 93 -
.../util/GridConcurrentLinkedDequeSelfTest.java | 228 -
...rrentLinkedHashMapMultiThreadedSelfTest.java | 543 -
.../gridgain/grid/util/GridIndexFillTest.java | 247 -
.../gridgain/grid/util/GridLogThrottleTest.java | 115 -
.../grid/util/GridLongListSelfTest.java | 144 -
.../gridgain/grid/util/GridQueueSelfTest.java | 62 -
.../gridgain/grid/util/GridRandomSelfTest.java | 60 -
.../grid/util/GridSnapshotLockSelfTest.java | 104 -
.../util/GridSpinReadWriteLockSelfTest.java | 135 -
...artupWithSpecifiedWorkDirectorySelfTest.java | 155 -
...tartupWithUndefinedGridGainHomeSelfTest.java | 97 -
.../util/GridStringBuilderFactorySelfTest.java | 63 -
.../gridgain/grid/util/GridTestClockTimer.java | 31 -
.../grid/util/GridTopologyHeapSizeSelfTest.java | 112 -
.../gridgain/grid/util/GridTransientTest.java | 60 -
.../gridgain/grid/util/GridUtilsSelfTest.java | 709 -
.../util/future/GridCompoundFutureSelfTest.java | 196 -
.../util/future/GridEmbeddedFutureSelfTest.java | 129 -
.../util/future/GridFinishedFutureSelfTest.java | 96 -
.../util/future/GridFutureAdapterSelfTest.java | 433 -
.../future/GridFutureListenPerformanceTest.java | 99 -
.../grid/util/future/GridFutureQueueTest.java | 175 -
.../nio/GridNioEmbeddedFutureSelfTest.java | 51 -
.../util/future/nio/GridNioFutureSelfTest.java | 202 -
...GridUnsafeDataOutputArraySizingSelfTest.java | 153 -
...idIpcServerEndpointDeserializerSelfTest.java | 152 -
.../shmem/GridGgfsSharedMemoryTestClient.java | 68 -
.../shmem/GridGgfsSharedMemoryTestServer.java | 63 -
...idIpcSharedMemoryCrashDetectionSelfTest.java | 492 -
.../shmem/GridIpcSharedMemoryFakeClient.java | 28 -
.../shmem/GridIpcSharedMemoryNodeStartup.java | 79 -
.../shmem/GridIpcSharedMemorySpaceSelfTest.java | 252 -
.../shmem/GridIpcSharedMemoryUtilsSelfTest.java | 76 -
.../GridIpcSharedMemoryBenchmarkParty.java | 27 -
.../GridIpcSharedMemoryBenchmarkReader.java | 125 -
.../GridIpcSharedMemoryBenchmarkWriter.java | 117 -
.../grid/util/mbeans/GridMBeanSelfTest.java | 336 -
.../gridgain/grid/util/nio/GridNioSelfTest.java | 1432 --
.../util/nio/GridNioSessionMetaKeySelfTest.java | 50 -
.../grid/util/nio/GridNioSslSelfTest.java | 79 -
.../grid/util/nio/GridRoundTripTest.java | 217 -
.../nio/impl/GridNioFilterChainSelfTest.java | 382 -
.../org/gridgain/grid/util/nio/package.html | 15 -
.../grid/util/offheap/GridByteArrayWrapper.java | 55 -
.../offheap/GridOffHeapMapAbstractSelfTest.java | 804 -
.../GridOffHeapMapPerformanceAbstractTest.java | 281 -
...idOffHeapPartitionedMapAbstractSelfTest.java | 1125 --
...apPartitionedMapPerformanceAbstractTest.java | 421 -
.../unsafe/GridOffheapSnapTreeSelfTest.java | 313 -
.../unsafe/GridUnsafeMapPerformanceTest.java | 22 -
.../offheap/unsafe/GridUnsafeMapSelfTest.java | 22 -
.../unsafe/GridUnsafeMemorySelfTest.java | 534 -
...GridUnsafePartitionedMapPerformanceTest.java | 24 -
.../GridUnsafePartitionedMapSelfTest.java | 22 -
.../unsafe/GridUnsafeStripedLruSefTest.java | 221 -
.../java/org/gridgain/grid/util/package.html | 15 -
.../tostring/GridToStringBuilderSelfTest.java | 197 -
.../gridgain/grid/util/tostring/package.html | 15 -
.../org/gridgain/jvmtest/BlockingQueueTest.java | 136 -
.../org/gridgain/jvmtest/ConcurrentMapTest.java | 185 -
.../java/org/gridgain/jvmtest/FileIOTest.java | 130 -
.../org/gridgain/jvmtest/FileLocksTest.java | 113 -
.../org/gridgain/jvmtest/LinkedHashMapTest.java | 79 -
.../gridgain/jvmtest/MultipleFileIOTest.java | 126 -
.../gridgain/jvmtest/NetworkFailureTest.java | 362 -
.../QueueSizeCounterMultiThreadedTest.java | 94 -
.../jvmtest/ReadWriteLockMultiThreadedTest.java | 199 -
.../java/org/gridgain/jvmtest/RegExpTest.java | 48 -
.../jvmtest/ServerSocketMultiThreadedTest.java | 94 -
.../loadtests/GridCacheLoadPopulationTask.java | 145 -
.../loadtests/GridCacheMultiNodeLoadTest.java | 98 -
.../cache/GridCacheAbstractLoadTest.java | 368 -
...ridCacheAffinityTransactionsOffHeapTest.java | 250 -
.../loadtests/cache/GridCacheBenchmark.java | 194 -
.../cache/GridCacheDataStructuresLoadTest.java | 357 -
.../cache/GridCacheGroupLockComparisonTest.java | 195 -
.../loadtests/cache/GridCacheLoadTest.java | 154 -
.../cache/GridCachePutRemoveLoadTest.java | 365 -
.../cache/GridCacheSingleNodeLoadTest.java | 176 -
.../loadtests/cache/GridCacheSwapLoadTest.java | 303 -
.../GridCacheWriteBehindStoreLoadTest.java | 200 -
.../capacity/GridCapacityLoadTest.java | 87 -
.../capacity/spring-capacity-cache.xml | 118 -
.../colocation/GridTestCacheStore.java | 122 -
.../loadtests/colocation/GridTestConstants.java | 27 -
.../loadtests/colocation/GridTestKey.java | 84 -
.../colocation/GridTestLifecycleBean.java | 34 -
.../loadtests/colocation/GridTestMain.java | 200 -
.../loadtests/colocation/spring-colocation.xml | 176 -
.../communication/GridIoManagerBenchmark.java | 330 -
.../communication/GridIoManagerBenchmark0.java | 462 -
.../GridTcpCommunicationBenchmark.java | 578 -
.../communication/GridTestMessage.java | 127 -
.../GridContinuousOperationsLoadTest.java | 204 -
.../GridCachePartitionedAtomicLongLoadTest.java | 121 -
.../direct/multisplit/GridLoadTestJob.java | 51 -
.../multisplit/GridLoadTestJobTarget.java | 25 -
.../direct/multisplit/GridLoadTestTask.java | 76 -
.../multisplit/GridMultiSplitsLoadTest.java | 153 -
.../GridMultiSplitsRedeployLoadTest.java | 155 -
.../loadtests/direct/multisplit/package.html | 15 -
.../GridSingleSplitNewNodesTestJobTarget.java | 42 -
.../GridSingleSplitNewNodesTestTask.java | 87 -
...ridSingleSplitsNewNodesAbstractLoadTest.java | 180 -
...idSingleSplitsNewNodesMulticastLoadTest.java | 37 -
.../loadtests/direct/newnodes/package.html | 15 -
.../GridSingleSplitsRedeployLoadTest.java | 167 -
.../loadtests/direct/redeploy/package.html | 15 -
.../direct/session/GridSessionLoadTest.java | 104 -
.../direct/session/GridSessionLoadTestJob.java | 69 -
.../direct/session/GridSessionLoadTestTask.java | 129 -
.../loadtests/direct/session/package.html | 15 -
.../direct/stealing/GridStealingLoadTest.java | 146 -
.../stealing/GridStealingLoadTestJob.java | 52 -
.../stealing/GridStealingLoadTestTask.java | 88 -
.../loadtests/direct/stealing/package.html | 15 -
.../loadtests/discovery/GridGcTimeoutTest.java | 56 -
.../gridgain/loadtests/dsi/GridDsiClient.java | 412 -
.../loadtests/dsi/GridDsiLifecycleBean.java | 51 -
.../gridgain/loadtests/dsi/GridDsiMessage.java | 66 -
.../gridgain/loadtests/dsi/GridDsiPerfJob.java | 333 -
.../gridgain/loadtests/dsi/GridDsiRequest.java | 85 -
.../loadtests/dsi/GridDsiRequestTask.java | 33 -
.../gridgain/loadtests/dsi/GridDsiResponse.java | 79 -
.../loadtests/dsi/GridDsiResponseTask.java | 33 -
.../gridgain/loadtests/dsi/GridDsiSession.java | 76 -
.../cacheget/GridBenchmarkCacheGetLoadTest.java | 111 -
.../org/gridgain/loadtests/dsi/package.html | 15 -
...dBoundedConcurrentLinkedHashSetLoadTest.java | 110 -
.../loadtests/hashmap/GridCacheTestContext.java | 55 -
.../loadtests/hashmap/GridHashMapLoadTest.java | 84 -
.../job/GridJobExecutionLoadTestClient.java | 212 -
...GridJobExecutionLoadTestClientSemaphore.java | 232 -
.../job/GridJobExecutionLoadTestJob.java | 40 -
.../job/GridJobExecutionLoadTestServer.java | 32 -
.../job/GridJobExecutionLoadTestTask.java | 42 -
.../job/GridJobExecutionSingleNodeLoadTest.java | 230 -
...JobExecutionSingleNodeSemaphoreLoadTest.java | 219 -
.../gridgain/loadtests/job/GridJobLoadTest.java | 193 -
.../loadtests/job/GridJobLoadTestJob.java | 153 -
.../loadtests/job/GridJobLoadTestParams.java | 76 -
.../loadtests/job/GridJobLoadTestSubmitter.java | 135 -
.../loadtests/job/GridJobLoadTestTask.java | 65 -
.../org/gridgain/loadtests/job/package.html | 15 -
.../GridConcurrentLinkedHashMapBenchmark.java | 230 -
.../mapper/GridContinuousMapperLoadTest1.java | 43 -
.../mapper/GridContinuousMapperLoadTest2.java | 83 -
.../mapper/GridContinuousMapperTask1.java | 142 -
.../mapper/GridContinuousMapperTask2.java | 80 -
.../loadtests/mapper/GridNodeStartup.java | 48 -
.../gridgain/loadtests/mapper/TestObject.java | 50 -
.../mergesort/GridMergeSortLoadTask.java | 181 -
.../mergesort/GridMergeSortLoadTest.java | 136 -
.../loadtests/nio/GridNioBenchmarkClient.java | 159 -
.../loadtests/nio/GridNioBenchmarkTest.java | 112 -
.../GridOffHeapMapPerformanceAbstractTest.java | 282 -
...apPartitionedMapPerformanceAbstractTest.java | 422 -
.../unsafe/GridUnsafeMapPerformanceTest.java | 22 -
...GridUnsafePartitionedMapPerformanceTest.java | 24 -
.../loadtests/streamer/EventClosure.java | 53 -
.../streamer/GridStreamerBenchmark.java | 132 -
.../streamer/GridStreamerIndexLoadTest.java | 172 -
.../loadtests/streamer/GridStreamerLoad.java | 54 -
.../loadtests/streamer/IndexUpdater.java | 38 -
.../loadtests/streamer/QueryClosure.java | 99 -
.../loadtests/streamer/average/TestAverage.java | 62 -
.../loadtests/streamer/average/TestStage.java | 57 -
.../swap/GridSwapEvictAllBenchmark.java | 284 -
.../loadtests/util/GridCumulativeAverage.java | 55 -
.../loadtests/util/GridLoadTestArgs.java | 275 -
.../startup/GridRandomCommandLineLoader.java | 393 -
.../gridgain/startup/GridVmNodesStarter.java | 263 -
.../test/java/org/gridgain/startup/package.html | 15 -
.../gridgain/testframework/GridFileLock.java | 102 -
.../testframework/GridGgfsTestUtils.java | 47 -
.../testframework/GridJarClassLoader.java | 170 -
.../testframework/GridLoadTestUtils.java | 145 -
.../testframework/GridSpiTestContext.java | 556 -
.../testframework/GridStringLogger.java | 159 -
.../testframework/GridTestClassLoader.java | 102 -
.../GridTestExternalClassLoader.java | 186 -
.../gridgain/testframework/GridTestNode.java | 246 -
.../GridTestSafeThreadFactory.java | 206 -
.../gridgain/testframework/GridTestThread.java | 139 -
.../gridgain/testframework/GridTestUtils.java | 1385 --
.../config/GridTestProperties.java | 296 -
.../gridgain/testframework/config/package.html | 15 -
.../http/GridEmbeddedHttpServer.java | 181 -
.../gridgain/testframework/http/package.html | 15 -
.../testframework/junits/GridAbstractTest.java | 1418 --
.../junits/GridTestKernalContext.java | 75 -
.../testframework/junits/GridTestResources.java | 252 -
.../cache/GridAbstractCacheStoreSelfTest.java | 505 -
.../junits/common/GridAbstractExamplesTest.java | 71 -
.../GridAbstractLifecycleAwareSelfTest.java | 112 -
.../junits/common/GridCommonAbstractTest.java | 556 -
.../junits/common/GridCommonTest.java | 28 -
.../testframework/junits/common/package.html | 15 -
.../logger/GridLog4jRollingFileAppender.java | 106 -
.../junits/logger/GridTestLog4jLogger.java | 508 -
.../gridgain/testframework/junits/package.html | 15 -
.../junits/spi/GridSpiAbstractConfigTest.java | 102 -
.../junits/spi/GridSpiAbstractTest.java | 684 -
.../testframework/junits/spi/GridSpiTest.java | 54 -
.../junits/spi/GridSpiTestConfig.java | 40 -
.../testframework/junits/spi/package.html | 15 -
.../org/gridgain/testframework/package.html | 15 -
.../GridCacheDataStructuresSelfTestSuite.java | 90 -
.../GridCacheEvictionSelfTestSuite.java | 54 -
.../GridCacheFullApiSelfTestSuite.java | 111 -
.../GridCacheGroupLockSelfTestSuite.java | 40 -
.../GridCacheIteratorsSelfTestSuite.java | 34 -
.../GridCacheMetricsSelfTestSuite.java | 41 -
.../GridCacheNearOnlySelfTestSuite.java | 37 -
.../GridCacheTxRecoverySelfTestSuite.java | 38 -
.../GridCacheWriteBehindTestSuite.java | 36 -
.../GridContinuousTaskSelfTestSuite.java | 34 -
.../GridExternalizableSelfTestSuite.java | 29 -
.../GridIpcSharedMemorySelfTestSuite.java | 32 -
.../testsuites/GridJobMetricsSelfTestSuite.java | 30 -
.../testsuites/GridKernalSelfTestSuite.java | 72 -
.../testsuites/GridLangSelfTestSuite.java | 63 -
.../testsuites/GridLoadersSelfTestSuite.java | 30 -
.../testsuites/GridLoggingSelfTestSuite.java | 30 -
.../testsuites/GridMarshallerSelfTestSuite.java | 37 -
.../testsuites/GridP2PSelfTestSuite.java | 46 -
.../testsuites/GridRichSelfTestSuite.java | 34 -
.../GridSpiCheckpointSelfTestSuite.java | 48 -
.../GridSpiCollisionSelfTestSuite.java | 47 -
.../GridSpiCommunicationSelfTestSuite.java | 44 -
.../GridSpiDeploymentSelfTestSuite.java | 32 -
.../GridSpiDiscoverySelfTestSuite.java | 48 -
.../GridSpiEventStorageSelfTestSuite.java | 33 -
.../GridSpiFailoverSelfTestSuite.java | 45 -
.../GridSpiIndexingSelfTestSuite.java | 30 -
.../GridSpiLoadBalancingSelfTestSuite.java | 56 -
.../GridSpiSwapSpaceSelfTestSuite.java | 33 -
.../testsuites/GridStreamerSelfTestSuite.java | 38 -
.../GridTaskSessionSelfTestSuite.java | 48 -
.../GridTimeoutProcessorSelfTestSuite.java | 30 -
.../testsuites/GridUtilSelfTestSuite.java | 63 -
.../testsuites/bamboo/GridBasicTestSuite.java | 69 -
.../bamboo/GridCacheFailoverTestSuite.java | 47 -
.../bamboo/GridComputeGridTestSuite.java | 93 -
.../bamboo/GridDataGridRestartTestSuite.java | 41 -
.../bamboo/GridDataGridTestSuite.java | 319 -
.../testsuites/bamboo/GridGgfsTestSuite.java | 71 -
.../bamboo/GridRestHandlerTestSuite.java | 30 -
.../testsuites/bamboo/GridSpiTestSuite.java | 62 -
.../org/gridgain/testsuites/bamboo/package.html | 15 -
.../java/org/gridgain/testsuites/package.html | 15 -
.../src/test/resources/load/html/index.html | 16 +
.../resources/load/js/gg-loadtest-server.js | 22 +-
modules/core/src/test/resources/readme.txt | 2 +-
.../core/src/test/webapp/META-INF/gg-config.xml | 42 +-
modules/core/src/test/webapp/WEB-INF/web.xml | 26 +-
modules/email/pom.xml | 22 +-
modules/email/readme.txt | 16 +-
.../processors/email/IgniteEmailProcessor.java | 296 +
.../processors/email/GridEmailProcessor.java | 289 -
modules/extdata/p2p/META-INF/gridgain.xml | 28 +-
modules/extdata/p2p/pom.xml | 24 +-
.../tests/p2p/CacheDeploymentTestKey.java | 63 +
.../tests/p2p/CacheDeploymentTestTask1.java | 65 +
.../tests/p2p/CacheDeploymentTestTask2.java | 56 +
.../tests/p2p/CacheDeploymentTestTask3.java | 61 +
.../tests/p2p/CacheDeploymentTestValue.java | 27 +
.../tests/p2p/CacheDeploymentTestValue2.java | 25 +
.../ignite/tests/p2p/ExcludeNodeFilter.java | 52 +
.../p2p/GridCacheDeploymentTestValue3.java | 42 +
.../tests/p2p/GridEventConsumeFilter.java | 31 +
.../GridEventConsumeProjectionPredicate.java | 31 +
.../tests/p2p/GridExternalAffinityFunction.java | 161 +
.../p2p/GridExternalAffinityKeyMapper.java | 38 +
.../tests/p2p/GridP2PAwareTestUserResource.java | 64 +
.../p2p/GridP2PContinuousDeploymentTask1.java | 52 +
.../p2p/GridP2PContinuousDeploymentTask2.java | 46 +
.../p2p/GridP2PEventFilterExternalPath1.java | 49 +
.../p2p/GridP2PEventFilterExternalPath2.java | 49 +
.../tests/p2p/GridSingleSplitTestJobTarget.java | 34 +
.../tests/p2p/GridTestMessageListener.java | 56 +
.../ignite/tests/p2p/GridTestMessageTopic.java | 35 +
.../ignite/tests/p2p/JobStealingTask.java | 119 +
.../tests/p2p/P2PTestTaskExternalPath1.java | 144 +
.../tests/p2p/P2PTestTaskExternalPath2.java | 137 +
.../ignite/tests/p2p/SingleSplitTestTask.java | 76 +
.../ignite/tests/p2p/TestUserResource.java | 27 +
.../org/apache/ignite/tests/p2p/package.html | 23 +
.../tests/p2p/GridCacheDeploymentTestKey.java | 55 -
.../tests/p2p/GridCacheDeploymentTestTask1.java | 58 -
.../tests/p2p/GridCacheDeploymentTestTask2.java | 49 -
.../tests/p2p/GridCacheDeploymentTestTask3.java | 54 -
.../tests/p2p/GridCacheDeploymentTestValue.java | 18 -
.../p2p/GridCacheDeploymentTestValue2.java | 16 -
.../p2p/GridCacheDeploymentTestValue3.java | 34 -
.../grid/tests/p2p/GridEventConsumeFilter.java | 23 -
.../GridEventConsumeProjectionPredicate.java | 23 -
.../grid/tests/p2p/GridExcludeNodeFilter.java | 35 -
.../tests/p2p/GridExternalAffinityFunction.java | 153 -
.../p2p/GridExternalAffinityKeyMapper.java | 30 -
.../GridExternalCacheQueryReducerClosure.java | 35 -
.../tests/p2p/GridP2PAwareTestUserResource.java | 76 -
.../p2p/GridP2PContinuousDeploymentTask1.java | 45 -
.../p2p/GridP2PContinuousDeploymentTask2.java | 39 -
.../p2p/GridP2PEventFilterExternalPath1.java | 47 -
.../p2p/GridP2PEventFilterExternalPath2.java | 47 -
.../tests/p2p/GridP2PTestTaskExternalPath1.java | 148 -
.../tests/p2p/GridP2PTestTaskExternalPath2.java | 137 -
.../tests/p2p/GridSingleSplitTestJobTarget.java | 26 -
.../grid/tests/p2p/GridSingleSplitTestTask.java | 69 -
.../grid/tests/p2p/GridTestMessageListener.java | 48 -
.../grid/tests/p2p/GridTestMessageTopic.java | 27 -
.../grid/tests/p2p/GridTestUserResource.java | 19 -
.../grid/tests/p2p/JobStealingTask.java | 103 -
.../org/gridgain/grid/tests/p2p/package.html | 15 -
modules/extdata/uri/pom.xml | 24 +-
.../GridUriDeploymentAbstractTestTask.java | 23 +-
.../uri/tasks/GridUriDeploymentDependency1.java | 24 +-
.../uri/tasks/GridUriDeploymentDependency2.java | 24 +-
.../tasks/GridUriDeploymentInnerTestTask.java | 23 +-
.../GridUriDeploymentInterfaceTestTask.java | 22 +-
.../GridUriDeploymentNonePublicTestTask.java | 23 +-
.../uri/tasks/GridUriDeploymentTestTask0.java | 23 +-
.../uri/tasks/GridUriDeploymentTestTask1.java | 23 +-
.../uri/tasks/GridUriDeploymentTestTask2.java | 23 +-
.../uri/tasks/GridUriDeploymentTestTask3.java | 23 +-
.../uri/tasks/GridUriDeploymentTestTask4.java | 23 +-
.../uri/tasks/GridUriDeploymentTestTask5.java | 23 +-
.../uri/tasks/GridUriDeploymentTestTask6.java | 23 +-
.../GridUriDeploymentTestWithNameTask0.java | 23 +-
.../GridUriDeploymentTestWithNameTask3.java | 23 +-
.../GridUriDeploymentTestWithNameTask4.java | 23 +-
.../GridUriDeploymentTestWithNameTask5.java | 23 +-
.../GridUriDeploymentTestWithNameTask6.java | 23 +-
.../GridUriDeploymentTestWithNameTask7.java | 23 +-
.../spi/deployment/uri/tasks/package.html | 25 +-
.../ignite/spi/deployment/uri/tasks/spring1.xml | 22 +-
.../ignite/spi/deployment/uri/tasks/spring2.xml | 22 +-
.../spi/deployment/uri/tasks/test1.properties | 20 +-
.../spi/deployment/uri/tasks/test2.properties | 20 +-
.../java/org/apache/ignite/test/test.properties | 23 +
.../main/java/org/gridgain/test/test.properties | 17 -
modules/hadoop/pom.xml | 22 +-
modules/hadoop/readme.txt | 16 +-
.../client/hadoop/GridHadoopClientProtocol.java | 333 +
.../GridHadoopClientProtocolProvider.java | 137 +
.../counter/GridHadoopClientCounterGroup.java | 121 +
.../counter/GridHadoopClientCounters.java | 217 +
.../apache/ignite/client/hadoop/package.html | 23 +
.../fs/hadoop/GridGgfsHadoopParameters.java | 94 +
.../org/apache/ignite/fs/hadoop/package.html | 23 +
.../fs/hadoop/v1/GridGgfsHadoopFileSystem.java | 1253 ++
.../org/apache/ignite/fs/hadoop/v1/package.html | 23 +
.../fs/hadoop/v2/GridGgfsHadoopFileSystem.java | 1007 ++
.../org/apache/ignite/fs/hadoop/v2/package.html | 23 +
.../main/java/org/apache/ignite/fs/package.html | 23 +
.../ignite/hadoop/GridHadoopDefaultJobInfo.java | 163 +
.../apache/ignite/hadoop/GridHadoopSetup.java | 506 +
.../internal/fs/hadoop/GridGgfsHadoop.java | 198 +
.../GridGgfsHadoopCommunicationException.java | 57 +
.../fs/hadoop/GridGgfsHadoopEndpoint.java | 210 +
.../internal/fs/hadoop/GridGgfsHadoopEx.java | 88 +
.../fs/hadoop/GridGgfsHadoopFSProperties.java | 88 +
.../hadoop/GridGgfsHadoopFileSystemWrapper.java | 413 +
.../fs/hadoop/GridGgfsHadoopFuture.java | 94 +
.../fs/hadoop/GridGgfsHadoopInProc.java | 366 +
.../fs/hadoop/GridGgfsHadoopInputStream.java | 626 +
.../internal/fs/hadoop/GridGgfsHadoopIo.java | 76 +
.../internal/fs/hadoop/GridGgfsHadoopIpcIo.java | 599 +
.../fs/hadoop/GridGgfsHadoopIpcIoListener.java | 36 +
.../fs/hadoop/GridGgfsHadoopJclLogger.java | 115 +
.../fs/hadoop/GridGgfsHadoopOutProc.java | 466 +
.../fs/hadoop/GridGgfsHadoopOutputStream.java | 201 +
.../hadoop/GridGgfsHadoopProxyInputStream.java | 335 +
.../hadoop/GridGgfsHadoopProxyOutputStream.java | 165 +
.../fs/hadoop/GridGgfsHadoopReader.java | 103 +
.../fs/hadoop/GridGgfsHadoopStreamDelegate.java | 96 +
.../GridGgfsHadoopStreamEventListener.java | 39 +
.../internal/fs/hadoop/GridGgfsHadoopUtils.java | 131 +
.../fs/hadoop/GridGgfsHadoopWrapper.java | 511 +
.../ignite/internal/fs/hadoop/package.html | 23 +
.../org/apache/ignite/internal/fs/package.html | 23 +
.../hadoop/GridHadoopClassLoader.java | 552 +
.../processors/hadoop/GridHadoopComponent.java | 61 +
.../processors/hadoop/GridHadoopContext.java | 197 +
.../processors/hadoop/GridHadoopImpl.java | 133 +
.../GridHadoopTaskCancelledException.java | 35 +
.../processors/hadoop/GridHadoopUtils.java | 306 +
.../hadoop/IgniteHadoopProcessor.java | 226 +
.../counter/GridHadoopCounterAdapter.java | 128 +
.../hadoop/counter/GridHadoopCountersImpl.java | 198 +
.../counter/GridHadoopFSCounterWriter.java | 90 +
.../hadoop/counter/GridHadoopLongCounter.java | 91 +
.../counter/GridHadoopPerformanceCounter.java | 279 +
.../fs/GridHadoopDistributedFileSystem.java | 91 +
.../hadoop/fs/GridHadoopFileSystemsUtils.java | 57 +
.../hadoop/fs/GridHadoopLocalFileSystemV1.java | 39 +
.../hadoop/fs/GridHadoopLocalFileSystemV2.java | 86 +
.../hadoop/fs/GridHadoopRawLocalFileSystem.java | 304 +
.../jobtracker/GridHadoopJobMetadata.java | 305 +
.../hadoop/jobtracker/GridHadoopJobTracker.java | 1628 ++
.../hadoop/message/GridHadoopMessage.java | 27 +
.../planner/GridHadoopDefaultMapReducePlan.java | 107 +
.../GridHadoopDefaultMapReducePlanner.java | 429 +
.../GridHadoopProtocolJobCountersTask.java | 45 +
.../proto/GridHadoopProtocolJobStatusTask.java | 81 +
.../proto/GridHadoopProtocolKillJobTask.java | 46 +
.../proto/GridHadoopProtocolNextTaskIdTask.java | 36 +
.../proto/GridHadoopProtocolSubmitJobTask.java | 57 +
.../proto/GridHadoopProtocolTaskAdapter.java | 105 +
.../proto/GridHadoopProtocolTaskArguments.java | 81 +
.../hadoop/shuffle/GridHadoopShuffle.java | 257 +
.../hadoop/shuffle/GridHadoopShuffleAck.java | 91 +
.../hadoop/shuffle/GridHadoopShuffleJob.java | 593 +
.../shuffle/GridHadoopShuffleMessage.java | 241 +
.../GridHadoopConcurrentHashMultimap.java | 611 +
.../collections/GridHadoopHashMultimap.java | 174 +
.../collections/GridHadoopHashMultimapBase.java | 208 +
.../shuffle/collections/GridHadoopMultimap.java | 112 +
.../collections/GridHadoopMultimapBase.java | 368 +
.../shuffle/collections/GridHadoopSkipList.java | 726 +
.../shuffle/streams/GridHadoopDataInStream.java | 170 +
.../streams/GridHadoopDataOutStream.java | 131 +
.../streams/GridHadoopOffheapBuffer.java | 122 +
.../GridHadoopEmbeddedTaskExecutor.java | 146 +
.../taskexecutor/GridHadoopExecutorService.java | 231 +
.../taskexecutor/GridHadoopRunnableTask.java | 269 +
.../GridHadoopTaskExecutorAdapter.java | 58 +
.../taskexecutor/GridHadoopTaskState.java | 38 +
.../taskexecutor/GridHadoopTaskStatus.java | 114 +
.../GridHadoopExternalTaskExecutor.java | 961 ++
.../GridHadoopExternalTaskMetadata.java | 68 +
.../GridHadoopJobInfoUpdateRequest.java | 109 +
.../GridHadoopPrepareForJobRequest.java | 126 +
.../external/GridHadoopProcessDescriptor.java | 150 +
.../external/GridHadoopProcessStartedAck.java | 46 +
.../GridHadoopTaskExecutionRequest.java | 110 +
.../external/GridHadoopTaskFinishedMessage.java | 92 +
.../child/GridHadoopChildProcessRunner.java | 440 +
.../child/GridHadoopExternalProcessStarter.java | 296 +
.../GridHadoopAbstractCommunicationClient.java | 96 +
.../GridHadoopCommunicationClient.java | 72 +
.../GridHadoopExternalCommunication.java | 1420 ++
.../GridHadoopHandshakeTimeoutException.java | 42 +
.../GridHadoopIpcToNioAdapter.java | 239 +
.../GridHadoopMarshallerFilter.java | 84 +
.../GridHadoopMessageListener.java | 39 +
.../GridHadoopTcpNioCommunicationClient.java | 99 +
.../hadoop/v1/GridHadoopV1CleanupTask.java | 62 +
.../hadoop/v1/GridHadoopV1Counter.java | 105 +
.../hadoop/v1/GridHadoopV1MapTask.java | 108 +
.../hadoop/v1/GridHadoopV1OutputCollector.java | 133 +
.../hadoop/v1/GridHadoopV1Partitioner.java | 44 +
.../hadoop/v1/GridHadoopV1ReduceTask.java | 93 +
.../hadoop/v1/GridHadoopV1Reporter.java | 79 +
.../hadoop/v1/GridHadoopV1SetupTask.java | 56 +
.../hadoop/v1/GridHadoopV1Splitter.java | 98 +
.../processors/hadoop/v1/GridHadoopV1Task.java | 97 +
.../hadoop/v2/GridHadoopExternalSplit.java | 87 +
.../hadoop/v2/GridHadoopNativeCodeLoader.java | 74 +
.../v2/GridHadoopSerializationWrapper.java | 133 +
.../v2/GridHadoopShutdownHookManager.java | 96 +
.../hadoop/v2/GridHadoopSplitWrapper.java | 119 +
.../hadoop/v2/GridHadoopV2CleanupTask.java | 70 +
.../hadoop/v2/GridHadoopV2Context.java | 231 +
.../hadoop/v2/GridHadoopV2Counter.java | 87 +
.../processors/hadoop/v2/GridHadoopV2Job.java | 281 +
.../v2/GridHadoopV2JobResourceManager.java | 304 +
.../hadoop/v2/GridHadoopV2MapTask.java | 104 +
.../hadoop/v2/GridHadoopV2Partitioner.java | 44 +
.../hadoop/v2/GridHadoopV2ReduceTask.java | 86 +
.../hadoop/v2/GridHadoopV2SetupTask.java | 64 +
.../hadoop/v2/GridHadoopV2Splitter.java | 105 +
.../processors/hadoop/v2/GridHadoopV2Task.java | 181 +
.../hadoop/v2/GridHadoopV2TaskContext.java | 444 +
.../v2/GridHadoopWritableSerialization.java | 74 +
.../client/hadoop/GridHadoopClientProtocol.java | 326 -
.../GridHadoopClientProtocolProvider.java | 130 -
.../counter/GridHadoopClientCounterGroup.java | 113 -
.../counter/GridHadoopClientCounters.java | 209 -
.../org/gridgain/client/hadoop/package.html | 15 -
.../ggfs/hadoop/GridGgfsHadoopParameters.java | 86 -
.../org/gridgain/grid/ggfs/hadoop/package.html | 15 -
.../hadoop/v1/GridGgfsHadoopFileSystem.java | 1246 --
.../gridgain/grid/ggfs/hadoop/v1/package.html | 15 -
.../hadoop/v2/GridGgfsHadoopFileSystem.java | 1000 --
.../gridgain/grid/ggfs/hadoop/v2/package.html | 15 -
.../java/org/gridgain/grid/ggfs/package.html | 15 -
.../grid/hadoop/GridHadoopDefaultJobInfo.java | 156 -
.../gridgain/grid/hadoop/GridHadoopSetup.java | 498 -
.../grid/kernal/ggfs/hadoop/GridGgfsHadoop.java | 191 -
.../GridGgfsHadoopCommunicationException.java | 52 -
.../ggfs/hadoop/GridGgfsHadoopEndpoint.java | 203 -
.../kernal/ggfs/hadoop/GridGgfsHadoopEx.java | 80 -
.../ggfs/hadoop/GridGgfsHadoopFSProperties.java | 81 -
.../hadoop/GridGgfsHadoopFileSystemWrapper.java | 406 -
.../ggfs/hadoop/GridGgfsHadoopFuture.java | 86 -
.../ggfs/hadoop/GridGgfsHadoopInProc.java | 359 -
.../ggfs/hadoop/GridGgfsHadoopInputStream.java | 619 -
.../kernal/ggfs/hadoop/GridGgfsHadoopIo.java | 69 -
.../kernal/ggfs/hadoop/GridGgfsHadoopIpcIo.java | 592 -
.../hadoop/GridGgfsHadoopIpcIoListener.java | 28 -
.../ggfs/hadoop/GridGgfsHadoopJclLogger.java | 107 -
.../ggfs/hadoop/GridGgfsHadoopOutProc.java | 459 -
.../ggfs/hadoop/GridGgfsHadoopOutputStream.java | 194 -
.../hadoop/GridGgfsHadoopProxyInputStream.java | 327 -
.../hadoop/GridGgfsHadoopProxyOutputStream.java | 157 -
.../ggfs/hadoop/GridGgfsHadoopReader.java | 95 -
.../hadoop/GridGgfsHadoopStreamDelegate.java | 88 -
.../GridGgfsHadoopStreamEventListener.java | 32 -
.../kernal/ggfs/hadoop/GridGgfsHadoopUtils.java | 124 -
.../ggfs/hadoop/GridGgfsHadoopWrapper.java | 504 -
.../grid/kernal/ggfs/hadoop/package.html | 15 -
.../org/gridgain/grid/kernal/ggfs/package.html | 15 -
.../hadoop/GridHadoopClassLoader.java | 545 -
.../processors/hadoop/GridHadoopComponent.java | 54 -
.../processors/hadoop/GridHadoopContext.java | 189 -
.../processors/hadoop/GridHadoopImpl.java | 126 -
.../processors/hadoop/GridHadoopProcessor.java | 220 -
.../GridHadoopTaskCancelledException.java | 28 -
.../processors/hadoop/GridHadoopUtils.java | 299 -
.../counter/GridHadoopCounterAdapter.java | 120 -
.../hadoop/counter/GridHadoopCountersImpl.java | 191 -
.../counter/GridHadoopFSCounterWriter.java | 83 -
.../hadoop/counter/GridHadoopLongCounter.java | 83 -
.../counter/GridHadoopPerformanceCounter.java | 259 -
.../fs/GridHadoopDistributedFileSystem.java | 83 -
.../hadoop/fs/GridHadoopFileSystemsUtils.java | 49 -
.../hadoop/fs/GridHadoopLocalFileSystemV1.java | 31 -
.../hadoop/fs/GridHadoopLocalFileSystemV2.java | 78 -
.../hadoop/fs/GridHadoopRawLocalFileSystem.java | 296 -
.../jobtracker/GridHadoopJobMetadata.java | 297 -
.../hadoop/jobtracker/GridHadoopJobTracker.java | 1560 --
.../hadoop/message/GridHadoopMessage.java | 19 -
.../planner/GridHadoopDefaultMapReducePlan.java | 99 -
.../GridHadoopDefaultMapReducePlanner.java | 422 -
.../GridHadoopProtocolJobCountersTask.java | 38 -
.../proto/GridHadoopProtocolJobStatusTask.java | 73 -
.../proto/GridHadoopProtocolKillJobTask.java | 39 -
.../proto/GridHadoopProtocolNextTaskIdTask.java | 29 -
.../proto/GridHadoopProtocolSubmitJobTask.java | 50 -
.../proto/GridHadoopProtocolTaskAdapter.java | 98 -
.../proto/GridHadoopProtocolTaskArguments.java | 73 -
.../hadoop/shuffle/GridHadoopShuffle.java | 250 -
.../hadoop/shuffle/GridHadoopShuffleAck.java | 83 -
.../hadoop/shuffle/GridHadoopShuffleJob.java | 585 -
.../shuffle/GridHadoopShuffleMessage.java | 234 -
.../GridHadoopConcurrentHashMultimap.java | 604 -
.../collections/GridHadoopHashMultimap.java | 167 -
.../collections/GridHadoopHashMultimapBase.java | 201 -
.../shuffle/collections/GridHadoopMultimap.java | 105 -
.../collections/GridHadoopMultimapBase.java | 361 -
.../shuffle/collections/GridHadoopSkipList.java | 719 -
.../shuffle/streams/GridHadoopDataInStream.java | 162 -
.../streams/GridHadoopDataOutStream.java | 123 -
.../streams/GridHadoopOffheapBuffer.java | 114 -
.../GridHadoopEmbeddedTaskExecutor.java | 139 -
.../taskexecutor/GridHadoopExecutorService.java | 224 -
.../taskexecutor/GridHadoopRunnableTask.java | 262 -
.../GridHadoopTaskExecutorAdapter.java | 51 -
.../taskexecutor/GridHadoopTaskState.java | 30 -
.../taskexecutor/GridHadoopTaskStatus.java | 106 -
.../GridHadoopExternalTaskExecutor.java | 954 --
.../GridHadoopExternalTaskMetadata.java | 60 -
.../GridHadoopJobInfoUpdateRequest.java | 101 -
.../GridHadoopPrepareForJobRequest.java | 118 -
.../external/GridHadoopProcessDescriptor.java | 142 -
.../external/GridHadoopProcessStartedAck.java | 38 -
.../GridHadoopTaskExecutionRequest.java | 102 -
.../external/GridHadoopTaskFinishedMessage.java | 84 -
.../child/GridHadoopChildProcessRunner.java | 433 -
.../child/GridHadoopExternalProcessStarter.java | 289 -
.../GridHadoopAbstractCommunicationClient.java | 88 -
.../GridHadoopCommunicationClient.java | 65 -
.../GridHadoopExternalCommunication.java | 1413 --
.../GridHadoopHandshakeTimeoutException.java | 35 -
.../GridHadoopIpcToNioAdapter.java | 232 -
.../GridHadoopMarshallerFilter.java | 77 -
.../GridHadoopMessageListener.java | 31 -
.../GridHadoopTcpNioCommunicationClient.java | 92 -
.../hadoop/v1/GridHadoopV1CleanupTask.java | 55 -
.../hadoop/v1/GridHadoopV1Counter.java | 97 -
.../hadoop/v1/GridHadoopV1MapTask.java | 101 -
.../hadoop/v1/GridHadoopV1OutputCollector.java | 126 -
.../hadoop/v1/GridHadoopV1Partitioner.java | 36 -
.../hadoop/v1/GridHadoopV1ReduceTask.java | 86 -
.../hadoop/v1/GridHadoopV1Reporter.java | 71 -
.../hadoop/v1/GridHadoopV1SetupTask.java | 49 -
.../hadoop/v1/GridHadoopV1Splitter.java | 91 -
.../processors/hadoop/v1/GridHadoopV1Task.java | 89 -
.../hadoop/v2/GridHadoopExternalSplit.java | 79 -
.../hadoop/v2/GridHadoopNativeCodeLoader.java | 66 -
.../v2/GridHadoopSerializationWrapper.java | 126 -
.../v2/GridHadoopShutdownHookManager.java | 88 -
.../hadoop/v2/GridHadoopSplitWrapper.java | 111 -
.../hadoop/v2/GridHadoopV2CleanupTask.java | 63 -
.../hadoop/v2/GridHadoopV2Context.java | 224 -
.../hadoop/v2/GridHadoopV2Counter.java | 79 -
.../processors/hadoop/v2/GridHadoopV2Job.java | 274 -
.../v2/GridHadoopV2JobResourceManager.java | 297 -
.../hadoop/v2/GridHadoopV2MapTask.java | 97 -
.../hadoop/v2/GridHadoopV2Partitioner.java | 36 -
.../hadoop/v2/GridHadoopV2ReduceTask.java | 79 -
.../hadoop/v2/GridHadoopV2SetupTask.java | 57 -
.../hadoop/v2/GridHadoopV2Splitter.java | 98 -
.../processors/hadoop/v2/GridHadoopV2Task.java | 174 -
.../hadoop/v2/GridHadoopV2TaskContext.java | 436 -
.../v2/GridHadoopWritableSerialization.java | 67 -
...op.mapreduce.protocol.ClientProtocolProvider | 2 +-
...ridHadoopClientProtocolEmbeddedSelfTest.java | 34 +
.../GridHadoopClientProtocolSelfTest.java | 633 +
.../apache/ignite/fs/GridFileSystemLoad.java | 548 +
...dGgfsHadoop20FileSystemAbstractSelfTest.java | 1967 +++
...doop20FileSystemLoopbackPrimarySelfTest.java | 74 +
...sHadoop20FileSystemShmemPrimarySelfTest.java | 74 +
.../fs/GridGgfsHadoopDualAbstractSelfTest.java | 303 +
.../fs/GridGgfsHadoopDualAsyncSelfTest.java | 32 +
.../fs/GridGgfsHadoopDualSyncSelfTest.java | 32 +
...ridGgfsHadoopFileSystemAbstractSelfTest.java | 2365 +++
.../GridGgfsHadoopFileSystemClientSelfTest.java | 200 +
...idGgfsHadoopFileSystemHandshakeSelfTest.java | 311 +
...ridGgfsHadoopFileSystemIpcCacheSelfTest.java | 207 +
.../GridGgfsHadoopFileSystemLoggerSelfTest.java | 288 +
...GgfsHadoopFileSystemLoggerStateSelfTest.java | 325 +
...adoopFileSystemLoopbackAbstractSelfTest.java | 46 +
...SystemLoopbackEmbeddedDualAsyncSelfTest.java | 33 +
...eSystemLoopbackEmbeddedDualSyncSelfTest.java | 33 +
...leSystemLoopbackEmbeddedPrimarySelfTest.java | 33 +
...SystemLoopbackEmbeddedSecondarySelfTest.java | 34 +
...SystemLoopbackExternalDualAsyncSelfTest.java | 33 +
...eSystemLoopbackExternalDualSyncSelfTest.java | 33 +
...leSystemLoopbackExternalPrimarySelfTest.java | 33 +
...SystemLoopbackExternalSecondarySelfTest.java | 34 +
...fsHadoopFileSystemSecondaryModeSelfTest.java | 319 +
...fsHadoopFileSystemShmemAbstractSelfTest.java | 88 +
...ileSystemShmemEmbeddedDualAsyncSelfTest.java | 33 +
...FileSystemShmemEmbeddedDualSyncSelfTest.java | 33 +
...pFileSystemShmemEmbeddedPrimarySelfTest.java | 33 +
...ileSystemShmemEmbeddedSecondarySelfTest.java | 33 +
...ileSystemShmemExternalDualAsyncSelfTest.java | 33 +
...FileSystemShmemExternalDualSyncSelfTest.java | 33 +
...pFileSystemShmemExternalPrimarySelfTest.java | 33 +
...ileSystemShmemExternalSecondarySelfTest.java | 33 +
.../fs/GridGgfsNearOnlyMultiNodeSelfTest.java | 212 +
.../ignite/fs/IgniteFsEventsTestSuite.java | 267 +
.../hadoop/GridHadoopPopularWordsTest.java | 294 +
.../ignite/hadoop/GridHadoopTestUtils.java | 102 +
.../ignite/hadoop/books/alice-in-wonderland.txt | 3735 +++++
.../apache/ignite/hadoop/books/art-of-war.txt | 6982 +++++++++
.../ignite/hadoop/books/huckleberry-finn.txt | 11733 +++++++++++++++
.../ignite/hadoop/books/sherlock-holmes.txt | 13052 +++++++++++++++++
.../apache/ignite/hadoop/books/tom-sawyer.txt | 8858 +++++++++++
.../hadoop/GridHadoopAbstractSelfTest.java | 210 +
.../hadoop/GridHadoopAbstractWordCountTest.java | 138 +
.../hadoop/GridHadoopClassLoaderTest.java | 69 +
.../hadoop/GridHadoopCommandLineTest.java | 441 +
...idHadoopDefaultMapReducePlannerSelfTest.java | 1222 ++
.../hadoop/GridHadoopFileSystemsTest.java | 176 +
.../hadoop/GridHadoopGroupingTest.java | 287 +
.../hadoop/GridHadoopJobTrackerSelfTest.java | 331 +
.../GridHadoopMapReduceEmbeddedSelfTest.java | 246 +
.../hadoop/GridHadoopMapReduceTest.java | 201 +
.../GridHadoopSerializationWrapperSelfTest.java | 75 +
.../processors/hadoop/GridHadoopSharedMap.java | 67 +
.../hadoop/GridHadoopSortingExternalTest.java | 34 +
.../hadoop/GridHadoopSortingTest.java | 283 +
.../hadoop/GridHadoopSplitWrapperSelfTest.java | 68 +
.../processors/hadoop/GridHadoopStartup.java | 54 +
.../hadoop/GridHadoopTaskExecutionSelfTest.java | 550 +
.../hadoop/GridHadoopTasksAllVersionsTest.java | 260 +
.../hadoop/GridHadoopTasksV1Test.java | 58 +
.../hadoop/GridHadoopTasksV2Test.java | 76 +
.../GridHadoopTestRoundRobinMrPlanner.java | 67 +
.../hadoop/GridHadoopTestTaskContext.java | 220 +
.../hadoop/GridHadoopV2JobSelfTest.java | 89 +
.../hadoop/GridHadoopValidationSelfTest.java | 53 +
.../hadoop/examples/GridHadoopWordCount1.java | 88 +
.../examples/GridHadoopWordCount1Map.java | 62 +
.../examples/GridHadoopWordCount1Reduce.java | 51 +
.../hadoop/examples/GridHadoopWordCount2.java | 95 +
.../examples/GridHadoopWordCount2Mapper.java | 72 +
.../examples/GridHadoopWordCount2Reducer.java | 71 +
.../collections/GridHadoopAbstractMapTest.java | 152 +
...ridHadoopConcurrentHashMultimapSelftest.java | 267 +
.../collections/GridHadoopHashMapSelfTest.java | 170 +
.../collections/GridHadoopSkipListSelfTest.java | 303 +
.../streams/GridHadoopDataStreamSelfTest.java | 151 +
.../GridHadoopExecutorServiceTest.java | 119 +
...GridHadoopExternalTaskExecutionSelfTest.java | 211 +
...GridHadoopExternalCommunicationSelfTest.java | 209 +
.../loadtests/ggfs/GridGgfsNodeStartup.java | 49 +
.../ggfs/GridGgfsPerformanceBenchmark.java | 273 +
.../IgniteFsLinuxAndMacOSTestSuite.java | 63 +
.../testsuites/IgniteHadoopTestSuite.java | 263 +
...ridHadoopClientProtocolEmbeddedSelfTest.java | 26 -
.../GridHadoopClientProtocolSelfTest.java | 625 -
.../gridgain/grid/ggfs/GridFileSystemLoad.java | 540 -
.../grid/ggfs/GridGgfsEventsTestSuite.java | 250 -
...dGgfsHadoop20FileSystemAbstractSelfTest.java | 1961 ---
...doop20FileSystemLoopbackPrimarySelfTest.java | 61 -
...sHadoop20FileSystemShmemPrimarySelfTest.java | 61 -
.../GridGgfsHadoopDualAbstractSelfTest.java | 289 -
.../ggfs/GridGgfsHadoopDualAsyncSelfTest.java | 24 -
.../ggfs/GridGgfsHadoopDualSyncSelfTest.java | 24 -
...ridGgfsHadoopFileSystemAbstractSelfTest.java | 2360 ---
.../GridGgfsHadoopFileSystemClientSelfTest.java | 191 -
...idGgfsHadoopFileSystemHandshakeSelfTest.java | 299 -
...ridGgfsHadoopFileSystemIpcCacheSelfTest.java | 199 -
.../GridGgfsHadoopFileSystemLoggerSelfTest.java | 280 -
...GgfsHadoopFileSystemLoggerStateSelfTest.java | 315 -
...adoopFileSystemLoopbackAbstractSelfTest.java | 35 -
...SystemLoopbackEmbeddedDualAsyncSelfTest.java | 23 -
...eSystemLoopbackEmbeddedDualSyncSelfTest.java | 23 -
...leSystemLoopbackEmbeddedPrimarySelfTest.java | 25 -
...SystemLoopbackEmbeddedSecondarySelfTest.java | 26 -
...SystemLoopbackExternalDualAsyncSelfTest.java | 23 -
...eSystemLoopbackExternalDualSyncSelfTest.java | 23 -
...leSystemLoopbackExternalPrimarySelfTest.java | 25 -
...SystemLoopbackExternalSecondarySelfTest.java | 26 -
...fsHadoopFileSystemSecondaryModeSelfTest.java | 306 -
...fsHadoopFileSystemShmemAbstractSelfTest.java | 79 -
...ileSystemShmemEmbeddedDualAsyncSelfTest.java | 23 -
...FileSystemShmemEmbeddedDualSyncSelfTest.java | 23 -
...pFileSystemShmemEmbeddedPrimarySelfTest.java | 23 -
...ileSystemShmemEmbeddedSecondarySelfTest.java | 23 -
...ileSystemShmemExternalDualAsyncSelfTest.java | 23 -
...FileSystemShmemExternalDualSyncSelfTest.java | 23 -
...pFileSystemShmemExternalPrimarySelfTest.java | 23 -
...ileSystemShmemExternalSecondarySelfTest.java | 23 -
.../ggfs/GridGgfsNearOnlyMultiNodeSelfTest.java | 204 -
.../grid/hadoop/GridHadoopPopularWordsTest.java | 286 -
.../grid/hadoop/GridHadoopTestUtils.java | 78 -
.../grid/hadoop/books/alice-in-wonderland.txt | 3735 -----
.../gridgain/grid/hadoop/books/art-of-war.txt | 6982 ---------
.../grid/hadoop/books/huckleberry-finn.txt | 11733 ---------------
.../grid/hadoop/books/sherlock-holmes.txt | 13052 -----------------
.../gridgain/grid/hadoop/books/tom-sawyer.txt | 8858 -----------
.../hadoop/GridHadoopAbstractSelfTest.java | 202 -
.../hadoop/GridHadoopAbstractWordCountTest.java | 130 -
.../hadoop/GridHadoopClassLoaderTest.java | 61 -
.../hadoop/GridHadoopCommandLineTest.java | 433 -
...idHadoopDefaultMapReducePlannerSelfTest.java | 1215 --
.../hadoop/GridHadoopFileSystemsTest.java | 168 -
.../hadoop/GridHadoopGroupingTest.java | 279 -
.../hadoop/GridHadoopJobTrackerSelfTest.java | 324 -
.../GridHadoopMapReduceEmbeddedSelfTest.java | 238 -
.../hadoop/GridHadoopMapReduceTest.java | 192 -
.../GridHadoopSerializationWrapperSelfTest.java | 68 -
.../processors/hadoop/GridHadoopSharedMap.java | 59 -
.../hadoop/GridHadoopSortingExternalTest.java | 26 -
.../hadoop/GridHadoopSortingTest.java | 275 -
.../hadoop/GridHadoopSplitWrapperSelfTest.java | 61 -
.../processors/hadoop/GridHadoopStartup.java | 47 -
.../hadoop/GridHadoopTaskExecutionSelfTest.java | 543 -
.../hadoop/GridHadoopTasksAllVersionsTest.java | 253 -
.../hadoop/GridHadoopTasksV1Test.java | 50 -
.../hadoop/GridHadoopTasksV2Test.java | 68 -
.../GridHadoopTestRoundRobinMrPlanner.java | 60 -
.../hadoop/GridHadoopTestTaskContext.java | 213 -
.../hadoop/GridHadoopV2JobSelfTest.java | 82 -
.../hadoop/GridHadoopValidationSelfTest.java | 45 -
.../hadoop/examples/GridHadoopWordCount1.java | 80 -
.../examples/GridHadoopWordCount1Map.java | 54 -
.../examples/GridHadoopWordCount1Reduce.java | 43 -
.../hadoop/examples/GridHadoopWordCount2.java | 87 -
.../examples/GridHadoopWordCount2Mapper.java | 64 -
.../examples/GridHadoopWordCount2Reducer.java | 63 -
.../collections/GridHadoopAbstractMapTest.java | 145 -
...ridHadoopConcurrentHashMultimapSelftest.java | 259 -
.../collections/GridHadoopHashMapSelfTest.java | 162 -
.../collections/GridHadoopSkipListSelfTest.java | 295 -
.../streams/GridHadoopDataStreamSelfTest.java | 143 -
.../GridHadoopExecutorServiceTest.java | 102 -
...GridHadoopExternalTaskExecutionSelfTest.java | 204 -
...GridHadoopExternalCommunicationSelfTest.java | 201 -
.../loadtests/ggfs/GridGgfsNodeStartup.java | 42 -
.../ggfs/GridGgfsPerformanceBenchmark.java | 265 -
.../bamboo/GridGgfsLinuxAndMacOSTestSuite.java | 55 -
.../testsuites/bamboo/GridHadoopTestSuite.java | 255 -
modules/hibernate/pom.xml | 22 +-
modules/hibernate/readme.txt | 18 +-
...idHibernateAbstractRegionAccessStrategy.java | 97 +
.../GridHibernateAccessStrategyAdapter.java | 367 +
.../GridHibernateCollectionRegion.java | 99 +
.../hibernate/GridHibernateEntityRegion.java | 110 +
.../GridHibernateGeneralDataRegion.java | 69 +
.../hibernate/GridHibernateNaturalIdRegion.java | 98 +
.../GridHibernateNonStrictAccessStrategy.java | 220 +
.../GridHibernateQueryResultsRegion.java | 71 +
.../GridHibernateReadOnlyAccessStrategy.java | 106 +
.../GridHibernateReadWriteAccessStrategy.java | 282 +
.../cache/hibernate/GridHibernateRegion.java | 101 +
.../hibernate/GridHibernateRegionFactory.java | 230 +
.../GridHibernateTimestampsRegion.java | 40 +
...ridHibernateTransactionalAccessStrategy.java | 139 +
.../GridHibernateTransactionalDataRegion.java | 96 +
.../apache/ignite/cache/hibernate/package.html | 26 +
.../hibernate/GridCacheHibernateBlobStore.java | 593 +
.../GridCacheHibernateBlobStoreEntry.hbm.xml | 29 +
.../GridCacheHibernateBlobStoreEntry.java | 86 +
.../ignite/cache/store/hibernate/package.html | 23 +
...idHibernateAbstractRegionAccessStrategy.java | 89 -
.../GridHibernateAccessStrategyAdapter.java | 360 -
.../GridHibernateCollectionRegion.java | 91 -
.../hibernate/GridHibernateEntityRegion.java | 102 -
.../GridHibernateGeneralDataRegion.java | 62 -
.../hibernate/GridHibernateNaturalIdRegion.java | 90 -
.../GridHibernateNonStrictAccessStrategy.java | 213 -
.../GridHibernateQueryResultsRegion.java | 63 -
.../GridHibernateReadOnlyAccessStrategy.java | 99 -
.../GridHibernateReadWriteAccessStrategy.java | 274 -
.../cache/hibernate/GridHibernateRegion.java | 93 -
.../hibernate/GridHibernateRegionFactory.java | 222 -
.../GridHibernateTimestampsRegion.java | 32 -
...ridHibernateTransactionalAccessStrategy.java | 132 -
.../GridHibernateTransactionalDataRegion.java | 88 -
.../gridgain/grid/cache/hibernate/package.html | 17 -
.../hibernate/GridCacheHibernateBlobStore.java | 555 -
.../GridCacheHibernateBlobStoreEntry.hbm.xml | 12 -
.../GridCacheHibernateBlobStoreEntry.java | 78 -
.../grid/cache/store/hibernate/package.html | 15 -
...idHibernateL2CacheConfigurationSelfTest.java | 380 +
.../hibernate/GridHibernateL2CacheSelfTest.java | 1923 +++
...idHibernateL2CacheTransactionalSelfTest.java | 135 +
.../GridCacheHibernateBlobStoreSelfTest.java | 108 +
.../cache/store/hibernate/hibernate.cfg.xml | 40 +
.../ignite/cache/store/hibernate/package.html | 23 +
.../testsuites/IgniteHibernateTestSuite.java | 44 +
...idHibernateL2CacheConfigurationSelfTest.java | 371 -
.../hibernate/GridHibernateL2CacheSelfTest.java | 1914 ---
...idHibernateL2CacheTransactionalSelfTest.java | 127 -
.../GridCacheHibernateBlobStoreSelfTest.java | 100 -
.../cache/store/hibernate/hibernate.cfg.xml | 23 -
.../grid/cache/store/hibernate/package.html | 15 -
.../bamboo/GridHibernateTestSuite.java | 36 -
modules/indexing/pom.xml | 22 +-
modules/indexing/readme.txt | 16 +-
.../query/h2/GridH2ResultSetIterator.java | 130 +
.../processors/query/h2/IgniteH2Indexing.java | 2015 +++
.../query/h2/opt/GridH2AbstractKeyValueRow.java | 455 +
.../processors/query/h2/opt/GridH2Cursor.java | 70 +
.../query/h2/opt/GridH2IndexBase.java | 209 +
.../query/h2/opt/GridH2KeyValueRowOffheap.java | 356 +
.../query/h2/opt/GridH2KeyValueRowOnheap.java | 54 +
.../processors/query/h2/opt/GridH2Row.java | 48 +
.../query/h2/opt/GridH2RowDescriptor.java | 110 +
.../query/h2/opt/GridH2SpatialIndex.java | 326 +
.../processors/query/h2/opt/GridH2Table.java | 896 ++
.../query/h2/opt/GridH2TreeIndex.java | 477 +
.../processors/query/h2/opt/GridH2Utils.java | 133 +
.../query/h2/opt/GridLuceneDirectory.java | 197 +
.../processors/query/h2/opt/GridLuceneFile.java | 194 +
.../query/h2/opt/GridLuceneIndex.java | 392 +
.../query/h2/opt/GridLuceneInputStream.java | 228 +
.../query/h2/opt/GridLuceneLockFactory.java | 72 +
.../query/h2/opt/GridLuceneOutputStream.java | 238 +
.../query/h2/opt/GridSearchRowPointer.java | 28 +
.../internal/processors/query/h2/package.html | 24 +
.../query/h2/sql/GridSqlAggregateFunction.java | 76 +
.../processors/query/h2/sql/GridSqlAlias.java | 55 +
.../processors/query/h2/sql/GridSqlColumn.java | 57 +
.../processors/query/h2/sql/GridSqlConst.java | 39 +
.../processors/query/h2/sql/GridSqlElement.java | 73 +
.../query/h2/sql/GridSqlFunction.java | 142 +
.../query/h2/sql/GridSqlFunctionType.java | 78 +
.../processors/query/h2/sql/GridSqlJoin.java | 68 +
.../query/h2/sql/GridSqlOperation.java | 73 +
.../query/h2/sql/GridSqlOperationType.java | 202 +
.../query/h2/sql/GridSqlParameter.java | 44 +
.../query/h2/sql/GridSqlQueryParser.java | 495 +
.../query/h2/sql/GridSqlQuerySplitter.java | 252 +
.../processors/query/h2/sql/GridSqlSelect.java | 287 +
.../query/h2/sql/GridSqlSubquery.java | 44 +
.../processors/query/h2/sql/GridSqlTable.java | 55 +
.../processors/query/h2/sql/GridSqlValue.java | 17 +
.../query/h2/twostep/GridMapQueryExecutor.java | 270 +
.../query/h2/twostep/GridMergeIndex.java | 290 +
.../h2/twostep/GridMergeIndexUnsorted.java | 85 +
.../query/h2/twostep/GridMergeTable.java | 178 +
.../h2/twostep/GridReduceQueryExecutor.java | 242 +
.../query/h2/twostep/GridResultPage.java | 59 +
.../twostep/messages/GridNextPageRequest.java | 59 +
.../twostep/messages/GridNextPageResponse.java | 180 +
.../query/h2/twostep/messages/GridQueryAck.java | 34 +
.../twostep/messages/GridQueryFailResponse.java | 46 +
.../h2/twostep/messages/GridQueryRequest.java | 61 +
.../processors/query/h2/GridH2Indexing.java | 1998 ---
.../query/h2/GridH2ResultSetIterator.java | 122 -
.../query/h2/opt/GridH2AbstractKeyValueRow.java | 447 -
.../processors/query/h2/opt/GridH2Cursor.java | 62 -
.../query/h2/opt/GridH2IndexBase.java | 198 -
.../query/h2/opt/GridH2KeyValueRowOffheap.java | 346 -
.../query/h2/opt/GridH2KeyValueRowOnheap.java | 46 -
.../processors/query/h2/opt/GridH2Row.java | 40 -
.../query/h2/opt/GridH2RowDescriptor.java | 102 -
.../query/h2/opt/GridH2SpatialIndex.java | 318 -
.../processors/query/h2/opt/GridH2Table.java | 888 --
.../query/h2/opt/GridH2TreeIndex.java | 469 -
.../processors/query/h2/opt/GridH2Utils.java | 125 -
.../query/h2/opt/GridLuceneDirectory.java | 189 -
.../processors/query/h2/opt/GridLuceneFile.java | 186 -
.../query/h2/opt/GridLuceneIndex.java | 384 -
.../query/h2/opt/GridLuceneInputStream.java | 220 -
.../query/h2/opt/GridLuceneLockFactory.java | 64 -
.../query/h2/opt/GridLuceneOutputStream.java | 230 -
.../query/h2/opt/GridSearchRowPointer.java | 20 -
.../kernal/processors/query/h2/package.html | 15 -
.../GridCacheAbstractFieldsQuerySelfTest.java | 1305 ++
.../cache/GridCacheAbstractQuerySelfTest.java | 2094 +++
.../cache/GridCacheCrossCacheQuerySelfTest.java | 435 +
.../cache/GridCacheOffHeapAndSwapSelfTest.java | 571 +
...idCacheQueryEvictsMultiThreadedSelfTest.java | 28 +
.../cache/GridCacheQueryLoadSelfTest.java | 458 +
.../cache/GridCacheQueryMetricsSelfTest.java | 161 +
.../GridCacheQueryMultiThreadedSelfTest.java | 859 ++
...QueryOffheapEvictsMultiThreadedSelfTest.java | 28 +
...dCacheQueryOffheapMultiThreadedSelfTest.java | 28 +
.../cache/GridCacheQueryTestValue.java | 172 +
...idCacheReduceQueryMultithreadedSelfTest.java | 158 +
.../GridCacheSqlQueryMultiThreadedSelfTest.java | 140 +
.../processors/cache/GridCacheSwapSelfTest.java | 722 +
.../cache/GridIndexingWithNoopSwapSelfTest.java | 117 +
.../GridCacheAtomicFieldsQuerySelfTest.java | 65 +
...cheAtomicNearEnabledFieldsQuerySelfTest.java | 32 +
...GridCacheAtomicNearEnabledQuerySelfTest.java | 38 +
.../near/GridCacheAtomicQuerySelfTest.java | 38 +
...rtitionedFieldsQueryP2PDisabledSelfTest.java | 34 +
...GridCachePartitionedFieldsQuerySelfTest.java | 109 +
...idCachePartitionedHitsAndMissesSelfTest.java | 179 +
...achePartitionedQueryP2PDisabledSelfTest.java | 34 +
.../near/GridCachePartitionedQuerySelfTest.java | 479 +
.../near/GridCacheQueryNodeRestartSelfTest.java | 225 +
...eplicatedFieldsQueryP2PDisabledSelfTest.java | 34 +
.../GridCacheReplicatedFieldsQuerySelfTest.java | 157 +
...CacheReplicatedQueryP2PDisabledSelfTest.java | 34 +
.../GridCacheReplicatedQuerySelfTest.java | 683 +
.../GridCacheLocalAtomicQuerySelfTest.java | 32 +
.../GridCacheLocalFieldsQuerySelfTest.java | 38 +
.../local/GridCacheLocalQuerySelfTest.java | 106 +
.../query/h2/GridH2IndexRebuildTest.java | 250 +
.../query/h2/GridH2IndexingGeoSelfTest.java | 248 +
.../query/h2/GridH2IndexingInMemSelfTest.java | 25 +
.../query/h2/GridH2IndexingOffheapSelfTest.java | 44 +
.../h2/GridIndexingSpiAbstractSelfTest.java | 559 +
.../query/h2/opt/GridH2TableSelfTest.java | 621 +
.../query/h2/sql/GridQueryParsingTest.java | 289 +
.../loadtests/h2indexing/GridTestEntity.java | 68 +
.../loadtests/h2indexing/GridTreeBenchmark.java | 276 +
.../tcp/GridOrderedMessageCancelSelfTest.java | 213 +
.../IgniteCacheQuerySelfTestSuite.java | 105 +
.../IgniteH2IndexingSpiTestSuite.java | 61 +
.../GridCacheAbstractFieldsQuerySelfTest.java | 1297 --
.../cache/GridCacheAbstractQuerySelfTest.java | 2089 ---
.../cache/GridCacheCrossCacheQuerySelfTest.java | 344 -
.../cache/GridCacheOffHeapAndSwapSelfTest.java | 563 -
...idCacheQueryEvictsMultiThreadedSelfTest.java | 19 -
.../cache/GridCacheQueryLoadSelfTest.java | 448 -
.../cache/GridCacheQueryMetricsSelfTest.java | 153 -
.../GridCacheQueryMultiThreadedSelfTest.java | 851 --
...QueryOffheapEvictsMultiThreadedSelfTest.java | 19 -
...dCacheQueryOffheapMultiThreadedSelfTest.java | 20 -
.../cache/GridCacheQueryTestValue.java | 164 -
.../GridCacheQueryUserResourceSelfTest.java | 172 -
...idCacheReduceQueryMultithreadedSelfTest.java | 150 -
.../GridCacheSqlQueryMultiThreadedSelfTest.java | 132 -
.../processors/cache/GridCacheSwapSelfTest.java | 714 -
.../cache/GridIndexingWithNoopSwapSelfTest.java | 109 -
.../GridCacheAtomicFieldsQuerySelfTest.java | 57 -
...cheAtomicNearEnabledFieldsQuerySelfTest.java | 24 -
...GridCacheAtomicNearEnabledQuerySelfTest.java | 30 -
.../near/GridCacheAtomicQuerySelfTest.java | 30 -
...rtitionedFieldsQueryP2PDisabledSelfTest.java | 26 -
...GridCachePartitionedFieldsQuerySelfTest.java | 101 -
...idCachePartitionedHitsAndMissesSelfTest.java | 162 -
...achePartitionedQueryP2PDisabledSelfTest.java | 26 -
.../near/GridCachePartitionedQuerySelfTest.java | 471 -
.../near/GridCacheQueryNodeRestartSelfTest.java | 216 -
...eplicatedFieldsQueryP2PDisabledSelfTest.java | 26 -
.../GridCacheReplicatedFieldsQuerySelfTest.java | 150 -
...CacheReplicatedQueryP2PDisabledSelfTest.java | 26 -
.../GridCacheReplicatedQuerySelfTest.java | 675 -
.../GridCacheLocalAtomicQuerySelfTest.java | 24 -
.../GridCacheLocalFieldsQuerySelfTest.java | 30 -
.../local/GridCacheLocalQuerySelfTest.java | 99 -
.../query/h2/GridH2IndexRebuildTest.java | 241 -
.../query/h2/GridH2IndexingGeoSelfTest.java | 240 -
.../query/h2/GridH2IndexingInMemSelfTest.java | 17 -
.../query/h2/GridH2IndexingOffheapSelfTest.java | 36 -
.../h2/GridIndexingSpiAbstractSelfTest.java | 553 -
.../query/h2/opt/GridH2TableSelfTest.java | 613 -
.../loadtests/h2indexing/GridTestEntity.java | 60 -
.../loadtests/h2indexing/GridTreeBenchmark.java | 268 -
.../testsuites/GridCacheQuerySelfTestSuite.java | 91 -
.../bamboo/GridH2IndexingSpiTestSuite.java | 53 -
modules/jcl/pom.xml | 22 +-
modules/jcl/readme.txt | 16 +-
.../apache/ignite/logger/jcl/GridJclLogger.java | 170 +
.../org/apache/ignite/logger/jcl/package.html | 23 +
.../gridgain/grid/logger/jcl/GridJclLogger.java | 163 -
.../org/gridgain/grid/logger/jcl/package.html | 15 -
.../ignite/logger/jcl/GridJclLoggerTest.java | 48 +
.../org/apache/ignite/logger/jcl/package.html | 23 +
.../ignite/testsuites/IgniteJclTestSuite.java | 38 +
.../grid/logger/jcl/GridJclLoggerTest.java | 40 -
.../org/gridgain/grid/logger/jcl/package.html | 15 -
.../testsuites/bamboo/GridJclTestSuite.java | 30 -
modules/jdk8-backport/pom.xml | 22 +-
modules/jta/pom.xml | 22 +-
modules/jta/readme.txt | 16 +-
.../ignite/cache/jta/GridCacheTmLookup.java | 50 +
.../cache/jta/jndi/GridCacheJndiTmLookup.java | 74 +
.../apache/ignite/cache/jta/jndi/package.html | 24 +
.../org/apache/ignite/cache/jta/package.html | 24 +
.../reflect/GridCacheReflectionTmLookup.java | 115 +
.../ignite/cache/jta/reflect/package.html | 24 +
.../processors/cache/jta/CacheJtaManager.java | 113 +
.../cache/jta/GridCacheXAResource.java | 248 +
.../grid/cache/jta/GridCacheTmLookup.java | 45 -
.../cache/jta/jndi/GridCacheJndiTmLookup.java | 66 -
.../gridgain/grid/cache/jta/jndi/package.html | 15 -
.../org/gridgain/grid/cache/jta/package.html | 15 -
.../reflect/GridCacheReflectionTmLookup.java | 107 -
.../grid/cache/jta/reflect/package.html | 15 -
.../cache/jta/GridCacheJtaManager.java | 105 -
.../cache/jta/GridCacheXAResource.java | 240 -
...CacheJtaConfigurationValidationSelfTest.java | 74 +
.../processors/cache/GridCacheJtaSelfTest.java | 186 +
.../cache/GridCacheReplicatedJtaSelfTest.java | 32 +
.../GridTmLookupLifecycleAwareSelfTest.java | 102 +
.../ignite/testsuites/IgniteJtaTestSuite.java | 41 +
...CacheJtaConfigurationValidationSelfTest.java | 66 -
.../processors/cache/GridCacheJtaSelfTest.java | 178 -
.../cache/GridCacheReplicatedJtaSelfTest.java | 24 -
.../GridTmLookupLifecycleAwareSelfTest.java | 95 -
.../testsuites/bamboo/GridJtaTestSuite.java | 33 -
modules/log4j/pom.xml | 22 +-
modules/log4j/readme.txt | 16 +-
.../IgniteLog4jDailyRollingFileAppender.java | 24 +-
...IgniteLog4jExternallyRolledFileAppender.java | 24 +-
.../logger/log4j/IgniteLog4jFileAppender.java | 24 +-
.../logger/log4j/IgniteLog4jFileAware.java | 22 +-
.../ignite/logger/log4j/IgniteLog4jLogger.java | 34 +-
.../logger/log4j/IgniteLog4jNodeIdFilePath.java | 26 +-
.../log4j/IgniteLog4jRollingFileAppender.java | 24 +-
.../org/apache/ignite/logger/log4j/package.html | 25 +-
.../log4j/GridLog4jCorrectFileNameTest.java | 137 +
.../logger/log4j/GridLog4jInitializedTest.java | 55 +
.../logger/log4j/GridLog4jLoggingFileTest.java | 59 +
.../logger/log4j/GridLog4jLoggingPathTest.java | 53 +
.../logger/log4j/GridLog4jLoggingUrlTest.java | 59 +
.../log4j/GridLog4jNotInitializedTest.java | 46 +
.../org/apache/ignite/logger/log4j/package.html | 23 +
.../ignite/testsuites/IgniteLog4jTestSuite.java | 40 +
.../log4j/GridLog4jCorrectFileNameTest.java | 129 -
.../logger/log4j/GridLog4jInitializedTest.java | 48 -
.../logger/log4j/GridLog4jLoggingFileTest.java | 51 -
.../logger/log4j/GridLog4jLoggingPathTest.java | 45 -
.../logger/log4j/GridLog4jLoggingUrlTest.java | 51 -
.../log4j/GridLog4jNotInitializedTest.java | 39 -
.../org/gridgain/grid/logger/log4j/package.html | 15 -
.../testsuites/bamboo/GridLog4jTestSuite.java | 32 -
modules/rest-http/pom.xml | 22 +-
modules/rest-http/readme.txt | 16 +-
.../http/jetty/GridJettyJsonConfig.java | 50 +
.../http/jetty/GridJettyRestHandler.java | 595 +
.../http/jetty/GridJettyRestProtocol.java | 409 +
.../rest/protocols/http/jetty/favicon.ico | Bin 0 -> 1406 bytes
.../rest/protocols/http/jetty/package.html | 23 +
.../rest/protocols/http/jetty/rest.html | 96 +
.../http/jetty/GridJettyJsonConfig.java | 42 -
.../http/jetty/GridJettyRestHandler.java | 588 -
.../http/jetty/GridJettyRestProtocol.java | 402 -
.../rest/protocols/http/jetty/favicon.ico | Bin 1406 -> 0 bytes
.../rest/protocols/http/jetty/package.html | 15 -
.../rest/protocols/http/jetty/rest.html | 82 -
modules/scalar/pom.xml | 28 +-
modules/scalar/readme.txt | 16 +-
.../ignite/scalar/ScalarConversions.scala | 1236 ++
.../org/apache/ignite/scalar/lang/Packet.scala | 23 +
.../ignite/scalar/lang/ScalarAbsClosure.scala | 37 +
.../scalar/lang/ScalarAbsClosureFunction.scala | 32 +
.../ignite/scalar/lang/ScalarAbsClosureX.scala | 36 +
.../scalar/lang/ScalarAbsClosureXFunction.scala | 34 +
.../ignite/scalar/lang/ScalarAbsPredicate.scala | 34 +
.../lang/ScalarAbsPredicateFunction.scala | 34 +
.../scalar/lang/ScalarAbsPredicateX.scala | 36 +
.../lang/ScalarAbsPredicateXFunction.scala | 34 +
.../ignite/scalar/lang/ScalarClosure.scala | 34 +
.../ignite/scalar/lang/ScalarClosure2.scala | 34 +
.../scalar/lang/ScalarClosure2Function.scala | 34 +
.../ignite/scalar/lang/ScalarClosure2X.scala | 36 +
.../scalar/lang/ScalarClosure2XFunction.scala | 34 +
.../ignite/scalar/lang/ScalarClosure3.scala | 34 +
.../scalar/lang/ScalarClosure3Function.scala | 34 +
.../ignite/scalar/lang/ScalarClosure3X.scala | 36 +
.../scalar/lang/ScalarClosure3XFunction.scala | 34 +
.../scalar/lang/ScalarClosureFunction.scala | 34 +
.../ignite/scalar/lang/ScalarClosureX.scala | 36 +
.../scalar/lang/ScalarClosureXFunction.scala | 34 +
.../ignite/scalar/lang/ScalarInClosure.scala | 34 +
.../ignite/scalar/lang/ScalarInClosure2.scala | 34 +
.../scalar/lang/ScalarInClosure2Function.scala | 34 +
.../ignite/scalar/lang/ScalarInClosure2X.scala | 36 +
.../scalar/lang/ScalarInClosure2XFunction.scala | 34 +
.../ignite/scalar/lang/ScalarInClosure3.scala | 34 +
.../scalar/lang/ScalarInClosure3Function.scala | 34 +
.../ignite/scalar/lang/ScalarInClosure3X.scala | 36 +
.../scalar/lang/ScalarInClosure3XFunction.scala | 34 +
.../scalar/lang/ScalarInClosureFunction.scala | 34 +
.../ignite/scalar/lang/ScalarInClosureX.scala | 36 +
.../scalar/lang/ScalarInClosureXFunction.scala | 34 +
.../apache/ignite/scalar/lang/ScalarJob.scala | 32 +
.../ignite/scalar/lang/ScalarOutClosure.scala | 47 +
.../scalar/lang/ScalarOutClosureFunction.scala | 33 +
.../ignite/scalar/lang/ScalarOutClosureX.scala | 36 +
.../scalar/lang/ScalarOutClosureXFunction.scala | 34 +
.../ignite/scalar/lang/ScalarPredicate.scala | 32 +
.../ignite/scalar/lang/ScalarPredicate2.scala | 32 +
.../scalar/lang/ScalarPredicate2Function.scala | 34 +
.../ignite/scalar/lang/ScalarPredicate2X.scala | 36 +
.../scalar/lang/ScalarPredicate2XFunction.scala | 34 +
.../ignite/scalar/lang/ScalarPredicate3.scala | 32 +
.../scalar/lang/ScalarPredicate3Function.scala | 34 +
.../ignite/scalar/lang/ScalarPredicate3X.scala | 36 +
.../scalar/lang/ScalarPredicate3XFunction.scala | 34 +
.../scalar/lang/ScalarPredicateFunction.scala | 34 +
.../ignite/scalar/lang/ScalarPredicateX.scala | 36 +
.../scalar/lang/ScalarPredicateXFunction.scala | 34 +
.../ignite/scalar/lang/ScalarReducer.scala | 47 +
.../ignite/scalar/lang/ScalarReducer2.scala | 50 +
.../scalar/lang/ScalarReducer2Function.scala | 36 +
.../ignite/scalar/lang/ScalarReducer3.scala | 54 +
.../scalar/lang/ScalarReducer3Function.scala | 37 +
.../scalar/lang/ScalarReducerFunction.scala | 36 +
.../org/apache/ignite/scalar/pimps/Packet.scala | 23 +
.../apache/ignite/scalar/pimps/PimpedType.scala | 32 +
.../ignite/scalar/pimps/ScalarCachePimp.scala | 69 +
.../pimps/ScalarCacheProjectionPimp.scala | 2002 +++
.../ignite/scalar/pimps/ScalarGridPimp.scala | 92 +
.../scalar/pimps/ScalarProjectionPimp.scala | 659 +
.../scalar/pimps/ScalarTaskThreadContext.scala | 45 +
.../scala/org/apache/ignite/scalar/scalar.scala | 459 +
.../org/gridgain/scalar/ScalarConversions.scala | 1229 --
.../scala/org/gridgain/scalar/lang/Packet.scala | 17 -
.../gridgain/scalar/lang/ScalarAbsClosure.scala | 31 -
.../scalar/lang/ScalarAbsClosureFunction.scala | 26 -
.../scalar/lang/ScalarAbsClosureX.scala | 31 -
.../scalar/lang/ScalarAbsClosureXFunction.scala | 28 -
.../scalar/lang/ScalarAbsPredicate.scala | 28 -
.../lang/ScalarAbsPredicateFunction.scala | 28 -
.../scalar/lang/ScalarAbsPredicateX.scala | 31 -
.../lang/ScalarAbsPredicateXFunction.scala | 28 -
.../gridgain/scalar/lang/ScalarClosure.scala | 28 -
.../gridgain/scalar/lang/ScalarClosure2.scala | 28 -
.../scalar/lang/ScalarClosure2Function.scala | 28 -
.../gridgain/scalar/lang/ScalarClosure2X.scala | 31 -
.../scalar/lang/ScalarClosure2XFunction.scala | 28 -
.../gridgain/scalar/lang/ScalarClosure3.scala | 28 -
.../scalar/lang/ScalarClosure3Function.scala | 28 -
.../gridgain/scalar/lang/ScalarClosure3X.scala | 31 -
.../scalar/lang/ScalarClosure3XFunction.scala | 28 -
.../scalar/lang/ScalarClosureFunction.scala | 28 -
.../gridgain/scalar/lang/ScalarClosureX.scala | 31 -
.../scalar/lang/ScalarClosureXFunction.scala | 28 -
.../gridgain/scalar/lang/ScalarInClosure.scala | 28 -
.../gridgain/scalar/lang/ScalarInClosure2.scala | 28 -
.../scalar/lang/ScalarInClosure2Function.scala | 28 -
.../scalar/lang/ScalarInClosure2X.scala | 31 -
.../scalar/lang/ScalarInClosure2XFunction.scala | 28 -
.../gridgain/scalar/lang/ScalarInClosure3.scala | 28 -
.../scalar/lang/ScalarInClosure3Function.scala | 28 -
.../scalar/lang/ScalarInClosure3X.scala | 31 -
.../scalar/lang/ScalarInClosure3XFunction.scala | 28 -
.../scalar/lang/ScalarInClosureFunction.scala | 28 -
.../gridgain/scalar/lang/ScalarInClosureX.scala | 31 -
.../scalar/lang/ScalarInClosureXFunction.scala | 28 -
.../org/gridgain/scalar/lang/ScalarJob.scala | 27 -
.../gridgain/scalar/lang/ScalarOutClosure.scala | 40 -
.../scalar/lang/ScalarOutClosureFunction.scala | 27 -
.../scalar/lang/ScalarOutClosureX.scala | 31 -
.../scalar/lang/ScalarOutClosureXFunction.scala | 28 -
.../gridgain/scalar/lang/ScalarPredicate.scala | 26 -
.../gridgain/scalar/lang/ScalarPredicate2.scala | 26 -
.../scalar/lang/ScalarPredicate2Function.scala | 28 -
.../scalar/lang/ScalarPredicate2X.scala | 31 -
.../scalar/lang/ScalarPredicate2XFunction.scala | 28 -
.../gridgain/scalar/lang/ScalarPredicate3.scala | 26 -
.../scalar/lang/ScalarPredicate3Function.scala | 28 -
.../scalar/lang/ScalarPredicate3X.scala | 31 -
.../scalar/lang/ScalarPredicate3XFunction.scala | 28 -
.../scalar/lang/ScalarPredicateFunction.scala | 28 -
.../gridgain/scalar/lang/ScalarPredicateX.scala | 31 -
.../scalar/lang/ScalarPredicateXFunction.scala | 28 -
.../gridgain/scalar/lang/ScalarReducer.scala | 41 -
.../gridgain/scalar/lang/ScalarReducer2.scala | 43 -
.../scalar/lang/ScalarReducer2Function.scala | 30 -
.../gridgain/scalar/lang/ScalarReducer3.scala | 47 -
.../scalar/lang/ScalarReducer3Function.scala | 31 -
.../scalar/lang/ScalarReducerFunction.scala | 30 -
.../org/gridgain/scalar/pimps/Packet.scala | 17 -
.../org/gridgain/scalar/pimps/PimpedType.scala | 26 -
.../gridgain/scalar/pimps/ScalarCachePimp.scala | 63 -
.../pimps/ScalarCacheProjectionPimp.scala | 1999 ---
.../gridgain/scalar/pimps/ScalarGridPimp.scala | 88 -
.../scalar/pimps/ScalarProjectionPimp.scala | 653 -
.../scalar/pimps/ScalarTaskThreadContext.scala | 41 -
.../main/scala/org/gridgain/scalar/scalar.scala | 453 -
.../scalar/src/test/resources/spring-cache.xml | 24 +-
.../test/resources/spring-ping-pong-partner.xml | 62 +-
.../tests/ScalarAffinityRoutingSpec.scala | 65 +
.../tests/ScalarCacheProjectionSpec.scala | 39 +
.../scalar/tests/ScalarCacheQueriesSpec.scala | 596 +
.../ignite/scalar/tests/ScalarCacheSpec.scala | 78 +
.../scalar/tests/ScalarConversionsSpec.scala | 254 +
.../scalar/tests/ScalarProjectionSpec.scala | 149 +
.../scalar/tests/ScalarReturnableSpec.scala | 57 +
.../apache/ignite/scalar/tests/ScalarSpec.scala | 37 +
.../scalar/testsuites/ScalarSelfTestSuite.scala | 38 +
.../tests/ScalarAffinityRoutingSpec.scala | 62 -
.../tests/ScalarCacheProjectionSpec.scala | 33 -
.../scalar/tests/ScalarCacheQueriesSpec.scala | 594 -
.../gridgain/scalar/tests/ScalarCacheSpec.scala | 73 -
.../scalar/tests/ScalarConversionsSpec.scala | 248 -
.../scalar/tests/ScalarProjectionSpec.scala | 144 -
.../scalar/tests/ScalarReturnableSpec.scala | 52 -
.../org/gridgain/scalar/tests/ScalarSpec.scala | 31 -
.../scalar/testsuites/ScalarSelfTestSuite.scala | 32 -
modules/schedule/pom.xml | 22 +-
modules/schedule/readme.txt | 16 +-
.../schedule/IgniteScheduleProcessor.java | 130 +
.../processors/schedule/ScheduleFutureImpl.java | 1004 ++
.../schedule/GridScheduleProcessor.java | 122 -
.../processors/schedule/ScheduleFutureImpl.java | 999 --
.../schedule/GridScheduleSelfTest.java | 402 +
.../testsuites/IgniteSchedulerTestSuite.java | 38 +
.../grid/kernal/GridScheduleSelfTest.java | 394 -
.../bamboo/GridSchedulerTestSuite.java | 30 -
modules/slf4j/pom.xml | 22 +-
modules/slf4j/readme.txt | 16 +-
.../ignite/logger/slf4j/GridSlf4jLogger.java | 141 +
.../org/apache/ignite/logger/slf4j/package.html | 23 +
.../grid/logger/slf4j/GridSlf4jLogger.java | 134 -
.../org/gridgain/grid/logger/slf4j/package.html | 15 -
modules/spring/pom.xml | 22 +-
modules/spring/readme.txt | 16 +-
.../java/org/apache/ignite/IgniteSpring.java | 117 +
.../org/apache/ignite/IgniteSpringBean.java | 348 +
.../apache/ignite/cache/spring/SpringCache.java | 185 +
.../ignite/cache/spring/SpringCacheManager.java | 241 +
.../cache/spring/SpringDynamicCacheManager.java | 315 +
.../org/apache/ignite/cache/spring/package.html | 23 +
.../GridResourceSpringBeanInjector.java | 100 +
.../resource/GridSpringResourceContextImpl.java | 67 +
.../spring/IgniteSpringProcessorImpl.java | 268 +
.../java/org/gridgain/grid/GridGainSpring.java | 110 -
.../java/org/gridgain/grid/GridSpringBean.java | 336 -
.../cache/spring/GridSpringCacheManager.java | 383 -
.../org/gridgain/grid/cache/spring/package.html | 15 -
.../GridResourceSpringBeanInjector.java | 92 -
.../resource/GridSpringResourceContextImpl.java | 59 -
.../spring/GridSpringProcessorImpl.java | 261 -
.../ignite/internal/GridFactorySelfTest.java | 790 +
.../GridSpringBeanSerializationSelfTest.java | 92 +
.../resource/GridLoggerInjectionSelfTest.java | 137 +
.../resource/GridResourceProcessorSelfTest.java | 465 +
.../resource/GridResourceTestUtils.java | 51 +
.../resource/GridServiceInjectionSelfTest.java | 309 +
.../processors/resource/TestClosure.java | 45 +
.../internal/processors/resource/package.html | 24 +
.../p2p/GridP2PUserVersionChangeSelfTest.java | 357 +
.../spring/GridSpringCacheManagerSelfTest.java | 237 +
.../ignite/spring/GridSpringCacheTestKey.java | 59 +
.../spring/GridSpringCacheTestKeyGenerator.java | 41 +
.../spring/GridSpringCacheTestService.java | 124 +
.../GridSpringDynamicCacheManagerSelfTest.java | 220 +
.../GridSpringDynamicCacheTestService.java | 62 +
.../org/apache/ignite/spring/spring-caching.xml | 47 +
.../ignite/spring/spring-dynamic-caching.xml | 43 +
.../testsuites/IgniteResourceSelfTestSuite.java | 41 +
.../testsuites/IgniteSpringTestSuite.java | 50 +
.../spring/GridSpringCacheManagerSelfTest.java | 229 -
.../cache/spring/GridSpringCacheTestKey.java | 51 -
.../spring/GridSpringCacheTestKeyGenerator.java | 33 -
.../spring/GridSpringCacheTestService.java | 116 -
.../grid/cache/spring/spring-caching.xml | 41 -
.../GridAbstractUserExternalResource.java | 147 -
.../resource/GridUserExternalResource1.java | 17 -
.../resource/GridUserExternalResource2.java | 17 -
.../resource/GridUserExternalResourceTask1.java | 149 -
.../resource/GridUserExternalResourceTask2.java | 161 -
.../grid/external/resource/package.html | 15 -
.../grid/kernal/GridFactorySelfTest.java | 814 -
.../GridSpringBeanSerializationSelfTest.java | 84 -
.../resource/GridAbstractUserResource.java | 143 -
.../resource/GridLoggerInjectionSelfTest.java | 129 -
.../GridResourceConcurrentUndeploySelfTest.java | 458 -
.../GridResourceEventFilterSelfTest.java | 178 -
.../GridResourceFieldInjectionSelfTest.java | 630 -
...dResourceFieldOverrideInjectionSelfTest.java | 194 -
.../resource/GridResourceIocSelfTest.java | 479 -
...GridResourceIsolatedClassLoaderSelfTest.java | 754 -
.../GridResourceIsolatedTaskSelfTest.java | 734 -
.../GridResourceMethodInjectionSelfTest.java | 608 -
...ResourceMethodOverrideInjectionSelfTest.java | 481 -
.../resource/GridResourceProcessorSelfTest.java | 456 -
.../GridResourceSharedUndeploySelfTest.java | 665 -
.../resource/GridResourceTestUtils.java | 43 -
.../resource/GridResourceUserExternalTest.java | 86 -
.../resource/GridServiceInjectionSelfTest.java | 301 -
.../kernal/processors/resource/TestClosure.java | 37 -
.../kernal/processors/resource/package.html | 15 -
.../grid/p2p/GridP2PAbstractUserResource.java | 176 -
.../GridP2PContinuousLocalDeploySelfTest.java | 311 -
.../p2p/GridP2PUserVersionChangeSelfTest.java | 353 -
.../testsuites/GridResourceSelfTestSuite.java | 44 -
.../testsuites/bamboo/GridSpringTestSuite.java | 42 -
modules/ssh/pom.xml | 22 +-
modules/ssh/readme.txt | 16 +-
.../util/nodestart/GridNodeCallableImpl.java | 343 +
.../util/nodestart/IgniteSshProcessorImpl.java | 28 +
.../util/nodestart/GridNodeCallableImpl.java | 336 -
.../util/nodestart/GridSshProcessorImpl.java | 20 -
.../internal/GridNodeStartUtilsSelfTest.java | 89 +
.../GridProjectionStartStopRestartSelfTest.java | 1032 ++
.../IgniteStartStopRestartTestSuite.java | 39 +
.../grid/kernal/GridNodeStartUtilsSelfTest.java | 81 -
.../GridProjectionStartStopRestartSelfTest.java | 1025 --
.../kernal/GridStartStopRestartTestSuite.java | 31 -
modules/tools/pom.xml | 22 +-
.../ant/beautifier/GridJavadocAntTask.java | 465 +
.../GridJavadocCharArrayLexReader.java | 93 +
.../tools/ant/beautifier/GridJavadocToken.java | 70 +
.../ant/beautifier/GridJavadocTokenType.java | 38 +
.../ignite/tools/ant/beautifier/package.html | 24 +
.../ignite/tools/javadoc/GridLinkTaglet.java | 165 +
.../optimized/OptimizedClassNamesGenerator.java | 325 +
.../util/antgar/IgniteDeploymentGarAntTask.java | 172 +
.../org/apache/ignite/util/antgar/package.html | 23 +
.../ant/beautifier/GridJavadocAntTask.java | 457 -
.../GridJavadocCharArrayLexReader.java | 85 -
.../tools/ant/beautifier/GridJavadocToken.java | 62 -
.../ant/beautifier/GridJavadocTokenType.java | 30 -
.../grid/tools/ant/beautifier/package.html | 15 -
.../grid/tools/javadoc/GridLinkTaglet.java | 157 -
.../optimized/OptimizedClassNamesGenerator.java | 317 -
.../util/antgar/GridDeploymentGarAntTask.java | 164 -
.../org/gridgain/grid/util/antgar/package.html | 15 -
modules/urideploy/pom.xml | 22 +-
modules/urideploy/readme.txt | 16 +-
.../uri/GridUriDeploymentClassLoader.java | 24 +-
.../GridUriDeploymentClassLoaderFactory.java | 22 +-
.../uri/GridUriDeploymentDiscovery.java | 24 +-
.../uri/GridUriDeploymentFileProcessor.java | 27 +-
.../GridUriDeploymentFileProcessorResult.java | 24 +-
.../GridUriDeploymentFileResourceLoader.java | 22 +-
.../uri/GridUriDeploymentJarVerifier.java | 24 +-
.../deployment/uri/GridUriDeploymentSpi.java | 36 +-
.../uri/GridUriDeploymentSpiMBean.java | 32 +-
.../uri/GridUriDeploymentSpringDocument.java | 24 +-
.../uri/GridUriDeploymentSpringParser.java | 24 +-
.../uri/GridUriDeploymentUnitDescriptor.java | 28 +-
.../uri/GridUriDeploymentUriParser.java | 26 +-
.../ignite/spi/deployment/uri/package.html | 24 +-
.../uri/scanners/GridDeploymentFileHandler.java | 22 +-
.../GridDeploymentFolderScannerHelper.java | 22 +-
.../uri/scanners/GridUriDeploymentScanner.java | 26 +-
.../GridUriDeploymentScannerListener.java | 22 +-
.../file/GridUriDeploymentFileScanner.java | 28 +-
.../deployment/uri/scanners/file/package.html | 25 +-
.../ftp/GridUriDeploymentFtpClient.java | 24 +-
.../ftp/GridUriDeploymentFtpConfiguration.java | 26 +-
.../ftp/GridUriDeploymentFtpException.java | 22 +-
.../scanners/ftp/GridUriDeploymentFtpFile.java | 24 +-
.../ftp/GridUriDeploymentFtpScanner.java | 25 +-
.../deployment/uri/scanners/ftp/package.html | 25 +-
.../http/GridUriDeploymentHttpScanner.java | 28 +-
.../deployment/uri/scanners/http/package.html | 24 +-
.../spi/deployment/uri/scanners/package.html | 25 +-
.../GridTaskUriDeploymentDeadlockSelfTest.java | 110 +
.../ignite/p2p/GridP2PDisabledSelfTest.java | 211 +
.../uri/GridUriDeploymentAbstractSelfTest.java | 26 +-
...loymentClassLoaderMultiThreadedSelfTest.java | 28 +-
.../GridUriDeploymentClassLoaderSelfTest.java | 30 +-
...riDeploymentClassloaderRegisterSelfTest.java | 28 +-
.../uri/GridUriDeploymentConfigSelfTest.java | 24 +-
.../GridUriDeploymentFileProcessorSelfTest.java | 32 +-
.../uri/GridUriDeploymentMd5CheckSelfTest.java | 28 +-
...loymentMultiScannersErrorThrottlingTest.java | 26 +-
.../GridUriDeploymentMultiScannersSelfTest.java | 28 +-
.../uri/GridUriDeploymentSimpleSelfTest.java | 28 +-
.../META-INF/bad-signed-deployfile-gridgain.xml | 22 +-
.../spi/deployment/uri/META-INF/bad_classes.xml | 22 +-
.../META-INF/deploy-with-resources-gridgain.xml | 22 +-
.../uri/META-INF/deploydepend-gridgain.xml | 22 +-
.../uri/META-INF/deploydir-gridgain.xml | 22 +-
.../uri/META-INF/deployfile-gridgain.xml | 22 +-
.../spi/deployment/uri/META-INF/gridgain.xml | 22 +-
.../deployment/uri/META-INF/p2p-gridgain.xml | 26 +-
.../well-signed-deployfile-gridgain.xml | 22 +-
.../ignite/spi/deployment/uri/package.html | 24 +-
.../file/GridFileDeploymentSelfTest.java | 26 +-
.../GridFileDeploymentUndeploySelfTest.java | 28 +-
.../deployment/uri/scanners/file/package.html | 25 +-
.../uri/scanners/ftp/GridFtpDeploymentTest.java | 26 +-
.../deployment/uri/scanners/ftp/package.html | 24 +-
.../http/GridHttpDeploymentSelfTest.java | 23 +-
.../deployment/uri/scanners/http/package.html | 24 +-
.../testsuites/IgniteToolsSelfTestSuite.java | 38 +
.../IgniteUriDeploymentTestSuite.java | 59 +
.../apache/ignite/tools/GridToolsSelfTest.java | 384 +
.../ignite/tools/gartask/META-INF/gridgain.xml | 38 +
.../java/org/apache/ignite/tools/package.html | 24 +
.../GridTaskUriDeploymentDeadlockSelfTest.java | 101 -
.../grid/p2p/GridP2PDisabledSelfTest.java | 205 -
.../gridgain/grid/tools/GridToolsSelfTest.java | 376 -
.../grid/tools/gartask/META-INF/gridgain.xml | 30 -
.../java/org/gridgain/grid/tools/package.html | 15 -
.../testsuites/GridToolsSelfTestSuite.java | 30 -
.../bamboo/GridUriDeploymentTestSuite.java | 51 -
modules/visor-console/pom.xml | 22 +-
.../scala/org/apache/ignite/visor/Packet.scala | 38 +
.../ignite/visor/commands/VisorConsole.scala | 344 +
.../visor/commands/VisorConsoleCommand.scala | 77 +
.../ignite/visor/commands/VisorTextTable.scala | 539 +
.../ignite/visor/commands/ack/Packet.scala | 55 +
.../visor/commands/ack/VisorAckCommand.scala | 162 +
.../ignite/visor/commands/alert/Packet.scala | 108 +
.../commands/alert/VisorAlertCommand.scala | 840 ++
.../ignite/visor/commands/cache/Packet.scala | 127 +
.../commands/cache/VisorCacheClearCommand.scala | 151 +
.../commands/cache/VisorCacheCommand.scala | 893 ++
.../cache/VisorCacheCompactCommand.scala | 151 +
.../commands/cache/VisorCacheScanCommand.scala | 237 +
.../commands/cache/VisorCacheSwapCommand.scala | 151 +
.../ignite/visor/commands/config/Packet.scala | 55 +
.../config/VisorConfigurationCommand.scala | 500 +
.../ignite/visor/commands/deploy/Packet.scala | 76 +
.../commands/deploy/VisorDeployCommand.scala | 612 +
.../ignite/visor/commands/disco/Packet.scala | 72 +
.../commands/disco/VisorDiscoveryCommand.scala | 306 +
.../ignite/visor/commands/events/Packet.scala | 97 +
.../commands/events/VisorEventsCommand.scala | 530 +
.../ignite/visor/commands/gc/Packet.scala | 61 +
.../visor/commands/gc/VisorGcCommand.scala | 241 +
.../ignite/visor/commands/ggcube_128x128.png | Bin 0 -> 11444 bytes
.../ignite/visor/commands/ggcube_48x48.png | Bin 0 -> 3365 bytes
.../ignite/visor/commands/kill/Packet.scala | 78 +
.../visor/commands/kill/VisorKillCommand.scala | 356 +
.../ignite/visor/commands/node/Packet.scala | 60 +
.../visor/commands/node/VisorNodeCommand.scala | 342 +
.../ignite/visor/commands/ping/Packet.scala | 50 +
.../visor/commands/ping/VisorPingCommand.scala | 228 +
.../ignite/visor/commands/start/Packet.scala | 90 +
.../commands/start/VisorStartCommand.scala | 429 +
.../ignite/visor/commands/tasks/Packet.scala | 116 +
.../commands/tasks/VisorTasksCommand.scala | 1488 ++
.../ignite/visor/commands/top/Packet.scala | 87 +
.../commands/top/VisorTopologyCommand.scala | 431 +
.../ignite/visor/commands/vvm/Packet.scala | 61 +
.../visor/commands/vvm/VisorVvmCommand.scala | 308 +
.../scala/org/apache/ignite/visor/visor.scala | 2676 ++++
.../main/scala/org/gridgain/visor/Packet.scala | 32 -
.../gridgain/visor/commands/VisorConsole.scala | 337 -
.../visor/commands/VisorConsoleCommand.scala | 72 -
.../visor/commands/VisorTextTable.scala | 534 -
.../gridgain/visor/commands/ack/Packet.scala | 49 -
.../visor/commands/ack/VisorAckCommand.scala | 156 -
.../gridgain/visor/commands/alert/Packet.scala | 102 -
.../commands/alert/VisorAlertCommand.scala | 833 --
.../gridgain/visor/commands/cache/Packet.scala | 121 -
.../commands/cache/VisorCacheClearCommand.scala | 143 -
.../commands/cache/VisorCacheCommand.scala | 888 --
.../cache/VisorCacheCompactCommand.scala | 144 -
.../commands/cache/VisorCacheScanCommand.scala | 230 -
.../commands/cache/VisorCacheSwapCommand.scala | 143 -
.../gridgain/visor/commands/config/Packet.scala | 49 -
.../config/VisorConfigurationCommand.scala | 494 -
.../gridgain/visor/commands/deploy/Packet.scala | 70 -
.../commands/deploy/VisorDeployCommand.scala | 605 -
.../gridgain/visor/commands/disco/Packet.scala | 66 -
.../commands/disco/VisorDiscoveryCommand.scala | 299 -
.../gridgain/visor/commands/events/Packet.scala | 91 -
.../commands/events/VisorEventsCommand.scala | 523 -
.../org/gridgain/visor/commands/gc/Packet.scala | 55 -
.../visor/commands/gc/VisorGcCommand.scala | 238 -
.../gridgain/visor/commands/ggcube_128x128.png | Bin 11444 -> 0 bytes
.../gridgain/visor/commands/ggcube_48x48.png | Bin 3365 -> 0 bytes
.../gridgain/visor/commands/kill/Packet.scala | 72 -
.../visor/commands/kill/VisorKillCommand.scala | 349 -
.../gridgain/visor/commands/node/Packet.scala | 54 -
.../visor/commands/node/VisorNodeCommand.scala | 334 -
.../gridgain/visor/commands/ping/Packet.scala | 44 -
.../visor/commands/ping/VisorPingCommand.scala | 222 -
.../gridgain/visor/commands/start/Packet.scala | 84 -
.../commands/start/VisorStartCommand.scala | 423 -
.../gridgain/visor/commands/tasks/Packet.scala | 110 -
.../commands/tasks/VisorTasksCommand.scala | 1481 --
.../gridgain/visor/commands/top/Packet.scala | 81 -
.../commands/top/VisorTopologyCommand.scala | 424 -
.../gridgain/visor/commands/vvm/Packet.scala | 55 -
.../visor/commands/vvm/VisorVvmCommand.scala | 300 -
.../main/scala/org/gridgain/visor/visor.scala | 2672 ----
.../ignite/visor/VisorRuntimeBaseSpec.scala | 75 +
.../ignite/visor/VisorTextTableSpec.scala | 44 +
.../visor/commands/VisorArgListSpec.scala | 72 +
.../commands/VisorFileNameCompleterSpec.scala | 58 +
.../commands/ack/VisorAckCommandSpec.scala | 40 +
.../commands/alert/VisorAlertCommandSpec.scala | 154 +
.../cache/VisorCacheClearCommandSpec.scala | 114 +
.../commands/cache/VisorCacheCommandSpec.scala | 102 +
.../cache/VisorCacheCompactCommandSpec.scala | 104 +
.../config/VisorConfigurationCommandSpec.scala | 51 +
.../cswap/VisorCacheSwapCommandSpec.scala | 91 +
.../deploy/VisorDeployCommandSpec.scala | 34 +
.../disco/VisorDiscoveryCommandSpec.scala | 86 +
.../events/VisorEventsCommandSpec.scala | 63 +
.../visor/commands/gc/VisorGcCommandSpec.scala | 60 +
.../commands/help/VisorHelpCommandSpec.scala | 68 +
.../commands/kill/VisorKillCommandSpec.scala | 58 +
.../commands/log/VisorLogCommandSpec.scala | 32 +
.../commands/mem/VisorMemoryCommandSpec.scala | 75 +
.../commands/node/VisorNodeCommandSpec.scala | 42 +
.../commands/open/VisorOpenCommandSpec.scala | 40 +
.../commands/ping/VisorPingCommandSpec.scala | 38 +
.../commands/start/VisorStartCommandSpec.scala | 123 +
.../commands/tasks/VisorTasksCommandSpec.scala | 231 +
.../commands/top/VisorTopologyCommandSpec.scala | 62 +
.../commands/vvm/VisorVvmCommandSpec.scala | 46 +
.../testsuites/VisorConsoleSelfTestSuite.scala | 95 +
.../gridgain/visor/VisorRuntimeBaseSpec.scala | 68 -
.../org/gridgain/visor/VisorTextTableSpec.scala | 39 -
.../visor/commands/VisorArgListSpec.scala | 65 -
.../commands/VisorFileNameCompleterSpec.scala | 52 -
.../commands/ack/VisorAckCommandSpec.scala | 34 -
.../commands/alert/VisorAlertCommandSpec.scala | 148 -
.../cache/VisorCacheClearCommandSpec.scala | 107 -
.../commands/cache/VisorCacheCommandSpec.scala | 97 -
.../cache/VisorCacheCompactCommandSpec.scala | 97 -
.../config/VisorConfigurationCommandSpec.scala | 45 -
.../cswap/VisorCacheSwapCommandSpec.scala | 84 -
.../deploy/VisorDeployCommandSpec.scala | 28 -
.../disco/VisorDiscoveryCommandSpec.scala | 80 -
.../events/VisorEventsCommandSpec.scala | 57 -
.../visor/commands/gc/VisorGcCommandSpec.scala | 51 -
.../commands/help/VisorHelpCommandSpec.scala | 63 -
.../commands/kill/VisorKillCommandSpec.scala | 52 -
.../commands/log/VisorLogCommandSpec.scala | 27 -
.../commands/mem/VisorMemoryCommandSpec.scala | 70 -
.../commands/node/VisorNodeCommandSpec.scala | 36 -
.../commands/open/VisorOpenCommandSpec.scala | 35 -
.../commands/ping/VisorPingCommandSpec.scala | 32 -
.../commands/start/VisorStartCommandSpec.scala | 117 -
.../commands/tasks/VisorTasksCommandSpec.scala | 225 -
.../commands/top/VisorTopologyCommandSpec.scala | 56 -
.../commands/vvm/VisorVvmCommandSpec.scala | 40 -
.../testsuites/VisorConsoleSelfTestSuite.scala | 91 -
modules/visor-plugins/pom.xml | 22 +-
.../src/main/java/log4j.properties | 17 +
.../visor/plugin/VisorExtensionPoint.java | 75 +
.../ignite/visor/plugin/VisorPluggableTab.java | 63 +
.../apache/ignite/visor/plugin/VisorPlugin.java | 45 +
.../visor/plugin/VisorPluginComponent.java | 30 +
.../plugin/VisorPluginComponentsFactory.java | 49 +
.../visor/plugin/VisorPluginLogPanel.java | 26 +
.../ignite/visor/plugin/VisorPluginModel.java | 97 +
.../visor/plugin/VisorPluginNodesPanel.java | 48 +
.../visor/plugin/VisorSelectionListener.java | 32 +
.../visor/plugin/VisorTopologyListener.java | 53 +
.../org/apache/ignite/visor/plugin/package.html | 23 +
.../visor/plugin/VisorExtensionPoint.java | 69 -
.../visor/plugin/VisorPluggableTab.java | 57 -
.../org/gridgain/visor/plugin/VisorPlugin.java | 37 -
.../visor/plugin/VisorPluginComponent.java | 22 -
.../plugin/VisorPluginComponentsFactory.java | 41 -
.../visor/plugin/VisorPluginLogPanel.java | 18 -
.../gridgain/visor/plugin/VisorPluginModel.java | 91 -
.../visor/plugin/VisorPluginNodesPanel.java | 40 -
.../visor/plugin/VisorSelectionListener.java | 24 -
.../visor/plugin/VisorTopologyListener.java | 45 -
.../java/org/gridgain/visor/plugin/package.html | 15 -
modules/web/pom.xml | 22 +-
modules/web/readme.txt | 20 +-
.../ignite/cache/websession/GridWebSession.java | 286 +
.../cache/websession/GridWebSessionFilter.java | 465 +
.../websession/GridWebSessionListener.java | 195 +
.../apache/ignite/cache/websession/package.html | 24 +
.../GridServletContextListenerStartup.java | 181 +
.../startup/servlet/GridServletStartup.java | 187 +
.../apache/ignite/startup/servlet/package.html | 23 +
.../grid/cache/websession/GridWebSession.java | 278 -
.../cache/websession/GridWebSessionFilter.java | 443 -
.../websession/GridWebSessionListener.java | 179 -
.../gridgain/grid/cache/websession/package.html | 15 -
.../GridServletContextListenerStartup.java | 174 -
.../startup/servlet/GridServletStartup.java | 180 -
.../gridgain/grid/startup/servlet/package.html | 15 -
.../IgniteWebSessionSelfTestSuite.java | 65 +
.../internal/websession/WebSessionSelfTest.java | 327 +
.../websession/WebSessionServerStart.java | 130 +
.../internal/websession/WebSessionTest.java | 62 +
.../websession/GridWebSessionSelfTest.java | 319 -
.../websession/GridWebSessionSelfTestSuite.java | 57 -
.../websession/GridWebSessionServerStart.java | 122 -
.../kernal/websession/GridWebSessionTest.java | 54 -
pom.xml | 224 +-
7910 files changed, 829332 insertions(+), 779722 deletions(-)
----------------------------------------------------------------------
[04/52] [abbrv] incubator-ignite git commit: GridNamedInstance ->
IgniteNamedInstance GridgainEx -> IgnitionEx
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5247ab3/modules/core/src/main/java/org/apache/ignite/internal/GridGainEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridGainEx.java b/modules/core/src/main/java/org/apache/ignite/internal/GridGainEx.java
deleted file mode 100644
index 65c2776..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridGainEx.java
+++ /dev/null
@@ -1,2399 +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;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.cache.affinity.rendezvous.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.fs.*;
-import org.apache.ignite.internal.util.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.lifecycle.*;
-import org.apache.ignite.logger.*;
-import org.apache.ignite.logger.java.*;
-import org.apache.ignite.marshaller.*;
-import org.apache.ignite.marshaller.jdk.*;
-import org.apache.ignite.marshaller.optimized.*;
-import org.apache.ignite.mxbean.*;
-import org.apache.ignite.spi.*;
-import org.apache.ignite.spi.authentication.*;
-import org.apache.ignite.spi.authentication.noop.*;
-import org.apache.ignite.spi.indexing.*;
-import org.apache.ignite.streamer.*;
-import org.apache.ignite.thread.*;
-import org.apache.ignite.internal.processors.resource.*;
-import org.apache.ignite.internal.processors.spring.*;
-import org.apache.ignite.plugin.segmentation.*;
-import org.apache.ignite.spi.checkpoint.*;
-import org.apache.ignite.spi.checkpoint.noop.*;
-import org.apache.ignite.spi.collision.*;
-import org.apache.ignite.spi.collision.noop.*;
-import org.apache.ignite.spi.communication.*;
-import org.apache.ignite.spi.communication.tcp.*;
-import org.apache.ignite.spi.deployment.*;
-import org.apache.ignite.spi.deployment.local.*;
-import org.apache.ignite.spi.discovery.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.*;
-import org.apache.ignite.spi.eventstorage.*;
-import org.apache.ignite.spi.eventstorage.memory.*;
-import org.apache.ignite.spi.failover.*;
-import org.apache.ignite.spi.failover.always.*;
-import org.apache.ignite.spi.loadbalancing.*;
-import org.apache.ignite.spi.loadbalancing.roundrobin.*;
-import org.apache.ignite.spi.securesession.*;
-import org.apache.ignite.spi.securesession.noop.*;
-import org.apache.ignite.spi.swapspace.*;
-import org.apache.ignite.spi.swapspace.file.*;
-import org.apache.ignite.spi.swapspace.noop.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.jdk8.backport.*;
-import org.jetbrains.annotations.*;
-
-import javax.management.*;
-import java.io.*;
-import java.lang.management.*;
-import java.lang.reflect.*;
-import java.net.*;
-import java.util.*;
-import java.util.Map.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-import java.util.logging.*;
-
-import static org.apache.ignite.configuration.IgniteConfiguration.*;
-import static org.apache.ignite.IgniteState.*;
-import static org.apache.ignite.IgniteSystemProperties.*;
-import static org.apache.ignite.cache.CacheAtomicityMode.*;
-import static org.apache.ignite.cache.CacheDistributionMode.*;
-import static org.apache.ignite.cache.CacheMode.*;
-import static org.apache.ignite.cache.CachePreloadMode.*;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
-import static org.apache.ignite.internal.IgniteComponentType.*;
-import static org.apache.ignite.plugin.segmentation.GridSegmentationPolicy.*;
-
-/**
- * This class defines a factory for the main GridGain API. It controls Grid life cycle
- * and allows listening for grid events.
- * <h1 class="header">Grid Loaders</h1>
- * Although user can apply grid factory directly to start and stop grid, grid is
- * often started and stopped by grid loaders. Grid loaders can be found in
- * {@link org.apache.ignite.startup} package, for example:
- * <ul>
- * <li>{@code GridCommandLineStartup}</li>
- * <li>{@code GridServletStartup}</li>
- * </ul>
- * <h1 class="header">Examples</h1>
- * Use {@link #start()} method to start grid with default configuration. You can also use
- * {@link org.apache.ignite.configuration.IgniteConfiguration} to override some default configuration. Below is an
- * example on how to start grid with <strong>URI deployment</strong>.
- * <pre name="code" class="java">
- * GridConfiguration cfg = new GridConfiguration();
- */
-public class GridGainEx {
- /** Default configuration path relative to GridGain home. */
- public static final String DFLT_CFG = "config/default-config.xml";
-
- /** Map of named grids. */
- private static final ConcurrentMap<Object, GridNamedInstance> grids = new ConcurrentHashMap8<>();
-
- /** Map of grid states ever started in this JVM. */
- private static final Map<Object, IgniteState> gridStates = new ConcurrentHashMap8<>();
-
- /** Mutex to synchronize updates of default grid reference. */
- private static final Object dfltGridMux = new Object();
-
- /** Default grid. */
- private static volatile GridNamedInstance dfltGrid;
-
- /** Default grid state. */
- private static volatile IgniteState dfltGridState;
-
- /** List of state listeners. */
- private static final Collection<IgniteListener> lsnrs = new GridConcurrentHashSet<>(4);
-
- /** */
- private static volatile boolean daemon;
-
- /**
- * Checks runtime version to be 1.7.x or 1.8.x.
- * This will load pretty much first so we must do these checks here.
- */
- static {
- // Check 1.8 just in case for forward compatibility.
- if (!U.jdkVersion().contains("1.7") &&
- !U.jdkVersion().contains("1.8"))
- throw new IllegalStateException("GridGain requires Java 7 or above. Current Java version " +
- "is not supported: " + U.jdkVersion());
-
- // To avoid nasty race condition in UUID.randomUUID() in JDK prior to 6u34.
- // For details please see:
- // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7071826
- // http://www.oracle.com/technetwork/java/javase/2col/6u34-bugfixes-1733379.html
- // http://hg.openjdk.java.net/jdk6/jdk6/jdk/rev/563d392b3e5c
- UUID.randomUUID();
- }
-
- /**
- * Enforces singleton.
- */
- private GridGainEx() {
- // No-op.
- }
-
- /**
- * Sets daemon flag.
- * <p>
- * If daemon flag is set then all grid instances created by the factory will be
- * daemon, i.e. the local node for these instances will be a daemon node. Note that
- * if daemon flag is set - it will override the same settings in {@link org.apache.ignite.configuration.IgniteConfiguration#isDaemon()}.
- * Note that you can set on and off daemon flag at will.
- *
- * @param daemon Daemon flag to set.
- */
- public static void setDaemon(boolean daemon) {
- GridGainEx.daemon = daemon;
- }
-
- /**
- * Gets daemon flag.
- * <p>
- * If daemon flag it set then all grid instances created by the factory will be
- * daemon, i.e. the local node for these instances will be a daemon node. Note that
- * if daemon flag is set - it will override the same settings in {@link org.apache.ignite.configuration.IgniteConfiguration#isDaemon()}.
- * Note that you can set on and off daemon flag at will.
- *
- * @return Daemon flag.
- */
- public static boolean isDaemon() {
- return daemon;
- }
-
- /**
- * Gets state of grid default grid.
- *
- * @return Default grid state.
- */
- public static IgniteState state() {
- return state(null);
- }
-
- /**
- * Gets states of named grid. If name is {@code null}, then state of
- * default no-name grid is returned.
- *
- * @param name Grid name. If name is {@code null}, then state of
- * default no-name grid is returned.
- * @return Grid state.
- */
- public static IgniteState state(@Nullable String name) {
- GridNamedInstance grid = name != null ? grids.get(name) : dfltGrid;
-
- if (grid == null) {
- IgniteState state = name != null ? gridStates.get(name) : dfltGridState;
-
- return state != null ? state : STOPPED;
- }
-
- return grid.state();
- }
-
- /**
- * Stops default grid. This method is identical to {@code G.stop(null, cancel)} apply.
- * Note that method does not wait for all tasks to be completed.
- *
- * @param cancel If {@code true} then all jobs currently executing on
- * default grid will be cancelled by calling {@link org.apache.ignite.compute.ComputeJob#cancel()}
- * method. Note that just like with {@link Thread#interrupt()}, it is
- * up to the actual job to exit from execution
- * @return {@code true} if default grid instance was indeed stopped,
- * {@code false} otherwise (if it was not started).
- */
- public static boolean stop(boolean cancel) {
- return stop(null, cancel);
- }
-
- /**
- * Stops named grid. If {@code cancel} flag is set to {@code true} then
- * all jobs currently executing on local node will be interrupted. If
- * grid name is {@code null}, then default no-name grid will be stopped.
- * If wait parameter is set to {@code true} then grid will wait for all
- * tasks to be finished.
- *
- * @param name Grid name. If {@code null}, then default no-name grid will
- * be stopped.
- * @param cancel If {@code true} then all jobs currently will be cancelled
- * by calling {@link org.apache.ignite.compute.ComputeJob#cancel()} method. Note that just like with
- * {@link Thread#interrupt()}, it is up to the actual job to exit from
- * execution. If {@code false}, then jobs currently running will not be
- * canceled. In either case, grid node will wait for completion of all
- * jobs running on it before stopping.
- * @return {@code true} if named grid instance was indeed found and stopped,
- * {@code false} otherwise (the instance with given {@code name} was
- * not found).
- */
- public static boolean stop(@Nullable String name, boolean cancel) {
- GridNamedInstance grid = name != null ? grids.get(name) : dfltGrid;
-
- if (grid != null && grid.state() == STARTED) {
- grid.stop(cancel);
-
- boolean fireEvt;
-
- if (name != null)
- fireEvt = grids.remove(name, grid);
- else {
- synchronized (dfltGridMux) {
- fireEvt = dfltGrid == grid;
-
- if (fireEvt)
- dfltGrid = null;
- }
- }
-
- if (fireEvt)
- notifyStateChange(grid.getName(), grid.state());
-
- return true;
- }
-
- // We don't have log at this point...
- U.warn(null, "Ignoring stopping grid instance that was already stopped or never started: " + name);
-
- return false;
- }
-
- /**
- * Stops <b>all</b> started grids. If {@code cancel} flag is set to {@code true} then
- * all jobs currently executing on local node will be interrupted.
- * If wait parameter is set to {@code true} then grid will wait for all
- * tasks to be finished.
- * <p>
- * <b>Note:</b> it is usually safer and more appropriate to stop grid instances individually
- * instead of blanket operation. In most cases, the party that started the grid instance
- * should be responsible for stopping it.
- *
- * @param cancel If {@code true} then all jobs currently executing on
- * all grids will be cancelled by calling {@link org.apache.ignite.compute.ComputeJob#cancel()}
- * method. Note that just like with {@link Thread#interrupt()}, it is
- * up to the actual job to exit from execution
- */
- public static void stopAll(boolean cancel) {
- GridNamedInstance dfltGrid0 = dfltGrid;
-
- if (dfltGrid0 != null) {
- dfltGrid0.stop(cancel);
-
- boolean fireEvt;
-
- synchronized (dfltGridMux) {
- fireEvt = dfltGrid == dfltGrid0;
-
- if (fireEvt)
- dfltGrid = null;
- }
-
- if (fireEvt)
- notifyStateChange(dfltGrid0.getName(), dfltGrid0.state());
- }
-
- // Stop the rest and clear grids map.
- for (GridNamedInstance grid : grids.values()) {
- grid.stop(cancel);
-
- boolean fireEvt = grids.remove(grid.getName(), grid);
-
- if (fireEvt)
- notifyStateChange(grid.getName(), grid.state());
- }
- }
-
- /**
- * Restarts <b>all</b> started grids. If {@code cancel} flag is set to {@code true} then
- * all jobs currently executing on the local node will be interrupted.
- * If {@code wait} parameter is set to {@code true} then grid will wait for all
- * tasks to be finished.
- * <p>
- * <b>Note:</b> it is usually safer and more appropriate to stop grid instances individually
- * instead of blanket operation. In most cases, the party that started the grid instance
- * should be responsible for stopping it.
- * <p>
- * Note also that restarting functionality only works with the tools that specifically
- * support GridGain's protocol for restarting. Currently only standard <tt>ggstart.{sh|bat}</tt>
- * scripts support restarting of JVM GridGain's process.
- *
- * @param cancel If {@code true} then all jobs currently executing on
- * all grids will be cancelled by calling {@link org.apache.ignite.compute.ComputeJob#cancel()}
- * method. Note that just like with {@link Thread#interrupt()}, it is
- * up to the actual job to exit from execution.
- * @see org.apache.ignite.Ignition#RESTART_EXIT_CODE
- */
- public static void restart(boolean cancel) {
- String file = System.getProperty(GG_SUCCESS_FILE);
-
- if (file == null)
- U.warn(null, "Cannot restart node when restart not enabled.");
- else {
- try {
- new File(file).createNewFile();
- }
- catch (IOException e) {
- U.error(null, "Failed to create restart marker file (restart aborted): " + e.getMessage());
-
- return;
- }
-
- U.log(null, "Restarting node. Will exit (" + Ignition.RESTART_EXIT_CODE + ").");
-
- // Set the exit code so that shell process can recognize it and loop
- // the start up sequence again.
- System.setProperty(GG_RESTART_CODE, Integer.toString(Ignition.RESTART_EXIT_CODE));
-
- stopAll(cancel);
-
- // This basically leaves loaders hang - we accept it.
- System.exit(Ignition.RESTART_EXIT_CODE);
- }
- }
-
- /**
- * Stops <b>all</b> started grids. If {@code cancel} flag is set to {@code true} then
- * all jobs currently executing on the local node will be interrupted.
- * If {@code wait} parameter is set to {@code true} then grid will wait for all
- * tasks to be finished.
- * <p>
- * <b>Note:</b> it is usually safer and more appropriate to stop grid instances individually
- * instead of blanket operation. In most cases, the party that started the grid instance
- * should be responsible for stopping it.
- * <p>
- * Note that upon completion of this method, the JVM with forcefully exist with
- * exit code {@link org.apache.ignite.Ignition#KILL_EXIT_CODE}.
- *
- * @param cancel If {@code true} then all jobs currently executing on
- * all grids will be cancelled by calling {@link org.apache.ignite.compute.ComputeJob#cancel()}
- * method. Note that just like with {@link Thread#interrupt()}, it is
- * up to the actual job to exit from execution.
- * @see org.apache.ignite.Ignition#KILL_EXIT_CODE
- */
- public static void kill(boolean cancel) {
- stopAll(cancel);
-
- // This basically leaves loaders hang - we accept it.
- System.exit(Ignition.KILL_EXIT_CODE);
- }
-
- /**
- * Starts grid with default configuration. By default this method will
- * use grid configuration defined in {@code GRIDGAIN_HOME/config/default-config.xml}
- * configuration file. If such file is not found, then all system defaults will be used.
- *
- * @return Started grid.
- * @throws IgniteCheckedException If default grid could not be started. This exception will be thrown
- * also if default grid has already been started.
- */
- public static Ignite start() throws IgniteCheckedException {
- return start((GridSpringResourceContext)null);
- }
-
- /**
- * Starts grid with default configuration. By default this method will
- * use grid configuration defined in {@code GRIDGAIN_HOME/config/default-config.xml}
- * configuration file. If such file is not found, then all system defaults will be used.
- *
- * @param springCtx Optional Spring application context, possibly {@code null}.
- * Spring bean definitions for bean injection are taken from this context.
- * If provided, this context can be injected into grid tasks and grid jobs using
- * {@link org.apache.ignite.resources.IgniteSpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation.
- * @return Started grid.
- * @throws IgniteCheckedException If default grid could not be started. This exception will be thrown
- * also if default grid has already been started.
- */
- public static Ignite start(@Nullable GridSpringResourceContext springCtx) throws IgniteCheckedException {
- URL url = U.resolveGridGainUrl(DFLT_CFG);
-
- if (url != null)
- return start(DFLT_CFG, null, springCtx);
-
- U.warn(null, "Default Spring XML file not found (is GRIDGAIN_HOME set?): " + DFLT_CFG);
-
- return start0(new GridStartContext(new IgniteConfiguration(), null, springCtx)).grid();
- }
-
- /**
- * Starts grid with given configuration. Note that this method is no-op if grid with the name
- * provided in given configuration is already started.
- *
- * @param cfg Grid configuration. This cannot be {@code null}.
- * @return Started grid.
- * @throws IgniteCheckedException If grid could not be started. This exception will be thrown
- * also if named grid has already been started.
- */
- public static Ignite start(IgniteConfiguration cfg) throws IgniteCheckedException {
- return start(cfg, null);
- }
-
- /**
- * Starts grid with given configuration. Note that this method is no-op if grid with the name
- * provided in given configuration is already started.
- *
- * @param cfg Grid configuration. This cannot be {@code null}.
- * @param springCtx Optional Spring application context, possibly {@code null}.
- * Spring bean definitions for bean injection are taken from this context.
- * If provided, this context can be injected into grid tasks and grid jobs using
- * {@link org.apache.ignite.resources.IgniteSpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation.
- * @return Started grid.
- * @throws IgniteCheckedException If grid could not be started. This exception will be thrown
- * also if named grid has already been started.
- */
- public static Ignite start(IgniteConfiguration cfg, @Nullable GridSpringResourceContext springCtx) throws IgniteCheckedException {
- A.notNull(cfg, "cfg");
-
- return start0(new GridStartContext(cfg, null, springCtx)).grid();
- }
-
- /**
- * Starts all grids specified within given Spring XML configuration file. If grid with given name
- * is already started, then exception is thrown. In this case all instances that may
- * have been started so far will be stopped too.
- * <p>
- * Usually Spring XML configuration file will contain only one Grid definition. Note that
- * Grid configuration bean(s) is retrieved form configuration file by type, so the name of
- * the Grid configuration bean is ignored.
- *
- * @param springCfgPath Spring XML configuration file path or URL.
- * @return Started grid. If Spring configuration contains multiple grid instances,
- * then the 1st found instance is returned.
- * @throws IgniteCheckedException If grid could not be started or configuration
- * read. This exception will be thrown also if grid with given name has already
- * been started or Spring XML configuration file is invalid.
- */
- public static Ignite start(@Nullable String springCfgPath) throws IgniteCheckedException {
- return springCfgPath == null ? start() : start(springCfgPath, null);
- }
-
- /**
- * Starts all grids specified within given Spring XML configuration file. If grid with given name
- * is already started, then exception is thrown. In this case all instances that may
- * have been started so far will be stopped too.
- * <p>
- * Usually Spring XML configuration file will contain only one Grid definition. Note that
- * Grid configuration bean(s) is retrieved form configuration file by type, so the name of
- * the Grid configuration bean is ignored.
- *
- * @param springCfgPath Spring XML configuration file path or URL.
- * @param gridName Grid name that will override default.
- * @return Started grid. If Spring configuration contains multiple grid instances,
- * then the 1st found instance is returned.
- * @throws IgniteCheckedException If grid could not be started or configuration
- * read. This exception will be thrown also if grid with given name has already
- * been started or Spring XML configuration file is invalid.
- */
- public static Ignite start(@Nullable String springCfgPath, @Nullable String gridName) throws IgniteCheckedException {
- if (springCfgPath == null) {
- IgniteConfiguration cfg = new IgniteConfiguration();
-
- if (cfg.getGridName() == null && !F.isEmpty(gridName))
- cfg.setGridName(gridName);
-
- return start(cfg);
- }
- else
- return start(springCfgPath, gridName, null);
- }
-
- /**
- * Start Grid for interop scenario.
- *
- * @param springCfgPath Spring config path.
- * @param gridName Grid name.
- * @param cfgClo Configuration closure.
- * @return Started Grid.
- * @throws IgniteCheckedException If failed.
- */
- public static Ignite startInterop(@Nullable String springCfgPath, @Nullable String gridName,
- IgniteClosure<IgniteConfiguration, IgniteConfiguration> cfgClo) throws IgniteCheckedException {
- URL url = resolveSpringUrl(springCfgPath);
-
- return start(url, gridName, null, cfgClo);
- }
-
- /**
- * Loads all grid configurations specified within given Spring XML configuration file.
- * <p>
- * Usually Spring XML configuration file will contain only one Grid definition. Note that
- * Grid configuration bean(s) is retrieved form configuration file by type, so the name of
- * the Grid configuration bean is ignored.
- *
- * @param springCfgUrl Spring XML configuration file path or URL. This cannot be {@code null}.
- * @return Tuple containing all loaded configurations and Spring context used to load them.
- * @throws IgniteCheckedException If grid could not be started or configuration
- * read. This exception will be thrown also if grid with given name has already
- * been started or Spring XML configuration file is invalid.
- */
- public static IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> loadConfigurations(
- URL springCfgUrl) throws IgniteCheckedException {
- IgniteSpringProcessor spring = SPRING.create(false);
-
- return spring.loadConfigurations(springCfgUrl);
- }
-
- /**
- * Loads all grid configurations specified within given Spring XML configuration file.
- * <p>
- * Usually Spring XML configuration file will contain only one Grid definition. Note that
- * Grid configuration bean(s) is retrieved form configuration file by type, so the name of
- * the Grid configuration bean is ignored.
- *
- * @param springCfgPath Spring XML configuration file path. This cannot be {@code null}.
- * @return Tuple containing all loaded configurations and Spring context used to load them.
- * @throws IgniteCheckedException If grid could not be started or configuration
- * read. This exception will be thrown also if grid with given name has already
- * been started or Spring XML configuration file is invalid.
- */
- public static IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> loadConfigurations(
- String springCfgPath) throws IgniteCheckedException {
- A.notNull(springCfgPath, "springCfgPath");
-
- URL url;
-
- try {
- url = new URL(springCfgPath);
- }
- catch (MalformedURLException e) {
- url = U.resolveGridGainUrl(springCfgPath);
-
- if (url == null)
- throw new IgniteCheckedException("Spring XML configuration path is invalid: " + springCfgPath +
- ". Note that this path should be either absolute or a relative local file system path, " +
- "relative to META-INF in classpath or valid URL to GRIDGAIN_HOME.", e);
- }
-
- return loadConfigurations(url);
- }
-
- /**
- * Loads first found grid configuration specified within given Spring XML configuration file.
- * <p>
- * Usually Spring XML configuration file will contain only one Grid definition. Note that
- * Grid configuration bean(s) is retrieved form configuration file by type, so the name of
- * the Grid configuration bean is ignored.
- *
- * @param springCfgUrl Spring XML configuration file path or URL. This cannot be {@code null}.
- * @return First found configuration and Spring context used to load it.
- * @throws IgniteCheckedException If grid could not be started or configuration
- * read. This exception will be thrown also if grid with given name has already
- * been started or Spring XML configuration file is invalid.
- */
- public static IgniteBiTuple<IgniteConfiguration, GridSpringResourceContext> loadConfiguration(URL springCfgUrl)
- throws IgniteCheckedException {
- IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> t = loadConfigurations(springCfgUrl);
-
- return F.t(F.first(t.get1()), t.get2());
- }
-
- /**
- * Loads first found grid configuration specified within given Spring XML configuration file.
- * <p>
- * Usually Spring XML configuration file will contain only one Grid definition. Note that
- * Grid configuration bean(s) is retrieved form configuration file by type, so the name of
- * the Grid configuration bean is ignored.
- *
- * @param springCfgPath Spring XML configuration file path. This cannot be {@code null}.
- * @return First found configuration and Spring context used to load it.
- * @throws IgniteCheckedException If grid could not be started or configuration
- * read. This exception will be thrown also if grid with given name has already
- * been started or Spring XML configuration file is invalid.
- */
- public static IgniteBiTuple<IgniteConfiguration, GridSpringResourceContext> loadConfiguration(String springCfgPath)
- throws IgniteCheckedException {
- IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> t =
- loadConfigurations(springCfgPath);
-
- return F.t(F.first(t.get1()), t.get2());
- }
-
- /**
- * Starts all grids specified within given Spring XML configuration file. If grid with given name
- * is already started, then exception is thrown. In this case all instances that may
- * have been started so far will be stopped too.
- * <p>
- * Usually Spring XML configuration file will contain only one Grid definition. Note that
- * Grid configuration bean(s) is retrieved form configuration file by type, so the name of
- * the Grid configuration bean is ignored.
- *
- * @param springCfgPath Spring XML configuration file path or URL. This cannot be {@code null}.
- * @param gridName Grid name that will override default.
- * @param springCtx Optional Spring application context, possibly {@code null}.
- * Spring bean definitions for bean injection are taken from this context.
- * If provided, this context can be injected into grid tasks and grid jobs using
- * {@link org.apache.ignite.resources.IgniteSpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation.
- * @return Started grid. If Spring configuration contains multiple grid instances,
- * then the 1st found instance is returned.
- * @throws IgniteCheckedException If grid could not be started or configuration
- * read. This exception will be thrown also if grid with given name has already
- * been started or Spring XML configuration file is invalid.
- */
- public static Ignite start(String springCfgPath, @Nullable String gridName,
- @Nullable GridSpringResourceContext springCtx) throws IgniteCheckedException {
- URL url = resolveSpringUrl(springCfgPath);
-
- return start(url, gridName, springCtx);
- }
-
- /**
- * Starts all grids specified within given Spring XML configuration file URL. If grid with given name
- * is already started, then exception is thrown. In this case all instances that may
- * have been started so far will be stopped too.
- * <p>
- * Usually Spring XML configuration file will contain only one Grid definition. Note that
- * Grid configuration bean(s) is retrieved form configuration file by type, so the name of
- * the Grid configuration bean is ignored.
- *
- * @param springCfgUrl Spring XML configuration file URL. This cannot be {@code null}.
- * @return Started grid. If Spring configuration contains multiple grid instances,
- * then the 1st found instance is returned.
- * @throws IgniteCheckedException If grid could not be started or configuration
- * read. This exception will be thrown also if grid with given name has already
- * been started or Spring XML configuration file is invalid.
- */
- public static Ignite start(URL springCfgUrl) throws IgniteCheckedException {
- return start(springCfgUrl, null, null);
- }
-
- /**
- * Starts all grids specified within given Spring XML configuration file URL. If grid with given name
- * is already started, then exception is thrown. In this case all instances that may
- * have been started so far will be stopped too.
- * <p>
- * Usually Spring XML configuration file will contain only one Grid definition. Note that
- * Grid configuration bean(s) is retrieved form configuration file by type, so the name of
- * the Grid configuration bean is ignored.
- *
- * @param springCfgUrl Spring XML configuration file URL. This cannot be {@code null}.
- * @param gridName Grid name that will override default.
- * @param springCtx Optional Spring application context, possibly {@code null}.
- * Spring bean definitions for bean injection are taken from this context.
- * If provided, this context can be injected into grid tasks and grid jobs using
- * {@link org.apache.ignite.resources.IgniteSpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation.
- * @return Started grid. If Spring configuration contains multiple grid instances,
- * then the 1st found instance is returned.
- * @throws IgniteCheckedException If grid could not be started or configuration
- * read. This exception will be thrown also if grid with given name has already
- * been started or Spring XML configuration file is invalid.
- */
- public static Ignite start(URL springCfgUrl, @Nullable String gridName,
- @Nullable GridSpringResourceContext springCtx) throws IgniteCheckedException {
- return start(springCfgUrl, gridName, springCtx, null);
- }
-
- /**
- * Internal Spring-based start routine.
- *
- * @param springCfgUrl Spring XML configuration file URL. This cannot be {@code null}.
- * @param gridName Grid name that will override default.
- * @param springCtx Optional Spring application context.
- * @param cfgClo Optional closure to change configuration before it is used to start the grid.
- * @return Started grid.
- * @throws IgniteCheckedException If failed.
- */
- private static Ignite start(URL springCfgUrl, @Nullable String gridName,
- @Nullable GridSpringResourceContext springCtx,
- @Nullable IgniteClosure<IgniteConfiguration, IgniteConfiguration> cfgClo)
- throws IgniteCheckedException {
- A.notNull(springCfgUrl, "springCfgUrl");
-
- boolean isLog4jUsed = U.gridClassLoader().getResource("org/apache/log4j/Appender.class") != null;
-
- IgniteBiTuple<Object, Object> t = null;
-
- Collection<Handler> savedHnds = null;
-
- if (isLog4jUsed)
- t = U.addLog4jNoOpLogger();
- else
- savedHnds = U.addJavaNoOpLogger();
-
- IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> cfgMap;
-
- try {
- cfgMap = loadConfigurations(springCfgUrl);
- }
- finally {
- if (isLog4jUsed && t != null)
- U.removeLog4jNoOpLogger(t);
-
- if (!isLog4jUsed)
- U.removeJavaNoOpLogger(savedHnds);
- }
-
- List<GridNamedInstance> grids = new ArrayList<>(cfgMap.size());
-
- try {
- for (IgniteConfiguration cfg : cfgMap.get1()) {
- assert cfg != null;
-
- if (cfg.getGridName() == null && !F.isEmpty(gridName))
- cfg.setGridName(gridName);
-
- if (cfgClo != null) {
- cfg = cfgClo.apply(cfg);
-
- assert cfg != null;
- }
-
- // Use either user defined context or our one.
- GridNamedInstance grid = start0(
- new GridStartContext(cfg, springCfgUrl, springCtx == null ? cfgMap.get2() : springCtx));
-
- // Add it if it was not stopped during startup.
- if (grid != null)
- grids.add(grid);
- }
- }
- catch (IgniteCheckedException e) {
- // Stop all instances started so far.
- for (GridNamedInstance grid : grids) {
- try {
- grid.stop(true);
- }
- catch (Exception e1) {
- U.error(grid.log, "Error when stopping grid: " + grid, e1);
- }
- }
-
- throw e;
- }
-
- // Return the first grid started.
- GridNamedInstance res = !grids.isEmpty() ? grids.get(0) : null;
-
- return res != null ? res.grid() : null;
- }
-
- /**
- * Resolve Spring configuration URL.
- *
- * @param springCfgPath Spring XML configuration file path or URL. This cannot be {@code null}.
- * @return URL.
- * @throws IgniteCheckedException If failed.
- */
- private static URL resolveSpringUrl(String springCfgPath) throws IgniteCheckedException {
- A.notNull(springCfgPath, "springCfgPath");
-
- URL url;
-
- try {
- url = new URL(springCfgPath);
- }
- catch (MalformedURLException e) {
- url = U.resolveGridGainUrl(springCfgPath);
-
- if (url == null)
- throw new IgniteCheckedException("Spring XML configuration path is invalid: " + springCfgPath +
- ". Note that this path should be either absolute or a relative local file system path, " +
- "relative to META-INF in classpath or valid URL to GRIDGAIN_HOME.", e);
- }
-
- return url;
- }
-
- /**
- * Starts grid with given configuration.
- *
- * @param startCtx Start context.
- * @return Started grid.
- * @throws IgniteCheckedException If grid could not be started.
- */
- private static GridNamedInstance start0(GridStartContext startCtx) throws IgniteCheckedException {
- assert startCtx != null;
-
- String name = startCtx.config().getGridName();
-
- if (name != null && name.isEmpty())
- throw new IgniteCheckedException("Non default grid instances cannot have empty string name.");
-
- GridNamedInstance grid = new GridNamedInstance(name);
-
- GridNamedInstance old;
-
- if (name != null)
- old = grids.putIfAbsent(name, grid);
- else {
- synchronized (dfltGridMux) {
- old = dfltGrid;
-
- if (old == null)
- dfltGrid = grid;
- }
- }
-
- if (old != null) {
- if (name == null)
- throw new IgniteCheckedException("Default grid instance has already been started.");
- else
- throw new IgniteCheckedException("Grid instance with this name has already been started: " + name);
- }
-
- if (startCtx.config().getWarmupClosure() != null)
- startCtx.config().getWarmupClosure().apply(startCtx.config());
-
- startCtx.single(grids.size() == 1);
-
- boolean success = false;
-
- try {
- grid.start(startCtx);
-
- notifyStateChange(name, STARTED);
-
- success = true;
- }
- finally {
- if (!success) {
- if (name != null)
- grids.remove(name, grid);
- else {
- synchronized (dfltGridMux) {
- if (dfltGrid == grid)
- dfltGrid = null;
- }
- }
-
- grid = null;
- }
- }
-
- if (grid == null)
- throw new IgniteCheckedException("Failed to start grid with provided configuration.");
-
- return grid;
- }
-
- /**
- * Gets an instance of default no-name grid. Note that
- * caller of this method should not assume that it will return the same
- * instance every time.
- * <p>
- * This method is identical to {@code G.grid(null)} apply.
- *
- * @return An instance of default no-name grid. This method never returns
- * {@code null}.
- * @throws org.apache.ignite.IgniteIllegalStateException Thrown if default grid was not properly
- * initialized or grid instance was stopped or was not started.
- */
- public static Ignite grid() throws IgniteIllegalStateException {
- return grid((String)null);
- }
-
- /**
- * Gets a list of all grids started so far.
- *
- * @return List of all grids started so far.
- */
- public static List<Ignite> allGrids() {
- List<Ignite> allIgnites = new ArrayList<>(grids.size() + 1);
-
- for (GridNamedInstance grid : grids.values()) {
- Ignite g = grid.grid();
-
- if (g != null)
- allIgnites.add(g);
- }
-
- GridNamedInstance dfltGrid0 = dfltGrid;
-
- if (dfltGrid0 != null) {
- IgniteKernal g = dfltGrid0.grid();
-
- if (g != null)
- allIgnites.add(g);
- }
-
- return allIgnites;
- }
-
- /**
- * Gets a grid instance for given local node ID. Note that grid instance and local node have
- * one-to-one relationship where node has ID and instance has name of the grid to which
- * both grid instance and its node belong. Note also that caller of this method
- * should not assume that it will return the same instance every time.
- *
- * @param locNodeId ID of local node the requested grid instance is managing.
- * @return An instance of named grid. This method never returns
- * {@code null}.
- * @throws org.apache.ignite.IgniteIllegalStateException Thrown if grid was not properly
- * initialized or grid instance was stopped or was not started.
- */
- public static Ignite grid(UUID locNodeId) throws IgniteIllegalStateException {
- A.notNull(locNodeId, "locNodeId");
-
- GridNamedInstance dfltGrid0 = dfltGrid;
-
- if (dfltGrid0 != null) {
- IgniteKernal g = dfltGrid0.grid();
-
- if (g != null && g.getLocalNodeId().equals(locNodeId))
- return g;
- }
-
- for (GridNamedInstance grid : grids.values()) {
- IgniteKernal g = grid.grid();
-
- if (g != null && g.getLocalNodeId().equals(locNodeId))
- return g;
- }
-
- throw new IgniteIllegalStateException("Grid instance with given local node ID was not properly " +
- "started or was stopped: " + locNodeId);
- }
-
- /**
- * Gets an named grid instance. If grid name is {@code null} or empty string,
- * then default no-name grid will be returned. Note that caller of this method
- * should not assume that it will return the same instance every time.
- * <p>
- * Note that Java VM can run multiple grid instances and every grid instance (and its
- * node) can belong to a different grid. Grid name defines what grid a particular grid
- * instance (and correspondingly its node) belongs to.
- *
- * @param name Grid name to which requested grid instance belongs to. If {@code null},
- * then grid instance belonging to a default no-name grid will be returned.
- * @return An instance of named grid. This method never returns
- * {@code null}.
- * @throws org.apache.ignite.IgniteIllegalStateException Thrown if default grid was not properly
- * initialized or grid instance was stopped or was not started.
- */
- public static Ignite grid(@Nullable String name) throws IgniteIllegalStateException {
- GridNamedInstance grid = name != null ? grids.get(name) : dfltGrid;
-
- Ignite res;
-
- if (grid == null || (res = grid.grid()) == null)
- throw new IgniteIllegalStateException("Grid instance was not properly started " +
- "or was already stopped: " + name);
-
- return res;
- }
-
- /**
- * Gets grid instance without waiting its initialization.
- *
- * @param name Grid name.
- * @return Grid instance.
- */
- public static IgniteKernal gridx(@Nullable String name) {
- GridNamedInstance grid = name != null ? grids.get(name) : dfltGrid;
-
- IgniteKernal res;
-
- if (grid == null || (res = grid.gridx()) == null)
- throw new IllegalStateException("Grid instance was not properly started or was already stopped: " + name);
-
- return res;
- }
-
- /**
- * Adds a lsnr for grid life cycle events.
- * <p>
- * Note that unlike other listeners in GridGain this listener will be
- * notified from the same thread that triggers the state change. Because of
- * that it is the responsibility of the user to make sure that listener logic
- * is light-weight and properly handles (catches) any runtime exceptions, if any
- * are expected.
- *
- * @param lsnr Listener for grid life cycle events. If this listener was already added
- * this method is no-op.
- */
- public static void addListener(IgniteListener lsnr) {
- A.notNull(lsnr, "lsnr");
-
- lsnrs.add(lsnr);
- }
-
- /**
- * Removes lsnr added by {@link #addListener(org.apache.ignite.lifecycle.IgniteListener)} method.
- *
- * @param lsnr Listener to remove.
- * @return {@code true} if lsnr was added before, {@code false} otherwise.
- */
- public static boolean removeListener(IgniteListener lsnr) {
- A.notNull(lsnr, "lsnr");
-
- return lsnrs.remove(lsnr);
- }
-
- /**
- * @param gridName Grid instance name.
- * @param state Factory state.
- */
- private static void notifyStateChange(@Nullable String gridName, IgniteState state) {
- if (gridName != null)
- gridStates.put(gridName, state);
- else
- dfltGridState = state;
-
- for (IgniteListener lsnr : lsnrs)
- lsnr.onStateChange(gridName, state);
- }
-
- /**
- * Start context encapsulates all starting parameters.
- */
- private static final class GridStartContext {
- /** User-defined configuration. */
- private IgniteConfiguration cfg;
-
- /** Optional configuration path. */
- private URL cfgUrl;
-
- /** Optional Spring application context. */
- private GridSpringResourceContext springCtx;
-
- /** Whether or not this is a single grid instance in current VM. */
- private boolean single;
-
- /**
- *
- * @param cfg User-defined configuration.
- * @param cfgUrl Optional configuration path.
- * @param springCtx Optional Spring application context.
- */
- GridStartContext(IgniteConfiguration cfg, @Nullable URL cfgUrl, @Nullable GridSpringResourceContext springCtx) {
- assert(cfg != null);
-
- this.cfg = cfg;
- this.cfgUrl = cfgUrl;
- this.springCtx = springCtx;
- }
-
- /**
- * @return Whether or not this is a single grid instance in current VM.
- */
- public boolean single() {
- return single;
- }
-
- /**
- * @param single Whether or not this is a single grid instance in current VM.
- */
- public void single(boolean single) {
- this.single = single;
- }
-
- /**
- * @return User-defined configuration.
- */
- IgniteConfiguration config() {
- return cfg;
- }
-
- /**
- * @param cfg User-defined configuration.
- */
- void config(IgniteConfiguration cfg) {
- this.cfg = cfg;
- }
-
- /**
- * @return Optional configuration path.
- */
- URL configUrl() {
- return cfgUrl;
- }
-
- /**
- * @param cfgUrl Optional configuration path.
- */
- void configUrl(URL cfgUrl) {
- this.cfgUrl = cfgUrl;
- }
-
- /**
- * @return Optional Spring application context.
- */
- public GridSpringResourceContext springContext() {
- return springCtx;
- }
- }
-
- /**
- * Grid data container.
- */
- private static final class GridNamedInstance {
- /** Map of registered MBeans. */
- private static final Map<MBeanServer, GridMBeanServerData> mbeans =
- new HashMap<>();
-
- /** */
- private static final String[] EMPTY_STR_ARR = new String[0];
-
- /** Empty array of caches. */
- private static final CacheConfiguration[] EMPTY_CACHE_CONFIGS = new CacheConfiguration[0];
-
- /** Grid name. */
- private final String name;
-
- /** Grid instance. */
- private volatile IgniteKernal grid;
-
- /** Executor service. */
- private ExecutorService execSvc;
-
- /** Auto executor service flag. */
- private boolean isAutoExecSvc;
-
- /** Executor service shutdown flag. */
- private boolean execSvcShutdown;
-
- /** System executor service. */
- private ExecutorService sysExecSvc;
-
- /** Auto system service flag. */
- private boolean isAutoSysSvc;
-
- /** System executor service shutdown flag. */
- private boolean sysSvcShutdown;
-
- /** Management executor service. */
- private ExecutorService mgmtExecSvc;
-
- /** Auto management service flag. */
- private boolean isAutoMgmtSvc;
-
- /** Management executor service shutdown flag. */
- private boolean mgmtSvcShutdown;
-
- /** P2P executor service. */
- private ExecutorService p2pExecSvc;
-
- /** Auto P2P service flag. */
- private boolean isAutoP2PSvc;
-
- /** P2P executor service shutdown flag. */
- private boolean p2pSvcShutdown;
-
- /** GGFS executor service. */
- private ExecutorService ggfsExecSvc;
-
- /** Auto GGFS service flag. */
- private boolean isAutoGgfsSvc;
-
- /** GGFS executor service shutdown flag. */
- private boolean ggfsSvcShutdown;
-
- /** REST requests executor service. */
- private ExecutorService restExecSvc;
-
- /** Auto REST service flag. */
- private boolean isAutoRestSvc;
-
- /** REST executor service shutdown flag. */
- private boolean restSvcShutdown;
-
- /** Utility cache executor service. */
- private ExecutorService utilityCacheExecSvc;
-
- /** Grid state. */
- private volatile IgniteState state = STOPPED;
-
- /** Shutdown hook. */
- private Thread shutdownHook;
-
- /** Grid log. */
- private IgniteLogger log;
-
- /** Start guard. */
- private final AtomicBoolean startGuard = new AtomicBoolean();
-
- /** Start latch. */
- private final CountDownLatch startLatch = new CountDownLatch(1);
-
- /**
- * Thread that starts this named instance. This field can be non-volatile since
- * it makes sense only for thread where it was originally initialized.
- */
- @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
- private Thread starterThread;
-
- /**
- * Creates un-started named instance.
- *
- * @param name Grid name (possibly {@code null} for default grid).
- */
- GridNamedInstance(@Nullable String name) {
- this.name = name;
- }
-
- /**
- * Gets grid name.
- *
- * @return Grid name.
- */
- String getName() {
- return name;
- }
-
- /**
- * Gets grid instance.
- *
- * @return Grid instance.
- */
- IgniteKernal grid() {
- if (starterThread != Thread.currentThread())
- U.awaitQuiet(startLatch);
-
- return grid;
- }
-
- /**
- * Gets grid instance without waiting for its initialization.
- *
- * @return Grid instance.
- */
- public IgniteKernal gridx() {
- return grid;
- }
-
- /**
- * Gets grid state.
- *
- * @return Grid state.
- */
- IgniteState state() {
- if (starterThread != Thread.currentThread())
- U.awaitQuiet(startLatch);
-
- return state;
- }
-
- /**
- * @param spi SPI implementation.
- * @throws IgniteCheckedException Thrown in case if multi-instance is not supported.
- */
- private void ensureMultiInstanceSupport(IgniteSpi spi) throws IgniteCheckedException {
- IgniteSpiMultipleInstancesSupport ann = U.getAnnotation(spi.getClass(),
- IgniteSpiMultipleInstancesSupport.class);
-
- if (ann == null || !ann.value())
- throw new IgniteCheckedException("SPI implementation doesn't support multiple grid instances in " +
- "the same VM: " + spi);
- }
-
- /**
- * @param spis SPI implementations.
- * @throws IgniteCheckedException Thrown in case if multi-instance is not supported.
- */
- private void ensureMultiInstanceSupport(IgniteSpi[] spis) throws IgniteCheckedException {
- for (IgniteSpi spi : spis)
- ensureMultiInstanceSupport(spi);
- }
-
- /**
- * Starts grid with given configuration.
- *
- * @param startCtx Starting context.
- * @throws IgniteCheckedException If start failed.
- */
- synchronized void start(GridStartContext startCtx) throws IgniteCheckedException {
- if (startGuard.compareAndSet(false, true)) {
- try {
- starterThread = Thread.currentThread();
-
- start0(startCtx);
- }
- catch (Exception e) {
- if (log != null)
- stopExecutors(log);
-
- throw e;
- }
- finally {
- startLatch.countDown();
- }
- }
- else
- U.awaitQuiet(startLatch);
- }
-
- /**
- * @param startCtx Starting context.
- * @throws IgniteCheckedException If start failed.
- */
- @SuppressWarnings({"unchecked", "TooBroadScope"})
- private void start0(GridStartContext startCtx) throws IgniteCheckedException {
- assert grid == null : "Grid is already started: " + name;
-
- IgniteConfiguration cfg = startCtx.config();
-
- if (cfg == null)
- cfg = new IgniteConfiguration();
-
- IgniteConfiguration myCfg = new IgniteConfiguration();
-
- String ggHome = cfg.getGridGainHome();
-
- // Set GridGain home.
- if (ggHome == null)
- ggHome = U.getGridGainHome();
- else
- // If user provided GRIDGAIN_HOME - set it as a system property.
- U.setGridGainHome(ggHome);
-
- U.setWorkDirectory(cfg.getWorkDirectory(), ggHome);
-
- /*
- * Set up all defaults and perform all checks.
- */
-
- // Ensure invariant.
- // It's a bit dirty - but this is a result of late refactoring
- // and I don't want to reshuffle a lot of code.
- assert F.eq(name, cfg.getGridName());
-
- // Set configuration URL, if any, into system property.
- if (startCtx.configUrl() != null)
- System.setProperty(GG_CONFIG_URL, startCtx.configUrl().toString());
-
- myCfg.setGridName(cfg.getGridName());
-
- UUID nodeId = cfg.getNodeId();
-
- if (nodeId == null)
- nodeId = UUID.randomUUID();
-
- IgniteLogger cfgLog = initLogger(cfg.getGridLogger(), nodeId);
-
- assert cfgLog != null;
-
- cfgLog = new GridLoggerProxy(cfgLog, null, name, U.id8(nodeId));
-
- // Initialize factory's log.
- log = cfgLog.getLogger(G.class);
-
- // Check GridGain home folder (after log is available).
- if (ggHome != null) {
- File ggHomeFile = new File(ggHome);
-
- if (!ggHomeFile.exists() || !ggHomeFile.isDirectory())
- throw new IgniteCheckedException("Invalid GridGain installation home folder: " + ggHome);
- }
-
- myCfg.setGridGainHome(ggHome);
-
- // Copy values that don't need extra processing.
- myCfg.setLicenseUrl(cfg.getLicenseUrl());
- myCfg.setPeerClassLoadingEnabled(cfg.isPeerClassLoadingEnabled());
- myCfg.setDeploymentMode(cfg.getDeploymentMode());
- myCfg.setNetworkTimeout(cfg.getNetworkTimeout());
- myCfg.setClockSyncSamples(cfg.getClockSyncSamples());
- myCfg.setClockSyncFrequency(cfg.getClockSyncFrequency());
- myCfg.setDiscoveryStartupDelay(cfg.getDiscoveryStartupDelay());
- myCfg.setMetricsHistorySize(cfg.getMetricsHistorySize());
- myCfg.setMetricsExpireTime(cfg.getMetricsExpireTime());
- myCfg.setMetricsUpdateFrequency(cfg.getMetricsUpdateFrequency());
- myCfg.setLifecycleBeans(cfg.getLifecycleBeans());
- myCfg.setLocalEventListeners(cfg.getLocalEventListeners());
- myCfg.setPeerClassLoadingMissedResourcesCacheSize(cfg.getPeerClassLoadingMissedResourcesCacheSize());
- myCfg.setIncludeEventTypes(cfg.getIncludeEventTypes());
- myCfg.setDaemon(cfg.isDaemon());
- myCfg.setIncludeProperties(cfg.getIncludeProperties());
- myCfg.setLifeCycleEmailNotification(cfg.isLifeCycleEmailNotification());
- myCfg.setMetricsLogFrequency(cfg.getMetricsLogFrequency());
- myCfg.setNetworkSendRetryDelay(cfg.getNetworkSendRetryDelay());
- myCfg.setNetworkSendRetryCount(cfg.getNetworkSendRetryCount());
- myCfg.setSecurityCredentialsProvider(cfg.getSecurityCredentialsProvider());
- myCfg.setServiceConfiguration(cfg.getServiceConfiguration());
- myCfg.setWarmupClosure(cfg.getWarmupClosure());
- myCfg.setInteropConfiguration(cfg.getInteropConfiguration());
- myCfg.setPluginConfigurations(cfg.getPluginConfigurations());
- myCfg.setTransactionsConfiguration(new TransactionsConfiguration(cfg.getTransactionsConfiguration()));
- myCfg.setQueryConfiguration(cfg.getQueryConfiguration());
-
- ClientConnectionConfiguration clientCfg = cfg.getClientConnectionConfiguration();
-
- if (clientCfg == null) {
- // If client config is not provided then create config copying values from GridConfiguration.
- if (cfg.isRestEnabled()) {
- clientCfg = new ClientConnectionConfiguration();
-
- clientCfg.setClientMessageInterceptor(cfg.getClientMessageInterceptor());
- clientCfg.setRestAccessibleFolders(cfg.getRestAccessibleFolders());
- clientCfg.setRestExecutorService(cfg.getRestExecutorService());
- clientCfg.setRestExecutorServiceShutdown(cfg.getRestExecutorServiceShutdown());
- clientCfg.setRestIdleTimeout(cfg.getRestIdleTimeout());
- clientCfg.setRestJettyPath(cfg.getRestJettyPath());
- clientCfg.setRestPortRange(cfg.getRestPortRange());
- clientCfg.setRestSecretKey(cfg.getRestSecretKey());
- clientCfg.setRestTcpDirectBuffer(cfg.isRestTcpDirectBuffer());
- clientCfg.setRestTcpHost(cfg.getRestTcpHost());
- clientCfg.setRestTcpNoDelay(cfg.isRestTcpNoDelay());
- clientCfg.setRestTcpPort(cfg.getRestTcpPort());
- clientCfg.setRestTcpReceiveBufferSize(cfg.getRestTcpReceiveBufferSize());
- clientCfg.setRestTcpSelectorCount(cfg.getRestTcpSelectorCount());
- clientCfg.setRestTcpSendBufferSize(cfg.getRestTcpSendBufferSize());
- clientCfg.setRestTcpSendQueueLimit(cfg.getRestTcpSendQueueLimit());
- clientCfg.setRestTcpSslClientAuth(cfg.isRestTcpSslClientAuth());
- clientCfg.setRestTcpSslContextFactory(cfg.getRestTcpSslContextFactory());
- clientCfg.setRestTcpSslEnabled(cfg.isRestTcpSslEnabled());
- }
- }
- else
- clientCfg = new ClientConnectionConfiguration(clientCfg);
-
-
- String ntfStr = IgniteSystemProperties.getString(GG_LIFECYCLE_EMAIL_NOTIFY);
-
- if (ntfStr != null)
- myCfg.setLifeCycleEmailNotification(Boolean.parseBoolean(ntfStr));
-
- // Local host.
- String locHost = IgniteSystemProperties.getString(GG_LOCAL_HOST);
-
- myCfg.setLocalHost(F.isEmpty(locHost) ? cfg.getLocalHost() : locHost);
-
- // Override daemon flag if it was set on the factory.
- if (daemon)
- myCfg.setDaemon(true);
-
- // Check for deployment mode override.
- String depModeName = IgniteSystemProperties.getString(GG_DEP_MODE_OVERRIDE);
-
- if (!F.isEmpty(depModeName)) {
- if (!F.isEmpty(cfg.getCacheConfiguration())) {
- U.quietAndInfo(log, "Skipping deployment mode override for caches (custom closure " +
- "execution may not work for console Visor)");
- }
- else {
- try {
- IgniteDeploymentMode depMode = IgniteDeploymentMode.valueOf(depModeName);
-
- if (myCfg.getDeploymentMode() != depMode)
- myCfg.setDeploymentMode(depMode);
- }
- catch (IllegalArgumentException e) {
- throw new IgniteCheckedException("Failed to override deployment mode using system property " +
- "(are there any misspellings?)" +
- "[name=" + GG_DEP_MODE_OVERRIDE + ", value=" + depModeName + ']', e);
- }
- }
- }
-
- Map<String, ?> attrs = cfg.getUserAttributes();
-
- if (attrs == null)
- attrs = Collections.emptyMap();
-
- MBeanServer mbSrv = cfg.getMBeanServer();
-
- IgniteMarshaller marsh = cfg.getMarshaller();
-
- String[] p2pExclude = cfg.getPeerClassLoadingLocalClassPathExclude();
-
- CommunicationSpi commSpi = cfg.getCommunicationSpi();
- DiscoverySpi discoSpi = cfg.getDiscoverySpi();
- EventStorageSpi evtSpi = cfg.getEventStorageSpi();
- CollisionSpi colSpi = cfg.getCollisionSpi();
- AuthenticationSpi authSpi = cfg.getAuthenticationSpi();
- SecureSessionSpi sesSpi = cfg.getSecureSessionSpi();
- DeploymentSpi deploySpi = cfg.getDeploymentSpi();
- CheckpointSpi[] cpSpi = cfg.getCheckpointSpi();
- FailoverSpi[] failSpi = cfg.getFailoverSpi();
- LoadBalancingSpi[] loadBalancingSpi = cfg.getLoadBalancingSpi();
- SwapSpaceSpi swapspaceSpi = cfg.getSwapSpaceSpi();
- GridIndexingSpi indexingSpi = cfg.getIndexingSpi();
-
- execSvc = cfg.getExecutorService();
- sysExecSvc = cfg.getSystemExecutorService();
- p2pExecSvc = cfg.getPeerClassLoadingExecutorService();
- mgmtExecSvc = cfg.getManagementExecutorService();
- ggfsExecSvc = cfg.getGgfsExecutorService();
-
- if (execSvc == null) {
- isAutoExecSvc = true;
-
- execSvc = new IgniteThreadPoolExecutor(
- "pub-" + cfg.getGridName(),
- DFLT_PUBLIC_CORE_THREAD_CNT,
- DFLT_PUBLIC_MAX_THREAD_CNT,
- DFLT_PUBLIC_KEEP_ALIVE_TIME,
- new LinkedBlockingQueue<Runnable>(DFLT_PUBLIC_THREADPOOL_QUEUE_CAP));
-
- // Pre-start all threads as they are guaranteed to be needed.
- ((ThreadPoolExecutor)execSvc).prestartAllCoreThreads();
- }
-
- if (sysExecSvc == null) {
- isAutoSysSvc = true;
-
- // Note that since we use 'LinkedBlockingQueue', number of
- // maximum threads has no effect.
- sysExecSvc = new IgniteThreadPoolExecutor(
- "sys-" + cfg.getGridName(),
- DFLT_SYSTEM_CORE_THREAD_CNT,
- DFLT_SYSTEM_MAX_THREAD_CNT,
- DFLT_SYSTEM_KEEP_ALIVE_TIME,
- new LinkedBlockingQueue<Runnable>(DFLT_SYSTEM_THREADPOOL_QUEUE_CAP));
-
- // Pre-start all threads as they are guaranteed to be needed.
- ((ThreadPoolExecutor)sysExecSvc).prestartAllCoreThreads();
- }
-
- if (mgmtExecSvc == null) {
- isAutoMgmtSvc = true;
-
- // Note that since we use 'LinkedBlockingQueue', number of
- // maximum threads has no effect.
- // Note, that we do not pre-start threads here as management pool may
- // not be needed.
- mgmtExecSvc = new IgniteThreadPoolExecutor(
- "mgmt-" + cfg.getGridName(),
- DFLT_MGMT_THREAD_CNT,
- DFLT_MGMT_THREAD_CNT,
- 0,
- new LinkedBlockingQueue<Runnable>());
- }
-
- if (p2pExecSvc == null) {
- isAutoP2PSvc = true;
-
- // Note that since we use 'LinkedBlockingQueue', number of
- // maximum threads has no effect.
- // Note, that we do not pre-start threads here as class loading pool may
- // not be needed.
- p2pExecSvc = new IgniteThreadPoolExecutor(
- "p2p-" + cfg.getGridName(),
- DFLT_P2P_THREAD_CNT,
- DFLT_P2P_THREAD_CNT,
- 0,
- new LinkedBlockingQueue<Runnable>());
- }
-
- if (ggfsExecSvc == null) {
- isAutoGgfsSvc = true;
-
- int procCnt = Runtime.getRuntime().availableProcessors();
-
- // Note that we do not pre-start threads here as ggfs pool may not be needed.
- ggfsExecSvc = new IgniteThreadPoolExecutor(
- "ggfs-" + cfg.getGridName(),
- procCnt,
- procCnt,
- 0,
- new LinkedBlockingQueue<Runnable>());
- }
-
- restExecSvc = clientCfg != null ? clientCfg.getRestExecutorService() : null;
-
- if (restExecSvc != null && !cfg.isRestEnabled()) {
- U.warn(log, "REST executor service is configured, but REST is disabled in configuration " +
- "(safely ignoring).");
- }
- else if (restExecSvc == null && clientCfg != null) {
- isAutoRestSvc = true;
-
- restExecSvc = new IgniteThreadPoolExecutor(
- "rest-" + cfg.getGridName(),
- DFLT_REST_CORE_THREAD_CNT,
- DFLT_REST_MAX_THREAD_CNT,
- DFLT_REST_KEEP_ALIVE_TIME,
- new LinkedBlockingQueue<Runnable>(DFLT_REST_THREADPOOL_QUEUE_CAP)
- );
-
- clientCfg.setRestExecutorService(restExecSvc);
- }
-
- utilityCacheExecSvc = new IgniteThreadPoolExecutor(
- "utility-" + cfg.getGridName(),
- DFLT_SYSTEM_CORE_THREAD_CNT,
- DFLT_SYSTEM_MAX_THREAD_CNT,
- DFLT_SYSTEM_KEEP_ALIVE_TIME,
- new LinkedBlockingQueue<Runnable>(DFLT_SYSTEM_THREADPOOL_QUEUE_CAP));
-
- execSvcShutdown = cfg.getExecutorServiceShutdown();
- sysSvcShutdown = cfg.getSystemExecutorServiceShutdown();
- mgmtSvcShutdown = cfg.getManagementExecutorServiceShutdown();
- p2pSvcShutdown = cfg.getPeerClassLoadingExecutorServiceShutdown();
- ggfsSvcShutdown = cfg.getGgfsExecutorServiceShutdown();
- restSvcShutdown = clientCfg != null && clientCfg.isRestExecutorServiceShutdown();
-
- if (marsh == null) {
- if (!U.isHotSpot()) {
- U.warn(log, "GridOptimizedMarshaller is not supported on this JVM " +
- "(only Java HotSpot VMs are supported). Switching to standard JDK marshalling - " +
- "object serialization performance will be significantly slower.",
- "To enable fast marshalling upgrade to recent 1.6 or 1.7 HotSpot VM release.");
-
- marsh = new IgniteJdkMarshaller();
- }
- else if (!IgniteOptimizedMarshaller.available()) {
- U.warn(log, "GridOptimizedMarshaller is not supported on this JVM " +
- "(only recent 1.6 and 1.7 versions HotSpot VMs are supported). " +
- "To enable fast marshalling upgrade to recent 1.6 or 1.7 HotSpot VM release. " +
- "Switching to standard JDK marshalling - " +
- "object serialization performance will be significantly slower.",
- "To enable fast marshalling upgrade to recent 1.6 or 1.7 HotSpot VM release.");
-
- marsh = new IgniteJdkMarshaller();
- }
- else
- marsh = new IgniteOptimizedMarshaller();
- }
- else if (marsh instanceof IgniteOptimizedMarshaller && !U.isHotSpot()) {
- U.warn(log, "Using GridOptimizedMarshaller on untested JVM (only Java HotSpot VMs were tested) - " +
- "object serialization behavior could yield unexpected results.",
- "Using GridOptimizedMarshaller on untested JVM.");
- }
-
- myCfg.setUserAttributes(attrs);
- myCfg.setMBeanServer(mbSrv == null ? ManagementFactory.getPlatformMBeanServer() : mbSrv);
- myCfg.setGridLogger(cfgLog);
- myCfg.setMarshaller(marsh);
- myCfg.setMarshalLocalJobs(cfg.isMarshalLocalJobs());
- myCfg.setExecutorService(execSvc);
- myCfg.setSystemExecutorService(sysExecSvc);
- myCfg.setManagementExecutorService(mgmtExecSvc);
- myCfg.setPeerClassLoadingExecutorService(p2pExecSvc);
- myCfg.setGgfsExecutorService(ggfsExecSvc);
- myCfg.setExecutorServiceShutdown(execSvcShutdown);
- myCfg.setSystemExecutorServiceShutdown(sysSvcShutdown);
- myCfg.setManagementExecutorServiceShutdown(mgmtSvcShutdown);
- myCfg.setPeerClassLoadingExecutorServiceShutdown(p2pSvcShutdown);
- myCfg.setGgfsExecutorServiceShutdown(ggfsSvcShutdown);
- myCfg.setNodeId(nodeId);
-
- IgniteFsConfiguration[] ggfsCfgs = cfg.getGgfsConfiguration();
-
- if (ggfsCfgs != null) {
- IgniteFsConfiguration[] clone = ggfsCfgs.clone();
-
- for (int i = 0; i < ggfsCfgs.length; i++)
- clone[i] = new IgniteFsConfiguration(ggfsCfgs[i]);
-
- myCfg.setGgfsConfiguration(clone);
- }
-
- StreamerConfiguration[] streamerCfgs = cfg.getStreamerConfiguration();
-
- if (streamerCfgs != null) {
- StreamerConfiguration[] clone = streamerCfgs.clone();
-
- for (int i = 0; i < streamerCfgs.length; i++)
- clone[i] = new StreamerConfiguration(streamerCfgs[i]);
-
- myCfg.setStreamerConfiguration(clone);
- }
-
- if (p2pExclude == null)
- p2pExclude = EMPTY_STR_ARR;
-
- myCfg.setPeerClassLoadingLocalClassPathExclude(p2pExclude);
-
- /*
- * Initialize default SPI implementations.
- */
-
- if (commSpi == null)
- commSpi = new TcpCommunicationSpi();
-
- if (discoSpi == null)
- discoSpi = new TcpDiscoverySpi();
-
- if (discoSpi instanceof TcpDiscoverySpi) {
- TcpDiscoverySpi tcpDisco = (TcpDiscoverySpi)discoSpi;
-
- if (tcpDisco.getIpFinder() == null)
- tcpDisco.setIpFinder(new TcpDiscoveryMulticastIpFinder());
- }
-
- if (evtSpi == null)
- evtSpi = new MemoryEventStorageSpi();
-
- if (colSpi == null)
- colSpi = new NoopCollisionSpi();
-
- if (authSpi == null)
- authSpi = new NoopAuthenticationSpi();
-
- if (sesSpi == null)
- sesSpi = new NoopSecureSessionSpi();
-
- if (deploySpi == null)
- deploySpi = new LocalDeploymentSpi();
-
- if (cpSpi == null)
- cpSpi = new CheckpointSpi[] {new NoopCheckpointSpi()};
-
- if (failSpi == null)
- failSpi = new FailoverSpi[] {new AlwaysFailoverSpi()};
-
- if (loadBalancingSpi == null)
- loadBalancingSpi = new LoadBalancingSpi[] {new RoundRobinLoadBalancingSpi()};
-
- if (swapspaceSpi == null) {
- boolean needSwap = false;
-
- CacheConfiguration[] caches = cfg.getCacheConfiguration();
-
- if (caches != null) {
- for (CacheConfiguration c : caches) {
- if (c.isSwapEnabled()) {
- needSwap = true;
-
- break;
- }
- }
- }
-
- swapspaceSpi = needSwap ? new FileSwapSpaceSpi() : new NoopSwapSpaceSpi();
- }
-
- if (indexingSpi == null)
- indexingSpi = new GridNoopIndexingSpi();
-
- myCfg.setCommunicationSpi(commSpi);
- myCfg.setDiscoverySpi(discoSpi);
- myCfg.setCheckpointSpi(cpSpi);
- myCfg.setEventStorageSpi(evtSpi);
- myCfg.setAuthenticationSpi(authSpi);
- myCfg.setSecureSessionSpi(sesSpi);
- myCfg.setDeploymentSpi(deploySpi);
- myCfg.setFailoverSpi(failSpi);
- myCfg.setCollisionSpi(colSpi);
- myCfg.setLoadBalancingSpi(loadBalancingSpi);
- myCfg.setSwapSpaceSpi(swapspaceSpi);
- myCfg.setIndexingSpi(indexingSpi);
-
- myCfg.setAddressResolver(cfg.getAddressResolver());
-
- // Set SMTP configuration.
- myCfg.setSmtpFromEmail(cfg.getSmtpFromEmail());
- myCfg.setSmtpHost(cfg.getSmtpHost());
- myCfg.setSmtpPort(cfg.getSmtpPort());
- myCfg.setSmtpSsl(cfg.isSmtpSsl());
- myCfg.setSmtpUsername(cfg.getSmtpUsername());
- myCfg.setSmtpPassword(cfg.getSmtpPassword());
- myCfg.setAdminEmails(cfg.getAdminEmails());
-
- // REST configuration.
- myCfg.setClientConnectionConfiguration(clientCfg);
-
- // Portable configuration.
- myCfg.setPortableConfiguration(cfg.getPortableConfiguration());
-
- // Hadoop configuration.
- myCfg.setHadoopConfiguration(cfg.getHadoopConfiguration());
-
- // Validate segmentation configuration.
- GridSegmentationPolicy segPlc = cfg.getSegmentationPolicy();
-
- // 1. Warn on potential configuration problem: grid is not configured to wait
- // for correct segment after segmentation happens.
- if (!F.isEmpty(cfg.getSegmentationResolvers()) && segPlc == RESTART_JVM && !cfg.isWaitForSegmentOnStart()) {
- U.warn(log, "Found potential configuration problem (forgot to enable waiting for segment" +
- "on start?) [segPlc=" + segPlc + ", wait=false]");
- }
-
- myCfg.setSegmentationResolvers(cfg.getSegmentationResolvers());
- myCfg.setSegmentationPolicy(segPlc);
- myCfg.setSegmentCheckFrequency(cfg.getSegmentCheckFrequency());
- myCfg.setWaitForSegmentOnStart(cfg.isWaitForSegmentOnStart());
- myCfg.setAllSegmentationResolversPassRequired(cfg.isAllSegmentationResolversPassRequired());
-
- // Override SMTP configuration from system properties
- // and environment variables, if specified.
- String fromEmail = IgniteSystemProperties.getString(GG_SMTP_FROM);
-
- if (fromEmail != null)
- myCfg.setSmtpFromEmail(fromEmail);
-
- String smtpHost = IgniteSystemProperties.getString(GG_SMTP_HOST);
-
- if (smtpHost != null)
- myCfg.setSmtpHost(smtpHost);
-
- String smtpUsername = IgniteSystemProperties.getString(GG_SMTP_USERNAME);
-
- if (smtpUsername != null)
- myCfg.setSmtpUsername(smtpUsername);
-
- String smtpPwd = IgniteSystemProperties.getString(GG_SMTP_PWD);
-
- if (smtpPwd != null)
- myCfg.setSmtpPassword(smtpPwd);
-
- int smtpPort = IgniteSystemProperties.getInteger(GG_SMTP_PORT, -1);
-
- if(smtpPort != -1)
- myCfg.setSmtpPort(smtpPort);
-
- myCfg.setSmtpSsl(IgniteSystemProperties.getBoolean(GG_SMTP_SSL));
-
- String adminEmails = IgniteSystemProperties.getString(GG_ADMIN_EMAILS);
-
- if (adminEmails != null)
- myCfg.setAdminEmails(adminEmails.split(","));
-
- CacheConfiguration[] cacheCfgs = cfg.getCacheConfiguration();
-
- boolean hasHadoop = IgniteComponentType.HADOOP.inClassPath();
-
- CacheConfiguration[] copies;
-
- if (cacheCfgs != null && cacheCfgs.length > 0) {
- if (!U.discoOrdered(discoSpi) && !U.relaxDiscoveryOrdered())
- throw new IgniteCheckedException("Discovery SPI implementation does not support node ordering and " +
- "cannot be used with cache (use SPI with @GridDiscoverySpiOrderSupport annotation, " +
- "like GridTcpDiscoverySpi)");
-
- for (CacheConfiguration ccfg : cacheCfgs) {
- if (CU.isHadoopSystemCache(ccfg.getName()))
- throw new IgniteCheckedException("Cache name cannot be \"" + CU.SYS_CACHE_HADOOP_MR +
- "\" because it is reserved for internal purposes.");
-
- if (CU.isUtilityCache(ccfg.getName()))
- throw new IgniteCheckedException("Cache name cannot start with \"" + CU.UTILITY_CACHE_NAME +
- "\" because this prefix is reserved for internal purposes.");
- }
-
- copies = new CacheConfiguration[cacheCfgs.length + (hasHadoop ? 2 : 1)];
-
- int cloneIdx = 1;
-
- if (hasHadoop)
- copies[cloneIdx++] = CU.hadoopSystemCache();
-
- for (CacheConfiguration ccfg : cacheCfgs)
- copies[cloneIdx++] = new CacheConfiguration(ccfg);
- }
- else if (hasHadoop) {
- // Populate system caches
- copies = new CacheConfiguration[hasHadoop ? 2 : 1];
-
- copies[1] = CU.hadoopSystemCache();
- }
- else
- copies = new CacheConfiguration[1];
-
- // Always add utility cache.
- copies[0] = utilitySystemCache(discoSpi instanceof TcpClientDiscoverySpi);
-
- myCfg.setCacheConfiguration(copies);
-
- myCfg.setCacheSanityCheckEnabled(cfg.isCacheSanityCheckEnabled());
-
- try {
- // Use reflection to avoid loading undesired classes.
- Class helperCls = Class.forName("org.gridgain.grid.util.GridConfigurationHelper");
-
- helperCls.getMethod("overrideConfiguration", IgniteConfiguration.class, Properties.class,
- String.class, IgniteLogger.class).invoke(helperCls, myCfg, System.getProperties(), name, log);
- }
- catch (Exception ignored) {
- // No-op.
- }
-
- // Ensure that SPIs support multiple grid instances, if required.
- if (!startCtx.single()) {
- ensureMultiInstanceSupport(deploySpi);
- ensureMultiInstanceSupport(commSpi);
- ensureMultiInstanceSupport(discoSpi);
- ensureMultiInstanceSupport(cpSpi);
- ensureMultiInstanceSupport(evtSpi);
- ensureMultiInstanceSupport(colSpi);
- ensureMultiInstanceSupport(failSpi);
- ensureMultiInstanceSupport(authSpi);
- ensureMultiInstanceSupport(sesSpi);
- ensureMultiInstanceSupport(loadBalancingSpi);
- ensureMultiInstanceSupport(swapspaceSpi);
- }
-
- // Register GridGain MBean for current grid instance.
- registerFactoryMbean(myCfg.getMBeanServer());
-
- boolean started = false;
-
- try {
- IgniteKernal grid0 = new IgniteKernal(startCtx.springContext());
-
- // Init here to make grid available to lifecycle listeners.
- grid = grid0;
-
- grid0.start(myCfg, utilityCacheExecSvc, new CA() {
- @Override public void apply() {
- startLatch.countDown();
- }
- });
-
- state = STARTED;
-
- if (log.isDebugEnabled())
- log.debug("Grid factory started ok: " + name);
-
- started = true;
- }
- catch (IgniteCheckedException e) {
- unregisterFactoryMBean();
-
- throw e;
- }
- // Catch Throwable to protect against any possible failure.
- catch (Throwable e) {
- unregisterFactoryMBean();
-
- throw new IgniteCheckedException("Unexpected exception when starting grid.", e);
- }
- finally {
- if (!started)
- // Grid was not started.
- grid = null;
- }
-
- // Do NOT set it up only if GRIDGAIN_NO_SHUTDOWN_HOOK=TRUE is provided.
- if (!IgniteSystemProperties.getBoolean(GG_NO_SHUTDOWN_HOOK, false)) {
- try {
- Runtime.getRuntime().addShutdownHook(shutdownHook = new Thread() {
- @Override public void run() {
- if (log.isInfoEnabled())
- log.info("Invoking shutdown hook...");
-
- GridNamedInstance.this.stop(true);
- }
- });
-
- if (log.isDebugEnabled())
- log.debug("Shutdown hook is installed.");
- }
- catch (IllegalStateException e) {
- stop(true);
-
- throw new IgniteCheckedException("Failed to install shutdown hook.", e);
- }
- }
- else {
- if (log.isDebugEnabled())
- log.debug("Shutdown hook has not been installed because environment " +
- "or system property " + GG_NO_SHUTDOWN_HOOK + " is set.");
- }
- }
-
- /**
- * @param cfgLog Configured logger.
- * @param nodeId Local node ID.
- * @return Initialized logger.
- * @throws IgniteCheckedException If failed.
- */
- private IgniteLogger initLogger(@Nullable IgniteLogger cfgLog, UUID nodeId) throws IgniteCheckedException {
- try {
- if (cfgLog == null) {
- Class<?> log4jCls;
-
- try {
- log4jCls = Class.forName("org.gridgain.grid.logger.log4j.GridLog4jLogger");
- }
- catch (ClassNotFoundException | NoClassDefFoundError ignored) {
- log4jCls = null;
- }
-
- if (log4jCls != null) {
- URL url = U.resolveGridGainUrl("config/gridgain-log4j.xml");
-
- if (url == null) {
- File cfgFile = new File("config/gridgain-log4j.xml");
-
- if (!cfgFile.exists())
- cfgFile = new File("../config/gridgain-log4j.xml");
-
- if (cfgFile.exists()) {
- try {
- url = cfgFile.toURI().toURL();
- }
- catch (MalformedURLException ignore) {
- // No-op.
- }
- }
- }
-
- if (url != null) {
- boolean configured = (Boolean)log4jCls.getMethod("isConfigured").invoke(null);
-
- if (configured)
- url = null;
- }
-
- if (url != null) {
- Constructor<?> ctor = log4jCls.getConstructor(URL.class);
-
- cfgLog = (IgniteLogger)ctor.newInstance(url);
- }
- else
- cfgLog = (IgniteLogger)log4jCls.newInstance();
- }
- else
- cfgLog = new IgniteJavaLogger();
- }
-
- // Set node IDs for all file appenders.
- if (cfgLog instanceof IgniteLoggerNodeIdAware)
- ((IgniteLoggerNodeIdAware)cfgLog).setNodeId(nodeId);
-
- return cfgLog;
- }
- catch (Exception e) {
- throw new IgniteCheckedException("Failed to create logger.", e);
- }
- }
-
- /**
- * Creates utility system cache configuration.
- *
- * @param client If {@code true} creates client-only cache configuration.
- * @return Utility system cache configuration.
- */
- private CacheConfiguration utilitySystemCache(boolean client) {
- CacheConfiguration cache = new CacheConfiguration();
-
- cache.setName(CU.UTILITY_CACHE_NAME);
- cache.setCacheMode(REPLICATED);
- cache.setAtomicityMode(TRANSACTIONAL);
- cache.setSwapEnabled(false);
- cache.setQueryIndexEnabled(false);
- cache.setPreloadMode(SYNC);
- cache.setWriteSynchronizationMode(FULL_SYNC);
- cache.setAffinity(new CacheRendezvousAffinityFunction(false, 100));
-
- if (client)
- cache.setDistributionMode(CLIENT_ONLY);
-
- return cache;
- }
-
- /**
- * Stops grid.
- *
- * @param cancel Flag indicating whether all currently running jobs
- * should be cancelled.
- */
- void stop(boolean cancel) {
- // Stop cannot be called prior to start from public API,
- // since it checks for STARTED state. So, we can assert here.
- assert startGuard.get();
-
- stop0(cancel);
- }
-
- /**
- * @param cancel Flag indicating whether all currently running jobs
- * should be cancelled.
- */
- private synchronized void stop0(boolean cancel) {
- IgniteKernal grid0 = grid;
-
- // Double check.
- if (grid0 == null) {
- if (log != null)
- U.warn(log, "Attempting to stop an already stopped grid instance (ignore): " + name);
-
- return;
- }
-
- if (shutdownHook != null)
- try {
- Runtime.getRuntime().removeShutdownHook(shutdownHook);
-
- shutdownHook = null;
-
- if (log.isDebugEnabled())
- log.debug("Shutdown hook is removed.");
- }
- catch (IllegalStateException e) {
- // Shutdown is in progress...
- if (log.isDebugEnabled())
- log.debug("Shutdown is in progress (ignoring): " + e.getMessage());
- }
-
- // Unregister GridGain MBean.
- unregisterFactoryMBean();
-
- try {
- grid0.stop(cancel);
-
- if (log.isDebugEnabled())
- log.debug("Grid instance stop
<TRUNCATED>
[31/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java
index 0000000,05f7ffb..822c0bc
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageAdapter.java
@@@ -1,0 -1,218 +1,206 @@@
+ /*
+ * 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.util.direct;
+
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*;
+ import org.apache.ignite.internal.processors.clock.*;
-import org.apache.ignite.internal.util.nio.*;
-import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ import static org.apache.ignite.events.IgniteEventType.*;
+
+ /**
+ * Communication message adapter.
+ */
+ public abstract class GridTcpCommunicationMessageAdapter implements Serializable, Cloneable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ public static final byte[] BYTE_ARR_NOT_READ = new byte[0];
+
+ /** */
+ public static final short[] SHORT_ARR_NOT_READ = new short[0];
+
+ /** */
+ public static final int[] INT_ARR_NOT_READ = new int[0];
+
+ /** */
+ public static final long[] LONG_ARR_NOT_READ = new long[0];
+
+ /** */
+ public static final float[] FLOAT_ARR_NOT_READ = new float[0];
+
+ /** */
+ public static final double[] DOUBLE_ARR_NOT_READ = new double[0];
+
+ /** */
+ public static final char[] CHAR_ARR_NOT_READ = new char[0];
+
+ /** */
+ public static final boolean[] BOOLEAN_ARR_NOT_READ = new boolean[0];
+
+ /** */
+ public static final UUID UUID_NOT_READ = new UUID(0, 0);
+
+ /** */
++ public static final ByteBuffer BYTE_BUF_NOT_READ = ByteBuffer.allocate(0);
++
++ /** */
+ public static final IgniteUuid GRID_UUID_NOT_READ = new IgniteUuid(new UUID(0, 0), 0);
+
+ /** */
+ public static final GridClockDeltaVersion CLOCK_DELTA_VER_NOT_READ = new GridClockDeltaVersion(0, 0);
+
+ /** */
+ public static final GridByteArrayList BYTE_ARR_LIST_NOT_READ = new GridByteArrayList(new byte[0]);
+
+ /** */
+ public static final GridLongList LONG_LIST_NOT_READ = new GridLongList(0);
+
+ /** */
+ public static final GridCacheVersion CACHE_VER_NOT_READ = new GridCacheVersion(0, 0, 0, 0);
+
+ /** */
+ public static final GridDhtPartitionExchangeId DHT_PART_EXCHANGE_ID_NOT_READ =
+ new GridDhtPartitionExchangeId(new UUID(0, 0), EVT_NODE_LEFT, 1);
+
+ /** */
+ public static final GridCacheValueBytes VAL_BYTES_NOT_READ = new GridCacheValueBytes();
+
+ /** */
+ @SuppressWarnings("RedundantStringConstructorCall")
+ public static final String STR_NOT_READ = new String();
+
+ /** */
+ public static final BitSet BIT_SET_NOT_READ = new BitSet();
+
+ /** */
- public static final Enum<?> ENUM_NOT_READ = DummyEnum.DUMMY;
-
- /** */
+ public static final GridTcpCommunicationMessageAdapter MSG_NOT_READ = new GridTcpCommunicationMessageAdapter() {
+ @SuppressWarnings("CloneDoesntCallSuperClone")
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override public boolean writeTo(ByteBuffer buf) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override public boolean readFrom(ByteBuffer buf) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override public byte directType() {
+ throw new UnsupportedOperationException();
+ }
+ };
+
+ /** */
+ protected static final Object NULL = new Object();
+
+ /** */
+ protected final GridTcpCommunicationMessageState commState = new GridTcpCommunicationMessageState();
+
+ /**
- * @param msgWriter Message writer.
- * @param nodeId Node ID (provided only if versions are different).
++ * @param writer Writer.
+ */
- public void messageWriter(GridNioMessageWriter msgWriter, @Nullable UUID nodeId) {
- assert msgWriter != null;
++ public final void setWriter(MessageWriter writer) {
++ assert writer != null;
+
- commState.messageWriter(msgWriter, nodeId);
++ commState.setWriter(writer);
+ }
+
+ /**
- * @param msgReader Message reader.
- * @param nodeId Node ID (provided only if versions are different).
++ * @param reader Reader.
+ */
- public void messageReader(GridNioMessageReader msgReader, @Nullable UUID nodeId) {
- assert msgReader != null;
++ public final void setReader(MessageReader reader) {
++ assert reader != null;
+
- commState.messageReader(msgReader, nodeId);
++ commState.setReader(reader);
+ }
+
+ /**
+ * @param buf Byte buffer.
+ * @return Whether message was fully written.
+ */
+ public abstract boolean writeTo(ByteBuffer buf);
+
+ /**
+ * @param buf Byte buffer.
+ * @return Whether message was fully read.
+ */
+ public abstract boolean readFrom(ByteBuffer buf);
+
+ /**
+ * @return Message type.
+ */
+ public abstract byte directType();
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException")
+ @Override public abstract GridTcpCommunicationMessageAdapter clone();
+
+ /**
+ * Clones all fields of the provided message to {@code this}.
+ *
+ * @param _msg Message to clone from.
+ */
+ protected abstract void clone0(GridTcpCommunicationMessageAdapter _msg);
+
+ /**
+ * @return {@code True} if should skip recovery for this message.
+ */
+ public boolean skipRecovery() {
+ return false;
+ }
+
+ /**
+ * @param arr Array.
+ * @return Array iterator.
+ */
+ protected final Iterator<?> arrayIterator(final Object[] arr) {
+ return new Iterator<Object>() {
+ private int idx;
+
+ @Override public boolean hasNext() {
+ return idx < arr.length;
+ }
+
+ @Override public Object next() {
+ if (!hasNext())
+ throw new NoSuchElementException();
+
+ return arr[idx++];
+ }
+
+ @Override public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
-
- /**
- * Dummy enum.
- */
- private enum DummyEnum {
- /** */
- DUMMY
- }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageFactory.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageFactory.java
index 0000000,9ef1b10..7007493
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageFactory.java
@@@ -1,0 -1,359 +1,359 @@@
+ /*
+ * 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.util.direct;
+
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.managers.checkpoint.*;
+ import org.apache.ignite.internal.managers.communication.*;
+ import org.apache.ignite.internal.managers.deployment.*;
+ import org.apache.ignite.internal.managers.eventstorage.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.processors.cache.distributed.dht.*;
+ import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.*;
+ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*;
+ import org.apache.ignite.internal.processors.cache.distributed.near.*;
+ import org.apache.ignite.internal.processors.cache.query.*;
+ import org.apache.ignite.internal.processors.clock.*;
+ import org.apache.ignite.internal.processors.continuous.*;
+ import org.apache.ignite.internal.processors.dataload.*;
+ import org.apache.ignite.internal.processors.rest.handlers.task.*;
+ import org.apache.ignite.internal.processors.streamer.*;
+ import org.apache.ignite.spi.collision.jobstealing.*;
+ import org.apache.ignite.spi.communication.tcp.*;
+ import org.jdk8.backport.*;
+
+ import java.util.*;
+
+ /**
+ * Communication message factory.
+ */
+ public class GridTcpCommunicationMessageFactory {
+ /** Common message producers. */
+ private static final GridTcpCommunicationMessageProducer[] COMMON = new GridTcpCommunicationMessageProducer[83];
+
+ /**
+ * Custom messages registry. Used for test purposes.
+ */
+ private static final Map<Byte, GridTcpCommunicationMessageProducer> CUSTOM = new ConcurrentHashMap8<>();
+
+ /** */
+ public static final int MAX_COMMON_TYPE = 82;
+
+ static {
+ registerCommon(new GridTcpCommunicationMessageProducer() {
+ @Override public GridTcpCommunicationMessageAdapter create(byte type) {
+ switch (type) {
+ case 0:
+ return new GridJobCancelRequest();
+
+ case 2:
+ return new GridJobExecuteResponse();
+
+ case 3:
+ return new GridJobSiblingsRequest();
+
+ case 4:
+ return new GridJobSiblingsResponse();
+
+ case 5:
+ return new GridTaskCancelRequest();
+
+ case 6:
+ return new GridTaskSessionRequest();
+
+ case 7:
+ return new GridCheckpointRequest();
+
+ case 8:
+ return new GridIoMessage();
+
+ case 9:
+ return new GridIoUserMessage();
+
+ case 10:
+ return new GridDeploymentInfoBean();
+
+ case 11:
+ return new GridDeploymentRequest();
+
+ case 12:
+ return new GridDeploymentResponse();
+
+ case 13:
+ return new GridEventStorageMessage();
+
+ case 16:
+ return new GridCacheEvictionRequest();
+
+ case 17:
+ return new GridCacheEvictionResponse();
+
+ case 18:
+ return new GridCacheOptimisticCheckPreparedTxRequest();
+
+ case 19:
+ return new GridCacheOptimisticCheckPreparedTxResponse();
+
+ case 20:
+ return new GridCachePessimisticCheckCommittedTxRequest();
+
+ case 21:
+ return new GridCachePessimisticCheckCommittedTxResponse();
+
+ case 22:
+ return new GridDistributedLockRequest();
+
+ case 23:
+ return new GridDistributedLockResponse();
+
+ case 24:
+ return new GridDistributedTxFinishRequest();
+
+ case 25:
+ return new GridDistributedTxFinishResponse();
+
+ case 26:
+ return new GridDistributedTxPrepareRequest();
+
+ case 27:
+ return new GridDistributedTxPrepareResponse();
+
+ case 28:
+ return new GridDistributedUnlockRequest();
+
+ case 29:
+ return new GridDhtLockRequest();
+
+ case 30:
+ return new GridDhtLockResponse();
+
+ case 31:
+ return new GridDhtTxFinishRequest();
+
+ case 32:
+ return new GridDhtTxFinishResponse();
+
+ case 33:
+ return new GridDhtTxPrepareRequest();
+
+ case 34:
+ return new GridDhtTxPrepareResponse();
+
+ case 35:
+ return new GridDhtUnlockRequest();
+
+ case 36:
+ return new GridDhtAtomicDeferredUpdateResponse();
+
+ case 37:
+ return new GridDhtAtomicUpdateRequest();
+
+ case 38:
+ return new GridDhtAtomicUpdateResponse();
+
+ case 39:
+ return new GridNearAtomicUpdateRequest();
+
+ case 40:
+ return new GridNearAtomicUpdateResponse();
+
+ case 41:
+ return new GridDhtForceKeysRequest();
+
+ case 42:
+ return new GridDhtForceKeysResponse();
+
+ case 43:
+ return new GridDhtPartitionDemandMessage();
+
+ case 44:
+ return new GridDhtPartitionSupplyMessage();
+
+ case 45:
+ return new GridDhtPartitionsFullMessage();
+
+ case 46:
+ return new GridDhtPartitionsSingleMessage();
+
+ case 47:
+ return new GridDhtPartitionsSingleRequest();
+
+ case 48:
+ return new GridNearGetRequest();
+
+ case 49:
+ return new GridNearGetResponse();
+
+ case 50:
+ return new GridNearLockRequest();
+
+ case 51:
+ return new GridNearLockResponse();
+
+ case 52:
+ return new GridNearTxFinishRequest();
+
+ case 53:
+ return new GridNearTxFinishResponse();
+
+ case 54:
+ return new GridNearTxPrepareRequest();
+
+ case 55:
+ return new GridNearTxPrepareResponse();
+
+ case 56:
+ return new GridNearUnlockRequest();
+
+ case 57:
+ return new GridCacheQueryRequest();
+
+ case 58:
+ return new GridCacheQueryResponse();
+
+ case 59:
+ return new GridClockDeltaSnapshotMessage();
+
+ case 60:
+ return new GridContinuousMessage();
+
+ case 61:
+ return new GridDataLoadRequest();
+
+ case 62:
+ return new GridDataLoadResponse();
+
+ // 65-72 are GGFS messages (see GridGgfsOpProcessor).
+
+ case 73:
+ return new GridTaskResultRequest();
+
+ case 74:
+ return new GridTaskResultResponse();
+
+ // TODO: Register from streamer processor.
+ case 75:
+ return new GridStreamerCancelRequest();
+
+ case 76:
+ return new GridStreamerExecutionRequest();
+
+ case 77:
+ return new GridStreamerResponse();
+
+ case 78:
+ return new JobStealingRequest();
+
+ case 79:
+ return new GridDhtAffinityAssignmentRequest();
+
+ case 80:
+ return new GridDhtAffinityAssignmentResponse();
+
+ case 81:
+ return new GridJobExecuteRequest();
+
+ case 82:
+ return new GridCacheTtlUpdateRequest();
+
+ default:
+ assert false : "Invalid message type.";
+
+ return null;
+ }
+ }
+ }, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 64, /* 65-72 - GGFS messages. */ 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82);
+ }
+
+ /**
+ * @param type Message type.
+ * @return New message.
+ */
+ public static GridTcpCommunicationMessageAdapter create(byte type) {
+ if (type == TcpCommunicationSpi.NODE_ID_MSG_TYPE)
+ return new TcpCommunicationSpi.NodeIdMessage();
+ else if (type == TcpCommunicationSpi.RECOVERY_LAST_ID_MSG_TYPE)
+ return new TcpCommunicationSpi.RecoveryLastReceivedMessage();
+ else if (type == TcpCommunicationSpi.HANDSHAKE_MSG_TYPE)
+ return new TcpCommunicationSpi.HandshakeMessage();
+ else
+ return create0(type);
+ }
+
+ /**
+ * @param type Message type.
+ * @return New message.
+ */
+ private static GridTcpCommunicationMessageAdapter create0(byte type) {
+ if (type >= 0 && type < COMMON.length) {
+ GridTcpCommunicationMessageProducer producer = COMMON[type];
+
+ if (producer != null)
+ return producer.create(type);
+ else
+ throw new IllegalStateException("Common message type producer is not registered: " + type);
+ }
+ else {
+ GridTcpCommunicationMessageProducer c = CUSTOM.get(type);
+
+ if (c != null)
+ return c.create(type);
+ else
+ throw new IllegalStateException("Custom message type producer is not registered: " + type);
+ }
+ }
+
+ /**
+ * Register message producer for common message type.
+ *
+ * @param producer Producer.
+ * @param types Types applicable for this producer.
+ */
+ public static void registerCommon(GridTcpCommunicationMessageProducer producer, int... types) {
+ for (int type : types) {
- assert type >= 0 && type < COMMON.length : "Commmon type being registered is out of common messages " +
++ assert type >= 0 && type < COMMON.length : "Common type being registered is out of common messages " +
+ "array length: " + type;
+
+ COMMON[type] = producer;
+ }
+ }
+
+ /**
+ * Registers factory for custom message. Used for test purposes.
+ *
+ * @param producer Message producer.
+ * @param type Message type.
+ */
+ public static void registerCustom(GridTcpCommunicationMessageProducer producer, byte type) {
+ assert producer != null;
+
+ CUSTOM.put(type, producer);
+ }
+
+ /**
+ * @return Common message producers.
+ */
+ public static GridTcpCommunicationMessageProducer[] commonProducers() {
+ return COMMON;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java
index 0000000,9b3863c..85717e4
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/direct/GridTcpCommunicationMessageState.java
@@@ -1,0 -1,1599 +1,774 @@@
+ /*
+ * 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.util.direct;
+
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*;
+ import org.apache.ignite.internal.processors.clock.*;
-import org.apache.ignite.internal.util.nio.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+ import sun.misc.*;
-import sun.nio.ch.*;
+
+ import java.nio.*;
+ import java.util.*;
+
+ import static org.apache.ignite.internal.util.direct.GridTcpCommunicationMessageAdapter.*;
+
+ /**
+ * Communication message state.
+ */
+ @SuppressWarnings("PublicField")
+ public class GridTcpCommunicationMessageState {
+ /** */
+ private static final Unsafe UNSAFE = GridUnsafe.unsafe();
+
+ /** */
+ private static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class);
+
+ /** */
- private static final long SHORT_ARR_OFF = UNSAFE.arrayBaseOffset(short[].class);
++ private MessageWriter writer;
+
+ /** */
- private static final long INT_ARR_OFF = UNSAFE.arrayBaseOffset(int[].class);
-
- /** */
- private static final long LONG_ARR_OFF = UNSAFE.arrayBaseOffset(long[].class);
-
- /** */
- private static final long FLOAT_ARR_OFF = UNSAFE.arrayBaseOffset(float[].class);
-
- /** */
- private static final long DOUBLE_ARR_OFF = UNSAFE.arrayBaseOffset(double[].class);
-
- /** */
- private static final long CHAR_ARR_OFF = UNSAFE.arrayBaseOffset(char[].class);
-
- /** */
- private static final long BOOLEAN_ARR_OFF = UNSAFE.arrayBaseOffset(boolean[].class);
-
- /** */
- private static final byte[] BYTE_ARR_EMPTY = new byte[0];
-
- /** */
- private static final short[] SHORT_ARR_EMPTY = new short[0];
-
- /** */
- private static final int[] INT_ARR_EMPTY = new int[0];
-
- /** */
- private static final long[] LONG_ARR_EMPTY = new long[0];
-
- /** */
- private static final float[] FLOAT_ARR_EMPTY = new float[0];
-
- /** */
- private static final double[] DOUBLE_ARR_EMPTY = new double[0];
-
- /** */
- private static final char[] CHAR_ARR_EMPTY = new char[0];
-
- /** */
- private static final boolean[] BOOLEAN_ARR_EMPTY = new boolean[0];
-
- /** */
- private static final byte[] EMPTY_UUID_BYTES = new byte[16];
-
- /** */
- private static final ArrayCreator<byte[]> BYTE_ARR_CREATOR = new ArrayCreator<byte[]>() {
- @Override public byte[] create(int len) {
- switch (len) {
- case -1:
- return BYTE_ARR_NOT_READ;
-
- case 0:
- return BYTE_ARR_EMPTY;
-
- default:
- return new byte[len];
- }
- }
- };
-
- /** */
- private static final ArrayCreator<short[]> SHORT_ARR_CREATOR = new ArrayCreator<short[]>() {
- @Override public short[] create(int len) {
- switch (len) {
- case -1:
- return SHORT_ARR_NOT_READ;
-
- case 0:
- return SHORT_ARR_EMPTY;
-
- default:
- return new short[len];
- }
- }
- };
-
- /** */
- private static final ArrayCreator<int[]> INT_ARR_CREATOR = new ArrayCreator<int[]>() {
- @Override public int[] create(int len) {
- switch (len) {
- case -1:
- return INT_ARR_NOT_READ;
-
- case 0:
- return INT_ARR_EMPTY;
-
- default:
- return new int[len];
- }
- }
- };
-
- /** */
- private static final ArrayCreator<long[]> LONG_ARR_CREATOR = new ArrayCreator<long[]>() {
- @Override public long[] create(int len) {
- switch (len) {
- case -1:
- return LONG_ARR_NOT_READ;
-
- case 0:
- return LONG_ARR_EMPTY;
-
- default:
- return new long[len];
- }
- }
- };
-
- /** */
- private static final ArrayCreator<float[]> FLOAT_ARR_CREATOR = new ArrayCreator<float[]>() {
- @Override public float[] create(int len) {
- switch (len) {
- case -1:
- return FLOAT_ARR_NOT_READ;
-
- case 0:
- return FLOAT_ARR_EMPTY;
-
- default:
- return new float[len];
- }
- }
- };
-
- /** */
- private static final ArrayCreator<double[]> DOUBLE_ARR_CREATOR = new ArrayCreator<double[]>() {
- @Override public double[] create(int len) {
- switch (len) {
- case -1:
- return DOUBLE_ARR_NOT_READ;
-
- case 0:
- return DOUBLE_ARR_EMPTY;
-
- default:
- return new double[len];
- }
- }
- };
-
- /** */
- private static final ArrayCreator<char[]> CHAR_ARR_CREATOR = new ArrayCreator<char[]>() {
- @Override public char[] create(int len) {
- switch (len) {
- case -1:
- return CHAR_ARR_NOT_READ;
-
- case 0:
- return CHAR_ARR_EMPTY;
-
- default:
- return new char[len];
- }
- }
- };
-
- /** */
- private static final ArrayCreator<boolean[]> BOOLEAN_ARR_CREATOR = new ArrayCreator<boolean[]>() {
- @Override public boolean[] create(int len) {
- switch (len) {
- case -1:
- return BOOLEAN_ARR_NOT_READ;
-
- case 0:
- return BOOLEAN_ARR_EMPTY;
-
- default:
- return new boolean[len];
- }
- }
- };
-
- /** */
- private GridNioMessageWriter msgWriter;
-
- /** */
- private GridNioMessageReader msgReader;
-
- /** */
- private UUID nodeId;
-
- /** */
- private ByteBuffer buf;
-
- /** */
- private byte[] heapArr;
-
- /** */
- private long baseOff;
-
- /** */
- private boolean arrHdrDone;
-
- /** */
- private int arrOff;
-
- /** */
- private Object tmpArr;
-
- /** */
- private int tmpArrOff;
-
- /** */
- private int tmpArrBytes;
-
- /** */
- private boolean msgNotNull;
-
- /** */
- private boolean msgNotNullDone;
-
- /** */
- private boolean msgTypeDone;
-
- /** */
- private GridTcpCommunicationMessageAdapter msg;
++ private MessageReader reader;
+
+ /** */
+ public int idx;
+
+ /** */
+ public boolean typeWritten;
+
+ /** */
+ public Iterator<?> it;
+
+ /** */
+ public Object cur = NULL;
+
+ /** */
+ public boolean keyDone;
+
+ /** */
+ public int readSize = -1;
+
+ /** */
+ public int readItems;
+
+ /**
- * @param msgWriter Message writer.
- * @param nodeId Node ID (provided only if versions are different).
++ * @param writer Writer.
+ */
- public void messageWriter(GridNioMessageWriter msgWriter, @Nullable UUID nodeId) {
- assert msgWriter != null;
-
- this.msgWriter = msgWriter;
- this.nodeId = nodeId;
++ public final void setWriter(MessageWriter writer) {
++ if (this.writer == null)
++ this.writer = writer;
+ }
+
+ /**
- * @param msgReader Message reader.
- * @param nodeId Node ID (provided only if versions are different).
++ * @param reader Reader.
+ */
- public void messageReader(GridNioMessageReader msgReader, @Nullable UUID nodeId) {
- assert msgReader != null;
-
- this.msgReader = msgReader;
- this.nodeId = nodeId;
++ public final void setReader(MessageReader reader) {
++ if (this.reader == null)
++ this.reader = reader;
+ }
+
+ /**
+ * @param buf Buffer.
+ */
+ public final void setBuffer(ByteBuffer buf) {
- assert buf != null;
-
- if (this.buf != buf) {
- this.buf = buf;
++ if (writer != null)
++ writer.setBuffer(buf);
+
- heapArr = buf.isDirect() ? null : buf.array();
- baseOff = buf.isDirect() ? ((DirectBuffer)buf).address() : BYTE_ARR_OFF;
- }
++ if (reader != null)
++ reader.setBuffer(buf);
+ }
+
+ /**
++ * @param name Field name.
+ * @param b Byte value.
+ * @return Whether value was written.
+ */
- public final boolean putByte(byte b) {
- assert buf != null;
-
- if (!buf.hasRemaining())
- return false;
-
- int pos = buf.position();
-
- UNSAFE.putByte(heapArr, baseOff + pos, b);
-
- buf.position(pos + 1);
-
- return true;
++ public final boolean putByte(String name, byte b) {
++ return writer.writeByte(name, b);
+ }
+
+ /**
++ * @param name Field name.
+ * @return Byte value.
+ */
- public final byte getByte() {
- assert buf != null;
- assert buf.hasRemaining();
-
- int pos = buf.position();
-
- buf.position(pos + 1);
-
- return UNSAFE.getByte(heapArr, baseOff + pos);
++ public final byte getByte(String name) {
++ return reader.readByte(name);
+ }
+
+ /**
++ * @param name Field name.
+ * @param s Short value.
+ * @return Whether value was written.
+ */
- public final boolean putShort(short s) {
- assert buf != null;
-
- if (buf.remaining() < 2)
- return false;
-
- int pos = buf.position();
-
- UNSAFE.putShort(heapArr, baseOff + pos, s);
-
- buf.position(pos + 2);
-
- return true;
++ public final boolean putShort(String name, short s) {
++ return writer.writeShort(name, s);
+ }
+
+ /**
++ * @param name Field name.
+ * @return Short value.
+ */
- public final short getShort() {
- assert buf != null;
- assert buf.remaining() >= 2;
-
- int pos = buf.position();
-
- buf.position(pos + 2);
-
- return UNSAFE.getShort(heapArr, baseOff + pos);
++ public final short getShort(String name) {
++ return reader.readShort(name);
+ }
+
+ /**
++ * @param name Field name.
+ * @param i Integer value.
+ * @return Whether value was written.
+ */
- public final boolean putInt(int i) {
- assert buf != null;
-
- if (buf.remaining() < 4)
- return false;
-
- int pos = buf.position();
-
- UNSAFE.putInt(heapArr, baseOff + pos, i);
-
- buf.position(pos + 4);
-
- return true;
++ public final boolean putInt(String name, int i) {
++ return writer.writeInt(name, i);
+ }
+
+ /**
++ * @param name Field name.
+ * @return Integer value.
+ */
- public final int getInt() {
- assert buf != null;
- assert buf.remaining() >= 4;
-
- int pos = buf.position();
-
- buf.position(pos + 4);
-
- return UNSAFE.getInt(heapArr, baseOff + pos);
++ public final int getInt(String name) {
++ return reader.readInt(name);
+ }
+
+ /**
++ * @param name Field name.
+ * @param l Long value.
+ * @return Whether value was written.
+ */
- public final boolean putLong(long l) {
- assert buf != null;
-
- if (buf.remaining() < 8)
- return false;
-
- int pos = buf.position();
-
- UNSAFE.putLong(heapArr, baseOff + pos, l);
-
- buf.position(pos + 8);
-
- return true;
++ public final boolean putLong(String name, long l) {
++ return writer.writeLong(name, l);
+ }
+
+ /**
++ * @param name Field name.
+ * @return Long value.
+ */
- public final long getLong() {
- assert buf != null;
- assert buf.remaining() >= 8;
-
- int pos = buf.position();
-
- buf.position(pos + 8);
-
- return UNSAFE.getLong(heapArr, baseOff + pos);
++ public final long getLong(String name) {
++ return reader.readLong(name);
+ }
+
+ /**
++ * @param name Field name.
+ * @param f Float value.
+ * @return Whether value was written.
+ */
- public final boolean putFloat(float f) {
- assert buf != null;
-
- if (buf.remaining() < 4)
- return false;
-
- int pos = buf.position();
-
- UNSAFE.putFloat(heapArr, baseOff + pos, f);
-
- buf.position(pos + 4);
-
- return true;
++ public final boolean putFloat(String name, float f) {
++ return writer.writeFloat(name, f);
+ }
+
+ /**
++ * @param name Field name.
+ * @return Float value.
+ */
- public final float getFloat() {
- assert buf != null;
- assert buf.remaining() >= 4;
-
- int pos = buf.position();
-
- buf.position(pos + 4);
-
- return UNSAFE.getFloat(heapArr, baseOff + pos);
++ public final float getFloat(String name) {
++ return reader.readFloat(name);
+ }
+
+ /**
++ * @param name Field name.
+ * @param d Double value.
+ * @return Whether value was written.
+ */
- public final boolean putDouble(double d) {
- assert buf != null;
-
- if (buf.remaining() < 8)
- return false;
-
- int pos = buf.position();
-
- UNSAFE.putDouble(heapArr, baseOff + pos, d);
-
- buf.position(pos + 8);
-
- return true;
++ public final boolean putDouble(String name, double d) {
++ return writer.writeDouble(name, d);
+ }
+
+ /**
++ * @param name Field name.
+ * @return Double value.
+ */
- public final double getDouble() {
- assert buf != null;
- assert buf.remaining() >= 8;
-
- int pos = buf.position();
-
- buf.position(pos + 8);
-
- return UNSAFE.getDouble(heapArr, baseOff + pos);
++ public final double getDouble(String name) {
++ return reader.readDouble(name);
+ }
+
+ /**
++ * @param name Field name.
+ * @param c Char value.
+ * @return Whether value was written.
+ */
- public final boolean putChar(char c) {
- assert buf != null;
-
- if (buf.remaining() < 2)
- return false;
-
- int pos = buf.position();
-
- UNSAFE.putChar(heapArr, baseOff + pos, c);
-
- buf.position(pos + 2);
-
- return true;
++ public final boolean putChar(String name, char c) {
++ return writer.writeChar(name, c);
+ }
+
+ /**
++ * @param name Field name.
+ * @return Char value.
+ */
- public final char getChar() {
- assert buf != null;
- assert buf.remaining() >= 2;
-
- int pos = buf.position();
-
- buf.position(pos + 2);
-
- return UNSAFE.getChar(heapArr, baseOff + pos);
++ public final char getChar(String name) {
++ return reader.readChar(name);
+ }
+
+ /**
++ * @param name Field name.
+ * @param b Boolean value.
+ * @return Whether value was written.
+ */
- public final boolean putBoolean(boolean b) {
- assert buf != null;
-
- if (buf.remaining() < 1)
- return false;
-
- int pos = buf.position();
-
- UNSAFE.putBoolean(heapArr, baseOff + pos, b);
-
- buf.position(pos + 1);
-
- return true;
++ public final boolean putBoolean(String name, boolean b) {
++ return writer.writeBoolean(name, b);
+ }
+
+ /**
++ * @param name Field name.
+ * @return Boolean value.
+ */
- public final boolean getBoolean() {
- assert buf != null;
- assert buf.hasRemaining();
-
- int pos = buf.position();
-
- buf.position(pos + 1);
-
- return UNSAFE.getBoolean(heapArr, baseOff + pos);
++ public final boolean getBoolean(String name) {
++ return reader.readBoolean(name);
+ }
+
+ /**
++ * @param name Field name.
+ * @param arr Byte array.
+ * @return Whether array was fully written.
+ */
- public final boolean putByteArray(@Nullable byte[] arr) {
- assert buf != null;
-
- int len = arr != null ? arr.length : 0;
-
- return putArray(arr, BYTE_ARR_OFF, len, len);
++ public final boolean putByteArray(String name, @Nullable byte[] arr) {
++ return writer.writeByteArray(name, arr);
+ }
+
+ /**
- * @return Byte array or special
- * {@link GridTcpCommunicationMessageAdapter#BYTE_ARR_NOT_READ}
- * value if it was not fully read.
++ * @param name Field name.
++ * @return Byte array.
+ */
- public final byte[] getByteArray() {
- assert buf != null;
-
- return getArray(BYTE_ARR_CREATOR, 0, BYTE_ARR_OFF);
++ public final byte[] getByteArray(String name) {
++ return reader.readByteArray(name);
+ }
+
+ /**
++ * @param name Field name.
+ * @param arr Short array.
+ * @return Whether array was fully written.
+ */
- public final boolean putShortArray(short[] arr) {
- assert buf != null;
-
- int len = arr != null ? arr.length : 0;
-
- return putArray(arr, SHORT_ARR_OFF, len, len << 1);
++ public final boolean putShortArray(String name, short[] arr) {
++ return writer.writeShortArray(name, arr);
+ }
+
+ /**
- * @return Short array or special
- * {@link GridTcpCommunicationMessageAdapter#SHORT_ARR_NOT_READ}
- * value if it was not fully read.
++ * @param name Field name.
++ * @return Short array.
+ */
- public final short[] getShortArray() {
- assert buf != null;
-
- return getArray(SHORT_ARR_CREATOR, 1, SHORT_ARR_OFF);
++ public final short[] getShortArray(String name) {
++ return reader.readShortArray(name);
+ }
+
+ /**
++ * @param name Field name.
+ * @param arr Integer array.
+ * @return Whether array was fully written.
+ */
- public final boolean putIntArray(int[] arr) {
- assert buf != null;
-
- int len = arr != null ? arr.length : 0;
-
- return putArray(arr, INT_ARR_OFF, len, len << 2);
++ public final boolean putIntArray(String name, int[] arr) {
++ return writer.writeIntArray(name, arr);
+ }
+
+ /**
- * @return Integer array or special
- * {@link GridTcpCommunicationMessageAdapter#INT_ARR_NOT_READ}
- * value if it was not fully read.
++ * @param name Field name.
++ * @return Integer array.
+ */
- public final int[] getIntArray() {
- assert buf != null;
-
- return getArray(INT_ARR_CREATOR, 2, INT_ARR_OFF);
++ public final int[] getIntArray(String name) {
++ return reader.readIntArray(name);
+ }
+
+ /**
++ * @param name Field name.
+ * @param arr Long array.
+ * @return Whether array was fully written.
+ */
- public final boolean putLongArray(long[] arr) {
- assert buf != null;
-
- int len = arr != null ? arr.length : 0;
-
- return putArray(arr, LONG_ARR_OFF, len, len << 3);
++ public final boolean putLongArray(String name, long[] arr) {
++ return writer.writeLongArray(name, arr);
+ }
+
+ /**
- * @return Long array or special
- * {@link GridTcpCommunicationMessageAdapter#LONG_ARR_NOT_READ}
- * value if it was not fully read.
++ * @param name Field name.
++ * @return Long array.
+ */
- public final long[] getLongArray() {
- assert buf != null;
-
- return getArray(LONG_ARR_CREATOR, 3, LONG_ARR_OFF);
++ public final long[] getLongArray(String name) {
++ return reader.readLongArray(name);
+ }
+
+ /**
++ * @param name Field name.
+ * @param arr Float array.
+ * @return Whether array was fully written.
+ */
- public final boolean putFloatArray(float[] arr) {
- assert buf != null;
-
- int len = arr != null ? arr.length : 0;
-
- return putArray(arr, FLOAT_ARR_OFF, len, len << 2);
++ public final boolean putFloatArray(String name, float[] arr) {
++ return writer.writeFloatArray(name, arr);
+ }
+
+ /**
- * @return Float array or special
- * {@link GridTcpCommunicationMessageAdapter#FLOAT_ARR_NOT_READ}
- * value if it was not fully read.
++ * @param name Field name.
++ * @return Float array.
+ */
- public final float[] getFloatArray() {
- assert buf != null;
-
- return getArray(FLOAT_ARR_CREATOR, 2, FLOAT_ARR_OFF);
++ public final float[] getFloatArray(String name) {
++ return reader.readFloatArray(name);
+ }
+
+ /**
++ * @param name Field name.
+ * @param arr Double array.
+ * @return Whether array was fully written.
+ */
- public final boolean putDoubleArray(double[] arr) {
- assert buf != null;
-
- int len = arr != null ? arr.length : 0;
-
- return putArray(arr, DOUBLE_ARR_OFF, len, len << 3);
++ public final boolean putDoubleArray(String name, double[] arr) {
++ return writer.writeDoubleArray(name, arr);
+ }
+
+ /**
- * @return Double array or special
- * {@link GridTcpCommunicationMessageAdapter#DOUBLE_ARR_NOT_READ}
- * value if it was not fully read.
++ * @param name Field name.
++ * @return Double array.
+ */
- public final double[] getDoubleArray() {
- assert buf != null;
-
- return getArray(DOUBLE_ARR_CREATOR, 3, DOUBLE_ARR_OFF);
++ public final double[] getDoubleArray(String name) {
++ return reader.readDoubleArray(name);
+ }
+
+ /**
++ * @param name Field name.
+ * @param arr Char array.
+ * @return Whether array was fully written.
+ */
- public final boolean putCharArray(char[] arr) {
- assert buf != null;
-
- int len = arr != null ? arr.length : 0;
-
- return putArray(arr, CHAR_ARR_OFF, len, len << 1);
++ public final boolean putCharArray(String name, char[] arr) {
++ return writer.writeCharArray(name, arr);
+ }
+
+ /**
- * @return Char array or special
- * {@link GridTcpCommunicationMessageAdapter#CHAR_ARR_NOT_READ}
- * value if it was not fully read.
++ * @param name Field name.
++ * @return Char array.
+ */
- public final char[] getCharArray() {
- assert buf != null;
-
- return getArray(CHAR_ARR_CREATOR, 1, CHAR_ARR_OFF);
++ public final char[] getCharArray(String name) {
++ return reader.readCharArray(name);
+ }
+
+ /**
++ * @param name Field name.
+ * @param arr Boolean array.
+ * @return Whether array was fully written.
+ */
- public final boolean putBooleanArray(boolean[] arr) {
- assert buf != null;
++ public final boolean putBooleanArray(String name, boolean[] arr) {
++ return writer.writeBooleanArray(name, arr);
++ }
++
++ /**
++ * @param name Field name.
++ * @return Boolean array.
++ */
++ public final boolean[] getBooleanArray(String name) {
++ return reader.readBooleanArray(name);
++ }
++
++ /**
++ * @param name Field name.
++ * @param buf Buffer.
++ * @return Whether value was fully written.
++ */
++ public final boolean putByteBuffer(String name, @Nullable ByteBuffer buf) {
++ byte[] arr = null;
++
++ if (buf != null) {
++ ByteBuffer buf0 = buf.duplicate();
+
- int len = arr != null ? arr.length : 0;
++ buf0.flip();
+
- return putArray(arr, BOOLEAN_ARR_OFF, len, len);
++ arr = new byte[buf0.remaining()];
++
++ buf0.get(arr);
++ }
++
++ return putByteArray(name, arr);
+ }
+
+ /**
- * @return Boolean array or special
- * {@link GridTcpCommunicationMessageAdapter#BOOLEAN_ARR_NOT_READ}
- * value if it was not fully read.
++ * @param name Field name.
++ * @return {@link ByteBuffer}.
+ */
- public final boolean[] getBooleanArray() {
- assert buf != null;
++ public final ByteBuffer getByteBuffer(String name) {
++ byte[] arr = getByteArray(name);
+
- return getArray(BOOLEAN_ARR_CREATOR, 0, BOOLEAN_ARR_OFF);
++ if (arr == null)
++ return null;
++ else
++ return ByteBuffer.wrap(arr);
+ }
+
+ /**
++ * @param name Field name.
+ * @param uuid {@link UUID}.
+ * @return Whether value was fully written.
+ */
- public final boolean putUuid(@Nullable UUID uuid) {
++ public final boolean putUuid(String name, @Nullable UUID uuid) {
+ byte[] arr = null;
+
+ if (uuid != null) {
+ arr = new byte[16];
+
+ UNSAFE.putLong(arr, BYTE_ARR_OFF, uuid.getMostSignificantBits());
+ UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, uuid.getLeastSignificantBits());
+ }
+
- return putByteArray(arr);
++ return putByteArray(name, arr);
+ }
+
+ /**
- * @return {@link UUID} or special
- * {@link GridTcpCommunicationMessageAdapter#UUID_NOT_READ}
- * value if it was not fully read.
++ * @param name Field name.
++ * @return {@link UUID}.
+ */
- public final UUID getUuid() {
- byte[] arr = getByteArray();
++ public final UUID getUuid(String name) {
++ byte[] arr = getByteArray(name);
+
- if (arr == BYTE_ARR_NOT_READ)
- return UUID_NOT_READ;
- else if (arr == null)
++ if (arr == null)
+ return null;
+ else {
+ long most = UNSAFE.getLong(arr, BYTE_ARR_OFF);
+ long least = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8);
+
+ return new UUID(most, least);
+ }
+ }
+
+ /**
- * @param uuid {@link org.apache.ignite.lang.IgniteUuid}.
++ * @param name Field name.
++ * @param uuid {@link IgniteUuid}.
+ * @return Whether value was fully written.
+ */
- public final boolean putGridUuid(@Nullable IgniteUuid uuid) {
++ public final boolean putGridUuid(String name, @Nullable IgniteUuid uuid) {
+ byte[] arr = null;
+
+ if (uuid != null) {
+ arr = new byte[24];
+
+ UNSAFE.putLong(arr, BYTE_ARR_OFF, uuid.globalId().getMostSignificantBits());
+ UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, uuid.globalId().getLeastSignificantBits());
+ UNSAFE.putLong(arr, BYTE_ARR_OFF + 16, uuid.localId());
+ }
+
- return putByteArray(arr);
++ return putByteArray(name, arr);
+ }
+
+ /**
- * @return {@link org.apache.ignite.lang.IgniteUuid} or special
- * {@link GridTcpCommunicationMessageAdapter#GRID_UUID_NOT_READ}
- * value if it was not fully read.
++ * @param name Field name.
++ * @return {@link IgniteUuid}.
+ */
- public final IgniteUuid getGridUuid() {
- byte[] arr = getByteArray();
++ public final IgniteUuid getGridUuid(String name) {
++ byte[] arr = getByteArray(name);
+
- if (arr == BYTE_ARR_NOT_READ)
- return GRID_UUID_NOT_READ;
- else if (arr == null)
++ if (arr == null)
+ return null;
+ else {
+ long most = UNSAFE.getLong(arr, BYTE_ARR_OFF);
+ long least = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8);
+ long loc = UNSAFE.getLong(arr, BYTE_ARR_OFF + 16);
+
+ return new IgniteUuid(new UUID(most, least), loc);
+ }
+ }
+
+ /**
++ * @param name Field name.
+ * @param ver {@link GridClockDeltaVersion}.
+ * @return Whether value was fully written.
+ */
- public final boolean putClockDeltaVersion(@Nullable GridClockDeltaVersion ver) {
++ public final boolean putClockDeltaVersion(String name, @Nullable GridClockDeltaVersion ver) {
+ byte[] arr = null;
+
+ if (ver != null) {
+ arr = new byte[16];
+
+ UNSAFE.putLong(arr, BYTE_ARR_OFF, ver.version());
+ UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, ver.topologyVersion());
+ }
+
- return putByteArray(arr);
++ return putByteArray(name, arr);
+ }
+
+ /**
- * @return {@link GridClockDeltaVersion} or special
- * {@link GridTcpCommunicationMessageAdapter#CLOCK_DELTA_VER_NOT_READ}
- * value if it was not fully read.
++ * @param name Field name.
++ * @return {@link GridClockDeltaVersion}.
+ */
- public final GridClockDeltaVersion getClockDeltaVersion() {
- byte[] arr = getByteArray();
++ public final GridClockDeltaVersion getClockDeltaVersion(String name) {
++ byte[] arr = getByteArray(name);
+
- if (arr == BYTE_ARR_NOT_READ)
- return CLOCK_DELTA_VER_NOT_READ;
- else if (arr == null)
++ if (arr == null)
+ return null;
+ else {
+ long ver = UNSAFE.getLong(arr, BYTE_ARR_OFF);
+ long topVer = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8);
+
+ return new GridClockDeltaVersion(ver, topVer);
+ }
+ }
+
+ /**
++ * @param name Field name.
+ * @param list {@link GridByteArrayList}.
+ * @return Whether value was fully written.
+ */
- public final boolean putByteArrayList(@Nullable GridByteArrayList list) {
- byte[] arr = list != null ? list.internalArray() : null;
- int size = list != null ? list.size() : 0;
-
- return putArray(arr, BYTE_ARR_OFF, size, size);
++ public final boolean putByteArrayList(String name, @Nullable GridByteArrayList list) {
++ return putByteArray(name, list != null ? list.array() : null);
+ }
+
+ /**
- * @return {@link GridByteArrayList} or special
- * {@link GridTcpCommunicationMessageAdapter#BYTE_ARR_LIST_NOT_READ}
- * value if it was not fully read.
++ * @param name Field name.
++ * @return {@link GridByteArrayList}.
+ */
+ @SuppressWarnings("IfMayBeConditional")
- public final GridByteArrayList getByteArrayList() {
- byte[] arr = getByteArray();
++ public final GridByteArrayList getByteArrayList(String name) {
++ byte[] arr = getByteArray(name);
+
- if (arr == BYTE_ARR_NOT_READ)
- return BYTE_ARR_LIST_NOT_READ;
- else if (arr == null)
++ if (arr == null)
+ return null;
+ else
+ return new GridByteArrayList(arr);
+ }
+
+ /**
++ * @param name Field name.
+ * @param list {@link GridLongList}.
+ * @return Whether value was fully written.
+ */
- public final boolean putLongList(@Nullable GridLongList list) {
- long[] arr = list != null ? list.internalArray() : null;
- int size = list != null ? list.size() : 0;
-
- return putArray(arr, LONG_ARR_OFF, size, size << 3);
++ public final boolean putLongList(String name, @Nullable GridLongList list) {
++ return putLongArray(name, list != null ? list.array() : null);
+ }
+
+ /**
- * @return {@link GridLongList} or special
- * {@link GridTcpCommunicationMessageAdapter#LONG_LIST_NOT_READ}
- * value if it was not fully read.
++ * @param name Field name.
++ * @return {@link GridLongList}.
+ */
+ @SuppressWarnings("IfMayBeConditional")
- public final GridLongList getLongList() {
- long[] arr = getLongArray();
++ public final GridLongList getLongList(String name) {
++ long[] arr = getLongArray(name);
+
- if (arr == LONG_ARR_NOT_READ)
- return LONG_LIST_NOT_READ;
- else if (arr == null)
++ if (arr == null)
+ return null;
+ else
+ return new GridLongList(arr);
+ }
+
+ /**
++ * @param name Field name.
+ * @param ver {@link org.apache.ignite.internal.processors.cache.version.GridCacheVersion}.
+ * @return Whether value was fully written.
+ */
- public final boolean putCacheVersion(@Nullable GridCacheVersion ver) {
++ public final boolean putCacheVersion(String name, @Nullable GridCacheVersion ver) {
+ byte[] arr = null;
+
+ if (ver != null) {
+ arr = new byte[24];
+
+ UNSAFE.putInt(arr, BYTE_ARR_OFF, ver.topologyVersion());
+ UNSAFE.putInt(arr, BYTE_ARR_OFF + 4, ver.nodeOrderAndDrIdRaw());
+ UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, ver.globalTime());
+ UNSAFE.putLong(arr, BYTE_ARR_OFF + 16, ver.order());
+ }
+
- return putByteArray(arr);
++ return putByteArray(name, arr);
+ }
+
+ /**
- * @return {@link GridCacheVersion} or special
- * {@link GridTcpCommunicationMessageAdapter#CACHE_VER_NOT_READ}
- * value if it was not fully read.
++ * @param name Field name.
++ * @return {@link GridCacheVersion}.
+ */
- public final GridCacheVersion getCacheVersion() {
- byte[] arr = getByteArray();
++ public final GridCacheVersion getCacheVersion(String name) {
++ byte[] arr = getByteArray(name);
+
- if (arr == BYTE_ARR_NOT_READ)
- return CACHE_VER_NOT_READ;
- else if (arr == null)
++ if (arr == null)
+ return null;
+ else {
+ int topVerDrId = UNSAFE.getInt(arr, BYTE_ARR_OFF);
+ int nodeOrder = UNSAFE.getInt(arr, BYTE_ARR_OFF + 4);
+ long globalTime = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8);
+ long order = UNSAFE.getLong(arr, BYTE_ARR_OFF + 16);
+
+ return new GridCacheVersion(topVerDrId, nodeOrder, globalTime, order);
+ }
+ }
+
+ /**
++ * @param name Field name.
+ * @param id {@link GridDhtPartitionExchangeId}.
+ * @return Whether value was fully written.
+ */
- public final boolean putDhtPartitionExchangeId(@Nullable GridDhtPartitionExchangeId id) {
++ public final boolean putDhtPartitionExchangeId(String name, @Nullable GridDhtPartitionExchangeId id) {
+ byte[] arr = null;
+
+ if (id != null) {
+ arr = new byte[28];
+
+ UNSAFE.putLong(arr, BYTE_ARR_OFF, id.nodeId().getMostSignificantBits());
+ UNSAFE.putLong(arr, BYTE_ARR_OFF + 8, id.nodeId().getLeastSignificantBits());
+ UNSAFE.putInt(arr, BYTE_ARR_OFF + 16, id.event());
+ UNSAFE.putLong(arr, BYTE_ARR_OFF + 20, id.topologyVersion());
+ }
+
- return putByteArray(arr);
++ return putByteArray(name, arr);
+ }
+
+ /**
- * @return {@link GridDhtPartitionExchangeId} or special
- * {@link GridTcpCommunicationMessageAdapter#DHT_PART_EXCHANGE_ID_NOT_READ}
- * value if it was not fully read.
++ * @param name Field name.
++ * @return {@link GridDhtPartitionExchangeId}.
+ */
- public final GridDhtPartitionExchangeId getDhtPartitionExchangeId() {
- byte[] arr = getByteArray();
++ public final GridDhtPartitionExchangeId getDhtPartitionExchangeId(String name) {
++ byte[] arr = getByteArray(name);
+
- if (arr == BYTE_ARR_NOT_READ)
- return DHT_PART_EXCHANGE_ID_NOT_READ;
- else if (arr == null)
++ if (arr == null)
+ return null;
+ else {
+ long most = UNSAFE.getLong(arr, BYTE_ARR_OFF);
+ long least = UNSAFE.getLong(arr, BYTE_ARR_OFF + 8);
+ int evt = UNSAFE.getInt(arr, BYTE_ARR_OFF + 16);
+ long topVer = UNSAFE.getLong(arr, BYTE_ARR_OFF + 20);
+
+ return new GridDhtPartitionExchangeId(new UUID(most, least), evt, topVer);
+ }
+ }
+
+ /**
++ * @param name Field name.
+ * @param bytes {@link GridCacheValueBytes}.
+ * @return Whether value was fully written.
+ */
- public final boolean putValueBytes(@Nullable GridCacheValueBytes bytes) {
++ public final boolean putValueBytes(String name, @Nullable GridCacheValueBytes bytes) {
+ byte[] arr = null;
+
+ if (bytes != null) {
- if (bytes.get() != null) {
- int len = bytes.get().length;
++ byte[] bytes0 = bytes.get();
++
++ if (bytes0 != null) {
++ int len = bytes0.length;
+
+ arr = new byte[len + 2];
+
+ UNSAFE.putBoolean(arr, BYTE_ARR_OFF, true);
- UNSAFE.copyMemory(bytes.get(), BYTE_ARR_OFF, arr, BYTE_ARR_OFF + 1, len);
++ UNSAFE.copyMemory(bytes0, BYTE_ARR_OFF, arr, BYTE_ARR_OFF + 1, len);
+ UNSAFE.putBoolean(arr, BYTE_ARR_OFF + 1 + len, bytes.isPlain());
+ }
+ else {
+ arr = new byte[1];
+
+ UNSAFE.putBoolean(arr, BYTE_ARR_OFF, false);
+ }
+ }
+
- return putByteArray(arr);
++ return putByteArray(name, arr);
+ }
+
+ /**
- * @return {@link GridCacheValueBytes} or special
- * {@link GridTcpCommunicationMessageAdapter#VAL_BYTES_NOT_READ}
- * value if it was not fully read.
++ * @param name Field name.
++ * @return {@link GridCacheValueBytes}.
+ */
- public final GridCacheValueBytes getValueBytes() {
- byte[] arr = getByteArray();
++ public final GridCacheValueBytes getValueBytes(String name) {
++ byte[] arr = getByteArray(name);
+
- if (arr == BYTE_ARR_NOT_READ)
- return VAL_BYTES_NOT_READ;
- else if (arr == null)
++ if (arr == null)
+ return null;
+ else {
+ boolean notNull = UNSAFE.getBoolean(arr, BYTE_ARR_OFF);
+
+ if (notNull) {
+ int len = arr.length - 2;
+
+ assert len >= 0 : len;
+
+ byte[] bytesArr = new byte[len];
+
+ UNSAFE.copyMemory(arr, BYTE_ARR_OFF + 1, bytesArr, BYTE_ARR_OFF, len);
+
+ boolean isPlain = UNSAFE.getBoolean(arr, BYTE_ARR_OFF + 1 + len);
+
+ return new GridCacheValueBytes(bytesArr, isPlain);
+ }
+ else
+ return new GridCacheValueBytes();
+ }
+ }
+
+ /**
++ * @param name Field name.
+ * @param str {@link String}.
+ * @return Whether value was fully written.
+ */
- public final boolean putString(@Nullable String str) {
- return putByteArray(str != null ? str.getBytes() : null);
++ public final boolean putString(String name, @Nullable String str) {
++ return putByteArray(name, str != null ? str.getBytes() : null);
+ }
+
+ /**
- * @return {@link String} or special {@link GridTcpCommunicationMessageAdapter#STR_NOT_READ}
- * value if it was not fully read.
++ * @param name Field name.
++ * @return {@link String}.
+ */
+ @SuppressWarnings("IfMayBeConditional")
- public final String getString() {
- byte[] arr = getByteArray();
++ public final String getString(String name) {
++ byte[] arr = getByteArray(name);
+
- if (arr == BYTE_ARR_NOT_READ)
- return STR_NOT_READ;
- else if (arr == null)
++ if (arr == null)
+ return null;
+ else
+ return new String(arr);
+ }
+
+ /**
++ * @param name Field name.
+ * @param bits {@link BitSet}.
+ * @return Whether value was fully written.
+ */
- public final boolean putBitSet(@Nullable BitSet bits) {
- return putLongArray(bits != null ? bits.toLongArray() : null);
++ public final boolean putBitSet(String name, @Nullable BitSet bits) {
++ return putLongArray(name, bits != null ? bits.toLongArray() : null);
+ }
+
+ /**
- * @return {@link BitSet} or special {@link GridTcpCommunicationMessageAdapter#BIT_SET_NOT_READ}
- * value if it was not fully read.
++ * @param name Field name.
++ * @return {@link BitSet}.
+ */
+ @SuppressWarnings("IfMayBeConditional")
- public final BitSet getBitSet() {
- long[] arr = getLongArray();
++ public final BitSet getBitSet(String name) {
++ long[] arr = getLongArray(name);
+
- if (arr == LONG_ARR_NOT_READ)
- return BIT_SET_NOT_READ;
- else if (arr == null)
++ if (arr == null)
+ return null;
+ else
+ return BitSet.valueOf(arr);
+ }
+
+ /**
++ * @param name Field name.
+ * @param e Enum.
+ * @return Whether value was fully written.
+ */
- public final boolean putEnum(@Nullable Enum<?> e) {
- return putByte(e != null ? (byte)e.ordinal() : -1);
++ public final boolean putEnum(String name, @Nullable Enum<?> e) {
++ return putByte(name, e != null ? (byte)e.ordinal() : -1);
+ }
+
+ /**
++ * @param name Field name.
+ * @param msg {@link GridTcpCommunicationMessageAdapter}.
+ * @return Whether value was fully written.
+ */
- public final boolean putMessage(@Nullable GridTcpCommunicationMessageAdapter msg) {
- assert buf != null;
-
- if (!msgNotNullDone) {
- if (!putBoolean(msg != null))
- return false;
-
- msgNotNullDone = true;
- }
-
- if (msg != null) {
- if (!msgWriter.write(nodeId, msg, buf))
- return false;
-
- msgNotNullDone = false;
- }
-
- return true;
- }
-
- /**
- * @return {@link GridTcpCommunicationMessageAdapter} or special
- * {@link GridTcpCommunicationMessageAdapter#MSG_NOT_READ}
- * value if it was not fully read.
- */
- public final GridTcpCommunicationMessageAdapter getMessage() {
- assert buf != null;
-
- if (!msgNotNullDone) {
- if (!buf.hasRemaining())
- return MSG_NOT_READ;
-
- msgNotNull = getBoolean();
-
- msgNotNullDone = true;
- }
-
- if (msgNotNull) {
- if (!msgTypeDone) {
- if (!buf.hasRemaining())
- return MSG_NOT_READ;
-
- GridTcpMessageFactory factory = msgReader.messageFactory();
-
- byte type = getByte();
-
- msg = factory != null ? factory.create(type) : GridTcpCommunicationMessageFactory.create(type);
-
- msgTypeDone = true;
- }
-
- if (msgReader.read(nodeId, msg, buf)) {
- GridTcpCommunicationMessageAdapter msg0 = msg;
-
- msgNotNullDone = false;
- msgTypeDone = false;
- msg = null;
-
- return msg0;
- }
- else
- return MSG_NOT_READ;
- }
- else
- return null;
- }
-
- /**
- * @param arr Array.
- * @param off Offset.
- * @param len Length.
- * @param bytes Length in bytes.
- * @return Whether array was fully written
- */
- private boolean putArray(@Nullable Object arr, long off, int len, int bytes) {
- assert off > 0;
- assert len >= 0;
- assert bytes >= 0;
- assert bytes >= arrOff;
-
- if (!buf.hasRemaining())
- return false;
-
- int pos = buf.position();
-
- if (arr != null) {
- assert arr.getClass().isArray() && arr.getClass().getComponentType().isPrimitive();
-
- if (!arrHdrDone) {
- if (buf.remaining() < 5)
- return false;
-
- UNSAFE.putBoolean(heapArr, baseOff + pos++, true);
- UNSAFE.putInt(heapArr, baseOff + pos, len);
-
- pos += 4;
-
- buf.position(pos);
-
- arrHdrDone = true;
- }
-
- if (!buf.hasRemaining())
- return false;
-
- int left = bytes - arrOff;
- int remaining = buf.remaining();
-
- if (left <= remaining) {
- UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, left);
-
- pos += left;
-
- buf.position(pos);
-
- arrHdrDone = false;
- arrOff = 0;
- }
- else {
- UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, remaining);
-
- pos += remaining;
-
- buf.position(pos);
-
- arrOff += remaining;
-
- return false;
- }
- }
- else {
- UNSAFE.putBoolean(heapArr, baseOff + pos++, false);
-
- buf.position(pos);
- }
-
- return true;
- }
-
- /**
- * @param creator Array creator.
- * @param lenShift Array length shift size.
- * @param off Base offset.
- * @return Array or special value if it was not fully read.
- */
- private <T> T getArray(ArrayCreator<T> creator, int lenShift, long off) {
- assert creator != null;
- assert lenShift >= 0;
-
- if (!arrHdrDone) {
- if (!buf.hasRemaining())
- return creator.create(-1);
-
- if (!getBoolean())
- return null;
-
- arrHdrDone = true;
- }
-
- if (tmpArr == null) {
- if (buf.remaining() < 4)
- return creator.create(-1);
-
- int len = getInt();
-
- if (len == 0) {
- arrHdrDone = false;
-
- return creator.create(0);
- }
-
- tmpArr = creator.create(len);
- tmpArrBytes = len << lenShift;
- }
-
- int toRead = tmpArrBytes - tmpArrOff;
- int remaining = buf.remaining();
- int pos = buf.position();
-
- if (remaining < toRead) {
- UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, remaining);
-
- buf.position(pos + remaining);
-
- tmpArrOff += remaining;
-
- return creator.create(-1);
- }
- else {
- UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, toRead);
-
- buf.position(pos + toRead);
-
- T arr = (T)tmpArr;
-
- arrHdrDone = false;
- tmpArr = null;
- tmpArrBytes = 0;
- tmpArrOff = 0;
-
- return arr;
- }
- }
-
- /**
- * @param i Integer value.
- * @return Whether value was written.
- */
- public final boolean putIntClient(int i) {
- assert buf != null;
-
- if (buf.remaining() < 4)
- return false;
-
- putByte((byte)(0xFF & (i >>> 24)));
- putByte((byte)(0xFF & (i >>> 16)));
- putByte((byte)(0xFF & (i >>> 8)));
- putByte((byte)(0xFF & i));
-
- return true;
- }
-
- /**
- * @return Integer value.
- */
- public final int getIntClient() {
- assert buf != null;
- assert buf.remaining() >= 4;
-
- int val = 0;
-
- val |= (0xFF & getByte()) << 24;
- val |= (0xFF & getByte()) << 16;
- val |= (0xFF & getByte()) << 8;
- val |= (0xFF & getByte());
-
- return val;
- }
-
- /**
- * @param val Long value.
- * @return Whether value was written.
- */
- public final boolean putLongClient(long val) {
- assert buf != null;
-
- if (buf.remaining() < 8)
- return false;
-
- putByte((byte)(val >>> 56));
- putByte((byte)(0xFFL & (val >>> 48)));
- putByte((byte)(0xFFL & (val >>> 40)));
- putByte((byte)(0xFFL & (val >>> 32)));
- putByte((byte)(0xFFL & (val >>> 24)));
- putByte((byte)(0xFFL & (val >>> 16)));
- putByte((byte)(0xFFL & (val >>> 8)));
- putByte((byte) (0xFFL & val));
-
- return true;
- }
-
- /**
- * @return Long value.
- */
- public final long getLongClient() {
- assert buf != null;
- assert buf.remaining() >= 8;
-
- long x = 0;
-
- x |= (0xFFL & getByte()) << 56;
- x |= (0xFFL & getByte()) << 48;
- x |= (0xFFL & getByte()) << 40;
- x |= (0xFFL & getByte()) << 32;
- x |= (0xFFL & getByte()) << 24;
- x |= (0xFFL & getByte()) << 16;
- x |= (0xFFL & getByte()) << 8;
- x |= (0xFFL & getByte());
-
- return x;
- }
-
- /**
- * @param uuid {@link UUID}.
- * @return Whether value was fully written.
- */
- public final boolean putUuidClient(@Nullable UUID uuid) {
- byte[] arr = uuid != null ? U.uuidToBytes(uuid) : EMPTY_UUID_BYTES;
-
- return putByteArrayClient(arr);
- }
-
- /**
- * @param arr Byte array.
- * @return Whether array was fully written.
- */
- public final boolean putByteArrayClient(byte[] arr) {
- assert buf != null;
- assert arr != null;
-
- return putArrayClient(arr, BYTE_ARR_OFF, arr.length, arr.length);
- }
-
- /**
- * @param src Buffer.
- * @return Whether array was fully written
- */
- public boolean putByteBufferClient(ByteBuffer src) {
- assert src != null;
- assert src.hasArray();
-
- return putArrayClient(src.array(), BYTE_ARR_OFF + src.position(), src.remaining(), src.remaining());
- }
-
- /**
- * @param arr Array.
- * @param off Offset.
- * @param len Length.
- * @param bytes Length in bytes.
- * @return Whether array was fully written
- */
- private boolean putArrayClient(Object arr, long off, int len, int bytes) {
- assert off > 0;
- assert len >= 0;
- assert bytes >= 0;
- assert bytes >= arrOff;
- assert arr != null;
-
- if (!buf.hasRemaining())
- return false;
-
- int pos = buf.position();
-
- assert arr.getClass().isArray() && arr.getClass().getComponentType().isPrimitive();
-
- if (!arrHdrDone)
- arrHdrDone = true;
-
- if (!buf.hasRemaining())
- return false;
-
- int left = bytes - arrOff;
- int remaining = buf.remaining();
-
- if (left <= remaining) {
- UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, left);
-
- pos += left;
-
- buf.position(pos);
-
- arrHdrDone = false;
- arrOff = 0;
- }
- else {
- UNSAFE.copyMemory(arr, off + arrOff, heapArr, baseOff + pos, remaining);
-
- pos += remaining;
-
- buf.position(pos);
-
- arrOff += remaining;
-
- return false;
- }
-
- return true;
- }
-
- /**
- * @param len Array length.
- * @return Byte array or special {@link GridTcpCommunicationMessageAdapter#BYTE_ARR_NOT_READ}
- * value if it was not fully read.
- */
- public final byte[] getByteArrayClient(int len) {
- assert buf != null;
-
- return getArrayClient(BYTE_ARR_CREATOR, BYTE_ARR_OFF, len);
- }
-
- /**
- * @return {@link UUID} or special
- * {@link GridTcpCommunicationMessageAdapter#UUID_NOT_READ}
- * value if it was not fully read.
- */
- public final UUID getUuidClient() {
- byte[] arr = getByteArrayClient(16);
++ public final boolean putMessage(String name, @Nullable GridTcpCommunicationMessageAdapter msg) {
++ if (msg != null)
++ msg.setWriter(writer);
+
- assert arr != null;
-
- return arr == BYTE_ARR_NOT_READ ? UUID_NOT_READ : U.bytesToUuid(arr, 0);
++ return writer.writeMessage(name, msg);
+ }
+
+ /**
- * @param creator Array creator.
- * @param off Base offset.
- * @param len Length.
- * @return Array or special value if it was not fully read.
++ * @param name Field name.
++ * @return {@link GridTcpCommunicationMessageAdapter}.
+ */
- private <T> T getArrayClient(ArrayCreator<T> creator, long off, int len) {
- assert creator != null;
-
- if (tmpArr == null) {
- tmpArr = creator.create(len);
- tmpArrBytes = len;
- }
-
- int toRead = tmpArrBytes - tmpArrOff;
- int remaining = buf.remaining();
- int pos = buf.position();
-
- if (remaining < toRead) {
- UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, remaining);
-
- buf.position(pos + remaining);
-
- tmpArrOff += remaining;
-
- return creator.create(-1);
- }
- else {
- UNSAFE.copyMemory(heapArr, baseOff + pos, tmpArr, off + tmpArrOff, toRead);
-
- buf.position(pos + toRead);
-
- T arr = (T)tmpArr;
-
- arrHdrDone = false;
- tmpArr = null;
- tmpArrBytes = 0;
- tmpArrOff = 0;
-
- return arr;
- }
++ public final GridTcpCommunicationMessageAdapter getMessage(String name) {
++ return reader.readMessage(name);
+ }
+
- /**
- * Array creator.
- */
- private static interface ArrayCreator<T> {
- /**
- * @param len Array length or {@code -1} if array was not fully read.
- * @return New array.
- */
- public T create(int len);
- }
-
- /**
- * Dummy enum.
- */
- private enum DummyEnum {
- /** */
- DUMMY
++ public final boolean lastRead() {
++ return reader.isLastRead();
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java
index 0000000,5097db7..d9daba6
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java
@@@ -1,0 -1,250 +1,241 @@@
+ /*
+ * 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.util.ipc;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.nio.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.concurrent.*;
+ import java.util.concurrent.atomic.*;
+
+ /**
+ * Allows to re-use existing {@link GridNioFilter}s on IPC (specifically shared memory IPC)
+ * communications.
+ *
+ * Note that this class consumes an entire thread inside {@link #serve()} method
+ * in order to serve one {@link IpcEndpoint}.
+ */
+ public class IpcToNioAdapter<T> {
+ /** */
+ private final IpcEndpoint endp;
+
+ /** */
+ private final GridNioFilterChain<T> chain;
+
+ /** */
+ private final GridNioSessionImpl ses;
+
+ /** */
+ private final AtomicReference<CountDownLatch> latchRef = new AtomicReference<>();
+
+ /** */
+ private final ByteBuffer writeBuf;
+
+ /** */
+ private final GridNioMetricsListener metricsLsnr;
+
- /** */
- private final GridNioMessageWriter msgWriter;
-
+ /**
+ * @param metricsLsnr Metrics listener.
+ * @param log Log.
+ * @param endp Endpoint.
- * @param msgWriter Message writer.
+ * @param lsnr Listener.
+ * @param filters Filters.
+ */
+ public IpcToNioAdapter(GridNioMetricsListener metricsLsnr, IgniteLogger log, IpcEndpoint endp,
- GridNioMessageWriter msgWriter, GridNioServerListener<T> lsnr, GridNioFilter... filters) {
++ GridNioServerListener<T> lsnr, GridNioFilter... filters) {
+ assert metricsLsnr != null;
- assert msgWriter != null;
+
+ this.metricsLsnr = metricsLsnr;
+ this.endp = endp;
- this.msgWriter = msgWriter;
+
+ chain = new GridNioFilterChain<>(log, lsnr, new HeadFilter(), filters);
+ ses = new GridNioSessionImpl(chain, null, null, true);
+
+ writeBuf = ByteBuffer.allocate(8 << 10);
+
+ writeBuf.order(ByteOrder.nativeOrder());
+ }
+
+ /**
+ * Serves given set of listeners repeatedly reading data from the endpoint.
+ *
+ * @throws InterruptedException If interrupted.
+ */
+ public void serve() throws InterruptedException {
+ try {
+ chain.onSessionOpened(ses);
+
+ InputStream in = endp.inputStream();
+
+ ByteBuffer readBuf = ByteBuffer.allocate(8 << 10);
+
+ readBuf.order(ByteOrder.nativeOrder());
+
+ assert readBuf.hasArray();
+
+ while (!Thread.interrupted()) {
+ int pos = readBuf.position();
+
+ int read = in.read(readBuf.array(), pos, readBuf.remaining());
+
+ if (read > 0) {
+ metricsLsnr.onBytesReceived(read);
+
+ readBuf.position(0);
+ readBuf.limit(pos + read);
+
+ chain.onMessageReceived(ses, readBuf);
+
+ if (readBuf.hasRemaining())
+ readBuf.compact();
+ else
+ readBuf.clear();
+
+ CountDownLatch latch = latchRef.get();
+
+ if (latch != null)
+ latch.await();
+ }
+ else if (read < 0) {
+ endp.close();
+
+ break; // And close below.
+ }
+ }
+ }
+ catch (Exception e) {
+ chain.onExceptionCaught(ses, new IgniteCheckedException("Failed to read from IPC endpoint.", e));
+ }
+ finally {
+ try {
+ // Assuming remote end closed connection - pushing event from head to tail.
+ chain.onSessionClosed(ses);
+ }
+ catch (IgniteCheckedException e) {
+ chain.onExceptionCaught(ses, new IgniteCheckedException("Failed to process session close event " +
+ "for IPC endpoint.", e));
+ }
+ }
+ }
+
+ /**
+ * Handles write events on chain.
+ *
+ * @param msg Buffer to send.
+ * @return Send result.
+ */
+ private GridNioFuture<?> send(GridTcpCommunicationMessageAdapter msg) {
+ assert writeBuf.hasArray();
+
+ try {
- // This method is called only on handshake,
- // so we don't need to provide node ID for
- // rolling updates support.
- int cnt = msgWriter.writeFully(null, msg, endp.outputStream(), writeBuf);
++ int cnt = U.writeMessageFully(msg, endp.outputStream(), writeBuf);
+
+ metricsLsnr.onBytesSent(cnt);
+ }
+ catch (IOException | IgniteCheckedException e) {
+ return new GridNioFinishedFuture<Object>(e);
+ }
+
+ return new GridNioFinishedFuture<>((Object)null);
+ }
+
+ /**
+ * Filter forwarding messages from chain's head to this server.
+ */
+ private class HeadFilter extends GridNioFilterAdapter {
+ /**
+ * Assigns filter name.
+ */
+ protected HeadFilter() {
+ super("HeadFilter");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onSessionOpened(GridNioSession ses) throws IgniteCheckedException {
+ proceedSessionOpened(ses);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onSessionClosed(GridNioSession ses) throws IgniteCheckedException {
+ proceedSessionClosed(ses);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onExceptionCaught(GridNioSession ses, IgniteCheckedException ex) throws IgniteCheckedException {
+ proceedExceptionCaught(ses, ex);
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridNioFuture<?> onSessionWrite(GridNioSession ses, Object msg) {
+ assert ses == IpcToNioAdapter.this.ses;
+
+ return send((GridTcpCommunicationMessageAdapter)msg);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onMessageReceived(GridNioSession ses, Object msg) throws IgniteCheckedException {
+ proceedMessageReceived(ses, msg);
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridNioFuture<?> onPauseReads(GridNioSession ses) throws IgniteCheckedException {
+ // This call should be synced externally to avoid races.
+ boolean b = latchRef.compareAndSet(null, new CountDownLatch(1));
+
+ assert b;
+
+ return new GridNioFinishedFuture<>(b);
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridNioFuture<?> onResumeReads(GridNioSession ses) throws IgniteCheckedException {
+ // This call should be synced externally to avoid races.
+ CountDownLatch latch = latchRef.getAndSet(null);
+
+ if (latch != null)
+ latch.countDown();
+
+ return new GridNioFinishedFuture<Object>(latch != null);
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridNioFuture<Boolean> onSessionClose(GridNioSession ses) {
+ assert ses == IpcToNioAdapter.this.ses;
+
+ boolean closed = IpcToNioAdapter.this.ses.setClosed();
+
+ if (closed)
+ endp.close();
+
+ return new GridNioFinishedFuture<>(closed);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onSessionIdleTimeout(GridNioSession ses) throws IgniteCheckedException {
+ proceedSessionIdleTimeout(ses);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onSessionWriteTimeout(GridNioSession ses) throws IgniteCheckedException {
+ proceedSessionWriteTimeout(ses);
+ }
+ }
+ }
[45/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java
index 0000000,40c9479..2047adb
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java
@@@ -1,0 -1,445 +1,435 @@@
+ /*
+ * 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.managers.communication;
+
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.managers.deployment.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * User message wrapper.
+ */
+ public class GridIoUserMessage extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Message body. */
+ @GridDirectTransient
+ private Object body;
+
+ /** Serialized message body. */
+ private byte[] bodyBytes;
+
+ /** Class loader ID. */
+ private IgniteUuid clsLdrId;
+
+ /** Message topic. */
+ @GridDirectTransient
+ private Object topic;
+
+ /** Serialized message topic. */
+ private byte[] topicBytes;
+
+ /** Deployment mode. */
+ private IgniteDeploymentMode depMode;
+
+ /** Deployment class name. */
+ private String depClsName;
+
+ /** User version. */
+ private String userVer;
+
+ /** Node class loader participants. */
+ @GridToStringInclude
+ @GridDirectMap(keyType = UUID.class, valueType = IgniteUuid.class)
+ private Map<UUID, IgniteUuid> ldrParties;
+
+ /** Message deployment. */
+ @GridDirectTransient
+ private GridDeployment dep;
+
+ /**
+ * @param body Message body.
+ * @param bodyBytes Serialized message body.
+ * @param depClsName Message body class name.
+ * @param topic Message topic.
+ * @param topicBytes Serialized message topic bytes.
+ * @param clsLdrId Class loader ID.
+ * @param depMode Deployment mode.
+ * @param userVer User version.
+ * @param ldrParties Node loader participant map.
+ */
+ GridIoUserMessage(
+ Object body,
+ @Nullable byte[] bodyBytes,
+ @Nullable String depClsName,
+ @Nullable Object topic,
+ @Nullable byte[] topicBytes,
+ @Nullable IgniteUuid clsLdrId,
+ @Nullable IgniteDeploymentMode depMode,
+ @Nullable String userVer,
+ @Nullable Map<UUID, IgniteUuid> ldrParties) {
+ this.body = body;
+ this.bodyBytes = bodyBytes;
+ this.depClsName = depClsName;
+ this.topic = topic;
+ this.topicBytes = topicBytes;
+ this.depMode = depMode;
+ this.clsLdrId = clsLdrId;
+ this.userVer = userVer;
+ this.ldrParties = ldrParties;
+ }
+
+ /**
+ * Default constructor, required for {@link Externalizable}.
+ */
+ public GridIoUserMessage() {
+ // No-op.
+ }
+
+ /**
+ * @return Serialized message body.
+ */
+ @Nullable public byte[] bodyBytes() {
+ return bodyBytes;
+ }
+
+ /**
+ * @return the Class loader ID.
+ */
+ @Nullable public IgniteUuid classLoaderId() {
+ return clsLdrId;
+ }
+
+ /**
+ * @return Deployment mode.
+ */
+ @Nullable public IgniteDeploymentMode deploymentMode() {
+ return depMode;
+ }
+
+ /**
+ * @return Message body class name.
+ */
+ @Nullable public String deploymentClassName() {
+ return depClsName;
+ }
+
+ /**
+ * @return User version.
+ */
+ @Nullable public String userVersion() {
+ return userVer;
+ }
+
+ /**
+ * @return Node class loader participant map.
+ */
+ @Nullable public Map<UUID, IgniteUuid> loaderParticipants() {
+ return ldrParties != null ? Collections.unmodifiableMap(ldrParties) : null;
+ }
+
+ /**
+ * @return Serialized message topic.
+ */
+ @Nullable public byte[] topicBytes() {
+ return topicBytes;
+ }
+
+ /**
+ * @param topic New message topic.
+ */
+ public void topic(Object topic) {
+ this.topic = topic;
+ }
+
+ /**
+ * @return Message topic.
+ */
+ @Nullable public Object topic() {
+ return topic;
+ }
+
+ /**
+ * @param body New message body.
+ */
+ public void body(Object body) {
+ this.body = body;
+ }
+
+ /**
+ * @return Message body.
+ */
+ @Nullable public Object body() {
+ return body;
+ }
+
+ /**
+ * @param dep New message deployment.
+ */
+ public void deployment(GridDeployment dep) {
+ this.dep = dep;
+ }
+
+ /**
+ * @return Message deployment.
+ */
+ @Nullable public GridDeployment deployment() {
+ return dep;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridIoUserMessage _clone = new GridIoUserMessage();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridIoUserMessage _clone = (GridIoUserMessage)_msg;
+
+ _clone.body = body;
+ _clone.bodyBytes = bodyBytes;
+ _clone.clsLdrId = clsLdrId;
+ _clone.topic = topic;
+ _clone.topicBytes = topicBytes;
+ _clone.depMode = depMode;
+ _clone.depClsName = depClsName;
+ _clone.userVer = userVer;
+ _clone.ldrParties = ldrParties;
+ _clone.dep = dep;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putByteArray(bodyBytes))
++ if (!commState.putByteArray("bodyBytes", bodyBytes))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putGridUuid(clsLdrId))
++ if (!commState.putGridUuid("clsLdrId", clsLdrId))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putString(depClsName))
++ if (!commState.putString("depClsName", depClsName))
+ return false;
+
+ commState.idx++;
+
+ case 3:
- if (!commState.putEnum(depMode))
++ if (!commState.putEnum("depMode", depMode))
+ return false;
+
+ commState.idx++;
+
+ case 4:
+ if (ldrParties != null) {
+ if (commState.it == null) {
- if (!commState.putInt(ldrParties.size()))
++ if (!commState.putInt(null, ldrParties.size()))
+ return false;
+
+ commState.it = ldrParties.entrySet().iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
+ Map.Entry<UUID, IgniteUuid> e = (Map.Entry<UUID, IgniteUuid>)commState.cur;
+
+ if (!commState.keyDone) {
- if (!commState.putUuid(e.getKey()))
++ if (!commState.putUuid(null, e.getKey()))
+ return false;
+
+ commState.keyDone = true;
+ }
+
- if (!commState.putGridUuid(e.getValue()))
++ if (!commState.putGridUuid(null, e.getValue()))
+ return false;
+
+ commState.keyDone = false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 5:
- if (!commState.putByteArray(topicBytes))
++ if (!commState.putByteArray("topicBytes", topicBytes))
+ return false;
+
+ commState.idx++;
+
+ case 6:
- if (!commState.putString(userVer))
++ if (!commState.putString("userVer", userVer))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- byte[] bodyBytes0 = commState.getByteArray();
++ bodyBytes = commState.getByteArray("bodyBytes");
+
- if (bodyBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- bodyBytes = bodyBytes0;
-
+ commState.idx++;
+
+ case 1:
- IgniteUuid clsLdrId0 = commState.getGridUuid();
++ clsLdrId = commState.getGridUuid("clsLdrId");
+
- if (clsLdrId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- clsLdrId = clsLdrId0;
-
+ commState.idx++;
+
+ case 2:
- String depClsName0 = commState.getString();
++ depClsName = commState.getString("depClsName");
+
- if (depClsName0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- depClsName = depClsName0;
-
+ commState.idx++;
+
+ case 3:
- if (buf.remaining() < 1)
- return false;
++ byte depMode0 = commState.getByte("depMode");
+
- byte depMode0 = commState.getByte();
++ if (!commState.lastRead())
++ return false;
+
+ depMode = IgniteDeploymentMode.fromOrdinal(depMode0);
+
+ commState.idx++;
+
+ case 4:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (ldrParties == null)
- ldrParties = U.newHashMap(commState.readSize);
++ ldrParties = new HashMap<>(commState.readSize, 1.0f);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
+ if (!commState.keyDone) {
- UUID _val = commState.getUuid();
++ UUID _val = commState.getUuid(null);
+
- if (_val == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ commState.cur = _val;
+ commState.keyDone = true;
+ }
+
- IgniteUuid _val = commState.getGridUuid();
++ IgniteUuid _val = commState.getGridUuid(null);
+
- if (_val == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ ldrParties.put((UUID)commState.cur, _val);
+
+ commState.keyDone = false;
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+ commState.cur = null;
+
+ commState.idx++;
+
+ case 5:
- byte[] topicBytes0 = commState.getByteArray();
++ topicBytes = commState.getByteArray("topicBytes");
+
- if (topicBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- topicBytes = topicBytes0;
-
+ commState.idx++;
+
+ case 6:
- String userVer0 = commState.getString();
++ userVer = commState.getString("userVer");
+
- if (userVer0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- userVer = userVer0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 9;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridIoUserMessage.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java
index 0000000,d49e280..d4de347
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java
@@@ -1,0 -1,359 +1,355 @@@
+ /*
+ * 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.managers.deployment;
+
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.apache.ignite.internal.util.tostring.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Deployment info bean.
+ */
+ public class GridDeploymentInfoBean extends GridTcpCommunicationMessageAdapter implements GridDeploymentInfo,
+ Externalizable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private IgniteUuid clsLdrId;
+
+ /** */
+ private IgniteDeploymentMode depMode;
+
+ /** */
+ private String userVer;
+
+ /** */
+ private boolean locDepOwner;
+
+ /** Node class loader participant map. */
+ @GridToStringInclude
+ @GridDirectMap(keyType = UUID.class, valueType = IgniteUuid.class)
+ private Map<UUID, IgniteUuid> participants;
+
+ /**
+ * Required by {@link Externalizable}.
+ */
+ public GridDeploymentInfoBean() {
+ /* No-op. */
+ }
+
+ /**
+ * @param clsLdrId Class loader ID.
+ * @param userVer User version.
+ * @param depMode Deployment mode.
+ * @param participants Participants.
+ * @param locDepOwner Local deployment owner flag.
+ */
+ public GridDeploymentInfoBean(IgniteUuid clsLdrId, String userVer, IgniteDeploymentMode depMode,
+ Map<UUID, IgniteUuid> participants, boolean locDepOwner) {
+ this.clsLdrId = clsLdrId;
+ this.depMode = depMode;
+ this.userVer = userVer;
+ this.participants = participants;
+ this.locDepOwner = locDepOwner;
+ }
+
+ /**
+ * @param dep Grid deployment.
+ */
+ public GridDeploymentInfoBean(GridDeploymentInfo dep) {
+ clsLdrId = dep.classLoaderId();
+ depMode = dep.deployMode();
+ userVer = dep.userVersion();
+ locDepOwner = dep.localDeploymentOwner();
+ participants = dep.participants();
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteUuid classLoaderId() {
+ return clsLdrId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteDeploymentMode deployMode() {
+ return depMode;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String userVersion() {
+ return userVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long sequenceNumber() {
+ return clsLdrId.localId();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean localDeploymentOwner() {
+ return locDepOwner;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Map<UUID, IgniteUuid> participants() {
+ return participants;
+ }
+
+ /**
+ * Sets local deployment ownership flag.
+ *
+ * @param locDepOwner Local deployment ownership flag.
+ */
+ public void localDeploymentOwner(boolean locDepOwner) {
+ this.locDepOwner = locDepOwner;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return clsLdrId.hashCode();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ return o == this || o instanceof GridDeploymentInfoBean &&
+ clsLdrId.equals(((GridDeploymentInfoBean)o).clsLdrId);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDeploymentInfoBean _clone = new GridDeploymentInfoBean();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridDeploymentInfoBean _clone = (GridDeploymentInfoBean)_msg;
+
+ _clone.clsLdrId = clsLdrId;
+ _clone.depMode = depMode;
+ _clone.userVer = userVer;
+ _clone.locDepOwner = locDepOwner;
+ _clone.participants = participants;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putGridUuid(clsLdrId))
++ if (!commState.putGridUuid("clsLdrId", clsLdrId))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putEnum(depMode))
++ if (!commState.putEnum("depMode", depMode))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putBoolean(locDepOwner))
++ if (!commState.putBoolean("locDepOwner", locDepOwner))
+ return false;
+
+ commState.idx++;
+
+ case 3:
+ if (participants != null) {
+ if (commState.it == null) {
- if (!commState.putInt(participants.size()))
++ if (!commState.putInt(null, participants.size()))
+ return false;
+
+ commState.it = participants.entrySet().iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
+ Map.Entry<UUID, IgniteUuid> e = (Map.Entry<UUID, IgniteUuid>)commState.cur;
+
+ if (!commState.keyDone) {
- if (!commState.putUuid(e.getKey()))
++ if (!commState.putUuid(null, e.getKey()))
+ return false;
+
+ commState.keyDone = true;
+ }
+
- if (!commState.putGridUuid(e.getValue()))
++ if (!commState.putGridUuid(null, e.getValue()))
+ return false;
+
+ commState.keyDone = false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putString(userVer))
++ if (!commState.putString("userVer", userVer))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- IgniteUuid clsLdrId0 = commState.getGridUuid();
++ clsLdrId = commState.getGridUuid("clsLdrId");
+
- if (clsLdrId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- clsLdrId = clsLdrId0;
-
+ commState.idx++;
+
+ case 1:
- if (buf.remaining() < 1)
- return false;
++ byte depMode0 = commState.getByte("depMode");
+
- byte depMode0 = commState.getByte();
++ if (!commState.lastRead())
++ return false;
+
+ depMode = IgniteDeploymentMode.fromOrdinal(depMode0);
+
+ commState.idx++;
+
+ case 2:
- if (buf.remaining() < 1)
- return false;
++ locDepOwner = commState.getBoolean("locDepOwner");
+
- locDepOwner = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 3:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (participants == null)
- participants = U.newHashMap(commState.readSize);
++ participants = new HashMap<>(commState.readSize, 1.0f);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
+ if (!commState.keyDone) {
- UUID _val = commState.getUuid();
++ UUID _val = commState.getUuid(null);
+
- if (_val == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ commState.cur = _val;
+ commState.keyDone = true;
+ }
+
- IgniteUuid _val = commState.getGridUuid();
++ IgniteUuid _val = commState.getGridUuid(null);
+
- if (_val == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ participants.put((UUID)commState.cur, _val);
+
+ commState.keyDone = false;
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+ commState.cur = null;
+
+ commState.idx++;
+
+ case 4:
- String userVer0 = commState.getString();
++ userVer = commState.getString("userVer");
+
- if (userVer0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- userVer = userVer0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 10;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ U.writeGridUuid(out, clsLdrId);
+ U.writeEnum(out, depMode);
+ U.writeString(out, userVer);
+ out.writeBoolean(locDepOwner);
+ U.writeMap(out, participants);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ clsLdrId = U.readGridUuid(in);
+ depMode = IgniteDeploymentMode.fromOrdinal(in.readByte());
+ userVer = U.readString(in);
+ locDepOwner = in.readBoolean();
+ participants = U.readMap(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDeploymentInfoBean.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
index 0000000,177976a..c9f1c6b
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
@@@ -1,0 -1,336 +1,330 @@@
+ /*
+ * 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.managers.deployment;
+
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.apache.ignite.internal.util.tostring.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Deployment request.
+ */
+ public class GridDeploymentRequest extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Response topic. Response should be sent back to this topic. */
+ @GridDirectTransient
+ private Object resTopic;
+
+ /** Serialized topic. */
+ private byte[] resTopicBytes;
+
+ /** Requested class name. */
+ private String rsrcName;
+
+ /** Class loader ID. */
+ private IgniteUuid ldrId;
+
+ /** Undeploy flag. */
+ private boolean isUndeploy;
+
+ /** Nodes participating in request (chain). */
+ @GridToStringInclude
+ @GridDirectCollection(UUID.class)
+ private Collection<UUID> nodeIds;
+
+ /**
+ * No-op constructor to support {@link Externalizable} interface.
+ * This constructor is not meant to be used for other purposes.
+ */
+ public GridDeploymentRequest() {
+ // No-op.
+ }
+
+ /**
+ * Creates new request.
+ *
+ * @param resTopic Response topic.
+ * @param ldrId Class loader ID.
+ * @param rsrcName Resource name that should be found and sent back.
+ * @param isUndeploy Undeploy property.
+ */
+ GridDeploymentRequest(Object resTopic, IgniteUuid ldrId, String rsrcName, boolean isUndeploy) {
+ assert isUndeploy || resTopic != null;
+ assert isUndeploy || ldrId != null;
+ assert rsrcName != null;
+
+ this.resTopic = resTopic;
+ this.ldrId = ldrId;
+ this.rsrcName = rsrcName;
+ this.isUndeploy = isUndeploy;
+ }
+
+ /**
+ * Get topic response should be sent to.
+ *
+ * @return Response topic name.
+ */
+ Object responseTopic() {
+ return resTopic;
+ }
+
+ /**
+ * @param resTopic Response topic.
+ */
+ void responseTopic(Object resTopic) {
+ this.resTopic = resTopic;
+ }
+
+ /**
+ * @return Serialized topic.
+ */
+ byte[] responseTopicBytes() {
+ return resTopicBytes;
+ }
+
+ /**
+ * @param resTopicBytes Serialized topic.
+ */
+ void responseTopicBytes(byte[] resTopicBytes) {
+ this.resTopicBytes = resTopicBytes;
+ }
+
+ /**
+ * Class name/resource name that is being requested.
+ *
+ * @return Resource or class name.
+ */
+ String resourceName() {
+ return rsrcName;
+ }
+
+ /**
+ * Gets property ldrId.
+ *
+ * @return Property ldrId.
+ */
+ IgniteUuid classLoaderId() {
+ return ldrId;
+ }
+
+ /**
+ * Gets property undeploy.
+ *
+ * @return Property undeploy.
+ */
+ boolean isUndeploy() {
+ return isUndeploy;
+ }
+
+ /**
+ * @return Node IDs chain which is updated as request jumps
+ * from node to node.
+ */
+ public Collection<UUID> nodeIds() {
+ return nodeIds;
+ }
+
+ /**
+ * @param nodeIds Node IDs chain which is updated as request jumps
+ * from node to node.
+ */
+ public void nodeIds(Collection<UUID> nodeIds) {
+ this.nodeIds = nodeIds;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDeploymentRequest _clone = new GridDeploymentRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridDeploymentRequest _clone = (GridDeploymentRequest)_msg;
+
+ _clone.resTopic = resTopic;
+ _clone.resTopicBytes = resTopicBytes;
+ _clone.rsrcName = rsrcName;
+ _clone.ldrId = ldrId;
+ _clone.isUndeploy = isUndeploy;
+ _clone.nodeIds = nodeIds;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putBoolean(isUndeploy))
++ if (!commState.putBoolean("isUndeploy", isUndeploy))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putGridUuid(ldrId))
++ if (!commState.putGridUuid("ldrId", ldrId))
+ return false;
+
+ commState.idx++;
+
+ case 2:
+ if (nodeIds != null) {
+ if (commState.it == null) {
- if (!commState.putInt(nodeIds.size()))
++ if (!commState.putInt(null, nodeIds.size()))
+ return false;
+
+ commState.it = nodeIds.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putUuid((UUID)commState.cur))
++ if (!commState.putUuid(null, (UUID)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 3:
- if (!commState.putByteArray(resTopicBytes))
++ if (!commState.putByteArray("resTopicBytes", resTopicBytes))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putString(rsrcName))
++ if (!commState.putString("rsrcName", rsrcName))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- if (buf.remaining() < 1)
- return false;
++ isUndeploy = commState.getBoolean("isUndeploy");
+
- isUndeploy = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 1:
- IgniteUuid ldrId0 = commState.getGridUuid();
++ ldrId = commState.getGridUuid("ldrId");
+
- if (ldrId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- ldrId = ldrId0;
-
+ commState.idx++;
+
+ case 2:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (nodeIds == null)
+ nodeIds = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- UUID _val = commState.getUuid();
++ UUID _val = commState.getUuid(null);
+
- if (_val == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ nodeIds.add((UUID)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 3:
- byte[] resTopicBytes0 = commState.getByteArray();
++ resTopicBytes = commState.getByteArray("resTopicBytes");
+
- if (resTopicBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- resTopicBytes = resTopicBytes0;
-
+ commState.idx++;
+
+ case 4:
- String rsrcName0 = commState.getString();
++ rsrcName = commState.getString("rsrcName");
+
- if (rsrcName0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- rsrcName = rsrcName0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 11;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDeploymentRequest.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java
index 0000000,3bcd5dd..bdd5b63
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java
@@@ -1,0 -1,212 +1,208 @@@
+ /*
+ * 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.managers.deployment;
+
+ import org.apache.ignite.internal.util.*;
+ import org.apache.ignite.internal.util.direct.*;
+
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Grid deployment response containing requested resource bytes.
+ */
+ public class GridDeploymentResponse extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Result state. */
+ private boolean success;
+
+ /** */
+ private String errMsg;
+
+ /** Raw class/resource/task. */
+ private GridByteArrayList byteSrc;
+
+ /**
+ * No-op constructor to support {@link Externalizable} interface.
+ * This constructor is not meant to be used for other purposes.
+ */
+ @SuppressWarnings({"RedundantNoArgConstructor"})
+ public GridDeploymentResponse() {
+ // No-op.
+ }
+
+ /**
+ * Sets raw class/resource or serialized task as bytes array.
+ *
+ * @param byteSrc Class/resource/task source.
+ */
+ void byteSource(GridByteArrayList byteSrc) {
+ this.byteSrc = byteSrc;
+ }
+
+ /**
+ * Gets raw class/resource or serialized task source as bytes array.
+ * @return Class/resource/task source.
+ */
+ GridByteArrayList byteSource() {
+ return byteSrc;
+ }
+
+ /**
+ * Tests whether corresponding request was processed successful of not.
+ *
+ * @return {@code true} if request for the source processed
+ * successfully and {@code false} if not.
+ */
+ boolean success() {
+ return success;
+ }
+
+ /**
+ * Sets corresponding request processing status.
+ *
+ * @param success {@code true} if request processed successfully and
+ * response keeps source inside and {@code false} otherwise.
+ */
+ void success(boolean success) {
+ this.success = success;
+ }
+
+ /**
+ * Gets request processing error message. If request processed with error,
+ * message will be put in response.
+ *
+ * @return Request processing error message.
+ */
+ String errorMessage() {
+ return errMsg;
+ }
+
+ /**
+ * Sets request processing error message.
+ *
+ * @param errMsg Request processing error message.
+ */
+ void errorMessage(String errMsg) {
+ this.errMsg = errMsg;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDeploymentResponse _clone = new GridDeploymentResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridDeploymentResponse _clone = (GridDeploymentResponse)_msg;
+
+ _clone.success = success;
+ _clone.errMsg = errMsg;
+ _clone.byteSrc = byteSrc;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putByteArrayList(byteSrc))
++ if (!commState.putByteArrayList("byteSrc", byteSrc))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putString(errMsg))
++ if (!commState.putString("errMsg", errMsg))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putBoolean(success))
++ if (!commState.putBoolean("success", success))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- GridByteArrayList byteSrc0 = commState.getByteArrayList();
++ byteSrc = commState.getByteArrayList("byteSrc");
+
- if (byteSrc0 == BYTE_ARR_LIST_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- byteSrc = byteSrc0;
-
+ commState.idx++;
+
+ case 1:
- String errMsg0 = commState.getString();
++ errMsg = commState.getString("errMsg");
+
- if (errMsg0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- errMsg = errMsg0;
-
+ commState.idx++;
+
+ case 2:
- if (buf.remaining() < 1)
- return false;
++ success = commState.getBoolean("success");
+
- success = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 12;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDeploymentResponse.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java
index 0000000,5abe905..dd46441
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java
@@@ -1,0 -1,537 +1,523 @@@
+ /*
+ * 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.managers.eventstorage;
+
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.events.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.jetbrains.annotations.*;
+
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Event storage message.
+ */
+ public class GridEventStorageMessage extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ @GridDirectTransient
+ private Object resTopic;
+
+ /** */
+ private byte[] resTopicBytes;
+
+ /** */
+ private byte[] filter;
+
+ /** */
+ @GridDirectTransient
+ private Collection<IgniteEvent> evts;
+
+ /** */
+ private byte[] evtsBytes;
+
+ /** */
+ @GridDirectTransient
+ private Throwable ex;
+
+ /** */
+ private byte[] exBytes;
+
+ /** */
+ private IgniteUuid clsLdrId;
+
+ /** */
+ private IgniteDeploymentMode depMode;
+
+ /** */
+ private String filterClsName;
+
+ /** */
+ private String userVer;
+
+ /** Node class loader participants. */
+ @GridToStringInclude
+ @GridDirectMap(keyType = UUID.class, valueType = IgniteUuid.class)
+ private Map<UUID, IgniteUuid> ldrParties;
+
+ /** */
+ public GridEventStorageMessage() {
+ // No-op.
+ }
+
+ /**
+ * @param resTopic Response topic,
+ * @param filter Query filter.
+ * @param filterClsName Filter class name.
+ * @param clsLdrId Class loader ID.
+ * @param depMode Deployment mode.
+ * @param userVer User version.
+ * @param ldrParties Node loader participant map.
+ */
+ GridEventStorageMessage(
+ Object resTopic,
+ byte[] filter,
+ String filterClsName,
+ IgniteUuid clsLdrId,
+ IgniteDeploymentMode depMode,
+ String userVer,
+ Map<UUID, IgniteUuid> ldrParties) {
+ this.resTopic = resTopic;
+ this.filter = filter;
+ this.filterClsName = filterClsName;
+ this.depMode = depMode;
+ this.clsLdrId = clsLdrId;
+ this.userVer = userVer;
+ this.ldrParties = ldrParties;
+
+ evts = null;
+ ex = null;
+ }
+
+ /**
+ * @param evts Grid events.
+ * @param ex Exception occurred during processing.
+ */
+ GridEventStorageMessage(Collection<IgniteEvent> evts, Throwable ex) {
+ this.evts = evts;
+ this.ex = ex;
+
+ resTopic = null;
+ filter = null;
+ filterClsName = null;
+ depMode = null;
+ clsLdrId = null;
+ userVer = null;
+ }
+
+ /**
+ * @return Response topic.
+ */
+ Object responseTopic() {
+ return resTopic;
+ }
+
+ /**
+ * @param resTopic Response topic.
+ */
+ void responseTopic(Object resTopic) {
+ this.resTopic = resTopic;
+ }
+
+ /**
+ * @return Serialized response topic.
+ */
+ byte[] responseTopicBytes() {
+ return resTopicBytes;
+ }
+
+ /**
+ * @param resTopicBytes Serialized response topic.
+ */
+ void responseTopicBytes(byte[] resTopicBytes) {
+ this.resTopicBytes = resTopicBytes;
+ }
+
+ /**
+ * @return Filter.
+ */
+ byte[] filter() {
+ return filter;
+ }
+
+ /**
+ * @return Events.
+ */
+ @Nullable Collection<IgniteEvent> events() {
+ return evts != null ? Collections.unmodifiableCollection(evts) : null;
+ }
+
+ /**
+ * @param evts Events.
+ */
+ void events(@Nullable Collection<IgniteEvent> evts) {
+ this.evts = evts;
+ }
+
+ /**
+ * @return Serialized events.
+ */
+ byte[] eventsBytes() {
+ return evtsBytes;
+ }
+
+ /**
+ * @param evtsBytes Serialized events.
+ */
+ void eventsBytes(byte[] evtsBytes) {
+ this.evtsBytes = evtsBytes;
+ }
+
+ /**
+ * @return the Class loader ID.
+ */
+ IgniteUuid classLoaderId() {
+ return clsLdrId;
+ }
+
+ /**
+ * @return Deployment mode.
+ */
+ IgniteDeploymentMode deploymentMode() {
+ return depMode;
+ }
+
+ /**
+ * @return Filter class name.
+ */
+ String filterClassName() {
+ return filterClsName;
+ }
+
+ /**
+ * @return User version.
+ */
+ String userVersion() {
+ return userVer;
+ }
+
+ /**
+ * @return Node class loader participant map.
+ */
+ @Nullable Map<UUID, IgniteUuid> loaderParticipants() {
+ return ldrParties != null ? Collections.unmodifiableMap(ldrParties) : null;
+ }
+
+ /**
+ * @param ldrParties Node class loader participant map.
+ */
+ void loaderParticipants(Map<UUID, IgniteUuid> ldrParties) {
+ this.ldrParties = ldrParties;
+ }
+
+ /**
+ * @return Exception.
+ */
+ Throwable exception() {
+ return ex;
+ }
+
+ /**
+ * @param ex Exception.
+ */
+ void exception(Throwable ex) {
+ this.ex = ex;
+ }
+
+ /**
+ * @return Serialized exception.
+ */
+ byte[] exceptionBytes() {
+ return exBytes;
+ }
+
+ /**
+ * @param exBytes Serialized exception.
+ */
+ void exceptionBytes(byte[] exBytes) {
+ this.exBytes = exBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridEventStorageMessage _clone = new GridEventStorageMessage();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridEventStorageMessage _clone = (GridEventStorageMessage)_msg;
+
+ _clone.resTopic = resTopic;
+ _clone.resTopicBytes = resTopicBytes;
+ _clone.filter = filter;
+ _clone.evts = evts;
+ _clone.evtsBytes = evtsBytes;
+ _clone.ex = ex;
+ _clone.exBytes = exBytes;
+ _clone.clsLdrId = clsLdrId;
+ _clone.depMode = depMode;
+ _clone.filterClsName = filterClsName;
+ _clone.userVer = userVer;
+ _clone.ldrParties = ldrParties;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putGridUuid(clsLdrId))
++ if (!commState.putGridUuid("clsLdrId", clsLdrId))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putEnum(depMode))
++ if (!commState.putEnum("depMode", depMode))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putByteArray(evtsBytes))
++ if (!commState.putByteArray("evtsBytes", evtsBytes))
+ return false;
+
+ commState.idx++;
+
+ case 3:
- if (!commState.putByteArray(exBytes))
++ if (!commState.putByteArray("exBytes", exBytes))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putByteArray(filter))
++ if (!commState.putByteArray("filter", filter))
+ return false;
+
+ commState.idx++;
+
+ case 5:
- if (!commState.putString(filterClsName))
++ if (!commState.putString("filterClsName", filterClsName))
+ return false;
+
+ commState.idx++;
+
+ case 6:
+ if (ldrParties != null) {
+ if (commState.it == null) {
- if (!commState.putInt(ldrParties.size()))
++ if (!commState.putInt(null, ldrParties.size()))
+ return false;
+
+ commState.it = ldrParties.entrySet().iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
+ Map.Entry<UUID, IgniteUuid> e = (Map.Entry<UUID, IgniteUuid>)commState.cur;
+
+ if (!commState.keyDone) {
- if (!commState.putUuid(e.getKey()))
++ if (!commState.putUuid(null, e.getKey()))
+ return false;
+
+ commState.keyDone = true;
+ }
+
- if (!commState.putGridUuid(e.getValue()))
++ if (!commState.putGridUuid(null, e.getValue()))
+ return false;
+
+ commState.keyDone = false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 7:
- if (!commState.putByteArray(resTopicBytes))
++ if (!commState.putByteArray("resTopicBytes", resTopicBytes))
+ return false;
+
+ commState.idx++;
+
+ case 8:
- if (!commState.putString(userVer))
++ if (!commState.putString("userVer", userVer))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- IgniteUuid clsLdrId0 = commState.getGridUuid();
++ clsLdrId = commState.getGridUuid("clsLdrId");
+
- if (clsLdrId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- clsLdrId = clsLdrId0;
-
+ commState.idx++;
+
+ case 1:
- if (buf.remaining() < 1)
- return false;
++ byte depMode0 = commState.getByte("depMode");
+
- byte depMode0 = commState.getByte();
++ if (!commState.lastRead())
++ return false;
+
+ depMode = IgniteDeploymentMode.fromOrdinal(depMode0);
+
+ commState.idx++;
+
+ case 2:
- byte[] evtsBytes0 = commState.getByteArray();
++ evtsBytes = commState.getByteArray("evtsBytes");
+
- if (evtsBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- evtsBytes = evtsBytes0;
-
+ commState.idx++;
+
+ case 3:
- byte[] exBytes0 = commState.getByteArray();
++ exBytes = commState.getByteArray("exBytes");
+
- if (exBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- exBytes = exBytes0;
-
+ commState.idx++;
+
+ case 4:
- byte[] filter0 = commState.getByteArray();
++ filter = commState.getByteArray("filter");
+
- if (filter0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- filter = filter0;
-
+ commState.idx++;
+
+ case 5:
- String filterClsName0 = commState.getString();
++ filterClsName = commState.getString("filterClsName");
+
- if (filterClsName0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- filterClsName = filterClsName0;
-
+ commState.idx++;
+
+ case 6:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (ldrParties == null)
- ldrParties = U.newHashMap(commState.readSize);
++ ldrParties = new HashMap<>(commState.readSize, 1.0f);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
+ if (!commState.keyDone) {
- UUID _val = commState.getUuid();
++ UUID _val = commState.getUuid(null);
+
- if (_val == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ commState.cur = _val;
+ commState.keyDone = true;
+ }
+
- IgniteUuid _val = commState.getGridUuid();
++ IgniteUuid _val = commState.getGridUuid(null);
+
- if (_val == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ ldrParties.put((UUID)commState.cur, _val);
+
+ commState.keyDone = false;
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+ commState.cur = null;
+
+ commState.idx++;
+
+ case 7:
- byte[] resTopicBytes0 = commState.getByteArray();
++ resTopicBytes = commState.getByteArray("resTopicBytes");
+
- if (resTopicBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- resTopicBytes = resTopicBytes0;
-
+ commState.idx++;
+
+ case 8:
- String userVer0 = commState.getString();
++ userVer = commState.getString("userVer");
+
- if (userVer0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- userVer = userVer0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 13;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridEventStorageMessage.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java
index 0000000,3465efd..b0b773c
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java
@@@ -1,0 -1,252 +1,250 @@@
+ /*
+ * 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.cache;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.direct.*;
+ 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 java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Cache eviction request.
+ */
+ public class GridCacheEvictionRequest<K, V> extends GridCacheMessage<K, V> implements GridCacheDeployable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Future id. */
+ private long futId;
+
+ /** Entries to clear from near and backup nodes. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<GridTuple3<K, GridCacheVersion, Boolean>> entries;
+
+ /** Serialized entries. */
+ @GridToStringExclude
+ private byte[] entriesBytes;
+
+ /** Topology version. */
+ private long topVer;
+
+ /**
+ * Required by {@link Externalizable}.
+ */
+ public GridCacheEvictionRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param futId Future id.
+ * @param size Size.
+ * @param topVer Topology version.
+ */
+ GridCacheEvictionRequest(int cacheId, long futId, int size, long topVer) {
+ assert futId > 0;
+ assert size > 0;
+ assert topVer > 0;
+
+ this.cacheId = cacheId;
+ this.futId = futId;
+
+ entries = new ArrayList<>(size);
+
+ this.topVer = topVer;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (entries != null) {
+ if (ctx.deploymentEnabled())
+ prepareObjects(entries, ctx);
+
+ entriesBytes = ctx.marshaller().marshal(entries);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (entriesBytes != null)
+ entries = ctx.marshaller().unmarshal(entriesBytes, ldr);
+ }
+
+ /**
+ * @return Future id.
+ */
+ long futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Entries - {{Key, Version, Boolean (near or not)}, ...}.
+ */
+ Collection<GridTuple3<K, GridCacheVersion, Boolean>> entries() {
+ return entries;
+ }
+
+ /**
+ * @return Topology version.
+ */
+ @Override public long topologyVersion() {
+ return topVer;
+ }
+
+ /**
+ * Add key to request.
+ *
+ * @param key Key to evict.
+ * @param ver Entry version.
+ * @param near {@code true} if key should be evicted from near cache.
+ */
+ void addKey(K key, GridCacheVersion ver, boolean near) {
+ assert key != null;
+ assert ver != null;
+
+ entries.add(F.t(key, ver, near));
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean ignoreClassErrors() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridCacheEvictionRequest _clone = new GridCacheEvictionRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridCacheEvictionRequest _clone = (GridCacheEvictionRequest)_msg;
+
+ _clone.futId = futId;
+ _clone.entries = entries;
+ _clone.entriesBytes = entriesBytes;
+ _clone.topVer = topVer;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
- if (!commState.putByteArray(entriesBytes))
++ if (!commState.putByteArray("entriesBytes", entriesBytes))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putLong(futId))
++ if (!commState.putLong("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 5:
- if (!commState.putLong(topVer))
++ if (!commState.putLong("topVer", topVer))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
- byte[] entriesBytes0 = commState.getByteArray();
++ entriesBytes = commState.getByteArray("entriesBytes");
+
- if (entriesBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- entriesBytes = entriesBytes0;
-
+ commState.idx++;
+
+ case 4:
- if (buf.remaining() < 8)
- return false;
++ futId = commState.getLong("futId");
+
- futId = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 5:
- if (buf.remaining() < 8)
- return false;
++ topVer = commState.getLong("topVer");
+
- topVer = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 16;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridCacheEvictionRequest.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java
index 0000000,afd1e6a..10adb63
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java
@@@ -1,0 -1,281 +1,281 @@@
+ /*
+ * 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.cache;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Cache eviction response.
+ */
+ public class GridCacheEvictionResponse<K, V> extends GridCacheMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Future ID. */
+ private long futId;
+
+ /** Rejected keys. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<K> rejectedKeys = new HashSet<>();
+
+ /** Serialized rejected keys. */
+ @GridToStringExclude
+ @GridDirectCollection(byte[].class)
+ private Collection<byte[]> rejectedKeyBytes;
+
+ /** Flag to indicate whether request processing has finished with error. */
+ private boolean err;
+
+ /**
+ * Required by {@link Externalizable}.
+ */
+ public GridCacheEvictionResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param futId Future ID.
+ */
+ GridCacheEvictionResponse(int cacheId, long futId) {
+ this(cacheId, futId, false);
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param futId Future ID.
+ * @param err {@code True} if request processing has finished with error.
+ */
+ GridCacheEvictionResponse(int cacheId, long futId, boolean err) {
+ this.cacheId = cacheId;
+ this.futId = futId;
+ this.err = err;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ rejectedKeyBytes = marshalCollection(rejectedKeys, ctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ rejectedKeys = unmarshalCollection(rejectedKeyBytes, ctx, ldr);
+ }
+
+ /**
+ * @return Future ID.
+ */
+ long futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Rejected keys.
+ */
+ Collection<K> rejectedKeys() {
+ return rejectedKeys;
+ }
+
+ /**
+ * Add rejected key to response.
+ *
+ * @param key Evicted key.
+ */
+ void addRejected(K key) {
+ assert key != null;
+
+ rejectedKeys.add(key);
+ }
+
+ /**
+ * @return {@code True} if request processing has finished with error.
+ */
+ boolean error() {
+ return err;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean ignoreClassErrors() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridCacheEvictionResponse _clone = new GridCacheEvictionResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridCacheEvictionResponse _clone = (GridCacheEvictionResponse)_msg;
+
+ _clone.futId = futId;
+ _clone.rejectedKeys = rejectedKeys;
+ _clone.rejectedKeyBytes = rejectedKeyBytes;
+ _clone.err = err;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
- if (!commState.putBoolean(err))
++ if (!commState.putBoolean("err", err))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putLong(futId))
++ if (!commState.putLong("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 5:
+ if (rejectedKeyBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(rejectedKeyBytes.size()))
++ if (!commState.putInt(null, rejectedKeyBytes.size()))
+ return false;
+
+ commState.it = rejectedKeyBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
- if (buf.remaining() < 1)
- return false;
++ err = commState.getBoolean("err");
+
- err = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 4:
- if (buf.remaining() < 8)
- return false;
++ futId = commState.getLong("futId");
+
- futId = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 5:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (rejectedKeyBytes == null)
+ rejectedKeyBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ rejectedKeyBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 17;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridCacheEvictionResponse.class, this);
+ }
+ }
[12/52] [abbrv] incubator-ignite git commit: Merge branches
'ignite-117' and 'sprint-1' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-117
Posted by vk...@apache.org.
Merge branches 'ignite-117' and 'sprint-1' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-117
Conflicts:
ipc/shmem/readme.txt
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d6a720f7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d6a720f7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d6a720f7
Branch: refs/heads/ignite-61
Commit: d6a720f7ae2be07dcb3207be445cfdb1cb816974
Parents: 506cda6 9ea9607
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jan 29 16:30:45 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jan 29 16:30:45 2015 +0300
----------------------------------------------------------------------
assembly/libs/readme.txt | 111 +-
assembly/release-base-fabric.xml | 2 +-
docs/core-site.gridgain.xml | 89 -
docs/core-site.ignite.xml | 89 +
docs/gridgain_readme.md | 149 -
docs/gridgain_readme.pdf | Bin 407698 -> 0 bytes
docs/hadoop_readme.md | 80 +-
docs/hadoop_readme.pdf | Bin 411788 -> 82297 bytes
docs/hive-site.gridgain.xml | 36 -
docs/hive-site.ignite.xml | 36 +
docs/ignite_readme.md | 100 +
docs/ignite_readme.pdf | Bin 0 -> 76810 bytes
docs/mapred-site.gridgain.xml | 79 -
docs/mapred-site.ignite.xml | 79 +
examples/config/filesystem/readme.txt | 4 +-
.../hibernate/example-hibernate-L2-cache.xml | 14 +-
examples/config/hibernate/readme.txt | 4 +-
examples/config/servlet/readme.txt | 2 +-
.../ComputeFibonacciContinuationExample.java | 11 +-
.../compute/ComputeRunnableExample.java | 5 +-
.../datagrid/CacheDataLoaderExample.java | 15 +-
.../HibernateL2CacheExampleNodeStartup.java | 6 +-
.../examples/ScalarContinuationExample.scala | 9 +-
ipc/readme.txt | 4 +-
ipc/shmem/readme.txt | 10 +-
modules/aop/readme.txt | 12 +-
modules/aws/readme.txt | 12 +-
.../ClientAbstractMultiThreadedSelfTest.java | 8 +-
.../ClientAbstractMultiNodeSelfTest.java | 4 +-
.../integration/ClientAbstractSelfTest.java | 8 +-
.../rest/RestBinaryProtocolSelfTest.java | 2 +-
.../rest/RestProcessorStartSelfTest.java | 3 +-
.../rest/TaskCommandHandlerSelfTest.java | 2 +-
.../org/apache/ignite/IgniteDataLoader.java | 14 +-
.../java/org/apache/ignite/IgniteScheduler.java | 6 +-
.../apache/ignite/IgniteSystemProperties.java | 6 +-
.../main/java/org/apache/ignite/Ignition.java | 38 +-
.../org/apache/ignite/cache/CacheEntry.java | 27 +-
.../apache/ignite/cache/CacheProjection.java | 43 +-
.../apache/ignite/cache/CachingProvider.java | 2 +-
.../java/org/apache/ignite/cache/GridCache.java | 5 +-
.../apache/ignite/cache/query/CacheQueries.java | 7 +-
.../ignite/cache/query/CacheQueryFuture.java | 4 +-
.../ignite/compute/ComputeTaskFuture.java | 4 +-
.../ignite/compute/ComputeTaskSession.java | 3 +-
.../ignite/fs/mapreduce/IgniteFsTask.java | 2 +-
.../org/apache/ignite/hadoop/GridHadoop.java | 6 +-
.../ignite/internal/ClusterGroupAdapter.java | 2 +-
.../internal/ClusterNodeLocalMapImpl.java | 2 +-
.../java/org/apache/ignite/internal/GridEx.java | 143 -
.../org/apache/ignite/internal/GridGainEx.java | 2399 -------------
.../ignite/internal/GridJobSessionImpl.java | 2 +-
.../org/apache/ignite/internal/GridKernal.java | 3322 ------------------
.../ignite/internal/GridKernalContext.java | 2 +-
.../ignite/internal/GridKernalContextImpl.java | 8 +-
.../apache/ignite/internal/GridLoggerProxy.java | 2 +-
.../ignite/internal/GridTaskSessionImpl.java | 2 +-
.../ignite/internal/GridUpdateNotifier.java | 2 +-
.../ignite/internal/IgniteClusterAsyncImpl.java | 4 +-
.../org/apache/ignite/internal/IgniteEx.java | 143 +
.../ignite/internal/IgniteInternalFuture.java | 190 +
.../apache/ignite/internal/IgniteKernal.java | 3322 ++++++++++++++++++
.../ignite/internal/IgniteSchedulerImpl.java | 6 +-
.../org/apache/ignite/internal/IgnitionEx.java | 2396 +++++++++++++
.../internal/executor/GridExecutorService.java | 44 +-
.../managers/communication/GridIoManager.java | 3 +-
.../discovery/GridDiscoveryManager.java | 2 +-
.../eventstorage/GridEventStorageManager.java | 4 +-
.../affinity/GridAffinityAssignmentCache.java | 5 +-
.../affinity/GridAffinityProcessor.java | 8 +-
.../processors/affinity/GridAffinityUtils.java | 2 +-
.../processors/cache/CacheLockImpl.java | 4 +-
.../processors/cache/GridCacheAdapter.java | 348 +-
.../cache/GridCacheAffinityManager.java | 8 +-
.../processors/cache/GridCacheContext.java | 59 +-
.../processors/cache/GridCacheEntryEx.java | 8 +
.../processors/cache/GridCacheEntryImpl.java | 27 +-
.../cache/GridCacheEvictionEntry.java | 27 +-
.../cache/GridCacheEvictionManager.java | 4 +-
.../cache/GridCacheExplicitLockSpan.java | 4 +-
.../cache/GridCacheFilterEvaluationEntry.java | 27 +-
.../processors/cache/GridCacheFuture.java | 3 +-
.../processors/cache/GridCacheIoManager.java | 15 +-
.../processors/cache/GridCacheMapEntry.java | 116 +-
.../cache/GridCacheMultiTxFuture.java | 6 +-
.../processors/cache/GridCacheMvccManager.java | 29 +-
.../GridCachePartitionExchangeManager.java | 9 +-
.../processors/cache/GridCachePreloader.java | 7 +-
.../cache/GridCachePreloaderAdapter.java | 9 +-
.../processors/cache/GridCacheProcessor.java | 9 +-
.../processors/cache/GridCacheProjectionEx.java | 27 +-
.../cache/GridCacheProjectionImpl.java | 69 +-
.../processors/cache/GridCacheProxyImpl.java | 73 +-
.../cache/GridCacheSharedContext.java | 13 +-
.../processors/cache/GridCacheStoreManager.java | 18 +-
.../cache/GridCacheUpdateAtomicResult.java | 6 +-
.../processors/cache/GridCacheUtils.java | 7 +-
.../processors/cache/GridDrResolveResult.java | 63 -
.../processors/cache/IgniteCacheProxy.java | 13 +-
.../GridCacheAtomicSequenceImpl.java | 3 +-
.../GridCacheDataStructuresManager.java | 4 +-
...ridCacheOptimisticCheckPreparedTxFuture.java | 7 +-
...dCachePessimisticCheckCommittedTxFuture.java | 7 +-
.../distributed/GridCacheTxFinishSync.java | 8 +-
.../GridDistributedCacheAdapter.java | 7 +-
.../GridDistributedTxRemoteAdapter.java | 54 +-
.../distributed/dht/GridDhtCacheAdapter.java | 12 +-
.../distributed/dht/GridDhtCacheEntry.java | 7 +-
.../distributed/dht/GridDhtEmbeddedFuture.java | 8 +-
.../cache/distributed/dht/GridDhtFuture.java | 4 +-
.../cache/distributed/dht/GridDhtGetFuture.java | 11 +-
.../distributed/dht/GridDhtLocalPartition.java | 5 +-
.../distributed/dht/GridDhtLockFuture.java | 11 +-
.../distributed/dht/GridDhtTopologyFuture.java | 4 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 29 +-
.../distributed/dht/GridDhtTxFinishFuture.java | 11 +-
.../cache/distributed/dht/GridDhtTxLocal.java | 19 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 11 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 11 +-
.../dht/GridPartitionedGetFuture.java | 32 +-
.../dht/atomic/GridDhtAtomicCache.java | 128 +-
.../dht/atomic/GridNearAtomicUpdateFuture.java | 34 +-
.../dht/colocated/GridDhtColocatedCache.java | 24 +-
.../colocated/GridDhtColocatedLockFuture.java | 23 +-
.../dht/preloader/GridDhtForceKeysFuture.java | 7 +-
.../preloader/GridDhtPartitionDemandPool.java | 13 +-
.../GridDhtPartitionsExchangeFuture.java | 20 +-
.../dht/preloader/GridDhtPreloader.java | 29 +-
.../distributed/near/GridNearAtomicCache.java | 45 +-
.../distributed/near/GridNearCacheAdapter.java | 15 +-
.../distributed/near/GridNearGetFuture.java | 36 +-
.../distributed/near/GridNearLockFuture.java | 23 +-
.../near/GridNearTransactionalCache.java | 9 +-
.../near/GridNearTxFinishFuture.java | 17 +-
.../cache/distributed/near/GridNearTxLocal.java | 58 +-
.../near/GridNearTxPrepareFuture.java | 17 +-
.../processors/cache/dr/GridCacheDrManager.java | 57 +-
.../cache/dr/os/GridOsCacheDrManager.java | 35 +-
.../processors/cache/local/GridLocalCache.java | 7 +-
.../processors/cache/local/GridLocalTx.java | 12 +-
.../local/atomic/GridLocalAtomicCache.java | 139 +-
.../GridCacheDistributedFieldsQueryFuture.java | 4 +-
.../query/GridCacheDistributedQueryManager.java | 9 +-
.../query/GridCacheFieldsQueryErrorFuture.java | 3 +-
.../query/GridCacheLocalFieldsQueryFuture.java | 4 +-
.../cache/query/GridCacheLocalQueryFuture.java | 3 +-
.../cache/query/GridCacheQueriesEx.java | 6 +-
.../cache/query/GridCacheQueriesImpl.java | 11 +-
.../cache/query/GridCacheQueriesProxy.java | 11 +-
.../cache/query/GridCacheQueryManager.java | 50 +-
.../query/GridCacheQueryMetadataAware.java | 4 +-
.../GridCacheContinuousQueryEntry.java | 27 +-
.../jdbc/GridCacheQueryJdbcMetadataTask.java | 2 +-
.../query/jdbc/GridCacheQueryJdbcTask.java | 2 +-
.../transactions/IgniteTransactionsImpl.java | 3 +-
.../cache/transactions/IgniteTxAdapter.java | 52 +-
.../cache/transactions/IgniteTxEx.java | 9 +-
.../cache/transactions/IgniteTxHandler.java | 48 +-
.../transactions/IgniteTxLocalAdapter.java | 158 +-
.../cache/transactions/IgniteTxLocalEx.java | 17 +-
.../cache/transactions/IgniteTxManager.java | 15 +-
.../cache/transactions/IgniteTxProxyImpl.java | 9 +-
...ridCacheVersionAbstractConflictResolver.java | 56 +
.../GridCacheVersionConflictContext.java | 73 +
.../GridCacheVersionConflictContextImpl.java | 188 +
.../GridCacheVersionConflictResolver.java | 59 +
.../version/GridCacheVersionedEntryEx.java | 2 +-
.../closure/GridClosureProcessor.java | 56 +-
.../continuous/GridContinuousProcessor.java | 4 +-
.../dataload/GridDataLoaderProcessor.java | 5 +-
.../dataload/IgniteDataLoaderImpl.java | 87 +-
.../dr/GridDrDataLoadCacheUpdater.java | 5 +-
.../email/IgniteEmailProcessorAdapter.java | 5 +-
.../email/IgniteNoopEmailProcessor.java | 5 +-
.../processors/fs/GridGgfsAsyncImpl.java | 3 +-
.../processors/fs/GridGgfsDataManager.java | 30 +-
.../internal/processors/fs/GridGgfsEx.java | 3 +-
.../internal/processors/fs/GridGgfsImpl.java | 18 +-
.../processors/fs/GridGgfsInputStreamImpl.java | 19 +-
.../processors/fs/GridGgfsIpcHandler.java | 4 +-
.../processors/fs/GridGgfsMetaManager.java | 9 +-
.../internal/processors/fs/GridGgfsServer.java | 8 +-
.../processors/fs/GridGgfsServerHandler.java | 4 +-
.../processors/fs/IgniteFsOutputStreamImpl.java | 3 +-
.../hadoop/IgniteHadoopNoopProcessor.java | 5 +-
.../hadoop/IgniteHadoopProcessorAdapter.java | 5 +-
.../processors/query/GridQueryIndexing.java | 4 +-
.../processors/query/GridQueryProcessor.java | 12 +-
.../resource/GridResourceProcessor.java | 2 +-
.../resource/GridSpringResourceContext.java | 2 +-
.../processors/rest/GridRestProcessor.java | 18 +-
.../rest/GridRestProtocolHandler.java | 4 +-
.../rest/handlers/GridRestCommandHandler.java | 4 +-
.../handlers/cache/GridCacheCommandHandler.java | 60 +-
.../cache/GridCacheQueryCommandHandler.java | 12 +-
.../handlers/log/GridLogCommandHandler.java | 3 +-
.../metadata/GridPortableMetadataHandler.java | 3 +-
.../handlers/task/GridTaskCommandHandler.java | 10 +-
.../top/GridTopologyCommandHandler.java | 3 +-
.../version/GridVersionCommandHandler.java | 3 +-
.../tcp/GridTcpMemcachedNioListener.java | 17 +-
.../protocols/tcp/GridTcpRestNioListener.java | 5 +-
.../service/GridServiceProcessor.java | 20 +-
.../processors/service/GridServiceProxy.java | 2 +-
.../processors/streamer/IgniteStreamerImpl.java | 4 +-
.../apache/ignite/internal/util/GridUtils.java | 8 +-
.../util/future/GridCompoundFuture.java | 28 +-
.../util/future/GridCompoundIdentityFuture.java | 2 +-
.../util/future/GridEmbeddedFuture.java | 38 +-
.../util/future/GridFinishedFuture.java | 8 +-
.../util/future/GridFinishedFutureEx.java | 9 +-
.../internal/util/future/GridFutureAdapter.java | 30 +-
.../util/future/GridFutureAdapterEx.java | 31 +-
.../util/future/GridFutureChainListener.java | 8 +-
.../ignite/internal/util/lang/GridFunc.java | 53 +-
.../ignite/internal/util/nio/GridNioFuture.java | 2 +-
.../apache/ignite/internal/util/typedef/X.java | 6 +-
.../apache/ignite/internal/visor/VisorJob.java | 2 +-
.../internal/visor/VisorMultiNodeTask.java | 2 +-
.../ignite/internal/visor/cache/VisorCache.java | 2 +-
.../visor/cache/VisorCachePreloadTask.java | 6 +-
.../compute/VisorComputeMonitoringHolder.java | 10 +-
.../visor/node/VisorBasicConfiguration.java | 2 +-
.../visor/node/VisorGridConfiguration.java | 2 +-
.../visor/node/VisorNodeDataCollectorJob.java | 2 +-
.../internal/visor/query/VisorQueryTask.java | 2 +-
.../apache/ignite/lang/IgniteAsyncSupport.java | 4 +-
.../ignite/lang/IgniteAsyncSupportAdapter.java | 11 +-
.../org/apache/ignite/lang/IgniteFuture.java | 189 -
.../ignite/scheduler/SchedulerFuture.java | 4 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 4 +-
.../StreamerCacheAffinityEventRouter.java | 2 +-
.../ignite/GridExceptionHelpLinksSelfTest.java | 106 -
.../ignite/GridExternalizableAbstractTest.java | 41 -
.../org/apache/ignite/GridTestTaskSession.java | 4 +-
.../ignite/IgniteCacheAffinitySelfTest.java | 283 ++
.../apache/ignite/IgniteCacheAffinityTest.java | 283 --
.../IgniteExceptionHelpLinksSelfTest.java | 106 +
.../IgniteExternalizableAbstractTest.java | 41 +
...CachePartitionFairAffinityNodesSelfTest.java | 6 +-
.../store/GridCacheBalancingStoreSelfTest.java | 3 +-
...CacheJdbcBlobStoreMultithreadedSelfTest.java | 7 +-
.../fs/GridGgfsEventsAbstractSelfTest.java | 2 +-
.../ignite/fs/GridGgfsFragmentizerSelfTest.java | 2 +-
.../internal/GridDiscoveryEventSelfTest.java | 3 +-
.../ignite/internal/GridDiscoverySelfTest.java | 4 +-
.../internal/GridExecutorServiceTest.java | 315 --
.../GridExplicitImplicitDeploymentSelfTest.java | 476 ---
.../GridJobMasterLeaveAwareSelfTest.java | 56 +-
.../ignite/internal/GridKernalTestUtils.java | 3 +-
.../internal/GridListenActorSelfTest.java | 3 +-
.../internal/GridMultipleJobsSelfTest.java | 6 +-
.../internal/GridProjectionAbstractTest.java | 20 +-
.../ignite/internal/GridReduceSelfTest.java | 2 +-
.../GridTaskFutureImplStopGridSelfTest.java | 5 +-
.../internal/GridTaskListenerSelfTest.java | 4 +-
.../GridTopicExternalizableSelfTest.java | 3 +-
.../GridTopologyBuildVersionSelfTest.java | 2 +-
.../internal/GridUpdateNotifierSelfTest.java | 3 +-
.../internal/IgniteExecutorServiceTest.java | 315 ++
...gniteExplicitImplicitDeploymentSelfTest.java | 476 +++
.../GridCheckpointManagerAbstractSelfTest.java | 4 +-
.../GridCommunicationSendMessageSelfTest.java | 4 +-
.../GridDiscoveryManagerAliveCacheSelfTest.java | 2 +-
.../discovery/GridDiscoveryManagerSelfTest.java | 6 +-
.../events/GridEventStorageManagerSelfTest.java | 3 +-
.../swapspace/GridSwapSpaceManagerSelfTest.java | 2 +-
.../GridAffinityProcessorAbstractSelfTest.java | 6 +-
.../GridCacheAbstractFailoverSelfTest.java | 3 +-
.../cache/GridCacheAbstractFlagsTest.java | 4 +-
...cheAbstractFullApiMultithreadedSelfTest.java | 5 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 381 +-
.../GridCacheAbstractIteratorsSelfTest.java | 10 +-
.../cache/GridCacheAbstractMetricsSelfTest.java | 18 +-
.../GridCacheAbstractRemoveFailureTest.java | 6 +-
.../cache/GridCacheAbstractSelfTest.java | 2 +-
.../cache/GridCacheAffinityApiSelfTest.java | 4 +-
.../GridCacheAsyncOperationsLimitSelfTest.java | 8 +-
.../cache/GridCacheConcurrentMapTest.java | 6 +-
.../GridCacheConcurrentTxMultiNodeTest.java | 4 +-
.../cache/GridCacheEntryVersionSelfTest.java | 4 +-
.../GridCacheFinishPartitionsSelfTest.java | 27 +-
...CacheFullTextQueryMultithreadedSelfTest.java | 6 +-
...idCacheGetAndTransformStoreAbstractTest.java | 4 +-
.../GridCacheGroupLockAbstractSelfTest.java | 6 +-
.../GridCacheGroupLockFailoverSelfTest.java | 5 +-
.../cache/GridCacheIncrementTransformTest.java | 4 +-
.../processors/cache/GridCacheLeakTest.java | 2 +-
.../cache/GridCacheLuceneQueryIndexTest.java | 18 +-
.../GridCacheMissingCommitVersionSelfTest.java | 3 +-
...GridCacheMixedPartitionExchangeSelfTest.java | 6 +-
.../cache/GridCacheMultiUpdateLockSelfTest.java | 5 +-
.../cache/GridCacheMvccFlagsTest.java | 4 +-
.../cache/GridCacheMvccManagerSelfTest.java | 4 +-
.../cache/GridCacheMvccPartitionedSelfTest.java | 4 +-
.../processors/cache/GridCacheMvccSelfTest.java | 4 +-
.../cache/GridCacheNestedTxAbstractTest.java | 2 +-
.../cache/GridCacheObjectToStringSelfTest.java | 2 +-
...HeapMultiThreadedUpdateAbstractSelfTest.java | 5 +-
.../GridCacheOrderedPreloadingSelfTest.java | 2 +-
.../cache/GridCacheP2PUndeploySelfTest.java | 6 +-
.../cache/GridCachePartitionedGetSelfTest.java | 2 +-
.../GridCachePreloadingEvictionsSelfTest.java | 8 +-
.../cache/GridCachePutAllFailoverSelfTest.java | 13 +-
.../GridCacheQueryInternalKeysSelfTest.java | 2 +-
.../GridCacheReferenceCleanupSelfTest.java | 6 +-
...ridCacheReplicatedSynchronousCommitTest.java | 4 +-
.../cache/GridCacheSlowTxWarnTest.java | 4 +-
.../processors/cache/GridCacheStopSelfTest.java | 6 +-
.../cache/GridCacheStoreValueBytesSelfTest.java | 4 +-
.../cache/GridCacheSwapPreloadSelfTest.java | 4 +-
.../cache/GridCacheSwapReloadSelfTest.java | 2 +-
.../processors/cache/GridCacheTestEntryEx.java | 5 +
.../cache/GridCacheTtlManagerLoadTest.java | 5 +-
.../cache/GridCacheTtlManagerSelfTest.java | 2 +-
.../GridCacheVariableTopologySelfTest.java | 4 +-
...idCacheWriteBehindStoreAbstractSelfTest.java | 4 +-
.../GridCacheWriteBehindStoreAbstractTest.java | 4 +-
.../GridCacheWriteBehindStoreSelfTest.java | 6 +-
.../IgniteCacheEntryListenerAbstractTest.java | 7 +-
.../cache/IgniteCacheInvokeAbstractTest.java | 6 +-
.../processors/cache/IgniteTxAbstractTest.java | 2 +-
.../IgniteTxConcurrentGetAbstractTest.java | 3 +-
.../IgniteTxExceptionAbstractSelfTest.java | 2 +-
.../cache/IgniteTxMultiNodeAbstractTest.java | 6 +-
.../IgniteTxMultiThreadedAbstractTest.java | 6 +-
.../IgniteTxStoreExceptionAbstractSelfTest.java | 2 +-
...eAbstractDataStructuresFailoverSelfTest.java | 27 +-
...actQueueFailoverDataConsistencySelfTest.java | 9 +-
.../GridCacheCountDownLatchSelfTest.java | 8 +-
.../GridCacheQueueCleanupSelfTest.java | 5 +-
...ridCacheQueueJoinedNodeSelfAbstractTest.java | 7 +-
...GridCacheQueueMultiNodeAbstractSelfTest.java | 17 +-
.../GridCacheSetAbstractSelfTest.java | 15 +-
.../GridCacheSetFailoverAbstractSelfTest.java | 6 +-
...PartitionedQueueCreateMultiNodeSelfTest.java | 6 +-
...dCachePartitionedQueueEntryMoveSelfTest.java | 6 +-
.../GridCacheAbstractJobExecutionTest.java | 6 +-
.../GridCacheAtomicTimeoutSelfTest.java | 11 +-
.../GridCacheBasicOpAbstractTest.java | 7 +-
.../distributed/GridCacheEventAbstractTest.java | 2 +-
...heExpiredEntriesPreloadAbstractSelfTest.java | 2 +-
.../distributed/GridCacheLockAbstractTest.java | 6 +-
.../GridCacheMultiNodeAbstractTest.java | 15 +-
.../GridCacheMultiNodeLockAbstractTest.java | 2 +-
...dCacheMultithreadedFailoverAbstractTest.java | 4 +-
.../GridCacheNodeFailureAbstractTest.java | 6 +-
...iteTxConsistencyRestartAbstractSelfTest.java | 4 +-
...xOriginatingNodeFailureAbstractSelfTest.java | 10 +-
...cOriginatingNodeFailureAbstractSelfTest.java | 22 +-
.../IgniteTxPreloadAbstractTest.java | 4 +-
.../dht/GridCacheAtomicFullApiSelfTest.java | 11 +-
.../dht/GridCacheAtomicNearCacheSelfTest.java | 2 +-
.../dht/GridCacheColocatedDebugTest.java | 11 +-
.../dht/GridCacheDhtEntrySelfTest.java | 2 +-
...GridCacheDhtEvictionNearReadersSelfTest.java | 10 +-
.../dht/GridCacheDhtEvictionSelfTest.java | 12 +-
.../dht/GridCacheDhtMappingSelfTest.java | 2 +-
.../dht/GridCacheDhtPreloadDelayedSelfTest.java | 2 +-
.../dht/GridCacheDhtPreloadPutGetSelfTest.java | 6 +-
.../dht/GridCacheDhtPreloadSelfTest.java | 5 +-
.../GridCacheDhtPreloadStartStopSelfTest.java | 5 +-
...dCachePartitionedTopologyChangeSelfTest.java | 60 +-
...itionedTxOriginatingNodeFailureSelfTest.java | 8 +-
...eAtomicInvalidPartitionHandlingSelfTest.java | 5 +-
.../atomic/GridCacheAtomicPreloadSelfTest.java | 4 +-
.../near/GridCacheNearMultiNodeSelfTest.java | 6 +-
.../near/GridCacheNearReadersSelfTest.java | 4 +-
.../near/GridCacheNearTxMultiNodeSelfTest.java | 2 +-
.../GridCachePartitionedEntryLockSelfTest.java | 5 +-
...titionedExplicitLockNodeFailureSelfTest.java | 6 +-
.../GridCachePartitionedFullApiSelfTest.java | 4 +-
...achePartitionedMultiNodeCounterSelfTest.java | 2 +-
...achePartitionedMultiNodeFullApiSelfTest.java | 5 +-
.../GridCachePartitionedProjectionSelfTest.java | 4 +-
...hePartitionedQueryMultiThreadedSelfTest.java | 6 +-
.../GridCachePartitionedTxSalvageSelfTest.java | 5 +-
.../GridCacheReplicatedEvictionSelfTest.java | 5 +-
.../GridCacheBatchEvictUnswapSelfTest.java | 5 +-
...heConcurrentEvictionConsistencySelfTest.java | 4 +-
.../GridCacheConcurrentEvictionsSelfTest.java | 4 +-
.../cache/eviction/GridCacheMockEntry.java | 27 +-
...cheSynchronousEvictionsFailoverSelfTest.java | 4 +-
.../IgniteCacheExpiryPolicyAbstractTest.java | 2 +-
...ridCacheContinuousQueryAbstractSelfTest.java | 4 +-
.../clock/GridTimeSyncProcessorSelfTest.java | 6 +-
.../closure/GridClosureProcessorSelfTest.java | 27 +-
.../continuous/GridEventConsumeSelfTest.java | 10 +-
.../GridDataLoaderProcessorSelfTest.java | 23 +-
.../processors/fs/GridGgfsAbstractSelfTest.java | 6 +-
.../fs/GridGgfsDataManagerSelfTest.java | 9 +-
.../processors/fs/GridGgfsModesSelfTest.java | 4 +-
.../fs/GridGgfsProcessorSelfTest.java | 2 +-
...IpcEndpointRegistrationAbstractSelfTest.java | 2 +-
.../processors/fs/GridGgfsSizeSelfTest.java | 8 +-
.../processors/fs/GridGgfsTaskSelfTest.java | 5 +-
.../cache/GridCacheCommandHandlerSelfTest.java | 9 +-
.../GridServiceProcessorAbstractSelfTest.java | 20 +-
.../GridServiceProcessorMultiNodeSelfTest.java | 8 +-
.../GridServiceReassignmentSelfTest.java | 2 +-
.../streamer/GridStreamerFailoverSelfTest.java | 4 +-
.../timeout/GridTimeoutProcessorSelfTest.java | 5 +-
.../util/future/GridCompoundFutureSelfTest.java | 8 +-
.../util/future/GridEmbeddedFutureSelfTest.java | 7 +-
.../util/future/GridFinishedFutureSelfTest.java | 9 +-
.../util/future/GridFutureAdapterSelfTest.java | 23 +-
.../future/GridFutureListenPerformanceTest.java | 5 +-
.../ipc/shmem/IpcSharedMemorySpaceSelfTest.java | 20 +-
.../internal/util/nio/GridNioSelfTest.java | 8 +-
.../offheap/GridOffHeapMapAbstractSelfTest.java | 7 +-
...idOffHeapPartitionedMapAbstractSelfTest.java | 3 +-
...apPartitionedMapPerformanceAbstractTest.java | 10 +-
.../unsafe/GridUnsafeMemorySelfTest.java | 6 +-
.../ignite/jvmtest/ConcurrentMapTest.java | 4 +-
.../ignite/jvmtest/NetworkFailureTest.java | 16 +-
.../QueueSizeCounterMultiThreadedTest.java | 4 +-
.../jvmtest/ReadWriteLockMultiThreadedTest.java | 10 +-
.../ignite/lang/GridBasicPerformanceTest.java | 5 +-
.../apache/ignite/lang/GridFuncSelfTest.java | 13 +-
.../lang/GridFutureListenPerformanceTest.java | 5 +-
...idFileSwapSpaceSpiMultithreadedLoadTest.java | 6 +-
.../cache/GridCacheAbstractLoadTest.java | 6 +-
.../cache/GridCachePutRemoveLoadTest.java | 2 +-
.../loadtests/cache/GridCacheSwapLoadTest.java | 13 +-
.../GridCacheWriteBehindStoreLoadTest.java | 4 +-
.../loadtests/colocation/GridTestMain.java | 10 +-
.../communication/GridIoManagerBenchmark.java | 10 +-
.../communication/GridIoManagerBenchmark0.java | 22 +-
.../GridContinuousOperationsLoadTest.java | 4 +-
.../ignite/loadtests/dsi/GridDsiPerfJob.java | 2 +-
...GridJobExecutionLoadTestClientSemaphore.java | 5 +-
...JobExecutionSingleNodeSemaphoreLoadTest.java | 7 +-
.../mergesort/GridMergeSortLoadTask.java | 6 +-
...apPartitionedMapPerformanceAbstractTest.java | 10 +-
.../streamer/GridStreamerIndexLoadTest.java | 8 +-
.../marshaller/GridMarshallerAbstractTest.java | 20 +-
.../ignite/messaging/GridMessagingSelfTest.java | 6 +-
...redFsCheckpointSpiMultiThreadedSelfTest.java | 8 +-
.../collision/GridTestCollisionTaskSession.java | 3 +-
...mmunicationSpiConcurrentConnectSelfTest.java | 3 +-
.../tcp/GridTcpCommunicationSpiLanTest.java | 3 +-
...cpCommunicationSpiMultithreadedSelfTest.java | 9 +-
...GridTcpCommunicationSpiRecoverySelfTest.java | 7 +-
...ClusterMetricsSnapshotSerializeSelfTest.java | 52 +-
.../tcp/GridTcpDiscoveryMultiThreadedTest.java | 7 +-
.../discovery/tcp/GridTcpDiscoverySelfTest.java | 14 +-
.../file/GridFileSwapSpaceSpiSelfTest.java | 7 +-
.../GridCacheStoreValueBytesTest.java | 7 +-
.../index/GridStreamerIndexSelfTest.java | 8 +-
.../window/GridStreamerWindowSelfTest.java | 4 +-
.../ignite/testframework/GridTestUtils.java | 12 +-
.../testframework/junits/GridAbstractTest.java | 22 +-
.../junits/GridTestKernalContext.java | 2 +-
.../cache/GridAbstractCacheStoreSelfTest.java | 3 +-
.../junits/common/GridCommonAbstractTest.java | 26 +-
.../ignite/testsuites/IgniteBasicTestSuite.java | 2 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 2 +-
.../testsuites/IgniteComputeGridTestSuite.java | 4 +-
...dConcurrentLinkedDequeMultiThreadedTest.java | 6 +-
...rrentLinkedHashMapMultiThreadedSelfTest.java | 10 +-
.../apache/ignite/util/GridIndexFillTest.java | 4 +-
.../ignite/util/GridSnapshotLockSelfTest.java | 6 +-
.../util/GridSpinReadWriteLockSelfTest.java | 4 +-
modules/core/src/test/resources/readme.txt | 2 +-
modules/email/readme.txt | 12 +-
.../processors/email/IgniteEmailProcessor.java | 5 +-
modules/hadoop/readme.txt | 12 +-
.../GridHadoopClientProtocolProvider.java | 8 +-
.../processors/hadoop/GridHadoopImpl.java | 6 +-
.../hadoop/IgniteHadoopProcessor.java | 5 +-
.../hadoop/jobtracker/GridHadoopJobTracker.java | 19 +-
.../GridHadoopDefaultMapReducePlanner.java | 2 +-
.../proto/GridHadoopProtocolJobStatusTask.java | 7 +-
.../hadoop/shuffle/GridHadoopShuffle.java | 2 +-
.../hadoop/shuffle/GridHadoopShuffleJob.java | 7 +-
.../GridHadoopExternalTaskExecutor.java | 16 +-
.../child/GridHadoopChildProcessRunner.java | 18 +-
.../GridGgfsHadoopFileSystemClientSelfTest.java | 2 +-
...idHadoopDefaultMapReducePlannerSelfTest.java | 12 +-
.../hadoop/GridHadoopJobTrackerSelfTest.java | 5 +-
.../GridHadoopMapReduceEmbeddedSelfTest.java | 4 +-
.../hadoop/GridHadoopMapReduceTest.java | 4 +-
.../hadoop/GridHadoopTaskExecutionSelfTest.java | 12 +-
.../GridHadoopExecutorServiceTest.java | 4 +-
...GridHadoopExternalTaskExecutionSelfTest.java | 6 +-
.../ggfs/GridGgfsPerformanceBenchmark.java | 4 +-
modules/hibernate/readme.txt | 14 +-
.../hibernate/GridHibernateRegionFactory.java | 10 +-
modules/indexing/readme.txt | 12 +-
.../processors/query/h2/IgniteH2Indexing.java | 4 +-
.../h2/twostep/GridReduceQueryExecutor.java | 2 +-
.../cache/GridCacheAbstractQuerySelfTest.java | 6 +-
.../cache/GridCacheOffHeapAndSwapSelfTest.java | 8 +-
.../cache/GridCacheQueryLoadSelfTest.java | 2 +-
.../GridCacheQueryMultiThreadedSelfTest.java | 24 +-
...idCacheReduceQueryMultithreadedSelfTest.java | 6 +-
.../near/GridCacheQueryNodeRestartSelfTest.java | 5 +-
.../GridCacheReplicatedFieldsQuerySelfTest.java | 2 +-
.../GridCacheReplicatedQuerySelfTest.java | 6 +-
.../query/h2/GridH2IndexRebuildTest.java | 7 +-
.../query/h2/GridH2IndexingGeoSelfTest.java | 6 +-
.../query/h2/sql/GridQueryParsingTest.java | 2 +-
.../tcp/GridOrderedMessageCancelSelfTest.java | 4 +-
modules/jcl/readme.txt | 12 +-
modules/jta/readme.txt | 12 +-
.../GridTmLookupLifecycleAwareSelfTest.java | 2 +-
modules/log4j/readme.txt | 12 +-
modules/rest-http/readme.txt | 12 +-
modules/scalar/readme.txt | 8 +-
.../scalar/pimps/ScalarProjectionPimp.scala | 25 +-
modules/schedule/readme.txt | 12 +-
.../processors/schedule/ScheduleFutureImpl.java | 22 +-
.../schedule/GridScheduleSelfTest.java | 13 +-
modules/slf4j/readme.txt | 12 +-
modules/spring/readme.txt | 12 +-
.../java/org/apache/ignite/IgniteSpring.java | 8 +-
.../cache/spring/SpringDynamicCacheManager.java | 2 +-
modules/ssh/readme.txt | 12 +-
modules/urideploy/readme.txt | 12 +-
.../GridTaskUriDeploymentDeadlockSelfTest.java | 2 +-
.../scala/org/apache/ignite/visor/visor.scala | 6 +-
modules/web/readme.txt | 16 +-
.../GridServletContextListenerStartup.java | 4 +-
.../startup/servlet/GridServletStartup.java | 4 +-
.../internal/websession/WebSessionSelfTest.java | 4 +-
525 files changed, 11396 insertions(+), 10513 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6a720f7/ipc/shmem/readme.txt
----------------------------------------------------------------------
diff --cc ipc/shmem/readme.txt
index 59e3b4c,a21cbf8..d4db015
--- a/ipc/shmem/readme.txt
+++ b/ipc/shmem/readme.txt
@@@ -26,12 -26,5 +26,12 @@@ Usage with Apache Ignit
-------------------
Copy compiled library to folder that already listed in 'java.library.path'
-with name in form: 'libggshmem-<ignite-version>.<extention>'.
+with name in form: 'libigniteshmem-<gridgain-version>.<extention>'.
Note: Grid should be restarted.
+
+**************************************************************************************
+*** Additional notes:
+*** - 'make install' should be run under sudo
+*** - if you have problems with <jni.h>, remember that JAVA_HOME have to be set not only for current user, but and for sudo user (check it by typing 'sudo -E env | grep JAVA_HOME')
+*** - if you do all right, but it still no work you can just replace manually $(JAVA_HOME) on your java home path at Makefiles.* . :-)
- **************************************************************************************
++**************************************************************************************
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6a720f7/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsServer.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6a720f7/modules/core/src/main/java/org/apache/ignite/internal/util/GridUtils.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6a720f7/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6a720f7/modules/core/src/test/java/org/apache/ignite/internal/processors/fs/GridGgfsServerManagerIpcEndpointRegistrationAbstractSelfTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6a720f7/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemorySpaceSelfTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemorySpaceSelfTest.java
index fab41e7,0000000..82b8c0e
mode 100644,000000..100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemorySpaceSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemorySpaceSelfTest.java
@@@ -1,259 -1,0 +1,267 @@@
+/*
+ * 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.util.ipc.shmem;
+
+import org.apache.ignite.*;
- import org.apache.ignite.lang.*;
++import org.apache.ignite.internal.*;
++import org.apache.ignite.internal.util.lang.*;
++import org.apache.ignite.testframework.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.jdk8.backport.*;
+
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+/**
+ *
+ */
+public class IpcSharedMemorySpaceSelfTest extends GridCommonAbstractTest {
+ /** */
+ public static final int DATA_LEN = 1024 * 1024;
+
+ /** */
+ private static final byte[] DATA = new byte[DATA_LEN];
+
+ /**
+ *
+ */
+ static {
+ for (int i = 0; i < DATA_LEN; i++)
+ DATA[i] = (byte)i;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ IpcSharedMemoryNativeLoader.load();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testBasicOperations() throws Exception {
+ File tokFile = new File(IgniteSystemProperties.getString("java.io.tmpdir"), UUID.randomUUID().toString());
+
+ assert tokFile.createNewFile();
+
+ final String tok = tokFile.getAbsolutePath();
+
+ info("Array length: " + DATA.length);
+
+ final AtomicReference<IpcSharedMemorySpace> spaceRef = new AtomicReference<>();
+
- IgniteFuture<?> fut1 = multithreadedAsync(
++ IgniteInternalFuture<?> fut1 = multithreadedAsync(
+ new Callable<Object>() {
+ @SuppressWarnings("TooBroadScope")
+ @Override public Object call() throws Exception {
+ try (IpcSharedMemorySpace space = new IpcSharedMemorySpace(tok, 0, 0, 128, false,
+ log)) {
+ spaceRef.set(space);
+
+ int bytesWritten = 0;
+
+ for (; ; ) {
+ int len = Math.min(DATA.length - bytesWritten,
+ ThreadLocalRandom8.current().nextInt(256) + 1);
+
+ space.write(DATA, bytesWritten, len, 0);
+
+ bytesWritten += len;
+
+ if (bytesWritten == DATA.length)
+ break;
+ }
+
+ info("Thread finished.");
+
+ return null;
+ }
+ }
+ },
+ 1,
+ "writer");
+
- IgniteFuture<?> fut2 = multithreadedAsync(
++ IgniteInternalFuture<?> fut2 = multithreadedAsync(
+ new Callable<Object>() {
+ @SuppressWarnings({"TooBroadScope", "StatementWithEmptyBody"})
+ @Override public Object call() throws Exception {
+ IpcSharedMemorySpace inSpace;
+
- while ((inSpace = spaceRef.get()) == null) {
- // No-op;
- }
++ GridTestUtils.waitForCondition(new GridAbsPredicate() {
++ @Override public boolean apply() {
++ return spaceRef.get() != null;
++ }
++ }, 10_000);
++
++ inSpace = spaceRef.get();
++
++ assertNotNull(inSpace);
+
+ try (IpcSharedMemorySpace space = new IpcSharedMemorySpace(tok, 0, 0, 128, true,
+ inSpace.sharedMemoryId(), log)) {
+ byte[] buf = new byte[DATA_LEN];
+
+ int bytesRead = 0;
+
+ for (; ; ) {
+ int len = Math.min(DATA.length - bytesRead,
+ ThreadLocalRandom8.current().nextInt(32) + 1);
+
+ int len0 = space.read(buf, bytesRead, len, 0);
+
+ assert len0 > 0;
+
+ bytesRead += len0;
+
+ if (bytesRead == DATA_LEN)
+ break;
+ }
+
+ assertTrue(Arrays.equals(DATA, buf));
+
+ return null;
+ }
+ }
+ },
+ 1,
+ "reader");
+
+ fut1.get();
+ fut2.get();
+
+ assert !tokFile.exists();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testForceClose() throws Exception {
+ File tokFile = new File(IgniteSystemProperties.getString("java.io.tmpdir"), getTestGridName());
+
+ assert tokFile.createNewFile() || tokFile.exists();
+
+ String tok = tokFile.getAbsolutePath();
+
+ info("Using token file: " + tok);
+
+ Collection<Integer> ids = IpcSharedMemoryUtils.sharedMemoryIds();
+
+ info("IDs in the system: " + ids);
+
+ IpcSharedMemorySpace space = new IpcSharedMemorySpace(tok, IpcSharedMemoryUtils.pid(), 0, 128,
+ false, log);
+
+ ids = IpcSharedMemoryUtils.sharedMemoryIds();
+
+ info("IDs in the system: " + ids);
+
+ assert ids.contains(space.sharedMemoryId());
+
+ // Write some data to the space, but avoid blocking.
+ space.write(DATA, 0, 16, 0);
+
+ int shmemId = space.sharedMemoryId();
+
+ space.forceClose();
+
+ ids = IpcSharedMemoryUtils.sharedMemoryIds();
+
+ info("IDs in the system: " + ids);
+
+ assert !ids.contains(shmemId);
+
+ assert !tokFile.exists();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testReadAfterClose() throws Exception {
+ File tokFile = new File(IgniteSystemProperties.getString("java.io.tmpdir"), getTestGridName());
+
+ assert tokFile.createNewFile() || tokFile.exists();
+
+ String tok = tokFile.getAbsolutePath();
+
+ info("Using token file: " + tok);
+
+ IpcSharedMemorySpace spaceOut = new IpcSharedMemorySpace(tok, IpcSharedMemoryUtils.pid(), 0, 128,
+ false, log);
+
+ try (IpcSharedMemorySpace spaceIn = new IpcSharedMemorySpace(tok, IpcSharedMemoryUtils.pid(), 0,
+ 128, true, spaceOut.sharedMemoryId(), log)) {
+ // Write some data to the space, but avoid blocking.
+ spaceOut.write(DATA, 0, 16, 0);
+
+ spaceOut.close();
+
+ // Read after other party has already called "close()".
+ // Space has data available and should read it.
+ byte[] buf = new byte[16];
+
+ int len = spaceIn.read(buf, 0, 16, 0);
+
+ assert len == 16;
+
+ len = spaceIn.read(buf, 0, 16, 0);
+
+ assert len == -1;
+ }
+
+ assert !tokFile.exists();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testWriteAfterClose() throws Exception {
+ File tokFile = new File(IgniteSystemProperties.getString("java.io.tmpdir"), getTestGridName());
+
+ assert tokFile.createNewFile() || tokFile.exists();
+
+ String tok = tokFile.getAbsolutePath();
+
+ info("Using token file: " + tok);
+
+ try (IpcSharedMemorySpace spaceOut = new IpcSharedMemorySpace(tok, IpcSharedMemoryUtils.pid(),
+ IpcSharedMemoryUtils.pid(), 128, false, log)) {
+
+ try (IpcSharedMemorySpace spaceIn = new IpcSharedMemorySpace(tok, IpcSharedMemoryUtils.pid(),
+ IpcSharedMemoryUtils.pid(), 128, true, spaceOut.sharedMemoryId(), log)) {
+ // Write some data to the space, but avoid blocking.
+ spaceOut.write(DATA, 0, 16, 0);
+
+ spaceIn.close();
+
+ try {
+ spaceOut.write(DATA, 0, 16, 0);
+
+ assert false;
+ }
+ catch (IgniteCheckedException e) {
+ info("Caught expected exception: " + e);
+ }
+ }
+ }
+
+ assert !tokFile.exists();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6a720f7/modules/hadoop/src/test/java/org/apache/ignite/fs/GridGgfsHadoopFileSystemClientSelfTest.java
----------------------------------------------------------------------
[29/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpCommunicationClient.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpCommunicationClient.java
index 0000000,87230c2..a6d0907
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpCommunicationClient.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridTcpCommunicationClient.java
@@@ -1,0 -1,555 +1,548 @@@
+ /*
+ * 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.util.nio;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.lang.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.net.*;
+ import java.nio.*;
+ import java.util.*;
+ import java.util.concurrent.locks.*;
+
+ /**
+ * Grid client for NIO server.
+ */
+ public class GridTcpCommunicationClient extends GridAbstractCommunicationClient {
+ /** Socket. */
+ private final Socket sock;
+
+ /** Output stream. */
+ private final UnsafeBufferedOutputStream out;
+
+ /** Minimum buffered message count. */
+ private final int minBufferedMsgCnt;
+
+ /** Communication buffer size ratio. */
+ private final double bufSizeRatio;
+
+ /** */
- private final GridNioMessageWriter msgWriter;
-
- /** */
+ private final ByteBuffer writeBuf;
+
+ /**
+ * @param metricsLsnr Metrics listener.
- * @param msgWriter Message writer.
+ * @param addr Address.
+ * @param locHost Local address.
+ * @param connTimeout Connect timeout.
+ * @param tcpNoDelay Value for {@code TCP_NODELAY} socket option.
+ * @param sockRcvBuf Socket receive buffer.
+ * @param sockSndBuf Socket send buffer.
+ * @param bufSize Buffer size (or {@code 0} to disable buffer).
+ * @param minBufferedMsgCnt Minimum buffered message count.
+ * @param bufSizeRatio Communication buffer size ratio.
+ * @throws IgniteCheckedException If failed.
+ */
+ public GridTcpCommunicationClient(
+ GridNioMetricsListener metricsLsnr,
- GridNioMessageWriter msgWriter,
+ InetSocketAddress addr,
+ InetAddress locHost,
+ long connTimeout,
+ boolean tcpNoDelay,
+ int sockRcvBuf,
+ int sockSndBuf,
+ int bufSize,
+ int minBufferedMsgCnt,
+ double bufSizeRatio
+ ) throws IgniteCheckedException {
+ super(metricsLsnr);
+
+ assert metricsLsnr != null;
- assert msgWriter != null;
+ assert addr != null;
+ assert locHost != null;
+ assert connTimeout >= 0;
+ assert bufSize >= 0;
+
+ A.ensure(minBufferedMsgCnt >= 0,
+ "Value of minBufferedMessageCount property cannot be less than zero.");
+ A.ensure(bufSizeRatio > 0 && bufSizeRatio < 1,
+ "Value of bufSizeRatio property must be between 0 and 1 (exclusive).");
+
- this.msgWriter = msgWriter;
+ this.minBufferedMsgCnt = minBufferedMsgCnt;
+ this.bufSizeRatio = bufSizeRatio;
+
+ writeBuf = ByteBuffer.allocate(8 << 10);
+
+ writeBuf.order(ByteOrder.nativeOrder());
+
+ sock = new Socket();
+
+ boolean success = false;
+
+ try {
+ sock.bind(new InetSocketAddress(locHost, 0));
+
+ sock.setTcpNoDelay(tcpNoDelay);
+
+ if (sockRcvBuf > 0)
+ sock.setReceiveBufferSize(sockRcvBuf);
+
+ if (sockSndBuf > 0)
+ sock.setSendBufferSize(sockSndBuf);
+
+ sock.connect(addr, (int)connTimeout);
+
+ out = new UnsafeBufferedOutputStream(sock.getOutputStream(), bufSize);
+
+ success = true;
+ }
+ catch (IOException e) {
+ throw new IgniteCheckedException("Failed to connect to remote host " +
+ "[addr=" + addr + ", localHost=" + locHost + ']', e);
+ }
+ finally {
+ if (!success)
+ U.closeQuiet(sock);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void doHandshake(IgniteInClosure2X<InputStream, OutputStream> handshakeC) throws IgniteCheckedException {
+ try {
+ handshakeC.applyx(sock.getInputStream(), sock.getOutputStream());
+ }
+ catch (IOException e) {
+ throw new IgniteCheckedException("Failed to access IO streams when executing handshake with remote node: " +
+ sock.getRemoteSocketAddress(), e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean close() {
+ boolean res = super.close();
+
+ if (res) {
+ U.closeQuiet(out);
+ U.closeQuiet(sock);
+ }
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void forceClose() {
+ super.forceClose();
+
+ try {
+ out.flush();
+ }
+ catch (IOException ignored) {
+ // No-op.
+ }
+
+ // Do not call (directly or indirectly) out.close() here
+ // since it may cause a deadlock.
+ out.forceClose();
+
+ U.closeQuiet(sock);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void sendMessage(byte[] data, int len) throws IgniteCheckedException {
+ if (closed())
+ throw new IgniteCheckedException("Client was closed: " + this);
+
+ try {
+ out.write(data, 0, len);
+
+ metricsLsnr.onBytesSent(len);
+ }
+ catch (IOException e) {
+ throw new IgniteCheckedException("Failed to send message to remote node: " + sock.getRemoteSocketAddress(), e);
+ }
+
+ markUsed();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean sendMessage(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg)
+ throws IgniteCheckedException {
+ if (closed())
+ throw new IgniteCheckedException("Client was closed: " + this);
+
+ assert writeBuf.hasArray();
+
+ try {
- int cnt = msgWriter.writeFully(nodeId, msg, out, writeBuf);
++ int cnt = U.writeMessageFully(msg, out, writeBuf);
+
+ metricsLsnr.onBytesSent(cnt);
+ }
+ catch (IOException e) {
+ throw new IgniteCheckedException("Failed to send message to remote node: " + sock.getRemoteSocketAddress(), e);
+ }
+
+ markUsed();
+
+ return false;
+ }
+
+ /**
+ * @param timeout Timeout.
+ * @throws IOException If failed.
+ */
+ @Override public void flushIfNeeded(long timeout) throws IOException {
+ assert timeout > 0;
+
+ out.flushOnTimeout(timeout);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void sendMessage(ByteBuffer data) throws IgniteCheckedException {
+ throw new UnsupportedOperationException();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridTcpCommunicationClient.class, this, super.toString());
+ }
+
+ /**
+ *
+ */
+ private class UnsafeBufferedOutputStream extends FilterOutputStream {
+ /** The internal buffer where data is stored. */
+ private final byte buf[];
+
+ /** Current size. */
+ private int size;
+
+ /** Count. */
+ private int cnt;
+
+ /** Message count. */
+ private int msgCnt;
+
+ /** Total messages size. */
+ private int totalCnt;
+
+ /** Lock. */
+ private final ReentrantLock lock = new ReentrantLock();
+
+ /** Last flushed timestamp. */
+ private volatile long lastFlushed = U.currentTimeMillis();
+
+ /** Cached flush timeout. */
+ private volatile long flushTimeout;
+
+ /** Buffer adjusted timestamp. */
+ private long lastAdjusted = U.currentTimeMillis();
+
+ /**
+ * Creates a new buffered output stream to write data to the
+ * specified underlying output stream.
+ *
+ * @param out The underlying output stream.
+ */
+ UnsafeBufferedOutputStream(OutputStream out) {
+ this(out, 8192);
+ }
+
+ /**
+ * Creates a new buffered output stream to write data to the
+ * specified underlying output stream with the specified buffer
+ * size.
+ *
+ * @param out The underlying output stream.
+ * @param size The buffer size.
+ */
+ UnsafeBufferedOutputStream(OutputStream out, int size) {
+ super(out);
+
+ assert size >= 0;
+
+ this.size = size;
+ buf = size > 0 ? new byte[size] : null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void write(int b) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void write(byte[] b, int off, int len) throws IOException {
+ assert b != null;
+ assert off == 0;
+
+ // No buffering.
+ if (buf == null) {
+ lock.lock();
+
+ try {
+ out.write(b, 0, len);
+ }
+ finally {
+ lock.unlock();
+ }
+
+ return;
+ }
+
+ // Buffering is enabled.
+ lock.lock();
+
+ try {
+ msgCnt++;
+ totalCnt += len;
+
+ if (len >= size) {
+ flushLocked();
+
+ out.write(b, 0, len);
+
+ lastFlushed = U.currentTimeMillis();
+
+ adjustBufferIfNeeded();
+
+ return;
+ }
+
+ if (cnt + len > size) {
+ flushLocked();
+
+ messageToBuffer0(b, off, len, buf, 0);
+
+ cnt = len;
+
+ assert cnt < size;
+
+ adjustBufferIfNeeded();
+
+ return;
+ }
+
+ messageToBuffer0(b, 0, len, buf, cnt);
+
+ cnt += len;
+
+ if (cnt == size)
+ flushLocked();
+ else
+ flushIfNeeded();
+ }
+ finally {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * @throws IOException If failed.
+ */
+ private void flushIfNeeded() throws IOException {
+ assert lock.isHeldByCurrentThread();
+ assert buf != null;
+
+ long flushTimeout0 = flushTimeout;
+
+ if (flushTimeout0 > 0)
+ flushOnTimeoutLocked(flushTimeout0);
+ }
+
+ /**
+ *
+ */
+ private void adjustBufferIfNeeded() {
+ assert lock.isHeldByCurrentThread();
+ assert buf != null;
+
+ long flushTimeout0 = flushTimeout;
+
+ if (flushTimeout0 > 0)
+ adjustBufferLocked(flushTimeout0);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void flush() throws IOException {
+ lock.lock();
+
+ try {
+ flushLocked();
+ }
+ finally {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * @param timeout Timeout.
+ * @throws IOException If failed.
+ */
+ public void flushOnTimeout(long timeout) throws IOException {
+ assert buf != null;
+ assert timeout > 0;
+
+ // Overwrite cached value.
+ flushTimeout = timeout;
+
+ if (lastFlushed + timeout > U.currentTimeMillis() || !lock.tryLock())
+ return;
+
+ try {
+ flushOnTimeoutLocked(timeout);
+ }
+ finally {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * @param timeout Timeout.
+ * @throws IOException If failed.
+ */
+ private void flushOnTimeoutLocked(long timeout) throws IOException {
+ assert lock.isHeldByCurrentThread();
+ assert timeout > 0;
+
+ // Double check.
+ if (cnt == 0 || lastFlushed + timeout > U.currentTimeMillis())
+ return;
+
+ flushLocked();
+
+ adjustBufferLocked(timeout);
+ }
+
+ /**
+ * @param timeout Timeout.
+ */
+ private void adjustBufferLocked(long timeout) {
+ assert lock.isHeldByCurrentThread();
+ assert timeout > 0;
+
+ long time = U.currentTimeMillis();
+
+ if (lastAdjusted + timeout < time) {
+ if (msgCnt <= minBufferedMsgCnt)
+ size = 0;
+ else {
+ size = (int)(totalCnt * bufSizeRatio);
+
+ if (size > buf.length)
+ size = buf.length;
+ }
+
+ msgCnt = 0;
+ totalCnt = 0;
+
+ lastAdjusted = time;
+ }
+ }
+
+ /**
+ * @throws IOException If failed.
+ */
+ private void flushLocked() throws IOException {
+ assert lock.isHeldByCurrentThread();
+
+ if (buf != null && cnt > 0) {
+ out.write(buf, 0, cnt);
+
+ cnt = 0;
+ }
+
+ out.flush();
+
+ lastFlushed = U.currentTimeMillis();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void close() throws IOException {
+ lock.lock();
+
+ try {
+ flushLocked();
+ }
+ finally {
+ try {
+ out.close();
+ }
+ finally {
+ lock.unlock();
+ }
+ }
+ }
+
+ /**
+ * Forcibly closes underlying stream ignoring any possible exception.
+ */
+ public void forceClose() {
+ try {
+ out.close();
+ }
+ catch (IOException ignored) {
+ // No-op.
+ }
+ }
+
+ /**
+ * @param b Buffer to copy from.
+ * @param off Offset in source buffer.
+ * @param len Length.
+ * @param resBuf Result buffer.
+ * @param resOff Result offset.
+ */
+ private void messageToBuffer(byte[] b, int off, int len, byte[] resBuf, int resOff) {
+ assert b.length == len;
+ assert off == 0;
+ assert resBuf.length >= resOff + len + 4;
+
+ U.intToBytes(len, resBuf, resOff);
+
+ U.arrayCopy(b, off, resBuf, resOff + 4, len);
+ }
+
+ /**
+ * @param b Buffer to copy from (length included).
+ * @param off Offset in source buffer.
+ * @param len Length.
+ * @param resBuf Result buffer.
+ * @param resOff Result offset.
+ */
+ private void messageToBuffer0(byte[] b, int off, int len, byte[] resBuf, int resOff) {
+ assert off == 0;
+ assert resBuf.length >= resOff + len;
+
+ U.arrayCopy(b, off, resBuf, resOff, len);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ lock.lock();
+
+ try {
+ return S.toString(UnsafeBufferedOutputStream.class, this);
+ }
+ finally {
+ lock.unlock();
+ }
+ }
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/plugin/PluginProvider.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
index 8c9354f,aef2490..892c0de
--- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
@@@ -21,8 -28,9 +28,8 @@@ import org.apache.ignite.internal.manag
import org.apache.ignite.plugin.security.*;
import org.apache.ignite.spi.securesession.*;
import org.apache.ignite.spi.swapspace.*;
- import org.gridgain.grid.util.typedef.*;
- import org.gridgain.grid.util.typedef.internal.*;
-import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
import org.jetbrains.annotations.*;
import javax.management.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java
index e4c239a,da2152f..822dae7
--- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java
@@@ -12,11 -20,11 +20,11 @@@ package org.apache.ignite.spi
import org.apache.ignite.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.events.*;
+import org.apache.ignite.plugin.extensions.communication.*;
import org.apache.ignite.plugin.security.*;
import org.apache.ignite.spi.swapspace.*;
- import org.gridgain.grid.kernal.managers.communication.*;
- import org.gridgain.grid.kernal.managers.eventstorage.*;
+ import org.apache.ignite.internal.managers.communication.*;
+ import org.apache.ignite.internal.managers.eventstorage.*;
-import org.apache.ignite.internal.util.direct.*;
import org.jetbrains.annotations.*;
import java.io.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingRequest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 8b204a4,afaae4f..3b0c98c
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@@ -13,24 -21,22 +21,22 @@@ import org.apache.ignite.*
import org.apache.ignite.cluster.*;
import org.apache.ignite.configuration.*;
import org.apache.ignite.events.*;
+ import org.apache.ignite.internal.util.*;
import org.apache.ignite.lang.*;
- import org.apache.ignite.marshaller.*;
import org.apache.ignite.resources.*;
import org.apache.ignite.spi.*;
+import org.apache.ignite.spi.communication.*;
import org.apache.ignite.thread.*;
- import org.gridgain.grid.*;
- import org.gridgain.grid.kernal.managers.eventstorage.*;
- import org.gridgain.grid.util.*;
- import org.gridgain.grid.util.direct.*;
- import org.gridgain.grid.util.future.*;
- import org.gridgain.grid.util.ipc.*;
- import org.gridgain.grid.util.ipc.shmem.*;
- import org.gridgain.grid.util.lang.*;
- import org.gridgain.grid.util.nio.*;
- import org.gridgain.grid.util.typedef.*;
- import org.gridgain.grid.util.typedef.internal.*;
- import org.gridgain.grid.util.worker.*;
+ import org.apache.ignite.internal.managers.eventstorage.*;
-import org.apache.ignite.spi.communication.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.future.*;
+ import org.apache.ignite.internal.util.ipc.*;
+ import org.apache.ignite.internal.util.ipc.shmem.*;
+ import org.apache.ignite.internal.util.lang.*;
+ import org.apache.ignite.internal.util.nio.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.apache.ignite.internal.util.worker.*;
import org.jdk8.backport.*;
import org.jetbrains.annotations.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java
index 0000000,46a380f..217b6fb
mode 000000,100644..100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridCommunicationSendMessageSelfTest.java
@@@ -1,0 -1,173 +1,173 @@@
+ /*
+ * 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.managers.communication;
+
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.spi.communication.tcp.*;
+ import org.apache.ignite.spi.discovery.tcp.*;
+ import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.testframework.junits.common.*;
+
+ import java.nio.*;
+ import java.util.*;
+ import java.util.concurrent.*;
+
+ import static java.util.concurrent.TimeUnit.*;
+
+ /**
+ * Send message test.
+ */
+ public class GridCommunicationSendMessageSelfTest extends GridCommonAbstractTest {
+ /** IP finder. */
+ private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** Sample count. */
+ private static final int SAMPLE_CNT = 1;
+
+ /** */
+ private static final byte DIRECT_TYPE = (byte)202;
+
+ /** */
+ private int bufSize;
+
+ static {
+ GridTcpCommunicationMessageFactory.registerCustom(new GridTcpCommunicationMessageProducer() {
+ @Override public GridTcpCommunicationMessageAdapter create(byte type) {
+ return new TestMessage();
+ }
+ }, DIRECT_TYPE);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration c = super.getConfiguration(gridName);
+
+ TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+ discoSpi.setIpFinder(ipFinder);
+
+ c.setDiscoverySpi(discoSpi);
+
+ TcpCommunicationSpi commSpi = new TcpCommunicationSpi();
+
+ commSpi.setConnectionBufferSize(bufSize);
+
+ c.setCommunicationSpi(commSpi);
+
+ return c;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSendMessage() throws Exception {
+ try {
+ startGridsMultiThreaded(2);
+
+ doSend();
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSendMessageWithBuffer() throws Exception {
+ bufSize = 8192;
+
+ try {
+ startGridsMultiThreaded(2);
+
+ doSend();
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ private void doSend() throws Exception {
+ GridIoManager mgr0 = ((IgniteKernal)grid(0)).context().io();
+ GridIoManager mgr1 = ((IgniteKernal)grid(1)).context().io();
+
+ String topic = "test-topic";
+
+ final CountDownLatch latch = new CountDownLatch(SAMPLE_CNT);
+
+ mgr1.addMessageListener(topic, new GridMessageListener() {
+ @Override public void onMessage(UUID nodeId, Object msg) {
+ latch.countDown();
+ }
+ });
+
+ long time = System.nanoTime();
+
+ for (int i = 1; i <= SAMPLE_CNT; i++) {
+ mgr0.send(grid(1).localNode(), topic, new TestMessage(), GridIoPolicy.PUBLIC_POOL);
+
+ if (i % 500 == 0)
+ info("Sent messages count: " + i);
+ }
+
+ assert latch.await(3, SECONDS);
+
+ time = System.nanoTime() - time;
+
+ info(">>>");
+ info(">>> send() time (ms): " + MILLISECONDS.convert(time, NANOSECONDS));
+ info(">>>");
+ }
+
+ /** */
+ private static class TestMessage extends GridTcpCommunicationMessageAdapter {
+ /** {@inheritDoc} */
+ @SuppressWarnings("CloneDoesntCallSuperClone")
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ throw new UnsupportedOperationException();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
- return commState.putByte(directType());
++ return commState.putByte(null, directType());
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf) {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return DIRECT_TYPE;
+ }
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
index 0000000,d70e4b0..6b5003f
mode 000000,100644..100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
@@@ -1,0 -1,563 +1,564 @@@
+ /*
+ * 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.testframework;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.cluster.*;
+ import org.apache.ignite.events.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.lang.*;
++import org.apache.ignite.plugin.extensions.communication.*;
+ import org.apache.ignite.plugin.security.*;
+ import org.apache.ignite.spi.*;
+ import org.apache.ignite.spi.swapspace.*;
+ import org.apache.ignite.internal.managers.communication.*;
+ import org.apache.ignite.internal.managers.eventstorage.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+ import java.util.concurrent.*;
+
+ import static org.apache.ignite.events.IgniteEventType.*;
+
+ /**
+ * Test SPI context.
+ */
+ public class GridSpiTestContext implements IgniteSpiContext {
+ /** */
+ private final Collection<ClusterNode> rmtNodes = new ConcurrentLinkedQueue<>();
+
+ /** */
+ private ClusterNode locNode;
+
+ /** */
+ private final Map<GridLocalEventListener, Set<Integer>> evtLsnrs = new HashMap<>();
+
+ /** */
+ @SuppressWarnings("deprecation")
+ private final Collection<GridMessageListener> msgLsnrs = new ArrayList<>();
+
+ /** */
+ private final Map<ClusterNode, Serializable> sentMsgs = new HashMap<>();
+
+ /** */
+ private final ConcurrentMap<String, Map> cache = new ConcurrentHashMap<>();
+
+ /** {@inheritDoc} */
+ @Override public Collection<ClusterNode> remoteNodes() {
+ return rmtNodes;
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterNode localNode() {
+ return locNode;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<ClusterNode> remoteDaemonNodes() {
+ Collection<ClusterNode> daemons = new ArrayList<>();
+
+ for (ClusterNode node : rmtNodes) {
+ if (node.isDaemon())
+ daemons.add(node);
+ }
+
+ return daemons;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<ClusterNode> nodes() {
+ Collection<ClusterNode> all = new ArrayList<>(rmtNodes);
+
+ if (locNode != null)
+ all.add(locNode);
+
+ return all;
+ }
+
+ /**
+ * @param locNode Local node.
+ */
+ public void setLocalNode(@Nullable ClusterNode locNode) {
+ this.locNode = locNode;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override
+ public ClusterNode node(UUID nodeId) {
+ if (locNode != null && locNode.id().equals(nodeId))
+ return locNode;
+
+ for (ClusterNode node : rmtNodes) {
+ if (node.id().equals(nodeId))
+ return node;
+ }
+
+ return null;
+ }
+
+ /** */
+ public void createLocalNode() {
+ setLocalNode(new GridTestNode(UUID.randomUUID(), createMetrics(1, 1)));
+ }
+
+ /**
+ * @param cnt Number of nodes.
+ */
+ public void createRemoteNodes(int cnt) {
+ for (int i = 0; i < cnt; i++)
+ addNode(new GridTestNode(UUID.randomUUID(), createMetrics(1, 1)));
+ }
+
+ /** */
+ public void reset() {
+ setLocalNode(null);
+
+ rmtNodes.clear();
+ }
+
+ /**
+ * @param waitingJobs Waiting jobs count.
+ * @param activeJobs Active jobs count.
+ * @return Metrics adapter.
+ */
+ private ClusterMetricsSnapshot createMetrics(int waitingJobs, int activeJobs) {
+ ClusterMetricsSnapshot metrics = new ClusterMetricsSnapshot();
+
+ metrics.setCurrentWaitingJobs(waitingJobs);
+ metrics.setCurrentActiveJobs(activeJobs);
+
+ return metrics;
+ }
+
+ /**
+ * @param nodes Nodes to reset.
+ * @param rmv Whether nodes that were not passed in should be removed or not.
+ */
+ public void resetNodes(Collection<ClusterNode> nodes, boolean rmv) {
+ for (ClusterNode node : nodes) {
+ assert !node.equals(locNode);
+
+ if (!rmtNodes.contains(node))
+ addNode(node);
+ }
+
+ if (rmv) {
+ for (Iterator<ClusterNode> iter = rmtNodes.iterator(); iter.hasNext();) {
+ ClusterNode node = iter.next();
+
+ if (!nodes.contains(node)) {
+ iter.remove();
+
+ notifyListener(new IgniteDiscoveryEvent(locNode, "Node left", EVT_NODE_LEFT, node));
+ }
+ }
+ }
+ }
+
+ /**
+ * @param node Node to check.
+ * @return {@code True} if the node is local.
+ */
+ public boolean isLocalNode(ClusterNode node) {
+ return locNode.equals(node);
+ }
+
+ /**
+ * @param node Node to add.
+ */
+ public void addNode(ClusterNode node) {
+ rmtNodes.add(node);
+
+ notifyListener(new IgniteDiscoveryEvent(locNode, "Node joined", EVT_NODE_JOINED, node));
+ }
+
+ /**
+ * @param node Node to remove.
+ */
+ public void removeNode(ClusterNode node) {
+ if (rmtNodes.remove(node))
+ notifyListener(new IgniteDiscoveryEvent(locNode, "Node left", EVT_NODE_LEFT, node));
+ }
+
+ /**
+ * @param nodeId Node ID.
+ */
+ public void removeNode(UUID nodeId) {
+ for (Iterator<ClusterNode> iter = rmtNodes.iterator(); iter.hasNext();) {
+ ClusterNode node = iter.next();
+
+ if (node.id().equals(nodeId)) {
+ iter.remove();
+
+ notifyListener(new IgniteDiscoveryEvent(locNode, "Node left", EVT_NODE_LEFT, node));
+ }
+ }
+ }
+
+ /**
+ * @param node Node to fail.
+ */
+ public void failNode(ClusterNode node) {
+ if (rmtNodes.remove(node))
+ notifyListener(new IgniteDiscoveryEvent(locNode, "Node failed", EVT_NODE_FAILED, node));
+ }
+
+ /**
+ * @param node Node for metrics update.
+ */
+ public void updateMetrics(ClusterNode node) {
+ if (locNode.equals(node) || rmtNodes.contains(node))
+ notifyListener(new IgniteDiscoveryEvent(locNode, "Metrics updated.", EVT_NODE_METRICS_UPDATED, node));
+ }
+
+ /** */
+ public void updateAllMetrics() {
+ notifyListener(new IgniteDiscoveryEvent(locNode, "Metrics updated", EVT_NODE_METRICS_UPDATED, locNode));
+
+ for (ClusterNode node : rmtNodes) {
+ notifyListener(new IgniteDiscoveryEvent(locNode, "Metrics updated", EVT_NODE_METRICS_UPDATED, node));
+ }
+ }
+
+ /**
+ * @param evt Event node.
+ */
+ private void notifyListener(IgniteEvent evt) {
+ assert evt.type() > 0;
+
+ for (Map.Entry<GridLocalEventListener, Set<Integer>> entry : evtLsnrs.entrySet()) {
+ if (F.isEmpty(entry.getValue()) || entry.getValue().contains(evt.type()))
+ entry.getKey().onEvent(evt);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean pingNode(UUID nodeId) {
+ return node(nodeId) != null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void send(ClusterNode node, Serializable msg, String topic)
+ throws IgniteSpiException {
+ sentMsgs.put(node, msg);
+ }
+
+ /**
+ * @param node Node message was sent to.
+ * @return Sent message.
+ */
+ public Serializable getSentMessage(ClusterNode node) {
+ return sentMsgs.get(node);
+ }
+
+ /**
+ * @param node Node message was sent to.
+ * @return Sent message.
+ */
+ public Serializable removeSentMessage(ClusterNode node) {
+ return sentMsgs.remove(node);
+ }
+
+ /**
+ * @param node Destination node.
+ * @param msg Message.
+ */
+ @SuppressWarnings("deprecation")
+ public void triggerMessage(ClusterNode node, Object msg) {
+ for (GridMessageListener lsnr : msgLsnrs) {
+ lsnr.onMessage(node.id(), msg);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("deprecation")
+ @Override public void addMessageListener(GridMessageListener lsnr, String topic) {
+ msgLsnrs.add(lsnr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("deprecation")
+ @Override public boolean removeMessageListener(GridMessageListener lsnr, String topic) {
+ return msgLsnrs.remove(lsnr);
+ }
+
+ /**
+ * @param type Event type.
+ * @param taskName Task name.
+ * @param taskSesId Session ID.
+ * @param msg Event message.
+ */
+ public void triggerTaskEvent(int type, String taskName, IgniteUuid taskSesId, String msg) {
+ assert type > 0;
+
+ triggerEvent(new IgniteTaskEvent(locNode, msg, type, taskSesId, taskName, null, false, null));
+ }
+
+ /**
+ * @param evt Event to trigger.
+ */
+ public void triggerEvent(IgniteEvent evt) {
+ notifyListener(evt);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void addLocalEventListener(GridLocalEventListener lsnr, int... types) {
+ Set<Integer> typeSet = F.addIfAbsent(evtLsnrs, lsnr, F.<Integer>newSet());
+
+ assert typeSet != null;
+
+ if (types != null) {
+ for (int type : types) {
+ typeSet.add(type);
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean removeLocalEventListener(GridLocalEventListener lsnr) {
+ boolean res = evtLsnrs.containsKey(lsnr);
+
+ evtLsnrs.remove(lsnr);
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isEventRecordable(int... types) {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void recordEvent(IgniteEvent evt) {
+ notifyListener(evt);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void registerPort(int port, IgnitePortProtocol proto) {
+ /* No-op. */
+ }
+
+ /** {@inheritDoc} */
+ @Override public void deregisterPort(int port, IgnitePortProtocol proto) {
+ /* No-op. */
+ }
+
+ /** {@inheritDoc} */
+ @Override public void deregisterPorts() {
+ /* No-op. */
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K, V> V get(String cacheName, K key) throws IgniteCheckedException {
+ assert cacheName != null;
+ assert key != null;
+
+ V res = null;
+
+ Map<K, CachedObject<V>> cache = getOrCreateCache(cacheName);
+
+ CachedObject<V> obj = cache.get(key);
+
+ if (obj != null) {
+ if (obj.expire == 0 || obj.expire > System.currentTimeMillis())
+ res = obj.obj;
+ else
+ cache.remove(key);
+ }
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K, V> V put(String cacheName, K key, V val, long ttl) throws IgniteCheckedException {
+ assert cacheName != null;
+ assert key != null;
+ assert ttl >= 0;
+
+ long expire = ttl > 0 ? System.currentTimeMillis() + ttl : 0;
+
+ CachedObject<V> obj = new CachedObject<>(expire, val);
+
+ Map<K, CachedObject<V>> cache = getOrCreateCache(cacheName);
+
+ CachedObject<V> prev = cache.put(key, obj);
+
+ return prev != null ? prev.obj : null;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"unchecked"})
+ @Override public <K, V> V putIfAbsent(String cacheName, K key, V val, long ttl) throws IgniteCheckedException {
+ V v = get(cacheName, key);
+
+ if (v != null)
+ return put(cacheName, key, val, ttl);
+
+ return v;
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K, V> V remove(String cacheName, K key) throws IgniteCheckedException {
+ assert cacheName != null;
+ assert key != null;
+
+ Map<K, CachedObject<V>> cache = getOrCreateCache(cacheName);
+
+ CachedObject<V> prev = cache.remove(key);
+
+ return prev != null ? prev.obj : null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K> boolean containsKey(String cacheName, K key) {
+ assert cacheName != null;
+ assert key != null;
+
+ boolean res = false;
+
+ try {
+ res = get(cacheName, key) != null;
+ }
+ catch (IgniteCheckedException ignored) {
+
+ }
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeToSwap(String spaceName, Object key, @Nullable Object val,
+ @Nullable ClassLoader ldr) throws IgniteCheckedException {
+ /* No-op. */
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> T readFromSwap(String spaceName, SwapKey key, @Nullable ClassLoader ldr)
+ throws IgniteCheckedException {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> T readFromOffheap(String spaceName, int part, Object key, byte[] keyBytes,
+ @Nullable ClassLoader ldr) throws IgniteCheckedException {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean removeFromOffheap(@Nullable String spaceName, int part, Object key,
+ @Nullable byte[] keyBytes) throws IgniteCheckedException {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeToOffheap(@Nullable String spaceName, int part, Object key, @Nullable byte[] keyBytes,
+ Object val, @Nullable byte[] valBytes, @Nullable ClassLoader ldr) throws IgniteCheckedException {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public int partition(String cacheName, Object key) {
+ return -1;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void removeFromSwap(String spaceName, Object key,
+ @Nullable ClassLoader ldr) throws IgniteCheckedException {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public IgniteSpiNodeValidationResult validateNode(ClusterNode node) {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeDelta(UUID nodeId, Object msg, ByteBuffer buf) {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readDelta(UUID nodeId, Class<?> msgCls, ByteBuffer buf) {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<GridSecuritySubject> authenticatedSubjects() throws IgniteCheckedException {
+ return Collections.emptyList();
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridSecuritySubject authenticatedSubject(UUID subjId) throws IgniteCheckedException {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public <T> T readValueFromOffheapAndSwap(@Nullable String spaceName, Object key,
+ @Nullable ClassLoader ldr) throws IgniteCheckedException {
+ return null;
+ }
+
+ /** {@inheritDoc} */
- @Override public GridTcpMessageFactory messageFactory() {
- return new GridTcpMessageFactory() {
++ @Override public MessageFactory messageFactory() {
++ return new MessageFactory() {
+ @Override public GridTcpCommunicationMessageAdapter create(byte type) {
+ return GridTcpCommunicationMessageFactory.create(type);
+ }
+ };
+ }
+
+ /**
+ * @param cacheName Cache name.
+ * @return Map representing cache.
+ */
+ @SuppressWarnings("unchecked")
+ private <K, V> Map<K, V> getOrCreateCache(String cacheName) {
+ synchronized (cache) {
+ Map<K, V> map = cache.get(cacheName);
+
+ if (map == null)
+ cache.put(cacheName, map = new ConcurrentHashMap<>());
+
+ return map;
+ }
+ }
+
+ /**
+ * Cached object.
+ */
+ private static class CachedObject<V> {
+ /** */
+ private long expire;
+
+ /** */
+ private V obj;
+
+ /**
+ * @param expire Expire time.
+ * @param obj Object.
+ */
+ private CachedObject(long expire, V obj) {
+ this.expire = expire;
+ this.obj = obj;
+ }
+ }
+ }
[34/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsSyncMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsSyncMessage.java
index 0000000,1f17b7e..fa917a0
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsSyncMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsSyncMessage.java
@@@ -1,0 -1,161 +1,161 @@@
+ /*
+ * 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.fs;
+
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Basic sync message.
+ */
+ public class GridGgfsSyncMessage extends GridGgfsCommunicationMessage {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Coordinator node order. */
+ private long order;
+
+ /** Response flag. */
+ private boolean res;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridGgfsSyncMessage() {
+ // No-op.
+ }
+
+ /**
+ * @param order Node order.
+ * @param res Response flag.
+ */
+ public GridGgfsSyncMessage(long order, boolean res) {
+ this.order = order;
+ this.res = res;
+ }
+
+ /**
+ * @return Coordinator node order.
+ */
+ public long order() {
+ return order;
+ }
+
+ /**
+ * @return {@code True} if response message.
+ */
+ public boolean response() {
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridGgfsSyncMessage.class, this);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridGgfsSyncMessage _clone = new GridGgfsSyncMessage();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridGgfsSyncMessage _clone = (GridGgfsSyncMessage)_msg;
+
+ _clone.order = order;
+ _clone.res = res;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putLong(order))
++ if (!commState.putLong("order", order))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putBoolean(res))
++ if (!commState.putBoolean("res", res))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 0:
- if (buf.remaining() < 8)
- return false;
++ order = commState.getLong("order");
+
- order = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 1:
- if (buf.remaining() < 1)
- return false;
++ res = commState.getBoolean("res");
+
- res = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 72;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java
index 0000000,5d3ad42..d9631bb
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java
@@@ -1,0 -1,211 +1,211 @@@
+ /*
+ * 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.plugin;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.*;
+ import org.apache.ignite.plugin.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.jetbrains.annotations.*;
+
+ import java.lang.reflect.*;
+ import java.util.*;
+
+ /**
+ * TODO 9447: move to internal package.
+ */
+ public class IgnitePluginProcessor extends GridProcessorAdapter {
+ /** */
+ private final Map<String, PluginProvider> plugins = new LinkedHashMap<>();
+
+ /** */
+ private final Map<PluginProvider, GridPluginContext> pluginCtxMap = new IdentityHashMap<>();
+
+ /** */
+ private volatile Map<Class<?>, Object[]> extensions;
+
+ /**
+ *
+ * @param ctx Kernal context.
+ * @param cfg Ignite configuration.
+ */
+ @SuppressWarnings("TypeMayBeWeakened")
+ public IgnitePluginProcessor(GridKernalContext ctx, IgniteConfiguration cfg) {
+ super(ctx);
+
+ ExtensionRegistry registry = new ExtensionRegistry();
+
+ if (cfg.getPluginConfigurations() != null) {
+ for (PluginConfiguration pluginCfg : cfg.getPluginConfigurations()) {
+ GridPluginContext pluginCtx = new GridPluginContext(ctx, pluginCfg, cfg);
+
+ PluginProvider provider;
+
+ try {
+ if (pluginCfg.providerClass() == null)
+ throw new IgniteException("Provider class is null.");
+
+ try {
- Constructor<? extends PluginProvider> ctr =
++ Constructor<? extends PluginProvider> ctr =
+ pluginCfg.providerClass().getConstructor(PluginContext.class);
+
+ provider = ctr.newInstance(pluginCtx);
+ }
+ catch (NoSuchMethodException ignore) {
+ try {
- Constructor<? extends PluginProvider> ctr =
++ Constructor<? extends PluginProvider> ctr =
+ pluginCfg.providerClass().getConstructor(pluginCfg.getClass());
+
+ provider = ctr.newInstance(pluginCfg);
+ }
+ catch (NoSuchMethodException ignored) {
+ provider = pluginCfg.providerClass().newInstance();
+ }
+ }
+ }
+ catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
+ throw new IgniteException("Failed to create plugin provider instance.", e);
+ }
+
+ if (F.isEmpty(provider.name()))
+ throw new IgniteException("Plugin name can not be empty.");
+
+ if (provider.plugin() == null)
+ throw new IgniteException("Plugin is null.");
+
+ if (plugins.containsKey(provider.name()))
+ throw new IgniteException("Duplicated plugin name: " + provider.name());
+
+ plugins.put(provider.name(), provider);
+
+ pluginCtxMap.put(provider, pluginCtx);
+
+ provider.initExtensions(pluginCtx, registry);
+ }
+ }
+
+ extensions = registry.createExtensionMap();
+ }
+
+ /**
+ * @param extensionItf Extension interface class.
+ * @return Returns implementation for provided extension from all plugins.
+ */
+ public <T> T[] extensions(Class<T> extensionItf) {
+ Map<Class<?>, Object[]> extensions = this.extensions;
+
+ T[] res = (T[])extensions.get(extensionItf);
+
+ if (res != null)
+ return res;
+
+ res = (T[])Array.newInstance(extensionItf, 0);
+
+ // Store empty array to map to avoid array creation on the next access.
+ Map<Class<?>, Object[]> extensionsCp = new HashMap<>((extensions.size() + 1) * 2, 2.0f);
+
+ extensionsCp.put(extensionItf, res);
+
+ this.extensions = extensionsCp;
+
+ return res;
+ }
+
+ /**
+ * @param name Plugin name.
+ * @return Plugin provider.
+ */
+ @Nullable public PluginProvider pluginProvider(String name) {
+ return plugins.get(name);
+ }
+
+ /**
+ * @return All plugin providers.
+ */
+ public Collection<PluginProvider> allProviders() {
+ return plugins.values();
+ }
+
+ /**
+ * @param provider Plugin context.
+ * @return Plugin context.
+ */
+ public PluginContext pluginContextForProvider(PluginProvider provider) {
+ return pluginCtxMap.get(provider);
+ }
+
+ /**
+ * @param cls Component class.
+ * @param <T> Component type.
+ * @return Component class instance or {@code null} if no one plugin override this component.
+ */
+ public <T> T createComponent(Class<T> cls) {
+ for (PluginProvider plugin : plugins.values()) {
+ T comp = (T)plugin.createComponent(cls);
+
+ if (comp != null)
+ return comp;
+ }
+
+ return null;
+ }
+
+ /**
+ *
+ */
+ private static class ExtensionRegistry implements IgniteExtensionRegistry {
+ /** */
+ private final Map<Class<?>, List<Object>> extensionsCollector = new HashMap<>();
+
+ /** {@inheritDoc} */
+ @Override public <T> void registerExtension(Class<T> extensionItf, T extensionImpl) {
+ List<Object> list = extensionsCollector.get(extensionItf);
+
+ if (list == null) {
+ list = new ArrayList<>();
+
+ extensionsCollector.put(extensionItf, list);
+ }
+
+ list.add(extensionImpl);
+ }
+
+ /**
+ * @return Map extension interface to array of implementation.
+ */
+ public Map<Class<?>, Object[]> createExtensionMap() {
+ Map<Class<?>, Object[]> extensions = new HashMap<>(extensionsCollector.size() * 2, 0.5f);
+
+ for (Map.Entry<Class<?>, List<Object>> entry : extensionsCollector.entrySet()) {
+ Class<?> extensionItf = entry.getKey();
+
+ List<Object> implementations = entry.getValue();
+
+ Object[] implArr = (Object[])Array.newInstance(extensionItf, implementations.size());
+
+ implArr = implementations.toArray(implArr);
+
+ extensions.put(extensionItf, implArr);
+ }
+
+ return extensions;
+ }
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableOutputStream.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableOutputStream.java
index 0000000,cfbf8d4..4f23fd1
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableOutputStream.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/portable/GridPortableOutputStream.java
@@@ -1,0 -1,172 +1,165 @@@
+ /*
+ * 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.portable;
+
+ /**
+ * Portable output stream.
+ */
+ public interface GridPortableOutputStream extends GridPortableStream, AutoCloseable {
+ /**
+ * Write byte value.
+ *
+ * @param val Byte value.
+ */
+ public void writeByte(byte val);
+
+ /**
+ * Write byte array.
+ *
+ * @param val Byte array.
+ */
+ public void writeByteArray(byte[] val);
+
+ /**
+ * Write boolean value.
+ *
+ * @param val Boolean value.
+ */
+ public void writeBoolean(boolean val);
+
+ /**
+ * Write boolean array.
+ *
+ * @param val Boolean array.
+ */
+ public void writeBooleanArray(boolean[] val);
+
+ /**
+ * Write short value.
+ *
+ * @param val Short value.
+ */
+ public void writeShort(short val);
+
+ /**
+ * Write short array.
+ *
+ * @param val Short array.
+ */
+ public void writeShortArray(short[] val);
+
+ /**
+ * Write char value.
+ *
+ * @param val Char value.
+ */
+ public void writeChar(char val);
+
+ /**
+ * Write char array.
+ *
+ * @param val Char array.
+ */
+ public void writeCharArray(char[] val);
+
+ /**
+ * Write int value.
+ *
+ * @param val Int value.
+ */
+ public void writeInt(int val);
+
+ /**
+ * Write int value to the given position.
+ *
+ * @param pos Position.
+ * @param val Value.
+ */
+ public void writeInt(int pos, int val);
+
+ /**
+ * Write int array.
+ *
+ * @param val Int array.
+ */
+ public void writeIntArray(int[] val);
+
+ /**
+ * Write float value.
+ *
+ * @param val Float value.
+ */
+ public void writeFloat(float val);
+
+ /**
+ * Write float array.
+ *
+ * @param val Float array.
+ */
+ public void writeFloatArray(float[] val);
+
+ /**
+ * Write long value.
+ *
+ * @param val Long value.
+ */
+ public void writeLong(long val);
+
+ /**
+ * Write long array.
+ *
+ * @param val Long array.
+ */
+ public void writeLongArray(long[] val);
+
+ /**
+ * Write double value.
+ *
+ * @param val Double value.
+ */
+ public void writeDouble(double val);
+
+ /**
+ * Write double array.
+ *
+ * @param val Double array.
+ */
+ public void writeDoubleArray(double[] val);
+
+ /**
+ * Write byte array.
+ *
+ * @param arr Array.
+ * @param off Offset.
+ * @param len Length.
+ */
+ public void write(byte[] arr, int off, int len);
+
+ /**
+ * Write data from unmanaged memory.
+ *
+ * @param addr Address.
+ * @param cnt Count.
+ */
+ public void write(long addr, int cnt);
+
+ /**
- * Ensure capacity.
- *
- * @param cnt Required byte count.
- */
- public void ensureCapacity(int cnt);
-
- /**
+ * Close the stream releasing resources.
+ */
+ @Override public void close();
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java
index 0000000,386b6eb..1c0366a
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeRequestWrapper.java
@@@ -1,0 -1,129 +1,127 @@@
+ /*
+ * 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.rest.client.message;
+
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.nio.*;
+
+ /**
+ * Client handshake wrapper for direct marshalling.
+ */
+ public class GridClientHandshakeRequestWrapper extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = -5705048094821942662L;
+
+ /** Signal char. */
+ public static final byte HANDSHAKE_HEADER = (byte)0x91;
+
+ /** Handshake bytes. */
+ private byte[] bytes;
+
+ /**
+ *
+ */
+ public GridClientHandshakeRequestWrapper() {
+ // No-op.
+ }
+
+ /**
+ *
+ * @param req Handshake request.
+ */
+ public GridClientHandshakeRequestWrapper(GridClientHandshakeRequest req) {
+ bytes = req.rawBytes();
+ }
+
+ /**
+ * @return Handshake bytes.
+ */
+ public byte[] bytes() {
+ return bytes;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putByteArrayClient(bytes))
++ if (!commState.putByteArray("bytes", bytes))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- byte[] bytes0 = commState.getByteArrayClient(GridClientHandshakeRequest.PACKET_SIZE);
++ bytes = commState.getByteArray("bytes");
+
- if (bytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- bytes = bytes0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return HANDSHAKE_HEADER;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridClientHandshakeRequestWrapper _clone = new GridClientHandshakeRequestWrapper();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridClientHandshakeRequestWrapper _clone = (GridClientHandshakeRequestWrapper)_msg;
+
+ _clone.bytes = bytes;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridClientHandshakeRequestWrapper.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java
index 0000000,1e20a9c..dff1f45
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientHandshakeResponseWrapper.java
@@@ -1,0 -1,96 +1,116 @@@
+ /*
+ * 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.rest.client.message;
+
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.nio.*;
+
+ /**
+ * Client handshake wrapper for direct marshalling.
+ */
+ public class GridClientHandshakeResponseWrapper extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = -1529807975073967381L;
+
+ /** */
+ private byte code;
+
+ /**
+ *
+ */
+ public GridClientHandshakeResponseWrapper() {
+ // No-op.
+ }
+
+ /**
+ * @param code Response code.
+ */
+ public GridClientHandshakeResponseWrapper(byte code) {
+ this.code = code;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
++ switch (commState.idx) {
++ case 0:
++ if (!commState.putByte("code", code))
++ return false;
++
++ commState.idx++;
++
++ }
++
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
++ switch (commState.idx) {
++ case 0:
++ code = commState.getByte("code");
++
++ if (!commState.lastRead())
++ return false;
++
++ commState.idx++;
++
++ }
++
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return code;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridClientHandshakeResponseWrapper _clone = new GridClientHandshakeResponseWrapper();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridClientHandshakeResponseWrapper _clone = (GridClientHandshakeResponseWrapper)_msg;
+
+ _clone.code = code;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridClientHandshakeResponseWrapper.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java
index 0000000,6ff66ce..6e6f485
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientMessageWrapper.java
@@@ -1,0 -1,266 +1,258 @@@
+ /*
+ * 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.rest.client.message;
+
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Client message wrapper for direct marshalling.
+ */
+ public class GridClientMessageWrapper extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 5284375300887454697L;
+
+ /** Client request header. */
+ public static final byte REQ_HEADER = (byte)0x90;
+
+ /** */
+ private int msgSize;
+
+ /** */
+ private long reqId;
+
+ /** */
+ private UUID clientId;
+
+ /** */
+ private UUID destId;
+
+ /** */
+ private ByteBuffer msg;
+
+ /**
+ * @return Request ID.
+ */
+ public long requestId() {
+ return reqId;
+ }
+
+ /**
+ * @param reqId Request ID.
+ */
+ public void requestId(long reqId) {
+ this.reqId = reqId;
+ }
+
+ /**
+ * @return Message size.
+ */
+ public int messageSize() {
+ return msgSize;
+ }
+
+ /**
+ * @param msgSize Message size.
+ */
+ public void messageSize(int msgSize) {
+ this.msgSize = msgSize;
+ }
+
+ /**
+ * @return Client ID.
+ */
+ public UUID clientId() {
+ return clientId;
+ }
+
+ /**
+ * @param clientId Client ID.
+ */
+ public void clientId(UUID clientId) {
+ this.clientId = clientId;
+ }
+
+ /**
+ * @return Destination ID.
+ */
+ public UUID destinationId() {
+ return destId;
+ }
+
+ /**
+ * @param destId Destination ID.
+ */
+ public void destinationId(UUID destId) {
+ this.destId = destId;
+ }
+
+ /**
+ * @return Message buffer.
+ */
+ public ByteBuffer message() {
+ return msg;
+ }
+
+ /**
+ * @return Message bytes.
+ */
+ public byte[] messageArray() {
+ assert msg.hasArray();
+ assert msg.position() == 0 && msg.remaining() == msg.capacity();
+
+ return msg.array();
+ }
+
+ /**
+ * @param msg Message bytes.
+ */
+ public void message(ByteBuffer msg) {
+ this.msg = msg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putIntClient(msgSize))
++ if (!commState.putUuid("clientId", clientId))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putLongClient(reqId))
++ if (!commState.putUuid("destId", destId))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putUuidClient(clientId))
++ if (!commState.putByteBuffer("msg", msg))
+ return false;
+
+ commState.idx++;
+
+ case 3:
- if (!commState.putUuidClient(destId))
++ if (!commState.putInt("msgSize", msgSize))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putByteBufferClient(msg))
++ if (!commState.putLong("reqId", reqId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- if (buf.remaining() < 4)
- return false;
-
- msgSize = commState.getIntClient();
++ clientId = commState.getUuid("clientId");
+
- if (msgSize == 0) // Ping message.
- return true;
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 1:
- if (buf.remaining() < 8)
- return false;
++ destId = commState.getUuid("destId");
+
- reqId = commState.getLongClient();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 2:
- UUID clientId0 = commState.getUuidClient();
++ msg = commState.getByteBuffer("msg");
+
- if (clientId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- clientId = clientId0;
-
+ commState.idx++;
+
+ case 3:
- UUID destId0 = commState.getUuidClient();
++ msgSize = commState.getInt("msgSize");
+
- if (destId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- destId = destId0;
-
+ commState.idx++;
+
+ case 4:
- byte[] msg0 = commState.getByteArrayClient(msgSize - 40);
++ reqId = commState.getLong("reqId");
+
- if (msg0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- msg = ByteBuffer.wrap(msg0);
-
+ commState.idx++;
++
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return REQ_HEADER;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridClientMessageWrapper _clone = new GridClientMessageWrapper();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridClientMessageWrapper _clone = (GridClientMessageWrapper)_msg;
+
- _clone.reqId = reqId;
+ _clone.msgSize = msgSize;
++ _clone.reqId = reqId;
+ _clone.clientId = clientId;
+ _clone.destId = destId;
+ _clone.msg = msg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridClientMessageWrapper.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java
index 0000000,6fd95b5..64e61c9
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientPingPacketWrapper.java
@@@ -1,0 -1,89 +1,102 @@@
+ /*
+ * 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.rest.client.message;
+
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.nio.*;
+
+ /**
+ * Ping packet wrapper for direct marshalling.
+ */
+ public class GridClientPingPacketWrapper extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = -3956036611004055629L;
+
+ /** Ping message size (always zero). */
+ private int size;
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putIntClient(size))
++ if (!commState.putInt("size", size))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf) {
- throw new UnsupportedOperationException();
++ commState.setBuffer(buf);
++
++ switch (commState.idx) {
++ case 0:
++ size = commState.getInt("size");
++
++ if (!commState.lastRead())
++ return false;
++
++ commState.idx++;
++
++ }
++
++ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return GridClientMessageWrapper.REQ_HEADER;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridClientPingPacketWrapper _clone = new GridClientPingPacketWrapper();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridClientPingPacketWrapper _clone = (GridClientPingPacketWrapper)_msg;
+
+ _clone.size = size;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridClientPingPacketWrapper.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java
index 0000000,61d2822..4abd359
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultRequest.java
@@@ -1,0 -1,185 +1,181 @@@
+ /*
+ * 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.rest.handlers.task;
+
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Task result request.
+ */
+ public class GridTaskResultRequest extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Task ID. */
+ private IgniteUuid taskId;
+
+ /** Topic. */
+ @GridDirectTransient
+ private Object topic;
+
+ /** Serialized topic. */
+ private byte[] topicBytes;
+
+ /**
+ * Public no-arg constructor for {@link Externalizable} support.
+ */
+ public GridTaskResultRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param taskId Task ID.
+ * @param topic Topic.
+ * @param topicBytes Serialized topic.
+ */
+ GridTaskResultRequest(IgniteUuid taskId, Object topic, byte[] topicBytes) {
+ this.taskId = taskId;
+ this.topic = topic;
+ this.topicBytes = topicBytes;
+ }
+
+ /**
+ * @return Task ID.
+ */
+ public IgniteUuid taskId() {
+ return taskId;
+ }
+
+ /**
+ * @param taskId Task ID.
+ */
+ public void taskId(IgniteUuid taskId) {
+ assert taskId != null;
+
+ this.taskId = taskId;
+ }
+
+ /**
+ * @return Topic.
+ */
+ public Object topic() {
+ return topic;
+ }
+
+ /**
+ * @return Serialized topic.
+ */
+ public byte[] topicBytes() {
+ return topicBytes;
+ }
+
+ /**
+ * @param topic Topic.
+ */
+ public void topic(String topic) {
+ assert topic != null;
+
+ this.topic = topic;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridTaskResultRequest _clone = new GridTaskResultRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridTaskResultRequest _clone = (GridTaskResultRequest)_msg;
+
+ _clone.taskId = taskId;
+ _clone.topic = topic;
+ _clone.topicBytes = topicBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putGridUuid(taskId))
++ if (!commState.putGridUuid("taskId", taskId))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putByteArray(topicBytes))
++ if (!commState.putByteArray("topicBytes", topicBytes))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- IgniteUuid taskId0 = commState.getGridUuid();
++ taskId = commState.getGridUuid("taskId");
+
- if (taskId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- taskId = taskId0;
-
+ commState.idx++;
+
+ case 1:
- byte[] topicBytes0 = commState.getByteArray();
++ topicBytes = commState.getByteArray("topicBytes");
+
- if (topicBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- topicBytes = topicBytes0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 73;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java
index 0000000,fb20156..06cec21
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/task/GridTaskResultResponse.java
@@@ -1,0 -1,233 +1,229 @@@
+ /*
+ * 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.rest.handlers.task;
+
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.jetbrains.annotations.*;
+
+ import java.nio.*;
+
+ /**
+ * Task result response.
+ */
+ public class GridTaskResultResponse extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Result. */
+ @GridDirectTransient
+ private Object res;
+
+ /** Serialized result. */
+ private byte[] resBytes;
+
+ /** Finished flag. */
+ private boolean finished;
+
+ /** Flag indicating that task has ever been launched on node. */
+ private boolean found;
+
+ /** Error. */
+ private String err;
+
+ /**
+ * @return Task result.
+ */
+ @Nullable public Object result() {
+ return res;
+ }
+
+ /**
+ * @param res Task result.
+ */
+ public void result(@Nullable Object res) {
+ this.res = res;
+ }
+
+ /**
+ * @param resBytes Serialized result.
+ */
+ public void resultBytes(byte[] resBytes) {
+ this.resBytes = resBytes;
+ }
+
+ /**
+ * @return Serialized result.
+ */
+ public byte[] resultBytes() {
+ return resBytes;
+ }
+
+ /**
+ * @return {@code true} if finished.
+ */
+ public boolean finished() {
+ return finished;
+ }
+
+ /**
+ * @param finished {@code true} if finished.
+ */
+ public void finished(boolean finished) {
+ this.finished = finished;
+ }
+
+ /**
+ * @return {@code true} if found.
+ */
+ public boolean found() {
+ return found;
+ }
+
+ /**
+ * @param found {@code true} if found.
+ */
+ public void found(boolean found) {
+ this.found = found;
+ }
+
+ /**
+ * @return Error.
+ */
+ public String error() {
+ return err;
+ }
+
+ /**
+ * @param err Error.
+ */
+ public void error(String err) {
+ this.err = err;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridTaskResultResponse _clone = new GridTaskResultResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridTaskResultResponse _clone = (GridTaskResultResponse)_msg;
+
+ _clone.res = res;
+ _clone.resBytes = resBytes;
+ _clone.finished = finished;
+ _clone.found = found;
+ _clone.err = err;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putString(err))
++ if (!commState.putString("err", err))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putBoolean(finished))
++ if (!commState.putBoolean("finished", finished))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putBoolean(found))
++ if (!commState.putBoolean("found", found))
+ return false;
+
+ commState.idx++;
+
+ case 3:
- if (!commState.putByteArray(resBytes))
++ if (!commState.putByteArray("resBytes", resBytes))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- String err0 = commState.getString();
++ err = commState.getString("err");
+
- if (err0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- err = err0;
-
+ commState.idx++;
+
+ case 1:
- if (buf.remaining() < 1)
- return false;
++ finished = commState.getBoolean("finished");
+
- finished = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 2:
- if (buf.remaining() < 1)
- return false;
++ found = commState.getBoolean("found");
+
- found = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 3:
- byte[] resBytes0 = commState.getByteArray();
++ resBytes = commState.getByteArray("resBytes");
+
- if (resBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- resBytes = resBytes0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 74;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java
index 0000000,55f04aa..3cc4358
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridMemcachedMessageWrapper.java
@@@ -1,0 -1,269 +1,282 @@@
+ /*
+ * 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.rest.protocols.tcp;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.util.*;
+ import org.apache.ignite.marshaller.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.nio.charset.*;
+ import java.util.*;
+
+ import static org.apache.ignite.internal.processors.rest.protocols.tcp.GridMemcachedMessage.*;
+
+ /**
+ * Memcached message wrapper for direct marshalling.
+ */
+ public class GridMemcachedMessageWrapper extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 3053626103006980626L;
+
+ /** UTF-8 charset. */
+ private static final Charset UTF_8 = Charset.forName("UTF-8");
+
+ /**
+ * Memcached message bytes.
+ */
+ private byte[] bytes;
+
+ /**
+ *
+ */
+ public GridMemcachedMessageWrapper() {
+ // No-op.
+ }
+
+ /**
+ * @param msg Message.
+ * @param jdkMarshaller JDK marshaller.
+ * @throws IgniteCheckedException If failed to marshal.
+ */
+ public GridMemcachedMessageWrapper(GridMemcachedMessage msg, IgniteMarshaller jdkMarshaller) throws IgniteCheckedException {
+ bytes = encodeMemcache(msg, jdkMarshaller);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putByteArrayClient(bytes))
++ if (!commState.putByteArray("bytes", bytes))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf) {
- throw new UnsupportedOperationException();
++ commState.setBuffer(buf);
++
++ switch (commState.idx) {
++ case 0:
++ bytes = commState.getByteArray("bytes");
++
++ if (!commState.lastRead())
++ return false;
++
++ commState.idx++;
++
++ }
++
++ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return MEMCACHE_RES_FLAG;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridMemcachedMessageWrapper _clone = new GridMemcachedMessageWrapper();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridMemcachedMessageWrapper _clone = (GridMemcachedMessageWrapper)_msg;
+
+ _clone.bytes = bytes;
+ }
+
+ /**
+ * Encodes memcache message to a raw byte array.
+ *
+ * @param msg Message being serialized.
+ * @param jdkMarshaller JDK marshaller.
+ * @return Serialized message.
+ * @throws IgniteCheckedException If serialization failed.
+ */
+ private byte[] encodeMemcache(GridMemcachedMessage msg, IgniteMarshaller jdkMarshaller) throws IgniteCheckedException {
+ GridByteArrayList res = new GridByteArrayList(HDR_LEN - 1);
+
+ int keyLen = 0;
+
+ int keyFlags = 0;
+
+ if (msg.key() != null) {
+ ByteArrayOutputStream rawKey = new ByteArrayOutputStream();
+
+ keyFlags = encodeObj(msg.key(), rawKey, jdkMarshaller);
+
+ msg.key(rawKey.toByteArray());
+
+ keyLen = rawKey.size();
+ }
+
+ int dataLen = 0;
+
+ int valFlags = 0;
+
+ if (msg.value() != null) {
+ ByteArrayOutputStream rawVal = new ByteArrayOutputStream();
+
+ valFlags = encodeObj(msg.value(), rawVal, jdkMarshaller);
+
+ msg.value(rawVal.toByteArray());
+
+ dataLen = rawVal.size();
+ }
+
+ int flagsLen = 0;
+
+ if (msg.addFlags())
+ flagsLen = FLAGS_LENGTH;
+
+ res.add(msg.operationCode());
+
+ // Cast is required due to packet layout.
+ res.add((short)keyLen);
+
+ // Cast is required due to packet layout.
+ res.add((byte)flagsLen);
+
+ // Data type is always 0x00.
+ res.add((byte)0x00);
+
+ res.add((short)msg.status());
+
+ res.add(keyLen + flagsLen + dataLen);
+
+ res.add(msg.opaque(), 0, msg.opaque().length);
+
+ // CAS, unused.
+ res.add(0L);
+
+ assert res.size() == HDR_LEN - 1;
+
+ if (flagsLen > 0) {
+ res.add((short) keyFlags);
+ res.add((short) valFlags);
+ }
+
+ assert msg.key() == null || msg.key() instanceof byte[];
+ assert msg.value() == null || msg.value() instanceof byte[];
+
+ if (keyLen > 0)
+ res.add((byte[])msg.key(), 0, ((byte[])msg.key()).length);
+
+ if (dataLen > 0)
+ res.add((byte[])msg.value(), 0, ((byte[])msg.value()).length);
+
+ return res.entireArray();
+ }
+
+ /**
+ * Encodes given object to a byte array and returns flags that describe the type of serialized object.
+ *
+ * @param obj Object to serialize.
+ * @param out Output stream to which object should be written.
+ * @param jdkMarshaller JDK marshaller.
+ * @return Serialization flags.
+ * @throws IgniteCheckedException If JDK serialization failed.
+ */
+ private int encodeObj(Object obj, ByteArrayOutputStream out, IgniteMarshaller jdkMarshaller) throws IgniteCheckedException {
+ int flags = 0;
+
+ byte[] data = null;
+
+ if (obj instanceof String)
+ data = ((String)obj).getBytes(UTF_8);
+ else if (obj instanceof Boolean) {
+ data = new byte[] {(byte)((Boolean)obj ? '1' : '0')};
+
+ flags |= BOOLEAN_FLAG;
+ }
+ else if (obj instanceof Integer) {
+ data = U.intToBytes((Integer) obj);
+
+ flags |= INT_FLAG;
+ }
+ else if (obj instanceof Long) {
+ data = U.longToBytes((Long)obj);
+
+ flags |= LONG_FLAG;
+ }
+ else if (obj instanceof Date) {
+ data = U.longToBytes(((Date)obj).getTime());
+
+ flags |= DATE_FLAG;
+ }
+ else if (obj instanceof Byte) {
+ data = new byte[] {(Byte)obj};
+
+ flags |= BYTE_FLAG;
+ }
+ else if (obj instanceof Float) {
+ data = U.intToBytes(Float.floatToIntBits((Float)obj));
+
+ flags |= FLOAT_FLAG;
+ }
+ else if (obj instanceof Double) {
+ data = U.longToBytes(Double.doubleToLongBits((Double)obj));
+
+ flags |= DOUBLE_FLAG;
+ }
+ else if (obj instanceof byte[]) {
+ data = (byte[])obj;
+
+ flags |= BYTE_ARR_FLAG;
+ }
+ else {
+ jdkMarshaller.marshal(obj, out);
+
+ flags |= SERIALIZED_FLAG;
+ }
+
+ if (data != null)
+ out.write(data, 0, data.length);
+
+ return flags;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridMemcachedMessageWrapper.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java
index 0000000,55d7c95..7a95fb2
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestDirectParser.java
@@@ -1,0 -1,519 +1,515 @@@
+ /*
+ * 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.rest.protocols.tcp;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.client.marshaller.*;
+ import org.apache.ignite.internal.processors.rest.client.message.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.nio.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.nio.charset.*;
+ import java.util.*;
+
+ import static org.apache.ignite.internal.processors.rest.protocols.tcp.GridMemcachedMessage.*;
+ import static org.apache.ignite.internal.util.nio.GridNioSessionMetaKey.*;
+
+ /**
+ *
+ */
+ public class GridTcpRestDirectParser implements GridNioParser {
+ /** UTF-8 charset. */
+ private static final Charset UTF_8 = Charset.forName("UTF-8");
+
+ /** Message metadata key. */
+ private static final int MSG_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
+
+ /** Protocol handler. */
+ private final GridTcpRestProtocol proto;
+
- /** Message reader. */
- private final GridNioMessageReader msgReader;
-
+ /**
+ * @param proto Protocol handler.
- * @param msgReader Message reader.
+ */
- public GridTcpRestDirectParser(GridTcpRestProtocol proto, GridNioMessageReader msgReader) {
++ public GridTcpRestDirectParser(GridTcpRestProtocol proto) {
+ this.proto = proto;
- this.msgReader = msgReader;
+ }
+
+ /** {@inheritDoc} */
- @Nullable @Override public Object decode(GridNioSession ses, ByteBuffer buf) throws IOException, IgniteCheckedException {
++ @Nullable @Override public Object decode(GridNioSession ses, ByteBuffer buf)
++ throws IOException, IgniteCheckedException {
+ ParserState state = ses.removeMeta(PARSER_STATE.ordinal());
+
+ if (state != null) {
+ assert state.packetType() == GridClientPacketType.MEMCACHE;
+
+ Object memcacheMsg = parseMemcachePacket(ses, buf, state);
+
+ if (memcacheMsg == null)
+ ses.addMeta(PARSER_STATE.ordinal(), state);
+
+ return memcacheMsg;
+ }
+
+ GridTcpCommunicationMessageAdapter msg = ses.removeMeta(MSG_META_KEY);
+
+ if (msg == null && buf.hasRemaining()) {
+ byte type = buf.get(buf.position());
+
+ if (type == GridClientMessageWrapper.REQ_HEADER) {
+ buf.get();
+
+ msg = new GridClientMessageWrapper();
+ }
+ else if (type == GridClientHandshakeRequestWrapper.HANDSHAKE_HEADER) {
+ buf.get();
+
+ msg = new GridClientHandshakeRequestWrapper();
+ }
+ else if (type == MEMCACHE_REQ_FLAG) {
+ state = new ParserState();
+
+ state.packet(new GridMemcachedMessage());
+ state.packetType(GridClientPacketType.MEMCACHE);
+
+ Object memcacheMsg = parseMemcachePacket(ses, buf, state);
+
+ if (memcacheMsg == null)
+ ses.addMeta(PARSER_STATE.ordinal(), state);
+
+ return memcacheMsg;
+ }
+ else
+ throw new IOException("Invalid message type: " + type);
+ }
+
+ boolean finished = false;
+
+ if (buf.hasRemaining())
- finished = msgReader.read(null, msg, buf);
++ finished = msg.readFrom(buf);
+
+ if (finished) {
+ if (msg instanceof GridClientMessageWrapper) {
+ GridClientMessageWrapper clientMsg = (GridClientMessageWrapper)msg;
+
+ if (clientMsg.messageSize() == 0)
+ return GridClientPingPacket.PING_MESSAGE;
+
+ GridClientMarshaller marsh = proto.marshaller(ses);
+
+ GridClientMessage ret = marsh.unmarshal(clientMsg.messageArray());
+
+ ret.requestId(clientMsg.requestId());
+ ret.clientId(clientMsg.clientId());
+ ret.destinationId(clientMsg.destinationId());
+
+ return ret;
+ }
+ else {
+ assert msg instanceof GridClientHandshakeRequestWrapper;
+
+ GridClientHandshakeRequestWrapper req = (GridClientHandshakeRequestWrapper)msg;
+
+ GridClientHandshakeRequest ret = new GridClientHandshakeRequest();
+
+ ret.putBytes(req.bytes(), 0, 4);
+
+ return ret;
+ }
+ }
+ else {
+ ses.addMeta(MSG_META_KEY, msg);
+
+ return null;
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public ByteBuffer encode(GridNioSession ses, Object msg) throws IOException, IgniteCheckedException {
+ // No encoding needed for direct messages.
+ throw new UnsupportedEncodingException();
+ }
+
+ /**
+ * Parses memcache protocol message.
+ *
+ * @param ses Session.
+ * @param buf Buffer containing not parsed bytes.
+ * @param state Current parser state.
+ * @return Parsed packet.s
+ * @throws IOException If packet cannot be parsed.
+ * @throws IgniteCheckedException If deserialization error occurred.
+ */
+ @Nullable private GridClientMessage parseMemcachePacket(GridNioSession ses, ByteBuffer buf, ParserState state)
+ throws IOException, IgniteCheckedException {
+ assert state.packetType() == GridClientPacketType.MEMCACHE;
+ assert state.packet() != null;
+ assert state.packet() instanceof GridMemcachedMessage;
+
+ GridMemcachedMessage req = (GridMemcachedMessage)state.packet();
+ ByteArrayOutputStream tmp = state.buffer();
+ int i = state.index();
+
+ while (buf.remaining() > 0) {
+ byte b = buf.get();
+
+ if (i == 0)
+ req.requestFlag(b);
+ else if (i == 1)
+ req.operationCode(b);
+ else if (i == 2 || i == 3) {
+ tmp.write(b);
+
+ if (i == 3) {
+ req.keyLength(U.bytesToShort(tmp.toByteArray(), 0));
+
+ tmp.reset();
+ }
+ }
+ else if (i == 4)
+ req.extrasLength(b);
+ else if (i >= 8 && i <= 11) {
+ tmp.write(b);
+
+ if (i == 11) {
+ req.totalLength(U.bytesToInt(tmp.toByteArray(), 0));
+
+ tmp.reset();
+ }
+ }
+ else if (i >= 12 && i <= 15) {
+ tmp.write(b);
+
+ if (i == 15) {
+ req.opaque(tmp.toByteArray());
+
+ tmp.reset();
+ }
+ }
+ else if (i >= HDR_LEN && i < HDR_LEN + req.extrasLength()) {
+ tmp.write(b);
+
+ if (i == HDR_LEN + req.extrasLength() - 1) {
+ req.extras(tmp.toByteArray());
+
+ tmp.reset();
+ }
+ }
+ else if (i >= HDR_LEN + req.extrasLength() &&
+ i < HDR_LEN + req.extrasLength() + req.keyLength()) {
+ tmp.write(b);
+
+ if (i == HDR_LEN + req.extrasLength() + req.keyLength() - 1) {
+ req.key(tmp.toByteArray());
+
+ tmp.reset();
+ }
+ }
+ else if (i >= HDR_LEN + req.extrasLength() + req.keyLength() &&
+ i < HDR_LEN + req.totalLength()) {
+ tmp.write(b);
+
+ if (i == HDR_LEN + req.totalLength() - 1) {
+ req.value(tmp.toByteArray());
+
+ tmp.reset();
+ }
+ }
+
+ if (i == HDR_LEN + req.totalLength() - 1)
+ // Assembled the packet.
+ return assemble(ses, req);
+
+ i++;
+ }
+
+ state.index(i);
+
+ return null;
+ }
+
+ /**
+ * Validates incoming packet and deserializes all fields that need to be deserialized.
+ *
+ * @param ses Session on which packet is being parsed.
+ * @param req Raw packet.
+ * @return Same packet with fields deserialized.
+ * @throws IOException If parsing failed.
+ * @throws IgniteCheckedException If deserialization failed.
+ */
+ private GridClientMessage assemble(GridNioSession ses, GridMemcachedMessage req) throws IOException, IgniteCheckedException {
+ byte[] extras = req.extras();
+
+ // First, decode key and value, if any
+ if (req.key() != null || req.value() != null) {
+ short keyFlags = 0;
+ short valFlags = 0;
+
+ if (req.hasFlags()) {
+ if (extras == null || extras.length < FLAGS_LENGTH)
+ throw new IOException("Failed to parse incoming packet (flags required for command) [ses=" +
+ ses + ", opCode=" + Integer.toHexString(req.operationCode() & 0xFF) + ']');
+
+ keyFlags = U.bytesToShort(extras, 0);
+ valFlags = U.bytesToShort(extras, 2);
+ }
+
+ if (req.key() != null) {
+ assert req.key() instanceof byte[];
+
+ byte[] rawKey = (byte[])req.key();
+
+ // Only values can be hessian-encoded.
+ req.key(decodeObj(keyFlags, rawKey));
+ }
+
+ if (req.value() != null) {
+ assert req.value() instanceof byte[];
+
+ byte[] rawVal = (byte[])req.value();
+
+ req.value(decodeObj(valFlags, rawVal));
+ }
+ }
+
+ if (req.hasExpiration()) {
+ if (extras == null || extras.length < 8)
+ throw new IOException("Failed to parse incoming packet (expiration value required for command) [ses=" +
+ ses + ", opCode=" + Integer.toHexString(req.operationCode() & 0xFF) + ']');
+
+ req.expiration(U.bytesToInt(extras, 4) & 0xFFFFFFFFL);
+ }
+
+ if (req.hasInitial()) {
+ if (extras == null || extras.length < 16)
+ throw new IOException("Failed to parse incoming packet (initial value required for command) [ses=" +
+ ses + ", opCode=" + Integer.toHexString(req.operationCode() & 0xFF) + ']');
+
+ req.initial(U.bytesToLong(extras, 8));
+ }
+
+ if (req.hasDelta()) {
+ if (extras == null || extras.length < 8)
+ throw new IOException("Failed to parse incoming packet (delta value required for command) [ses=" +
+ ses + ", opCode=" + Integer.toHexString(req.operationCode() & 0xFF) + ']');
+
+ req.delta(U.bytesToLong(extras, 0));
+ }
+
+ if (extras != null) {
+ // Clients that include cache name must always include flags.
+ int len = 4;
+
+ if (req.hasExpiration())
+ len += 4;
+
+ if (req.hasDelta())
+ len += 8;
+
+ if (req.hasInitial())
+ len += 8;
+
+ if (extras.length - len > 0) {
+ byte[] cacheName = new byte[extras.length - len];
+
+ U.arrayCopy(extras, len, cacheName, 0, extras.length - len);
+
+ req.cacheName(new String(cacheName, UTF_8));
+ }
+ }
+
+ return req;
+ }
+
+ /**
+ * Decodes value from a given byte array to the object according to the flags given.
+ *
+ * @param flags Flags.
+ * @param bytes Byte array to decode.
+ * @return Decoded value.
+ * @throws IgniteCheckedException If deserialization failed.
+ */
+ private Object decodeObj(short flags, byte[] bytes) throws IgniteCheckedException {
+ assert bytes != null;
+
+ if ((flags & SERIALIZED_FLAG) != 0)
+ return proto.jdkMarshaller().unmarshal(bytes, null);
+
+ int masked = flags & 0xff00;
+
+ switch (masked) {
+ case BOOLEAN_FLAG:
+ return bytes[0] == '1';
+ case INT_FLAG:
+ return U.bytesToInt(bytes, 0);
+ case LONG_FLAG:
+ return U.bytesToLong(bytes, 0);
+ case DATE_FLAG:
+ return new Date(U.bytesToLong(bytes, 0));
+ case BYTE_FLAG:
+ return bytes[0];
+ case FLOAT_FLAG:
+ return Float.intBitsToFloat(U.bytesToInt(bytes, 0));
+ case DOUBLE_FLAG:
+ return Double.longBitsToDouble(U.bytesToLong(bytes, 0));
+ case BYTE_ARR_FLAG:
+ return bytes;
+ default:
+ return new String(bytes, UTF_8);
+ }
+ }
+
+ /**
+ * Holder for parser state and temporary buffer.
+ */
+ protected static class ParserState {
+ /** Parser index. */
+ private int idx;
+
+ /** Temporary data buffer. */
+ private ByteArrayOutputStream buf = new ByteArrayOutputStream();
+
+ /** Packet being assembled. */
+ private GridClientMessage packet;
+
+ /** Packet type. */
+ private GridClientPacketType packetType;
+
+ /** Header data. */
+ private HeaderData hdr;
+
+ /**
+ * @return Stored parser index.
+ */
+ public int index() {
+ return idx;
+ }
+
+ /**
+ * @param idx Index to store.
+ */
+ public void index(int idx) {
+ this.idx = idx;
+ }
+
+ /**
+ * @return Temporary data buffer.
+ */
+ public ByteArrayOutputStream buffer() {
+ return buf;
+ }
+
+ /**
+ * @return Pending packet.
+ */
+ @Nullable public GridClientMessage packet() {
+ return packet;
+ }
+
+ /**
+ * @param packet Pending packet.
+ */
+ public void packet(GridClientMessage packet) {
+ assert this.packet == null;
+
+ this.packet = packet;
+ }
+
+ /**
+ * @return Pending packet type.
+ */
+ public GridClientPacketType packetType() {
+ return packetType;
+ }
+
+ /**
+ * @param packetType Pending packet type.
+ */
+ public void packetType(GridClientPacketType packetType) {
+ this.packetType = packetType;
+ }
+
+ /**
+ * @return Header.
+ */
+ public HeaderData header() {
+ return hdr;
+ }
+
+ /**
+ * @param hdr Header.
+ */
+ public void header(HeaderData hdr) {
+ this.hdr = hdr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(ParserState.class, this);
+ }
+ }
+
+ /**
+ * Header.
+ */
+ protected static class HeaderData {
+ /** Request Id. */
+ private final long reqId;
+
+ /** Request Id. */
+ private final UUID clientId;
+
+ /** Request Id. */
+ private final UUID destId;
+
+ /**
+ * @param reqId Request Id.
+ * @param clientId Client Id.
+ * @param destId Destination Id.
+ */
+ private HeaderData(long reqId, UUID clientId, UUID destId) {
+ this.reqId = reqId;
+ this.clientId = clientId;
+ this.destId = destId;
+ }
+
+ /**
+ * @return Request Id.
+ */
+ public long reqId() {
+ return reqId;
+ }
+
+ /**
+ * @return Client Id.
+ */
+ public UUID clientId() {
+ return clientId;
+ }
+
+ /**
+ * @return Destination Id.
+ */
+ public UUID destinationId() {
+ return destId;
+ }
+ }
+ }
[35/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java
index 0000000,794a02b..c842a06
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java
@@@ -1,0 -1,548 +1,534 @@@
+ /*
+ * 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.dataload;
+
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.jetbrains.annotations.*;
+
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ *
+ */
+ public class GridDataLoadRequest extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private long reqId;
+
+ /** */
+ private byte[] resTopicBytes;
+
+ /** Cache name. */
+ private String cacheName;
+
+ /** */
+ private byte[] updaterBytes;
+
+ /** Entries to put. */
+ private byte[] colBytes;
+
+ /** {@code True} to ignore deployment ownership. */
+ private boolean ignoreDepOwnership;
+
+ /** */
+ private boolean skipStore;
+
+ /** */
+ private IgniteDeploymentMode depMode;
+
+ /** */
+ private String sampleClsName;
+
+ /** */
+ private String userVer;
+
+ /** Node class loader participants. */
+ @GridToStringInclude
+ @GridDirectMap(keyType = UUID.class, valueType = IgniteUuid.class)
+ private Map<UUID, IgniteUuid> ldrParticipants;
+
+ /** */
+ private IgniteUuid clsLdrId;
+
+ /** */
+ private boolean forceLocDep;
+
+ /**
+ * {@code Externalizable} support.
+ */
+ public GridDataLoadRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param reqId Request ID.
+ * @param resTopicBytes Response topic.
+ * @param cacheName Cache name.
+ * @param updaterBytes Cache updater.
+ * @param colBytes Collection bytes.
+ * @param ignoreDepOwnership Ignore ownership.
+ * @param skipStore Skip store flag.
+ * @param depMode Deployment mode.
+ * @param sampleClsName Sample class name.
+ * @param userVer User version.
+ * @param ldrParticipants Loader participants.
+ * @param clsLdrId Class loader ID.
+ * @param forceLocDep Force local deployment.
+ */
+ public GridDataLoadRequest(long reqId,
+ byte[] resTopicBytes,
+ @Nullable String cacheName,
+ byte[] updaterBytes,
+ byte[] colBytes,
+ boolean ignoreDepOwnership,
+ boolean skipStore,
+ IgniteDeploymentMode depMode,
+ String sampleClsName,
+ String userVer,
+ Map<UUID, IgniteUuid> ldrParticipants,
+ IgniteUuid clsLdrId,
+ boolean forceLocDep) {
+ this.reqId = reqId;
+ this.resTopicBytes = resTopicBytes;
+ this.cacheName = cacheName;
+ this.updaterBytes = updaterBytes;
+ this.colBytes = colBytes;
+ this.ignoreDepOwnership = ignoreDepOwnership;
+ this.skipStore = skipStore;
+ this.depMode = depMode;
+ this.sampleClsName = sampleClsName;
+ this.userVer = userVer;
+ this.ldrParticipants = ldrParticipants;
+ this.clsLdrId = clsLdrId;
+ this.forceLocDep = forceLocDep;
+ }
+
+ /**
+ * @return Request ID.
+ */
+ public long requestId() {
+ return reqId;
+ }
+
+ /**
+ * @return Response topic.
+ */
+ public byte[] responseTopicBytes() {
+ return resTopicBytes;
+ }
+
+ /**
+ * @return Cache name.
+ */
+ public String cacheName() {
+ return cacheName;
+ }
+
+ /**
+ * @return Updater.
+ */
+ public byte[] updaterBytes() {
+ return updaterBytes;
+ }
+
+ /**
+ * @return Collection bytes.
+ */
+ public byte[] collectionBytes() {
+ return colBytes;
+ }
+
+ /**
+ * @return {@code True} to ignore ownership.
+ */
+ public boolean ignoreDeploymentOwnership() {
+ return ignoreDepOwnership;
+ }
+
+ /**
+ * @return Skip store flag.
+ */
+ public boolean skipStore() {
+ return skipStore;
+ }
+
+ /**
+ * @return Deployment mode.
+ */
+ public IgniteDeploymentMode deploymentMode() {
+ return depMode;
+ }
+
+ /**
+ * @return Sample class name.
+ */
+ public String sampleClassName() {
+ return sampleClsName;
+ }
+
+ /**
+ * @return User version.
+ */
+ public String userVersion() {
+ return userVer;
+ }
+
+ /**
+ * @return Participants.
+ */
+ public Map<UUID, IgniteUuid> participants() {
+ return ldrParticipants;
+ }
+
+ /**
+ * @return Class loader ID.
+ */
+ public IgniteUuid classLoaderId() {
+ return clsLdrId;
+ }
+
+ /**
+ * @return {@code True} to force local deployment.
+ */
+ public boolean forceLocalDeployment() {
+ return forceLocDep;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDataLoadRequest.class, this);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putString(cacheName))
++ if (!commState.putString("cacheName", cacheName))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putGridUuid(clsLdrId))
++ if (!commState.putGridUuid("clsLdrId", clsLdrId))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putByteArray(colBytes))
++ if (!commState.putByteArray("colBytes", colBytes))
+ return false;
+
+ commState.idx++;
+
+ case 3:
- if (!commState.putEnum(depMode))
++ if (!commState.putEnum("depMode", depMode))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putBoolean(forceLocDep))
++ if (!commState.putBoolean("forceLocDep", forceLocDep))
+ return false;
+
+ commState.idx++;
+
+ case 5:
- if (!commState.putBoolean(ignoreDepOwnership))
++ if (!commState.putBoolean("ignoreDepOwnership", ignoreDepOwnership))
+ return false;
+
+ commState.idx++;
+
+ case 6:
+ if (ldrParticipants != null) {
+ if (commState.it == null) {
- if (!commState.putInt(ldrParticipants.size()))
++ if (!commState.putInt(null, ldrParticipants.size()))
+ return false;
+
+ commState.it = ldrParticipants.entrySet().iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
+ Map.Entry<UUID, IgniteUuid> e = (Map.Entry<UUID, IgniteUuid>)commState.cur;
+
+ if (!commState.keyDone) {
- if (!commState.putUuid(e.getKey()))
++ if (!commState.putUuid(null, e.getKey()))
+ return false;
+
+ commState.keyDone = true;
+ }
+
- if (!commState.putGridUuid(e.getValue()))
++ if (!commState.putGridUuid(null, e.getValue()))
+ return false;
+
+ commState.keyDone = false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 7:
- if (!commState.putLong(reqId))
++ if (!commState.putLong("reqId", reqId))
+ return false;
+
+ commState.idx++;
+
+ case 8:
- if (!commState.putByteArray(resTopicBytes))
++ if (!commState.putByteArray("resTopicBytes", resTopicBytes))
+ return false;
+
+ commState.idx++;
+
+ case 9:
- if (!commState.putString(sampleClsName))
++ if (!commState.putString("sampleClsName", sampleClsName))
+ return false;
+
+ commState.idx++;
+
+ case 10:
- if (!commState.putBoolean(skipStore))
++ if (!commState.putBoolean(null, skipStore))
+ return false;
+
+ commState.idx++;
+
+ case 11:
- if (!commState.putByteArray(updaterBytes))
++ if (!commState.putByteArray(null, updaterBytes))
+ return false;
+
+ commState.idx++;
+
+ case 12:
- if (!commState.putString(userVer))
++ if (!commState.putString(null, userVer))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- String cacheName0 = commState.getString();
++ cacheName = commState.getString("cacheName");
+
- if (cacheName0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- cacheName = cacheName0;
-
+ commState.idx++;
+
+ case 1:
- IgniteUuid clsLdrId0 = commState.getGridUuid();
++ clsLdrId = commState.getGridUuid("clsLdrId");
+
- if (clsLdrId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- clsLdrId = clsLdrId0;
-
+ commState.idx++;
+
+ case 2:
- byte[] colBytes0 = commState.getByteArray();
++ colBytes = commState.getByteArray("colBytes");
+
- if (colBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- colBytes = colBytes0;
-
+ commState.idx++;
+
+ case 3:
- if (buf.remaining() < 1)
- return false;
++ byte depMode0 = commState.getByte("depMode");
+
- byte depMode0 = commState.getByte();
++ if (!commState.lastRead())
++ return false;
+
+ depMode = IgniteDeploymentMode.fromOrdinal(depMode0);
+
+ commState.idx++;
+
+ case 4:
- if (buf.remaining() < 1)
- return false;
++ forceLocDep = commState.getBoolean("forceLocDep");
+
- forceLocDep = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 5:
- if (buf.remaining() < 1)
- return false;
++ ignoreDepOwnership = commState.getBoolean("ignoreDepOwnership");
+
- ignoreDepOwnership = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 6:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (ldrParticipants == null)
+ ldrParticipants = new HashMap<>(commState.readSize, 1.0f);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
+ if (!commState.keyDone) {
- UUID _val = commState.getUuid();
++ UUID _val = commState.getUuid(null);
+
- if (_val == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ commState.cur = _val;
+ commState.keyDone = true;
+ }
+
- IgniteUuid _val = commState.getGridUuid();
++ IgniteUuid _val = commState.getGridUuid(null);
+
- if (_val == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ ldrParticipants.put((UUID)commState.cur, _val);
+
+ commState.keyDone = false;
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+ commState.cur = null;
+
+ commState.idx++;
+
+ case 7:
- if (buf.remaining() < 8)
- return false;
++ reqId = commState.getLong("reqId");
+
- reqId = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 8:
- byte[] resTopicBytes0 = commState.getByteArray();
++ resTopicBytes = commState.getByteArray("resTopicBytes");
+
- if (resTopicBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- resTopicBytes = resTopicBytes0;
-
+ commState.idx++;
+
+ case 9:
- String sampleClsName0 = commState.getString();
++ sampleClsName = commState.getString("sampleClsName");
+
- if (sampleClsName0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- sampleClsName = sampleClsName0;
-
+ commState.idx++;
+
+ case 10:
+ if (buf.remaining() < 1)
+ return false;
+
- skipStore = commState.getBoolean();
++ skipStore = commState.getBoolean(null);
+
+ commState.idx++;
+
+ case 11:
- byte[] updaterBytes0 = commState.getByteArray();
++ byte[] updaterBytes0 = commState.getByteArray(null);
+
- if (updaterBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- updaterBytes = updaterBytes0;
-
+ commState.idx++;
+
+ case 12:
- String userVer0 = commState.getString();
++ String userVer0 = commState.getString(null);
+
- if (userVer0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- userVer = userVer0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 61;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDataLoadRequest _clone = new GridDataLoadRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridDataLoadRequest _clone = (GridDataLoadRequest)_msg;
+
+ _clone.reqId = reqId;
+ _clone.resTopicBytes = resTopicBytes;
+ _clone.cacheName = cacheName;
+ _clone.updaterBytes = updaterBytes;
+ _clone.colBytes = colBytes;
+ _clone.ignoreDepOwnership = ignoreDepOwnership;
+ _clone.skipStore = skipStore;
+ _clone.depMode = depMode;
+ _clone.sampleClsName = sampleClsName;
+ _clone.userVer = userVer;
+ _clone.ldrParticipants = ldrParticipants;
+ _clone.clsLdrId = clsLdrId;
+ _clone.forceLocDep = forceLocDep;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadResponse.java
index 0000000,6f784f5..ed193a9
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadResponse.java
@@@ -1,0 -1,181 +1,179 @@@
+ /*
+ * 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.dataload;
+
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.nio.*;
+
+ /**
+ *
+ */
+ public class GridDataLoadResponse extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private long reqId;
+
+ /** */
+ private byte[] errBytes;
+
+ /** */
+ private boolean forceLocDep;
+
+ /**
+ * @param reqId Request ID.
+ * @param errBytes Error bytes.
+ * @param forceLocDep Force local deployment.
+ */
+ public GridDataLoadResponse(long reqId, byte[] errBytes, boolean forceLocDep) {
+ this.reqId = reqId;
+ this.errBytes = errBytes;
+ this.forceLocDep = forceLocDep;
+ }
+
+ /**
+ * {@code Externalizable} support.
+ */
+ public GridDataLoadResponse() {
+ // No-op.
+ }
+
+ /**
+ * @return Request ID.
+ */
+ public long requestId() {
+ return reqId;
+ }
+
+ /**
+ * @return Error bytes.
+ */
+ public byte[] errorBytes() {
+ return errBytes;
+ }
+
+ /**
+ * @return {@code True} to force local deployment.
+ */
+ public boolean forceLocalDeployment() {
+ return forceLocDep;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDataLoadResponse.class, this);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDataLoadResponse _clone = new GridDataLoadResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridDataLoadResponse _clone = (GridDataLoadResponse)_msg;
+
+ _clone.reqId = reqId;
+ _clone.errBytes = errBytes;
+ _clone.forceLocDep = forceLocDep;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putByteArray(errBytes))
++ if (!commState.putByteArray("errBytes", errBytes))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putBoolean(forceLocDep))
++ if (!commState.putBoolean("forceLocDep", forceLocDep))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putLong(reqId))
++ if (!commState.putLong("reqId", reqId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- byte[] errBytes0 = commState.getByteArray();
++ errBytes = commState.getByteArray("errBytes");
+
- if (errBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- errBytes = errBytes0;
-
+ commState.idx++;
+
+ case 1:
- if (buf.remaining() < 1)
- return false;
++ forceLocDep = commState.getBoolean("forceLocDep");
+
- forceLocDep = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 2:
- if (buf.remaining() < 8)
- return false;
++ reqId = commState.getLong("reqId");
+
- reqId = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 62;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsAckMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsAckMessage.java
index 0000000,eabc2b1..e39bc6b
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsAckMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsAckMessage.java
@@@ -1,0 -1,212 +1,208 @@@
+ /*
+ * 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.fs;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.marshaller.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Block write request acknowledgement message.
+ */
+ public class GridGgfsAckMessage extends GridGgfsCommunicationMessage {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** File id. */
+ private IgniteUuid fileId;
+
+ /** Request ID to ack. */
+ private long id;
+
+ /** Write exception. */
+ @GridDirectTransient
+ private IgniteCheckedException err;
+
+ /** */
+ private byte[] errBytes;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridGgfsAckMessage() {
+ // No-op.
+ }
+
+ /**
+ * @param fileId File ID.
+ * @param id Request ID.
+ * @param err Error.
+ */
+ public GridGgfsAckMessage(IgniteUuid fileId, long id, @Nullable IgniteCheckedException err) {
+ this.fileId = fileId;
+ this.id = id;
+ this.err = err;
+ }
+
+ /**
+ * @return File ID.
+ */
+ public IgniteUuid fileId() {
+ return fileId;
+ }
+
+ /**
+ * @return Batch ID.
+ */
+ public long id() {
+ return id;
+ }
+
+ /**
+ * @return Error occurred when writing this batch, if any.
+ */
+ public IgniteCheckedException error() {
+ return err;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void prepareMarshal(IgniteMarshaller marsh) throws IgniteCheckedException {
+ super.prepareMarshal(marsh);
+
+ if (err != null)
+ errBytes = marsh.marshal(err);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(IgniteMarshaller marsh, @Nullable ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(marsh, ldr);
+
+ if (errBytes != null)
+ err = marsh.unmarshal(errBytes, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridGgfsAckMessage _clone = new GridGgfsAckMessage();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridGgfsAckMessage _clone = (GridGgfsAckMessage)_msg;
+
+ _clone.fileId = fileId;
+ _clone.id = id;
+ _clone.err = err;
+ _clone.errBytes = errBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putByteArray(errBytes))
++ if (!commState.putByteArray("errBytes", errBytes))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putGridUuid(fileId))
++ if (!commState.putGridUuid("fileId", fileId))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putLong(id))
++ if (!commState.putLong("id", id))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 0:
- byte[] errBytes0 = commState.getByteArray();
++ errBytes = commState.getByteArray("errBytes");
+
- if (errBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- errBytes = errBytes0;
-
+ commState.idx++;
+
+ case 1:
- IgniteUuid fileId0 = commState.getGridUuid();
++ fileId = commState.getGridUuid("fileId");
+
- if (fileId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- fileId = fileId0;
-
+ commState.idx++;
+
+ case 2:
- if (buf.remaining() < 8)
- return false;
++ id = commState.getLong("id");
+
- id = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 65;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlockKey.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlockKey.java
index 0000000,84fcaa6..101db19
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlockKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlockKey.java
@@@ -1,0 -1,279 +1,275 @@@
+ /*
+ * 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.fs;
+
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.processors.task.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * File's binary data block key.
+ */
+ @GridInternal
+ public final class GridGgfsBlockKey extends GridTcpCommunicationMessageAdapter
+ implements Externalizable, Comparable<GridGgfsBlockKey> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** File system file ID. */
+ private IgniteUuid fileId;
+
+ /** Block ID. */
+ private long blockId;
+
+ /** Block affinity key. */
+ private IgniteUuid affKey;
+
+ /** Eviction exclude flag. */
+ private boolean evictExclude;
+
+ /**
+ * Constructs file's binary data block key.
+ *
+ * @param fileId File ID.
+ * @param affKey Affinity key.
+ * @param evictExclude Evict exclude flag.
+ * @param blockId Block ID.
+ */
+ public GridGgfsBlockKey(IgniteUuid fileId, @Nullable IgniteUuid affKey, boolean evictExclude, long blockId) {
+ assert fileId != null;
+ assert blockId >= 0;
+
+ this.fileId = fileId;
+ this.affKey = affKey;
+ this.evictExclude = evictExclude;
+ this.blockId = blockId;
+ }
+
+ /**
+ * Empty constructor required for {@link Externalizable}.
+ */
+ public GridGgfsBlockKey() {
+ // No-op.
+ }
+
+ /**
+ * @return File ID.
+ */
+ public IgniteUuid getFileId() {
+ return fileId;
+ }
+
+ /**
+ * @return Block affinity key.
+ */
+ public IgniteUuid affinityKey() {
+ return affKey;
+ }
+
+ /**
+ * @return Evict exclude flag.
+ */
+ public boolean evictExclude() {
+ return evictExclude;
+ }
+
+ /**
+ * @return Block ID.
+ */
+ public long getBlockId() {
+ return blockId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int compareTo(@NotNull GridGgfsBlockKey o) {
+ int res = fileId.compareTo(o.fileId);
+
+ if (res != 0)
+ return res;
+
+ long v1 = blockId;
+ long v2 = o.blockId;
+
+ if (v1 != v2)
+ return v1 > v2 ? 1 : -1;
+
+ if (affKey == null && o.affKey == null)
+ return 0;
+
+ if (affKey != null && o.affKey != null)
+ return affKey.compareTo(o.affKey);
+
+ return affKey != null ? -1 : 1;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ U.writeGridUuid(out, fileId);
+ U.writeGridUuid(out, affKey);
+ out.writeBoolean(evictExclude);
+ out.writeLong(blockId);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException {
+ fileId = U.readGridUuid(in);
+ affKey = U.readGridUuid(in);
+ evictExclude = in.readBoolean();
+ blockId = in.readLong();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return fileId.hashCode() + (int)(blockId ^ (blockId >>> 32));
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (o == this)
+ return true;
+
+ if (o == null || o.getClass() != getClass())
+ return false;
+
+ GridGgfsBlockKey that = (GridGgfsBlockKey)o;
+
+ return blockId == that.blockId && fileId.equals(that.fileId) && F.eq(affKey, that.affKey) &&
+ evictExclude == that.evictExclude;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridGgfsBlockKey _clone = new GridGgfsBlockKey();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridGgfsBlockKey _clone = (GridGgfsBlockKey)_msg;
+
+ _clone.fileId = fileId;
+ _clone.blockId = blockId;
+ _clone.affKey = affKey;
+ _clone.evictExclude = evictExclude;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("fallthrough")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putGridUuid(affKey))
++ if (!commState.putGridUuid("affKey", affKey))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putLong(blockId))
++ if (!commState.putLong("blockId", blockId))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putBoolean(evictExclude))
++ if (!commState.putBoolean("evictExclude", evictExclude))
+ return false;
+
+ commState.idx++;
+
+ case 3:
- if (!commState.putGridUuid(fileId))
++ if (!commState.putGridUuid("fileId", fileId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("fallthrough")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- IgniteUuid affKey0 = commState.getGridUuid();
++ affKey = commState.getGridUuid("affKey");
+
- if (affKey0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- affKey = affKey0;
-
+ commState.idx++;
+
+ case 1:
- if (buf.remaining() < 8)
- return false;
++ blockId = commState.getLong("blockId");
+
- blockId = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 2:
- if (buf.remaining() < 1)
- return false;
++ evictExclude = commState.getBoolean("evictExclude");
+
- evictExclude = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 3:
- IgniteUuid fileId0 = commState.getGridUuid();
++ fileId = commState.getGridUuid("fileId");
+
- if (fileId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- fileId = fileId0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 66;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridGgfsBlockKey.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java
index 0000000,2d90e86..2a1f8a1
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsBlocksMessage.java
@@@ -1,0 -1,257 +1,254 @@@
+ /*
+ * 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.fs;
+
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * GGFS write blocks message.
+ */
+ public class GridGgfsBlocksMessage extends GridGgfsCommunicationMessage {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** File id. */
+ private IgniteUuid fileId;
+
+ /** Batch id */
+ private long id;
+
+ /** Blocks to store. */
+ @GridDirectMap(keyType = GridGgfsBlockKey.class, valueType = byte[].class)
+ private Map<GridGgfsBlockKey, byte[]> blocks;
+
+ /**
+ * Empty constructor required by {@link Externalizable}
+ */
+ public GridGgfsBlocksMessage() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param fileId File ID.
+ * @param id Message id.
+ * @param blocks Blocks to put in cache.
+ */
+ public GridGgfsBlocksMessage(IgniteUuid fileId, long id, Map<GridGgfsBlockKey, byte[]> blocks) {
+ this.fileId = fileId;
+ this.id = id;
+ this.blocks = blocks;
+ }
+
+ /**
+ * @return File id.
+ */
+ public IgniteUuid fileId() {
+ return fileId;
+ }
+
+ /**
+ * @return Batch id.
+ */
+ public long id() {
+ return id;
+ }
+
+ /**
+ * @return Map of blocks to put in cache.
+ */
+ public Map<GridGgfsBlockKey, byte[]> blocks() {
+ return blocks;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridGgfsBlocksMessage _clone = new GridGgfsBlocksMessage();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridGgfsBlocksMessage _clone = (GridGgfsBlocksMessage)_msg;
+
+ _clone.fileId = fileId;
+ _clone.id = id;
+ _clone.blocks = blocks;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
+ if (blocks != null) {
+ if (commState.it == null) {
- if (!commState.putInt(blocks.size()))
++ if (!commState.putInt(null, blocks.size()))
+ return false;
+
+ commState.it = blocks.entrySet().iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
+ Map.Entry<GridGgfsBlockKey, byte[]> e = (Map.Entry<GridGgfsBlockKey, byte[]>)commState.cur;
+
+ if (!commState.keyDone) {
- if (!commState.putMessage(e.getKey()))
++ if (!commState.putMessage(null, e.getKey()))
+ return false;
+
+ commState.keyDone = true;
+ }
+
- if (!commState.putByteArray(e.getValue()))
++ if (!commState.putByteArray(null, e.getValue()))
+ return false;
+
+ commState.keyDone = false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putGridUuid(fileId))
++ if (!commState.putGridUuid("fileId", fileId))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putLong(id))
++ if (!commState.putLong("id", id))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 0:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (blocks == null)
- blocks = U.newHashMap(commState.readSize);
++ blocks = new HashMap<>(commState.readSize, 1.0f);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
+ if (!commState.keyDone) {
- Object _val = commState.getMessage();
++ GridGgfsBlockKey _val = (GridGgfsBlockKey)commState.getMessage(null);
+
- if (_val == MSG_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ commState.cur = _val;
+ commState.keyDone = true;
+ }
+
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ blocks.put((GridGgfsBlockKey)commState.cur, _val);
+
+ commState.keyDone = false;
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+ commState.cur = null;
+
+ commState.idx++;
+
+ case 1:
- IgniteUuid fileId0 = commState.getGridUuid();
++ fileId = commState.getGridUuid("fileId");
+
- if (fileId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- fileId = fileId0;
-
+ commState.idx++;
+
+ case 2:
- if (buf.remaining() < 8)
- return false;
++ id = commState.getLong("id");
+
- id = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 67;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsCommunicationMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsCommunicationMessage.java
index 0000000,b4bedd8..dc0b4a9
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsCommunicationMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsCommunicationMessage.java
@@@ -1,0 -1,75 +1,75 @@@
+ /*
+ * 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.fs;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.marshaller.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.jetbrains.annotations.*;
+
+ import java.nio.*;
+
+ /**
+ * Base class for all GGFS communication messages sent between nodes.
+ */
+ public abstract class GridGgfsCommunicationMessage extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ }
+
+ /**
+ * @param marsh Marshaller.
+ * @throws IgniteCheckedException In case of error.
+ */
+ public void prepareMarshal(IgniteMarshaller marsh) throws IgniteCheckedException {
+ // No-op.
+ }
+
+ /**
+ * @param marsh Marshaller.
+ * @param ldr Class loader.
+ * @throws IgniteCheckedException In case of error.
+ */
+ public void finishUnmarshal(IgniteMarshaller marsh, @Nullable ClassLoader ldr) throws IgniteCheckedException {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ return true;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteMessage.java
index 0000000,2b565c6..cc64415
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteMessage.java
@@@ -1,0 -1,206 +1,202 @@@
+ /*
+ * 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.fs;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.marshaller.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Indicates that entry scheduled for delete was actually deleted.
+ */
+ public class GridGgfsDeleteMessage extends GridGgfsCommunicationMessage {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Deleted entry ID. */
+ private IgniteUuid id;
+
+ /** Optional error. */
+ @GridDirectTransient
+ private IgniteCheckedException err;
+
+ /** */
+ private byte[] errBytes;
+
+ /**
+ * {@link Externalizable} support.
+ */
+ public GridGgfsDeleteMessage() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param id Deleted entry ID.
+ */
+ public GridGgfsDeleteMessage(IgniteUuid id) {
+ assert id != null;
+
+ this.id = id;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param id Entry ID.
+ * @param err Error.
+ */
+ public GridGgfsDeleteMessage(IgniteUuid id, IgniteCheckedException err) {
+ assert err != null;
+
+ this.id = id;
+ this.err = err;
+ }
+
+ /**
+ * @return Deleted entry ID.
+ */
+ public IgniteUuid id() {
+ return id;
+ }
+
+ /**
+ * @return Error.
+ */
+ public IgniteCheckedException error() {
+ return err;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void prepareMarshal(IgniteMarshaller marsh) throws IgniteCheckedException {
+ super.prepareMarshal(marsh);
+
+ if (err != null)
+ errBytes = marsh.marshal(err);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(IgniteMarshaller marsh, @Nullable ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(marsh, ldr);
+
+ if (errBytes != null)
+ err = marsh.unmarshal(errBytes, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridGgfsDeleteMessage _clone = new GridGgfsDeleteMessage();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridGgfsDeleteMessage _clone = (GridGgfsDeleteMessage)_msg;
+
+ _clone.id = id;
+ _clone.err = err;
+ _clone.errBytes = errBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putByteArray(errBytes))
++ if (!commState.putByteArray("errBytes", errBytes))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putGridUuid(id))
++ if (!commState.putGridUuid("id", id))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 0:
- byte[] errBytes0 = commState.getByteArray();
++ errBytes = commState.getByteArray("errBytes");
+
- if (errBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- errBytes = errBytes0;
-
+ commState.idx++;
+
+ case 1:
- IgniteUuid id0 = commState.getGridUuid();
++ id = commState.getGridUuid("id");
+
- if (id0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- id = id0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 68;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridGgfsDeleteMessage.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileAffinityRange.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileAffinityRange.java
index 0000000,3474ac0..6fb4699
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileAffinityRange.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileAffinityRange.java
@@@ -1,0 -1,396 +1,394 @@@
+ /*
+ * 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.fs;
+
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Affinity range.
+ */
+ public class GridGgfsFileAffinityRange extends GridTcpCommunicationMessageAdapter implements Externalizable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Initial range status, right after creation. */
+ public static final int RANGE_STATUS_INITIAL = 0;
+
+ /** Moving range state. Fragmentizer started blocks copy. */
+ public static final int RANGE_STATUS_MOVING = 1;
+
+ /** Fragmentizer finished block copy for this range. */
+ public static final int RANGE_STATUS_MOVED = 2;
+
+ /** Range affinity key. */
+ private IgniteUuid affKey;
+
+ /** {@code True} if currently being moved by fragmentizer. */
+ @SuppressWarnings("RedundantFieldInitialization")
+ private int status = RANGE_STATUS_INITIAL;
+
+ /** Range start offset (divisible by block size). */
+ private long startOff;
+
+ /** Range end offset (endOff + 1 divisible by block size). */
+ private long endOff;
+
+ /** Transient flag indicating no further writes should be made to this range. */
+ private boolean done;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridGgfsFileAffinityRange() {
+ // No-op.
+ }
+
+ /**
+ * @param startOff Start offset.
+ * @param endOff End offset.
+ * @param affKey Affinity key.
+ */
+ GridGgfsFileAffinityRange(long startOff, long endOff, IgniteUuid affKey) {
+ this.startOff = startOff;
+ this.endOff = endOff;
+ this.affKey = affKey;
+ }
+
+ /**
+ * Creates new range with updated status.
+ *
+ * @param other Initial range.
+ * @param status Updated status.
+ */
+ GridGgfsFileAffinityRange(GridGgfsFileAffinityRange other, int status) {
+ startOff = other.startOff;
+ endOff = other.endOff;
+ affKey = other.affKey;
+
+ this.status = status;
+ }
+
+ /**
+ * @return Affinity key for this range.
+ */
+ public IgniteUuid affinityKey() {
+ return affKey;
+ }
+
+ /**
+ * @return Range start offset.
+ */
+ public long startOffset() {
+ return startOff;
+ }
+
+ /**
+ * @return Range end offset.
+ */
+ public long endOffset() {
+ return endOff;
+ }
+
+ /**
+ * @param blockStartOff Block start offset to check.
+ * @return {@code True} if block with given start offset belongs to this range.
+ */
+ public boolean belongs(long blockStartOff) {
+ return blockStartOff >= startOff && blockStartOff < endOff;
+ }
+
+ /**
+ * @param blockStartOff Block start offset to check.
+ * @return {@code True} if block with given start offset is located before this range.
+ */
+ public boolean less(long blockStartOff) {
+ return blockStartOff < startOff;
+ }
+
+ /**
+ * @param blockStartOff Block start offset to check.
+ * @return {@code True} if block with given start offset is located after this range.
+ */
+ public boolean greater(long blockStartOff) {
+ return blockStartOff > endOff;
+ }
+
+ /**
+ * @return If range is empty, i.e. has zero length.
+ */
+ public boolean empty() {
+ return startOff == endOff;
+ }
+
+ /**
+ * @return Range status.
+ */
+ public int status() {
+ return status;
+ }
+
+ /**
+ * Expands this range by given block.
+ *
+ * @param blockStartOff Offset of block start.
+ * @param expansionSize Block size.
+ */
+ public void expand(long blockStartOff, int expansionSize) {
+ // If we are expanding empty range.
+ if (endOff == startOff) {
+ assert endOff == blockStartOff : "Failed to expand range [endOff=" + endOff +
+ ", blockStartOff=" + blockStartOff + ", expansionSize=" + expansionSize + ']';
+
+ endOff += expansionSize - 1;
+ }
+ else {
+ assert endOff == blockStartOff - 1;
+
+ endOff += expansionSize;
+ }
+ }
+
+ /**
+ * Splits range into collection if smaller ranges with length equal to {@code maxSize}.
+ *
+ * @param maxSize Split part maximum size.
+ * @return Collection of range parts.
+ */
+ public Collection<GridGgfsFileAffinityRange> split(long maxSize) {
+ long len = endOff - startOff + 1;
+
+ if (len > maxSize) {
+ int size = (int)(len / maxSize + 1);
+
+ Collection<GridGgfsFileAffinityRange> res = new ArrayList<>(size);
+
+ long pos = startOff;
+
+ while (pos < endOff + 1) {
+ long end = Math.min(pos + maxSize - 1, endOff);
+
+ GridGgfsFileAffinityRange part = new GridGgfsFileAffinityRange(pos, end, affKey);
+
+ part.status = status;
+
+ res.add(part);
+
+ pos = end + 1;
+ }
+
+ return res;
+ }
+ else
+ return Collections.singletonList(this);
+ }
+
+ /**
+ * Tries to concatenate this range with a given one. If ranges are not adjacent, will return {@code null}.
+ *
+ * @param range Range to concatenate with.
+ * @return Concatenation result or {@code null} if ranges are not adjacent.
+ */
+ @Nullable public GridGgfsFileAffinityRange concat(GridGgfsFileAffinityRange range) {
+ if (endOff + 1 != range.startOff || !F.eq(affKey, range.affKey) || status != RANGE_STATUS_INITIAL)
+ return null;
+
+ return new GridGgfsFileAffinityRange(startOff, range.endOff, affKey);
+ }
+
+ /**
+ * Marks this range as done.
+ */
+ public void markDone() {
+ done = true;
+ }
+
+ /**
+ * @return Done flag.
+ */
+ public boolean done() {
+ return done;
+ }
+
+ /**
+ * Checks if range regions are equal.
+ *
+ * @param other Other range to check against.
+ * @return {@code True} if range regions are equal.
+ */
+ public boolean regionEqual(GridGgfsFileAffinityRange other) {
+ return startOff == other.startOff && endOff == other.endOff;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ U.writeGridUuid(out, affKey);
+
+ out.writeInt(status);
+
+ out.writeLong(startOff);
+ out.writeLong(endOff);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ affKey = U.readGridUuid(in);
+
+ status = in.readInt();
+
+ startOff = in.readLong();
+ endOff = in.readLong();
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridGgfsFileAffinityRange _clone = new GridGgfsFileAffinityRange();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridGgfsFileAffinityRange _clone = (GridGgfsFileAffinityRange)_msg;
+
+ _clone.affKey = affKey;
+ _clone.status = status;
+ _clone.startOff = startOff;
+ _clone.endOff = endOff;
+ _clone.done = done;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("fallthrough")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putGridUuid(affKey))
++ if (!commState.putGridUuid("affKey", affKey))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putBoolean(done))
++ if (!commState.putBoolean("done", done))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putLong(endOff))
++ if (!commState.putLong("endOff", endOff))
+ return false;
+
+ commState.idx++;
+
+ case 3:
- if (!commState.putLong(startOff))
++ if (!commState.putLong("startOff", startOff))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putInt(status))
++ if (!commState.putInt("status", status))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("fallthrough")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- IgniteUuid affKey0 = commState.getGridUuid();
++ affKey = commState.getGridUuid("affKey");
+
- if (affKey0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- affKey = affKey0;
-
+ commState.idx++;
+
+ case 1:
- if (buf.remaining() < 1)
- return false;
++ done = commState.getBoolean("done");
+
- done = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 2:
- if (buf.remaining() < 8)
- return false;
++ endOff = commState.getLong("endOff");
+
- endOff = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 3:
- if (buf.remaining() < 8)
- return false;
++ startOff = commState.getLong("startOff");
+
- startOff = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 4:
- if (buf.remaining() < 4)
- return false;
++ status = commState.getInt("status");
+
- status = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 69;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridGgfsFileAffinityRange.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java
index 0000000,3224340..37954a3
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerRequest.java
@@@ -1,0 -1,212 +1,210 @@@
+ /*
+ * 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.fs;
+
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.apache.ignite.internal.util.tostring.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Fragmentizer request. Sent from coordinator to other GGFS nodes when colocated part of file
+ * should be fragmented.
+ */
+ public class GridGgfsFragmentizerRequest extends GridGgfsCommunicationMessage {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** File id. */
+ private IgniteUuid fileId;
+
+ /** Ranges to fragment. */
+ @GridToStringInclude
+ @GridDirectCollection(GridGgfsFileAffinityRange.class)
+ private Collection<GridGgfsFileAffinityRange> fragmentRanges;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridGgfsFragmentizerRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param fileId File id to fragment.
+ * @param fragmentRanges Ranges to fragment.
+ */
+ public GridGgfsFragmentizerRequest(IgniteUuid fileId, Collection<GridGgfsFileAffinityRange> fragmentRanges) {
+ this.fileId = fileId;
+ this.fragmentRanges = fragmentRanges;
+ }
+
+ /**
+ * @return File ID.
+ */
+ public IgniteUuid fileId() {
+ return fileId;
+ }
+
+ /**
+ * @return Fragment ranges.
+ */
+ public Collection<GridGgfsFileAffinityRange> fragmentRanges() {
+ return fragmentRanges;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridGgfsFragmentizerRequest.class, this);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridGgfsFragmentizerRequest _clone = new GridGgfsFragmentizerRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridGgfsFragmentizerRequest _clone = (GridGgfsFragmentizerRequest)_msg;
+
+ _clone.fileId = fileId;
+ _clone.fragmentRanges = fragmentRanges;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putGridUuid(fileId))
++ if (!commState.putGridUuid("fileId", fileId))
+ return false;
+
+ commState.idx++;
+
+ case 1:
+ if (fragmentRanges != null) {
+ if (commState.it == null) {
- if (!commState.putInt(fragmentRanges.size()))
++ if (!commState.putInt(null, fragmentRanges.size()))
+ return false;
+
+ commState.it = fragmentRanges.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putMessage((GridGgfsFileAffinityRange)commState.cur))
++ if (!commState.putMessage(null, (GridGgfsFileAffinityRange)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 0:
- IgniteUuid fileId0 = commState.getGridUuid();
++ fileId = commState.getGridUuid("fileId");
+
- if (fileId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- fileId = fileId0;
-
+ commState.idx++;
+
+ case 1:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (fragmentRanges == null)
+ fragmentRanges = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- Object _val = commState.getMessage();
++ GridGgfsFileAffinityRange _val = (GridGgfsFileAffinityRange)commState.getMessage(null);
+
- if (_val == MSG_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ fragmentRanges.add((GridGgfsFileAffinityRange)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 70;
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerResponse.java
index 0000000,641cdcc..19a04d2
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerResponse.java
@@@ -1,0 -1,131 +1,129 @@@
+ /*
+ * 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.fs;
+
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Fragmentizer response.
+ */
+ public class GridGgfsFragmentizerResponse extends GridGgfsCommunicationMessage {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** File ID. */
+ private IgniteUuid fileId;
+
+ /**
+ * Empty constructor required for {@link Externalizable}.
+ */
+ public GridGgfsFragmentizerResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param fileId File ID.
+ */
+ public GridGgfsFragmentizerResponse(IgniteUuid fileId) {
+ this.fileId = fileId;
+ }
+
+ /**
+ * @return File ID.
+ */
+ public IgniteUuid fileId() {
+ return fileId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridGgfsFragmentizerResponse _clone = new GridGgfsFragmentizerResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridGgfsFragmentizerResponse _clone = (GridGgfsFragmentizerResponse)_msg;
+
+ _clone.fileId = fileId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putGridUuid(fileId))
++ if (!commState.putGridUuid("fileId", fileId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 0:
- IgniteUuid fileId0 = commState.getGridUuid();
++ fileId = commState.getGridUuid("fileId");
+
- if (fileId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- fileId = fileId0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 71;
+ }
+ }
[27/52] [abbrv] incubator-ignite git commit: IGNITE-109 - Merge
branch 'ignite-109' into sprint-1
Posted by vk...@apache.org.
IGNITE-109 - Merge branch 'ignite-109' into sprint-1
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/61a9f986
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/61a9f986
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/61a9f986
Branch: refs/heads/ignite-61
Commit: 61a9f986a918052aae159e21ca37693491d34382
Parents: 4fe57d4 e4cd632
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Thu Jan 29 19:04:38 2015 -0800
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Thu Jan 29 19:04:38 2015 -0800
----------------------------------------------------------------------
.../processors/cache/GridCacheStoreManager.java | 25 +-
.../transactions/IgniteTxLocalAdapter.java | 42 ++-
.../IgniteCrossCacheTxStoreSelfTest.java | 288 +++++++++++++++++++
.../IgniteCacheTxStoreSessionTest.java | 11 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 1 +
5 files changed, 357 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/61a9f986/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
[26/52] [abbrv] incubator-ignite git commit: # ignite-sprint-1 fixed
build.
Posted by vk...@apache.org.
# ignite-sprint-1 fixed build.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4fe57d44
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4fe57d44
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4fe57d44
Branch: refs/heads/ignite-61
Commit: 4fe57d44373294700dcdeb42206bd525ce84475a
Parents: bdebb40
Author: AKuznetsov <ak...@gridgain.com>
Authored: Fri Jan 30 09:55:21 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Fri Jan 30 09:55:21 2015 +0700
----------------------------------------------------------------------
assembly/release-hadoop.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4fe57d44/assembly/release-hadoop.xml
----------------------------------------------------------------------
diff --git a/assembly/release-hadoop.xml b/assembly/release-hadoop.xml
index 7dbd5ea..576425c 100644
--- a/assembly/release-hadoop.xml
+++ b/assembly/release-hadoop.xml
@@ -39,15 +39,15 @@
<outputDirectory>/docs</outputDirectory>
</file>
<file>
- <source>docs/core-site.gridgain.xml</source>
+ <source>docs/core-site.ignite.xml</source>
<outputDirectory>/docs</outputDirectory>
</file>
<file>
- <source>docs/mapred-site.gridgain.xml</source>
+ <source>docs/mapred-site.ignite.xml</source>
<outputDirectory>/docs</outputDirectory>
</file>
<file>
- <source>docs/hive-site.gridgain.xml</source>
+ <source>docs/hive-site.ignite.xml</source>
<outputDirectory>/docs</outputDirectory>
</file>
</files>
[38/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
index 0000000,0ea9769..73fcb03
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
@@@ -1,0 -1,339 +1,333 @@@
+ /*
+ * 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.cache.distributed.dht.preloader;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Force keys response. Contains absent keys.
+ */
+ public class GridDhtForceKeysResponse<K, V> extends GridCacheMessage<K, V> implements GridCacheDeployable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /** Mini-future ID. */
+ private IgniteUuid miniId;
+
+ /** */
+ @GridDirectCollection(byte[].class)
+ private Collection<byte[]> missedKeyBytes;
+
+ /** Missed (not found) keys. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<K> missedKeys;
+
+ /** Cache entries. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private List<GridCacheEntryInfo<K, V>> infos;
+
+ /** */
+ private byte[] infosBytes;
+
+ /**
+ * Required by {@link Externalizable}.
+ */
+ public GridDhtForceKeysResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param futId Request id.
+ * @param miniId Mini-future ID.
+ */
+ public GridDhtForceKeysResponse(int cacheId, IgniteUuid futId, IgniteUuid miniId) {
+ assert futId != null;
+ assert miniId != null;
+
+ this.cacheId = cacheId;
+ this.futId = futId;
+ this.miniId = miniId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean allowForStartup() {
+ return true;
+ }
+
+ /**
+ * @return Keys.
+ */
+ public Collection<K> missedKeys() {
+ return missedKeys == null ? Collections.<K>emptyList() : missedKeys;
+ }
+
+ /**
+ * @return Forced entries.
+ */
+ public Collection<GridCacheEntryInfo<K, V>> forcedInfos() {
+ return infos == null ? Collections.<GridCacheEntryInfo<K,V>>emptyList() : infos;
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Mini-future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @param key Key.
+ */
+ public void addMissed(K key) {
+ if (missedKeys == null)
+ missedKeys = new ArrayList<>();
+
+ missedKeys.add(key);
+ }
+
+ /**
+ * @param info Entry info to add.
+ */
+ public void addInfo(GridCacheEntryInfo<K, V> info) {
+ assert info != null;
+
+ if (infos == null)
+ infos = new ArrayList<>();
+
+ infos.add(info);
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (missedKeys != null && missedKeyBytes == null)
+ missedKeyBytes = marshalCollection(missedKeys, ctx);
+
+ if (infos != null) {
+ marshalInfos(infos, ctx);
+
+ infosBytes = ctx.marshaller().marshal(infos);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (missedKeys == null && missedKeyBytes != null)
+ missedKeys = unmarshalCollection(missedKeyBytes, ctx, ldr);
+
+ if (infosBytes != null) {
+ infos = ctx.marshaller().unmarshal(infosBytes, ldr);
+
+ unmarshalInfos(infos, ctx.cacheContext(cacheId()), ldr);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtForceKeysResponse _clone = new GridDhtForceKeysResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtForceKeysResponse _clone = (GridDhtForceKeysResponse)_msg;
+
+ _clone.futId = futId;
+ _clone.miniId = miniId;
+ _clone.missedKeyBytes = missedKeyBytes;
+ _clone.missedKeys = missedKeys;
+ _clone.infos = infos;
+ _clone.infosBytes = infosBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putByteArray(infosBytes))
++ if (!commState.putByteArray("infosBytes", infosBytes))
+ return false;
+
+ commState.idx++;
+
+ case 5:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 6:
+ if (missedKeyBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(missedKeyBytes.size()))
++ if (!commState.putInt(null, missedKeyBytes.size()))
+ return false;
+
+ commState.it = missedKeyBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
- IgniteUuid futId0 = commState.getGridUuid();
++ futId = commState.getGridUuid("futId");
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ case 4:
- byte[] infosBytes0 = commState.getByteArray();
++ infosBytes = commState.getByteArray("infosBytes");
+
- if (infosBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- infosBytes = infosBytes0;
-
+ commState.idx++;
+
+ case 5:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 6:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (missedKeyBytes == null)
+ missedKeyBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ missedKeyBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 42;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtForceKeysResponse.class, this, super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java
index 0000000,29568c9..bf41e14
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java
@@@ -1,0 -1,390 +1,388 @@@
+ /*
+ * 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.cache.distributed.dht.preloader;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Partition demand request.
+ */
+ public class GridDhtPartitionDemandMessage<K, V> extends GridCacheMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Update sequence. */
+ private long updateSeq;
+
+ /** Partition. */
+ @GridToStringInclude
+ @GridDirectCollection(int.class)
+ private Set<Integer> parts;
+
+ /** Topic. */
+ @GridDirectTransient
+ private Object topic;
+
+ /** Serialized topic. */
+ private byte[] topicBytes;
+
+ /** Timeout. */
+ private long timeout;
+
+ /** Worker ID. */
+ private int workerId = -1;
+
+ /** Topology version. */
+ private long topVer;
+
+ /**
+ * @param updateSeq Update sequence for this node.
+ * @param topVer Topology version.
+ */
+ GridDhtPartitionDemandMessage(long updateSeq, long topVer, int cacheId) {
+ assert updateSeq > 0;
+
+ this.cacheId = cacheId;
+ this.updateSeq = updateSeq;
+ this.topVer = topVer;
+ }
+
+ /**
+ * @param cp Message to copy from.
+ */
+ GridDhtPartitionDemandMessage(GridDhtPartitionDemandMessage<K, V> cp, Collection<Integer> parts) {
+ cacheId = cp.cacheId;
+ updateSeq = cp.updateSeq;
+ topic = cp.topic;
+ timeout = cp.timeout;
+ workerId = cp.workerId;
+ topVer = cp.topVer;
+
+ // Create a copy of passed in collection since it can be modified when this message is being sent.
+ this.parts = new HashSet<>(parts);
+ }
+
+ /**
+ * Empty constructor required for {@link Externalizable}.
+ */
+ public GridDhtPartitionDemandMessage() {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean allowForStartup() {
+ return true;
+ }
+
+ /**
+ * @param p Partition.
+ */
+ void addPartition(int p) {
+ if (parts == null)
+ parts = new HashSet<>();
+
+ parts.add(p);
+ }
+
+
+ /**
+ * @return Partition.
+ */
+ Set<Integer> partitions() {
+ return parts;
+ }
+
+ /**
+ * @return Update sequence.
+ */
+ long updateSequence() {
+ return updateSeq;
+ }
+
+ /**
+ * @return Reply message timeout.
+ */
+ long timeout() {
+ return timeout;
+ }
+
+ /**
+ * @param timeout Timeout.
+ */
+ void timeout(long timeout) {
+ this.timeout = timeout;
+ }
+
+ /**
+ * @return Topic.
+ */
+ Object topic() {
+ return topic;
+ }
+
+ /**
+ * @param topic Topic.
+ */
+ void topic(Object topic) {
+ this.topic = topic;
+ }
+
+ /**
+ * @return Worker ID.
+ */
+ int workerId() {
+ return workerId;
+ }
+
+ /**
+ * @param workerId Worker ID.
+ */
+ void workerId(int workerId) {
+ this.workerId = workerId;
+ }
+
+ /**
+ * @return Topology version for which demand message is sent.
+ */
+ @Override public long topologyVersion() {
+ return topVer;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (topic != null)
+ topicBytes = ctx.marshaller().marshal(topic);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (topicBytes != null)
+ topic = ctx.marshaller().unmarshal(topicBytes, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtPartitionDemandMessage _clone = new GridDhtPartitionDemandMessage();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtPartitionDemandMessage _clone = (GridDhtPartitionDemandMessage)_msg;
+
+ _clone.updateSeq = updateSeq;
+ _clone.parts = parts;
+ _clone.topic = topic;
+ _clone.topicBytes = topicBytes;
+ _clone.timeout = timeout;
+ _clone.workerId = workerId;
+ _clone.topVer = topVer;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
+ if (parts != null) {
+ if (commState.it == null) {
- if (!commState.putInt(parts.size()))
++ if (!commState.putInt(null, parts.size()))
+ return false;
+
+ commState.it = parts.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putInt((int)commState.cur))
++ if (!commState.putInt(null, (int)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putLong(timeout))
++ if (!commState.putLong("timeout", timeout))
+ return false;
+
+ commState.idx++;
+
+ case 5:
- if (!commState.putLong(topVer))
++ if (!commState.putLong("topVer", topVer))
+ return false;
+
+ commState.idx++;
+
+ case 6:
- if (!commState.putByteArray(topicBytes))
++ if (!commState.putByteArray("topicBytes", topicBytes))
+ return false;
+
+ commState.idx++;
+
+ case 7:
- if (!commState.putLong(updateSeq))
++ if (!commState.putLong("updateSeq", updateSeq))
+ return false;
+
+ commState.idx++;
+
+ case 8:
- if (!commState.putInt(workerId))
++ if (!commState.putInt("workerId", workerId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (parts == null)
+ parts = new HashSet<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- if (buf.remaining() < 4)
- return false;
++ int _val = commState.getInt(null);
+
- int _val = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ parts.add((Integer)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 4:
- if (buf.remaining() < 8)
- return false;
++ timeout = commState.getLong("timeout");
+
- timeout = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 5:
- if (buf.remaining() < 8)
- return false;
++ topVer = commState.getLong("topVer");
+
- topVer = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 6:
- byte[] topicBytes0 = commState.getByteArray();
++ topicBytes = commState.getByteArray("topicBytes");
+
- if (topicBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- topicBytes = topicBytes0;
-
+ commState.idx++;
+
+ case 7:
- if (buf.remaining() < 8)
- return false;
++ updateSeq = commState.getLong("updateSeq");
+
- updateSeq = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 8:
- if (buf.remaining() < 4)
- return false;
++ workerId = commState.getInt("workerId");
+
- workerId = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 43;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtPartitionDemandMessage.class, this, "partCnt", parts.size(), "super",
+ super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
index 0000000,b1c6f45..417ab84
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplyMessage.java
@@@ -1,0 -1,519 +1,517 @@@
+ /*
+ * 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.cache.distributed.dht.preloader;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Partition supply message.
+ */
+ public class GridDhtPartitionSupplyMessage<K, V> extends GridCacheMessage<K, V> implements GridCacheDeployable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Worker ID. */
+ private int workerId = -1;
+
+ /** Update sequence. */
+ private long updateSeq;
+
+ /** Acknowledgement flag. */
+ private boolean ack;
+
+ /** Partitions that have been fully sent. */
+ @GridDirectCollection(int.class)
+ private Set<Integer> last;
+
+ /** Partitions which were not found. */
+ @GridToStringInclude
+ @GridDirectCollection(int.class)
+ private Set<Integer> missed;
+
+ /** Entries. */
+ @GridDirectTransient
+ private Map<Integer, Collection<GridCacheEntryInfo<K, V>>> infos = new HashMap<>();
+
+ /** Cache entries in serialized form. */
+ @GridToStringExclude
+ @GridDirectTransient
+ private Map<Integer, Collection<byte[]>> infoBytesMap = new HashMap<>();
+
+ /** */
+ private byte[] infoBytes;
+
+ /** Message size. */
+ @GridDirectTransient
+ private int msgSize;
+
+ /**
+ * @param workerId Worker ID.
+ * @param updateSeq Update sequence for this node.
+ */
+ GridDhtPartitionSupplyMessage(int workerId, long updateSeq, int cacheId) {
+ assert workerId >= 0;
+ assert updateSeq > 0;
+
+ this.cacheId = cacheId;
+ this.updateSeq = updateSeq;
+ this.workerId = workerId;
+ }
+
+ /**
+ * Empty constructor required for {@link Externalizable}.
+ */
+ public GridDhtPartitionSupplyMessage() {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean allowForStartup() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean ignoreClassErrors() {
+ return true;
+ }
+
+ /**
+ * @return Worker ID.
+ */
+ int workerId() {
+ return workerId;
+ }
+
+ /**
+ * @return Update sequence.
+ */
+ long updateSequence() {
+ return updateSeq;
+ }
+
+ /**
+ * Marks this message for acknowledgment.
+ */
+ void markAck() {
+ ack = true;
+ }
+
+ /**
+ * @return Acknowledgement flag.
+ */
+ boolean ack() {
+ return ack;
+ }
+
+ /**
+ * @return Flag to indicate last message for partition.
+ */
+ Set<Integer> last() {
+ return last == null ? Collections.<Integer>emptySet() : last;
+ }
+
+ /**
+ * @param p Partition which was fully sent.
+ */
+ void last(int p) {
+ if (last == null)
+ last = new HashSet<>();
+
+ if (last.add(p)) {
+ msgSize += 4;
+
+ // If partition is empty, we need to add it.
+ Collection<byte[]> serInfo = infoBytesMap.get(p);
+
+ if (serInfo == null)
+ infoBytesMap.put(p, new LinkedList<byte[]>());
+ }
+ }
+
+ /**
+ * @param p Missed partition.
+ */
+ void missed(int p) {
+ if (missed == null)
+ missed = new HashSet<>();
+
+ if (missed.add(p))
+ msgSize += 4;
+ }
+
+ /**
+ * @return Missed partitions.
+ */
+ Set<Integer> missed() {
+ return missed == null ? Collections.<Integer>emptySet() : missed;
+ }
+
+ /**
+ * @return Entries.
+ */
+ Map<Integer, Collection<GridCacheEntryInfo<K, V>>> infos() {
+ return infos;
+ }
+
+ /**
+ * @return Message size.
+ */
+ int messageSize() {
+ return msgSize;
+ }
+
+ /**
+ * @param p Partition.
+ * @param info Entry to add.
+ * @param ctx Cache context.
+ * @throws IgniteCheckedException If failed.
+ */
+ void addEntry(int p, GridCacheEntryInfo<K, V> info, GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ assert info != null;
+
+ marshalInfo(info, ctx);
+
+ byte[] bytes = CU.marshal(ctx, info);
+
+ msgSize += bytes.length;
+
+ Collection<byte[]> serInfo = infoBytesMap.get(p);
+
+ if (serInfo == null) {
+ msgSize += 4;
+
+ infoBytesMap.put(p, serInfo = new LinkedList<>());
+ }
+
+ serInfo.add(bytes);
+ }
+
+ /**
+ * @param p Partition.
+ * @param info Entry to add.
+ * @param ctx Cache context.
+ * @throws IgniteCheckedException If failed.
+ */
+ void addEntry0(int p, GridCacheEntryInfo<K, V> info, GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ assert info != null;
+ assert info.keyBytes() != null;
+ assert info.valueBytes() != null || info.value() instanceof byte[] :
+ "Missing value bytes with invalid value: " + info.value();
+
+ // Need to call this method to initialize info properly.
+ marshalInfo(info, ctx);
+
+ byte[] bytes = CU.marshal(ctx, info);
+
+ msgSize += bytes.length;
+
+ Collection<byte[]> serInfo = infoBytesMap.get(p);
+
+ if (serInfo == null) {
+ msgSize += 4;
+
+ infoBytesMap.put(p, serInfo = new LinkedList<>());
+ }
+
+ serInfo.add(bytes);
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ infoBytes = ctx.marshaller().marshal(infoBytesMap);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ infoBytesMap = ctx.marshaller().unmarshal(infoBytes, ldr);
+
+ GridCacheContext<K, V> cacheCtx = ctx.cacheContext(cacheId);
+
+ for (Map.Entry<Integer, Collection<byte[]>> e : infoBytesMap.entrySet()) {
+ Collection<GridCacheEntryInfo<K, V>> entries = unmarshalCollection(e.getValue(), ctx, ldr);
+
+ unmarshalInfos(entries, cacheCtx, ldr);
+
+ infos.put(e.getKey(), entries);
+ }
+ }
+
+ /**
+ * @return Number of entries in message.
+ */
+ public int size() {
+ return infos.isEmpty() ? infoBytesMap.size() : infos.size();
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtPartitionSupplyMessage _clone = new GridDhtPartitionSupplyMessage();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtPartitionSupplyMessage _clone = (GridDhtPartitionSupplyMessage)_msg;
+
+ _clone.workerId = workerId;
+ _clone.updateSeq = updateSeq;
+ _clone.ack = ack;
+ _clone.last = last;
+ _clone.missed = missed;
+ _clone.infos = infos;
+ _clone.infoBytesMap = infoBytesMap;
+ _clone.infoBytes = infoBytes;
+ _clone.msgSize = msgSize;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
- if (!commState.putBoolean(ack))
++ if (!commState.putBoolean("ack", ack))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putByteArray(infoBytes))
++ if (!commState.putByteArray("infoBytes", infoBytes))
+ return false;
+
+ commState.idx++;
+
+ case 5:
+ if (last != null) {
+ if (commState.it == null) {
- if (!commState.putInt(last.size()))
++ if (!commState.putInt(null, last.size()))
+ return false;
+
+ commState.it = last.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putInt((int)commState.cur))
++ if (!commState.putInt(null, (int)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 6:
+ if (missed != null) {
+ if (commState.it == null) {
- if (!commState.putInt(missed.size()))
++ if (!commState.putInt(null, missed.size()))
+ return false;
+
+ commState.it = missed.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putInt((int)commState.cur))
++ if (!commState.putInt(null, (int)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 7:
- if (!commState.putLong(updateSeq))
++ if (!commState.putLong("updateSeq", updateSeq))
+ return false;
+
+ commState.idx++;
+
+ case 8:
- if (!commState.putInt(workerId))
++ if (!commState.putInt("workerId", workerId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
- if (buf.remaining() < 1)
- return false;
++ ack = commState.getBoolean("ack");
+
- ack = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 4:
- byte[] infoBytes0 = commState.getByteArray();
++ infoBytes = commState.getByteArray("infoBytes");
+
- if (infoBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- infoBytes = infoBytes0;
-
+ commState.idx++;
+
+ case 5:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (last == null)
+ last = new HashSet<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- if (buf.remaining() < 4)
- return false;
++ int _val = commState.getInt(null);
+
- int _val = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ last.add((Integer)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 6:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (missed == null)
+ missed = new HashSet<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- if (buf.remaining() < 4)
- return false;
++ int _val = commState.getInt(null);
+
- int _val = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ missed.add((Integer)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 7:
- if (buf.remaining() < 8)
- return false;
++ updateSeq = commState.getLong("updateSeq");
+
- updateSeq = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 8:
- if (buf.remaining() < 4)
- return false;
++ workerId = commState.getInt("workerId");
+
- workerId = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 44;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtPartitionSupplyMessage.class, this,
+ "size", size(),
+ "parts", infos.keySet(),
+ "super", super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java
index 0000000,1f55c59..1eb069e
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java
@@@ -1,0 -1,158 +1,154 @@@
+ /*
+ * 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.cache.distributed.dht.preloader;
+
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Request for single partition info.
+ */
+ abstract class GridDhtPartitionsAbstractMessage<K, V> extends GridCacheMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Exchange ID. */
+ private GridDhtPartitionExchangeId exchId;
+
+ /** Last used cache version. */
+ private GridCacheVersion lastVer;
+
+ /**
+ * Required by {@link Externalizable}.
+ */
+ protected GridDhtPartitionsAbstractMessage() {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean allowForStartup() {
+ return true;
+ }
+
+ /**
+ * @param exchId Exchange ID.
+ * @param lastVer Last version.
+ */
+ GridDhtPartitionsAbstractMessage(GridDhtPartitionExchangeId exchId, @Nullable GridCacheVersion lastVer) {
+ this.exchId = exchId;
+ this.lastVer = lastVer;
+ }
+
+ /**
+ * @return Exchange ID.
+ */
+ public GridDhtPartitionExchangeId exchangeId() {
+ return exchId;
+ }
+
+ /**
+ * @return Last used version among all nodes.
+ */
+ @Nullable public GridCacheVersion lastVersion() {
+ return lastVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtPartitionsAbstractMessage _clone = (GridDhtPartitionsAbstractMessage)_msg;
+
+ _clone.exchId = exchId;
+ _clone.lastVer = lastVer;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
- if (!commState.putDhtPartitionExchangeId(exchId))
++ if (!commState.putDhtPartitionExchangeId("exchId", exchId))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putCacheVersion(lastVer))
++ if (!commState.putCacheVersion("lastVer", lastVer))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
- GridDhtPartitionExchangeId exchId0 = commState.getDhtPartitionExchangeId();
++ exchId = commState.getDhtPartitionExchangeId("exchId");
+
- if (exchId0 == DHT_PART_EXCHANGE_ID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- exchId = exchId0;
-
+ commState.idx++;
+
+ case 4:
- GridCacheVersion lastVer0 = commState.getCacheVersion();
++ lastVer = commState.getCacheVersion("lastVer");
+
- if (lastVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- lastVer = lastVer0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtPartitionsAbstractMessage.class, this, super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
index 0000000,3f8cefb..ec138fd
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
@@@ -1,0 -1,259 +1,255 @@@
+ /*
+ * 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.cache.distributed.dht.preloader;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.cluster.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Information about partitions of all nodes in topology.
+ */
+ public class GridDhtPartitionsFullMessage<K, V> extends GridDhtPartitionsAbstractMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Map<Integer, GridDhtPartitionFullMap> parts = new HashMap<>();
+
+ /** */
+ private byte[] partsBytes;
+
+ /** Topology version. */
+ private long topVer;
+
+ @GridDirectTransient
+ private List<List<ClusterNode>> affAssignment;
+
+ /** */
+ private byte[] affAssignmentBytes;
+
+ /**
+ * Required by {@link Externalizable}.
+ */
+ public GridDhtPartitionsFullMessage() {
+ // No-op.
+ }
+
+ /**
+ * @param id Exchange ID.
+ * @param lastVer Last version.
+ */
+ public GridDhtPartitionsFullMessage(@Nullable GridDhtPartitionExchangeId id, @Nullable GridCacheVersion lastVer,
+ long topVer) {
+ super(id, lastVer);
+
+ assert parts != null;
+ assert id == null || topVer == id.topologyVersion();
+
+ this.topVer = topVer;
+ }
+
+ /**
+ * @return Local partitions.
+ */
+ public Map<Integer, GridDhtPartitionFullMap> partitions() {
+ return parts;
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param fullMap Full partitions map.
+ */
+ public void addFullPartitionsMap(int cacheId, GridDhtPartitionFullMap fullMap) {
+ parts.put(cacheId, fullMap);
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (parts != null)
+ partsBytes = ctx.marshaller().marshal(parts);
+
+ if (affAssignment != null)
+ affAssignmentBytes = ctx.marshaller().marshal(affAssignment);
+ }
+
+ /**
+ * @return Topology version.
+ */
+ @Override public long topologyVersion() {
+ return topVer;
+ }
+
+ /**
+ * @param topVer Topology version.
+ */
+ public void topologyVersion(long topVer) {
+ this.topVer = topVer;
+ }
+
+ /**
+ * @return Affinity assignment for topology version.
+ */
+ public List<List<ClusterNode>> affinityAssignment() {
+ return affAssignment;
+ }
+
+ /**
+ * @param affAssignment Affinity assignment for topology version.
+ */
+ public void affinityAssignment(List<List<ClusterNode>> affAssignment) {
+ this.affAssignment = affAssignment;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (partsBytes != null)
+ parts = ctx.marshaller().unmarshal(partsBytes, ldr);
+
+ if (affAssignmentBytes != null)
+ affAssignment = ctx.marshaller().unmarshal(affAssignmentBytes, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtPartitionsFullMessage _clone = new GridDhtPartitionsFullMessage();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtPartitionsFullMessage _clone = (GridDhtPartitionsFullMessage)_msg;
+
+ _clone.parts = parts;
+ _clone.partsBytes = partsBytes;
+ _clone.topVer = topVer;
+ _clone.affAssignment = affAssignment;
+ _clone.affAssignmentBytes = affAssignmentBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 5:
- if (!commState.putByteArray(affAssignmentBytes))
++ if (!commState.putByteArray("affAssignmentBytes", affAssignmentBytes))
+ return false;
+
+ commState.idx++;
+
+ case 6:
- if (!commState.putByteArray(partsBytes))
++ if (!commState.putByteArray("partsBytes", partsBytes))
+ return false;
+
+ commState.idx++;
+
+ case 7:
- if (!commState.putLong(topVer))
++ if (!commState.putLong("topVer", topVer))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 5:
- byte[] affAssignmentBytes0 = commState.getByteArray();
++ affAssignmentBytes = commState.getByteArray("affAssignmentBytes");
+
- if (affAssignmentBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- affAssignmentBytes = affAssignmentBytes0;
-
+ commState.idx++;
+
+ case 6:
- byte[] partsBytes0 = commState.getByteArray();
++ partsBytes = commState.getByteArray("partsBytes");
+
- if (partsBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- partsBytes = partsBytes0;
-
+ commState.idx++;
+
+ case 7:
- if (buf.remaining() < 8)
- return false;
++ topVer = commState.getLong("topVer");
+
- topVer = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 45;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtPartitionsFullMessage.class, this, "partCnt", parts != null ? parts.size() : 0,
+ "super", super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
index 0000000,00fef2b..823f1f6
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
@@@ -1,0 -1,177 +1,175 @@@
+ /*
+ * 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.cache.distributed.dht.preloader;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Information about partitions of a single node.
+ */
+ public class GridDhtPartitionsSingleMessage<K, V> extends GridDhtPartitionsAbstractMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Local partitions. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Map<Integer, GridDhtPartitionMap> parts = new HashMap<>();
+
+ /** Serialized partitions. */
+ private byte[] partsBytes;
+
+ /**
+ * Required by {@link Externalizable}.
+ */
+ public GridDhtPartitionsSingleMessage() {
+ // No-op.
+ }
+
+ /**
+ * @param exchId Exchange ID.
+ * @param lastVer Last version.
+ */
+ public GridDhtPartitionsSingleMessage(GridDhtPartitionExchangeId exchId, @Nullable GridCacheVersion lastVer) {
+ super(exchId, lastVer);
+ }
+
+ /**
+ * Adds partition map to this message.
+ *
+ * @param cacheId Cache ID to add local partition for.
+ * @param locMap Local partition map.
+ */
+ public void addLocalPartitionMap(int cacheId, GridDhtPartitionMap locMap) {
+ parts.put(cacheId, locMap);
+ }
+
+ /**
+ * @return Local partitions.
+ */
+ public Map<Integer, GridDhtPartitionMap> partitions() {
+ return parts;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (parts != null)
+ partsBytes = ctx.marshaller().marshal(parts);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (partsBytes != null)
+ parts = ctx.marshaller().unmarshal(partsBytes, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtPartitionsSingleMessage _clone = new GridDhtPartitionsSingleMessage();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDhtPartitionsSingleMessage _clone = (GridDhtPartitionsSingleMessage)_msg;
+
+ _clone.parts = parts;
+ _clone.partsBytes = partsBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 5:
- if (!commState.putByteArray(partsBytes))
++ if (!commState.putByteArray("partsBytes", partsBytes))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 5:
- byte[] partsBytes0 = commState.getByteArray();
++ partsBytes = commState.getByteArray("partsBytes");
+
- if (partsBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- partsBytes = partsBytes0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 46;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtPartitionsSingleMessage.class, this, super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java
index 0000000,01aeb46..d3fbe40
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java
@@@ -1,0 -1,101 +1,101 @@@
+ /*
+ * 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.cache.distributed.dht.preloader;
+
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Request for single partition info.
+ */
+ public class GridDhtPartitionsSingleRequest<K, V> extends GridDhtPartitionsAbstractMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Required by {@link Externalizable}.
+ */
+ public GridDhtPartitionsSingleRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param id Exchange ID.
+ */
+ GridDhtPartitionsSingleRequest(GridDhtPartitionExchangeId id) {
+ super(id, null);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridDhtPartitionsSingleRequest _clone = new GridDhtPartitionsSingleRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 47;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtPartitionsSingleRequest.class, this, super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
index 0000000,8934704..2a51d59
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
@@@ -1,0 -1,597 +1,588 @@@
+ /*
+ * 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.cache.distributed.near;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.cache.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Get request.
+ */
+ public class GridNearGetRequest<K, V> extends GridCacheMessage<K, V> implements GridCacheDeployable,
+ GridCacheVersionable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /** Sub ID. */
+ private IgniteUuid miniId;
+
+ /** Version. */
+ private GridCacheVersion ver;
+
+ /** */
+ @GridToStringInclude
+ @GridDirectTransient
+ private LinkedHashMap<K, Boolean> keys;
+
+ /** Reload flag. */
+ private boolean reload;
+
+ /** Read through flag. */
+ private boolean readThrough;
+
+ /** */
+ @GridToStringExclude
+ @GridDirectMap(keyType = byte[].class, valueType = boolean.class)
+ private LinkedHashMap<byte[], Boolean> keyBytes;
+
+ /** Filter bytes. */
+ private byte[][] filterBytes;
+
+ /** Topology version. */
+ private long topVer;
+
+ /** Filters. */
+ @GridDirectTransient
+ private IgnitePredicate<CacheEntry<K, V>>[] filter;
+
+ /** Subject ID. */
+ @GridDirectVersion(1)
+ private UUID subjId;
+
+ /** Task name hash. */
+ @GridDirectVersion(2)
+ private int taskNameHash;
+
+ /** TTL for read operation. */
+ private long accessTtl;
+
+ /**
+ * Empty constructor required for {@link Externalizable}.
+ */
+ public GridNearGetRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param futId Future ID.
+ * @param miniId Sub ID.
+ * @param ver Version.
+ * @param keys Keys.
+ * @param readThrough Read through flag.
+ * @param reload Reload flag.
+ * @param topVer Topology version.
+ * @param filter Filter.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash.
+ * @param accessTtl New TTL to set after entry is accessed, -1 to leave unchanged.
+ */
+ public GridNearGetRequest(
+ int cacheId,
+ IgniteUuid futId,
+ IgniteUuid miniId,
+ GridCacheVersion ver,
+ LinkedHashMap<K, Boolean> keys,
+ boolean readThrough,
+ boolean reload,
+ long topVer,
+ IgnitePredicate<CacheEntry<K, V>>[] filter,
+ UUID subjId,
+ int taskNameHash,
+ long accessTtl
+ ) {
+ assert futId != null;
+ assert miniId != null;
+ assert ver != null;
+ assert keys != null;
+
+ this.cacheId = cacheId;
+ this.futId = futId;
+ this.miniId = miniId;
+ this.ver = ver;
+ this.keys = keys;
+ this.readThrough = readThrough;
+ this.reload = reload;
+ this.topVer = topVer;
+ this.filter = filter;
+ this.subjId = subjId;
+ this.taskNameHash = taskNameHash;
+ this.accessTtl = accessTtl;
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Sub ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @return Subject ID.
+ */
+ public UUID subjectId() {
+ return subjId;
+ }
+
+ /**
+ * Gets task name hash.
+ *
+ * @return Task name hash.
+ */
+ public int taskNameHash() {
+ return taskNameHash;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridCacheVersion version() {
+ return ver;
+ }
+
+ /**
+ * @return Keys
+ */
+ public LinkedHashMap<K, Boolean> keys() {
+ return keys;
+ }
+
+ /**
+ * @return Reload flag.
+ */
+ public boolean reload() {
+ return reload;
+ }
+
+ /**
+ * @return Read through flag.
+ */
+ public boolean readThrough() {
+ return readThrough;
+ }
+
+ /**
+ * @return Topology version.
+ */
+ @Override public long topologyVersion() {
+ return topVer;
+ }
+
+ /**
+ * @return Filters.
+ */
+ public IgnitePredicate<CacheEntry<K, V>>[] filter() {
+ return filter;
+ }
+
+ /**
+ * @return New TTL to set after entry is accessed, -1 to leave unchanged.
+ */
+ public long accessTtl() {
+ return accessTtl;
+ }
+
+ /**
+ * @param ctx Cache context.
+ * @throws IgniteCheckedException If failed.
+ */
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ assert ctx != null;
+ assert !F.isEmpty(keys);
+
+ if (keyBytes == null)
+ keyBytes = marshalBooleanLinkedMap(keys, ctx);
+
+ if (filterBytes == null)
+ filterBytes = marshalFilter(filter, ctx);
+ }
+
+ /**
+ * @param ctx Context.
+ * @param ldr Loader.
+ * @throws IgniteCheckedException If failed.
+ */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (keys == null)
+ keys = unmarshalBooleanLinkedMap(keyBytes, ctx, ldr);
+
+ if (filter == null && filterBytes != null)
+ filter = unmarshalFilter(filterBytes, ctx, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridNearGetRequest _clone = new GridNearGetRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridNearGetRequest _clone = (GridNearGetRequest)_msg;
+
+ _clone.futId = futId;
+ _clone.miniId = miniId;
+ _clone.ver = ver;
+ _clone.keys = keys;
+ _clone.reload = reload;
+ _clone.readThrough = readThrough;
+ _clone.keyBytes = keyBytes;
+ _clone.filterBytes = filterBytes;
+ _clone.topVer = topVer;
+ _clone.filter = filter;
+ _clone.subjId = subjId;
+ _clone.taskNameHash = taskNameHash;
+ _clone.accessTtl = accessTtl;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
+ if (!commState.putLong(accessTtl))
+ return false;
+
+ commState.idx++;
+
+ case 4:
+ if (filterBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(filterBytes.length))
++ if (!commState.putInt(null, filterBytes.length))
+ return false;
+
+ commState.it = arrayIterator(filterBytes);
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 5:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid(null, futId))
+ return false;
+
+ commState.idx++;
+
+ case 6:
+ if (keyBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(keyBytes.size()))
++ if (!commState.putInt(null, keyBytes.size()))
+ return false;
+
+ commState.it = keyBytes.entrySet().iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
+ Map.Entry<byte[], Boolean> e = (Map.Entry<byte[], Boolean>)commState.cur;
+
+ if (!commState.keyDone) {
- if (!commState.putByteArray(e.getKey()))
++ if (!commState.putByteArray(null, e.getKey()))
+ return false;
+
+ commState.keyDone = true;
+ }
+
- if (!commState.putBoolean(e.getValue()))
++ if (!commState.putBoolean(null, e.getValue()))
+ return false;
+
+ commState.keyDone = false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 7:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid(null, miniId))
+ return false;
+
+ commState.idx++;
+
+ case 8:
- if (!commState.putBoolean(readThrough))
++ if (!commState.putBoolean(null, readThrough))
+ return false;
+
+ commState.idx++;
+
+ case 9:
- if (!commState.putBoolean(reload))
++ if (!commState.putBoolean(null, reload))
+ return false;
+
+ commState.idx++;
+
+ case 10:
- if (!commState.putLong(topVer))
++ if (!commState.putLong(null, topVer))
+ return false;
+
+ commState.idx++;
+
+ case 11:
- if (!commState.putCacheVersion(ver))
++ if (!commState.putCacheVersion(null, ver))
+ return false;
+
+ commState.idx++;
+
+ case 12:
- if (!commState.putUuid(subjId))
++ if (!commState.putUuid(null, subjId))
+ return false;
+
+ commState.idx++;
+
+ case 13:
- if (!commState.putInt(taskNameHash))
++ if (!commState.putInt(null, taskNameHash))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
+ if (buf.remaining() < 8)
+ return false;
+
+ accessTtl = commState.getLong();
+
+ commState.idx++;
+
+ case 4:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (filterBytes == null)
+ filterBytes = new byte[commState.readSize][];
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ filterBytes[i] = (byte[])_val;
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 5:
- IgniteUuid futId0 = commState.getGridUuid();
++ IgniteUuid futId0 = commState.getGridUuid(null);
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ case 6:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (keyBytes == null)
+ keyBytes = new LinkedHashMap<>(commState.readSize, 1.0f);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
+ if (!commState.keyDone) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ commState.cur = _val;
+ commState.keyDone = true;
+ }
+
- if (buf.remaining() < 1)
- return false;
++ boolean _val = commState.getBoolean(null);
+
- boolean _val = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ keyBytes.put((byte[])commState.cur, _val);
+
+ commState.keyDone = false;
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+ commState.cur = null;
+
+ commState.idx++;
+
+ case 7:
- IgniteUuid miniId0 = commState.getGridUuid();
++ IgniteUuid miniId0 = commState.getGridUuid(null);
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 8:
+ if (buf.remaining() < 1)
+ return false;
+
- readThrough = commState.getBoolean();
++ readThrough = commState.getBoolean(null);
+
+ commState.idx++;
+
+ case 9:
+ if (buf.remaining() < 1)
+ return false;
+
- reload = commState.getBoolean();
++ reload = commState.getBoolean(null);
+
+ commState.idx++;
+
+ case 10:
+ if (buf.remaining() < 8)
+ return false;
+
- topVer = commState.getLong();
-
+ commState.idx++;
+
+ case 11:
- GridCacheVersion ver0 = commState.getCacheVersion();
++ GridCacheVersion ver0 = commState.getCacheVersion(null);
+
- if (ver0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- ver = ver0;
-
+ commState.idx++;
+
+ case 12:
- UUID subjId0 = commState.getUuid();
++ UUID subjId0 = commState.getUuid(null);
+
- if (subjId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- subjId = subjId0;
-
+ commState.idx++;
+
+ case 13:
+ if (buf.remaining() < 4)
+ return false;
+
- taskNameHash = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 48;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridNearGetRequest.class, this);
+ }
+ }
[44/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
index 0000000,85b07bf..6a46bee
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
@@@ -1,0 -1,734 +1,732 @@@
+ /*
+ * 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.cache;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.cache.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.marshaller.*;
+ import org.apache.ignite.internal.managers.deployment.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.nio.*;
+ import java.util.*;
+ import java.util.concurrent.atomic.*;
+
+ /**
+ * Parent of all cache messages.
+ */
+ public abstract class GridCacheMessage<K, V> extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Maximum number of cache lookup indexes. */
+ public static final int MAX_CACHE_MSG_LOOKUP_INDEX = 256;
+
+ /** Cache message index field name. */
+ public static final String CACHE_MSG_INDEX_FIELD_NAME = "CACHE_MSG_IDX";
+
+ /** Message index id. */
+ private static final AtomicInteger msgIdx = new AtomicInteger();
+
+ /** Null message ID. */
+ private static final long NULL_MSG_ID = -1;
+
+ /** ID of this message. */
+ private long msgId = NULL_MSG_ID;
+
+ /** */
+ @GridToStringInclude
+ private GridDeploymentInfoBean depInfo;
+
+ /** */
+ @GridDirectTransient
+ private Exception err;
+
+ /** */
+ @GridDirectTransient
+ private boolean skipPrepare;
+
+ /** Cache ID. */
+ protected int cacheId;
+
+ /**
+ * Gets next ID for indexed message ID.
+ *
+ * @return Message ID.
+ */
+ public static int nextIndexId() {
+ return msgIdx.getAndIncrement();
+ }
+
+ /**
+ * @return {@code True} if this message is preloader message.
+ */
+ public boolean allowForStartup() {
+ return false;
+ }
+
+ /**
+ * @return If this is a transactional message.
+ */
+ public boolean transactional() {
+ return false;
+ }
+
+ /**
+ * @return {@code True} if class loading errors should be ignored, false otherwise.
+ */
+ public boolean ignoreClassErrors() {
+ return false;
+ }
+
+ /**
+ * Gets message lookup index. All messages that does not return -1 in this method must return a unique
+ * number in range from 0 to {@link #MAX_CACHE_MSG_LOOKUP_INDEX}.
+ *
+ * @return Message lookup index.
+ */
+ public int lookupIndex() {
+ return -1;
+ }
+
+ /**
+ * If class loading error occurred during unmarshalling and {@link #ignoreClassErrors()} is
+ * set to {@code true}, then the error will be passed into this method.
+ *
+ * @param err Error.
+ */
+ public void onClassError(Exception err) {
+ this.err = err;
+ }
+
+ /**
+ * @return Error set via {@link #onClassError(Exception)} method.
+ */
+ public Exception classError() {
+ return err;
+ }
+
+ /**
+ * @return Message ID.
+ */
+ public long messageId() {
+ return msgId;
+ }
+
+ /**
+ * Sets message ID. This method is package protected and is only called
+ * by {@link GridCacheIoManager}.
+ *
+ * @param msgId New message ID.
+ */
+ void messageId(long msgId) {
+ this.msgId = msgId;
+ }
+
+ /**
+ * @return Cache ID.
+ */
+ public int cacheId() {
+ return cacheId;
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ */
+ public void cacheId(int cacheId) {
+ this.cacheId = cacheId;
+ }
+
+ /**
+ * Gets topology version or -1 in case of topology version is not required for this message.
+ *
+ * @return Topology version.
+ */
+ public long topologyVersion() {
+ return -1;
+ }
+
+ /**
+ * @param filters Predicate filters.
+ * @param ctx Context.
+ * @throws IgniteCheckedException If failed.
+ */
+ protected final void prepareFilter(@Nullable IgnitePredicate<CacheEntry<K, V>>[] filters,
+ GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ if (filters != null)
+ for (IgnitePredicate filter : filters)
+ prepareObject(filter, ctx);
+ }
+
+ /**
+ * @param o Object to prepare for marshalling.
+ * @param ctx Context.
+ * @throws IgniteCheckedException If failed.
+ */
+ protected final void prepareObject(@Nullable Object o, GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ if (!skipPrepare && o != null) {
+ GridDeploymentInfo d = ctx.deploy().globalDeploymentInfo();
+
+ if (d != null) {
+ prepare(d);
+
+ // Global deployment has been injected.
+ skipPrepare = true;
+ }
+ else {
+ Class<?> cls = U.detectClass(o);
+
+ ctx.deploy().registerClass(cls);
+
+ ClassLoader ldr = U.detectClassLoader(cls);
+
+ if (ldr instanceof GridDeploymentInfo)
+ prepare((GridDeploymentInfo)ldr);
+ }
+ }
+ }
+
+ /**
+ * @param col Collection of objects to prepare for marshalling.
+ * @param ctx Cache context.
+ * @throws IgniteCheckedException If failed.
+ */
+ protected final void prepareObjects(@Nullable Iterable<?> col, GridCacheSharedContext<K, V> ctx)
+ throws IgniteCheckedException {
+ if (col != null)
+ for (Object o : col)
+ prepareObject(o, ctx);
+ }
+
+ /**
+ * @param depInfo Deployment to set.
+ * @see GridCacheDeployable#prepare(GridDeploymentInfo)
+ */
+ public final void prepare(GridDeploymentInfo depInfo) {
+ if (depInfo != this.depInfo) {
+ if (this.depInfo != null && depInfo instanceof GridDeployment)
+ // Make sure not to replace remote deployment with local.
+ if (((GridDeployment)depInfo).local())
+ return;
+
+ this.depInfo = depInfo instanceof GridDeploymentInfoBean ?
+ (GridDeploymentInfoBean)depInfo : new GridDeploymentInfoBean(depInfo);
+ }
+ }
+
+ /**
+ * @return Preset deployment info.
+ * @see GridCacheDeployable#deployInfo()
+ */
+ public GridDeploymentInfo deployInfo() {
+ return depInfo;
+ }
+
+ /**
+ * This method is called before the whole message is serialized
+ * and is responsible for pre-marshalling state.
+ *
+ * @param ctx Cache context.
+ * @throws IgniteCheckedException If failed.
+ */
+ public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ // No-op.
+ }
+
+ /**
+ * This method is called after the message is deserialized and is responsible for
+ * unmarshalling state marshalled in {@link #prepareMarshal(GridCacheSharedContext)} method.
+ *
+ * @param ctx Context.
+ * @param ldr Class loader.
+ * @throws IgniteCheckedException If failed.
+ */
+ public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ // No-op.
+ }
+
+ /**
+ * @param info Entry to marshal.
+ * @param ctx Context.
+ * @throws IgniteCheckedException If failed.
+ */
+ protected final void marshalInfo(GridCacheEntryInfo<K, V> info, GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ assert ctx != null;
+
+ if (info != null) {
+ info.marshal(ctx);
+
+ if (ctx.deploymentEnabled()) {
+ prepareObject(info.key(), ctx);
+ prepareObject(info.value(), ctx);
+ }
+ }
+ }
+
+ /**
+ * @param info Entry to unmarshal.
+ * @param ctx Context.
+ * @param ldr Loader.
+ * @throws IgniteCheckedException If failed.
+ */
+ protected final void unmarshalInfo(GridCacheEntryInfo<K, V> info, GridCacheContext<K, V> ctx,
+ ClassLoader ldr) throws IgniteCheckedException {
+ assert ldr != null;
+ assert ctx != null;
+
+ if (info != null)
+ info.unmarshal(ctx, ldr);
+ }
+
+ /**
+ * @param infos Entries to marshal.
+ * @param ctx Context.
+ * @throws IgniteCheckedException If failed.
+ */
+ protected final void marshalInfos(Iterable<? extends GridCacheEntryInfo<K, V>> infos, GridCacheSharedContext<K, V> ctx)
+ throws IgniteCheckedException {
+ assert ctx != null;
+
+ if (infos != null)
+ for (GridCacheEntryInfo<K, V> e : infos)
+ marshalInfo(e, ctx);
+ }
+
+ /**
+ * @param infos Entries to unmarshal.
+ * @param ctx Context.
+ * @param ldr Loader.
+ * @throws IgniteCheckedException If failed.
+ */
+ protected final void unmarshalInfos(Iterable<? extends GridCacheEntryInfo<K, V>> infos,
+ GridCacheContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ assert ldr != null;
+ assert ctx != null;
+
+ if (infos != null)
+ for (GridCacheEntryInfo<K, V> e : infos)
+ unmarshalInfo(e, ctx, ldr);
+ }
+
+ /**
+ * @param txEntries Entries to marshal.
+ * @param ctx Context.
+ * @throws IgniteCheckedException If failed.
+ */
+ protected final void marshalTx(Iterable<IgniteTxEntry<K, V>> txEntries, GridCacheSharedContext<K, V> ctx)
+ throws IgniteCheckedException {
+ assert ctx != null;
+
+ if (txEntries != null) {
+ boolean transferExpiry = transferExpiryPolicy();
+
+ for (IgniteTxEntry<K, V> e : txEntries) {
+ e.marshal(ctx, transferExpiry);
+
+ if (ctx.deploymentEnabled()) {
+ prepareObject(e.key(), ctx);
+ prepareObject(e.value(), ctx);
+ prepareFilter(e.filters(), ctx);
+ }
+ }
+ }
+ }
+
+ /**
+ * @return {@code True} if entries expire policy should be marshalled.
+ */
+ protected boolean transferExpiryPolicy() {
+ return false;
+ }
+
+ /**
+ * @param txEntries Entries to unmarshal.
+ * @param ctx Context.
+ * @param ldr Loader.
+ * @throws IgniteCheckedException If failed.
+ */
+ protected final void unmarshalTx(Iterable<IgniteTxEntry<K, V>> txEntries,
+ boolean near,
+ GridCacheSharedContext<K, V> ctx,
+ ClassLoader ldr) throws IgniteCheckedException {
+ assert ldr != null;
+ assert ctx != null;
+
+ if (txEntries != null) {
+ for (IgniteTxEntry<K, V> e : txEntries)
+ e.unmarshal(ctx, near, ldr);
+ }
+ }
+
+ /**
+ * @param args Arguments to marshal.
+ * @param ctx Context.
+ * @return Marshalled collection.
+ * @throws IgniteCheckedException If failed.
+ */
+ @Nullable protected final byte[][] marshalInvokeArguments(@Nullable Object[] args,
+ GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ assert ctx != null;
+
+ if (args == null || args.length == 0)
+ return null;
+
+ byte[][] argsBytes = new byte[args.length][];
+
+ for (int i = 0; i < args.length; i++) {
+ Object arg = args[i];
+
+ if (ctx.deploymentEnabled())
+ prepareObject(arg, ctx);
+
+ argsBytes[i] = arg == null ? null : CU.marshal(ctx, arg);
+ }
+
+ return argsBytes;
+ }
+
+
+ /**
+ * @param byteCol Collection to unmarshal.
+ * @param ctx Context.
+ * @param ldr Loader.
+ * @return Unmarshalled collection.
+ * @throws IgniteCheckedException If failed.
+ */
+ @Nullable protected final Object[] unmarshalInvokeArguments(@Nullable byte[][] byteCol,
+ GridCacheSharedContext<K, V> ctx,
+ ClassLoader ldr) throws IgniteCheckedException {
+ assert ldr != null;
+ assert ctx != null;
+
+ if (byteCol == null)
+ return null;
+
+ Object[] args = new Object[byteCol.length];
+
+ IgniteMarshaller marsh = ctx.marshaller();
+
+ for (int i = 0; i < byteCol.length; i++)
+ args[i] = byteCol[i] == null ? null : marsh.unmarshal(byteCol[i], ldr);
+
+ return args;
+ }
+
+ /**
+ * @param filter Collection to marshal.
+ * @param ctx Context.
+ * @return Marshalled collection.
+ * @throws IgniteCheckedException If failed.
+ */
+ @Nullable protected final <T> byte[][] marshalFilter(@Nullable IgnitePredicate<CacheEntry<K, V>>[] filter,
+ GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ assert ctx != null;
+
+ if (filter == null)
+ return null;
+
+ byte[][] filterBytes = new byte[filter.length][];
+
+ for (int i = 0; i < filter.length; i++) {
+ IgnitePredicate<CacheEntry<K, V>> p = filter[i];
+
+ if (ctx.deploymentEnabled())
+ prepareObject(p, ctx);
+
+ filterBytes[i] = p == null ? null : CU.marshal(ctx, p);
+ }
+
+ return filterBytes;
+ }
+
+ /**
+ * @param byteCol Collection to unmarshal.
+ * @param ctx Context.
+ * @param ldr Loader.
+ * @return Unmarshalled collection.
+ * @throws IgniteCheckedException If failed.
+ */
+ @SuppressWarnings({"unchecked"})
+ @Nullable protected final <T> IgnitePredicate<CacheEntry<K, V>>[] unmarshalFilter(
+ @Nullable byte[][] byteCol, GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ assert ldr != null;
+ assert ctx != null;
+
+ if (byteCol == null)
+ return null;
+
+ IgnitePredicate<CacheEntry<K, V>>[] filter = new IgnitePredicate[byteCol.length];
+
+ IgniteMarshaller marsh = ctx.marshaller();
+
+ for (int i = 0; i < byteCol.length; i++)
+ filter[i] = byteCol[i] == null ? null :
+ marsh.<IgnitePredicate<CacheEntry<K, V>>>unmarshal(byteCol[i], ldr);
+
+ return filter;
+ }
+
+ /**
+ * @param col Values collection to marshal.
+ * @param ctx Context.
+ * @return Marshaled collection.
+ * @throws IgniteCheckedException If failed.
+ */
+ @Nullable protected List<GridCacheValueBytes> marshalValuesCollection(@Nullable Collection<?> col,
+ GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ assert ctx != null;
+
+ if (col == null)
+ return null;
+
+ List<GridCacheValueBytes> byteCol = new ArrayList<>(col.size());
+
+ for (Object o : col) {
+ if (ctx.deploymentEnabled())
+ prepareObject(o, ctx);
+
+ byteCol.add(o == null ? null : o instanceof byte[] ? GridCacheValueBytes.plain(o) :
+ GridCacheValueBytes.marshaled(CU.marshal(ctx, o)));
+ }
+
+ return byteCol;
+ }
+
+ /**
+ * @param byteCol Collection to unmarshal.
+ * @param ctx Context.
+ * @param ldr Loader.
+ * @return Unmarshalled collection.
+ * @throws IgniteCheckedException If failed.
+ */
+ @Nullable protected <T> List<T> unmarshalValueBytesCollection(@Nullable Collection<GridCacheValueBytes> byteCol,
+ GridCacheSharedContext<K, V> ctx, ClassLoader ldr)
+ throws IgniteCheckedException {
+ assert ldr != null;
+ assert ctx != null;
+
+ if (byteCol == null)
+ return null;
+
+ List<T> col = new ArrayList<>(byteCol.size());
+
+ IgniteMarshaller marsh = ctx.marshaller();
+
+ for (GridCacheValueBytes item : byteCol) {
+ assert item == null || item.get() != null;
+
+ col.add(item != null ? item.isPlain() ? (T)item.get() : marsh.<T>unmarshal(item.get(), ldr) : null);
+ }
+
+ return col;
+ }
+
+ /**
+ * @param col Collection to marshal.
+ * @param ctx Context.
+ * @return Marshalled collection.
+ * @throws IgniteCheckedException If failed.
+ */
+ @Nullable protected List<byte[]> marshalCollection(@Nullable Collection<?> col,
+ GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ assert ctx != null;
+
+ if (col == null)
+ return null;
+
+ List<byte[]> byteCol = new ArrayList<>(col.size());
+
+ for (Object o : col) {
+ if (ctx.deploymentEnabled())
+ prepareObject(o, ctx);
+
+ byteCol.add(o == null ? null : CU.marshal(ctx, o));
+ }
+
+ return byteCol;
+ }
+
+ /**
+ * @param byteCol Collection to unmarshal.
+ * @param ctx Context.
+ * @param ldr Loader.
+ * @return Unmarshalled collection.
+ * @throws IgniteCheckedException If failed.
+ */
+ @Nullable protected <T> List<T> unmarshalCollection(@Nullable Collection<byte[]> byteCol,
+ GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ assert ldr != null;
+ assert ctx != null;
+
+ if (byteCol == null)
+ return null;
+
+ List<T> col = new ArrayList<>(byteCol.size());
+
+ IgniteMarshaller marsh = ctx.marshaller();
+
+ for (byte[] bytes : byteCol)
+ col.add(bytes == null ? null : marsh.<T>unmarshal(bytes, ldr));
+
+ return col;
+ }
+
+ /**
+ * @param map Map to marshal.
+ * @param ctx Context.
+ * @return Marshalled map.
+ * @throws IgniteCheckedException If failed.
+ */
+ @SuppressWarnings("TypeMayBeWeakened") // Don't weaken type to clearly see that it's linked hash map.
+ @Nullable protected final LinkedHashMap<byte[], Boolean> marshalBooleanLinkedMap(
+ @Nullable LinkedHashMap<?, Boolean> map, GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ assert ctx != null;
+
+ if (map == null)
+ return null;
+
+ LinkedHashMap<byte[], Boolean> byteMap = U.newLinkedHashMap(map.size());
+
+ for (Map.Entry<?, Boolean> e : map.entrySet()) {
+ if (ctx.deploymentEnabled())
+ prepareObject(e.getKey(), ctx);
+
+ byteMap.put(CU.marshal(ctx, e.getKey()), e.getValue());
+ }
+
+ return byteMap;
+ }
+
+ /**
+ * @param byteMap Map to unmarshal.
+ * @param ctx Context.
+ * @param ldr Loader.
+ * @return Unmarshalled map.
+ * @throws IgniteCheckedException If failed.
+ */
+ @Nullable protected final <K1> LinkedHashMap<K1, Boolean> unmarshalBooleanLinkedMap(
+ @Nullable Map<byte[], Boolean> byteMap, GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ assert ldr != null;
+ assert ctx != null;
+
+ if (byteMap == null)
+ return null;
+
+ LinkedHashMap<K1, Boolean> map = U.newLinkedHashMap(byteMap.size());
+
+ IgniteMarshaller marsh = ctx.marshaller();
+
+ for (Map.Entry<byte[], Boolean> e : byteMap.entrySet())
+ map.put(marsh.<K1>unmarshal(e.getKey(), ldr), e.getValue());
+
+ return map;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridCacheMessage _clone = (GridCacheMessage)_msg;
+
+ _clone.msgId = msgId;
+ _clone.depInfo = depInfo != null ? (GridDeploymentInfoBean)depInfo.clone() : null;
+ _clone.err = err;
+ _clone.skipPrepare = skipPrepare;
+ _clone.cacheId = cacheId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putInt(cacheId))
++ if (!commState.putInt("cacheId", cacheId))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putMessage(depInfo))
++ if (!commState.putMessage("depInfo", depInfo))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putLong(msgId))
++ if (!commState.putLong("msgId", msgId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- if (buf.remaining() < 4)
- return false;
++ cacheId = commState.getInt("cacheId");
+
- cacheId = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 1:
- Object depInfo0 = commState.getMessage();
++ depInfo = (GridDeploymentInfoBean)commState.getMessage("depInfo");
+
- if (depInfo0 == MSG_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- depInfo = (GridDeploymentInfoBean)depInfo0;
-
+ commState.idx++;
+
+ case 2:
- if (buf.remaining() < 8)
- return false;
++ msgId = commState.getLong("msgId");
+
- msgId = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridCacheMessage.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java
index 0000000,73ad5d0..5fcef9f
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java
@@@ -1,0 -1,227 +1,221 @@@
+ /*
+ * 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.cache.distributed;
+
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Message sent to check that transactions related to some optimistic transaction
+ * were prepared on remote node.
+ */
+ public class GridCacheOptimisticCheckPreparedTxRequest<K, V> extends GridDistributedBaseMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /** Mini future ID. */
+ private IgniteUuid miniId;
+
+ /** Near transaction ID. */
+ private GridCacheVersion nearXidVer;
+
+ /** Expected number of transactions on node. */
+ private int txNum;
+
+ /**
+ * Empty constructor required by {@link Externalizable}
+ */
+ public GridCacheOptimisticCheckPreparedTxRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param tx Transaction.
+ * @param txNum Expected number of transactions on remote node.
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ */
+ public GridCacheOptimisticCheckPreparedTxRequest(IgniteTxEx<K, V> tx, int txNum, IgniteUuid futId, IgniteUuid miniId) {
+ super(tx.xidVersion(), 0);
+
+ nearXidVer = tx.nearXidVersion();
+ this.futId = futId;
+ this.miniId = miniId;
+ this.txNum = txNum;
+ }
+
+ /**
+ * @return Near version.
+ */
+ public GridCacheVersion nearXidVersion() {
+ return nearXidVer;
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Mini future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @return Expected number of transactions on node.
+ */
+ public int transactions() {
+ return txNum;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridCacheOptimisticCheckPreparedTxRequest _clone = new GridCacheOptimisticCheckPreparedTxRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridCacheOptimisticCheckPreparedTxRequest _clone = (GridCacheOptimisticCheckPreparedTxRequest)_msg;
+
+ _clone.futId = futId;
+ _clone.miniId = miniId;
+ _clone.nearXidVer = nearXidVer;
+ _clone.txNum = txNum;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 8:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 9:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 10:
- if (!commState.putCacheVersion(nearXidVer))
++ if (!commState.putCacheVersion("nearXidVer", nearXidVer))
+ return false;
+
+ commState.idx++;
+
+ case 11:
- if (!commState.putInt(txNum))
++ if (!commState.putInt("txNum", txNum))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 8:
- IgniteUuid futId0 = commState.getGridUuid();
++ futId = commState.getGridUuid("futId");
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ case 9:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 10:
- GridCacheVersion nearXidVer0 = commState.getCacheVersion();
++ nearXidVer = commState.getCacheVersion("nearXidVer");
+
- if (nearXidVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- nearXidVer = nearXidVer0;
-
+ commState.idx++;
+
+ case 11:
- if (buf.remaining() < 4)
- return false;
++ txNum = commState.getInt("txNum");
+
- txNum = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 18;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridCacheOptimisticCheckPreparedTxRequest.class, this, "super", super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java
index 0000000,f0e03e1..e2a66fc
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java
@@@ -1,0 -1,198 +1,194 @@@
+ /*
+ * 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.cache.distributed;
+
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Check prepared transactions response.
+ */
+ public class GridCacheOptimisticCheckPreparedTxResponse<K, V> extends GridDistributedBaseMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /** Mini future ID. */
+ private IgniteUuid miniId;
+
+ /** Flag indicating if all remote transactions were prepared. */
+ private boolean success;
+
+ /**
+ * Empty constructor required by {@link Externalizable}
+ */
+ public GridCacheOptimisticCheckPreparedTxResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param txId Transaction ID.
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ * @param success {@code True} if all remote transactions were prepared, {@code false} otherwise.
+ */
+ public GridCacheOptimisticCheckPreparedTxResponse(GridCacheVersion txId, IgniteUuid futId, IgniteUuid miniId,
+ boolean success) {
+ super(txId, 0);
+
+ this.futId = futId;
+ this.miniId = miniId;
+ this.success = success;
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Mini future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @return {@code True} if all remote transactions were prepared.
+ */
+ public boolean success() {
+ return success;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridCacheOptimisticCheckPreparedTxResponse _clone = new GridCacheOptimisticCheckPreparedTxResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridCacheOptimisticCheckPreparedTxResponse _clone = (GridCacheOptimisticCheckPreparedTxResponse)_msg;
+
+ _clone.futId = futId;
+ _clone.miniId = miniId;
+ _clone.success = success;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 8:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 9:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 10:
- if (!commState.putBoolean(success))
++ if (!commState.putBoolean("success", success))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 8:
- IgniteUuid futId0 = commState.getGridUuid();
++ futId = commState.getGridUuid("futId");
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ case 9:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 10:
- if (buf.remaining() < 1)
- return false;
++ success = commState.getBoolean("success");
+
- success = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 19;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridCacheOptimisticCheckPreparedTxResponse.class, this, "super", super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java
index 0000000,2aae468..e2d45d7
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java
@@@ -1,0 -1,292 +1,284 @@@
+ /*
+ * 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.cache.distributed;
+
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Message sent to check that transactions related to some pessimistic transaction
+ * were prepared on remote node.
+ */
+ public class GridCachePessimisticCheckCommittedTxRequest<K, V> extends GridDistributedBaseMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /** Mini future ID. */
+ private IgniteUuid miniId;
+
+ /** Near transaction ID. */
+ private GridCacheVersion nearXidVer;
+
+ /** Originating node ID. */
+ private UUID originatingNodeId;
+
+ /** Originating thread ID. */
+ private long originatingThreadId;
+
+ /** Flag indicating that this is near-only check. */
+ @GridDirectVersion(1)
+ private boolean nearOnlyCheck;
+
+ /**
+ * Empty constructor required by {@link Externalizable}
+ */
+ public GridCachePessimisticCheckCommittedTxRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param tx Transaction.
+ * @param originatingThreadId Originating thread ID.
+ * @param futId Future ID.
+ */
+ public GridCachePessimisticCheckCommittedTxRequest(IgniteTxEx<K, V> tx, long originatingThreadId, IgniteUuid futId,
+ boolean nearOnlyCheck) {
+ super(tx.xidVersion(), 0);
+
+ this.futId = futId;
+ this.nearOnlyCheck = nearOnlyCheck;
+
+ nearXidVer = tx.nearXidVersion();
+ originatingNodeId = tx.eventNodeId();
+ this.originatingThreadId = originatingThreadId;
+ }
+
+ /**
+ * @return Near version.
+ */
+ public GridCacheVersion nearXidVersion() {
+ return nearXidVer;
+ }
+
+ /**
+ * @return Tx originating node ID.
+ */
+ public UUID originatingNodeId() {
+ return originatingNodeId;
+ }
+
+ /**
+ * @return Tx originating thread ID.
+ */
+ public long originatingThreadId() {
+ return originatingThreadId;
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Mini future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @param miniId Mini ID to set.
+ */
+ public void miniId(IgniteUuid miniId) {
+ this.miniId = miniId;
+ }
+
+ /**
+ * @return Flag indicating that this request was sent only to near node. If this flag is set, no finalizing
+ * will be executed on receiving (near) node since this is a user node.
+ */
+ public boolean nearOnlyCheck() {
+ return nearOnlyCheck;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridCachePessimisticCheckCommittedTxRequest _clone = new GridCachePessimisticCheckCommittedTxRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridCachePessimisticCheckCommittedTxRequest _clone = (GridCachePessimisticCheckCommittedTxRequest)_msg;
+
+ _clone.futId = futId;
+ _clone.miniId = miniId;
+ _clone.nearXidVer = nearXidVer;
+ _clone.originatingNodeId = originatingNodeId;
+ _clone.originatingThreadId = originatingThreadId;
+ _clone.nearOnlyCheck = nearOnlyCheck;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 8:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 9:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 10:
- if (!commState.putCacheVersion(nearXidVer))
++ if (!commState.putCacheVersion("nearXidVer", nearXidVer))
+ return false;
+
+ commState.idx++;
+
+ case 11:
- if (!commState.putUuid(originatingNodeId))
++ if (!commState.putUuid("originatingNodeId", originatingNodeId))
+ return false;
+
+ commState.idx++;
+
+ case 12:
- if (!commState.putLong(originatingThreadId))
++ if (!commState.putLong("originatingThreadId", originatingThreadId))
+ return false;
+
+ commState.idx++;
+
+ case 13:
- if (!commState.putBoolean(nearOnlyCheck))
++ if (!commState.putBoolean("nearOnlyCheck", nearOnlyCheck))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 8:
- IgniteUuid futId0 = commState.getGridUuid();
++ futId = commState.getGridUuid("futId");
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ case 9:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 10:
- GridCacheVersion nearXidVer0 = commState.getCacheVersion();
++ nearXidVer = commState.getCacheVersion("nearXidVer");
+
- if (nearXidVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- nearXidVer = nearXidVer0;
-
+ commState.idx++;
+
+ case 11:
- UUID originatingNodeId0 = commState.getUuid();
++ originatingNodeId = commState.getUuid("originatingNodeId");
+
- if (originatingNodeId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- originatingNodeId = originatingNodeId0;
-
+ commState.idx++;
+
+ case 12:
- if (buf.remaining() < 8)
- return false;
++ originatingThreadId = commState.getLong("originatingThreadId");
+
- originatingThreadId = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 13:
- if (buf.remaining() < 1)
- return false;
++ nearOnlyCheck = commState.getBoolean("nearOnlyCheck");
+
- nearOnlyCheck = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 20;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridCachePessimisticCheckCommittedTxRequest.class, this, "super", super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java
index 0000000,afb45a1..3ac0aac
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxResponse.java
@@@ -1,0 -1,232 +1,226 @@@
+ /*
+ * 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.cache.distributed;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Check prepared transactions response.
+ */
+ public class GridCachePessimisticCheckCommittedTxResponse<K, V> extends GridDistributedBaseMessage<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /** Mini future ID. */
+ private IgniteUuid miniId;
+
+ /** Committed transaction info. */
+ @GridDirectTransient
+ private GridCacheCommittedTxInfo<K, V> committedTxInfo;
+
+ /** Serialized transaction info. */
+ private byte[] committedTxInfoBytes;
+
+ /**
+ * Empty constructor required by {@link Externalizable}
+ */
+ public GridCachePessimisticCheckCommittedTxResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param txId Transaction ID.
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ * @param committedTxInfo Committed transaction info.
+ */
+ public GridCachePessimisticCheckCommittedTxResponse(GridCacheVersion txId, IgniteUuid futId, IgniteUuid miniId,
+ @Nullable GridCacheCommittedTxInfo<K, V> committedTxInfo) {
+ super(txId, 0);
+
+ this.futId = futId;
+ this.miniId = miniId;
+ this.committedTxInfo = committedTxInfo;
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Mini future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @return {@code True} if all remote transactions were prepared.
+ */
+ public GridCacheCommittedTxInfo<K, V> committedTxInfo() {
+ return committedTxInfo;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (committedTxInfo != null) {
+ marshalTx(committedTxInfo.recoveryWrites(), ctx);
+
+ committedTxInfoBytes = ctx.marshaller().marshal(committedTxInfo);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (committedTxInfoBytes != null) {
+ committedTxInfo = ctx.marshaller().unmarshal(committedTxInfoBytes, ldr);
+
+ unmarshalTx(committedTxInfo.recoveryWrites(), false, ctx, ldr);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridCachePessimisticCheckCommittedTxResponse _clone = new GridCachePessimisticCheckCommittedTxResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridCachePessimisticCheckCommittedTxResponse _clone = (GridCachePessimisticCheckCommittedTxResponse)_msg;
+
+ _clone.futId = futId;
+ _clone.miniId = miniId;
+ _clone.committedTxInfo = committedTxInfo;
+ _clone.committedTxInfoBytes = committedTxInfoBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 8:
- if (!commState.putByteArray(committedTxInfoBytes))
++ if (!commState.putByteArray("committedTxInfoBytes", committedTxInfoBytes))
+ return false;
+
+ commState.idx++;
+
+ case 9:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 10:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 8:
- byte[] committedTxInfoBytes0 = commState.getByteArray();
++ committedTxInfoBytes = commState.getByteArray("committedTxInfoBytes");
+
- if (committedTxInfoBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- committedTxInfoBytes = committedTxInfoBytes0;
-
+ commState.idx++;
+
+ case 9:
- IgniteUuid futId0 = commState.getGridUuid();
++ futId = commState.getGridUuid("futId");
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ case 10:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 21;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridCachePessimisticCheckCommittedTxResponse.class, this, "super", super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java
index 0000000,514fa51..5597a4a
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java
@@@ -1,0 -1,457 +1,451 @@@
+ /*
+ * 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.cache.distributed;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Base for all messages in replicated cache.
+ */
+ public abstract class GridDistributedBaseMessage<K, V> extends GridCacheMessage<K, V> implements GridCacheDeployable,
+ GridCacheVersionable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Lock or transaction version. */
+ @GridToStringInclude
+ protected GridCacheVersion ver;
+
+ /**
+ * Candidates for every key ordered in the order of keys. These
+ * can be either local-only candidates in case of lock acquisition,
+ * or pending candidates in case of transaction commit.
+ */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Collection<GridCacheMvccCandidate<K>>[] candsByIdx;
+
+ /** */
+ @GridToStringExclude
+ private byte[] candsByIdxBytes;
+
+ /** Collections of local lock candidates. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Map<K, Collection<GridCacheMvccCandidate<K>>> candsByKey;
+
+ /** Collections of local lock candidates in serialized form. */
+ @GridToStringExclude
+ private byte[] candsByKeyBytes;
+
+ /** Committed versions with order higher than one for this message (needed for commit ordering). */
+ @GridToStringInclude
+ @GridDirectCollection(GridCacheVersion.class)
+ private Collection<GridCacheVersion> committedVers;
+
+ /** Rolled back versions with order higher than one for this message (needed for commit ordering). */
+ @GridToStringInclude
+ @GridDirectCollection(GridCacheVersion.class)
+ private Collection<GridCacheVersion> rolledbackVers;
+
+ /** Count of keys referenced in candidates array (needed only locally for optimization). */
+ @GridToStringInclude
+ @GridDirectTransient
+ private int cnt;
+
+ /**
+ * Empty constructor required by {@link Externalizable}
+ */
+ protected GridDistributedBaseMessage() {
+ /* No-op. */
+ }
+
+ /**
+ * @param cnt Count of keys references in list of candidates.
+ */
+ protected GridDistributedBaseMessage(int cnt) {
+ assert cnt >= 0;
+
+ this.cnt = cnt;
+ }
+
+ /**
+ * @param ver Either lock or transaction version.
+ * @param cnt Key count.
+ */
+ protected GridDistributedBaseMessage(GridCacheVersion ver, int cnt) {
+ this(cnt);
+
+ assert ver != null;
+
+ this.ver = ver;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (candsByIdx != null)
+ candsByIdxBytes = ctx.marshaller().marshal(candsByIdx);
+
+ if (candsByKey != null) {
+ if (ctx.deploymentEnabled()) {
+ for (K key : candsByKey.keySet())
+ prepareObject(key, ctx);
+ }
+
+ candsByKeyBytes = CU.marshal(ctx, candsByKey);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (candsByIdxBytes != null)
+ candsByIdx = ctx.marshaller().unmarshal(candsByIdxBytes, ldr);
+
+ if (candsByKeyBytes != null)
+ candsByKey = ctx.marshaller().unmarshal(candsByKeyBytes, ldr);
+ }
+
+ /**
+ * @return Version.
+ */
+ @Override public GridCacheVersion version() {
+ return ver;
+ }
+
+ /**
+ * @param ver Version.
+ */
+ public void version(GridCacheVersion ver) {
+ this.ver = ver;
+ }
+
+ /**
+ * @param committedVers Committed versions.
+ * @param rolledbackVers Rolled back versions.
+ */
+ public void completedVersions(Collection<GridCacheVersion> committedVers,
+ Collection<GridCacheVersion> rolledbackVers) {
+ this.committedVers = committedVers;
+ this.rolledbackVers = rolledbackVers;
+ }
+
+ /**
+ * @return Committed versions.
+ */
+ public Collection<GridCacheVersion> committedVersions() {
+ return committedVers == null ? Collections.<GridCacheVersion>emptyList() : committedVers;
+ }
+
+ /**
+ * @return Rolled back versions.
+ */
+ public Collection<GridCacheVersion> rolledbackVersions() {
+ return rolledbackVers == null ? Collections.<GridCacheVersion>emptyList() : rolledbackVers;
+ }
+
+ /**
+ * @param idx Key index.
+ * @param candsByIdx List of candidates for that key.
+ */
+ @SuppressWarnings({"unchecked"})
+ public void candidatesByIndex(int idx, Collection<GridCacheMvccCandidate<K>> candsByIdx) {
+ assert idx < cnt;
+
+ // If nothing to add.
+ if (candsByIdx == null || candsByIdx.isEmpty())
+ return;
+
+ if (this.candsByIdx == null)
+ this.candsByIdx = new Collection[cnt];
+
+ this.candsByIdx[idx] = candsByIdx;
+ }
+
+ /**
+ * @param idx Key index.
+ * @return Candidates for given key.
+ */
+ public Collection<GridCacheMvccCandidate<K>> candidatesByIndex(int idx) {
+ return candsByIdx == null || candsByIdx[idx] == null ? Collections.<GridCacheMvccCandidate<K>>emptyList() : candsByIdx[idx];
+ }
+
+ /**
+ * @param key Candidates key.
+ * @param candsByKey Collection of local candidates.
+ */
+ public void candidatesByKey(K key, Collection<GridCacheMvccCandidate<K>> candsByKey) {
+ if (this.candsByKey == null)
+ this.candsByKey = new HashMap<>(1, 1.0f);
+
+ this.candsByKey.put(key, candsByKey);
+ }
+
+ /**
+ *
+ * @param key Candidates key.
+ * @return Collection of lock candidates at given index.
+ */
+ @Nullable public Collection<GridCacheMvccCandidate<K>> candidatesByKey(K key) {
+ assert key != null;
+
+ if (candsByKey == null)
+ return null;
+
+ return candsByKey.get(key);
+ }
+
+ /**
+ * @return Map of candidates.
+ */
+ public Map<K, Collection<GridCacheMvccCandidate<K>>> candidatesByKey() {
+ return candsByKey == null ? Collections.<K, Collection<GridCacheMvccCandidate<K>>>emptyMap() : candsByKey;
+ }
+
+ /**
+ * @return Count of keys referenced in candidates array (needed only locally for optimization).
+ */
+ public int keysCount() {
+ return cnt;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridDistributedBaseMessage _clone = (GridDistributedBaseMessage)_msg;
+
+ _clone.ver = ver;
+ _clone.candsByIdx = candsByIdx;
+ _clone.candsByIdxBytes = candsByIdxBytes;
+ _clone.candsByKey = candsByKey;
+ _clone.candsByKeyBytes = candsByKeyBytes;
+ _clone.committedVers = committedVers;
+ _clone.rolledbackVers = rolledbackVers;
+ _clone.cnt = cnt;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
- if (!commState.putByteArray(candsByIdxBytes))
++ if (!commState.putByteArray("candsByIdxBytes", candsByIdxBytes))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putByteArray(candsByKeyBytes))
++ if (!commState.putByteArray("candsByKeyBytes", candsByKeyBytes))
+ return false;
+
+ commState.idx++;
+
+ case 5:
+ if (committedVers != null) {
+ if (commState.it == null) {
- if (!commState.putInt(committedVers.size()))
++ if (!commState.putInt(null, committedVers.size()))
+ return false;
+
+ commState.it = committedVers.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putCacheVersion((GridCacheVersion)commState.cur))
++ if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 6:
+ if (rolledbackVers != null) {
+ if (commState.it == null) {
- if (!commState.putInt(rolledbackVers.size()))
++ if (!commState.putInt(null, rolledbackVers.size()))
+ return false;
+
+ commState.it = rolledbackVers.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putCacheVersion((GridCacheVersion)commState.cur))
++ if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 7:
- if (!commState.putCacheVersion(ver))
++ if (!commState.putCacheVersion("ver", ver))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
- byte[] candsByIdxBytes0 = commState.getByteArray();
++ candsByIdxBytes = commState.getByteArray("candsByIdxBytes");
+
- if (candsByIdxBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- candsByIdxBytes = candsByIdxBytes0;
-
+ commState.idx++;
+
+ case 4:
- byte[] candsByKeyBytes0 = commState.getByteArray();
++ candsByKeyBytes = commState.getByteArray("candsByKeyBytes");
+
- if (candsByKeyBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- candsByKeyBytes = candsByKeyBytes0;
-
+ commState.idx++;
+
+ case 5:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (committedVers == null)
+ committedVers = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheVersion _val = commState.getCacheVersion();
++ GridCacheVersion _val = commState.getCacheVersion(null);
+
- if (_val == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ committedVers.add((GridCacheVersion)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 6:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (rolledbackVers == null)
+ rolledbackVers = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheVersion _val = commState.getCacheVersion();
++ GridCacheVersion _val = commState.getCacheVersion(null);
+
- if (_val == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ rolledbackVers.add((GridCacheVersion)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 7:
- GridCacheVersion ver0 = commState.getCacheVersion();
++ ver = commState.getCacheVersion("ver");
+
- if (ver0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- ver = ver0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDistributedBaseMessage.class, this, "super", super.toString());
+ }
+ }
[22/52] [abbrv] incubator-ignite git commit: # sprint-1 Fixed typo
after auto renaming.
Posted by vk...@apache.org.
# sprint-1 Fixed typo after auto renaming.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/14ad3ea5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/14ad3ea5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/14ad3ea5
Branch: refs/heads/ignite-61
Commit: 14ad3ea5c988ab0a034fbfb389b9274f9631fd69
Parents: 7eebc7e
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Jan 29 22:30:51 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Jan 29 22:30:51 2015 +0700
----------------------------------------------------------------------
.../org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/14ad3ea5/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala
index 1899ca4..837b424 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/alert/VisorAlertCommand.scala
@@ -278,7 +278,7 @@ class VisorAlertCommand {
// Grid-wide metrics (not node specific).
case "cc" if v != null => gf = makeGridFilter(v, gf, grid.metrics().getTotalCpus)
case "nc" if v != null => gf = makeGridFilter(v, gf, grid.nodes().size)
- case "hc" if v != null => gf = makeGridFilter(v, gf, IgniteUtils.neighborhood(grid.nodes()).size)
+ case "hc" if v != null => gf = makeGridFilter(v, gf, U.neighborhood(grid.nodes()).size)
case "cl" if v != null => gf = makeGridFilter(v, gf,
() => (grid.metrics().getAverageCpuLoad * 100).toLong)
[46/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
index 0000000,6996e6f..b918b68
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
@@@ -1,0 -1,2043 +1,2153 @@@
+ /*
+ * 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.managers.communication;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.cluster.*;
+ import org.apache.ignite.events.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.util.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.marshaller.*;
++import org.apache.ignite.plugin.extensions.communication.*;
+ import org.apache.ignite.spi.*;
+ import org.apache.ignite.spi.communication.*;
+ import org.apache.ignite.internal.managers.*;
+ import org.apache.ignite.internal.managers.deployment.*;
+ import org.apache.ignite.internal.managers.eventstorage.*;
+ import org.apache.ignite.internal.processors.timeout.*;
+ import org.apache.ignite.internal.util.direct.*;
+ 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.internal.util.worker.*;
+ import org.jdk8.backport.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.util.*;
+ import java.util.Map.*;
+ import java.util.concurrent.*;
+ import java.util.concurrent.atomic.*;
+ import java.util.concurrent.locks.*;
+
+ import static org.apache.ignite.events.IgniteEventType.*;
+ import static org.apache.ignite.internal.GridTopic.*;
+ import static org.apache.ignite.internal.managers.communication.GridIoPolicy.*;
+ import static org.apache.ignite.internal.util.nio.GridNioBackPressureControl.*;
+ import static org.jdk8.backport.ConcurrentLinkedHashMap.QueuePolicy.*;
+
+ /**
+ * Grid communication manager.
+ */
+ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializable>> {
+ /** Max closed topics to store. */
+ public static final int MAX_CLOSED_TOPICS = 10240;
+
+ /** Listeners by topic. */
+ private final ConcurrentMap<Object, GridMessageListener> lsnrMap = new ConcurrentHashMap8<>();
+
+ /** Disconnect listeners. */
+ private final Collection<GridDisconnectListener> disconnectLsnrs = new ConcurrentLinkedQueue<>();
+
+ /** Public pool. */
+ private ExecutorService pubPool;
+
+ /** Internal P2P pool. */
+ private ExecutorService p2pPool;
+
+ /** Internal system pool. */
+ private ExecutorService sysPool;
+
+ /** Internal management pool. */
+ private ExecutorService mgmtPool;
+
+ /** Affinity assignment executor service. */
+ private ExecutorService affPool;
+
+ /** Utility cache pool. */
+ private ExecutorService utilityCachePool;
+
+ /** Discovery listener. */
+ private GridLocalEventListener discoLsnr;
+
+ /** */
+ private final ConcurrentMap<Object, ConcurrentMap<UUID, GridCommunicationMessageSet>> msgSetMap =
+ new ConcurrentHashMap8<>();
+
+ /** Local node ID. */
+ private final UUID locNodeId;
+
+ /** Discovery delay. */
+ private final long discoDelay;
+
+ /** Cache for messages that were received prior to discovery. */
+ private final ConcurrentMap<UUID, ConcurrentLinkedDeque8<DelayedMessage>> waitMap =
+ new ConcurrentHashMap8<>();
+
+ /** Communication message listener. */
+ private CommunicationListener<Serializable> commLsnr;
+
+ /** Grid marshaller. */
+ private final IgniteMarshaller marsh;
+
+ /** Busy lock. */
+ private final GridSpinReadWriteLock busyLock = new GridSpinReadWriteLock();
+
+ /** Lock to sync maps access. */
+ private final ReadWriteLock lock = new ReentrantReadWriteLock();
+
+ /** Message cache. */
+ private ThreadLocal<IgniteBiTuple<Object, byte[]>> cacheMsg =
+ new GridThreadLocal<IgniteBiTuple<Object, byte[]>>() {
+ @Nullable @Override protected IgniteBiTuple<Object, byte[]> initialValue() {
+ return null;
+ }
+ };
+
+ /** Fully started flag. When set to true, can send and receive messages. */
+ private volatile boolean started;
+
+ /** Closed topics. */
+ private final GridBoundedConcurrentLinkedHashSet<Object> closedTopics =
+ new GridBoundedConcurrentLinkedHashSet<>(MAX_CLOSED_TOPICS, MAX_CLOSED_TOPICS, 0.75f, 256,
+ PER_SEGMENT_Q_OPTIMIZED_RMV);
+
+ /** Workers count. */
+ private final LongAdder workersCnt = new LongAdder();
+
++ /** */
++ private int pluginMsg = GridTcpCommunicationMessageFactory.MAX_COMMON_TYPE;
++
++ /** */
++ private Map<Byte, GridTcpCommunicationMessageProducer> pluginMsgs;
++
++ /** */
++ private MessageFactory msgFactory;
++
++ /** */
++ private MessageWriterFactory writerFactory;
++
++ /** */
++ private MessageReaderFactory readerFactory;
++
+ /**
+ * @param ctx Grid kernal context.
+ */
+ @SuppressWarnings("deprecation")
+ public GridIoManager(GridKernalContext ctx) {
+ super(ctx, ctx.config().getCommunicationSpi());
+
+ locNodeId = ctx.localNodeId();
+
+ discoDelay = ctx.config().getDiscoveryStartupDelay();
+
+ marsh = ctx.config().getMarshaller();
+ }
+
+ /**
++ * @param producer Message producer.
++ * @return Message type code.
++ */
++ public byte registerMessageProducer(GridTcpCommunicationMessageProducer producer) {
++ int nextMsg = ++pluginMsg;
++
++ if (nextMsg > Byte.MAX_VALUE)
++ throw new IgniteException();
++
++ if (pluginMsgs == null)
++ pluginMsgs = new HashMap<>();
++
++ pluginMsgs.put((byte)nextMsg, producer);
++
++ return (byte)nextMsg;
++ }
++
++ /**
++ * Initializes manager (called prior to discovery start, but after all other components).
++ */
++ public void initMessageFactory() {
++ final GridTcpCommunicationMessageProducer[] common = GridTcpCommunicationMessageFactory.commonProducers();
++
++ final GridTcpCommunicationMessageProducer[] producers;
++
++ if (pluginMsgs != null) {
++ producers = Arrays.copyOf(common, pluginMsg + 1);
++
++ for (Map.Entry<Byte, GridTcpCommunicationMessageProducer> e : pluginMsgs.entrySet()) {
++ assert producers[e.getKey()] == null : e.getKey();
++
++ producers[e.getKey()] = e.getValue();
++ }
++
++ pluginMsgs = null;
++ }
++ else
++ producers = common;
++
++ msgFactory = new MessageFactory() {
++ @Override public GridTcpCommunicationMessageAdapter create(byte type) {
++ GridTcpCommunicationMessageAdapter msg;
++
++ if (type < 0 || type >= producers.length)
++ msg = GridTcpCommunicationMessageFactory.create(type);
++ else {
++ GridTcpCommunicationMessageProducer producer = producers[type];
++
++ if (producer == null)
++ throw new IllegalStateException("Common message type producer is not registered: " + type);
++
++ msg = producer.create(type);
++ }
++
++ msg.setReader(readerFactory.reader());
++
++ return msg;
++ }
++ };
++ }
++
++ public MessageFactory messageFactory() {
++ assert msgFactory != null;
++
++ return msgFactory;
++ }
++
++ /**
+ * Resets metrics for this manager.
+ */
+ public void resetMetrics() {
+ getSpi().resetMetrics();
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("deprecation")
+ @Override public void start() throws IgniteCheckedException {
+ assertParameter(discoDelay > 0, "discoveryStartupDelay > 0");
+
+ startSpi();
+
+ pubPool = ctx.config().getExecutorService();
+ p2pPool = ctx.config().getPeerClassLoadingExecutorService();
+ sysPool = ctx.config().getSystemExecutorService();
+ mgmtPool = ctx.config().getManagementExecutorService();
+ utilityCachePool = ctx.utilityCachePool();
+ affPool = Executors.newFixedThreadPool(1);
+
+ getSpi().setListener(commLsnr = new CommunicationListener<Serializable>() {
+ @Override public void onMessage(UUID nodeId, Serializable msg, IgniteRunnable msgC) {
+ try {
+ onMessage0(nodeId, (GridIoMessage)msg, msgC);
+ }
+ catch (ClassCastException ignored) {
+ U.error(log, "Communication manager received message of unknown type (will ignore): " +
+ msg.getClass().getName() + ". Most likely GridCommunicationSpi is being used directly, " +
+ "which is illegal - make sure to send messages only via GridProjection API.");
+ }
+ }
+
+ @Override public void onDisconnected(UUID nodeId) {
+ for (GridDisconnectListener lsnr : disconnectLsnrs)
+ lsnr.onNodeDisconnected(nodeId);
+ }
+ });
+
++ MessageWriterFactory[] writerExt = ctx.plugins().extensions(MessageWriterFactory.class);
++
++ if (writerExt != null && writerExt.length > 0)
++ writerFactory = writerExt[0];
++ else {
++ writerFactory = new MessageWriterFactory() {
++ @Override public MessageWriter writer() {
++ return new GridTcpCommunicationMessageWriter();
++ }
++ };
++ }
++
++ MessageReaderFactory[] readerExt = ctx.plugins().extensions(MessageReaderFactory.class);
++
++ if (readerExt != null && readerExt.length > 0)
++ readerFactory = readerExt[0];
++ else {
++ readerFactory = new MessageReaderFactory() {
++ @Override public MessageReader reader() {
++ return new GridTcpCommunicationMessageReader(msgFactory);
++ }
++ };
++ }
++
+ if (log.isDebugEnabled())
+ log.debug(startInfo());
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"deprecation", "SynchronizationOnLocalVariableOrMethodParameter"})
+ @Override public void onKernalStart0() throws IgniteCheckedException {
+ discoLsnr = new GridLocalEventListener() {
+ @SuppressWarnings({"TooBroadScope", "fallthrough"})
+ @Override public void onEvent(IgniteEvent evt) {
+ assert evt instanceof IgniteDiscoveryEvent : "Invalid event: " + evt;
+
+ IgniteDiscoveryEvent discoEvt = (IgniteDiscoveryEvent)evt;
+
+ UUID nodeId = discoEvt.eventNode().id();
+
+ switch (evt.type()) {
+ case EVT_NODE_JOINED:
+ assert waitMap.get(nodeId) == null; // We can't receive messages from undiscovered nodes.
+
+ break;
+
+ case EVT_NODE_LEFT:
+ case EVT_NODE_FAILED:
+ for (Map.Entry<Object, ConcurrentMap<UUID, GridCommunicationMessageSet>> e :
+ msgSetMap.entrySet()) {
+ ConcurrentMap<UUID, GridCommunicationMessageSet> map = e.getValue();
+
+ GridCommunicationMessageSet set;
+
+ boolean empty;
+
+ synchronized (map) {
+ set = map.remove(nodeId);
+
+ empty = map.isEmpty();
+ }
+
+ if (set != null) {
+ if (log.isDebugEnabled())
+ log.debug("Removed message set due to node leaving grid: " + set);
+
+ // Unregister timeout listener.
+ ctx.timeout().removeTimeoutObject(set);
+
+ // Node may still send stale messages for this topic
+ // even after discovery notification is done.
+ closedTopics.add(set.topic());
+ }
+
+ if (empty)
+ msgSetMap.remove(e.getKey(), map);
+ }
+
+ // Clean up delayed and ordered messages (need exclusive lock).
+ lock.writeLock().lock();
+
+ try {
+ ConcurrentLinkedDeque8<DelayedMessage> waitList = waitMap.remove(nodeId);
+
+ if (log.isDebugEnabled())
+ log.debug("Removed messages from discovery startup delay list " +
+ "(sender node left topology): " + waitList);
+ }
+ finally {
+ lock.writeLock().unlock();
+ }
+
+ break;
+
+ default:
+ assert false : "Unexpected event: " + evt;
+ }
+ }
+ };
+
+ ctx.event().addLocalEventListener(discoLsnr, EVT_NODE_JOINED, EVT_NODE_LEFT, EVT_NODE_FAILED);
+
+ // Make sure that there are no stale messages due to window between communication
+ // manager start and kernal start.
+ // 1. Process wait list.
+ Collection<Collection<DelayedMessage>> delayedMsgs = new ArrayList<>();
+
+ lock.writeLock().lock();
+
+ try {
+ started = true;
+
+ for (Entry<UUID, ConcurrentLinkedDeque8<DelayedMessage>> e : waitMap.entrySet()) {
+ if (ctx.discovery().node(e.getKey()) != null) {
+ ConcurrentLinkedDeque8<DelayedMessage> waitList = waitMap.remove(e.getKey());
+
+ if (log.isDebugEnabled())
+ log.debug("Processing messages from discovery startup delay list: " + waitList);
+
+ if (waitList != null)
+ delayedMsgs.add(waitList);
+ }
+ }
+ }
+ finally {
+ lock.writeLock().unlock();
+ }
+
+ // After write lock released.
+ if (!delayedMsgs.isEmpty()) {
+ for (Collection<DelayedMessage> col : delayedMsgs)
+ for (DelayedMessage msg : col)
+ commLsnr.onMessage(msg.nodeId(), msg.message(), msg.callback());
+ }
+
+ // 2. Process messages sets.
+ for (Map.Entry<Object, ConcurrentMap<UUID, GridCommunicationMessageSet>> e : msgSetMap.entrySet()) {
+ ConcurrentMap<UUID, GridCommunicationMessageSet> map = e.getValue();
+
+ for (GridCommunicationMessageSet set : map.values()) {
+ if (ctx.discovery().node(set.nodeId()) == null) {
+ // All map modifications should be synced for consistency.
+ boolean rmv;
+
+ synchronized (map) {
+ rmv = map.remove(set.nodeId(), set);
+ }
+
+ if (rmv) {
+ if (log.isDebugEnabled())
+ log.debug("Removed message set due to node leaving grid: " + set);
+
+ // Unregister timeout listener.
+ ctx.timeout().removeTimeoutObject(set);
+ }
+
+ }
+ }
+
+ boolean rmv;
+
+ synchronized (map) {
+ rmv = map.isEmpty();
+ }
+
+ if (rmv) {
+ msgSetMap.remove(e.getKey(), map);
+
+ // Node may still send stale messages for this topic
+ // even after discovery notification is done.
+ closedTopics.add(e.getKey());
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("BusyWait")
+ @Override public void onKernalStop0(boolean cancel) {
+ // No more communication messages.
+ getSpi().setListener(null);
+
+ busyLock.writeLock();
+
+ U.shutdownNow(getClass(), affPool, log);
+
+ boolean interrupted = false;
+
+ while (workersCnt.sum() != 0) {
+ try {
+ Thread.sleep(200);
+ }
+ catch (InterruptedException ignored) {
+ interrupted = true;
+ }
+ }
+
+ if (interrupted)
+ Thread.currentThread().interrupt();
+
+ GridEventStorageManager evtMgr = ctx.event();
+
+ if (evtMgr != null && discoLsnr != null)
+ evtMgr.removeLocalEventListener(discoLsnr);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void stop(boolean cancel) throws IgniteCheckedException {
+ stopSpi();
+
+ // Clear cache.
+ cacheMsg.set(null);
+
+ if (log.isDebugEnabled())
+ log.debug(stopInfo());
+ }
+
+ /**
+ * @param nodeId Node ID.
+ * @param msg Message bytes.
+ * @param msgC Closure to call when message processing finished.
+ */
+ @SuppressWarnings("fallthrough")
+ private void onMessage0(UUID nodeId, GridIoMessage msg, IgniteRunnable msgC) {
+ assert nodeId != null;
+ assert msg != null;
+
+ if (!busyLock.tryReadLock()) {
+ if (log.isDebugEnabled())
+ log.debug("Received communication message while stopping grid.");
+
+ return;
+ }
+
+ try {
+ // Check discovery.
+ ClusterNode node = ctx.discovery().node(nodeId);
+
+ if (node == null) {
+ if (log.isDebugEnabled())
+ log.debug("Ignoring message from dead node [senderId=" + nodeId + ", msg=" + msg + ']');
+
+ return; // We can't receive messages from non-discovered ones.
+ }
+
+ if (msg.topic() == null) {
+ int topicOrd = msg.topicOrdinal();
+
+ msg.topic(topicOrd >= 0 ? GridTopic.fromOrdinal(topicOrd) : marsh.unmarshal(msg.topicBytes(), null));
+ }
+
+ if (!started) {
+ lock.readLock().lock();
+
+ try {
+ if (!started) { // Sets to true in write lock, so double checking.
+ // Received message before valid context is set to manager.
+ if (log.isDebugEnabled())
+ log.debug("Adding message to waiting list [senderId=" + nodeId +
+ ", msg=" + msg + ']');
+
+ ConcurrentLinkedDeque8<DelayedMessage> list =
+ F.addIfAbsent(waitMap, nodeId, F.<DelayedMessage>newDeque());
+
+ assert list != null;
+
+ list.add(new DelayedMessage(nodeId, msg, msgC));
+
+ return;
+ }
+ }
+ finally {
+ lock.readLock().unlock();
+ }
+ }
+
+ // If message is P2P, then process in P2P service.
+ // This is done to avoid extra waiting and potential deadlocks
+ // as thread pool may not have any available threads to give.
+ GridIoPolicy plc = msg.policy();
+
+ switch (plc) {
+ case P2P_POOL: {
+ processP2PMessage(nodeId, msg, msgC);
+
+ break;
+ }
+
+ case PUBLIC_POOL:
+ case SYSTEM_POOL:
+ case MANAGEMENT_POOL:
+ case AFFINITY_POOL:
+ case UTILITY_CACHE_POOL: {
+ if (msg.isOrdered())
+ processOrderedMessage(nodeId, msg, plc, msgC);
+ else
+ processRegularMessage(nodeId, msg, plc, msgC);
+
+ break;
+ }
+ }
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to process message (will ignore): " + msg, e);
+ }
+ finally {
+ busyLock.readUnlock();
+ }
+ }
+
+ /**
+ * Gets execution pool for policy.
+ *
+ * @param plc Policy.
+ * @return Execution pool.
+ */
+ private Executor pool(GridIoPolicy plc) {
+ switch (plc) {
+ case P2P_POOL:
+ return p2pPool;
+ case SYSTEM_POOL:
+ return sysPool;
+ case PUBLIC_POOL:
+ return pubPool;
+ case MANAGEMENT_POOL:
+ return mgmtPool;
+ case AFFINITY_POOL:
+ return affPool;
+ case UTILITY_CACHE_POOL:
+ assert utilityCachePool != null : "Utility cache pool is not configured.";
+
+ return utilityCachePool;
+
+ default: {
+ assert false : "Invalid communication policy: " + plc;
+
+ // Never reached.
+ return null;
+ }
+ }
+ }
+
+ /**
+ * @param nodeId Node ID.
+ * @param msg Message.
+ * @param msgC Closure to call when message processing finished.
+ */
+ private void processP2PMessage(
+ final UUID nodeId,
+ final GridIoMessage msg,
+ final IgniteRunnable msgC
+ ) {
+ workersCnt.increment();
+
+ Runnable c = new GridWorker(ctx.gridName(), "msg-worker", log) {
+ @Override protected void body() {
+ try {
+ threadProcessingMessage(true);
+
+ GridMessageListener lsnr = lsnrMap.get(msg.topic());
+
+ if (lsnr == null)
+ return;
+
+ Object obj = msg.message();
+
+ assert obj != null;
+
+ lsnr.onMessage(nodeId, obj);
+ }
+ finally {
+ threadProcessingMessage(false);
+
+ workersCnt.decrement();
+
+ msgC.run();
+ }
+ }
+ };
+
+ try {
+ p2pPool.execute(c);
+ }
+ catch (RejectedExecutionException e) {
+ U.error(log, "Failed to process P2P message due to execution rejection. Increase the upper bound " +
+ "on 'ExecutorService' provided by 'GridConfiguration.getPeerClassLoadingExecutorService()'. " +
+ "Will attempt to process message in the listener thread instead.", e);
+
+ c.run();
+ }
+ }
+
+ /**
+ * @param nodeId Node ID.
+ * @param msg Message.
+ * @param plc Execution policy.
+ * @param msgC Closure to call when message processing finished.
+ */
+ private void processRegularMessage(
+ final UUID nodeId,
+ final GridIoMessage msg,
+ GridIoPolicy plc,
+ final IgniteRunnable msgC
+ ) {
+ workersCnt.increment();
+
+ Runnable c = new GridWorker(ctx.gridName(), "msg-worker", log) {
+ @Override protected void body() {
+ try {
+ threadProcessingMessage(true);
+
+ processRegularMessage0(msg, nodeId);
+ }
+ finally {
+ threadProcessingMessage(false);
+
+ workersCnt.decrement();
+
+ msgC.run();
+ }
+ }
+ };
+
+ try {
+ pool(plc).execute(c);
+ }
+ catch (RejectedExecutionException e) {
+ U.error(log, "Failed to process regular message due to execution rejection. Increase the upper bound " +
+ "on 'ExecutorService' provided by 'GridConfiguration.getExecutorService()'. " +
+ "Will attempt to process message in the listener thread instead.", e);
+
+ c.run();
+ }
+ }
+
+ /**
+ * @param msg Message.
+ * @param nodeId Node ID.
+ */
+ @SuppressWarnings("deprecation")
+ private void processRegularMessage0(GridIoMessage msg, UUID nodeId) {
+ GridMessageListener lsnr = lsnrMap.get(msg.topic());
+
+ if (lsnr == null)
+ return;
+
+ Object obj = msg.message();
+
+ assert obj != null;
+
+ lsnr.onMessage(nodeId, obj);
+ }
+
+ /**
+ * @param nodeId Node ID.
+ * @param msg Ordered message.
+ * @param plc Execution policy.
+ * @param msgC Closure to call when message processing finished ({@code null} for sync processing).
+ */
+ @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
+ private void processOrderedMessage(
+ final UUID nodeId,
+ final GridIoMessage msg,
+ final GridIoPolicy plc,
+ @Nullable final IgniteRunnable msgC
+ ) {
+ assert msg != null;
+
+ long timeout = msg.timeout();
+ boolean skipOnTimeout = msg.skipOnTimeout();
+
+ boolean isNew = false;
+
+ ConcurrentMap<UUID, GridCommunicationMessageSet> map;
+
+ GridCommunicationMessageSet set = null;
+
+ while (true) {
+ map = msgSetMap.get(msg.topic());
+
+ if (map == null) {
+ set = new GridCommunicationMessageSet(plc, msg.topic(), nodeId, timeout, skipOnTimeout, msg);
+
+ map = new ConcurrentHashMap0<>();
+
+ map.put(nodeId, set);
+
+ ConcurrentMap<UUID, GridCommunicationMessageSet> old = msgSetMap.putIfAbsent(
+ msg.topic(), map);
+
+ if (old != null)
+ map = old;
+ else {
+ isNew = true;
+
+ // Put succeeded.
+ break;
+ }
+ }
+
+ boolean rmv = false;
+
+ synchronized (map) {
+ if (map.isEmpty())
+ rmv = true;
+ else {
+ set = map.get(nodeId);
+
+ if (set == null) {
+ GridCommunicationMessageSet old = map.putIfAbsent(nodeId,
+ set = new GridCommunicationMessageSet(plc, msg.topic(),
+ nodeId, timeout, skipOnTimeout, msg));
+
+ assert old == null;
+
+ isNew = true;
+
+ // Put succeeded.
+ break;
+ }
+ }
+ }
+
+ if (rmv)
+ msgSetMap.remove(msg.topic(), map);
+ else {
+ assert set != null;
+ assert !isNew;
+
+ set.add(msg);
+
+ break;
+ }
+ }
+
+ if (isNew && ctx.discovery().node(nodeId) == null) {
+ if (log.isDebugEnabled())
+ log.debug("Message is ignored as sender has left the grid: " + msg);
+
+ assert map != null;
+
+ boolean rmv;
+
+ synchronized (map) {
+ map.remove(nodeId);
+
+ rmv = map.isEmpty();
+ }
+
+ if (rmv)
+ msgSetMap.remove(msg.topic(), map);
+
+ return;
+ }
+
+ if (isNew && set.endTime() != Long.MAX_VALUE)
+ ctx.timeout().addTimeoutObject(set);
+
+ if (set.reserved()) {
+ // Set is reserved which means that it is currently processed by worker thread.
+ if (msgC != null)
+ msgC.run();
+
+ return;
+ }
+
+ final GridMessageListener lsnr = lsnrMap.get(msg.topic());
+
+ if (lsnr == null) {
+ if (closedTopics.contains(msg.topic())) {
+ if (log.isDebugEnabled())
+ log.debug("Message is ignored as it came for the closed topic: " + msg);
+
+ assert map != null;
+
+ msgSetMap.remove(msg.topic(), map);
+ }
+ else if (log.isDebugEnabled()) {
+ // Note that we simply keep messages if listener is not
+ // registered yet, until one will be registered.
+ log.debug("Received message for unknown listener (messages will be kept until a " +
+ "listener is registered): " + msg);
+ }
+
+ // Mark the message as processed.
+ if (msgC != null)
+ msgC.run();
+
+ return;
+ }
+
+ if (msgC == null) {
+ // Message from local node can be processed in sync manner.
+ assert locNodeId.equals(nodeId);
+
+ unwindMessageSet(set, lsnr);
+
+ return;
+ }
+
+ // Set is not reserved and new worker should be submitted.
+ workersCnt.increment();
+
+ final GridCommunicationMessageSet msgSet0 = set;
+
+ Runnable c = new GridWorker(ctx.gridName(), "msg-worker", log) {
+ @Override protected void body() {
+ try {
+ threadProcessingMessage(true);
+
+ unwindMessageSet(msgSet0, lsnr);
+ }
+ finally {
+ threadProcessingMessage(false);
+
+ workersCnt.decrement();
+
+ msgC.run();
+ }
+ }
+ };
+
+ try {
+ pool(plc).execute(c);
+ }
+ catch (RejectedExecutionException e) {
+ U.error(log, "Failed to process ordered message due to execution rejection. " +
+ "Increase the upper bound on executor service provided by corresponding " +
+ "configuration property. Will attempt to process message in the listener " +
+ "thread instead [msgPlc=" + plc + ']', e);
+
+ c.run();
+ }
+ }
+
+ /**
+ * @param msgSet Message set to unwind.
+ * @param lsnr Listener to notify.
+ */
+ private void unwindMessageSet(GridCommunicationMessageSet msgSet, GridMessageListener lsnr) {
+ // Loop until message set is empty or
+ // another thread owns the reservation.
+ while (true) {
+ if (msgSet.reserve()) {
+ try {
+ msgSet.unwind(lsnr);
+ }
+ finally {
+ msgSet.release();
+ }
+
+ // Check outside of reservation block.
+ if (!msgSet.changed()) {
+ if (log.isDebugEnabled())
+ log.debug("Message set has not been changed: " + msgSet);
+
+ break;
+ }
+ }
+ else {
+ if (log.isDebugEnabled())
+ log.debug("Another thread owns reservation: " + msgSet);
+
+ return;
+ }
+ }
+ }
+
+ /**
+ * @param node Destination node.
+ * @param topic Topic to send the message to.
+ * @param topicOrd GridTopic enumeration ordinal.
+ * @param msg Message to send.
+ * @param plc Type of processing.
+ * @param ordered Ordered flag.
+ * @param timeout Timeout.
+ * @param skipOnTimeout Whether message can be skipped on timeout.
+ * @throws IgniteCheckedException Thrown in case of any errors.
+ */
+ private void send(
+ ClusterNode node,
+ Object topic,
+ int topicOrd,
+ GridTcpCommunicationMessageAdapter msg,
+ GridIoPolicy plc,
+ boolean ordered,
+ long timeout,
+ boolean skipOnTimeout
+ ) throws IgniteCheckedException {
+ assert node != null;
+ assert topic != null;
+ assert msg != null;
+ assert plc != null;
+
+ GridIoMessage ioMsg = new GridIoMessage(plc, topic, topicOrd, msg, ordered, timeout, skipOnTimeout);
+
+ if (locNodeId.equals(node.id())) {
+ assert plc != P2P_POOL;
+
+ CommunicationListener commLsnr = this.commLsnr;
+
+ if (commLsnr == null)
+ throw new IgniteCheckedException("Trying to send message when grid is not fully started.");
+
+ if (ordered)
+ processOrderedMessage(locNodeId, ioMsg, plc, null);
+ else
+ processRegularMessage0(ioMsg, locNodeId);
+ }
+ else {
++ ioMsg.setWriter(writerFactory.writer());
++
+ if (topicOrd < 0)
+ ioMsg.topicBytes(marsh.marshal(topic));
+
+ try {
+ getSpi().sendMessage(node, ioMsg);
+ }
+ catch (IgniteSpiException e) {
+ throw new IgniteCheckedException("Failed to send message (node may have left the grid or " +
+ "TCP connection cannot be established due to firewall issues) " +
+ "[node=" + node + ", topic=" + topic +
+ ", msg=" + msg + ", policy=" + plc + ']', e);
+ }
+ }
+ }
+
+ /**
+ * @param nodeId Id of destination node.
+ * @param topic Topic to send the message to.
+ * @param msg Message to send.
+ * @param plc Type of processing.
+ * @throws IgniteCheckedException Thrown in case of any errors.
+ */
+ public void send(UUID nodeId, Object topic, GridTcpCommunicationMessageAdapter msg, GridIoPolicy plc)
+ throws IgniteCheckedException {
+ ClusterNode node = ctx.discovery().node(nodeId);
+
+ if (node == null)
+ throw new IgniteCheckedException("Failed to send message to node (has node left grid?): " + nodeId);
+
+ send(node, topic, msg, plc);
+ }
+
+ /**
+ * @param nodeId Id of destination node.
+ * @param topic Topic to send the message to.
+ * @param msg Message to send.
+ * @param plc Type of processing.
+ * @throws IgniteCheckedException Thrown in case of any errors.
+ */
+ @SuppressWarnings("TypeMayBeWeakened")
+ public void send(UUID nodeId, GridTopic topic, GridTcpCommunicationMessageAdapter msg, GridIoPolicy plc)
+ throws IgniteCheckedException {
+ ClusterNode node = ctx.discovery().node(nodeId);
+
+ if (node == null)
+ throw new IgniteCheckedException("Failed to send message to node (has node left grid?): " + nodeId);
+
+ send(node, topic, topic.ordinal(), msg, plc, false, 0, false);
+ }
+
+ /**
+ * @param node Destination node.
+ * @param topic Topic to send the message to.
+ * @param msg Message to send.
+ * @param plc Type of processing.
+ * @throws IgniteCheckedException Thrown in case of any errors.
+ */
+ public void send(ClusterNode node, Object topic, GridTcpCommunicationMessageAdapter msg, GridIoPolicy plc)
+ throws IgniteCheckedException {
+ send(node, topic, -1, msg, plc, false, 0, false);
+ }
+
+ /**
+ * @param node Destination node.
+ * @param topic Topic to send the message to.
+ * @param msg Message to send.
+ * @param plc Type of processing.
+ * @throws IgniteCheckedException Thrown in case of any errors.
+ */
+ public void send(ClusterNode node, GridTopic topic, GridTcpCommunicationMessageAdapter msg, GridIoPolicy plc)
+ throws IgniteCheckedException {
+ send(node, topic, topic.ordinal(), msg, plc, false, 0, false);
+ }
+
+ /**
+ * @param node Destination node.
+ * @param topic Topic to send the message to.
+ * @param msg Message to send.
+ * @param plc Type of processing.
+ * @param timeout Timeout to keep a message on receiving queue.
+ * @param skipOnTimeout Whether message can be skipped on timeout.
+ * @throws IgniteCheckedException Thrown in case of any errors.
+ */
+ public void sendOrderedMessage(
+ ClusterNode node,
+ Object topic,
+ GridTcpCommunicationMessageAdapter msg,
+ GridIoPolicy plc,
+ long timeout,
+ boolean skipOnTimeout
+ ) throws IgniteCheckedException {
+ assert timeout > 0 || skipOnTimeout;
+
+ send(node, topic, (byte)-1, msg, plc, true, timeout, skipOnTimeout);
+ }
+
+ /**
+ * @param nodeId Destination node.
+ * @param topic Topic to send the message to.
+ * @param msg Message to send.
+ * @param plc Type of processing.
+ * @param timeout Timeout to keep a message on receiving queue.
+ * @param skipOnTimeout Whether message can be skipped on timeout.
+ * @throws IgniteCheckedException Thrown in case of any errors.
+ */
+ public void sendOrderedMessage(
+ UUID nodeId,
+ Object topic,
+ GridTcpCommunicationMessageAdapter msg,
+ GridIoPolicy plc,
+ long timeout,
+ boolean skipOnTimeout
+ ) throws IgniteCheckedException {
+ assert timeout > 0 || skipOnTimeout;
+
+ ClusterNode node = ctx.discovery().node(nodeId);
+
+ if (node == null)
+ throw new IgniteCheckedException("Failed to send message to node (has node left grid?): " + nodeId);
+
+ send(node, topic, (byte)-1, msg, plc, true, timeout, skipOnTimeout);
+ }
+
+ /**
+ * @param nodes Destination nodes.
+ * @param topic Topic to send the message to.
+ * @param msg Message to send.
+ * @param plc Type of processing.
+ * @param timeout Timeout to keep a message on receiving queue.
+ * @param skipOnTimeout Whether message can be skipped on timeout.
+ * @throws IgniteCheckedException Thrown in case of any errors.
+ */
+ public void sendOrderedMessage(
+ Collection<? extends ClusterNode> nodes,
+ Object topic,
+ GridTcpCommunicationMessageAdapter msg,
+ GridIoPolicy plc,
+ long timeout,
+ boolean skipOnTimeout
+ )
+ throws IgniteCheckedException {
+ assert timeout > 0 || skipOnTimeout;
+
+ send(nodes, topic, -1, msg, plc, true, timeout, skipOnTimeout);
+ }
+
+ /**
+ * @param nodes Destination nodes.
+ * @param topic Topic to send the message to.
+ * @param msg Message to send.
+ * @param plc Type of processing.
+ * @throws IgniteCheckedException Thrown in case of any errors.
+ */
+ public void send(
+ Collection<? extends ClusterNode> nodes,
+ Object topic,
+ GridTcpCommunicationMessageAdapter msg,
+ GridIoPolicy plc
+ ) throws IgniteCheckedException {
+ send(nodes, topic, -1, msg, plc, false, 0, false);
+ }
+
+ /**
+ * @param nodes Destination nodes.
+ * @param topic Topic to send the message to.
+ * @param msg Message to send.
+ * @param plc Type of processing.
+ * @throws IgniteCheckedException Thrown in case of any errors.
+ */
+ public void send(
+ Collection<? extends ClusterNode> nodes,
+ GridTopic topic,
+ GridTcpCommunicationMessageAdapter msg,
+ GridIoPolicy plc
+ ) throws IgniteCheckedException {
+ send(nodes, topic, topic.ordinal(), msg, plc, false, 0, false);
+ }
+
+ /**
+ * Sends a peer deployable user message.
+ *
+ * @param nodes Destination nodes.
+ * @param msg Message to send.
+ * @throws IgniteCheckedException Thrown in case of any errors.
+ */
+ public void sendUserMessage(Collection<? extends ClusterNode> nodes, Object msg) throws IgniteCheckedException {
+ sendUserMessage(nodes, msg, null, false, 0);
+ }
+
+ /**
+ * Sends a peer deployable user message.
+ *
+ * @param nodes Destination nodes.
+ * @param msg Message to send.
+ * @param topic Message topic to use.
+ * @param ordered Is message ordered?
+ * @param timeout Message timeout in milliseconds for ordered messages.
+ * @throws IgniteCheckedException Thrown in case of any errors.
+ */
+ @SuppressWarnings("ConstantConditions")
+ public void sendUserMessage(Collection<? extends ClusterNode> nodes, Object msg,
+ @Nullable Object topic, boolean ordered, long timeout) throws IgniteCheckedException {
+ boolean loc = nodes.size() == 1 && F.first(nodes).id().equals(locNodeId);
+
+ byte[] serMsg = null;
+ byte[] serTopic = null;
+
+ if (!loc) {
+ serMsg = marsh.marshal(msg);
+
+ if (topic != null)
+ serTopic = marsh.marshal(topic);
+ }
+
+ GridDeployment dep = null;
+
+ String depClsName = null;
+
+ if (ctx.config().isPeerClassLoadingEnabled()) {
+ Class<?> cls0 = U.detectClass(msg);
+
+ if (U.isJdk(cls0) && topic != null)
+ cls0 = U.detectClass(topic);
+
+ dep = ctx.deploy().deploy(cls0, U.detectClassLoader(cls0));
+
+ if (dep == null)
+ throw new IgniteDeploymentException("Failed to deploy user message: " + msg);
+
+ depClsName = cls0.getName();
+ }
+
+ GridTcpCommunicationMessageAdapter ioMsg = new GridIoUserMessage(
+ msg,
+ serMsg,
+ depClsName,
+ topic,
+ serTopic,
+ dep != null ? dep.classLoaderId() : null,
+ dep != null ? dep.deployMode() : null,
+ dep != null ? dep.userVersion() : null,
+ dep != null ? dep.participants() : null);
+
+ if (ordered)
+ sendOrderedMessage(nodes, TOPIC_COMM_USER, ioMsg, PUBLIC_POOL, timeout, true);
+ else if (loc)
+ send(F.first(nodes), TOPIC_COMM_USER, ioMsg, PUBLIC_POOL);
+ else {
+ ClusterNode locNode = F.find(nodes, null, F.localNode(locNodeId));
+
+ Collection<? extends ClusterNode> rmtNodes = F.view(nodes, F.remoteNodes(locNodeId));
+
+ if (locNode != null)
+ send(locNode, TOPIC_COMM_USER, ioMsg, PUBLIC_POOL);
+
+ if (!rmtNodes.isEmpty())
+ send(rmtNodes, TOPIC_COMM_USER, ioMsg, PUBLIC_POOL);
+ }
+ }
+
+ /**
+ * @param topic Topic to subscribe to.
+ * @param p Message predicate.
+ */
+ public void addUserMessageListener(@Nullable final Object topic, @Nullable final IgniteBiPredicate<UUID, ?> p) {
+ if (p != null) {
+ try {
+ addMessageListener(TOPIC_COMM_USER,
+ new GridUserMessageListener(topic, (IgniteBiPredicate<UUID, Object>)p));
+ }
+ catch (IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
+ }
+ }
+
+ /**
+ * @param topic Topic to unsubscribe from.
+ * @param p Message predicate.
+ */
+ public void removeUserMessageListener(@Nullable Object topic, IgniteBiPredicate<UUID, ?> p) {
+ try {
+ removeMessageListener(TOPIC_COMM_USER,
+ new GridUserMessageListener(topic, (IgniteBiPredicate<UUID, Object>)p));
+ }
+ catch (IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
+ }
+
+ /**
+ * @param nodes Destination nodes.
+ * @param topic Topic to send the message to.
+ * @param topicOrd Topic ordinal value.
+ * @param msg Message to send.
+ * @param plc Type of processing.
+ * @param ordered Ordered flag.
+ * @param timeout Message timeout.
+ * @param skipOnTimeout Whether message can be skipped in timeout.
+ * @throws IgniteCheckedException Thrown in case of any errors.
+ */
+ private void send(
+ Collection<? extends ClusterNode> nodes,
+ Object topic,
+ int topicOrd,
+ GridTcpCommunicationMessageAdapter msg,
+ GridIoPolicy plc,
+ boolean ordered,
+ long timeout,
+ boolean skipOnTimeout
+ ) throws IgniteCheckedException {
+ assert nodes != null;
+ assert topic != null;
+ assert msg != null;
+ assert plc != null;
+
+ if (!ordered)
+ assert F.find(nodes, null, F.localNode(locNodeId)) == null :
+ "Internal GridGain code should never call the method with local node in a node list.";
+
+ try {
+ // Small optimization, as communication SPIs may have lighter implementation for sending
+ // messages to one node vs. many.
+ if (!nodes.isEmpty()) {
+ boolean first = true;
+
+ for (ClusterNode node : nodes) {
+ GridTcpCommunicationMessageAdapter msg0 = first ? msg : msg.clone();
+
+ first = false;
+
+ send(node, topic, topicOrd, msg0, plc, ordered, timeout, skipOnTimeout);
+ }
+ }
+ else if (log.isDebugEnabled())
+ log.debug("Failed to send message to empty nodes collection [topic=" + topic + ", msg=" +
+ msg + ", policy=" + plc + ']');
+ }
+ catch (IgniteSpiException e) {
+ throw new IgniteCheckedException("Failed to send message (nodes may have left the grid or " +
+ "TCP connection cannot be established due to firewall issues) " +
+ "[nodes=" + nodes + ", topic=" + topic +
+ ", msg=" + msg + ", policy=" + plc + ']', e);
+ }
+ }
+
+ /**
+ * @param topic Listener's topic.
+ * @param lsnr Listener to add.
+ */
+ @SuppressWarnings({"TypeMayBeWeakened", "deprecation"})
+ public void addMessageListener(GridTopic topic, GridMessageListener lsnr) {
+ addMessageListener((Object)topic, lsnr);
+ }
+
+ /**
+ * @param lsnr Listener to add.
+ */
+ public void addDisconnectListener(GridDisconnectListener lsnr) {
+ disconnectLsnrs.add(lsnr);
+ }
+
+ /**
+ * @param topic Listener's topic.
+ * @param lsnr Listener to add.
+ */
+ @SuppressWarnings({"deprecation", "SynchronizationOnLocalVariableOrMethodParameter"})
+ public void addMessageListener(Object topic, final GridMessageListener lsnr) {
+ assert lsnr != null;
+ assert topic != null;
+
+ // Make sure that new topic is not in the list of closed topics.
+ closedTopics.remove(topic);
+
+ GridMessageListener lsnrs;
+
+ for (;;) {
+ lsnrs = lsnrMap.putIfAbsent(topic, lsnr);
+
+ if (lsnrs == null) {
+ lsnrs = lsnr;
+
+ break;
+ }
+
+ assert lsnrs != null;
+
+ if (!(lsnrs instanceof ArrayListener)) { // We are putting the second listener, creating array.
+ GridMessageListener arrLsnr = new ArrayListener(lsnrs, lsnr);
+
+ if (lsnrMap.replace(topic, lsnrs, arrLsnr)) {
+ lsnrs = arrLsnr;
+
+ break;
+ }
+ }
+ else {
+ if (((ArrayListener)lsnrs).add(lsnr))
+ break;
+
+ // Add operation failed because array is already empty and is about to be removed, helping and retrying.
+ lsnrMap.remove(topic, lsnrs);
+ }
+ }
+
+ Map<UUID, GridCommunicationMessageSet> map = msgSetMap.get(topic);
+
+ Collection<GridCommunicationMessageSet> msgSets = map != null ? map.values() : null;
+
+ if (msgSets != null) {
+ final GridMessageListener lsnrs0 = lsnrs;
+
+ boolean success = true;
+
+ try {
+ for (final GridCommunicationMessageSet msgSet : msgSets) {
+ success = false;
+
+ workersCnt.increment();
+
+ pool(msgSet.policy()).execute(new GridWorker(ctx.gridName(), "msg-worker", log) {
+ @Override protected void body() {
+ try {
+ unwindMessageSet(msgSet, lsnrs0);
+ }
+ finally {
+ workersCnt.decrement();
+ }
+ }
+ });
+
+ success = true;
+ }
+ }
+ catch (RejectedExecutionException e) {
+ U.error(log, "Failed to process delayed message due to execution rejection. Increase the upper bound " +
+ "on executor service provided in 'GridConfiguration.getExecutorService()'). Will attempt to " +
+ "process message in the listener thread instead.", e);
+
+ for (GridCommunicationMessageSet msgSet : msgSets)
+ unwindMessageSet(msgSet, lsnr);
+ }
+ finally {
+ // Decrement for last runnable submission of which failed.
+ if (!success)
+ workersCnt.decrement();
+ }
+ }
+ }
+
+ /**
+ * @param topic Message topic.
+ * @return Whether or not listener was indeed removed.
+ */
+ public boolean removeMessageListener(GridTopic topic) {
+ return removeMessageListener((Object)topic);
+ }
+
+ /**
+ * @param topic Message topic.
+ * @return Whether or not listener was indeed removed.
+ */
+ public boolean removeMessageListener(Object topic) {
+ return removeMessageListener(topic, null);
+ }
+
+ /**
+ * @param topic Listener's topic.
+ * @param lsnr Listener to remove.
+ * @return Whether or not the lsnr was removed.
+ */
+ @SuppressWarnings("deprecation")
+ public boolean removeMessageListener(GridTopic topic, @Nullable GridMessageListener lsnr) {
+ return removeMessageListener((Object)topic, lsnr);
+ }
+
+ /**
+ * @param topic Listener's topic.
+ * @param lsnr Listener to remove.
+ * @return Whether or not the lsnr was removed.
+ */
+ @SuppressWarnings({"deprecation", "SynchronizationOnLocalVariableOrMethodParameter"})
+ public boolean removeMessageListener(Object topic, @Nullable final GridMessageListener lsnr) {
+ assert topic != null;
+
+ boolean rmv = true;
+
+ Collection<GridCommunicationMessageSet> msgSets = null;
+
+ // If listener is null, then remove all listeners.
+ if (lsnr == null) {
+ closedTopics.add(topic);
+
+ rmv = lsnrMap.remove(topic) != null;
+
+ Map<UUID, GridCommunicationMessageSet> map = msgSetMap.remove(topic);
+
+ if (map != null)
+ msgSets = map.values();
+ }
+ else {
+ for (;;) {
+ GridMessageListener lsnrs = lsnrMap.get(topic);
+
+ // If removing listener before subscription happened.
+ if (lsnrs == null) {
+ closedTopics.add(topic);
+
+ Map<UUID, GridCommunicationMessageSet> map = msgSetMap.remove(topic);
+
+ if (map != null)
+ msgSets = map.values();
+
+ rmv = false;
+
+ break;
+ }
+ else {
+ boolean empty = false;
+
+ if (!(lsnrs instanceof ArrayListener)) {
+ if (lsnrs.equals(lsnr)) {
+ if (!lsnrMap.remove(topic, lsnrs))
+ continue; // Retry because it can be packed to array listener.
+
+ empty = true;
+ }
+ else
+ rmv = false;
+ }
+ else {
+ ArrayListener arrLsnr = (ArrayListener)lsnrs;
+
+ if (arrLsnr.remove(lsnr))
+ empty = arrLsnr.isEmpty();
+ else
+ // Listener was not found.
+ rmv = false;
+
+ if (empty)
+ lsnrMap.remove(topic, lsnrs);
+ }
+
+ // If removing last subscribed listener.
+ if (empty) {
+ closedTopics.add(topic);
+
+ Map<UUID, GridCommunicationMessageSet> map = msgSetMap.remove(topic);
+
+ if (map != null)
+ msgSets = map.values();
+ }
+
+ break;
+ }
+ }
+ }
+
+ if (msgSets != null)
+ for (GridCommunicationMessageSet msgSet : msgSets)
+ ctx.timeout().removeTimeoutObject(msgSet);
+
+ if (rmv && log.isDebugEnabled())
+ log.debug("Removed message listener [topic=" + topic + ", lsnr=" + lsnr + ']');
+
+ return rmv;
+ }
+
+ /**
+ * Gets sent messages count.
+ *
+ * @return Sent messages count.
+ */
+ public int getSentMessagesCount() {
+ return getSpi().getSentMessagesCount();
+ }
+
+ /**
+ * Gets sent bytes count.
+ *
+ * @return Sent bytes count.
+ */
+ public long getSentBytesCount() {
+ return getSpi().getSentBytesCount();
+ }
+
+ /**
+ * Gets received messages count.
+ *
+ * @return Received messages count.
+ */
+ public int getReceivedMessagesCount() {
+ return getSpi().getReceivedMessagesCount();
+ }
+
+ /**
+ * Gets received bytes count.
+ *
+ * @return Received bytes count.
+ */
+ public long getReceivedBytesCount() {
+ return getSpi().getReceivedBytesCount();
+ }
+
+ /**
+ * Gets outbound messages queue size.
+ *
+ * @return Outbound messages queue size.
+ */
+ public int getOutboundMessagesQueueSize() {
+ return getSpi().getOutboundMessagesQueueSize();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void printMemoryStats() {
+ X.println(">>>");
+ X.println(">>> IO manager memory stats [grid=" + ctx.gridName() + ']');
+ X.println(">>> lsnrMapSize: " + lsnrMap.size());
+ X.println(">>> msgSetMapSize: " + msgSetMap.size());
+ X.println(">>> closedTopicsSize: " + closedTopics.sizex());
+ X.println(">>> discoWaitMapSize: " + waitMap.size());
+ }
+
+ /**
+ * Linked chain of listeners.
+ */
+ private static class ArrayListener implements GridMessageListener {
+ /** */
+ private volatile GridMessageListener[] arr;
+
+ /**
+ * @param arr Array of listeners.
+ */
+ ArrayListener(GridMessageListener... arr) {
+ this.arr = arr;
+ }
+
+ /**
+ * Passes message to the whole chain.
+ *
+ * @param nodeId Node ID.
+ * @param msg Message.
+ */
+ @Override public void onMessage(UUID nodeId, Object msg) {
+ GridMessageListener[] arr0 = arr;
+
+ if (arr0 == null)
+ return;
+
+ for (GridMessageListener l : arr0)
+ l.onMessage(nodeId, msg);
+ }
+
+ /**
+ * @return {@code true} If this instance is empty.
+ */
+ boolean isEmpty() {
+ return arr == null;
+ }
+
+ /**
+ * @param l Listener.
+ * @return {@code true} If listener was removed.
+ */
+ synchronized boolean remove(GridMessageListener l) {
+ GridMessageListener[] arr0 = arr;
+
+ if (arr0 == null)
+ return false;
+
+ if (arr0.length == 1) {
+ if (!arr0[0].equals(l))
+ return false;
+
+ arr = null;
+
+ return true;
+ }
+
+ for (int i = 0; i < arr0.length; i++) {
+ if (arr0[i].equals(l)) {
+ int newLen = arr0.length - 1;
+
+ if (i == newLen) // Remove last.
+ arr = Arrays.copyOf(arr0, newLen);
+ else {
+ GridMessageListener[] arr1 = new GridMessageListener[newLen];
+
+ if (i != 0) // Not remove first.
+ System.arraycopy(arr0, 0, arr1, 0, i);
+
+ System.arraycopy(arr0, i + 1, arr1, i, newLen - i);
+
+ arr = arr1;
+ }
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * @param l Listener.
+ * @return {@code true} if listener was added. Add can fail if this instance is empty and is about to be removed
+ * from map.
+ */
+ synchronized boolean add(GridMessageListener l) {
+ GridMessageListener[] arr0 = arr;
+
+ if (arr0 == null)
+ return false;
+
+ int oldLen = arr0.length;
+
+ arr0 = Arrays.copyOf(arr0, oldLen + 1);
+
+ arr0[oldLen] = l;
+
+ arr = arr0;
+
+ return true;
+ }
+ }
+
+ /**
+ * This class represents a message listener wrapper that knows about peer deployment.
+ */
+ private class GridUserMessageListener implements GridMessageListener {
+ /** Predicate listeners. */
+ private final IgniteBiPredicate<UUID, Object> predLsnr;
+
+ /** User message topic. */
+ private final Object topic;
+
+ /**
+ * @param topic User topic.
+ * @param predLsnr Predicate listener.
+ * @throws IgniteCheckedException If failed to inject resources to predicates.
+ */
+ GridUserMessageListener(@Nullable Object topic, @Nullable IgniteBiPredicate<UUID, Object> predLsnr)
+ throws IgniteCheckedException {
+ this.topic = topic;
+ this.predLsnr = predLsnr;
+
+ if (predLsnr != null)
+ ctx.resource().injectGeneric(predLsnr);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"SynchronizationOnLocalVariableOrMethodParameter", "ConstantConditions",
+ "OverlyStrongTypeCast"})
+ @Override public void onMessage(UUID nodeId, Object msg) {
+ if (!(msg instanceof GridIoUserMessage)) {
+ U.error(log, "Received unknown message (potentially fatal problem): " + msg);
+
+ return;
+ }
+
+ GridIoUserMessage ioMsg = (GridIoUserMessage)msg;
+
+ ClusterNode node = ctx.discovery().node(nodeId);
+
+ if (node == null) {
+ U.warn(log, "Failed to resolve sender node (did the node left grid?): " + nodeId);
+
+ return;
+ }
+
+ Object msgBody = ioMsg.body();
+
+ assert msgBody != null || ioMsg.bodyBytes() != null;
+
+ try {
+ byte[] msgTopicBytes = ioMsg.topicBytes();
+
+ Object msgTopic = ioMsg.topic();
+
+ GridDeployment dep = ioMsg.deployment();
+
+ if (dep == null && ctx.config().isPeerClassLoadingEnabled() &&
+ ioMsg.deploymentClassName() != null) {
+ dep = ctx.deploy().getGlobalDeployment(
+ ioMsg.deploymentMode(),
+ ioMsg.deploymentClassName(),
+ ioMsg.deploymentClassName(),
+ ioMsg.userVersion(),
+ nodeId,
+ ioMsg.classLoaderId(),
+ ioMsg.loaderParticipants(),
+ null);
+
+ if (dep == null)
+ throw new IgniteDeploymentException(
+ "Failed to obtain deployment information for user message. " +
+ "If you are using custom message or topic class, try implementing " +
+ "GridPeerDeployAware interface. [msg=" + ioMsg + ']');
+
+ ioMsg.deployment(dep); // Cache deployment.
+ }
+
+ // Unmarshall message topic if needed.
+ if (msgTopic == null && msgTopicBytes != null) {
+ msgTopic = marsh.unmarshal(msgTopicBytes, dep != null ? dep.classLoader() : null);
+
+ ioMsg.topic(msgTopic); // Save topic to avoid future unmarshallings.
+ }
+
+ if (!F.eq(topic, msgTopic))
+ return;
+
+ if (msgBody == null) {
+ msgBody = marsh.unmarshal(ioMsg.bodyBytes(), dep != null ? dep.classLoader() : null);
+
+ ioMsg.body(msgBody); // Save body to avoid future unmarshallings.
+ }
+
+ // Resource injection.
+ if (dep != null)
+ ctx.resource().inject(dep, dep.deployedClass(ioMsg.deploymentClassName()), msgBody);
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to unmarshal user message [node=" + nodeId + ", message=" +
+ msg + ']', e);
+ }
+
+ if (msgBody != null) {
+ if (predLsnr != null) {
+ if (!predLsnr.apply(nodeId, msgBody))
+ removeMessageListener(TOPIC_COMM_USER, this);
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ GridUserMessageListener l = (GridUserMessageListener)o;
+
+ return F.eq(predLsnr, l.predLsnr) && F.eq(topic, l.topic);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ int res = predLsnr != null ? predLsnr.hashCode() : 0;
+
+ res = 31 * res + (topic != null ? topic.hashCode() : 0);
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridUserMessageListener.class, this);
+ }
+ }
+
+ /**
+ * Ordered communication message set.
+ */
+ private class GridCommunicationMessageSet implements GridTimeoutObject {
+ /** */
+ private final UUID nodeId;
+
+ /** */
+ private long endTime;
+
+ /** */
+ private final IgniteUuid timeoutId;
+
+ /** */
+ @GridToStringInclude
+ private final Object topic;
+
+ /** */
+ private final GridIoPolicy plc;
+
+ /** */
+ @GridToStringInclude
+ private final Queue<IgniteBiTuple<GridIoMessage, Long>> msgs = new ConcurrentLinkedDeque<>();
+
+ /** */
+ private final AtomicBoolean reserved = new AtomicBoolean();
+
+ /** */
+ private final long timeout;
+
+ /** */
+ private final boolean skipOnTimeout;
+
+ /** */
+ private long lastTs;
+
+ /**
+ * @param plc Communication policy.
+ * @param topic Communication topic.
+ * @param nodeId Node ID.
+ * @param timeout Timeout.
+ * @param skipOnTimeout Whether message can be skipped on timeout.
+ * @param msg Message to add immediately.
+ */
+ GridCommunicationMessageSet(
+ GridIoPolicy plc,
+ Object topic,
+ UUID nodeId,
+ long timeout,
+ boolean skipOnTimeout,
+ GridIoMessage msg
+ ) {
+ assert nodeId != null;
+ assert topic != null;
+ assert plc != null;
+ assert msg != null;
+
+ this.plc = plc;
+ this.nodeId = nodeId;
+ this.topic = topic;
+ this.timeout = timeout == 0 ? ctx.config().getNetworkTimeout() : timeout;
+ this.skipOnTimeout = skipOnTimeout;
+
+ endTime = endTime(timeout);
+
+ timeoutId = IgniteUuid.randomUuid();
+
+ lastTs = U.currentTimeMillis();
+
+ msgs.add(F.t(msg, lastTs));
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteUuid timeoutId() {
+ return timeoutId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long endTime() {
+ return endTime;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
+ @Override public void onTimeout() {
+ GridMessageListener lsnr = lsnrMap.get(topic);
+
+ if (lsnr != null) {
+ long delta = 0;
+
+ if (skipOnTimeout) {
+ while (true) {
+ delta = 0;
+
+ boolean unwind = false;
+
+ synchronized (this) {
+ if (!msgs.isEmpty()) {
+ delta = U.currentTimeMillis() - lastTs;
+
+ if (delta >= timeout)
+ unwind = true;
+ }
+ }
+
+ if (unwind)
+ unwindMessageSet(this, lsnr);
+ else
+ break;
+ }
+ }
+
+ // Someone is still listening to messages, so delay set removal.
+ endTime = endTime(timeout - delta);
+
+ ctx.timeout().addTimeoutObject(this);
+
+ return;
+ }
+
+ if (log.isDebugEnabled())
+ log.debug("Removing message set due to timeout: " + this);
+
+ ConcurrentMap<UUID, GridCommunicationMessageSet> map = msgSetMap.get(topic);
+
+ if (map != null) {
+ boolean rmv;
+
+ synchronized (map) {
+ rmv = map.remove(nodeId, this) && map.isEmpty();
+ }
+
+ if (rmv)
+ msgSetMap.remove(topic, map);
+ }
+ }
+
+ /**
+ * @return ID of node that sent the messages in the set.
+ */
+ UUID nodeId() {
+ return nodeId;
+ }
+
+ /**
+ * @return Communication policy.
+ */
+ GridIoPolicy policy() {
+ return plc;
+ }
+
+ /**
+ * @return Message topic.
+ */
+ Object topic() {
+ return topic;
+ }
+
+ /**
+ * @return {@code True} if successful.
+ */
+ boolean reserve() {
+ return reserved.compareAndSet(false, true);
+ }
+
+ /**
+ * @return {@code True} if set is reserved.
+ */
+ boolean reserved() {
+ return reserved.get();
+ }
+
+ /**
+ * Releases reservation.
+ */
+ void release() {
+ assert reserved.get() : "Message set was not reserved: " + this;
+
+ reserved.set(false);
+ }
+
+ /**
+ * @param lsnr Listener to notify.
+ */
+ void unwind(GridMessageListener lsnr) {
+ assert reserved.get();
+
+ for (IgniteBiTuple<GridIoMessage, Long> t = msgs.poll(); t != null; t = msgs.poll())
+ lsnr.onMessage(nodeId, t.get1().message());
+ }
+
+ /**
+ * @param msg Message to add.
+ */
+ void add(GridIoMessage msg) {
+ msgs.add(F.t(msg, U.currentTimeMillis()));
+ }
+
+ /**
+ * @return {@code True} if set has messages to unwind.
+ */
+ boolean changed() {
+ return !msgs.isEmpty();
+ }
+
+ /**
+ * Calculates end time with overflow check.
+ *
+ * @param timeout Timeout in milliseconds.
+ * @return End time in milliseconds.
+ */
+ private long endTime(long timeout) {
+ long endTime = U.currentTimeMillis() + timeout;
+
+ // Account for overflow.
+ if (endTime < 0)
+ endTime = Long.MAX_VALUE;
+
+ return endTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridCommunicationMessageSet.class, this);
+ }
+ }
+
+ /**
+ *
+ */
+ private static class ConcurrentHashMap0<K, V> extends ConcurrentHashMap8<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private int hash;
+
+ /**
+ * @param o Object to be compared for equality with this map.
+ * @return {@code True} only for {@code this}.
+ */
+ @Override public boolean equals(Object o) {
+ return o == this;
+ }
+
+ /**
+ * @return Identity hash code.
+ */
+ @Override public int hashCode() {
+ if (hash == 0) {
+ int hash0 = System.identityHashCode(this);
+
+ hash = hash0 != 0 ? hash0 : -1;
+ }
+
+ return hash;
+ }
+ }
+
+ /**
+ *
+ */
+ private static class DelayedMessage {
+ /** */
+ private final UUID nodeId;
+
+ /** */
+ private final GridIoMessage msg;
+
+ /** */
+ private final IgniteRunnable msgC;
+
+ /**
+ * @param nodeId Node ID.
+ * @param msg Message.
+ * @param msgC Callback.
+ */
+ private DelayedMessage(UUID nodeId, GridIoMessage msg, IgniteRunnable msgC) {
+ this.nodeId = nodeId;
+ this.msg = msg;
+ this.msgC = msgC;
+ }
+
+ /**
+ * @return Message char.
+ */
+ public IgniteRunnable callback() {
+ return msgC;
+ }
+
+ /**
+ * @return Message.
+ */
+ public GridIoMessage message() {
+ return msg;
+ }
+
+ /**
+ * @return Node id.
+ */
+ public UUID nodeId() {
+ return nodeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(DelayedMessage.class, this, super.toString());
+ }
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java
index 0000000,e7067f2..fd67067
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java
@@@ -1,0 -1,348 +1,344 @@@
+ /*
+ * 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.managers.communication;
+
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.apache.ignite.internal.util.tostring.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Wrapper for all grid messages.
+ */
+ public class GridIoMessage extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Policy. */
+ private GridIoPolicy plc;
+
+ /** Message topic. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Object topic;
+
+ /** Topic bytes. */
+ private byte[] topicBytes;
+
+ /** Topic ordinal. */
+ private int topicOrd = -1;
+
+ /** Message ordered flag. */
+ private boolean ordered;
+
+ /** Message timeout. */
+ private long timeout;
+
+ /** Whether message can be skipped on timeout. */
+ private boolean skipOnTimeout;
+
+ /** Message. */
+ private GridTcpCommunicationMessageAdapter msg;
+
+ /**
+ * No-op constructor to support {@link Externalizable} interface.
+ * This constructor is not meant to be used for other purposes.
+ */
+ public GridIoMessage() {
+ // No-op.
+ }
+
+ /**
+ * @param plc Policy.
+ * @param topic Communication topic.
+ * @param topicOrd Topic ordinal value.
+ * @param msg Message.
+ * @param ordered Message ordered flag.
+ * @param timeout Timeout.
+ * @param skipOnTimeout Whether message can be skipped on timeout.
+ */
+ public GridIoMessage(
+ GridIoPolicy plc,
+ Object topic,
+ int topicOrd,
+ GridTcpCommunicationMessageAdapter msg,
+ boolean ordered,
+ long timeout,
+ boolean skipOnTimeout
+ ) {
+ assert plc != null;
+ assert topic != null;
+ assert topicOrd <= Byte.MAX_VALUE;
+ assert msg != null;
+
+ this.plc = plc;
+ this.msg = msg;
+ this.topic = topic;
+ this.topicOrd = topicOrd;
+ this.ordered = ordered;
+ this.timeout = timeout;
+ this.skipOnTimeout = skipOnTimeout;
+ }
+
+ /**
+ * @return Policy.
+ */
+ GridIoPolicy policy() {
+ return plc;
+ }
+
+ /**
+ * @return Topic.
+ */
+ Object topic() {
+ return topic;
+ }
+
+ /**
+ * @param topic Topic.
+ */
+ void topic(Object topic) {
+ this.topic = topic;
+ }
+
+ /**
+ * @return Topic bytes.
+ */
+ byte[] topicBytes() {
+ return topicBytes;
+ }
+
+ /**
+ * @param topicBytes Topic bytes.
+ */
+ void topicBytes(byte[] topicBytes) {
+ this.topicBytes = topicBytes;
+ }
+
+ /**
+ * @return Topic ordinal.
+ */
+ int topicOrdinal() {
+ return topicOrd;
+ }
+
+ /**
+ * @return Message.
+ */
+ public Object message() {
+ return msg;
+ }
+
+ /**
+ * @return Message timeout.
+ */
+ public long timeout() {
+ return timeout;
+ }
+
+ /**
+ * @return Whether message can be skipped on timeout.
+ */
+ public boolean skipOnTimeout() {
+ return skipOnTimeout;
+ }
+
+ /**
+ * @return {@code True} if message is ordered, {@code false} otherwise.
+ */
+ boolean isOrdered() {
+ return ordered;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object obj) {
+ throw new AssertionError();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ throw new AssertionError();
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridIoMessage _clone = new GridIoMessage();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("RedundantCast")
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridIoMessage _clone = (GridIoMessage)_msg;
+
+ _clone.plc = plc;
+ _clone.topic = topic;
+ _clone.topicBytes = topicBytes;
+ _clone.topicOrd = topicOrd;
+ _clone.ordered = ordered;
+ _clone.timeout = timeout;
+ _clone.skipOnTimeout = skipOnTimeout;
+ _clone.msg = msg != null ? (GridTcpCommunicationMessageAdapter)msg.clone() : null;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putMessage(msg))
++ if (!commState.putMessage("msg", msg))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putBoolean(ordered))
++ if (!commState.putBoolean("ordered", ordered))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putEnum(plc))
++ if (!commState.putEnum("plc", plc))
+ return false;
+
+ commState.idx++;
+
+ case 3:
- if (!commState.putBoolean(skipOnTimeout))
++ if (!commState.putBoolean("skipOnTimeout", skipOnTimeout))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putLong(timeout))
++ if (!commState.putLong("timeout", timeout))
+ return false;
+
+ commState.idx++;
+
+ case 5:
- if (!commState.putByteArray(topicBytes))
++ if (!commState.putByteArray("topicBytes", topicBytes))
+ return false;
+
+ commState.idx++;
+
+ case 6:
- if (!commState.putInt(topicOrd))
++ if (!commState.putInt("topicOrd", topicOrd))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- Object msg0 = commState.getMessage();
++ msg = (GridTcpCommunicationMessageAdapter)commState.getMessage("msg");
+
- if (msg0 == MSG_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- msg = (GridTcpCommunicationMessageAdapter)msg0;
-
+ commState.idx++;
+
+ case 1:
- if (buf.remaining() < 1)
- return false;
++ ordered = commState.getBoolean("ordered");
+
- ordered = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 2:
- if (buf.remaining() < 1)
- return false;
++ byte plc0 = commState.getByte("plc");
+
- byte plc0 = commState.getByte();
++ if (!commState.lastRead())
++ return false;
+
+ plc = GridIoPolicy.fromOrdinal(plc0);
+
+ commState.idx++;
+
+ case 3:
- if (buf.remaining() < 1)
- return false;
++ skipOnTimeout = commState.getBoolean("skipOnTimeout");
+
- skipOnTimeout = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 4:
- if (buf.remaining() < 8)
- return false;
++ timeout = commState.getLong("timeout");
+
- timeout = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 5:
- byte[] topicBytes0 = commState.getByteArray();
++ topicBytes = commState.getByteArray("topicBytes");
+
- if (topicBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- topicBytes = topicBytes0;
-
+ commState.idx++;
+
+ case 6:
- if (buf.remaining() < 4)
- return false;
++ topicOrd = commState.getInt("topicOrd");
+
- topicOrd = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 8;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridIoMessage.class, this);
+ }
+ }
[25/52] [abbrv] incubator-ignite git commit: # ignite-sprint-1.
Posted by vk...@apache.org.
# ignite-sprint-1.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/bdebb406
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bdebb406
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bdebb406
Branch: refs/heads/ignite-61
Commit: bdebb406d6f58e7c6c4b334f6ea1a8be2b4ad7c8
Parents: 9502c0d
Author: AKuznetsov <ak...@gridgain.com>
Authored: Fri Jan 30 09:38:18 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Fri Jan 30 09:38:18 2015 +0700
----------------------------------------------------------------------
.../visor/commands/gc/VisorGcCommand.scala | 13 ++++------
.../visor/commands/gc/VisorGcCommandSpec.scala | 25 +++++++++++---------
2 files changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bdebb406/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala
index ef1a241..713247c 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala
@@ -17,17 +17,14 @@
package org.apache.ignite.visor.commands.gc
-import org.apache.ignite.internal.visor.node.VisorNodeGcTask
-
import org.apache.ignite._
import org.apache.ignite.cluster.{ClusterGroupEmptyException, ClusterNode}
-
-import java.lang.{Boolean => JavaBoolean}
-import java.util.{UUID, HashSet => JavaHashSet}
-
+import org.apache.ignite.internal.visor.node.VisorNodeGcTask
import org.apache.ignite.visor.VisorTag
import org.apache.ignite.visor.commands.{VisorConsoleCommand, VisorTextTable}
-import visor.visor._
+import org.apache.ignite.visor.visor._
+
+import java.util.UUID
import scala.collection.JavaConversions._
import scala.language.{implicitConversions, reflectiveCalls}
@@ -240,5 +237,5 @@ object VisorGcCommand {
*
* @param vs Visor tagging trait.
*/
- implicit def fromGc2Visor(vs: VisorTag) = cmd
+ implicit def fromGc2Visor(vs: VisorTag): VisorGcCommand = cmd
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bdebb406/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/gc/VisorGcCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/gc/VisorGcCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/gc/VisorGcCommandSpec.scala
index 5e6f1c3..1a59274 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/gc/VisorGcCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/gc/VisorGcCommandSpec.scala
@@ -17,26 +17,29 @@
package org.apache.ignite.visor.commands.gc
-import org.apache.ignite.visor.visor
-import org.scalatest._
-
+import org.apache.ignite.configuration.IgniteConfiguration
import org.apache.ignite.visor.commands.gc.VisorGcCommand._
-import org.apache.ignite.visor.commands.top.VisorTopologyCommand._
+import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor}
/**
* Unit test for 'gc' command.
*/
-class VisorGcCommandSpec extends FlatSpec with Matchers with BeforeAndAfterAll {
+class VisorGcCommandSpec extends VisorRuntimeBaseSpec(1) {
behavior of "A 'gc' visor command"
- override def beforeAll() {
- visor.open("-d")
+ /**
+ * Creates grid configuration for provided grid host.
+ *
+ * @param name Grid name.
+ * @return Grid configuration.
+ */
+ override def config(name: String): IgniteConfiguration = {
+ val cfg = new IgniteConfiguration
- visor.top()
- }
+ cfg.setGridName(name)
+ cfg.setLifeCycleEmailNotification(false)
- override def afterAll() {
- visor.close()
+ cfg
}
it should "run GC on all nodes" in {
[32/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 0000000,fedf24b..5ba3403
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@@ -1,0 -1,9141 +1,9174 @@@
+ /*
+ * 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.util;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.cache.*;
+ import org.apache.ignite.cluster.*;
+ import org.apache.ignite.compute.*;
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.events.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.mxbean.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.lifecycle.*;
+ import org.apache.ignite.portables.*;
+ import org.apache.ignite.spi.*;
+ import org.apache.ignite.internal.managers.deployment.*;
+ import org.apache.ignite.internal.processors.streamer.*;
+ import org.apache.ignite.spi.discovery.*;
+ import org.apache.ignite.internal.util.io.*;
+ import org.apache.ignite.internal.util.lang.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.apache.ignite.internal.util.worker.*;
+ import org.jdk8.backport.*;
+ import org.jetbrains.annotations.*;
+ import sun.misc.*;
+
+ import javax.management.*;
+ import javax.naming.*;
+ import javax.net.ssl.*;
+ import java.io.*;
+ import java.lang.annotation.Annotation;
+ import java.lang.management.*;
+ import java.lang.reflect.Array;
+ import java.lang.reflect.*;
+ import java.math.*;
+ import java.net.*;
+ import java.nio.*;
+ import java.nio.channels.*;
+ import java.nio.channels.spi.*;
+ import java.nio.charset.*;
+ import java.security.*;
+ import java.security.cert.*;
+ import java.sql.*;
+ import java.sql.Timestamp;
+ import java.text.*;
+ import java.util.*;
+ import java.util.Date;
+ import java.util.concurrent.*;
+ import java.util.concurrent.atomic.*;
+ import java.util.concurrent.locks.*;
+ import java.util.jar.*;
+ import java.util.logging.*;
+ import java.util.regex.*;
+ import java.util.zip.*;
+
+ import static org.apache.ignite.IgniteSystemProperties.*;
+ import static org.apache.ignite.events.IgniteEventType.*;
+ import static org.apache.ignite.internal.GridNodeAttributes.*;
+
+ /**
+ * Collection of utility methods used throughout the system.
+ */
+ @SuppressWarnings({"UnusedReturnValue", "UnnecessaryFullyQualifiedName"})
+ public abstract class IgniteUtils {
+ /** Unsafe. */
+ private static final Unsafe UNSAFE = GridUnsafe.unsafe();
+
+ /** {@code True} if {@code unsafe} should be used for array copy. */
+ private static final boolean UNSAFE_BYTE_ARR_CP = unsafeByteArrayCopyAvailable();
+
+ /** Offset. */
+ private static final int BYTE_ARRAY_DATA_OFFSET = UNSAFE.arrayBaseOffset(byte[].class);
+
+ /** Sun-specific JDK constructor factory for objects that don't have empty constructor. */
+ private static final Method CTOR_FACTORY;
+
+ /** Sun JDK reflection factory. */
+ private static final Object SUN_REFLECT_FACTORY;
+
+ /** Public {@code java.lang.Object} no-argument constructor. */
+ private static final Constructor OBJECT_CTOR;
+
+ /** All grid event names. */
+ private static final Map<Integer, String> GRID_EVT_NAMES = new HashMap<>();
+
+ /** All grid events. */
+ private static final int[] GRID_EVTS;
+
+ /** Empty integers array. */
+ private static final int[] EMPTY_INTS = new int[0];
+
+ /** Empty longs. */
+ private static final long[] EMPTY_LONGS = new long[0];
+
+ /** System line separator. */
+ private static final String NL = System.getProperty("line.separator");
+
+ /** Default user version. */
+ public static final String DFLT_USER_VERSION = "0";
+
+ /** Cache for {@link GridPeerDeployAware} fields to speed up reflection. */
+ private static final ConcurrentMap<String, IgniteBiTuple<Class<?>, Collection<Field>>> p2pFields =
+ new ConcurrentHashMap8<>();
+
+ /** Secure socket protocol to use. */
+ private static final String HTTPS_PROTOCOL = "TLS";
+
+ /** Project home directory. */
+ private static volatile GridTuple<String> ggHome;
+
+ /** Project work directory. */
+ private static volatile String ggWork;
+
+ /** OS JDK string. */
+ private static String osJdkStr;
+
+ /** OS string. */
+ private static String osStr;
+
+ /** JDK string. */
+ private static String jdkStr;
+
+ /** Indicates whether current OS is Windows 95. */
+ private static boolean win95;
+
+ /** Indicates whether current OS is Windows 98. */
+ private static boolean win98;
+
+ /** Indicates whether current OS is Windows NT. */
+ private static boolean winNt;
+
+ /** Indicates whether current OS is Windows Vista. */
+ private static boolean winVista;
+
+ /** Indicates whether current OS is Windows 7. */
+ private static boolean win7;
+
+ /** Indicates whether current OS is Windows 8. */
+ private static boolean win8;
+
+ /** Indicates whether current OS is Windows 8.1. */
+ private static boolean win81;
+
+ /** Indicates whether current OS is some version of Windows. */
+ private static boolean unknownWin;
+
+ /** Indicates whether current OS is Windows 2000. */
+ private static boolean win2k;
+
+ /** Indicates whether current OS is Windows XP. */
+ private static boolean winXp;
+
+ /** Indicates whether current OS is Windows Server 2003. */
+ private static boolean win2003;
+
+ /** Indicates whether current OS is Windows Server 2008. */
+ private static boolean win2008;
+
+ /** Indicates whether current OS is UNIX flavor. */
+ private static boolean unix;
+
+ /** Indicates whether current OS is Solaris. */
+ private static boolean solaris;
+
+ /** Indicates whether current OS is Linux flavor. */
+ private static boolean linux;
+
+ /** Indicates whether current OS is NetWare. */
+ private static boolean netware;
+
+ /** Indicates whether current OS is Mac OS. */
+ private static boolean mac;
+
+ /** Indicates whether current OS architecture is Sun Sparc. */
+ private static boolean sparc;
+
+ /** Indicates whether current OS architecture is Intel X86. */
+ private static boolean x86;
+
+ /** Name of the underlying OS. */
+ private static String osName;
+
+ /** Version of the underlying OS. */
+ private static String osVer;
+
+ /** CPU architecture of the underlying OS. */
+ private static String osArch;
+
+ /** Name of the Java Runtime. */
+ private static String javaRtName;
+
+ /** Name of the Java Runtime version. */
+ private static String javaRtVer;
+
+ /** Name of the JDK vendor. */
+ private static String jdkVendor;
+
+ /** Name of the JDK. */
+ private static String jdkName;
+
+ /** Version of the JDK. */
+ private static String jdkVer;
+
+ /** Name of JVM specification. */
+ private static String jvmSpecName;
+
+ /** Version of JVM implementation. */
+ private static String jvmImplVer;
+
+ /** Vendor's name of JVM implementation. */
+ private static String jvmImplVendor;
+
+ /** Name of the JVM implementation. */
+ private static String jvmImplName;
+
+ /** JMX domain as 'xxx.gridgain'. */
+ public static final String JMX_DOMAIN = IgniteUtils.class.getName().substring(0, IgniteUtils.class.getName().
+ indexOf('.', IgniteUtils.class.getName().indexOf('.') + 1));
+
+ /** Network packet header. */
+ public static final byte[] GG_HEADER = U.intToBytes(0x00004747);
+
+ /** Default buffer size = 4K. */
+ private static final int BUF_SIZE = 4096;
+
+ /** Byte bit-mask. */
+ private static final int MASK = 0xf;
+
+ /** Long date format pattern for log messages. */
+ private static final SimpleDateFormat LONG_DATE_FMT = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
+
+ /**
+ * Short date format pattern for log messages in "quiet" mode.
+ * Only time is included since we don't expect "quiet" mode to be used
+ * for longer runs.
+ */
+ private static final SimpleDateFormat SHORT_DATE_FMT = new SimpleDateFormat("HH:mm:ss");
+
+ /** Debug date format. */
+ private static final SimpleDateFormat DEBUG_DATE_FMT = new SimpleDateFormat("HH:mm:ss,SSS");
+
+ /** Cached local host address to make sure that every time the same local host is returned. */
+ private static InetAddress locHost;
+
+ /** */
+ static volatile long curTimeMillis = System.currentTimeMillis();
+
+ /** Primitive class map. */
+ private static final Map<String, Class<?>> primitiveMap = new HashMap<>(16, .5f);
+
+ /** Boxed class map. */
+ private static final Map<Class<?>, Class<?>> boxedClsMap = new HashMap<>(16, .5f);
+
+ /** Class loader used to load GridGain. */
+ private static final ClassLoader gridClassLoader = IgniteUtils.class.getClassLoader();
+
+ /** MAC OS invalid argument socket error message. */
+ public static final String MAC_INVALID_ARG_MSG = "On MAC OS you may have too many file descriptors open " +
+ "(simple restart usually solves the issue)";
+
+ /** Default help pages. */
+ public static final List<String> DFLT_HELP_LINKS = Arrays.asList(
+ "Troubleshooting: http://bit.ly/GridGain-Troubleshooting",
+ "Documentation Center: http://bit.ly/GridGain-Documentation");
+
+ /** Portable classes. */
+ private static final Collection<Class<?>> PORTABLE_CLS = new HashSet<>();
+
+ /** GridGain Logging Directory. */
+ public static final String GRIDGAIN_LOG_DIR = System.getenv(GG_LOG_DIR);
+
+ /** GridGain Work Directory. */
+ public static final String GRIDGAIN_WORK_DIR = System.getenv(GG_WORK_DIR);
+
+ /** Clock timer. */
+ private static Thread timer;
+
+ /** Grid counter. */
+ private static int gridCnt;
+
+ /** Mutex. */
+ private static final Object mux = new Object();
+
+ /**
+ * Initializes enterprise check.
+ */
+ static {
+ String osName = System.getProperty("os.name");
+
+ String osLow = osName.toLowerCase();
+
+ // OS type detection.
+ if (osLow.contains("win")) {
+ if (osLow.contains("95"))
+ win95 = true;
+ else if (osLow.contains("98"))
+ win98 = true;
+ else if (osLow.contains("nt"))
+ winNt = true;
+ else if (osLow.contains("2000"))
+ win2k = true;
+ else if (osLow.contains("vista"))
+ winVista = true;
+ else if (osLow.contains("xp"))
+ winXp = true;
+ else if (osLow.contains("2003"))
+ win2003 = true;
+ else if (osLow.contains("2008"))
+ win2008 = true;
+ else if (osLow.contains("7"))
+ win7 = true;
+ else if (osLow.contains("8.1"))
+ win81 = true;
+ else if (osLow.contains("8"))
+ win8 = true;
+ else
+ unknownWin = true;
+ }
+ else if (osLow.contains("netware"))
+ netware = true;
+ else if (osLow.contains("mac os"))
+ mac = true;
+ else {
+ // UNIXs flavors tokens.
+ for (CharSequence os : new String[]{"ix", "inux", "olaris", "un", "ux", "sco", "bsd", "att"})
+ if (osLow.contains(os)) {
+ unix = true;
+
+ break;
+ }
+
+ // UNIX name detection.
+ if (osLow.contains("olaris"))
+ solaris = true;
+ else if (osLow.contains("inux"))
+ linux = true;
+ }
+
+ String osArch = System.getProperty("os.arch");
+
+ String archStr = osArch.toLowerCase();
+
+ // OS architecture detection.
+ if (archStr.contains("x86"))
+ x86 = true;
+ else if (archStr.contains("sparc"))
+ sparc = true;
+
+ String javaRtName = System.getProperty("java.runtime.name");
+ String javaRtVer = System.getProperty("java.runtime.version");
+ String jdkVendor = System.getProperty("java.specification.vendor");
+ String jdkName = System.getProperty("java.specification.name");
+ String jdkVer = System.getProperty("java.specification.version");
+ String osVer = System.getProperty("os.version");
+ String jvmSpecName = System.getProperty("java.vm.specification.name");
+ String jvmImplVer = System.getProperty("java.vm.version");
+ String jvmImplVendor = System.getProperty("java.vm.vendor");
+ String jvmImplName = System.getProperty("java.vm.name");
+
+ String jdkStr = javaRtName + ' ' + javaRtVer + ' ' + jvmImplVendor + ' ' + jvmImplName + ' ' +
+ jvmImplVer;
+
+ osStr = osName + ' ' + osVer + ' ' + osArch;
+ osJdkStr = osLow + ", " + jdkStr;
+
+ // Copy auto variables to static ones.
+ IgniteUtils.osName = osName;
+ IgniteUtils.jdkName = jdkName;
+ IgniteUtils.jdkVendor = jdkVendor;
+ IgniteUtils.jdkVer = jdkVer;
+ IgniteUtils.jdkStr = jdkStr;
+ IgniteUtils.osVer = osVer;
+ IgniteUtils.osArch = osArch;
+ IgniteUtils.jvmSpecName = jvmSpecName;
+ IgniteUtils.jvmImplVer = jvmImplVer;
+ IgniteUtils.jvmImplVendor = jvmImplVendor;
+ IgniteUtils.jvmImplName = jvmImplName;
+ IgniteUtils.javaRtName = javaRtName;
+ IgniteUtils.javaRtVer = javaRtVer;
+
+ primitiveMap.put("byte", byte.class);
+ primitiveMap.put("short", short.class);
+ primitiveMap.put("int", int.class);
+ primitiveMap.put("long", long.class);
+ primitiveMap.put("float", float.class);
+ primitiveMap.put("double", double.class);
+ primitiveMap.put("char", char.class);
+ primitiveMap.put("boolean", boolean.class);
+
+ boxedClsMap.put(byte.class, Byte.class);
+ boxedClsMap.put(short.class, Short.class);
+ boxedClsMap.put(int.class, Integer.class);
+ boxedClsMap.put(long.class, Long.class);
+ boxedClsMap.put(float.class, Float.class);
+ boxedClsMap.put(double.class, Double.class);
+ boxedClsMap.put(char.class, Character.class);
+ boxedClsMap.put(boolean.class, Boolean.class);
+
+ try {
+ OBJECT_CTOR = Object.class.getConstructor();
+ }
+ catch (NoSuchMethodException e) {
+ throw withCause(new AssertionError("Object class does not have empty constructor (is JDK corrupted?)."), e);
+ }
+
+ // Constructor factory.
+ Method ctorFac = null;
+ Object refFac = null;
+
+ try {
+ Class<?> refFactoryCls = Class.forName("sun.reflect.ReflectionFactory");
+
+ refFac = refFactoryCls.getMethod("getReflectionFactory").invoke(null);
+
+ ctorFac = refFac.getClass().getMethod("newConstructorForSerialization", Class.class,
+ Constructor.class);
+ }
+ catch (NoSuchMethodException | ClassNotFoundException | IllegalAccessException | InvocationTargetException ignored) {
+ // No-op.
+ }
+
+ CTOR_FACTORY = ctorFac;
+ SUN_REFLECT_FACTORY = refFac;
+
+ // Disable hostname SSL verification for development and testing with self-signed certificates.
+ if (Boolean.parseBoolean(System.getProperty(GG_DISABLE_HOSTNAME_VERIFIER))) {
+ HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
+ @Override public boolean verify(String hostname, SSLSession sslSes) {
+ return true;
+ }
+ });
+ }
+
+ // Event names initialization.
+ for (Field field : IgniteEventType.class.getFields()) {
+ if (field.getType().equals(int.class)) {
+ try {
+ assert field.getName().startsWith("EVT_") : "Invalid event name (should start with 'EVT_': " +
+ field.getName();
+
+ int type = field.getInt(null);
+
+ String prev = GRID_EVT_NAMES.put(type, field.getName().substring(4));
+
+ // Check for duplicate event types.
+ assert prev == null : "Duplicate event [type=" + type + ", name1=" + prev +
+ ", name2=" + field.getName() + ']';
+ }
+ catch (IllegalAccessException e) {
+ throw new IgniteException(e);
+ }
+ }
+ }
+
+ // Event array initialization.
+ GRID_EVTS = toIntArray(GRID_EVT_NAMES.keySet());
+
+ // Sort for fast event lookup.
+ Arrays.sort(GRID_EVTS);
+
+ // We need to re-initialize EVTS_ALL and EVTS_ALL_MINUS_METRIC_UPDATE
+ // because they may have been initialized to null before GRID_EVTS were initialized.
+ if (EVTS_ALL == null || EVTS_ALL_MINUS_METRIC_UPDATE == null) {
+ try {
+ Field f1 = IgniteEventType.class.getDeclaredField("EVTS_ALL");
+ Field f2 = IgniteEventType.class.getDeclaredField("EVTS_ALL_MINUS_METRIC_UPDATE");
+
+ assert f1 != null;
+ assert f2 != null;
+
+ // We use unsafe operations to update static fields on interface because
+ // they are treated as static final and cannot be updated via standard reflection.
+ UNSAFE.putObjectVolatile(UNSAFE.staticFieldBase(f1), UNSAFE.staticFieldOffset(f1), gridEvents());
+ UNSAFE.putObjectVolatile(UNSAFE.staticFieldBase(f2), UNSAFE.staticFieldOffset(f2),
+ gridEvents(EVT_NODE_METRICS_UPDATED));
+
+ assert EVTS_ALL != null;
+ assert EVTS_ALL.length == GRID_EVTS.length;
+
+ assert EVTS_ALL_MINUS_METRIC_UPDATE != null;
+ assert EVTS_ALL_MINUS_METRIC_UPDATE.length == GRID_EVTS.length - 1;
+
+ // Validate correctness.
+ for (int type : GRID_EVTS) {
+ assert containsIntArray(EVTS_ALL, type);
+
+ if (type != EVT_NODE_METRICS_UPDATED)
+ assert containsIntArray(EVTS_ALL_MINUS_METRIC_UPDATE, type);
+ }
+
+ assert !containsIntArray(EVTS_ALL_MINUS_METRIC_UPDATE, EVT_NODE_METRICS_UPDATED);
+ }
+ catch (NoSuchFieldException e) {
+ throw new IgniteException(e);
+ }
+ }
+
+ PORTABLE_CLS.add(Byte.class);
+ PORTABLE_CLS.add(Short.class);
+ PORTABLE_CLS.add(Integer.class);
+ PORTABLE_CLS.add(Long.class);
+ PORTABLE_CLS.add(Float.class);
+ PORTABLE_CLS.add(Double.class);
+ PORTABLE_CLS.add(Character.class);
+ PORTABLE_CLS.add(Boolean.class);
+ PORTABLE_CLS.add(String.class);
+ PORTABLE_CLS.add(UUID.class);
+ PORTABLE_CLS.add(Date.class);
+ PORTABLE_CLS.add(Timestamp.class);
+ PORTABLE_CLS.add(byte[].class);
+ PORTABLE_CLS.add(short[].class);
+ PORTABLE_CLS.add(int[].class);
+ PORTABLE_CLS.add(long[].class);
+ PORTABLE_CLS.add(float[].class);
+ PORTABLE_CLS.add(double[].class);
+ PORTABLE_CLS.add(char[].class);
+ PORTABLE_CLS.add(boolean[].class);
+ PORTABLE_CLS.add(String[].class);
+ PORTABLE_CLS.add(UUID[].class);
+ PORTABLE_CLS.add(Date[].class);
+ PORTABLE_CLS.add(Timestamp[].class);
+ }
+
+ /**
+ * @return System time approximated by 10 ms.
+ */
+ public static long currentTimeMillis() {
+ return curTimeMillis;
+ }
+
+ /**
+ * @return Value of {@link System#nanoTime()} in microseconds.
+ */
+ public static long microTime() {
+ return System.nanoTime() / 1000;
+ }
+
+ /**
+ * Gets nearest power of 2 larger or equal than v.
+ *
+ * @param v Value.
+ * @return Nearest power of 2.
+ */
+ public static int ceilPow2(int v) {
+ v--;
+
+ v |= v >> 1;
+ v |= v >> 2;
+ v |= v >> 4;
+ v |= v >> 8;
+ v |= v >> 16;
+
+ return ++v;
+ }
+
+ /**
+ * @param i Value.
+ * @return {@code true} If the given value is power of 2 (0 is not power of 2).
+ */
+ public static boolean isPow2(int i) {
+ return i > 0 && (i & (i - 1)) == 0;
+ }
+
+ /**
+ * Return SUN specific constructor factory.
+ *
+ * @return SUN specific constructor factory.
+ */
+ @Nullable public static Method ctorFactory() {
+ return CTOR_FACTORY;
+ }
+
+ /**
+ * @return Empty constructor for object class.
+ */
+ public static Constructor objectConstructor() {
+ return OBJECT_CTOR;
+ }
+
+ /**
+ * SUN JDK specific reflection factory for objects without public constructor.
+ *
+ * @return Reflection factory for objects without public constructor.
+ */
+ @Nullable public static Object sunReflectionFactory() {
+ return SUN_REFLECT_FACTORY;
+ }
+
+ /**
+ * Gets name for given grid event type.
+ *
+ * @param type Event type.
+ * @return Event name.
+ */
+ public static String gridEventName(int type) {
+ String name = GRID_EVT_NAMES.get(type);
+
+ return name != null ? name : Integer.toString(type);
+ }
+
+ /**
+ * Gets all event types.
+ *
+ * @param excl Optional exclude events.
+ * @return All events minus excluded ones.
+ */
+ public static int[] gridEvents(final int... excl) {
+ if (F.isEmpty(excl))
+ return GRID_EVTS;
+
+ List<Integer> evts = toIntList(GRID_EVTS, new P1<Integer>() {
+ @Override
+ public boolean apply(Integer i) {
+ return !containsIntArray(excl, i);
+ }
+ });
+
+ return toIntArray(evts);
+ }
+
+ /**
+ * @param discoSpi Discovery SPI.
+ * @return {@code True} if ordering is supported.
+ */
+ public static boolean discoOrdered(DiscoverySpi discoSpi) {
+ DiscoverySpiOrderSupport ann = U.getAnnotation(discoSpi.getClass(), DiscoverySpiOrderSupport.class);
+
+ return ann != null && ann.value();
+ }
+
+ /**
+ * @return Checks if disco ordering should be enforced.
+ */
+ public static boolean relaxDiscoveryOrdered() {
+ return "true".equalsIgnoreCase(System.getProperty(GG_NO_DISCO_ORDER));
+ }
+
+ /**
+ * This method should be used for adding quick debug statements in code
+ * while debugging. Calls to this method should never be committed to master.
+ *
+ * @param msg Message to debug.
+ * @deprecated Calls to this method should never be committed to master.
+ */
+ @Deprecated
+ public static void debug(Object msg) {
+ X.println(debugPrefix() + msg);
+ }
+
+ /**
+ * This method should be used for adding quick debug statements in code
+ * while debugging. Calls to this method should never be committed to master.
+ *
+ * @param msg Message to debug.
+ * @deprecated Calls to this method should never be committed to master.
+ */
+ @Deprecated
+ public static void debugx(String msg) {
+ X.printerrln(debugPrefix() + msg);
+ }
+
+ /**
+ * This method should be used for adding quick debug statements in code
+ * while debugging. Calls to this method should never be committed to master.
+ *
+ * @param log Logger.
+ * @param msg Message to debug.
+ *
+ * @deprecated Calls to this method should never be committed to master.
+ */
+ @Deprecated
+ public static void debug(IgniteLogger log, String msg) {
+ log.info(msg);
+ }
+
+ /**
+ * Prints stack trace of the current thread to {@code System.out}.
+ *
+ * @deprecated Calls to this method should never be committed to master.
+ */
+ @SuppressWarnings("deprecation")
+ @Deprecated
+ public static void dumpStack() {
+ dumpStack("Dumping stack.");
+ }
+
+ /**
+ * Prints stack trace of the current thread to {@code System.out}.
+ *
+ * @param msg Message to print with the stack.
+ *
+ * @deprecated Calls to this method should never be committed to master.
+ */
+ @Deprecated
+ public static void dumpStack(String msg) {
+ new Exception(debugPrefix() + msg).printStackTrace(System.out);
+ }
+
+ /**
+ * @param log Logger.
+ * @param msg Message.
+ */
+ public static void dumpStack(@Nullable IgniteLogger log, String msg) {
+ U.error(log, "Dumping stack.", new Exception(msg));
+ }
+
+ /**
+ * Prints stack trace of the current thread to provided output stream.
+ *
+ * @param msg Message to print with the stack.
+ * @param out Output to dump stack to.
+ *
+ * @deprecated Calls to this method should never be committed to master.
+ */
+ @Deprecated
+ public static void dumpStack(String msg, PrintStream out) {
+ new Exception(msg).printStackTrace(out);
+ }
+
+ /**
+ * Prints stack trace of the current thread to provided logger.
+ *
+ * @param log Logger.
+ * @param msg Message to print with the stack.
+ *
+ * @deprecated Calls to this method should never be committed to master.
+ */
+ @Deprecated
+ public static void debugStack(IgniteLogger log, String msg) {
+ log.error(msg, new Exception(debugPrefix() + msg));
+ }
+
+ /**
+ * @return Common prefix for debug messages.
+ */
+ private static String debugPrefix() {
+ return '<' + DEBUG_DATE_FMT.format(new Date(System.currentTimeMillis())) + "><DEBUG><" +
+ Thread.currentThread().getName() + '>' + ' ';
+ }
+
+ /**
+ * Prints heap usage.
+ */
+ public static void debugHeapUsage() {
+ System.gc();
+
+ Runtime runtime = Runtime.getRuntime();
+
+ X.println('<' + DEBUG_DATE_FMT.format(new Date(System.currentTimeMillis())) + "><DEBUG><" +
+ Thread.currentThread().getName() + "> Heap stats [free=" + runtime.freeMemory() / (1024 * 1024) +
+ "M, total=" + runtime.totalMemory() / (1024 * 1024) + "M]");
+ }
+
+ /**
+ * Gets heap size in GB rounded to specified precision.
+ *
+ * @param node Node.
+ * @param precision Precision.
+ * @return Heap size in GB.
+ */
+ public static double heapSize(ClusterNode node, int precision) {
+ return heapSize(Collections.singleton(node), precision);
+ }
+
+ /**
+ * Gets total heap size in GB rounded to specified precision.
+ *
+ * @param nodes Nodes.
+ * @param precision Precision.
+ * @return Total heap size in GB.
+ */
+ public static double heapSize(Iterable<ClusterNode> nodes, int precision) {
+ // In bytes.
+ double heap = 0.0;
+
+ for (ClusterNode n : nodesPerJvm(nodes)) {
+ ClusterMetrics m = n.metrics();
+
+ heap += Math.max(m.getHeapMemoryInitialized(), m.getHeapMemoryMaximum());
+ }
+
+ return roundedHeapSize(heap, precision);
+ }
+
+ /**
+ * Returns one representative node for each JVM.
+ *
+ * @param nodes Nodes.
+ * @return Collection which contains only one representative node for each JVM.
+ */
+ private static Iterable<ClusterNode> nodesPerJvm(Iterable<ClusterNode> nodes) {
+ Map<String, ClusterNode> grpMap = new HashMap<>();
+
+ // Group by mac addresses and pid.
+ for (ClusterNode node : nodes) {
+ String grpId = node.attribute(ATTR_MACS) + "|" + node.attribute(ATTR_JVM_PID);
+
+ if (!grpMap.containsKey(grpId))
+ grpMap.put(grpId, node);
+ }
+
+ return grpMap.values();
+ }
+
+ /**
+ * Returns current JVM maxMemory in the same format as {@link #heapSize(org.apache.ignite.cluster.ClusterNode, int)}.
+ *
+ * @param precision Precision.
+ * @return Maximum memory size in GB.
+ */
+ public static double heapSize(int precision) {
+ return roundedHeapSize(Runtime.getRuntime().maxMemory(), precision);
+ }
+
+ /**
+ * Rounded heap size in gigabytes.
+ *
+ * @param heap Heap.
+ * @param precision Precision.
+ * @return Rounded heap size.
+ */
+ private static double roundedHeapSize(double heap, int precision) {
+ double rounded = new BigDecimal(heap / (1024 * 1024 * 1024d)).round(new MathContext(precision)).doubleValue();
+
+ return rounded < 0.1 ? 0.1 : rounded;
+ }
+
+ /**
+ * Performs thread dump and prints all available info to the given log.
+ *
+ * @param log Logger.
+ */
+ public static void dumpThreads(@Nullable IgniteLogger log) {
+ ThreadMXBean mxBean = ManagementFactory.getThreadMXBean();
+
+ ThreadInfo[] threadInfos =
+ mxBean.dumpAllThreads(mxBean.isObjectMonitorUsageSupported(), mxBean.isSynchronizerUsageSupported());
+
+ GridStringBuilder sb = new GridStringBuilder("Thread dump at ")
+ .a(new SimpleDateFormat("yyyy/MM/dd HH:mm:ss z").format(new Date(U.currentTimeMillis()))).a(NL);
+
+ for (ThreadInfo info : threadInfos) {
+ printThreadInfo(info, sb);
+
+ sb.a(NL);
+
+ if (info.getLockedSynchronizers() != null && info.getLockedSynchronizers().length > 0) {
+ printSynchronizersInfo(info.getLockedSynchronizers(), sb);
+
+ sb.a(NL);
+ }
+ }
+
+ sb.a(NL);
+
+ warn(log, sb.toString());
+ }
+
+ /**
+ * Prints single thread info to a buffer.
+ *
+ * @param threadInfo Thread info.
+ * @param sb Buffer.
+ */
+ private static void printThreadInfo(ThreadInfo threadInfo, GridStringBuilder sb) {
+ sb.a("Thread [name=\"").a(threadInfo.getThreadName())
+ .a("\", id=").a(threadInfo.getThreadId())
+ .a(", state=").a(threadInfo.getThreadState())
+ .a(", blockCnt=").a(threadInfo.getBlockedCount())
+ .a(", waitCnt=").a(threadInfo.getWaitedCount()).a("]").a(NL);
+
+ LockInfo lockInfo = threadInfo.getLockInfo();
+
+ if (lockInfo != null) {
+ sb.a(" Lock [object=").a(lockInfo)
+ .a(", ownerName=").a(threadInfo.getLockOwnerName())
+ .a(", ownerId=").a(threadInfo.getLockOwnerId()).a("]").a(NL);
+ }
+
+ MonitorInfo[] monitors = threadInfo.getLockedMonitors();
+ StackTraceElement[] elements = threadInfo.getStackTrace();
+
+ for (int i = 0; i < elements.length; i++) {
+ StackTraceElement e = elements[i];
+
+ sb.a(" at ").a(e.toString());
+
+ for (MonitorInfo monitor : monitors) {
+ if (monitor.getLockedStackDepth() == i)
+ sb.a(NL).a(" - locked ").a(monitor);
+ }
+
+ sb.a(NL);
+ }
+ }
+
+ /**
+ * Prints Synchronizers info to a buffer.
+ *
+ * @param syncs Synchronizers info.
+ * @param sb Buffer.
+ */
+ private static void printSynchronizersInfo(LockInfo[] syncs, GridStringBuilder sb) {
+ sb.a(" Locked synchronizers:");
+
+ for (LockInfo info : syncs)
+ sb.a(NL).a(" ").a(info);
+ }
+
+ /**
+ * Gets empty constructor for class even if the class does not have empty constructor
+ * declared. This method is guaranteed to work with SUN JDK and other JDKs still need
+ * to be tested.
+ *
+ * @param cls Class to get empty constructor for.
+ * @return Empty constructor if one could be found or {@code null} otherwise.
+ * @throws IgniteCheckedException If failed.
+ */
+ @Nullable public static Constructor<?> forceEmptyConstructor(Class<?> cls) throws IgniteCheckedException {
+ Constructor<?> ctor = null;
+
+ try {
+ return cls.getDeclaredConstructor();
+ }
+ catch (Exception ignore) {
+ Method ctorFac = U.ctorFactory();
+ Object sunRefFac = U.sunReflectionFactory();
+
+ if (ctorFac != null && sunRefFac != null)
+ try {
+ ctor = (Constructor)ctorFac.invoke(sunRefFac, cls, U.objectConstructor());
+ }
+ catch (IllegalAccessException | InvocationTargetException e) {
+ throw new IgniteCheckedException("Failed to get object constructor for class: " + cls, e);
+ }
+ }
+
+ return ctor;
+ }
+
+ /**
+ * Creates new instance of a class only if it has an empty constructor (can be non-public).
+ *
+ * @param cls Class name.
+ * @return Instance.
+ * @throws IgniteCheckedException If failed.
+ */
+ @Nullable public static <T> T newInstance(String cls) throws IgniteCheckedException {
+ Class<?> cls0;
+
+ try {
+ cls0 = Class.forName(cls);
+ }
+ catch (Exception e) {
+ throw new IgniteCheckedException(e);
+ }
+
+ return (T)newInstance(cls0);
+ }
+
+ /**
+ * Creates new instance of a class only if it has an empty constructor (can be non-public).
+ *
+ * @param cls Class to instantiate.
+ * @return New instance of the class or {@code null} if empty constructor could not be assigned.
+ * @throws IgniteCheckedException If failed.
+ */
+ @Nullable public static <T> T newInstance(Class<T> cls) throws IgniteCheckedException {
+ boolean set = false;
+
+ Constructor<T> ctor = null;
+
+ try {
+ ctor = cls.getDeclaredConstructor();
+
+ if (ctor == null)
+ return null;
+
+ if (!ctor.isAccessible()) {
+ ctor.setAccessible(true);
+
+ set = true;
+ }
+
+ return ctor.newInstance();
+ }
+ catch (NoSuchMethodException e) {
+ throw new IgniteCheckedException("Failed to find empty constructor for class: " + cls, e);
+ }
+ catch (InstantiationException | InvocationTargetException | IllegalAccessException e) {
+ throw new IgniteCheckedException("Failed to create new instance for class: " + cls, e);
+ } finally {
+ if (ctor != null && set)
+ ctor.setAccessible(false);
+ }
+ }
+
+ /**
+ * Creates new instance of a class even if it does not have public constructor.
+ *
+ * @param cls Class to instantiate.
+ * @return New instance of the class or {@code null} if empty constructor could not be assigned.
+ * @throws IgniteCheckedException If failed.
+ */
+ @SuppressWarnings({"unchecked"})
+ @Nullable public static <T> T forceNewInstance(Class<?> cls) throws IgniteCheckedException {
+ Constructor ctor = forceEmptyConstructor(cls);
+
+ if (ctor == null)
+ return null;
+
+ boolean set = false;
+
+ try {
+
+ if (!ctor.isAccessible()) {
+ ctor.setAccessible(true);
+
+ set = true;
+ }
+
+ return (T)ctor.newInstance();
+ }
+ catch (InstantiationException | InvocationTargetException | IllegalAccessException e) {
+ throw new IgniteCheckedException("Failed to create new instance for class: " + cls, e);
+ } finally {
+ if (set)
+ ctor.setAccessible(false);
+ }
+ }
+
+ /**
+ * Pretty-formatting for minutes.
+ *
+ * @param mins Minutes to format.
+ * @return Formatted presentation of minutes.
+ */
+ public static String formatMins(long mins) {
+ assert mins >= 0;
+
+ if (mins == 0)
+ return "< 1 min";
+
+ SB sb = new SB();
+
+ long dd = mins / 1440; // 1440 mins = 60 mins * 24 hours
+
+ if (dd > 0)
+ sb.a(dd).a(dd == 1 ? " day " : " days ");
+
+ mins %= 1440;
+
+ long hh = mins / 60;
+
+ if (hh > 0)
+ sb.a(hh).a(hh == 1 ? " hour " : " hours ");
+
+ mins %= 60;
+
+ if (mins > 0)
+ sb.a(mins).a(mins == 1 ? " min " : " mins ");
+
+ return sb.toString().trim();
+ }
+
+ /**
+ * Gets 8-character substring of UUID (for terse logging).
+ *
+ * @param id Input ID.
+ * @return 8-character ID substring.
+ */
+ public static String id8(UUID id) {
+ return id.toString().substring(0, 8);
+ }
+
+ /**
+ * Gets 8-character substring of {@link org.apache.ignite.lang.IgniteUuid} (for terse logging).
+ * The ID8 will be constructed as follows:
+ * <ul>
+ * <li>Take first 4 digits for global ID, i.e. {@code GridUuid.globalId()}.</li>
+ * <li>Take last 4 digits for local ID, i.e. {@code GridUuid.localId()}.</li>
+ * </ul>
+ *
+ * @param id Input ID.
+ * @return 8-character representation of {@code GridUuid}.
+ */
+ public static String id8(IgniteUuid id) {
+ String s = id.toString();
+
+ return s.substring(0, 4) + s.substring(s.length() - 4);
+ }
+
+ /**
+ *
+ * @param len Number of characters to fill in.
+ * @param ch Character to fill with.
+ * @return String.
+ */
+ public static String filler(int len, char ch) {
+ char[] a = new char[len];
+
+ Arrays.fill(a, ch);
+
+ return new String(a);
+ }
+
+ /**
+ * Writes array to output stream.
+ *
+ * @param out Output stream.
+ * @param arr Array to write.
+ * @param <T> Array type.
+ * @throws IOException If failed.
+ */
+ public static <T> void writeArray(ObjectOutput out, T[] arr) throws IOException {
+ int len = arr == null ? 0 : arr.length;
+
+ out.writeInt(len);
+
+ if (arr != null && arr.length > 0)
+ for (T t : arr)
+ out.writeObject(t);
+ }
+
+ /**
+ * Reads array from input stream.
+ *
+ * @param in Input stream.
+ * @return Deserialized array.
+ * @throws IOException If failed.
+ * @throws ClassNotFoundException If class not found.
+ */
+ @Nullable public static Object[] readArray(ObjectInput in) throws IOException, ClassNotFoundException {
+ int len = in.readInt();
+
+ Object[] arr = null;
+
+ if (len > 0) {
+ arr = new Object[len];
+
+ for (int i = 0; i < len; i++)
+ arr[i] = in.readObject();
+ }
+
+ return arr;
+ }
+
+ /**
+ * Reads array from input stream.
+ *
+ * @param in Input stream.
+ * @return Deserialized array.
+ * @throws IOException If failed.
+ * @throws ClassNotFoundException If class not found.
+ */
+ @Nullable public static Class<?>[] readClassArray(ObjectInput in) throws IOException, ClassNotFoundException {
+ int len = in.readInt();
+
+ Class<?>[] arr = null;
+
+ if (len > 0) {
+ arr = new Class<?>[len];
+
+ for (int i = 0; i < len; i++)
+ arr[i] = (Class<?>)in.readObject();
+ }
+
+ return arr;
+ }
+
+ /**
+ * Reads array from input stream.
+ *
+ * @param in Input stream.
+ * @return Deserialized array.
+ * @throws IOException If failed.
+ * @throws ClassNotFoundException If class not found.
+ */
+ @SuppressWarnings("unchecked")
+ @Nullable public static <K, V> IgnitePredicate<CacheEntry<K, V>>[] readEntryFilterArray(ObjectInput in)
+ throws IOException, ClassNotFoundException {
+ int len = in.readInt();
+
+ IgnitePredicate<CacheEntry<K, V>>[] arr = null;
+
+ if (len > 0) {
+ arr = new IgnitePredicate[len];
+
+ for (int i = 0; i < len; i++)
+ arr[i] = (IgnitePredicate<CacheEntry<K, V>>)in.readObject();
+ }
+
+ return arr;
+ }
+
+ /**
+ *
+ * @param out Output.
+ * @param col Set to write.
+ * @throws IOException If write failed.
+ */
+ public static void writeCollection(ObjectOutput out, Collection<?> col) throws IOException {
+ if (col != null) {
+ out.writeInt(col.size());
+
+ for (Object o : col)
+ out.writeObject(o);
+ }
+ else
+ out.writeInt(-1);
+ }
+
+ /**
+ * Writes collection of byte arrays to data output.
+ *
+ * @param out Output to write to.
+ * @param bytes Collection with byte arrays.
+ * @throws IOException If write failed.
+ */
+ public static void writeBytesCollection(DataOutput out, Collection<byte[]> bytes) throws IOException {
+ if (bytes != null) {
+ out.writeInt(bytes.size());
+
+ for (byte[] b : bytes)
+ writeByteArray(out, b);
+ }
+ else
+ out.writeInt(-1);
+ }
+
+ /**
+ * Reads collection of byte arrays from data input.
+ *
+ * @param in Data input to read from.
+ * @return List of byte arrays.
+ * @throws IOException If read failed.
+ */
+ public static List<byte[]> readBytesList(DataInput in) throws IOException {
+ int size = in.readInt();
+
+ if (size < 0)
+ return null;
+
+ List<byte[]> res = new ArrayList<>(size);
+
+ for (int i = 0; i < size; i++)
+ res.add(readByteArray(in));
+
+ return res;
+ }
+
+ /**
+ *
+ * @param out Output.
+ * @param col Set to write.
+ * @throws IOException If write failed.
+ */
+ public static void writeIntCollection(DataOutput out, Collection<Integer> col) throws IOException {
+ if (col != null) {
+ out.writeInt(col.size());
+
+ for (Integer i : col)
+ out.writeInt(i);
+ }
+ else
+ out.writeInt(-1);
+ }
+
+ /**
+ * @param in Input.
+ * @return Deserialized set.
+ * @throws IOException If deserialization failed.
+ * @throws ClassNotFoundException If deserialized class could not be found.
+ */
+ @Nullable public static <E> Collection<E> readCollection(ObjectInput in)
+ throws IOException, ClassNotFoundException {
+ return readList(in);
+ }
+
+ /**
+ * @param in Input.
+ * @return Deserialized set.
+ * @throws IOException If deserialization failed.
+ */
+ @Nullable public static Collection<Integer> readIntCollection(DataInput in) throws IOException {
+ int size = in.readInt();
+
+ // Check null flag.
+ if (size == -1)
+ return null;
+
+ Collection<Integer> col = new ArrayList<>(size);
+
+ for (int i = 0; i < size; i++)
+ col.add(in.readInt());
+
+ return col;
+ }
+
+ /**
+ *
+ * @param m Map to copy.
+ * @param <K> Key type.
+ * @param <V> Value type
+ * @return Copied map.
+ */
+ public static <K, V> Map<K, V> copyMap(Map<K, V> m) {
+ return new HashMap<>(m);
+ }
+
+ /**
+ *
+ * @param m Map to seal.
+ * @param <K> Key type.
+ * @param <V> Value type
+ * @return Sealed map.
+ */
+ public static <K, V> Map<K, V> sealMap(Map<K, V> m) {
+ assert m != null;
+
+ return Collections.unmodifiableMap(new HashMap<>(m));
+ }
+
+ /**
+ * Seal collection.
+ *
+ * @param c Collection to seal.
+ * @param <E> Entry type
+ * @return Sealed collection.
+ */
+ public static <E> List<E> sealList(Collection<E> c) {
+ return Collections.unmodifiableList(new ArrayList<>(c));
+ }
+
+ /**
+ * Convert array to seal list.
+ *
+ * @param a Array for convert to seal list.
+ * @param <E> Entry type
+ * @return Sealed collection.
+ */
+ public static <E> List<E> sealList(E... a) {
+ return Collections.unmodifiableList(Arrays.asList(a));
+ }
+
+ /**
+ * Gets display name of the network interface this IP address belongs to.
+ *
+ * @param addr IP address for which to find network interface name.
+ * @return Network interface name or {@code null} if can't be found.
+ */
+ @Nullable public static String getNetworkInterfaceName(String addr) {
+ assert addr != null;
+
+ try {
+ InetAddress inetAddr = InetAddress.getByName(addr);
+
+ for (NetworkInterface itf : asIterable(NetworkInterface.getNetworkInterfaces()))
+ for (InetAddress itfAddr : asIterable(itf.getInetAddresses()))
+ if (itfAddr.equals(inetAddr))
+ return itf.getDisplayName();
+ }
+ catch (UnknownHostException ignore) {
+ return null;
+ }
+ catch (SocketException ignore) {
+ return null;
+ }
+
+ return null;
+ }
+
+ /**
+ * Tries to resolve host by name, returning local host if input is empty.
+ * This method reflects how {@link org.apache.ignite.configuration.IgniteConfiguration#getLocalHost()} should
+ * be handled in most places.
+ *
+ * @param hostName Hostname or {@code null} if local host should be returned.
+ * @return Address of given host or of localhost.
+ * @throws IOException If attempt to get local host failed.
+ */
+ public static InetAddress resolveLocalHost(@Nullable String hostName) throws IOException {
+ return F.isEmpty(hostName) ?
+ // Should default to InetAddress#anyLocalAddress which is package-private.
+ new InetSocketAddress(0).getAddress() :
+ InetAddress.getByName(hostName);
+ }
+
+ /**
+ * Determines whether current local host is different from previously cached.
+ *
+ * @return {@code true} or {@code false} depending on whether or not local host
+ * has changed from the cached value.
+ * @throws IOException If attempt to get local host failed.
+ */
+ public static synchronized boolean isLocalHostChanged() throws IOException {
+ InetAddress locHost0 = locHost;
+
+ return locHost0 != null && !resetLocalHost().equals(locHost0);
+ }
+
+ /**
+ * Returns host names consistent with {@link #resolveLocalHost(String)}. So when it returns
+ * a common address this method returns single host name, and when a wildcard address passed
+ * this method tries to collect addresses of all available interfaces.
+ *
+ * @param locAddr Local address to resolve.
+ * @return Resolved available addresses of given local address.
+ * @throws IOException If failed.
+ * @throws IgniteCheckedException If no network interfaces found.
+ */
+ public static IgniteBiTuple<Collection<String>, Collection<String>> resolveLocalAddresses(InetAddress locAddr)
+ throws IOException, IgniteCheckedException {
+ assert locAddr != null;
+
+ Collection<String> addrs = new ArrayList<>();
+ Collection<String> hostNames = new ArrayList<>();
+
+ if (locAddr.isAnyLocalAddress()) {
+ // It should not take longer than 2 seconds to reach
+ // local address on any network.
+ int reachTimeout = 2000;
+
+ for (NetworkInterface itf : asIterable(NetworkInterface.getNetworkInterfaces())) {
+ for (InetAddress addr : asIterable(itf.getInetAddresses())) {
+ if (!addr.isLinkLocalAddress() && reachable(itf, addr, reachTimeout))
+ addresses(addr, addrs, hostNames);
+ }
+ }
+
+ if (F.isEmpty(addrs))
+ throw new IgniteCheckedException("No network addresses found (is networking enabled?).");
+ }
+ else
+ addresses(locAddr, addrs, hostNames);
+
+ return F.t(addrs, hostNames);
+ }
+
+ /**
+ * @param addr Address.
+ * @param addrs Addresses.
+ * @param hostNames Host names.
+ */
+ private static void addresses(InetAddress addr, Collection<String> addrs, Collection<String> hostNames) {
+ String hostName = addr.getHostName();
+
+ String ipAddr = addr.getHostAddress();
+
+ hostName = F.isEmpty(hostName) || hostName.equals(ipAddr) || addr.isLoopbackAddress() ? "" : hostName;
+
+ addrs.add(ipAddr);
+ hostNames.add(hostName);
+ }
+
+ /**
+ * Gets local host. Implementation will first attempt to get a non-loopback
+ * address. If that fails, then loopback address will be returned.
+ * <p>
+ * Note that this method is synchronized to make sure that local host
+ * initialization happens only once.
+ *
+ * @return Address representing local host.
+ * @throws IOException If attempt to get local host failed.
+ */
+ public static synchronized InetAddress getLocalHost() throws IOException {
+ if (locHost == null)
+ // Cache it.
+ resetLocalHost();
+
+ return locHost;
+ }
+
+ /**
+ * @return Local host.
+ * @throws IOException If attempt to get local host failed.
+ */
+ private static synchronized InetAddress resetLocalHost() throws IOException {
+ locHost = null;
+
+ String sysLocHost = IgniteSystemProperties.getString(GG_LOCAL_HOST);
+
+ if (sysLocHost != null)
+ sysLocHost = sysLocHost.trim();
+
+ if (!F.isEmpty(sysLocHost))
+ locHost = InetAddress.getByName(sysLocHost);
+ else {
+ List<NetworkInterface> itfs = new ArrayList<>();
+
+ for (NetworkInterface itf : asIterable(NetworkInterface.getNetworkInterfaces()))
+ itfs.add(itf);
+
+ Collections.sort(itfs, new Comparator<NetworkInterface>() {
+ @Override public int compare(NetworkInterface itf1, NetworkInterface itf2) {
+ // Interfaces whose name starts with 'e' should go first.
+ return itf1.getName().compareTo(itf2.getName());
+ }
+ });
+
+ // It should not take longer than 2 seconds to reach
+ // local address on any network.
+ int reachTimeout = 2000;
+
+ for (NetworkInterface itf : itfs) {
+ boolean found = false;
+
+ for (InetAddress addr : asIterable(itf.getInetAddresses())) {
+ if (!addr.isLoopbackAddress() && !addr.isLinkLocalAddress() && reachable(itf, addr, reachTimeout)) {
+ locHost = addr;
+
+ found = true;
+
+ break;
+ }
+ }
+
+ if (found)
+ break;
+ }
+ }
+
+ if (locHost == null)
+ locHost = InetAddress.getLocalHost();
+
+ return locHost;
+ }
+
+ /**
+ * Checks if address can be reached using three argument InetAddress.isReachable() version.
+ *
+ * @param itf Network interface to use for test.
+ * @param addr Address to check.
+ * @param reachTimeout Timeout for the check.
+ * @return {@code True} if address is reachable.
+ */
+ public static boolean reachable(NetworkInterface itf, InetAddress addr, int reachTimeout) {
+ try {
+ return addr.isReachable(itf, 0, reachTimeout);
+ }
+ catch (IOException ignore) {
+ return false;
+ }
+ }
+
+ /**
+ * Checks if address can be reached using one argument InetAddress.isReachable() version.
+ *
+ * @param addr Address to check.
+ * @param reachTimeout Timeout for the check.
+ * @return {@code True} if address is reachable.
+ */
+ public static boolean reachable(InetAddress addr, int reachTimeout) {
+ try {
+ return addr.isReachable(reachTimeout);
+ }
+ catch (IOException ignore) {
+ return false;
+ }
+ }
+
+ /**
+ * @param loc Local node.
+ * @param rmt Remote node.
+ * @return Whether given nodes have the same macs.
+ */
+ public static boolean sameMacs(ClusterNode loc, ClusterNode rmt) {
+ assert loc != null;
+ assert rmt != null;
+
+ String locMacs = loc.attribute(GridNodeAttributes.ATTR_MACS);
+ String rmtMacs = rmt.attribute(GridNodeAttributes.ATTR_MACS);
+
+ return locMacs != null && locMacs.equals(rmtMacs);
+ }
+
+ /**
+ * Gets a list of all local non-loopback IPs known to this JVM.
+ * Note that this will include both IPv4 and IPv6 addresses (even if one "resolves"
+ * into another). Loopbacks will be skipped.
+ *
+ * @return List of all known local IPs (empty list if no addresses available).
+ */
+ public static synchronized Collection<String> allLocalIps() {
+ List<String> ips = new ArrayList<>(4);
+
+ try {
+ Enumeration<NetworkInterface> itfs = NetworkInterface.getNetworkInterfaces();
+
+ if (itfs != null) {
+ for (NetworkInterface itf : asIterable(itfs)) {
+ if (!itf.isLoopback()) {
+ Enumeration<InetAddress> addrs = itf.getInetAddresses();
+
+ if (addrs != null) {
+ for (InetAddress addr : asIterable(addrs)) {
+ String hostAddr = addr.getHostAddress();
+
+ if (!addr.isLoopbackAddress() && !ips.contains(hostAddr))
+ ips.add(hostAddr);
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (SocketException ignore) {
+ return Collections.emptyList();
+ }
+
+ Collections.sort(ips);
+
+ return ips;
+ }
+
+ /**
+ * Gets a list of all local enabled MACs known to this JVM. It
+ * is using hardware address of the network interface that is not guaranteed to be
+ * MAC addresses (but in most cases it is).
+ * <p>
+ * Note that if network interface is disabled - its MAC won't be included. All
+ * local network interfaces are probed including loopbacks. Virtual interfaces
+ * (sub-interfaces) are skipped.
+ * <p>
+ * Note that on linux getHardwareAddress() can return null from time to time
+ * if NetworkInterface.getHardwareAddress() method is called from many threads.
+ *
+ * @return List of all known enabled local MACs or empty list
+ * if no MACs could be found.
+ */
+ public static synchronized Collection<String> allLocalMACs() {
+ List<String> macs = new ArrayList<>(3);
+
+ try {
+ Enumeration<NetworkInterface> itfs = NetworkInterface.getNetworkInterfaces();
+
+ if (itfs != null) {
+ for (NetworkInterface itf : asIterable(itfs)) {
+ byte[] hwAddr = itf.getHardwareAddress();
+
+ // Loopback produces empty MAC.
+ if (hwAddr != null && hwAddr.length > 0) {
+ String mac = byteArray2HexString(hwAddr);
+
+ if (!macs.contains(mac))
+ macs.add(mac);
+ }
+ }
+ }
+ }
+ catch (SocketException ignore) {
+ return Collections.emptyList();
+ }
+
+ Collections.sort(macs);
+
+ return macs;
+ }
+
+ /**
+ * Downloads resource by URL.
+ *
+ * @param url URL to download.
+ * @param file File where downloaded resource should be stored.
+ * @return File where downloaded resource should be stored.
+ * @throws IOException If error occurred.
+ */
+ public static File downloadUrl(URL url, File file) throws IOException {
+ assert url != null;
+ assert file != null;
+
+ InputStream in = null;
+ OutputStream out = null;
+
+ try {
+ URLConnection conn = url.openConnection();
+
+ if (conn instanceof HttpsURLConnection) {
+ HttpsURLConnection https = (HttpsURLConnection)conn;
+
+ https.setHostnameVerifier(new DeploymentHostnameVerifier());
+
+ SSLContext ctx = SSLContext.getInstance(HTTPS_PROTOCOL);
+
+ ctx.init(null, getTrustManagers(), null);
+
+ // Initialize socket factory.
+ https.setSSLSocketFactory(ctx.getSocketFactory());
+ }
+
+ in = conn.getInputStream();
+
+ if (in == null)
+ throw new IOException("Failed to open connection: " + url.toString());
+
+ out = new BufferedOutputStream(new FileOutputStream(file));
+
+ copy(in, out);
+ }
+ catch (NoSuchAlgorithmException | KeyManagementException e) {
+ throw new IOException("Failed to open HTTPs connection [url=" + url.toString() + ", msg=" + e + ']', e);
+ } finally {
+ close(in, null);
+ close(out, null);
+ }
+
+ return file;
+ }
+
+ /**
+ * Construct array with one trust manager which don't reject input certificates.
+ *
+ * @return Array with one X509TrustManager implementation of trust manager.
+ */
+ private static TrustManager[] getTrustManagers() {
+ return new TrustManager[]{
+ new X509TrustManager() {
+ @Nullable @Override public X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+
+ @Override public void checkClientTrusted(X509Certificate[] certs, String authType) {
+ /* No-op. */
+ }
+
+ @Override public void checkServerTrusted(X509Certificate[] certs, String authType) {
+ /* No-op. */
+ }
+ }
+ };
+ }
+
+ /**
+ * Replace password in URI string with a single '*' character.
+ * <p>
+ * Parses given URI by applying ".*://(.*:.*)@.*"
+ * regular expression pattern and than if URI matches it
+ * replaces password strings between '/' and '@' with '*'.
+ *
+ * @param uri URI which password should be replaced.
+ * @return Converted URI string
+ */
+ @Nullable public static String hidePassword(@Nullable String uri) {
+ if (uri == null)
+ return null;
+
+ if (Pattern.matches(".*://(.*:.*)@.*", uri)) {
+ int userInfoLastIdx = uri.indexOf('@');
+
+ assert userInfoLastIdx != -1;
+
+ String str = uri.substring(0, userInfoLastIdx);
+
+ int userInfoStartIdx = str.lastIndexOf('/');
+
+ str = str.substring(userInfoStartIdx + 1);
+
+ String[] params = str.split(";");
+
+ StringBuilder builder = new StringBuilder();
+
+ for (int i = 0; i < params.length; i++) {
+ int idx;
+
+ if ((idx = params[i].indexOf(':')) != -1)
+ params[i] = params[i].substring(0, idx + 1) + '*';
+
+ builder.append(params[i]);
+
+ if (i != params.length - 1)
+ builder.append(';');
+ }
+
+ return new StringBuilder(uri).replace(userInfoStartIdx + 1, userInfoLastIdx,
+ builder.toString()).toString();
+ }
+
+ return uri;
+ }
+
+ /**
+ * @return Class loader used to load GridGain itself.
+ */
+ public static ClassLoader gridClassLoader() {
+ return gridClassLoader;
+ }
+
+ /**
+ * @param parent Parent to find.
+ * @param ldr Loader to check.
+ * @return {@code True} if parent found.
+ */
+ public static boolean hasParent(@Nullable ClassLoader parent, ClassLoader ldr) {
+ if (parent != null) {
+ for (; ldr != null; ldr = ldr.getParent()) {
+ if (ldr.equals(parent))
+ return true;
+ }
+
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Verifier always returns successful result for any host.
+ */
+ private static class DeploymentHostnameVerifier implements HostnameVerifier {
+ /** {@inheritDoc} */
+ @Override public boolean verify(String hostname, SSLSession ses) {
+ // Remote host trusted by default.
+ return true;
+ }
+ }
+
+ /**
+ * Makes a {@code '+---+'} dash line.
+ *
+ * @param len Length of the dash line to make.
+ * @return Dash line.
+ */
+ public static String dash(int len) {
+ char[] dash = new char[len];
+
+ Arrays.fill(dash, '-');
+
+ dash[0] = dash[len - 1] = '+';
+
+ return new String(dash);
+ }
+
+ /**
+ * Creates space filled string of given length.
+ *
+ * @param len Number of spaces.
+ * @return Space filled string of given length.
+ */
+ public static String pad(int len) {
+ char[] dash = new char[len];
+
+ Arrays.fill(dash, ' ');
+
+ return new String(dash);
+ }
+
+ /**
+ * Formats system time in milliseconds for printing in logs.
+ *
+ * @param sysTime System time.
+ * @return Formatted time string.
+ */
+ public static String format(long sysTime) {
+ return LONG_DATE_FMT.format(new java.util.Date(sysTime));
+ }
+
+ /**
+ * Takes given collection, shuffles it and returns iterable instance.
+ *
+ * @param <T> Type of elements to create iterator for.
+ * @param col Collection to shuffle.
+ * @return Iterable instance over randomly shuffled collection.
+ */
+ public static <T> Iterable<T> randomIterable(Collection<T> col) {
+ List<T> list = new ArrayList<>(col);
+
+ Collections.shuffle(list);
+
+ return list;
+ }
+
+ /**
+ * Converts enumeration to iterable so it can be used in {@code foreach} construct.
+ *
+ * @param <T> Types of instances for iteration.
+ * @param e Enumeration to convert.
+ * @return Iterable over the given enumeration.
+ */
+ public static <T> Iterable<T> asIterable(final Enumeration<T> e) {
+ return new Iterable<T>() {
+ @Override public Iterator<T> iterator() {
+ return new Iterator<T>() {
+ @Override public boolean hasNext() {
+ return e.hasMoreElements();
+ }
+
+ @SuppressWarnings({"IteratorNextCanNotThrowNoSuchElementException"})
+ @Override public T next() {
+ return e.nextElement();
+ }
+
+ @Override public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+ };
+ }
+
+ /**
+ * Copy source file (or folder) to destination file (or folder). Supported source & destination:
+ * <ul>
+ * <li>File to File</li>
+ * <li>File to Folder</li>
+ * <li>Folder to Folder (Copy the content of the directory and not the directory itself)</li>
+ * </ul>
+ *
+ * @param src Source file or folder.
+ * @param dest Destination file or folder.
+ * @param overwrite Whether or not overwrite existing files and folders.
+ * @throws IOException Thrown if an I/O error occurs.
+ */
+ public static void copy(File src, File dest, boolean overwrite) throws IOException {
+ assert src != null;
+ assert dest != null;
+
+ /*
+ * Supported source & destination:
+ * ===============================
+ * 1. File -> File
+ * 2. File -> Directory
+ * 3. Directory -> Directory
+ */
+
+ // Source must exist.
+ if (!src.exists())
+ throw new FileNotFoundException("Source can't be found: " + src);
+
+ // Check that source and destination are not the same.
+ if (src.getAbsoluteFile().equals(dest.getAbsoluteFile()))
+ throw new IOException("Source and destination are the same [src=" + src + ", dest=" + dest + ']');
+
+ if (dest.exists()) {
+ if (!dest.isDirectory() && !overwrite)
+ throw new IOException("Destination already exists: " + dest);
+
+ if (!dest.canWrite())
+ throw new IOException("Destination is not writable:" + dest);
+ }
+ else {
+ File parent = dest.getParentFile();
+
+ if (parent != null && !parent.exists())
+ // Ignore any errors here.
+ // We will get errors when we'll try to open the file stream.
+ //noinspection ResultOfMethodCallIgnored
+ parent.mkdirs();
+
+ // If source is a directory, we should create destination directory.
+ if (src.isDirectory())
+ //noinspection ResultOfMethodCallIgnored
+ dest.mkdir();
+ }
+
+ if (src.isDirectory()) {
+ // In this case we have Directory -> Directory.
+ // Note that we copy the content of the directory and not the directory itself.
+
+ File[] files = src.listFiles();
+
+ for (File file : files) {
+ if (file.isDirectory()) {
+ File dir = new File(dest, file.getName());
+
+ if (!dir.exists() && !dir.mkdirs())
+ throw new IOException("Can't create directory: " + dir);
+
+ copy(file, dir, overwrite);
+ }
+ else
+ copy(file, dest, overwrite);
+ }
+ }
+ else {
+ // In this case we have File -> File or File -> Directory.
+ File file = dest.exists() && dest.isDirectory() ? new File(dest, src.getName()) : dest;
+
+ if (!overwrite && file.exists())
+ throw new IOException("Destination already exists: " + file);
+
+ FileInputStream in = null;
+ FileOutputStream out = null;
+
+ try {
+ in = new FileInputStream(src);
+ out = new FileOutputStream(file);
+
+ copy(in, out);
+ }
+ finally {
+ if (in != null)
+ in.close();
+
+ if (out != null) {
+ out.getFD().sync();
+
+ out.close();
+ }
+ }
+ }
+ }
+
+ /**
+ * Starts clock timer if grid is first.
+ */
+ public static void onGridStart() {
+ synchronized (mux) {
+ if (gridCnt == 0) {
+ timer = new Thread(new Runnable() {
+ @SuppressWarnings({"BusyWait", "InfiniteLoopStatement"})
+ @Override public void run() {
+ while (true) {
+ curTimeMillis = System.currentTimeMillis();
+
+ try {
+ Thread.sleep(10);
+ }
+ catch (InterruptedException ignored) {
+ U.log(null, "Timer thread has been interrupted.");
+
+ break;
+ }
+ }
+ }
+ }, "gridgain-clock");
+
+ timer.setDaemon(true);
+
+ timer.setPriority(10);
+
+ timer.start();
+ }
+
+ ++gridCnt;
+ }
+ }
+
+ /**
+ * Stops clock timer if all nodes into JVM were stopped.
+ */
+ public static void onGridStop(){
+ synchronized (mux) {
+ assert gridCnt > 0 : gridCnt;
+
+ --gridCnt;
+
+ if (gridCnt == 0 && timer != null) {
+ timer.interrupt();
+
+ timer = null;
+ }
+ }
+ }
+
+ /**
+ * Copies input byte stream to output byte stream.
+ *
+ * @param in Input byte stream.
+ * @param out Output byte stream.
+ * @return Number of the copied bytes.
+ * @throws IOException Thrown if an I/O error occurs.
+ */
+ public static int copy(InputStream in, OutputStream out) throws IOException {
+ assert in != null;
+ assert out != null;
+
+ byte[] buf = new byte[BUF_SIZE];
+
+ int cnt = 0;
+
+ for (int n; (n = in.read(buf)) > 0;) {
+ out.write(buf, 0, n);
+
+ cnt += n;
+ }
+
+ return cnt;
+ }
+
+ /**
+ * Copies input character stream to output character stream.
+ *
+ * @param in Input character stream.
+ * @param out Output character stream.
+ * @return Number of the copied characters.
+ * @throws IOException Thrown if an I/O error occurs.
+ */
+ public static int copy(Reader in, Writer out) throws IOException {
+ assert in != null;
+ assert out != null;
+
+ char[] buf = new char[BUF_SIZE];
+
+ int cnt = 0;
+
+ for (int n; (n = in.read(buf)) > 0;) {
+ out.write(buf, 0, n);
+
+ cnt += n;
+ }
+
+ return cnt;
+ }
+
+ /**
+ * Writes string to file.
+ *
+ * @param file File.
+ * @param s String to write.
+ * @throws IOException Thrown if an I/O error occurs.
+ */
+ public static void writeStringToFile(File file, String s) throws IOException {
+ writeStringToFile(file, s, Charset.defaultCharset().toString(), false);
+ }
+
+ /**
+ * Writes string to file.
+ *
+ * @param file File.
+ * @param s String to write.
+ * @param charset Encoding.
+ * @throws IOException Thrown if an I/O error occurs.
+ */
+ public static void writeStringToFile(File file, String s, String charset) throws IOException {
+ writeStringToFile(file, s, charset, false);
+ }
+
+ /**
+ * Reads file to string using specified charset.
+ *
+ * @param fileName File name.
+ * @param charset File charset.
+ * @return File content.
+ * @throws IOException If error occurred.
+ */
+ public static String readFileToString(String fileName, String charset) throws IOException {
+ Reader input = new InputStreamReader(new FileInputStream(fileName), charset);
+
+ StringWriter output = new StringWriter();
+
+ char[] buf = new char[4096];
+
+ int n;
+
+ while ((n = input.read(buf)) != -1)
+ output.write(buf, 0, n);
+
+ return output.toString();
+ }
+
+ /**
+ * Writes string to file.
+ *
+ * @param file File.
+ * @param s String to write.
+ * @param charset Encoding.
+ * @param append If {@code true}, then specified string will be added to the end of the file.
+ * @throws IOException Thrown if an I/O error occurs.
+ */
+ public static void writeStringToFile(File file, String s, String charset, boolean append) throws IOException {
+ if (s == null)
+ return;
+
+ OutputStream out = null;
+
+ try {
+ out = new FileOutputStream(file, append);
+
+ if (s != null)
+ out.write(s.getBytes(charset));
+ } finally {
+ closeQuiet(out);
+ }
+ }
+
+ /**
+ * Utility method that sets cause into exception and returns it.
+ *
+ * @param e Exception to set cause to and return.
+ * @param cause Optional cause to set (if not {@code null}).
+ * @param <E> Type of the exception.
+ * @return Passed in exception with optionally set cause.
+ */
+ public static <E extends Throwable> E withCause(E e, @Nullable Throwable cause) {
+ assert e != null;
+
+ if (cause != null)
+ e.initCause(cause);
+
+ return e;
+ }
+
+ /**
+ * Deletes file or directory with all sub-directories and files.
+ *
+ * @param file File or directory to delete.
+ * @return {@code true} if and only if the file or directory is successfully deleted,
+ * {@code false} otherwise
+ */
+ public static boolean delete(File file) {
+ assert file != null;
+
+ boolean res = true;
+
+ if (file.isDirectory()) {
+ File[] files = file.listFiles();
+
+ if (files != null && files.length > 0)
+ for (File file1 : files)
+ if (file1.isDirectory())
+ res &= delete(file1);
+ else if (file1.getName().endsWith("jar"))
+ try {
+ // Why do we do this?
+ new JarFile(file1, false).close();
+
+ res &= file1.delete();
+ }
+ catch (IOException ignore) {
+ // Ignore it here...
+ }
+ else
+ res &= file1.delete();
+
+ res &= file.delete();
+ }
+ else
+ res = file.delete();
+
+ return res;
+ }
+
+ /**
+ * @param dir Directory to create along with all non-existent parent directories.
+ * @return {@code True} if directory exists (has been created or already existed),
+ * {@code false} if has not been created and does not exist.
+ */
+ public static boolean mkdirs(File dir) {
+ assert dir != null;
+
+ return dir.mkdirs() || dir.exists();
+ }
+
+ /**
+ * Resolve project home directory based on source code base.
+ *
+ * @return Project home directory (or {@code null} if it cannot be resolved).
+ */
+ @Nullable private static String resolveProjectHome() {
+ assert Thread.holdsLock(IgniteUtils.class);
+
+ // Resolve GridGain home via environment variables.
+ String ggHome0 = IgniteSystemProperties.getString(GG_HOME);
+
+ if (!F.isEmpty(ggHome0))
+ return ggHome0;
+
+ String appWorkDir = System.getProperty("user.dir");
+
+ if (appWorkDir != null) {
+ ggHome0 = findProjectHome(new File(appWorkDir));
+
+ if (ggHome0 != null)
+ return ggHome0;
+ }
+
+ URI uri;
+
+ Class<IgniteUtils> cls = IgniteUtils.class;
+
+ try {
+ ProtectionDomain domain = cls.getProtectionDomain();
+
+ // Should not happen, but to make sure our code is not broken.
+ if (domain == null || domain.getCodeSource() == null || domain.getCodeSource().getLocation() == null) {
+ logResolveFailed(cls, null);
+
+ return null;
+ }
+
+ // Resolve path to class-file.
+ uri = domain.getCodeSource().getLocation().toURI();
+
+ // Overcome UNC path problem on Windows (http://www.tomergabel.com/JavaMishandlesUNCPathsOnWindows.aspx)
+ if (isWindows() && uri.getAuthority() != null)
+ uri = new URI(uri.toString().replace("file://", "file:/"));
+ }
+ catch (URISyntaxException | SecurityException e) {
+ logResolveFailed(cls, e);
+
+ return null;
+ }
+
+ return findProjectHome(new File(uri));
+ }
+
+ /**
+ * Tries to find project home starting from specified directory and moving to root.
+ *
+ * @param startDir First directory in search hierarchy.
+ * @return Project home path or {@code null} if it wasn't found.
+ */
+ private static String findProjectHome(File startDir) {
+ for (File cur = startDir.getAbsoluteFile(); cur != null; cur = cur.getParentFile()) {
+ // Check 'cur' is project home directory.
+ if (!new File(cur, "bin").isDirectory() ||
+ !new File(cur, "libs").isDirectory() ||
+ !new File(cur, "config").isDirectory())
+ continue;
+
+ return cur.getPath();
+ }
+
+ return null;
+ }
+
+ /**
+ * @param cls Class.
+ * @param e Exception.
+ */
+ private static void logResolveFailed(Class cls, Exception e) {
+ warn(null, "Failed to resolve GRIDGAIN_HOME automatically for class codebase " +
+ "[class=" + cls + (e == null ? "" : ", e=" + e.getMessage()) + ']');
+ }
+
+ /**
+ * Retrieves {@code GRIDGAIN_HOME} property. The property is retrieved from system
+ * properties or from environment in that order.
+ *
+ * @return {@code GRIDGAIN_HOME} property.
+ */
+ @Nullable public static String getGridGainHome() {
+ GridTuple<String> ggHomeTup = ggHome;
+
+ String ggHome0;
+
+ if (ggHomeTup == null) {
+ synchronized (IgniteUtils.class) {
+ // Double check.
+ ggHomeTup = ggHome;
+
+ if (ggHomeTup == null) {
+ // Resolve GridGain installation home directory.
+ ggHome = F.t(ggHome0 = resolveProjectHome());
+
+ if (ggHome0 != null)
+ System.setProperty(GG_HOME, ggHome0);
+ }
+ else
+ ggHome0 = ggHomeTup.get();
+ }
+ }
+ else
+ ggHome0 = ggHomeTup.get();
+
+ return ggHome0;
+ }
+
+ /**
+ * @param path GridGain home. May be {@code null}.
+ */
+ public static void setGridGainHome(@Nullable String path) {
+ GridTuple<String> ggHomeTup = ggHome;
+
+ String ggHome0;
+
+ if (ggHomeTup == null) {
+ synchronized (IgniteUtils.class) {
+ // Double check.
+ ggHomeTup = ggHome;
+
+ if (ggHomeTup == null) {
+ if (F.isEmpty(path))
+ System.clearProperty(GG_HOME);
+ else
+ System.setProperty(GG_HOME, path);
+
+ ggHome = F.t(path);
+
+ return;
+ }
+ else
+ ggHome0 = ggHomeTup.get();
+ }
+ }
+ else
+ ggHome0 = ggHomeTup.get();
+
+ if (ggHome0 != null && !ggHome0.equals(path))
+ throw new IgniteException("Failed to set GRIDGAIN_HOME after it has been already resolved " +
+ "[ggHome=" + ggHome0 + ", newGgHome=" + path + ']');
+ }
+
+ /**
+ * Gets file associated with path.
+ * <p>
+ * First check if path is relative to {@code GRIDGAIN_HOME}.
+ * If not, check if path is absolute.
+ * If all checks fail, then {@code null} is returned.
+ * <p>
+ * See {@link #getGridGainHome()} for information on how {@code GRIDGAIN_HOME} is retrieved.
+ *
+ * @param path Path to resolve.
+ * @return Resolved path as file, or {@code null} if path cannot be resolved.
+ */
+ @Nullable public static File resolveGridGainPath(String path) {
+ assert path != null;
+
+ /*
+ * 1. Check relative to GRIDGAIN_HOME specified in configuration, if any.
+ */
+
+ String home = getGridGainHome();
+
+ if (home != null) {
+ File file = new File(home, path);
+
+ if (file.exists())
+ return file;
+ }
+
+ /*
+ * 2. Check given path as absolute.
+ */
+
+ File file = new File(path);
+
+ if (file.exists())
+ return file;
+
+ /*
+ * 3. Check development path.
+ */
+
+ if (home != null)
+ file = new File(home, "os/" + path);
+
+ return file.exists() ? file : null;
+ }
+
+ /**
+ * Gets URL representing the path passed in. First the check is made if path is absolute.
+ * If not, then the check is made if path is relative to {@code META-INF} folder in classpath.
+ * If not, then the check is made if path is relative to ${GRIDGAIN_HOME}.
+ * If all checks fail,
+ * then {@code null} is returned, otherwise URL representing path is returned.
+ * <p>
+ * See {@link #getGridGainHome()} for information on how {@code GRIDGAIN_HOME} is retrieved.
+ *
+ * @param path Path to resolve.
+ * @return Resolved path as URL, or {@code null} if path cannot be resolved.
+ * @see #getGridGainHome()
+ */
+ @Nullable public static URL resolveGridGainUrl(String path) {
+ return resolveGridGainUrl(path, true);
+ }
+
+ /**
+ * Gets URL representing the path passed in. First the check is made if path is absolute.
+ * If not, then the check is made if path is relative to {@code META-INF} folder in classpath.
+ * If not, then the check is made if path is relative to ${GRIDGAIN_HOME}.
+ * If all checks fail,
+ * then {@code null} is returned, otherwise URL representing path is returned.
+ * <p>
+ * See {@link #getGridGainHome()} for information on how {@code GRIDGAIN_HOME} is retrieved.
+ *
+ * @param path Path to resolve.
+ * @param metaInf Flag to indicate whether META-INF folder should be checked or class path root.
+ * @return Resolved path as URL, or {@code null} if path cannot be resolved.
+ * @see #getGridGainHome()
+ */
+ @SuppressWarnings({"UnusedCatchParameter"})
+ @Nullable public static URL resolveGridGainUrl(String path, boolean metaInf) {
+ File f = resolveGridGainPath(path);
+
+ if (f == null)
+ f = resolveGridGainPath("os/" + path);
+
+ if (f != null) {
+ try {
+ // Note: we use that method's chain instead of File.getURL() with due
+ // Sun bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6179468
+ return f.toURI().toURL();
+ }
+ catch (MalformedURLException e) {
+ // No-op.
+ }
+ }
+
+ String locPath = (metaInf ? "META-INF/" : "") + path.replaceAll("\\\\", "/");
+
+ return Thread.currentThread().getContextClassLoader().getResource(locPath);
+ }
+
+ /**
+ * Join byte arrays into single one.
+ *
+ * @param bufs list of byte arrays to concatenate.
+ * @return Concatenated byte's array.
+ */
+ public static byte[] join(byte[]... bufs) {
+ int size = 0;
+ for (byte[] buf : bufs) {
+ size += buf.length;
+ }
+
+ byte[] res = new byte[size];
+ int position = 0;
+ for (byte[] buf : bufs) {
+ arrayCopy(buf, 0, res, position, buf.length);
+ position += buf.length;
+ }
+
+ return res;
+ }
+
+ /**
+ * Converts byte array to formatted string. If calling:
+ * <pre name="code" class="java">
+ * ...
+ * byte[] data = {10, 20, 30, 40, 50, 60, 70, 80, 90};
+ *
+ * U.byteArray2String(data, "0x%02X", ",0x%02X")
+ * ...
+ * </pre>
+ * the result will be:
+ * <pre name="code" class="java">
+ * ...
+ * 0x0A, 0x14, 0x1E, 0x28, 0x32, 0x3C, 0x46, 0x50, 0x5A
+ * ...
+ * </pre>
+ *
+ * @param arr Array of byte.
+ * @param hdrFmt C-style string format for the first element.
+ * @param bodyFmt C-style string format for second and following elements, if any.
+ * @return String with converted bytes.
+ */
+ public static String byteArray2String(byte[] arr, String hdrFmt, String bodyFmt) {
+ assert arr != null;
+ assert hdrFmt != null;
+ assert bodyFmt != null;
+
+ SB sb = new SB();
+
+ sb.a('{');
+
+ boolean first = true;
+
+ for (byte b : arr)
+ if (first) {
+ sb.a(String.format(hdrFmt, b));
+
+ first = false;
+ }
+ else
+ sb.a(String.format(bodyFmt, b));
+
+ sb.a('}');
+
+ return sb.toString();
+ }
+
+ /**
+ * Converts byte array to hex string.
+ *
+ * @param arr Array of bytes.
+ * @return Hex string.
+ */
+ public static String byteArray2HexString(byte[] arr) {
+ SB sb = new SB(arr.length << 1);
+
+ for (byte b : arr)
+ sb.a(Integer.toHexString(MASK & b >>> 4)).a(Integer.toHexString(MASK & b));
+
+ return sb.toString().toUpperCase();
+ }
+
+ /**
+ * Convert string with hex values to byte array.
+ *
+ * @param hex Hexadecimal string to convert.
+ * @return array of bytes defined as hex in string.
+ * @throws IllegalArgumentException If input character differs from certain hex characters.
+ */
+ public static byte[] hexString2ByteArray(String hex) throws IllegalArgumentException {
+ // If Hex string has odd character length.
+ if (hex.length() % 2 != 0)
+ hex = '0' + hex;
+
+ char[] chars = hex.toCharArray();
+
+ byte[] bytes = new byte[chars.length / 2];
+
+ int byteCnt = 0;
+
+ for (int i = 0; i < chars.length; i += 2) {
+ int newByte = 0;
+
+ newByte |= hexCharToByte(chars[i]);
+
+ newByte <<= 4;
+
+ newByte |= hexCharToByte(chars[i + 1]);
+
+ bytes[byteCnt] = (byte)newByte;
+
+ byteCnt++;
+ }
+
+ return bytes;
+ }
+
+ /**
+ * Return byte value for certain character.
+ *
+ * @param ch Character
+ * @return Byte value.
+ * @throws IllegalArgumentException If input character differ from certain hex characters.
+ */
+ @SuppressWarnings({"UnnecessaryFullyQualifiedName", "fallthrough"})
+ private static byte hexCharToByte(char ch) throws IllegalArgumentException {
+ switch (ch) {
+ case '0':
+
<TRUNCATED>
[11/52] [abbrv] incubator-ignite git commit: ignite-117 rebuilt mac
natives
Posted by vk...@apache.org.
ignite-117 rebuilt mac natives
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/506cda64
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/506cda64
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/506cda64
Branch: refs/heads/ignite-61
Commit: 506cda644ac151d5b0da8e36de2959efc00d8f8e
Parents: e73857f
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jan 29 16:29:08 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jan 29 16:29:08 2015 +0300
----------------------------------------------------------------------
.../META-INF/native/osx/libigniteshmem.dylib | Bin 33108 -> 33116 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/506cda64/modules/core/src/main/java/META-INF/native/osx/libigniteshmem.dylib
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/META-INF/native/osx/libigniteshmem.dylib b/modules/core/src/main/java/META-INF/native/osx/libigniteshmem.dylib
index 6cfeb9e..2152401 100755
Binary files a/modules/core/src/main/java/META-INF/native/osx/libigniteshmem.dylib and b/modules/core/src/main/java/META-INF/native/osx/libigniteshmem.dylib differ
[36/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
index 0000000,79937f9..7c53dba
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
@@@ -1,0 -1,511 +1,505 @@@
+ /*
+ * 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.cache.distributed.near;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.processors.cache.version.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.processors.cache.transactions.*;
+ import org.apache.ignite.internal.util.direct.*;
+ 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 java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Near cache prepare response.
+ */
+ public class GridNearTxPrepareResponse<K, V> extends GridDistributedTxPrepareResponse<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Collection of versions that are pending and less than lock version. */
+ @GridToStringInclude
+ @GridDirectCollection(GridCacheVersion.class)
+ private Collection<GridCacheVersion> pending;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /** Mini future ID. */
+ private IgniteUuid miniId;
+
+ /** DHT version. */
+ private GridCacheVersion dhtVer;
+
+ /** */
+ @GridToStringInclude
+ @GridDirectCollection(int.class)
+ private Collection<Integer> invalidParts;
+
+ /** Map of owned values to set on near node. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Map<IgniteTxKey<K>, GridTuple3<GridCacheVersion, V, byte[]>> ownedVals;
+
+ /** Marshalled owned bytes. */
+ @GridToStringExclude
+ @GridDirectCollection(byte[].class)
+ private Collection<byte[]> ownedValsBytes;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridNearTxPrepareResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param xid Xid version.
+ * @param futId Future ID.
+ * @param miniId Mini future ID.
+ * @param dhtVer DHT version.
+ * @param invalidParts Invalid partitions.
+ * @param err Error.
+ */
+ public GridNearTxPrepareResponse(GridCacheVersion xid, IgniteUuid futId, IgniteUuid miniId, GridCacheVersion dhtVer,
+ Collection<Integer> invalidParts, Throwable err) {
+ super(xid, err);
+
+ assert futId != null;
+ assert miniId != null;
+ assert dhtVer != null;
+
+ this.futId = futId;
+ this.miniId = miniId;
+ this.dhtVer = dhtVer;
+ this.invalidParts = invalidParts;
+ }
+
+ /**
+ * Gets pending versions that are less than {@link #version()}.
+ *
+ * @return Pending versions.
+ */
+ public Collection<GridCacheVersion> pending() {
+ return pending == null ? Collections.<GridCacheVersion>emptyList() : pending;
+ }
+
+ /**
+ * Sets pending versions that are less than {@link #version()}.
+ *
+ * @param pending Pending versions.
+ */
+ public void pending(Collection<GridCacheVersion> pending) {
+ this.pending = pending;
+ }
+
+ /**
+ * @return Mini future ID.
+ */
+ public IgniteUuid miniId() {
+ return miniId;
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return DHT version.
+ */
+ public GridCacheVersion dhtVersion() {
+ return dhtVer;
+ }
+
+ /**
+ * Adds owned value.
+ *
+ * @param key Key.
+ * @param ver DHT version.
+ * @param val Value.
+ * @param valBytes Value bytes.
+ */
+ public void addOwnedValue(IgniteTxKey<K> key, GridCacheVersion ver, V val, byte[] valBytes) {
+ if (ownedVals == null)
+ ownedVals = new HashMap<>();
+
+ ownedVals.put(key, F.t(ver, val, valBytes));
+ }
+
+ /**
+ * @return Owned values map.
+ */
+ public Map<IgniteTxKey<K>, GridTuple3<GridCacheVersion, V, byte[]>> ownedValues() {
+ return ownedVals == null ? Collections.<IgniteTxKey<K>, GridTuple3<GridCacheVersion,V,byte[]>>emptyMap() :
+ Collections.unmodifiableMap(ownedVals);
+ }
+
+ /**
+ * @param key Key.
+ * @return {@code True} if response has owned value for given key.
+ */
+ public boolean hasOwnedValue(IgniteTxKey<K> key) {
+ return ownedVals != null && ownedVals.containsKey(key);
+ }
+
+ /**
+ * @return Invalid partitions.
+ */
+ public Collection<Integer> invalidPartitions() {
+ return invalidParts;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (ownedVals != null && ownedValsBytes == null) {
+ ownedValsBytes = new ArrayList<>(ownedVals.size());
+
+ for (Map.Entry<IgniteTxKey<K>, GridTuple3<GridCacheVersion, V, byte[]>> entry : ownedVals.entrySet()) {
+ GridTuple3<GridCacheVersion, V, byte[]> tup = entry.getValue();
+
+ boolean rawBytes = false;
+
+ byte[] valBytes = tup.get3();
+
+ if (valBytes == null) {
+ if (tup.get2() != null && tup.get2() instanceof byte[]) {
+ rawBytes = true;
+
+ valBytes = (byte[])tup.get2();
+ }
+ else
+ valBytes = ctx.marshaller().marshal(tup.get2());
+ }
+
+ ownedValsBytes.add(ctx.marshaller().marshal(F.t(entry.getKey(), tup.get1(), valBytes, rawBytes)));
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (ownedValsBytes != null && ownedVals == null) {
+ ownedVals = new HashMap<>();
+
+ for (byte[] bytes : ownedValsBytes) {
+ GridTuple4<IgniteTxKey<K>, GridCacheVersion, byte[], Boolean> tup = ctx.marshaller().unmarshal(bytes, ldr);
+
+ V val = tup.get4() ? (V)tup.get3() : ctx.marshaller().<V>unmarshal(tup.get3(), ldr);
+
+ ownedVals.put(tup.get1(), F.t(tup.get2(), val, tup.get4() ? null : tup.get3()));
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridNearTxPrepareResponse _clone = new GridNearTxPrepareResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridNearTxPrepareResponse _clone = (GridNearTxPrepareResponse)_msg;
+
+ _clone.pending = pending;
+ _clone.futId = futId;
+ _clone.miniId = miniId;
+ _clone.dhtVer = dhtVer;
+ _clone.invalidParts = invalidParts;
+ _clone.ownedVals = ownedVals;
+ _clone.ownedValsBytes = ownedValsBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 10:
- if (!commState.putCacheVersion(dhtVer))
++ if (!commState.putCacheVersion("dhtVer", dhtVer))
+ return false;
+
+ commState.idx++;
+
+ case 11:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid("futId", futId))
+ return false;
+
+ commState.idx++;
+
+ case 12:
+ if (invalidParts != null) {
+ if (commState.it == null) {
- if (!commState.putInt(invalidParts.size()))
++ if (!commState.putInt(null, invalidParts.size()))
+ return false;
+
+ commState.it = invalidParts.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putInt((int)commState.cur))
++ if (!commState.putInt(null, (int)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 13:
- if (!commState.putGridUuid(miniId))
++ if (!commState.putGridUuid("miniId", miniId))
+ return false;
+
+ commState.idx++;
+
+ case 14:
+ if (ownedValsBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(ownedValsBytes.size()))
++ if (!commState.putInt(null, ownedValsBytes.size()))
+ return false;
+
+ commState.it = ownedValsBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 15:
+ if (pending != null) {
+ if (commState.it == null) {
- if (!commState.putInt(pending.size()))
++ if (!commState.putInt(null, pending.size()))
+ return false;
+
+ commState.it = pending.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putCacheVersion((GridCacheVersion)commState.cur))
++ if (!commState.putCacheVersion(null, (GridCacheVersion)commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 10:
- GridCacheVersion dhtVer0 = commState.getCacheVersion();
++ dhtVer = commState.getCacheVersion("dhtVer");
+
- if (dhtVer0 == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- dhtVer = dhtVer0;
-
+ commState.idx++;
+
+ case 11:
- IgniteUuid futId0 = commState.getGridUuid();
++ futId = commState.getGridUuid("futId");
+
- if (futId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- futId = futId0;
-
+ commState.idx++;
+
+ case 12:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (invalidParts == null)
+ invalidParts = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- if (buf.remaining() < 4)
- return false;
++ int _val = commState.getInt(null);
+
- int _val = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ invalidParts.add((Integer)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 13:
- IgniteUuid miniId0 = commState.getGridUuid();
++ miniId = commState.getGridUuid("miniId");
+
- if (miniId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- miniId = miniId0;
-
+ commState.idx++;
+
+ case 14:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (ownedValsBytes == null)
+ ownedValsBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ ownedValsBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 15:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (pending == null)
+ pending = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- GridCacheVersion _val = commState.getCacheVersion();
++ GridCacheVersion _val = commState.getCacheVersion(null);
+
- if (_val == CACHE_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ pending.add((GridCacheVersion)_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 55;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridNearTxPrepareResponse.class, this, "super", super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearUnlockRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearUnlockRequest.java
index 0000000,06ce651..40d3506
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearUnlockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearUnlockRequest.java
@@@ -1,0 -1,103 +1,103 @@@
+ /*
+ * 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.cache.distributed.near;
+
+ import org.apache.ignite.internal.processors.cache.distributed.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Near cache unlock request.
+ */
+ public class GridNearUnlockRequest<K, V> extends GridDistributedUnlockRequest<K, V> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridNearUnlockRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param keyCnt Key count.
+ */
+ public GridNearUnlockRequest(int cacheId, int keyCnt) {
+ super(cacheId, keyCnt);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridNearUnlockRequest _clone = new GridNearUnlockRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 56;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridNearUnlockRequest.class, this, super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
index 0000000,e3f2c94..7794028
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
@@@ -1,0 -1,818 +1,800 @@@
+ /*
+ * 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.cache.query;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.cache.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.marshaller.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.*;
+
+ /**
+ * Query request.
+ */
+ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K, V> implements GridCacheDeployable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private long id;
+
+ /** */
+ private String cacheName;
+
+ /** */
+ private GridCacheQueryType type;
+
+ /** */
+ private boolean fields;
+
+ /** */
+ private String clause;
+
+ /** */
+ private String clsName;
+
+ /** */
+ @GridDirectTransient
+ private IgniteBiPredicate<Object, Object> keyValFilter;
+
+ /** */
+ private byte[] keyValFilterBytes;
+
+ /** */
+ @GridDirectTransient
+ private IgnitePredicate<CacheEntry<Object, Object>> prjFilter;
+
+ /** */
+ private byte[] prjFilterBytes;
+
+ /** */
+ @GridDirectTransient
+ private IgniteReducer<Object, Object> rdc;
+
+ /** */
+ private byte[] rdcBytes;
+
+ /** */
+ @GridDirectTransient
+ private IgniteClosure<Object, Object> trans;
+
+ /** */
+ private byte[] transBytes;
+
+ /** */
+ @GridDirectTransient
+ private Object[] args;
+
+ /** */
+ private byte[] argsBytes;
+
+ /** */
+ private int pageSize;
+
+ /** */
+ private boolean incBackups;
+
+ /** */
+ private boolean cancel;
+
+ /** */
+ private boolean incMeta;
+
+ /** */
+ private boolean all;
+
+ /** */
+ @GridDirectVersion(1)
+ private boolean keepPortable;
+
+ /** */
+ @GridDirectVersion(2)
+ private UUID subjId;
+
+ /** */
+ @GridDirectVersion(2)
+ private int taskHash;
+
+ /**
+ * Required by {@link Externalizable}
+ */
+ public GridCacheQueryRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param id Request to cancel.
+ * @param fields Fields query flag.
+ */
+ public GridCacheQueryRequest(int cacheId, long id, boolean fields) {
+ this.cacheId = cacheId;
+ this.id = id;
+ this.fields = fields;
+
+ cancel = true;
+ }
+
+ /**
+ * Request to load page.
+ *
+ * @param cacheId Cache ID.
+ * @param id Request ID.
+ * @param cacheName Cache name.
+ * @param pageSize Page size.
+ * @param incBackups {@code true} if need to include backups.
+ * @param fields Fields query flag.
+ * @param all Whether to load all pages.
+ * @param keepPortable Whether to keep portables.
+ */
+ public GridCacheQueryRequest(
+ int cacheId,
+ long id,
+ String cacheName,
+ int pageSize,
+ boolean incBackups,
+ boolean fields,
+ boolean all,
+ boolean keepPortable,
+ UUID subjId,
+ int taskHash
+ ) {
+ this.cacheId = cacheId;
+ this.id = id;
+ this.cacheName = cacheName;
+ this.pageSize = pageSize;
+ this.incBackups = incBackups;
+ this.fields = fields;
+ this.all = all;
+ this.keepPortable = keepPortable;
+ this.subjId = subjId;
+ this.taskHash = taskHash;
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param id Request id.
+ * @param cacheName Cache name.
+ * @param type Query type.
+ * @param fields {@code true} if query returns fields.
+ * @param clause Query clause.
+ * @param clsName Query class name.
+ * @param keyValFilter Key-value filter.
+ * @param prjFilter Projection filter.
+ * @param rdc Reducer.
+ * @param trans Transformer.
+ * @param pageSize Page size.
+ * @param incBackups {@code true} if need to include backups.
+ * @param args Query arguments.
+ * @param incMeta Include meta data or not.
+ */
+ public GridCacheQueryRequest(
+ int cacheId,
+ long id,
+ String cacheName,
+ GridCacheQueryType type,
+ boolean fields,
+ String clause,
+ String clsName,
+ IgniteBiPredicate<Object, Object> keyValFilter,
+ IgnitePredicate<CacheEntry<Object, Object>> prjFilter,
+ IgniteReducer<Object, Object> rdc,
+ IgniteClosure<Object, Object> trans,
+ int pageSize,
+ boolean incBackups,
+ Object[] args,
+ boolean incMeta,
+ boolean keepPortable,
+ UUID subjId,
+ int taskHash
+ ) {
+ assert type != null || fields;
+ assert clause != null || (type == SCAN || type == SET || type == SPI);
+ assert clsName != null || fields || type == SCAN || type == SET || type == SPI;
+
+ this.cacheId = cacheId;
+ this.id = id;
+ this.cacheName = cacheName;
+ this.type = type;
+ this.fields = fields;
+ this.clause = clause;
+ this.clsName = clsName;
+ this.keyValFilter = keyValFilter;
+ this.prjFilter = prjFilter;
+ this.rdc = rdc;
+ this.trans = trans;
+ this.pageSize = pageSize;
+ this.incBackups = incBackups;
+ this.args = args;
+ this.incMeta = incMeta;
+ this.keepPortable = keepPortable;
+ this.subjId = subjId;
+ this.taskHash = taskHash;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (keyValFilter != null) {
+ if (ctx.deploymentEnabled())
+ prepareObject(keyValFilter, ctx);
+
+ keyValFilterBytes = CU.marshal(ctx, keyValFilter);
+ }
+
+ if (prjFilter != null) {
+ if (ctx.deploymentEnabled())
+ prepareObject(prjFilter, ctx);
+
+ prjFilterBytes = CU.marshal(ctx, prjFilter);
+ }
+
+ if (rdc != null) {
+ if (ctx.deploymentEnabled())
+ prepareObject(rdc, ctx);
+
+ rdcBytes = CU.marshal(ctx, rdc);
+ }
+
+ if (trans != null) {
+ if (ctx.deploymentEnabled())
+ prepareObject(trans, ctx);
+
+ transBytes = CU.marshal(ctx, trans);
+ }
+
+ if (!F.isEmpty(args)) {
+ if (ctx.deploymentEnabled()) {
+ for (Object arg : args)
+ prepareObject(arg, ctx);
+ }
+
+ argsBytes = CU.marshal(ctx, args);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ IgniteMarshaller mrsh = ctx.marshaller();
+
+ if (keyValFilterBytes != null)
+ keyValFilter = mrsh.unmarshal(keyValFilterBytes, ldr);
+
+ if (prjFilterBytes != null)
+ prjFilter = mrsh.unmarshal(prjFilterBytes, ldr);
+
+ if (rdcBytes != null)
+ rdc = mrsh.unmarshal(rdcBytes, ldr);
+
+ if (transBytes != null)
+ trans = mrsh.unmarshal(transBytes, ldr);
+
+ if (argsBytes != null)
+ args = mrsh.unmarshal(argsBytes, ldr);
+ }
+
+ /**
+ * @param ctx Context.
+ * @throws IgniteCheckedException In case of error.
+ */
+ void beforeLocalExecution(GridCacheContext<K, V> ctx) throws IgniteCheckedException {
+ IgniteMarshaller marsh = ctx.marshaller();
+
+ rdc = rdc != null ? marsh.<IgniteReducer<Object, Object>>unmarshal(marsh.marshal(rdc), null) : null;
+ trans = trans != null ? marsh.<IgniteClosure<Object, Object>>unmarshal(marsh.marshal(trans), null) : null;
+ }
+
+ /**
+ * @return Request id.
+ */
+ public long id() {
+ return id;
+ }
+
+ /**
+ * @return Cache name.
+ */
+ public String cacheName() {
+ return cacheName;
+ }
+
+ /**
+ * @return Query type.
+ */
+ public GridCacheQueryType type() {
+ return type;
+ }
+
+ /**
+ * @return {@code true} if query returns fields.
+ */
+ public boolean fields() {
+ return fields;
+ }
+
+ /**
+ * @return Query clause.
+ */
+ public String clause() {
+ return clause;
+ }
+
+ /**
+ * @return Class name.
+ */
+ public String className() {
+ return clsName;
+ }
+
+ /**
+ * @return Flag indicating whether to include backups.
+ */
+ public boolean includeBackups() {
+ return incBackups;
+ }
+
+ /**
+ * @return Flag indicating that this is cancel request.
+ */
+ public boolean cancel() {
+ return cancel;
+ }
+
+ /**
+ * @return Key-value filter.
+ */
+ public IgniteBiPredicate<Object, Object> keyValueFilter() {
+ return keyValFilter;
+ }
+
+ /** {@inheritDoc} */
+ public IgnitePredicate<CacheEntry<Object, Object>> projectionFilter() {
+ return prjFilter;
+ }
+
+ /**
+ * @return Reducer.
+ */
+ public IgniteReducer<Object, Object> reducer() {
+ return rdc;
+ }
+
+ /**
+ * @return Transformer.
+ */
+ public IgniteClosure<Object, Object> transformer() {
+ return trans;
+ }
+
+ /**
+ * @return Page size.
+ */
+ public int pageSize() {
+ return pageSize;
+ }
+
+ /**
+ * @return Arguments.
+ */
+ public Object[] arguments() {
+ return args;
+ }
+
+ /**
+ * @return Include meta data or not.
+ */
+ public boolean includeMetaData() {
+ return incMeta;
+ }
+
+ /**
+ * @return Whether to load all pages.
+ */
+ public boolean allPages() {
+ return all;
+ }
+
+ /**
+ * @return Whether to keep portables.
+ */
+ public boolean keepPortable() {
+ return keepPortable;
+ }
+
+ /**
+ * @return Security subject ID.
+ */
+ public UUID subjectId() {
+ return subjId;
+ }
+
+ /**
+ * @return Task hash.
+ */
+ public int taskHash() {
+ return taskHash;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridCacheQueryRequest _clone = new GridCacheQueryRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridCacheQueryRequest _clone = (GridCacheQueryRequest)_msg;
+
+ _clone.id = id;
+ _clone.cacheName = cacheName;
+ _clone.type = type;
+ _clone.fields = fields;
+ _clone.clause = clause;
+ _clone.clsName = clsName;
+ _clone.keyValFilter = keyValFilter;
+ _clone.keyValFilterBytes = keyValFilterBytes;
+ _clone.prjFilter = prjFilter;
+ _clone.prjFilterBytes = prjFilterBytes;
+ _clone.rdc = rdc;
+ _clone.rdcBytes = rdcBytes;
+ _clone.trans = trans;
+ _clone.transBytes = transBytes;
+ _clone.args = args;
+ _clone.argsBytes = argsBytes;
+ _clone.pageSize = pageSize;
+ _clone.incBackups = incBackups;
+ _clone.cancel = cancel;
+ _clone.incMeta = incMeta;
+ _clone.all = all;
+ _clone.keepPortable = keepPortable;
+ _clone.subjId = subjId;
+ _clone.taskHash = taskHash;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
- if (!commState.putBoolean(all))
++ if (!commState.putBoolean("all", all))
+ return false;
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putByteArray(argsBytes))
++ if (!commState.putByteArray("argsBytes", argsBytes))
+ return false;
+
+ commState.idx++;
+
+ case 5:
- if (!commState.putString(cacheName))
++ if (!commState.putString("cacheName", cacheName))
+ return false;
+
+ commState.idx++;
+
+ case 6:
- if (!commState.putBoolean(cancel))
++ if (!commState.putBoolean("cancel", cancel))
+ return false;
+
+ commState.idx++;
+
+ case 7:
- if (!commState.putString(clause))
++ if (!commState.putString("clause", clause))
+ return false;
+
+ commState.idx++;
+
+ case 8:
- if (!commState.putString(clsName))
++ if (!commState.putString("clsName", clsName))
+ return false;
+
+ commState.idx++;
+
+ case 9:
- if (!commState.putBoolean(fields))
++ if (!commState.putBoolean("fields", fields))
+ return false;
+
+ commState.idx++;
+
+ case 10:
- if (!commState.putLong(id))
++ if (!commState.putLong("id", id))
+ return false;
+
+ commState.idx++;
+
+ case 11:
- if (!commState.putBoolean(incBackups))
++ if (!commState.putBoolean("incBackups", incBackups))
+ return false;
+
+ commState.idx++;
+
+ case 12:
- if (!commState.putBoolean(incMeta))
++ if (!commState.putBoolean("incMeta", incMeta))
+ return false;
+
+ commState.idx++;
+
+ case 13:
- if (!commState.putByteArray(keyValFilterBytes))
++ if (!commState.putByteArray("keyValFilterBytes", keyValFilterBytes))
+ return false;
+
+ commState.idx++;
+
+ case 14:
- if (!commState.putInt(pageSize))
++ if (!commState.putInt("pageSize", pageSize))
+ return false;
+
+ commState.idx++;
+
+ case 15:
- if (!commState.putByteArray(prjFilterBytes))
++ if (!commState.putByteArray("prjFilterBytes", prjFilterBytes))
+ return false;
+
+ commState.idx++;
+
+ case 16:
- if (!commState.putByteArray(rdcBytes))
++ if (!commState.putByteArray("rdcBytes", rdcBytes))
+ return false;
+
+ commState.idx++;
+
+ case 17:
- if (!commState.putByteArray(transBytes))
++ if (!commState.putByteArray("transBytes", transBytes))
+ return false;
+
+ commState.idx++;
+
+ case 18:
- if (!commState.putEnum(type))
++ if (!commState.putEnum("type", type))
+ return false;
+
+ commState.idx++;
+
+ case 19:
- if (!commState.putBoolean(keepPortable))
++ if (!commState.putBoolean("keepPortable", keepPortable))
+ return false;
+
+ commState.idx++;
+
+ case 20:
- if (!commState.putUuid(subjId))
++ if (!commState.putUuid("subjId", subjId))
+ return false;
+
+ commState.idx++;
+
+ case 21:
- if (!commState.putInt(taskHash))
++ if (!commState.putInt("taskHash", taskHash))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
- if (buf.remaining() < 1)
- return false;
++ all = commState.getBoolean("all");
+
- all = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 4:
- byte[] argsBytes0 = commState.getByteArray();
++ argsBytes = commState.getByteArray("argsBytes");
+
- if (argsBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- argsBytes = argsBytes0;
-
+ commState.idx++;
+
+ case 5:
- String cacheName0 = commState.getString();
++ cacheName = commState.getString("cacheName");
+
- if (cacheName0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- cacheName = cacheName0;
-
+ commState.idx++;
+
+ case 6:
- if (buf.remaining() < 1)
- return false;
++ cancel = commState.getBoolean("cancel");
+
- cancel = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 7:
- String clause0 = commState.getString();
++ clause = commState.getString("clause");
+
- if (clause0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- clause = clause0;
-
+ commState.idx++;
+
+ case 8:
- String clsName0 = commState.getString();
++ clsName = commState.getString("clsName");
+
- if (clsName0 == STR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- clsName = clsName0;
-
+ commState.idx++;
+
+ case 9:
- if (buf.remaining() < 1)
- return false;
++ fields = commState.getBoolean("fields");
+
- fields = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 10:
- if (buf.remaining() < 8)
- return false;
++ id = commState.getLong("id");
+
- id = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 11:
- if (buf.remaining() < 1)
- return false;
++ incBackups = commState.getBoolean("incBackups");
+
- incBackups = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 12:
- if (buf.remaining() < 1)
- return false;
++ incMeta = commState.getBoolean("incMeta");
+
- incMeta = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 13:
- byte[] keyValFilterBytes0 = commState.getByteArray();
++ keyValFilterBytes = commState.getByteArray("keyValFilterBytes");
+
- if (keyValFilterBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- keyValFilterBytes = keyValFilterBytes0;
-
+ commState.idx++;
+
+ case 14:
- if (buf.remaining() < 4)
- return false;
++ pageSize = commState.getInt("pageSize");
+
- pageSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 15:
- byte[] prjFilterBytes0 = commState.getByteArray();
++ prjFilterBytes = commState.getByteArray("prjFilterBytes");
+
- if (prjFilterBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- prjFilterBytes = prjFilterBytes0;
-
+ commState.idx++;
+
+ case 16:
- byte[] rdcBytes0 = commState.getByteArray();
++ rdcBytes = commState.getByteArray("rdcBytes");
+
- if (rdcBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- rdcBytes = rdcBytes0;
-
+ commState.idx++;
+
+ case 17:
- byte[] transBytes0 = commState.getByteArray();
++ transBytes = commState.getByteArray("transBytes");
+
- if (transBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- transBytes = transBytes0;
-
+ commState.idx++;
+
+ case 18:
- if (buf.remaining() < 1)
- return false;
++ byte type0 = commState.getByte("type");
+
- byte type0 = commState.getByte();
++ if (!commState.lastRead())
++ return false;
+
+ type = GridCacheQueryType.fromOrdinal(type0);
+
+ commState.idx++;
+
+ case 19:
- if (buf.remaining() < 1)
- return false;
++ keepPortable = commState.getBoolean("keepPortable");
+
- keepPortable = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 20:
- UUID subjId0 = commState.getUuid();
++ subjId = commState.getUuid("subjId");
+
- if (subjId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- subjId = subjId0;
-
+ commState.idx++;
+
+ case 21:
- if (buf.remaining() < 4)
- return false;
++ taskHash = commState.getInt("taskHash");
+
- taskHash = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 57;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridCacheQueryRequest.class, this, super.toString());
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
index 0000000,7a7b9b9..01569cd
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
@@@ -1,0 -1,445 +1,443 @@@
+ /*
+ * 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.cache.query;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.query.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Query request.
+ */
+ public class GridCacheQueryResponse<K, V> extends GridCacheMessage<K, V> implements GridCacheDeployable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private boolean finished;
+
+ /** */
+ private long reqId;
+
+ /** */
+ @GridDirectTransient
+ private Throwable err;
+
+ /** */
+ private byte[] errBytes;
+
+ /** */
+ private boolean fields;
+
+ /** */
+ @GridDirectCollection(byte[].class)
+ private Collection<byte[]> metaDataBytes;
+
+ /** */
+ @GridToStringInclude
+ @GridDirectTransient
+ private List<GridQueryFieldMetadata> metadata;
+
+ /** */
+ @GridDirectCollection(byte[].class)
+ private Collection<byte[]> dataBytes;
+
+ /** */
+ @GridDirectTransient
+ private Collection<Object> data;
+
+ /**
+ * Empty constructor for {@link Externalizable}
+ */
+ public GridCacheQueryResponse() {
+ //No-op.
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param reqId Request id.
+ * @param finished Last response or not.
+ * @param fields Fields query or not.
+ */
+ public GridCacheQueryResponse(int cacheId, long reqId, boolean finished, boolean fields) {
+ this.cacheId = cacheId;
+ this.reqId = reqId;
+ this.finished = finished;
+ this.fields = fields;
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ * @param reqId Request id.
+ * @param err Error.
+ */
+ public GridCacheQueryResponse(int cacheId, long reqId, Throwable err) {
+ this.cacheId = cacheId;
+ this.reqId = reqId;
+ this.err = err;
+ finished = true;
+ }
+
+ /** {@inheritDoc}
+ * @param ctx*/
+ @Override public void prepareMarshal(GridCacheSharedContext<K, V> ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ if (err != null)
+ errBytes = ctx.marshaller().marshal(err);
+
+ metaDataBytes = marshalCollection(metadata, ctx);
+ dataBytes = marshalCollection(data, ctx);
+
+ if (ctx.deploymentEnabled() && !F.isEmpty(data)) {
+ for (Object o : data) {
+ if (o instanceof Map.Entry) {
+ Map.Entry e = (Map.Entry)o;
+
+ prepareObject(e.getKey(), ctx);
+ prepareObject(e.getValue(), ctx);
+ }
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (errBytes != null)
+ err = ctx.marshaller().unmarshal(errBytes, ldr);
+
+ metadata = unmarshalCollection(metaDataBytes, ctx, ldr);
+ data = unmarshalCollection(dataBytes, ctx, ldr);
+ }
+
+ /**
+ * @return Metadata.
+ */
+ public List<GridQueryFieldMetadata> metadata() {
+ return metadata;
+ }
+
+ /**
+ * @param metadata Metadata.
+ */
+ public void metadata(@Nullable List<GridQueryFieldMetadata> metadata) {
+ this.metadata = metadata;
+ }
+
+ /**
+ * @return Query data.
+ */
+ public Collection<Object> data() {
+ return data;
+ }
+
+ /**
+ * @param data Query data.
+ */
+ @SuppressWarnings("unchecked")
+ public void data(Collection<?> data) {
+ this.data = (Collection<Object>)data;
+ }
+
+ /**
+ * @return If this is last response for this request or not.
+ */
+ public boolean isFinished() {
+ return finished;
+ }
+
+ /**
+ * @param finished If this is last response for this request or not.
+ */
+ public void finished(boolean finished) {
+ this.finished = finished;
+ }
+
+ /**
+ * @return Request id.
+ */
+ public long requestId() {
+ return reqId;
+ }
+
+ /**
+ * @return Error.
+ */
+ public Throwable error() {
+ return err;
+ }
+
+ /**
+ * @return If fields query.
+ */
+ public boolean fields() {
+ return fields;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridCacheQueryResponse _clone = new GridCacheQueryResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ super.clone0(_msg);
+
+ GridCacheQueryResponse _clone = (GridCacheQueryResponse)_msg;
+
+ _clone.finished = finished;
+ _clone.reqId = reqId;
+ _clone.err = err;
+ _clone.errBytes = errBytes;
+ _clone.fields = fields;
+ _clone.metaDataBytes = metaDataBytes;
+ _clone.metadata = metadata;
+ _clone.dataBytes = dataBytes;
+ _clone.data = data;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.writeTo(buf))
+ return false;
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 3:
+ if (dataBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(dataBytes.size()))
++ if (!commState.putInt(null, dataBytes.size()))
+ return false;
+
+ commState.it = dataBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 4:
- if (!commState.putByteArray(errBytes))
++ if (!commState.putByteArray("errBytes", errBytes))
+ return false;
+
+ commState.idx++;
+
+ case 5:
- if (!commState.putBoolean(fields))
++ if (!commState.putBoolean("fields", fields))
+ return false;
+
+ commState.idx++;
+
+ case 6:
- if (!commState.putBoolean(finished))
++ if (!commState.putBoolean("finished", finished))
+ return false;
+
+ commState.idx++;
+
+ case 7:
+ if (metaDataBytes != null) {
+ if (commState.it == null) {
- if (!commState.putInt(metaDataBytes.size()))
++ if (!commState.putInt(null, metaDataBytes.size()))
+ return false;
+
+ commState.it = metaDataBytes.iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
- if (!commState.putByteArray((byte[])commState.cur))
++ if (!commState.putByteArray(null, (byte[])commState.cur))
+ return false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 8:
- if (!commState.putLong(reqId))
++ if (!commState.putLong("reqId", reqId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!super.readFrom(buf))
+ return false;
+
+ switch (commState.idx) {
+ case 3:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (dataBytes == null)
+ dataBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ dataBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 4:
- byte[] errBytes0 = commState.getByteArray();
++ errBytes = commState.getByteArray("errBytes");
+
- if (errBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- errBytes = errBytes0;
-
+ commState.idx++;
+
+ case 5:
- if (buf.remaining() < 1)
- return false;
++ fields = commState.getBoolean("fields");
+
- fields = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 6:
- if (buf.remaining() < 1)
- return false;
++ finished = commState.getBoolean("finished");
+
- finished = commState.getBoolean();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ case 7:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (metaDataBytes == null)
+ metaDataBytes = new ArrayList<>(commState.readSize);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
- byte[] _val = commState.getByteArray();
++ byte[] _val = commState.getByteArray(null);
+
- if (_val == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ metaDataBytes.add((byte[])_val);
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+
+ commState.idx++;
+
+ case 8:
- if (buf.remaining() < 8)
- return false;
++ reqId = commState.getLong("reqId");
+
- reqId = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 58;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridCacheQueryResponse.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
index 0000000,3164c46..4f9345c
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
@@@ -1,0 -1,226 +1,224 @@@
+ /*
+ * 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.clock;
+
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.apache.ignite.internal.util.tostring.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Message containing time delta map for all nodes.
+ */
+ public class GridClockDeltaSnapshotMessage extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Snapshot version. */
+ private GridClockDeltaVersion snapVer;
+
+ /** Grid time deltas. */
+ @GridToStringInclude
+ @GridDirectMap(keyType = UUID.class, valueType = long.class)
+ private Map<UUID, Long> deltas;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridClockDeltaSnapshotMessage() {
+ // No-op.
+ }
+
+ /**
+ * @param snapVer Snapshot version.
+ * @param deltas Deltas map.
+ */
+ public GridClockDeltaSnapshotMessage(GridClockDeltaVersion snapVer, Map<UUID, Long> deltas) {
+ this.snapVer = snapVer;
+ this.deltas = deltas;
+ }
+
+ /**
+ * @return Snapshot version.
+ */
+ public GridClockDeltaVersion snapshotVersion() {
+ return snapVer;
+ }
+
+ /**
+ * @return Time deltas map.
+ */
+ public Map<UUID, Long> deltas() {
+ return deltas;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridClockDeltaSnapshotMessage _clone = new GridClockDeltaSnapshotMessage();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridClockDeltaSnapshotMessage _clone = (GridClockDeltaSnapshotMessage)_msg;
+
+ _clone.snapVer = snapVer;
+ _clone.deltas = deltas;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
+ if (deltas != null) {
+ if (commState.it == null) {
- if (!commState.putInt(deltas.size()))
++ if (!commState.putInt(null, deltas.size()))
+ return false;
+
+ commState.it = deltas.entrySet().iterator();
+ }
+
+ while (commState.it.hasNext() || commState.cur != NULL) {
+ if (commState.cur == NULL)
+ commState.cur = commState.it.next();
+
+ Map.Entry<UUID, Long> e = (Map.Entry<UUID, Long>)commState.cur;
+
+ if (!commState.keyDone) {
- if (!commState.putUuid(e.getKey()))
++ if (!commState.putUuid(null, e.getKey()))
+ return false;
+
+ commState.keyDone = true;
+ }
+
- if (!commState.putLong(e.getValue()))
++ if (!commState.putLong(null, e.getValue()))
+ return false;
+
+ commState.keyDone = false;
+
+ commState.cur = NULL;
+ }
+
+ commState.it = null;
+ } else {
- if (!commState.putInt(-1))
++ if (!commState.putInt(null, -1))
+ return false;
+ }
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putClockDeltaVersion(snapVer))
++ if (!commState.putClockDeltaVersion("snapVer", snapVer))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
+ if (commState.readSize == -1) {
- if (buf.remaining() < 4)
- return false;
++ commState.readSize = commState.getInt(null);
+
- commState.readSize = commState.getInt();
++ if (!commState.lastRead())
++ return false;
+ }
+
+ if (commState.readSize >= 0) {
+ if (deltas == null)
- deltas = U.newHashMap(commState.readSize);
++ deltas = new HashMap<>(commState.readSize, 1.0f);
+
+ for (int i = commState.readItems; i < commState.readSize; i++) {
+ if (!commState.keyDone) {
- UUID _val = commState.getUuid();
++ UUID _val = commState.getUuid(null);
+
- if (_val == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
+ commState.cur = _val;
+ commState.keyDone = true;
+ }
+
- if (buf.remaining() < 8)
- return false;
++ long _val = commState.getLong(null);
+
- long _val = commState.getLong();
++ if (!commState.lastRead())
++ return false;
+
+ deltas.put((UUID)commState.cur, _val);
+
+ commState.keyDone = false;
+
+ commState.readItems++;
+ }
+ }
+
+ commState.readSize = -1;
+ commState.readItems = 0;
+ commState.cur = null;
+
+ commState.idx++;
+
+ case 1:
- GridClockDeltaVersion snapVer0 = commState.getClockDeltaVersion();
++ snapVer = commState.getClockDeltaVersion("snapVer");
+
- if (snapVer0 == CLOCK_DELTA_VER_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- snapVer = snapVer0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 59;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridClockDeltaSnapshotMessage.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java
index 0000000,1c63a8a..11339c6
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java
@@@ -1,0 -1,256 +1,252 @@@
+ /*
+ * 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.continuous;
+
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ import static org.apache.ignite.internal.processors.continuous.GridContinuousMessageType.*;
+
+ /**
+ * Continuous processor message.
+ */
+ public class GridContinuousMessage extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Message type. */
+ private GridContinuousMessageType type;
+
+ /** Routine ID. */
+ private UUID routineId;
+
+ /** Optional message data. */
+ @GridToStringInclude
+ @GridDirectTransient
+ private Object data;
+
+ /** Serialized message data. */
+ private byte[] dataBytes;
+
+ /** Future ID for synchronous event notifications. */
+ private IgniteUuid futId;
+
+ /**
+ * Required by {@link Externalizable}.
+ */
+ public GridContinuousMessage() {
+ // No-op.
+ }
+
+ /**
+ * @param type Message type.
+ * @param routineId Consume ID.
+ * @param futId Future ID.
+ * @param data Optional message data.
+ */
+ GridContinuousMessage(GridContinuousMessageType type,
+ @Nullable UUID routineId,
+ @Nullable IgniteUuid futId,
+ @Nullable Object data) {
+ assert type != null;
+ assert routineId != null || type == MSG_EVT_ACK;
+
+ this.type = type;
+ this.routineId = routineId;
+ this.futId = futId;
+ this.data = data;
+ }
+
+ /**
+ * @return Message type.
+ */
+ public GridContinuousMessageType type() {
+ return type;
+ }
+
+ /**
+ * @return Consume ID.
+ */
+ public UUID routineId() {
+ return routineId;
+ }
+
+ /**
+ * @return Message data.
+ */
+ @SuppressWarnings("unchecked")
+ public <T> T data() {
+ return (T)data;
+ }
+
+ /**
+ * @param data Message data.
+ */
+ public void data(Object data) {
+ this.data = data;
+ }
+
+ /**
+ * @return Serialized message data.
+ */
+ public byte[] dataBytes() {
+ return dataBytes;
+ }
+
+ /**
+ * @param dataBytes Serialized message data.
+ */
+ public void dataBytes(byte[] dataBytes) {
+ this.dataBytes = dataBytes;
+ }
+
+ /**
+ * @return Future ID for synchronous event notification.
+ */
+ @Nullable public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridContinuousMessage _clone = new GridContinuousMessage();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter msg) {
+ GridContinuousMessage clone = (GridContinuousMessage)msg;
+
+ clone.type = type;
+ clone.routineId = routineId;
+ clone.futId = futId;
+ clone.data = data;
+ clone.dataBytes = dataBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("fallthrough")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putByteArray(dataBytes))
++ if (!commState.putByteArray("dataBytes", dataBytes))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putGridUuid(futId))
++ if (!commState.putGridUuid(null, futId))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putUuid(routineId))
++ if (!commState.putUuid(null, routineId))
+ return false;
+
+ commState.idx++;
+
+ case 3:
- if (!commState.putEnum(type))
++ if (!commState.putEnum(null, type))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("fallthrough")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- byte[] dataBytes0 = commState.getByteArray();
++ dataBytes = commState.getByteArray("dataBytes");
+
- if (dataBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- dataBytes = dataBytes0;
-
+ commState.idx++;
+
+ case 1:
- IgniteUuid futId0 = commState.getGridUuid();
++ IgniteUuid futId0 = commState.getGridUuid(null);
+
+ if (futId0 == GRID_UUID_NOT_READ)
+ return false;
+
+ futId = futId0;
+
+ commState.idx++;
+
+ case 2:
- UUID routineId0 = commState.getUuid();
++ UUID routineId0 = commState.getUuid(null);
+
- if (routineId0 == UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- routineId = routineId0;
-
+ commState.idx++;
+
+ case 3:
+ if (buf.remaining() < 1)
+ return false;
+
- byte type0 = commState.getByte();
++ if (!commState.lastRead())
++ return false;
+
- type = fromOrdinal(type0);
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 60;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridContinuousMessage.class, this);
+ }
+ }
[49/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java
index 0000000,d22003b..c0e6a87
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java
@@@ -1,0 -1,151 +1,149 @@@
+ /*
+ * 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;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.compute.*;
+ import org.apache.ignite.marshaller.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Job siblings response.
+ */
+ public class GridJobSiblingsResponse extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ @GridDirectTransient
+ private Collection<ComputeJobSibling> siblings;
+
+ /** */
+ private byte[] siblingsBytes;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridJobSiblingsResponse() {
+ // No-op.
+ }
+
+ /**
+ * @param siblings Siblings.
+ * @param siblingsBytes Serialized siblings.
+ */
+ public GridJobSiblingsResponse(@Nullable Collection<ComputeJobSibling> siblings, @Nullable byte[] siblingsBytes) {
+ this.siblings = siblings;
+ this.siblingsBytes = siblingsBytes;
+ }
+
+ /**
+ * @return Job siblings.
+ */
+ public Collection<ComputeJobSibling> jobSiblings() {
+ return siblings;
+ }
+
+ /**
+ * @param marsh Marshaller.
+ * @throws IgniteCheckedException In case of error.
+ */
+ public void unmarshalSiblings(IgniteMarshaller marsh) throws IgniteCheckedException {
+ assert marsh != null;
+
+ if (siblingsBytes != null)
+ siblings = marsh.unmarshal(siblingsBytes, null);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridJobSiblingsResponse _clone = new GridJobSiblingsResponse();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridJobSiblingsResponse _clone = (GridJobSiblingsResponse)_msg;
+
+ _clone.siblings = siblings;
+ _clone.siblingsBytes = siblingsBytes;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putByteArray(siblingsBytes))
++ if (!commState.putByteArray("siblingsBytes", siblingsBytes))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- byte[] siblingsBytes0 = commState.getByteArray();
++ siblingsBytes = commState.getByteArray("siblingsBytes");
+
- if (siblingsBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- siblingsBytes = siblingsBytes0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 4;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridJobSiblingsResponse.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
index 0000000,17f3ec8..0b08ec6
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
@@@ -1,0 -1,515 +1,503 @@@
+ /*
+ * 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;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.fs.*;
+ import org.apache.ignite.internal.processors.portable.*;
+ import org.apache.ignite.plugin.*;
+ import org.apache.ignite.internal.product.*;
+ import org.apache.ignite.internal.managers.security.*;
+ import org.apache.ignite.internal.managers.checkpoint.*;
+ import org.apache.ignite.internal.managers.collision.*;
+ import org.apache.ignite.internal.managers.communication.*;
+ import org.apache.ignite.internal.managers.deployment.*;
+ import org.apache.ignite.internal.managers.discovery.*;
+ import org.apache.ignite.internal.managers.eventstorage.*;
+ import org.apache.ignite.internal.managers.failover.*;
+ import org.apache.ignite.internal.managers.indexing.*;
+ import org.apache.ignite.internal.managers.loadbalancer.*;
+ import org.apache.ignite.internal.managers.securesession.*;
+ import org.apache.ignite.internal.managers.swapspace.*;
+ import org.apache.ignite.internal.processors.affinity.*;
+ import org.apache.ignite.internal.processors.clock.*;
+ import org.apache.ignite.internal.processors.closure.*;
+ import org.apache.ignite.internal.processors.continuous.*;
+ import org.apache.ignite.internal.processors.dataload.*;
+ import org.apache.ignite.internal.processors.email.*;
+ import org.apache.ignite.internal.processors.hadoop.*;
+ import org.apache.ignite.internal.processors.interop.*;
+ import org.apache.ignite.internal.processors.job.*;
+ import org.apache.ignite.internal.processors.jobmetrics.*;
+ import org.apache.ignite.internal.processors.license.*;
+ import org.apache.ignite.internal.processors.offheap.*;
+ import org.apache.ignite.internal.processors.plugin.*;
+ import org.apache.ignite.internal.processors.port.*;
+ import org.apache.ignite.internal.processors.query.*;
+ import org.apache.ignite.internal.processors.resource.*;
+ import org.apache.ignite.internal.processors.rest.*;
+ import org.apache.ignite.internal.processors.schedule.*;
+ import org.apache.ignite.internal.processors.segmentation.*;
+ import org.apache.ignite.internal.processors.service.*;
+ import org.apache.ignite.internal.processors.session.*;
+ import org.apache.ignite.internal.processors.streamer.*;
+ import org.apache.ignite.internal.processors.task.*;
+ import org.apache.ignite.internal.processors.timeout.*;
-import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+
+ import java.util.*;
+ import java.util.concurrent.*;
+
+ /**
+ *
+ */
+ @GridToStringExclude
+ public interface GridKernalContext extends Iterable<GridComponent> {
+ /**
+ * Gets list of all grid components in the order they were added.
+ *
+ * @return List of all grid components in the order they were added.
+ */
+ public List<GridComponent> components();
+
+ /**
+ * Gets local node ID.
+ *
+ * @return Local node ID.
+ */
+ public UUID localNodeId();
+
+ /**
+ * Gets grid name.
+ *
+ * @return Grid name.
+ */
+ public String gridName();
+
+ /**
+ * Gets grid product.
+ *
+ * @return Grid product.
+ */
+ public IgniteProduct product();
+
+ /**
+ * Gets list of compatible versions.
+ *
+ * @return Compatible versions.
+ */
+ public Collection<String> compatibleVersions();
+
+ /**
+ * Gets logger.
+ *
+ * @return Logger.
+ */
+ public IgniteLogger log();
+
+ /**
+ * Gets logger for given class.
+ *
+ * @param cls Class to get logger for.
+ * @return Logger.
+ */
+ public IgniteLogger log(Class<?> cls);
+
+ /**
+ * @return {@code True} if grid is in the process of stopping.
+ */
+ public boolean isStopping();
+
+ /**
+ * Gets kernal gateway.
+ *
+ * @return Kernal gateway.
+ */
+ public GridKernalGateway gateway();
+
+ /**
+ * Gets grid instance managed by kernal.
+ *
+ * @return Grid instance.
+ */
+ public IgniteEx grid();
+
+ /**
+ * Gets grid configuration.
+ *
+ * @return Grid configuration.
+ */
+ public IgniteConfiguration config();
+
+ /**
+ * Gets task processor.
+ *
+ * @return Task processor.
+ */
+ public GridTaskProcessor task();
+
+ /**
+ * Gets license processor.
+ *
+ * @return License processor.
+ */
+ public GridLicenseProcessor license();
+
+ /**
+ * Gets cache data affinity processor.
+ *
+ * @return Cache data affinity processor.
+ */
+ public GridAffinityProcessor affinity();
+
+ /**
+ * Gets job processor.
+ *
+ * @return Job processor
+ */
+ public GridJobProcessor job();
+
+ /**
+ * Gets offheap processor.
+ *
+ * @return Off-heap processor.
+ */
+ public GridOffHeapProcessor offheap();
+
+ /**
+ * Gets timeout processor.
+ *
+ * @return Timeout processor.
+ */
+ public GridTimeoutProcessor timeout();
+
+ /**
+ * Gets time processor.
+ *
+ * @return Time processor.
+ */
+ public GridClockSyncProcessor clockSync();
+
+ /**
+ * Gets resource processor.
+ *
+ * @return Resource processor.
+ */
+ public GridResourceProcessor resource();
+
+ /**
+ * Gets job metric processor.
+ *
+ * @return Metrics processor.
+ */
+ public GridJobMetricsProcessor jobMetric();
+
+ /**
+ * Gets caches processor.
+ *
+ * @return Cache processor.
+ */
+ public GridCacheProcessor cache();
+
+ /**
+ * Gets task session processor.
+ *
+ * @return Session processor.
+ */
+ public GridTaskSessionProcessor session();
+
+ /**
+ * Gets closure processor.
+ *
+ * @return Closure processor.
+ */
+ public GridClosureProcessor closure();
+
+ /**
+ * Gets service processor.
+ *
+ * @return Service processor.
+ */
+ public GridServiceProcessor service();
+
+ /**
+ * Gets port processor.
+ *
+ * @return Port processor.
+ */
+ public GridPortProcessor ports();
+
+ /**
+ * Gets email processor.
+ *
+ * @return Email processor.
+ */
+ public IgniteEmailProcessorAdapter email();
+
+ /**
+ * Gets schedule processor.
+ *
+ * @return Schedule processor.
+ */
+ public IgniteScheduleProcessorAdapter schedule();
+
+ /**
+ * Gets REST processor.
+ *
+ * @return REST processor.
+ */
+ public GridRestProcessor rest();
+
+ /**
+ * Gets segmentation processor.
+ *
+ * @return Segmentation processor.
+ */
+ public GridSegmentationProcessor segmentation();
+
+ /**
+ * Gets data loader processor.
+ *
+ * @return Data loader processor.
+ */
+ public <K, V> GridDataLoaderProcessor<K, V> dataLoad();
+
+ /**
+ * Gets file system processor.
+ *
+ * @return File system processor.
+ */
+ public IgniteFsProcessorAdapter ggfs();
+
+ /**
+ * Gets GGFS utils processor.
+ *
+ * @return GGFS utils processor.
+ */
+ public IgniteFsHelper ggfsHelper();
+
+ /**
+ * Gets stream processor.
+ *
+ * @return Stream processor.
+ */
+ public GridStreamProcessor stream();
+
+ /**
+ * Gets event continuous processor.
+ *
+ * @return Event continuous processor.
+ */
+ public GridContinuousProcessor continuous();
+
+ /**
+ * Gets Hadoop processor.
+ *
+ * @return Hadoop processor.
+ */
+ public IgniteHadoopProcessorAdapter hadoop();
+
+ /**
+ * Gets utility cache pool.
+ *
+ * @return DR pool.
+ */
+ public ExecutorService utilityCachePool();
+
+ /**
+ * Gets portable processor.
+ *
+ * @return Portable processor.
+ */
+ public GridPortableProcessor portable();
+
+ /**
+ * Gets interop processor.
+ *
+ * @return Interop processor.
+ */
+ public GridInteropProcessor interop();
+
+ /**
+ * Gets query processor.
+ *
+ * @return Query processor.
+ */
+ public GridQueryProcessor query();
+
+ /**
+ * @return Plugin processor.
+ */
+ public IgnitePluginProcessor plugins();
+
+ /**
+ * Gets deployment manager.
+ *
+ * @return Deployment manager.
+ */
+ public GridDeploymentManager deploy();
+
+ /**
+ * Gets communication manager.
+ *
+ * @return Communication manager.
+ */
+ public GridIoManager io();
+
+ /**
+ * Gets discovery manager.
+ *
+ * @return Discovery manager.
+ */
+ public GridDiscoveryManager discovery();
+
+ /**
+ * Gets checkpoint manager.
+ *
+ * @return Checkpoint manager.
+ */
+ public GridCheckpointManager checkpoint();
+
+ /**
+ * Gets event storage manager.
+ *
+ * @return Event storage manager.
+ */
+ public GridEventStorageManager event();
+
+ /**
+ * Gets failover manager.
+ *
+ * @return Failover manager.
+ */
+ public GridFailoverManager failover();
+
+ /**
+ * Gets collision manager.
+ *
+ * @return Collision manager.
+ */
+ public GridCollisionManager collision();
+
+ /**
+ * Gets authentication manager.
+ *
+ * @return Authentication manager.
+ */
+ public GridSecurityManager security();
+
+ /**
+ * Gets secure session manager.
+ *
+ * @return Secure session manager.
+ */
+ public GridSecureSessionManager secureSession();
+
+ /**
+ * Gets load balancing manager.
+ *
+ * @return Load balancing manager.
+ */
+ public GridLoadBalancerManager loadBalancing();
+
+ /**
+ * Gets swap space manager.
+ *
+ * @return Swap space manager.
+ */
+ public GridSwapSpaceManager swap();
+
+ /**
+ * Gets indexing manager.
+ *
+ * @return Indexing manager.
+ */
+ public GridIndexingManager indexing();
+
+ /**
+ * Gets grid time source.
+ *
+ * @return Time source.
+ */
+ public GridClockSource timeSource();
+
+ /**
+ * Sets segmented flag to {@code true} when node is stopped due to segmentation issues.
+ */
+ public void markSegmented();
+
+ /**
+ * Gets segmented flag.
+ *
+ * @return {@code True} if network is currently segmented, {@code false} otherwise.
+ */
+ public boolean segmented();
+
+ /**
+ * Print grid kernal memory stats (sizes of internal structures, etc.).
+ *
+ * NOTE: This method is for testing and profiling purposes only.
+ */
+ public void printMemoryStats();
+
+ /**
+ * Checks whether this node is daemon.
+ *
+ * @return {@code True} if this node is daemon, {@code false} otherwise.
+ */
+ public boolean isDaemon();
+
+ /**
+ * @return Performance suggestions object.
+ */
+ public GridPerformanceSuggestions performance();
+
+ /**
+ * @return Enterprise release flag.
+ */
+ public boolean isEnterprise();
+
+ /**
+ * Gets user version for given class loader by checking
+ * {@code META-INF/gridgain.xml} file for {@code userVersion} attribute. If
+ * {@code gridgain.xml} file is not found, or user version is not specified there,
+ * then default version (empty string) is returned.
+ *
+ * @param ldr Class loader.
+ * @return User version for given class loader or empty string if no version
+ * was explicitly specified.
+ */
+ public String userVersion(ClassLoader ldr);
+
+ /**
+ * @param name Plugin name.
+ * @return Plugin provider instance.
+ * @throws PluginNotFoundException If plugin provider for the given name was not found.
+ */
+ public PluginProvider pluginProvider(String name) throws PluginNotFoundException;
+
+ /**
+ * Creates optional component.
+ *
+ * @param cls Component class.
+ * @return Created component.
+ */
+ public <T> T createComponent(Class<T> cls);
-
- /**
- * @return Message factory.
- */
- public GridTcpMessageFactory messageFactory();
-
- /**
- * @param producer Message producer.
- * @return Message type code.
- */
- public byte registerMessageProducer(GridTcpCommunicationMessageProducer producer);
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
index 0000000,88dbef6..c39a4f6
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
@@@ -1,0 -1,905 +1,836 @@@
+ /*
+ * 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;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.internal.processors.cache.*;
+ import org.apache.ignite.internal.processors.fs.*;
+ import org.apache.ignite.internal.processors.portable.*;
+ import org.apache.ignite.internal.processors.streamer.*;
+ import org.apache.ignite.plugin.*;
+ import org.apache.ignite.internal.product.*;
+ import org.apache.ignite.internal.managers.checkpoint.*;
+ import org.apache.ignite.internal.managers.collision.*;
+ import org.apache.ignite.internal.managers.communication.*;
+ import org.apache.ignite.internal.managers.deployment.*;
+ import org.apache.ignite.internal.managers.discovery.*;
+ import org.apache.ignite.internal.managers.eventstorage.*;
+ import org.apache.ignite.internal.managers.failover.*;
+ import org.apache.ignite.internal.managers.indexing.*;
+ import org.apache.ignite.internal.managers.loadbalancer.*;
+ import org.apache.ignite.internal.managers.securesession.*;
+ import org.apache.ignite.internal.managers.security.*;
+ import org.apache.ignite.internal.managers.swapspace.*;
+ import org.apache.ignite.internal.processors.affinity.*;
+ import org.apache.ignite.internal.processors.cache.dr.*;
+ import org.apache.ignite.internal.processors.cache.dr.os.*;
+ import org.apache.ignite.internal.processors.clock.*;
+ import org.apache.ignite.internal.processors.closure.*;
+ import org.apache.ignite.internal.processors.continuous.*;
+ import org.apache.ignite.internal.processors.dataload.*;
+ import org.apache.ignite.internal.processors.email.*;
+ import org.apache.ignite.internal.processors.hadoop.*;
+ import org.apache.ignite.internal.processors.interop.*;
+ import org.apache.ignite.internal.processors.job.*;
+ import org.apache.ignite.internal.processors.jobmetrics.*;
+ import org.apache.ignite.internal.processors.license.*;
+ import org.apache.ignite.internal.processors.offheap.*;
+ import org.apache.ignite.internal.processors.plugin.*;
+ import org.apache.ignite.internal.processors.port.*;
+ import org.apache.ignite.internal.processors.query.*;
+ import org.apache.ignite.internal.processors.resource.*;
+ import org.apache.ignite.internal.processors.rest.*;
+ import org.apache.ignite.internal.processors.schedule.*;
+ import org.apache.ignite.internal.processors.segmentation.*;
+ import org.apache.ignite.internal.processors.service.*;
+ import org.apache.ignite.internal.processors.session.*;
+ import org.apache.ignite.internal.processors.spring.*;
+ import org.apache.ignite.internal.processors.task.*;
+ import org.apache.ignite.internal.processors.timeout.*;
-import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.tostring.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.util.*;
+ import java.util.concurrent.*;
+
+ import static org.apache.ignite.IgniteSystemProperties.*;
+ import static org.apache.ignite.internal.IgniteComponentType.*;
+
+ /**
+ * Implementation of kernal context.
+ */
+ @GridToStringExclude
+ public class GridKernalContextImpl implements GridKernalContext, Externalizable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private static final ThreadLocal<String> stash = new ThreadLocal<>();
+
+ /*
+ * Managers.
+ * ========
+ */
+
+ /** */
+ @GridToStringExclude
+ private GridDeploymentManager depMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridIoManager ioMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridDiscoveryManager discoMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridCheckpointManager cpMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridEventStorageManager evtMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridFailoverManager failoverMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridCollisionManager colMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridLoadBalancerManager loadMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridSecurityManager authMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridSecureSessionManager sesMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridSwapSpaceManager swapspaceMgr;
+
+ /** */
+ @GridToStringExclude
+ private GridIndexingManager indexingMgr;
+
+ /*
+ * Processors.
+ * ==========
+ */
+
+ /** */
+ @GridToStringInclude
+ private GridQueryProcessor qryProc;
+
+ /** */
+ @GridToStringInclude
+ private GridTaskProcessor taskProc;
+
+ /** */
+ @GridToStringInclude
+ private GridJobProcessor jobProc;
+
+ /** */
+ @GridToStringInclude
+ private GridTimeoutProcessor timeProc;
+
+ /** */
+ @GridToStringInclude
+ private GridClockSyncProcessor clockSyncProc;
+
+ /** */
+ @GridToStringInclude
+ private GridResourceProcessor rsrcProc;
+
+ /** */
+ @GridToStringInclude
+ private GridJobMetricsProcessor metricsProc;
+
+ /** */
+ @GridToStringInclude
+ private GridClosureProcessor closProc;
+
+ /** */
+ @GridToStringInclude
+ private GridServiceProcessor svcProc;
+
+ /** */
+ @GridToStringInclude
+ private GridCacheProcessor cacheProc;
+
+ /** */
+ @GridToStringInclude
+ private GridTaskSessionProcessor sesProc;
+
+ /** */
+ @GridToStringInclude
+ private GridPortProcessor portProc;
+
+ /** */
+ @GridToStringInclude
+ private GridOffHeapProcessor offheapProc;
+
+ /** */
+ @GridToStringInclude
+ private IgniteEmailProcessorAdapter emailProc;
+
+ /** */
+ @GridToStringInclude
+ private IgniteScheduleProcessorAdapter scheduleProc;
+
+ /** */
+ @GridToStringInclude
+ private GridRestProcessor restProc;
+
+ /** */
+ @GridToStringInclude
+ private GridDataLoaderProcessor dataLdrProc;
+
+ /** */
+ @GridToStringInclude
+ private IgniteFsProcessorAdapter ggfsProc;
+
+ /** */
+ @GridToStringInclude
+ private IgniteFsHelper ggfsHelper;
+
+ /** */
+ @GridToStringInclude
+ private GridSegmentationProcessor segProc;
+
+ /** */
+ @GridToStringInclude
+ private GridAffinityProcessor affProc;
+
+ /** */
+ @GridToStringInclude
+ private GridLicenseProcessor licProc;
+
+ /** */
+ @GridToStringInclude
+ private GridStreamProcessor streamProc;
+
+ /** */
+ @GridToStringExclude
+ private GridContinuousProcessor contProc;
+
+ /** */
+ @GridToStringExclude
+ private IgniteHadoopProcessorAdapter hadoopProc;
+
+ /** */
+ @GridToStringExclude
+ private IgnitePluginProcessor pluginProc;
+
+ /** */
+ @GridToStringExclude
+ private GridPortableProcessor portableProc;
+
+ /** */
+ @GridToStringExclude
+ private GridInteropProcessor interopProc;
+
+ /** */
+ @GridToStringExclude
+ private IgniteSpringProcessor spring;
+
+ /** */
+ @GridToStringExclude
+ private List<GridComponent> comps = new LinkedList<>();
+
+ /** */
+ private IgniteEx grid;
+
+ /** */
+ private ExecutorService utilityCachePool;
+
+ /** */
+ private IgniteProduct product;
+
+ /** */
+ private IgniteConfiguration cfg;
+
+ /** */
+ private GridKernalGateway gw;
+
+ /** Network segmented flag. */
+ private volatile boolean segFlag;
+
+ /** Time source. */
+ private GridClockSource clockSrc = new GridJvmClockSource();
+
+ /** Performance suggestions. */
+ private final GridPerformanceSuggestions perf = new GridPerformanceSuggestions();
+
+ /** Enterprise release flag. */
+ private boolean ent;
+
- /** */
- private GridTcpMessageFactory msgFactory;
-
- /** */
- private int pluginMsg = GridTcpCommunicationMessageFactory.MAX_COMMON_TYPE;
-
- /** */
- private Map<Byte, GridTcpCommunicationMessageProducer> pluginMsgs;
-
+ /**
+ * No-arg constructor is required by externalization.
+ */
+ public GridKernalContextImpl() {
+ // No-op.
+ }
+
+ /**
+ * Creates new kernal context.
+ *
+ * @param log Logger.
+ * @param grid Grid instance managed by kernal.
+ * @param cfg Grid configuration.
+ * @param gw Kernal gateway.
+ * @param utilityCachePool Utility cache pool.
+ * @param ent Release enterprise flag.
+ */
+ @SuppressWarnings("TypeMayBeWeakened")
+ protected GridKernalContextImpl(GridLoggerProxy log,
+ IgniteEx grid,
+ IgniteConfiguration cfg,
+ GridKernalGateway gw,
+ ExecutorService utilityCachePool,
+ boolean ent) {
+ assert grid != null;
+ assert cfg != null;
+ assert gw != null;
+
+ this.grid = grid;
+ this.cfg = cfg;
+ this.gw = gw;
+ this.ent = ent;
+ this.utilityCachePool = utilityCachePool;
+
+ try {
+ spring = SPRING.create(false);
+ }
+ catch (IgniteCheckedException ignored) {
+ if (log != null && log.isDebugEnabled())
+ log.debug("Failed to load spring component, will not be able to extract userVersion from " +
+ "META-INF/gridgain.xml.");
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public Iterator<GridComponent> iterator() {
+ return comps.iterator();
+ }
+
+ /** {@inheritDoc} */
+ @Override public List<GridComponent> components() {
+ return Collections.unmodifiableList(comps);
+ }
+
+ /**
+ * @param comp Manager to add.
+ */
+ public void add(GridComponent comp) {
+ assert comp != null;
+
+ /*
+ * Managers.
+ * ========
+ */
+
+ if (comp instanceof GridDeploymentManager)
+ depMgr = (GridDeploymentManager)comp;
+ else if (comp instanceof GridIoManager)
+ ioMgr = (GridIoManager)comp;
+ else if (comp instanceof GridDiscoveryManager)
+ discoMgr = (GridDiscoveryManager)comp;
+ else if (comp instanceof GridCheckpointManager)
+ cpMgr = (GridCheckpointManager)comp;
+ else if (comp instanceof GridEventStorageManager)
+ evtMgr = (GridEventStorageManager)comp;
+ else if (comp instanceof GridFailoverManager)
+ failoverMgr = (GridFailoverManager)comp;
+ else if (comp instanceof GridCollisionManager)
+ colMgr = (GridCollisionManager)comp;
+ else if (comp instanceof GridSecurityManager)
+ authMgr = (GridSecurityManager)comp;
+ else if (comp instanceof GridSecureSessionManager)
+ sesMgr = (GridSecureSessionManager)comp;
+ else if (comp instanceof GridLoadBalancerManager)
+ loadMgr = (GridLoadBalancerManager)comp;
+ else if (comp instanceof GridSwapSpaceManager)
+ swapspaceMgr = (GridSwapSpaceManager)comp;
+ else if (comp instanceof GridIndexingManager)
+ indexingMgr = (GridIndexingManager)comp;
+
+ /*
+ * Processors.
+ * ==========
+ */
+
+ else if (comp instanceof GridTaskProcessor)
+ taskProc = (GridTaskProcessor)comp;
+ else if (comp instanceof GridJobProcessor)
+ jobProc = (GridJobProcessor)comp;
+ else if (comp instanceof GridTimeoutProcessor)
+ timeProc = (GridTimeoutProcessor)comp;
+ else if (comp instanceof GridClockSyncProcessor)
+ clockSyncProc = (GridClockSyncProcessor)comp;
+ else if (comp instanceof GridResourceProcessor)
+ rsrcProc = (GridResourceProcessor)comp;
+ else if (comp instanceof GridJobMetricsProcessor)
+ metricsProc = (GridJobMetricsProcessor)comp;
+ else if (comp instanceof GridCacheProcessor)
+ cacheProc = (GridCacheProcessor)comp;
+ else if (comp instanceof GridTaskSessionProcessor)
+ sesProc = (GridTaskSessionProcessor)comp;
+ else if (comp instanceof GridPortProcessor)
+ portProc = (GridPortProcessor)comp;
+ else if (comp instanceof IgniteEmailProcessorAdapter)
+ emailProc = (IgniteEmailProcessorAdapter)comp;
+ else if (comp instanceof GridClosureProcessor)
+ closProc = (GridClosureProcessor)comp;
+ else if (comp instanceof GridServiceProcessor)
+ svcProc = (GridServiceProcessor)comp;
+ else if (comp instanceof IgniteScheduleProcessorAdapter)
+ scheduleProc = (IgniteScheduleProcessorAdapter)comp;
+ else if (comp instanceof GridSegmentationProcessor)
+ segProc = (GridSegmentationProcessor)comp;
+ else if (comp instanceof GridAffinityProcessor)
+ affProc = (GridAffinityProcessor)comp;
+ else if (comp instanceof GridRestProcessor)
+ restProc = (GridRestProcessor)comp;
+ else if (comp instanceof GridDataLoaderProcessor)
+ dataLdrProc = (GridDataLoaderProcessor)comp;
+ else if (comp instanceof IgniteFsProcessorAdapter)
+ ggfsProc = (IgniteFsProcessorAdapter)comp;
+ else if (comp instanceof GridOffHeapProcessor)
+ offheapProc = (GridOffHeapProcessor)comp;
+ else if (comp instanceof GridLicenseProcessor)
+ licProc = (GridLicenseProcessor)comp;
+ else if (comp instanceof GridStreamProcessor)
+ streamProc = (GridStreamProcessor)comp;
+ else if (comp instanceof GridContinuousProcessor)
+ contProc = (GridContinuousProcessor)comp;
+ else if (comp instanceof IgniteHadoopProcessorAdapter)
+ hadoopProc = (IgniteHadoopProcessorAdapter)comp;
+ else if (comp instanceof GridPortableProcessor)
+ portableProc = (GridPortableProcessor)comp;
+ else if (comp instanceof GridInteropProcessor)
+ interopProc = (GridInteropProcessor)comp;
+ else if (comp instanceof IgnitePluginProcessor)
+ pluginProc = (IgnitePluginProcessor)comp;
+ else if (comp instanceof GridQueryProcessor)
+ qryProc = (GridQueryProcessor)comp;
+ else
+ assert (comp instanceof GridPluginComponent) : "Unknown manager class: " + comp.getClass();
+
+ comps.add(comp);
+ }
+
+ /**
+ * @param helper Helper to add.
+ */
+ public void addHelper(Object helper) {
+ assert helper != null;
+
+ if (helper instanceof IgniteFsHelper)
+ ggfsHelper = (IgniteFsHelper)helper;
+ else
+ assert false : "Unknown helper class: " + helper.getClass();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<String> compatibleVersions() {
+ return grid.compatibleVersions();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isStopping() {
+ GridKernalState state = gw.getState();
+
+ return state == GridKernalState.STOPPING || state == GridKernalState.STOPPED;
+ }
+
+ /** {@inheritDoc} */
+ @Override public UUID localNodeId() {
+ return cfg.getNodeId();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String gridName() {
+ return cfg.getGridName();
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridKernalGateway gateway() {
+ return gw;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteEx grid() {
+ return grid;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteConfiguration config() {
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridTaskProcessor task() {
+ return taskProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridJobProcessor job() {
+ return jobProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridTimeoutProcessor timeout() {
+ return timeProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridClockSyncProcessor clockSync() {
+ return clockSyncProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridResourceProcessor resource() {
+ return rsrcProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridJobMetricsProcessor jobMetric() {
+ return metricsProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridCacheProcessor cache() {
+ return cacheProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridTaskSessionProcessor session() {
+ return sesProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridClosureProcessor closure() {
+ return closProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridServiceProcessor service() {
+ return svcProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridPortProcessor ports() {
+ return portProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteEmailProcessorAdapter email() {
+ return emailProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridOffHeapProcessor offheap() {
+ return offheapProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteScheduleProcessorAdapter schedule() {
+ return scheduleProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridStreamProcessor stream() {
+ return streamProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridDeploymentManager deploy() {
+ return depMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridIoManager io() {
+ return ioMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridDiscoveryManager discovery() {
+ return discoMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridCheckpointManager checkpoint() {
+ return cpMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridEventStorageManager event() {
+ return evtMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridFailoverManager failover() {
+ return failoverMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridCollisionManager collision() {
+ return colMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridSecurityManager security() {
+ return authMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridSecureSessionManager secureSession() {
+ return sesMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridLoadBalancerManager loadBalancing() {
+ return loadMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridSwapSpaceManager swap() {
+ return swapspaceMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridIndexingManager indexing() {
+ return indexingMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridLicenseProcessor license() {
+ return licProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridAffinityProcessor affinity() {
+ return affProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridRestProcessor rest() {
+ return restProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridSegmentationProcessor segmentation() {
+ return segProc;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public <K, V> GridDataLoaderProcessor<K, V> dataLoad() {
+ return (GridDataLoaderProcessor<K, V>)dataLdrProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteFsProcessorAdapter ggfs() {
+ return ggfsProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteFsHelper ggfsHelper() {
+ return ggfsHelper;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridContinuousProcessor continuous() {
+ return contProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteHadoopProcessorAdapter hadoop() {
+ return hadoopProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public ExecutorService utilityCachePool() {
+ return utilityCachePool;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridPortableProcessor portable() {
+ return portableProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridInteropProcessor interop() {
+ return interopProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridQueryProcessor query() {
+ return qryProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteLogger log() {
+ return config().getGridLogger();
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteLogger log(Class<?> cls) {
+ return config().getGridLogger().getLogger(cls);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void markSegmented() {
+ segFlag = true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean segmented() {
+ return segFlag;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridClockSource timeSource() {
+ return clockSrc;
+ }
+
+ /**
+ * @param product Product.
+ */
+ public void product(IgniteProduct product) {
+ this.product = product;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteProduct product() {
+ return product;
+ }
+
+ /**
+ * Sets time source. For test purposes only.
+ *
+ * @param clockSrc Time source.
+ */
+ public void timeSource(GridClockSource clockSrc) {
+ this.clockSrc = clockSrc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridPerformanceSuggestions performance() {
+ return perf;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isEnterprise() {
+ return ent;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void printMemoryStats() {
+ X.println(">>> ");
+ X.println(">>> Grid memory stats [grid=" + gridName() + ']');
+
+ for (GridComponent comp : comps)
+ comp.printMemoryStats();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isDaemon() {
+ return config().isDaemon() || "true".equalsIgnoreCase(System.getProperty(GG_DAEMON));
+ }
+
+ /** {@inheritDoc} */
+ @Override public String userVersion(ClassLoader ldr) {
+ return spring != null ? spring.userVersion(ldr, log()) : U.DFLT_USER_VERSION;
+ }
+
+ /** {@inheritDoc} */
+ @Override public PluginProvider pluginProvider(String name) throws PluginNotFoundException {
+ PluginProvider plugin = pluginProc.pluginProvider(name);
+
+ if (plugin == null)
+ throw new PluginNotFoundException(name);
+
+ return plugin;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public <T> T createComponent(Class<T> cls) {
+ T res = pluginProc.createComponent(cls);
+
+ if (res != null)
+ return res;
+
+ if (cls.equals(GridCacheDrManager.class))
+ return (T)new GridOsCacheDrManager();
+
+ throw new IgniteException("Unsupported component type: " + cls);
+ }
+
- /** {@inheritDoc} */
- @Override public GridTcpMessageFactory messageFactory() {
- assert msgFactory != null;
-
- return msgFactory;
- }
-
- /** {@inheritDoc} */
- @Override public byte registerMessageProducer(GridTcpCommunicationMessageProducer producer) {
- int nextMsg = ++pluginMsg;
-
- if (nextMsg > Byte.MAX_VALUE)
- throw new IgniteException();
-
- if (pluginMsgs == null)
- pluginMsgs = new HashMap<>();
-
- pluginMsgs.put((byte)nextMsg, producer);
-
- return (byte)nextMsg;
- }
-
- /**
- * Creates message factory.
- */
- void createMessageFactory() {
- final GridTcpCommunicationMessageProducer[] common = GridTcpCommunicationMessageFactory.commonProducers();
-
- final GridTcpCommunicationMessageProducer[] producers;
-
- if (pluginMsgs != null) {
- producers = Arrays.copyOf(common, pluginMsg + 1);
-
- for (Map.Entry<Byte, GridTcpCommunicationMessageProducer> e : pluginMsgs.entrySet()) {
- assert producers[e.getKey()] == null : e.getKey();
-
- producers[e.getKey()] = e.getValue();
- }
-
- pluginMsgs = null;
- }
- else
- producers = common;
-
- msgFactory = new GridTcpMessageFactory() {
- @Override public GridTcpCommunicationMessageAdapter create(byte type) {
- if (type < 0 || type >= producers.length)
- return GridTcpCommunicationMessageFactory.create(type);
-
- GridTcpCommunicationMessageProducer producer = producers[type];
-
- if (producer != null)
- return producer.create(type);
- else
- throw new IllegalStateException("Common message type producer is not registered: " + type);
- }
- };
- }
-
+ /**
+ * @return Plugin manager.
+ */
+ @Override public IgnitePluginProcessor plugins() {
+ return pluginProc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ U.writeString(out, grid.name());
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ stash.set(U.readString(in));
+ }
+
+ /**
+ * Reconstructs object on unmarshalling.
+ *
+ * @return Reconstructed object.
+ * @throws ObjectStreamException Thrown in case of unmarshalling error.
+ */
+ protected Object readResolve() throws ObjectStreamException {
+ try {
+ return IgnitionEx.gridx(stash.get()).context();
+ }
+ catch (IllegalStateException e) {
+ throw U.withCause(new InvalidObjectException(e.getMessage()), e);
+ }
+ finally {
+ stash.remove();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridKernalContextImpl.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/GridPluginContext.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/GridPluginContext.java
index 0000000,9346ae7..9e9ddbf
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridPluginContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridPluginContext.java
@@@ -1,0 -1,102 +1,102 @@@
+ /*
+ * 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;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.cluster.*;
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.internal.*;
+ import org.apache.ignite.plugin.*;
+ import org.apache.ignite.spi.*;
+ import org.apache.ignite.internal.util.direct.*;
+
+ import java.util.*;
+
+ /**
+ *
+ */
+ public class GridPluginContext implements PluginContext {
+ /** */
+ private final PluginConfiguration cfg;
+
+ /** */
+ private final GridKernalContext ctx;
+
+ /** */
+ private IgniteConfiguration igniteCfg;
+
+ /**
+ * @param ctx Kernal context.
+ * @param cfg Plugin configuration.
+ */
+ public GridPluginContext(GridKernalContext ctx, PluginConfiguration cfg, IgniteConfiguration igniteCfg) {
+ this.cfg = cfg;
+ this.ctx = ctx;
+ this.igniteCfg = igniteCfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public <C extends PluginConfiguration> C configuration() {
+ return (C)cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteConfiguration igniteConfiguration() {
+ return igniteCfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Ignite grid() {
+ return ctx.grid();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<ClusterNode> nodes() {
+ return ctx.discovery().allNodes();
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterNode localNode() {
+ return ctx.discovery().localNode();
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteLogger log(Class<?> cls) {
+ return ctx.log(cls);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void registerPort(int port, IgnitePortProtocol proto, Class<?> cls) {
+ ctx.ports().registerPort(port, proto, cls);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void deregisterPort(int port, IgnitePortProtocol proto, Class<?> cls) {
+ ctx.ports().deregisterPort(port, proto, cls);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void deregisterPorts(Class<?> cls) {
+ ctx.ports().deregisterPorts(cls);
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte registerMessageProducer(GridTcpCommunicationMessageProducer producer) {
- return ctx.registerMessageProducer(producer);
++ return ctx.io().registerMessageProducer(producer);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java
index 0000000,6bb0b4f..deb5567
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java
@@@ -1,0 -1,134 +1,132 @@@
+ /*
+ * 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;
+
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+
+ /**
+ * Request for cancelling tasks.
+ */
+ public class GridTaskCancelRequest extends GridTcpCommunicationMessageAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private IgniteUuid sesId;
+
+ /**
+ * No-op constructor to support {@link Externalizable} interface.
+ * This constructor is not meant to be used for other purposes.
+ */
+ public GridTaskCancelRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param sesId Task session ID.
+ */
+ public GridTaskCancelRequest(IgniteUuid sesId) {
+ assert sesId != null;
+
+ this.sesId = sesId;
+ }
+
+ /**
+ * Gets execution ID of task to be cancelled.
+ *
+ * @return Execution ID of task to be cancelled.
+ */
+ public IgniteUuid sessionId() {
+ return sesId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridTaskCancelRequest _clone = new GridTaskCancelRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridTaskCancelRequest _clone = (GridTaskCancelRequest)_msg;
+
+ _clone.sesId = sesId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putGridUuid(sesId))
++ if (!commState.putGridUuid("sesId", sesId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- IgniteUuid sesId0 = commState.getGridUuid();
++ sesId = commState.getGridUuid("sesId");
+
- if (sesId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- sesId = sesId0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 5;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridTaskCancelRequest.class, this);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
index 0000000,4061808..1343f45
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
@@@ -1,0 -1,206 +1,200 @@@
+ /*
+ * 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;
+
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ * Task session request.
+ */
+ public class GridTaskSessionRequest extends GridTcpCommunicationMessageAdapter implements GridTaskMessage {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Task session ID. */
+ private IgniteUuid sesId;
+
+ /** ID of job within a task. */
+ private IgniteUuid jobId;
+
+ /** Changed attributes bytes. */
+ private byte[] attrsBytes;
+
+ /** Changed attributes. */
+ @GridDirectTransient
+ private Map<?, ?> attrs;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridTaskSessionRequest() {
+ // No-op.
+ }
+
+ /**
+ * @param sesId Session ID.
+ * @param jobId Job ID.
+ * @param attrsBytes Serialized attributes.
+ * @param attrs Attributes.
+ */
+ public GridTaskSessionRequest(IgniteUuid sesId, IgniteUuid jobId, byte[] attrsBytes, Map<?, ?> attrs) {
+ assert sesId != null;
+ assert attrsBytes != null;
+ assert attrs != null;
+
+ this.sesId = sesId;
+ this.jobId = jobId;
+ this.attrsBytes = attrsBytes;
+ this.attrs = attrs;
+ }
+
+ /**
+ * @return Changed attributes (serialized).
+ */
+ public byte[] getAttributesBytes() {
+ return attrsBytes;
+ }
+
+ /**
+ * @return Changed attributes.
+ */
+ public Map<?, ?> getAttributes() {
+ return attrs;
+ }
+
+ /**
+ * @return Session ID.
+ */
+ @Override public IgniteUuid getSessionId() {
+ return sesId;
+ }
+
+ /**
+ * @return Job ID.
+ */
+ public IgniteUuid getJobId() {
+ return jobId;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"})
+ @Override public GridTcpCommunicationMessageAdapter clone() {
+ GridTaskSessionRequest _clone = new GridTaskSessionRequest();
+
+ clone0(_clone);
+
+ return _clone;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) {
+ GridTaskSessionRequest _clone = (GridTaskSessionRequest)_msg;
+
+ _clone.sesId = sesId;
+ _clone.jobId = jobId;
+ _clone.attrsBytes = attrsBytes;
+ _clone.attrs = attrs;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean writeTo(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ if (!commState.typeWritten) {
- if (!commState.putByte(directType()))
++ if (!commState.putByte(null, directType()))
+ return false;
+
+ commState.typeWritten = true;
+ }
+
+ switch (commState.idx) {
+ case 0:
- if (!commState.putByteArray(attrsBytes))
++ if (!commState.putByteArray("attrsBytes", attrsBytes))
+ return false;
+
+ commState.idx++;
+
+ case 1:
- if (!commState.putGridUuid(jobId))
++ if (!commState.putGridUuid("jobId", jobId))
+ return false;
+
+ commState.idx++;
+
+ case 2:
- if (!commState.putGridUuid(sesId))
++ if (!commState.putGridUuid("sesId", sesId))
+ return false;
+
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("all")
+ @Override public boolean readFrom(ByteBuffer buf) {
+ commState.setBuffer(buf);
+
+ switch (commState.idx) {
+ case 0:
- byte[] attrsBytes0 = commState.getByteArray();
++ attrsBytes = commState.getByteArray("attrsBytes");
+
- if (attrsBytes0 == BYTE_ARR_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- attrsBytes = attrsBytes0;
-
+ commState.idx++;
+
+ case 1:
- IgniteUuid jobId0 = commState.getGridUuid();
++ jobId = commState.getGridUuid("jobId");
+
- if (jobId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- jobId = jobId0;
-
+ commState.idx++;
+
+ case 2:
- IgniteUuid sesId0 = commState.getGridUuid();
++ sesId = commState.getGridUuid("sesId");
+
- if (sesId0 == GRID_UUID_NOT_READ)
++ if (!commState.lastRead())
+ return false;
+
- sesId = sesId0;
-
+ commState.idx++;
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 6;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridTaskSessionRequest.class, this);
+ }
+ }
[14/52] [abbrv] incubator-ignite git commit: GridUtils -> IgniteUtils
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fc768b83/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
new file mode 100644
index 0000000..fedf24b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -0,0 +1,9141 @@
+/*
+ * 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.util;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.compute.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.events.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.mxbean.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.version.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.lifecycle.*;
+import org.apache.ignite.portables.*;
+import org.apache.ignite.spi.*;
+import org.apache.ignite.internal.managers.deployment.*;
+import org.apache.ignite.internal.processors.streamer.*;
+import org.apache.ignite.spi.discovery.*;
+import org.apache.ignite.internal.util.io.*;
+import org.apache.ignite.internal.util.lang.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.internal.util.worker.*;
+import org.jdk8.backport.*;
+import org.jetbrains.annotations.*;
+import sun.misc.*;
+
+import javax.management.*;
+import javax.naming.*;
+import javax.net.ssl.*;
+import java.io.*;
+import java.lang.annotation.Annotation;
+import java.lang.management.*;
+import java.lang.reflect.Array;
+import java.lang.reflect.*;
+import java.math.*;
+import java.net.*;
+import java.nio.*;
+import java.nio.channels.*;
+import java.nio.channels.spi.*;
+import java.nio.charset.*;
+import java.security.*;
+import java.security.cert.*;
+import java.sql.*;
+import java.sql.Timestamp;
+import java.text.*;
+import java.util.*;
+import java.util.Date;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+import java.util.concurrent.locks.*;
+import java.util.jar.*;
+import java.util.logging.*;
+import java.util.regex.*;
+import java.util.zip.*;
+
+import static org.apache.ignite.IgniteSystemProperties.*;
+import static org.apache.ignite.events.IgniteEventType.*;
+import static org.apache.ignite.internal.GridNodeAttributes.*;
+
+/**
+ * Collection of utility methods used throughout the system.
+ */
+@SuppressWarnings({"UnusedReturnValue", "UnnecessaryFullyQualifiedName"})
+public abstract class IgniteUtils {
+ /** Unsafe. */
+ private static final Unsafe UNSAFE = GridUnsafe.unsafe();
+
+ /** {@code True} if {@code unsafe} should be used for array copy. */
+ private static final boolean UNSAFE_BYTE_ARR_CP = unsafeByteArrayCopyAvailable();
+
+ /** Offset. */
+ private static final int BYTE_ARRAY_DATA_OFFSET = UNSAFE.arrayBaseOffset(byte[].class);
+
+ /** Sun-specific JDK constructor factory for objects that don't have empty constructor. */
+ private static final Method CTOR_FACTORY;
+
+ /** Sun JDK reflection factory. */
+ private static final Object SUN_REFLECT_FACTORY;
+
+ /** Public {@code java.lang.Object} no-argument constructor. */
+ private static final Constructor OBJECT_CTOR;
+
+ /** All grid event names. */
+ private static final Map<Integer, String> GRID_EVT_NAMES = new HashMap<>();
+
+ /** All grid events. */
+ private static final int[] GRID_EVTS;
+
+ /** Empty integers array. */
+ private static final int[] EMPTY_INTS = new int[0];
+
+ /** Empty longs. */
+ private static final long[] EMPTY_LONGS = new long[0];
+
+ /** System line separator. */
+ private static final String NL = System.getProperty("line.separator");
+
+ /** Default user version. */
+ public static final String DFLT_USER_VERSION = "0";
+
+ /** Cache for {@link GridPeerDeployAware} fields to speed up reflection. */
+ private static final ConcurrentMap<String, IgniteBiTuple<Class<?>, Collection<Field>>> p2pFields =
+ new ConcurrentHashMap8<>();
+
+ /** Secure socket protocol to use. */
+ private static final String HTTPS_PROTOCOL = "TLS";
+
+ /** Project home directory. */
+ private static volatile GridTuple<String> ggHome;
+
+ /** Project work directory. */
+ private static volatile String ggWork;
+
+ /** OS JDK string. */
+ private static String osJdkStr;
+
+ /** OS string. */
+ private static String osStr;
+
+ /** JDK string. */
+ private static String jdkStr;
+
+ /** Indicates whether current OS is Windows 95. */
+ private static boolean win95;
+
+ /** Indicates whether current OS is Windows 98. */
+ private static boolean win98;
+
+ /** Indicates whether current OS is Windows NT. */
+ private static boolean winNt;
+
+ /** Indicates whether current OS is Windows Vista. */
+ private static boolean winVista;
+
+ /** Indicates whether current OS is Windows 7. */
+ private static boolean win7;
+
+ /** Indicates whether current OS is Windows 8. */
+ private static boolean win8;
+
+ /** Indicates whether current OS is Windows 8.1. */
+ private static boolean win81;
+
+ /** Indicates whether current OS is some version of Windows. */
+ private static boolean unknownWin;
+
+ /** Indicates whether current OS is Windows 2000. */
+ private static boolean win2k;
+
+ /** Indicates whether current OS is Windows XP. */
+ private static boolean winXp;
+
+ /** Indicates whether current OS is Windows Server 2003. */
+ private static boolean win2003;
+
+ /** Indicates whether current OS is Windows Server 2008. */
+ private static boolean win2008;
+
+ /** Indicates whether current OS is UNIX flavor. */
+ private static boolean unix;
+
+ /** Indicates whether current OS is Solaris. */
+ private static boolean solaris;
+
+ /** Indicates whether current OS is Linux flavor. */
+ private static boolean linux;
+
+ /** Indicates whether current OS is NetWare. */
+ private static boolean netware;
+
+ /** Indicates whether current OS is Mac OS. */
+ private static boolean mac;
+
+ /** Indicates whether current OS architecture is Sun Sparc. */
+ private static boolean sparc;
+
+ /** Indicates whether current OS architecture is Intel X86. */
+ private static boolean x86;
+
+ /** Name of the underlying OS. */
+ private static String osName;
+
+ /** Version of the underlying OS. */
+ private static String osVer;
+
+ /** CPU architecture of the underlying OS. */
+ private static String osArch;
+
+ /** Name of the Java Runtime. */
+ private static String javaRtName;
+
+ /** Name of the Java Runtime version. */
+ private static String javaRtVer;
+
+ /** Name of the JDK vendor. */
+ private static String jdkVendor;
+
+ /** Name of the JDK. */
+ private static String jdkName;
+
+ /** Version of the JDK. */
+ private static String jdkVer;
+
+ /** Name of JVM specification. */
+ private static String jvmSpecName;
+
+ /** Version of JVM implementation. */
+ private static String jvmImplVer;
+
+ /** Vendor's name of JVM implementation. */
+ private static String jvmImplVendor;
+
+ /** Name of the JVM implementation. */
+ private static String jvmImplName;
+
+ /** JMX domain as 'xxx.gridgain'. */
+ public static final String JMX_DOMAIN = IgniteUtils.class.getName().substring(0, IgniteUtils.class.getName().
+ indexOf('.', IgniteUtils.class.getName().indexOf('.') + 1));
+
+ /** Network packet header. */
+ public static final byte[] GG_HEADER = U.intToBytes(0x00004747);
+
+ /** Default buffer size = 4K. */
+ private static final int BUF_SIZE = 4096;
+
+ /** Byte bit-mask. */
+ private static final int MASK = 0xf;
+
+ /** Long date format pattern for log messages. */
+ private static final SimpleDateFormat LONG_DATE_FMT = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
+
+ /**
+ * Short date format pattern for log messages in "quiet" mode.
+ * Only time is included since we don't expect "quiet" mode to be used
+ * for longer runs.
+ */
+ private static final SimpleDateFormat SHORT_DATE_FMT = new SimpleDateFormat("HH:mm:ss");
+
+ /** Debug date format. */
+ private static final SimpleDateFormat DEBUG_DATE_FMT = new SimpleDateFormat("HH:mm:ss,SSS");
+
+ /** Cached local host address to make sure that every time the same local host is returned. */
+ private static InetAddress locHost;
+
+ /** */
+ static volatile long curTimeMillis = System.currentTimeMillis();
+
+ /** Primitive class map. */
+ private static final Map<String, Class<?>> primitiveMap = new HashMap<>(16, .5f);
+
+ /** Boxed class map. */
+ private static final Map<Class<?>, Class<?>> boxedClsMap = new HashMap<>(16, .5f);
+
+ /** Class loader used to load GridGain. */
+ private static final ClassLoader gridClassLoader = IgniteUtils.class.getClassLoader();
+
+ /** MAC OS invalid argument socket error message. */
+ public static final String MAC_INVALID_ARG_MSG = "On MAC OS you may have too many file descriptors open " +
+ "(simple restart usually solves the issue)";
+
+ /** Default help pages. */
+ public static final List<String> DFLT_HELP_LINKS = Arrays.asList(
+ "Troubleshooting: http://bit.ly/GridGain-Troubleshooting",
+ "Documentation Center: http://bit.ly/GridGain-Documentation");
+
+ /** Portable classes. */
+ private static final Collection<Class<?>> PORTABLE_CLS = new HashSet<>();
+
+ /** GridGain Logging Directory. */
+ public static final String GRIDGAIN_LOG_DIR = System.getenv(GG_LOG_DIR);
+
+ /** GridGain Work Directory. */
+ public static final String GRIDGAIN_WORK_DIR = System.getenv(GG_WORK_DIR);
+
+ /** Clock timer. */
+ private static Thread timer;
+
+ /** Grid counter. */
+ private static int gridCnt;
+
+ /** Mutex. */
+ private static final Object mux = new Object();
+
+ /**
+ * Initializes enterprise check.
+ */
+ static {
+ String osName = System.getProperty("os.name");
+
+ String osLow = osName.toLowerCase();
+
+ // OS type detection.
+ if (osLow.contains("win")) {
+ if (osLow.contains("95"))
+ win95 = true;
+ else if (osLow.contains("98"))
+ win98 = true;
+ else if (osLow.contains("nt"))
+ winNt = true;
+ else if (osLow.contains("2000"))
+ win2k = true;
+ else if (osLow.contains("vista"))
+ winVista = true;
+ else if (osLow.contains("xp"))
+ winXp = true;
+ else if (osLow.contains("2003"))
+ win2003 = true;
+ else if (osLow.contains("2008"))
+ win2008 = true;
+ else if (osLow.contains("7"))
+ win7 = true;
+ else if (osLow.contains("8.1"))
+ win81 = true;
+ else if (osLow.contains("8"))
+ win8 = true;
+ else
+ unknownWin = true;
+ }
+ else if (osLow.contains("netware"))
+ netware = true;
+ else if (osLow.contains("mac os"))
+ mac = true;
+ else {
+ // UNIXs flavors tokens.
+ for (CharSequence os : new String[]{"ix", "inux", "olaris", "un", "ux", "sco", "bsd", "att"})
+ if (osLow.contains(os)) {
+ unix = true;
+
+ break;
+ }
+
+ // UNIX name detection.
+ if (osLow.contains("olaris"))
+ solaris = true;
+ else if (osLow.contains("inux"))
+ linux = true;
+ }
+
+ String osArch = System.getProperty("os.arch");
+
+ String archStr = osArch.toLowerCase();
+
+ // OS architecture detection.
+ if (archStr.contains("x86"))
+ x86 = true;
+ else if (archStr.contains("sparc"))
+ sparc = true;
+
+ String javaRtName = System.getProperty("java.runtime.name");
+ String javaRtVer = System.getProperty("java.runtime.version");
+ String jdkVendor = System.getProperty("java.specification.vendor");
+ String jdkName = System.getProperty("java.specification.name");
+ String jdkVer = System.getProperty("java.specification.version");
+ String osVer = System.getProperty("os.version");
+ String jvmSpecName = System.getProperty("java.vm.specification.name");
+ String jvmImplVer = System.getProperty("java.vm.version");
+ String jvmImplVendor = System.getProperty("java.vm.vendor");
+ String jvmImplName = System.getProperty("java.vm.name");
+
+ String jdkStr = javaRtName + ' ' + javaRtVer + ' ' + jvmImplVendor + ' ' + jvmImplName + ' ' +
+ jvmImplVer;
+
+ osStr = osName + ' ' + osVer + ' ' + osArch;
+ osJdkStr = osLow + ", " + jdkStr;
+
+ // Copy auto variables to static ones.
+ IgniteUtils.osName = osName;
+ IgniteUtils.jdkName = jdkName;
+ IgniteUtils.jdkVendor = jdkVendor;
+ IgniteUtils.jdkVer = jdkVer;
+ IgniteUtils.jdkStr = jdkStr;
+ IgniteUtils.osVer = osVer;
+ IgniteUtils.osArch = osArch;
+ IgniteUtils.jvmSpecName = jvmSpecName;
+ IgniteUtils.jvmImplVer = jvmImplVer;
+ IgniteUtils.jvmImplVendor = jvmImplVendor;
+ IgniteUtils.jvmImplName = jvmImplName;
+ IgniteUtils.javaRtName = javaRtName;
+ IgniteUtils.javaRtVer = javaRtVer;
+
+ primitiveMap.put("byte", byte.class);
+ primitiveMap.put("short", short.class);
+ primitiveMap.put("int", int.class);
+ primitiveMap.put("long", long.class);
+ primitiveMap.put("float", float.class);
+ primitiveMap.put("double", double.class);
+ primitiveMap.put("char", char.class);
+ primitiveMap.put("boolean", boolean.class);
+
+ boxedClsMap.put(byte.class, Byte.class);
+ boxedClsMap.put(short.class, Short.class);
+ boxedClsMap.put(int.class, Integer.class);
+ boxedClsMap.put(long.class, Long.class);
+ boxedClsMap.put(float.class, Float.class);
+ boxedClsMap.put(double.class, Double.class);
+ boxedClsMap.put(char.class, Character.class);
+ boxedClsMap.put(boolean.class, Boolean.class);
+
+ try {
+ OBJECT_CTOR = Object.class.getConstructor();
+ }
+ catch (NoSuchMethodException e) {
+ throw withCause(new AssertionError("Object class does not have empty constructor (is JDK corrupted?)."), e);
+ }
+
+ // Constructor factory.
+ Method ctorFac = null;
+ Object refFac = null;
+
+ try {
+ Class<?> refFactoryCls = Class.forName("sun.reflect.ReflectionFactory");
+
+ refFac = refFactoryCls.getMethod("getReflectionFactory").invoke(null);
+
+ ctorFac = refFac.getClass().getMethod("newConstructorForSerialization", Class.class,
+ Constructor.class);
+ }
+ catch (NoSuchMethodException | ClassNotFoundException | IllegalAccessException | InvocationTargetException ignored) {
+ // No-op.
+ }
+
+ CTOR_FACTORY = ctorFac;
+ SUN_REFLECT_FACTORY = refFac;
+
+ // Disable hostname SSL verification for development and testing with self-signed certificates.
+ if (Boolean.parseBoolean(System.getProperty(GG_DISABLE_HOSTNAME_VERIFIER))) {
+ HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
+ @Override public boolean verify(String hostname, SSLSession sslSes) {
+ return true;
+ }
+ });
+ }
+
+ // Event names initialization.
+ for (Field field : IgniteEventType.class.getFields()) {
+ if (field.getType().equals(int.class)) {
+ try {
+ assert field.getName().startsWith("EVT_") : "Invalid event name (should start with 'EVT_': " +
+ field.getName();
+
+ int type = field.getInt(null);
+
+ String prev = GRID_EVT_NAMES.put(type, field.getName().substring(4));
+
+ // Check for duplicate event types.
+ assert prev == null : "Duplicate event [type=" + type + ", name1=" + prev +
+ ", name2=" + field.getName() + ']';
+ }
+ catch (IllegalAccessException e) {
+ throw new IgniteException(e);
+ }
+ }
+ }
+
+ // Event array initialization.
+ GRID_EVTS = toIntArray(GRID_EVT_NAMES.keySet());
+
+ // Sort for fast event lookup.
+ Arrays.sort(GRID_EVTS);
+
+ // We need to re-initialize EVTS_ALL and EVTS_ALL_MINUS_METRIC_UPDATE
+ // because they may have been initialized to null before GRID_EVTS were initialized.
+ if (EVTS_ALL == null || EVTS_ALL_MINUS_METRIC_UPDATE == null) {
+ try {
+ Field f1 = IgniteEventType.class.getDeclaredField("EVTS_ALL");
+ Field f2 = IgniteEventType.class.getDeclaredField("EVTS_ALL_MINUS_METRIC_UPDATE");
+
+ assert f1 != null;
+ assert f2 != null;
+
+ // We use unsafe operations to update static fields on interface because
+ // they are treated as static final and cannot be updated via standard reflection.
+ UNSAFE.putObjectVolatile(UNSAFE.staticFieldBase(f1), UNSAFE.staticFieldOffset(f1), gridEvents());
+ UNSAFE.putObjectVolatile(UNSAFE.staticFieldBase(f2), UNSAFE.staticFieldOffset(f2),
+ gridEvents(EVT_NODE_METRICS_UPDATED));
+
+ assert EVTS_ALL != null;
+ assert EVTS_ALL.length == GRID_EVTS.length;
+
+ assert EVTS_ALL_MINUS_METRIC_UPDATE != null;
+ assert EVTS_ALL_MINUS_METRIC_UPDATE.length == GRID_EVTS.length - 1;
+
+ // Validate correctness.
+ for (int type : GRID_EVTS) {
+ assert containsIntArray(EVTS_ALL, type);
+
+ if (type != EVT_NODE_METRICS_UPDATED)
+ assert containsIntArray(EVTS_ALL_MINUS_METRIC_UPDATE, type);
+ }
+
+ assert !containsIntArray(EVTS_ALL_MINUS_METRIC_UPDATE, EVT_NODE_METRICS_UPDATED);
+ }
+ catch (NoSuchFieldException e) {
+ throw new IgniteException(e);
+ }
+ }
+
+ PORTABLE_CLS.add(Byte.class);
+ PORTABLE_CLS.add(Short.class);
+ PORTABLE_CLS.add(Integer.class);
+ PORTABLE_CLS.add(Long.class);
+ PORTABLE_CLS.add(Float.class);
+ PORTABLE_CLS.add(Double.class);
+ PORTABLE_CLS.add(Character.class);
+ PORTABLE_CLS.add(Boolean.class);
+ PORTABLE_CLS.add(String.class);
+ PORTABLE_CLS.add(UUID.class);
+ PORTABLE_CLS.add(Date.class);
+ PORTABLE_CLS.add(Timestamp.class);
+ PORTABLE_CLS.add(byte[].class);
+ PORTABLE_CLS.add(short[].class);
+ PORTABLE_CLS.add(int[].class);
+ PORTABLE_CLS.add(long[].class);
+ PORTABLE_CLS.add(float[].class);
+ PORTABLE_CLS.add(double[].class);
+ PORTABLE_CLS.add(char[].class);
+ PORTABLE_CLS.add(boolean[].class);
+ PORTABLE_CLS.add(String[].class);
+ PORTABLE_CLS.add(UUID[].class);
+ PORTABLE_CLS.add(Date[].class);
+ PORTABLE_CLS.add(Timestamp[].class);
+ }
+
+ /**
+ * @return System time approximated by 10 ms.
+ */
+ public static long currentTimeMillis() {
+ return curTimeMillis;
+ }
+
+ /**
+ * @return Value of {@link System#nanoTime()} in microseconds.
+ */
+ public static long microTime() {
+ return System.nanoTime() / 1000;
+ }
+
+ /**
+ * Gets nearest power of 2 larger or equal than v.
+ *
+ * @param v Value.
+ * @return Nearest power of 2.
+ */
+ public static int ceilPow2(int v) {
+ v--;
+
+ v |= v >> 1;
+ v |= v >> 2;
+ v |= v >> 4;
+ v |= v >> 8;
+ v |= v >> 16;
+
+ return ++v;
+ }
+
+ /**
+ * @param i Value.
+ * @return {@code true} If the given value is power of 2 (0 is not power of 2).
+ */
+ public static boolean isPow2(int i) {
+ return i > 0 && (i & (i - 1)) == 0;
+ }
+
+ /**
+ * Return SUN specific constructor factory.
+ *
+ * @return SUN specific constructor factory.
+ */
+ @Nullable public static Method ctorFactory() {
+ return CTOR_FACTORY;
+ }
+
+ /**
+ * @return Empty constructor for object class.
+ */
+ public static Constructor objectConstructor() {
+ return OBJECT_CTOR;
+ }
+
+ /**
+ * SUN JDK specific reflection factory for objects without public constructor.
+ *
+ * @return Reflection factory for objects without public constructor.
+ */
+ @Nullable public static Object sunReflectionFactory() {
+ return SUN_REFLECT_FACTORY;
+ }
+
+ /**
+ * Gets name for given grid event type.
+ *
+ * @param type Event type.
+ * @return Event name.
+ */
+ public static String gridEventName(int type) {
+ String name = GRID_EVT_NAMES.get(type);
+
+ return name != null ? name : Integer.toString(type);
+ }
+
+ /**
+ * Gets all event types.
+ *
+ * @param excl Optional exclude events.
+ * @return All events minus excluded ones.
+ */
+ public static int[] gridEvents(final int... excl) {
+ if (F.isEmpty(excl))
+ return GRID_EVTS;
+
+ List<Integer> evts = toIntList(GRID_EVTS, new P1<Integer>() {
+ @Override
+ public boolean apply(Integer i) {
+ return !containsIntArray(excl, i);
+ }
+ });
+
+ return toIntArray(evts);
+ }
+
+ /**
+ * @param discoSpi Discovery SPI.
+ * @return {@code True} if ordering is supported.
+ */
+ public static boolean discoOrdered(DiscoverySpi discoSpi) {
+ DiscoverySpiOrderSupport ann = U.getAnnotation(discoSpi.getClass(), DiscoverySpiOrderSupport.class);
+
+ return ann != null && ann.value();
+ }
+
+ /**
+ * @return Checks if disco ordering should be enforced.
+ */
+ public static boolean relaxDiscoveryOrdered() {
+ return "true".equalsIgnoreCase(System.getProperty(GG_NO_DISCO_ORDER));
+ }
+
+ /**
+ * This method should be used for adding quick debug statements in code
+ * while debugging. Calls to this method should never be committed to master.
+ *
+ * @param msg Message to debug.
+ * @deprecated Calls to this method should never be committed to master.
+ */
+ @Deprecated
+ public static void debug(Object msg) {
+ X.println(debugPrefix() + msg);
+ }
+
+ /**
+ * This method should be used for adding quick debug statements in code
+ * while debugging. Calls to this method should never be committed to master.
+ *
+ * @param msg Message to debug.
+ * @deprecated Calls to this method should never be committed to master.
+ */
+ @Deprecated
+ public static void debugx(String msg) {
+ X.printerrln(debugPrefix() + msg);
+ }
+
+ /**
+ * This method should be used for adding quick debug statements in code
+ * while debugging. Calls to this method should never be committed to master.
+ *
+ * @param log Logger.
+ * @param msg Message to debug.
+ *
+ * @deprecated Calls to this method should never be committed to master.
+ */
+ @Deprecated
+ public static void debug(IgniteLogger log, String msg) {
+ log.info(msg);
+ }
+
+ /**
+ * Prints stack trace of the current thread to {@code System.out}.
+ *
+ * @deprecated Calls to this method should never be committed to master.
+ */
+ @SuppressWarnings("deprecation")
+ @Deprecated
+ public static void dumpStack() {
+ dumpStack("Dumping stack.");
+ }
+
+ /**
+ * Prints stack trace of the current thread to {@code System.out}.
+ *
+ * @param msg Message to print with the stack.
+ *
+ * @deprecated Calls to this method should never be committed to master.
+ */
+ @Deprecated
+ public static void dumpStack(String msg) {
+ new Exception(debugPrefix() + msg).printStackTrace(System.out);
+ }
+
+ /**
+ * @param log Logger.
+ * @param msg Message.
+ */
+ public static void dumpStack(@Nullable IgniteLogger log, String msg) {
+ U.error(log, "Dumping stack.", new Exception(msg));
+ }
+
+ /**
+ * Prints stack trace of the current thread to provided output stream.
+ *
+ * @param msg Message to print with the stack.
+ * @param out Output to dump stack to.
+ *
+ * @deprecated Calls to this method should never be committed to master.
+ */
+ @Deprecated
+ public static void dumpStack(String msg, PrintStream out) {
+ new Exception(msg).printStackTrace(out);
+ }
+
+ /**
+ * Prints stack trace of the current thread to provided logger.
+ *
+ * @param log Logger.
+ * @param msg Message to print with the stack.
+ *
+ * @deprecated Calls to this method should never be committed to master.
+ */
+ @Deprecated
+ public static void debugStack(IgniteLogger log, String msg) {
+ log.error(msg, new Exception(debugPrefix() + msg));
+ }
+
+ /**
+ * @return Common prefix for debug messages.
+ */
+ private static String debugPrefix() {
+ return '<' + DEBUG_DATE_FMT.format(new Date(System.currentTimeMillis())) + "><DEBUG><" +
+ Thread.currentThread().getName() + '>' + ' ';
+ }
+
+ /**
+ * Prints heap usage.
+ */
+ public static void debugHeapUsage() {
+ System.gc();
+
+ Runtime runtime = Runtime.getRuntime();
+
+ X.println('<' + DEBUG_DATE_FMT.format(new Date(System.currentTimeMillis())) + "><DEBUG><" +
+ Thread.currentThread().getName() + "> Heap stats [free=" + runtime.freeMemory() / (1024 * 1024) +
+ "M, total=" + runtime.totalMemory() / (1024 * 1024) + "M]");
+ }
+
+ /**
+ * Gets heap size in GB rounded to specified precision.
+ *
+ * @param node Node.
+ * @param precision Precision.
+ * @return Heap size in GB.
+ */
+ public static double heapSize(ClusterNode node, int precision) {
+ return heapSize(Collections.singleton(node), precision);
+ }
+
+ /**
+ * Gets total heap size in GB rounded to specified precision.
+ *
+ * @param nodes Nodes.
+ * @param precision Precision.
+ * @return Total heap size in GB.
+ */
+ public static double heapSize(Iterable<ClusterNode> nodes, int precision) {
+ // In bytes.
+ double heap = 0.0;
+
+ for (ClusterNode n : nodesPerJvm(nodes)) {
+ ClusterMetrics m = n.metrics();
+
+ heap += Math.max(m.getHeapMemoryInitialized(), m.getHeapMemoryMaximum());
+ }
+
+ return roundedHeapSize(heap, precision);
+ }
+
+ /**
+ * Returns one representative node for each JVM.
+ *
+ * @param nodes Nodes.
+ * @return Collection which contains only one representative node for each JVM.
+ */
+ private static Iterable<ClusterNode> nodesPerJvm(Iterable<ClusterNode> nodes) {
+ Map<String, ClusterNode> grpMap = new HashMap<>();
+
+ // Group by mac addresses and pid.
+ for (ClusterNode node : nodes) {
+ String grpId = node.attribute(ATTR_MACS) + "|" + node.attribute(ATTR_JVM_PID);
+
+ if (!grpMap.containsKey(grpId))
+ grpMap.put(grpId, node);
+ }
+
+ return grpMap.values();
+ }
+
+ /**
+ * Returns current JVM maxMemory in the same format as {@link #heapSize(org.apache.ignite.cluster.ClusterNode, int)}.
+ *
+ * @param precision Precision.
+ * @return Maximum memory size in GB.
+ */
+ public static double heapSize(int precision) {
+ return roundedHeapSize(Runtime.getRuntime().maxMemory(), precision);
+ }
+
+ /**
+ * Rounded heap size in gigabytes.
+ *
+ * @param heap Heap.
+ * @param precision Precision.
+ * @return Rounded heap size.
+ */
+ private static double roundedHeapSize(double heap, int precision) {
+ double rounded = new BigDecimal(heap / (1024 * 1024 * 1024d)).round(new MathContext(precision)).doubleValue();
+
+ return rounded < 0.1 ? 0.1 : rounded;
+ }
+
+ /**
+ * Performs thread dump and prints all available info to the given log.
+ *
+ * @param log Logger.
+ */
+ public static void dumpThreads(@Nullable IgniteLogger log) {
+ ThreadMXBean mxBean = ManagementFactory.getThreadMXBean();
+
+ ThreadInfo[] threadInfos =
+ mxBean.dumpAllThreads(mxBean.isObjectMonitorUsageSupported(), mxBean.isSynchronizerUsageSupported());
+
+ GridStringBuilder sb = new GridStringBuilder("Thread dump at ")
+ .a(new SimpleDateFormat("yyyy/MM/dd HH:mm:ss z").format(new Date(U.currentTimeMillis()))).a(NL);
+
+ for (ThreadInfo info : threadInfos) {
+ printThreadInfo(info, sb);
+
+ sb.a(NL);
+
+ if (info.getLockedSynchronizers() != null && info.getLockedSynchronizers().length > 0) {
+ printSynchronizersInfo(info.getLockedSynchronizers(), sb);
+
+ sb.a(NL);
+ }
+ }
+
+ sb.a(NL);
+
+ warn(log, sb.toString());
+ }
+
+ /**
+ * Prints single thread info to a buffer.
+ *
+ * @param threadInfo Thread info.
+ * @param sb Buffer.
+ */
+ private static void printThreadInfo(ThreadInfo threadInfo, GridStringBuilder sb) {
+ sb.a("Thread [name=\"").a(threadInfo.getThreadName())
+ .a("\", id=").a(threadInfo.getThreadId())
+ .a(", state=").a(threadInfo.getThreadState())
+ .a(", blockCnt=").a(threadInfo.getBlockedCount())
+ .a(", waitCnt=").a(threadInfo.getWaitedCount()).a("]").a(NL);
+
+ LockInfo lockInfo = threadInfo.getLockInfo();
+
+ if (lockInfo != null) {
+ sb.a(" Lock [object=").a(lockInfo)
+ .a(", ownerName=").a(threadInfo.getLockOwnerName())
+ .a(", ownerId=").a(threadInfo.getLockOwnerId()).a("]").a(NL);
+ }
+
+ MonitorInfo[] monitors = threadInfo.getLockedMonitors();
+ StackTraceElement[] elements = threadInfo.getStackTrace();
+
+ for (int i = 0; i < elements.length; i++) {
+ StackTraceElement e = elements[i];
+
+ sb.a(" at ").a(e.toString());
+
+ for (MonitorInfo monitor : monitors) {
+ if (monitor.getLockedStackDepth() == i)
+ sb.a(NL).a(" - locked ").a(monitor);
+ }
+
+ sb.a(NL);
+ }
+ }
+
+ /**
+ * Prints Synchronizers info to a buffer.
+ *
+ * @param syncs Synchronizers info.
+ * @param sb Buffer.
+ */
+ private static void printSynchronizersInfo(LockInfo[] syncs, GridStringBuilder sb) {
+ sb.a(" Locked synchronizers:");
+
+ for (LockInfo info : syncs)
+ sb.a(NL).a(" ").a(info);
+ }
+
+ /**
+ * Gets empty constructor for class even if the class does not have empty constructor
+ * declared. This method is guaranteed to work with SUN JDK and other JDKs still need
+ * to be tested.
+ *
+ * @param cls Class to get empty constructor for.
+ * @return Empty constructor if one could be found or {@code null} otherwise.
+ * @throws IgniteCheckedException If failed.
+ */
+ @Nullable public static Constructor<?> forceEmptyConstructor(Class<?> cls) throws IgniteCheckedException {
+ Constructor<?> ctor = null;
+
+ try {
+ return cls.getDeclaredConstructor();
+ }
+ catch (Exception ignore) {
+ Method ctorFac = U.ctorFactory();
+ Object sunRefFac = U.sunReflectionFactory();
+
+ if (ctorFac != null && sunRefFac != null)
+ try {
+ ctor = (Constructor)ctorFac.invoke(sunRefFac, cls, U.objectConstructor());
+ }
+ catch (IllegalAccessException | InvocationTargetException e) {
+ throw new IgniteCheckedException("Failed to get object constructor for class: " + cls, e);
+ }
+ }
+
+ return ctor;
+ }
+
+ /**
+ * Creates new instance of a class only if it has an empty constructor (can be non-public).
+ *
+ * @param cls Class name.
+ * @return Instance.
+ * @throws IgniteCheckedException If failed.
+ */
+ @Nullable public static <T> T newInstance(String cls) throws IgniteCheckedException {
+ Class<?> cls0;
+
+ try {
+ cls0 = Class.forName(cls);
+ }
+ catch (Exception e) {
+ throw new IgniteCheckedException(e);
+ }
+
+ return (T)newInstance(cls0);
+ }
+
+ /**
+ * Creates new instance of a class only if it has an empty constructor (can be non-public).
+ *
+ * @param cls Class to instantiate.
+ * @return New instance of the class or {@code null} if empty constructor could not be assigned.
+ * @throws IgniteCheckedException If failed.
+ */
+ @Nullable public static <T> T newInstance(Class<T> cls) throws IgniteCheckedException {
+ boolean set = false;
+
+ Constructor<T> ctor = null;
+
+ try {
+ ctor = cls.getDeclaredConstructor();
+
+ if (ctor == null)
+ return null;
+
+ if (!ctor.isAccessible()) {
+ ctor.setAccessible(true);
+
+ set = true;
+ }
+
+ return ctor.newInstance();
+ }
+ catch (NoSuchMethodException e) {
+ throw new IgniteCheckedException("Failed to find empty constructor for class: " + cls, e);
+ }
+ catch (InstantiationException | InvocationTargetException | IllegalAccessException e) {
+ throw new IgniteCheckedException("Failed to create new instance for class: " + cls, e);
+ } finally {
+ if (ctor != null && set)
+ ctor.setAccessible(false);
+ }
+ }
+
+ /**
+ * Creates new instance of a class even if it does not have public constructor.
+ *
+ * @param cls Class to instantiate.
+ * @return New instance of the class or {@code null} if empty constructor could not be assigned.
+ * @throws IgniteCheckedException If failed.
+ */
+ @SuppressWarnings({"unchecked"})
+ @Nullable public static <T> T forceNewInstance(Class<?> cls) throws IgniteCheckedException {
+ Constructor ctor = forceEmptyConstructor(cls);
+
+ if (ctor == null)
+ return null;
+
+ boolean set = false;
+
+ try {
+
+ if (!ctor.isAccessible()) {
+ ctor.setAccessible(true);
+
+ set = true;
+ }
+
+ return (T)ctor.newInstance();
+ }
+ catch (InstantiationException | InvocationTargetException | IllegalAccessException e) {
+ throw new IgniteCheckedException("Failed to create new instance for class: " + cls, e);
+ } finally {
+ if (set)
+ ctor.setAccessible(false);
+ }
+ }
+
+ /**
+ * Pretty-formatting for minutes.
+ *
+ * @param mins Minutes to format.
+ * @return Formatted presentation of minutes.
+ */
+ public static String formatMins(long mins) {
+ assert mins >= 0;
+
+ if (mins == 0)
+ return "< 1 min";
+
+ SB sb = new SB();
+
+ long dd = mins / 1440; // 1440 mins = 60 mins * 24 hours
+
+ if (dd > 0)
+ sb.a(dd).a(dd == 1 ? " day " : " days ");
+
+ mins %= 1440;
+
+ long hh = mins / 60;
+
+ if (hh > 0)
+ sb.a(hh).a(hh == 1 ? " hour " : " hours ");
+
+ mins %= 60;
+
+ if (mins > 0)
+ sb.a(mins).a(mins == 1 ? " min " : " mins ");
+
+ return sb.toString().trim();
+ }
+
+ /**
+ * Gets 8-character substring of UUID (for terse logging).
+ *
+ * @param id Input ID.
+ * @return 8-character ID substring.
+ */
+ public static String id8(UUID id) {
+ return id.toString().substring(0, 8);
+ }
+
+ /**
+ * Gets 8-character substring of {@link org.apache.ignite.lang.IgniteUuid} (for terse logging).
+ * The ID8 will be constructed as follows:
+ * <ul>
+ * <li>Take first 4 digits for global ID, i.e. {@code GridUuid.globalId()}.</li>
+ * <li>Take last 4 digits for local ID, i.e. {@code GridUuid.localId()}.</li>
+ * </ul>
+ *
+ * @param id Input ID.
+ * @return 8-character representation of {@code GridUuid}.
+ */
+ public static String id8(IgniteUuid id) {
+ String s = id.toString();
+
+ return s.substring(0, 4) + s.substring(s.length() - 4);
+ }
+
+ /**
+ *
+ * @param len Number of characters to fill in.
+ * @param ch Character to fill with.
+ * @return String.
+ */
+ public static String filler(int len, char ch) {
+ char[] a = new char[len];
+
+ Arrays.fill(a, ch);
+
+ return new String(a);
+ }
+
+ /**
+ * Writes array to output stream.
+ *
+ * @param out Output stream.
+ * @param arr Array to write.
+ * @param <T> Array type.
+ * @throws IOException If failed.
+ */
+ public static <T> void writeArray(ObjectOutput out, T[] arr) throws IOException {
+ int len = arr == null ? 0 : arr.length;
+
+ out.writeInt(len);
+
+ if (arr != null && arr.length > 0)
+ for (T t : arr)
+ out.writeObject(t);
+ }
+
+ /**
+ * Reads array from input stream.
+ *
+ * @param in Input stream.
+ * @return Deserialized array.
+ * @throws IOException If failed.
+ * @throws ClassNotFoundException If class not found.
+ */
+ @Nullable public static Object[] readArray(ObjectInput in) throws IOException, ClassNotFoundException {
+ int len = in.readInt();
+
+ Object[] arr = null;
+
+ if (len > 0) {
+ arr = new Object[len];
+
+ for (int i = 0; i < len; i++)
+ arr[i] = in.readObject();
+ }
+
+ return arr;
+ }
+
+ /**
+ * Reads array from input stream.
+ *
+ * @param in Input stream.
+ * @return Deserialized array.
+ * @throws IOException If failed.
+ * @throws ClassNotFoundException If class not found.
+ */
+ @Nullable public static Class<?>[] readClassArray(ObjectInput in) throws IOException, ClassNotFoundException {
+ int len = in.readInt();
+
+ Class<?>[] arr = null;
+
+ if (len > 0) {
+ arr = new Class<?>[len];
+
+ for (int i = 0; i < len; i++)
+ arr[i] = (Class<?>)in.readObject();
+ }
+
+ return arr;
+ }
+
+ /**
+ * Reads array from input stream.
+ *
+ * @param in Input stream.
+ * @return Deserialized array.
+ * @throws IOException If failed.
+ * @throws ClassNotFoundException If class not found.
+ */
+ @SuppressWarnings("unchecked")
+ @Nullable public static <K, V> IgnitePredicate<CacheEntry<K, V>>[] readEntryFilterArray(ObjectInput in)
+ throws IOException, ClassNotFoundException {
+ int len = in.readInt();
+
+ IgnitePredicate<CacheEntry<K, V>>[] arr = null;
+
+ if (len > 0) {
+ arr = new IgnitePredicate[len];
+
+ for (int i = 0; i < len; i++)
+ arr[i] = (IgnitePredicate<CacheEntry<K, V>>)in.readObject();
+ }
+
+ return arr;
+ }
+
+ /**
+ *
+ * @param out Output.
+ * @param col Set to write.
+ * @throws IOException If write failed.
+ */
+ public static void writeCollection(ObjectOutput out, Collection<?> col) throws IOException {
+ if (col != null) {
+ out.writeInt(col.size());
+
+ for (Object o : col)
+ out.writeObject(o);
+ }
+ else
+ out.writeInt(-1);
+ }
+
+ /**
+ * Writes collection of byte arrays to data output.
+ *
+ * @param out Output to write to.
+ * @param bytes Collection with byte arrays.
+ * @throws IOException If write failed.
+ */
+ public static void writeBytesCollection(DataOutput out, Collection<byte[]> bytes) throws IOException {
+ if (bytes != null) {
+ out.writeInt(bytes.size());
+
+ for (byte[] b : bytes)
+ writeByteArray(out, b);
+ }
+ else
+ out.writeInt(-1);
+ }
+
+ /**
+ * Reads collection of byte arrays from data input.
+ *
+ * @param in Data input to read from.
+ * @return List of byte arrays.
+ * @throws IOException If read failed.
+ */
+ public static List<byte[]> readBytesList(DataInput in) throws IOException {
+ int size = in.readInt();
+
+ if (size < 0)
+ return null;
+
+ List<byte[]> res = new ArrayList<>(size);
+
+ for (int i = 0; i < size; i++)
+ res.add(readByteArray(in));
+
+ return res;
+ }
+
+ /**
+ *
+ * @param out Output.
+ * @param col Set to write.
+ * @throws IOException If write failed.
+ */
+ public static void writeIntCollection(DataOutput out, Collection<Integer> col) throws IOException {
+ if (col != null) {
+ out.writeInt(col.size());
+
+ for (Integer i : col)
+ out.writeInt(i);
+ }
+ else
+ out.writeInt(-1);
+ }
+
+ /**
+ * @param in Input.
+ * @return Deserialized set.
+ * @throws IOException If deserialization failed.
+ * @throws ClassNotFoundException If deserialized class could not be found.
+ */
+ @Nullable public static <E> Collection<E> readCollection(ObjectInput in)
+ throws IOException, ClassNotFoundException {
+ return readList(in);
+ }
+
+ /**
+ * @param in Input.
+ * @return Deserialized set.
+ * @throws IOException If deserialization failed.
+ */
+ @Nullable public static Collection<Integer> readIntCollection(DataInput in) throws IOException {
+ int size = in.readInt();
+
+ // Check null flag.
+ if (size == -1)
+ return null;
+
+ Collection<Integer> col = new ArrayList<>(size);
+
+ for (int i = 0; i < size; i++)
+ col.add(in.readInt());
+
+ return col;
+ }
+
+ /**
+ *
+ * @param m Map to copy.
+ * @param <K> Key type.
+ * @param <V> Value type
+ * @return Copied map.
+ */
+ public static <K, V> Map<K, V> copyMap(Map<K, V> m) {
+ return new HashMap<>(m);
+ }
+
+ /**
+ *
+ * @param m Map to seal.
+ * @param <K> Key type.
+ * @param <V> Value type
+ * @return Sealed map.
+ */
+ public static <K, V> Map<K, V> sealMap(Map<K, V> m) {
+ assert m != null;
+
+ return Collections.unmodifiableMap(new HashMap<>(m));
+ }
+
+ /**
+ * Seal collection.
+ *
+ * @param c Collection to seal.
+ * @param <E> Entry type
+ * @return Sealed collection.
+ */
+ public static <E> List<E> sealList(Collection<E> c) {
+ return Collections.unmodifiableList(new ArrayList<>(c));
+ }
+
+ /**
+ * Convert array to seal list.
+ *
+ * @param a Array for convert to seal list.
+ * @param <E> Entry type
+ * @return Sealed collection.
+ */
+ public static <E> List<E> sealList(E... a) {
+ return Collections.unmodifiableList(Arrays.asList(a));
+ }
+
+ /**
+ * Gets display name of the network interface this IP address belongs to.
+ *
+ * @param addr IP address for which to find network interface name.
+ * @return Network interface name or {@code null} if can't be found.
+ */
+ @Nullable public static String getNetworkInterfaceName(String addr) {
+ assert addr != null;
+
+ try {
+ InetAddress inetAddr = InetAddress.getByName(addr);
+
+ for (NetworkInterface itf : asIterable(NetworkInterface.getNetworkInterfaces()))
+ for (InetAddress itfAddr : asIterable(itf.getInetAddresses()))
+ if (itfAddr.equals(inetAddr))
+ return itf.getDisplayName();
+ }
+ catch (UnknownHostException ignore) {
+ return null;
+ }
+ catch (SocketException ignore) {
+ return null;
+ }
+
+ return null;
+ }
+
+ /**
+ * Tries to resolve host by name, returning local host if input is empty.
+ * This method reflects how {@link org.apache.ignite.configuration.IgniteConfiguration#getLocalHost()} should
+ * be handled in most places.
+ *
+ * @param hostName Hostname or {@code null} if local host should be returned.
+ * @return Address of given host or of localhost.
+ * @throws IOException If attempt to get local host failed.
+ */
+ public static InetAddress resolveLocalHost(@Nullable String hostName) throws IOException {
+ return F.isEmpty(hostName) ?
+ // Should default to InetAddress#anyLocalAddress which is package-private.
+ new InetSocketAddress(0).getAddress() :
+ InetAddress.getByName(hostName);
+ }
+
+ /**
+ * Determines whether current local host is different from previously cached.
+ *
+ * @return {@code true} or {@code false} depending on whether or not local host
+ * has changed from the cached value.
+ * @throws IOException If attempt to get local host failed.
+ */
+ public static synchronized boolean isLocalHostChanged() throws IOException {
+ InetAddress locHost0 = locHost;
+
+ return locHost0 != null && !resetLocalHost().equals(locHost0);
+ }
+
+ /**
+ * Returns host names consistent with {@link #resolveLocalHost(String)}. So when it returns
+ * a common address this method returns single host name, and when a wildcard address passed
+ * this method tries to collect addresses of all available interfaces.
+ *
+ * @param locAddr Local address to resolve.
+ * @return Resolved available addresses of given local address.
+ * @throws IOException If failed.
+ * @throws IgniteCheckedException If no network interfaces found.
+ */
+ public static IgniteBiTuple<Collection<String>, Collection<String>> resolveLocalAddresses(InetAddress locAddr)
+ throws IOException, IgniteCheckedException {
+ assert locAddr != null;
+
+ Collection<String> addrs = new ArrayList<>();
+ Collection<String> hostNames = new ArrayList<>();
+
+ if (locAddr.isAnyLocalAddress()) {
+ // It should not take longer than 2 seconds to reach
+ // local address on any network.
+ int reachTimeout = 2000;
+
+ for (NetworkInterface itf : asIterable(NetworkInterface.getNetworkInterfaces())) {
+ for (InetAddress addr : asIterable(itf.getInetAddresses())) {
+ if (!addr.isLinkLocalAddress() && reachable(itf, addr, reachTimeout))
+ addresses(addr, addrs, hostNames);
+ }
+ }
+
+ if (F.isEmpty(addrs))
+ throw new IgniteCheckedException("No network addresses found (is networking enabled?).");
+ }
+ else
+ addresses(locAddr, addrs, hostNames);
+
+ return F.t(addrs, hostNames);
+ }
+
+ /**
+ * @param addr Address.
+ * @param addrs Addresses.
+ * @param hostNames Host names.
+ */
+ private static void addresses(InetAddress addr, Collection<String> addrs, Collection<String> hostNames) {
+ String hostName = addr.getHostName();
+
+ String ipAddr = addr.getHostAddress();
+
+ hostName = F.isEmpty(hostName) || hostName.equals(ipAddr) || addr.isLoopbackAddress() ? "" : hostName;
+
+ addrs.add(ipAddr);
+ hostNames.add(hostName);
+ }
+
+ /**
+ * Gets local host. Implementation will first attempt to get a non-loopback
+ * address. If that fails, then loopback address will be returned.
+ * <p>
+ * Note that this method is synchronized to make sure that local host
+ * initialization happens only once.
+ *
+ * @return Address representing local host.
+ * @throws IOException If attempt to get local host failed.
+ */
+ public static synchronized InetAddress getLocalHost() throws IOException {
+ if (locHost == null)
+ // Cache it.
+ resetLocalHost();
+
+ return locHost;
+ }
+
+ /**
+ * @return Local host.
+ * @throws IOException If attempt to get local host failed.
+ */
+ private static synchronized InetAddress resetLocalHost() throws IOException {
+ locHost = null;
+
+ String sysLocHost = IgniteSystemProperties.getString(GG_LOCAL_HOST);
+
+ if (sysLocHost != null)
+ sysLocHost = sysLocHost.trim();
+
+ if (!F.isEmpty(sysLocHost))
+ locHost = InetAddress.getByName(sysLocHost);
+ else {
+ List<NetworkInterface> itfs = new ArrayList<>();
+
+ for (NetworkInterface itf : asIterable(NetworkInterface.getNetworkInterfaces()))
+ itfs.add(itf);
+
+ Collections.sort(itfs, new Comparator<NetworkInterface>() {
+ @Override public int compare(NetworkInterface itf1, NetworkInterface itf2) {
+ // Interfaces whose name starts with 'e' should go first.
+ return itf1.getName().compareTo(itf2.getName());
+ }
+ });
+
+ // It should not take longer than 2 seconds to reach
+ // local address on any network.
+ int reachTimeout = 2000;
+
+ for (NetworkInterface itf : itfs) {
+ boolean found = false;
+
+ for (InetAddress addr : asIterable(itf.getInetAddresses())) {
+ if (!addr.isLoopbackAddress() && !addr.isLinkLocalAddress() && reachable(itf, addr, reachTimeout)) {
+ locHost = addr;
+
+ found = true;
+
+ break;
+ }
+ }
+
+ if (found)
+ break;
+ }
+ }
+
+ if (locHost == null)
+ locHost = InetAddress.getLocalHost();
+
+ return locHost;
+ }
+
+ /**
+ * Checks if address can be reached using three argument InetAddress.isReachable() version.
+ *
+ * @param itf Network interface to use for test.
+ * @param addr Address to check.
+ * @param reachTimeout Timeout for the check.
+ * @return {@code True} if address is reachable.
+ */
+ public static boolean reachable(NetworkInterface itf, InetAddress addr, int reachTimeout) {
+ try {
+ return addr.isReachable(itf, 0, reachTimeout);
+ }
+ catch (IOException ignore) {
+ return false;
+ }
+ }
+
+ /**
+ * Checks if address can be reached using one argument InetAddress.isReachable() version.
+ *
+ * @param addr Address to check.
+ * @param reachTimeout Timeout for the check.
+ * @return {@code True} if address is reachable.
+ */
+ public static boolean reachable(InetAddress addr, int reachTimeout) {
+ try {
+ return addr.isReachable(reachTimeout);
+ }
+ catch (IOException ignore) {
+ return false;
+ }
+ }
+
+ /**
+ * @param loc Local node.
+ * @param rmt Remote node.
+ * @return Whether given nodes have the same macs.
+ */
+ public static boolean sameMacs(ClusterNode loc, ClusterNode rmt) {
+ assert loc != null;
+ assert rmt != null;
+
+ String locMacs = loc.attribute(GridNodeAttributes.ATTR_MACS);
+ String rmtMacs = rmt.attribute(GridNodeAttributes.ATTR_MACS);
+
+ return locMacs != null && locMacs.equals(rmtMacs);
+ }
+
+ /**
+ * Gets a list of all local non-loopback IPs known to this JVM.
+ * Note that this will include both IPv4 and IPv6 addresses (even if one "resolves"
+ * into another). Loopbacks will be skipped.
+ *
+ * @return List of all known local IPs (empty list if no addresses available).
+ */
+ public static synchronized Collection<String> allLocalIps() {
+ List<String> ips = new ArrayList<>(4);
+
+ try {
+ Enumeration<NetworkInterface> itfs = NetworkInterface.getNetworkInterfaces();
+
+ if (itfs != null) {
+ for (NetworkInterface itf : asIterable(itfs)) {
+ if (!itf.isLoopback()) {
+ Enumeration<InetAddress> addrs = itf.getInetAddresses();
+
+ if (addrs != null) {
+ for (InetAddress addr : asIterable(addrs)) {
+ String hostAddr = addr.getHostAddress();
+
+ if (!addr.isLoopbackAddress() && !ips.contains(hostAddr))
+ ips.add(hostAddr);
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (SocketException ignore) {
+ return Collections.emptyList();
+ }
+
+ Collections.sort(ips);
+
+ return ips;
+ }
+
+ /**
+ * Gets a list of all local enabled MACs known to this JVM. It
+ * is using hardware address of the network interface that is not guaranteed to be
+ * MAC addresses (but in most cases it is).
+ * <p>
+ * Note that if network interface is disabled - its MAC won't be included. All
+ * local network interfaces are probed including loopbacks. Virtual interfaces
+ * (sub-interfaces) are skipped.
+ * <p>
+ * Note that on linux getHardwareAddress() can return null from time to time
+ * if NetworkInterface.getHardwareAddress() method is called from many threads.
+ *
+ * @return List of all known enabled local MACs or empty list
+ * if no MACs could be found.
+ */
+ public static synchronized Collection<String> allLocalMACs() {
+ List<String> macs = new ArrayList<>(3);
+
+ try {
+ Enumeration<NetworkInterface> itfs = NetworkInterface.getNetworkInterfaces();
+
+ if (itfs != null) {
+ for (NetworkInterface itf : asIterable(itfs)) {
+ byte[] hwAddr = itf.getHardwareAddress();
+
+ // Loopback produces empty MAC.
+ if (hwAddr != null && hwAddr.length > 0) {
+ String mac = byteArray2HexString(hwAddr);
+
+ if (!macs.contains(mac))
+ macs.add(mac);
+ }
+ }
+ }
+ }
+ catch (SocketException ignore) {
+ return Collections.emptyList();
+ }
+
+ Collections.sort(macs);
+
+ return macs;
+ }
+
+ /**
+ * Downloads resource by URL.
+ *
+ * @param url URL to download.
+ * @param file File where downloaded resource should be stored.
+ * @return File where downloaded resource should be stored.
+ * @throws IOException If error occurred.
+ */
+ public static File downloadUrl(URL url, File file) throws IOException {
+ assert url != null;
+ assert file != null;
+
+ InputStream in = null;
+ OutputStream out = null;
+
+ try {
+ URLConnection conn = url.openConnection();
+
+ if (conn instanceof HttpsURLConnection) {
+ HttpsURLConnection https = (HttpsURLConnection)conn;
+
+ https.setHostnameVerifier(new DeploymentHostnameVerifier());
+
+ SSLContext ctx = SSLContext.getInstance(HTTPS_PROTOCOL);
+
+ ctx.init(null, getTrustManagers(), null);
+
+ // Initialize socket factory.
+ https.setSSLSocketFactory(ctx.getSocketFactory());
+ }
+
+ in = conn.getInputStream();
+
+ if (in == null)
+ throw new IOException("Failed to open connection: " + url.toString());
+
+ out = new BufferedOutputStream(new FileOutputStream(file));
+
+ copy(in, out);
+ }
+ catch (NoSuchAlgorithmException | KeyManagementException e) {
+ throw new IOException("Failed to open HTTPs connection [url=" + url.toString() + ", msg=" + e + ']', e);
+ } finally {
+ close(in, null);
+ close(out, null);
+ }
+
+ return file;
+ }
+
+ /**
+ * Construct array with one trust manager which don't reject input certificates.
+ *
+ * @return Array with one X509TrustManager implementation of trust manager.
+ */
+ private static TrustManager[] getTrustManagers() {
+ return new TrustManager[]{
+ new X509TrustManager() {
+ @Nullable @Override public X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+
+ @Override public void checkClientTrusted(X509Certificate[] certs, String authType) {
+ /* No-op. */
+ }
+
+ @Override public void checkServerTrusted(X509Certificate[] certs, String authType) {
+ /* No-op. */
+ }
+ }
+ };
+ }
+
+ /**
+ * Replace password in URI string with a single '*' character.
+ * <p>
+ * Parses given URI by applying ".*://(.*:.*)@.*"
+ * regular expression pattern and than if URI matches it
+ * replaces password strings between '/' and '@' with '*'.
+ *
+ * @param uri URI which password should be replaced.
+ * @return Converted URI string
+ */
+ @Nullable public static String hidePassword(@Nullable String uri) {
+ if (uri == null)
+ return null;
+
+ if (Pattern.matches(".*://(.*:.*)@.*", uri)) {
+ int userInfoLastIdx = uri.indexOf('@');
+
+ assert userInfoLastIdx != -1;
+
+ String str = uri.substring(0, userInfoLastIdx);
+
+ int userInfoStartIdx = str.lastIndexOf('/');
+
+ str = str.substring(userInfoStartIdx + 1);
+
+ String[] params = str.split(";");
+
+ StringBuilder builder = new StringBuilder();
+
+ for (int i = 0; i < params.length; i++) {
+ int idx;
+
+ if ((idx = params[i].indexOf(':')) != -1)
+ params[i] = params[i].substring(0, idx + 1) + '*';
+
+ builder.append(params[i]);
+
+ if (i != params.length - 1)
+ builder.append(';');
+ }
+
+ return new StringBuilder(uri).replace(userInfoStartIdx + 1, userInfoLastIdx,
+ builder.toString()).toString();
+ }
+
+ return uri;
+ }
+
+ /**
+ * @return Class loader used to load GridGain itself.
+ */
+ public static ClassLoader gridClassLoader() {
+ return gridClassLoader;
+ }
+
+ /**
+ * @param parent Parent to find.
+ * @param ldr Loader to check.
+ * @return {@code True} if parent found.
+ */
+ public static boolean hasParent(@Nullable ClassLoader parent, ClassLoader ldr) {
+ if (parent != null) {
+ for (; ldr != null; ldr = ldr.getParent()) {
+ if (ldr.equals(parent))
+ return true;
+ }
+
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Verifier always returns successful result for any host.
+ */
+ private static class DeploymentHostnameVerifier implements HostnameVerifier {
+ /** {@inheritDoc} */
+ @Override public boolean verify(String hostname, SSLSession ses) {
+ // Remote host trusted by default.
+ return true;
+ }
+ }
+
+ /**
+ * Makes a {@code '+---+'} dash line.
+ *
+ * @param len Length of the dash line to make.
+ * @return Dash line.
+ */
+ public static String dash(int len) {
+ char[] dash = new char[len];
+
+ Arrays.fill(dash, '-');
+
+ dash[0] = dash[len - 1] = '+';
+
+ return new String(dash);
+ }
+
+ /**
+ * Creates space filled string of given length.
+ *
+ * @param len Number of spaces.
+ * @return Space filled string of given length.
+ */
+ public static String pad(int len) {
+ char[] dash = new char[len];
+
+ Arrays.fill(dash, ' ');
+
+ return new String(dash);
+ }
+
+ /**
+ * Formats system time in milliseconds for printing in logs.
+ *
+ * @param sysTime System time.
+ * @return Formatted time string.
+ */
+ public static String format(long sysTime) {
+ return LONG_DATE_FMT.format(new java.util.Date(sysTime));
+ }
+
+ /**
+ * Takes given collection, shuffles it and returns iterable instance.
+ *
+ * @param <T> Type of elements to create iterator for.
+ * @param col Collection to shuffle.
+ * @return Iterable instance over randomly shuffled collection.
+ */
+ public static <T> Iterable<T> randomIterable(Collection<T> col) {
+ List<T> list = new ArrayList<>(col);
+
+ Collections.shuffle(list);
+
+ return list;
+ }
+
+ /**
+ * Converts enumeration to iterable so it can be used in {@code foreach} construct.
+ *
+ * @param <T> Types of instances for iteration.
+ * @param e Enumeration to convert.
+ * @return Iterable over the given enumeration.
+ */
+ public static <T> Iterable<T> asIterable(final Enumeration<T> e) {
+ return new Iterable<T>() {
+ @Override public Iterator<T> iterator() {
+ return new Iterator<T>() {
+ @Override public boolean hasNext() {
+ return e.hasMoreElements();
+ }
+
+ @SuppressWarnings({"IteratorNextCanNotThrowNoSuchElementException"})
+ @Override public T next() {
+ return e.nextElement();
+ }
+
+ @Override public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+ };
+ }
+
+ /**
+ * Copy source file (or folder) to destination file (or folder). Supported source & destination:
+ * <ul>
+ * <li>File to File</li>
+ * <li>File to Folder</li>
+ * <li>Folder to Folder (Copy the content of the directory and not the directory itself)</li>
+ * </ul>
+ *
+ * @param src Source file or folder.
+ * @param dest Destination file or folder.
+ * @param overwrite Whether or not overwrite existing files and folders.
+ * @throws IOException Thrown if an I/O error occurs.
+ */
+ public static void copy(File src, File dest, boolean overwrite) throws IOException {
+ assert src != null;
+ assert dest != null;
+
+ /*
+ * Supported source & destination:
+ * ===============================
+ * 1. File -> File
+ * 2. File -> Directory
+ * 3. Directory -> Directory
+ */
+
+ // Source must exist.
+ if (!src.exists())
+ throw new FileNotFoundException("Source can't be found: " + src);
+
+ // Check that source and destination are not the same.
+ if (src.getAbsoluteFile().equals(dest.getAbsoluteFile()))
+ throw new IOException("Source and destination are the same [src=" + src + ", dest=" + dest + ']');
+
+ if (dest.exists()) {
+ if (!dest.isDirectory() && !overwrite)
+ throw new IOException("Destination already exists: " + dest);
+
+ if (!dest.canWrite())
+ throw new IOException("Destination is not writable:" + dest);
+ }
+ else {
+ File parent = dest.getParentFile();
+
+ if (parent != null && !parent.exists())
+ // Ignore any errors here.
+ // We will get errors when we'll try to open the file stream.
+ //noinspection ResultOfMethodCallIgnored
+ parent.mkdirs();
+
+ // If source is a directory, we should create destination directory.
+ if (src.isDirectory())
+ //noinspection ResultOfMethodCallIgnored
+ dest.mkdir();
+ }
+
+ if (src.isDirectory()) {
+ // In this case we have Directory -> Directory.
+ // Note that we copy the content of the directory and not the directory itself.
+
+ File[] files = src.listFiles();
+
+ for (File file : files) {
+ if (file.isDirectory()) {
+ File dir = new File(dest, file.getName());
+
+ if (!dir.exists() && !dir.mkdirs())
+ throw new IOException("Can't create directory: " + dir);
+
+ copy(file, dir, overwrite);
+ }
+ else
+ copy(file, dest, overwrite);
+ }
+ }
+ else {
+ // In this case we have File -> File or File -> Directory.
+ File file = dest.exists() && dest.isDirectory() ? new File(dest, src.getName()) : dest;
+
+ if (!overwrite && file.exists())
+ throw new IOException("Destination already exists: " + file);
+
+ FileInputStream in = null;
+ FileOutputStream out = null;
+
+ try {
+ in = new FileInputStream(src);
+ out = new FileOutputStream(file);
+
+ copy(in, out);
+ }
+ finally {
+ if (in != null)
+ in.close();
+
+ if (out != null) {
+ out.getFD().sync();
+
+ out.close();
+ }
+ }
+ }
+ }
+
+ /**
+ * Starts clock timer if grid is first.
+ */
+ public static void onGridStart() {
+ synchronized (mux) {
+ if (gridCnt == 0) {
+ timer = new Thread(new Runnable() {
+ @SuppressWarnings({"BusyWait", "InfiniteLoopStatement"})
+ @Override public void run() {
+ while (true) {
+ curTimeMillis = System.currentTimeMillis();
+
+ try {
+ Thread.sleep(10);
+ }
+ catch (InterruptedException ignored) {
+ U.log(null, "Timer thread has been interrupted.");
+
+ break;
+ }
+ }
+ }
+ }, "gridgain-clock");
+
+ timer.setDaemon(true);
+
+ timer.setPriority(10);
+
+ timer.start();
+ }
+
+ ++gridCnt;
+ }
+ }
+
+ /**
+ * Stops clock timer if all nodes into JVM were stopped.
+ */
+ public static void onGridStop(){
+ synchronized (mux) {
+ assert gridCnt > 0 : gridCnt;
+
+ --gridCnt;
+
+ if (gridCnt == 0 && timer != null) {
+ timer.interrupt();
+
+ timer = null;
+ }
+ }
+ }
+
+ /**
+ * Copies input byte stream to output byte stream.
+ *
+ * @param in Input byte stream.
+ * @param out Output byte stream.
+ * @return Number of the copied bytes.
+ * @throws IOException Thrown if an I/O error occurs.
+ */
+ public static int copy(InputStream in, OutputStream out) throws IOException {
+ assert in != null;
+ assert out != null;
+
+ byte[] buf = new byte[BUF_SIZE];
+
+ int cnt = 0;
+
+ for (int n; (n = in.read(buf)) > 0;) {
+ out.write(buf, 0, n);
+
+ cnt += n;
+ }
+
+ return cnt;
+ }
+
+ /**
+ * Copies input character stream to output character stream.
+ *
+ * @param in Input character stream.
+ * @param out Output character stream.
+ * @return Number of the copied characters.
+ * @throws IOException Thrown if an I/O error occurs.
+ */
+ public static int copy(Reader in, Writer out) throws IOException {
+ assert in != null;
+ assert out != null;
+
+ char[] buf = new char[BUF_SIZE];
+
+ int cnt = 0;
+
+ for (int n; (n = in.read(buf)) > 0;) {
+ out.write(buf, 0, n);
+
+ cnt += n;
+ }
+
+ return cnt;
+ }
+
+ /**
+ * Writes string to file.
+ *
+ * @param file File.
+ * @param s String to write.
+ * @throws IOException Thrown if an I/O error occurs.
+ */
+ public static void writeStringToFile(File file, String s) throws IOException {
+ writeStringToFile(file, s, Charset.defaultCharset().toString(), false);
+ }
+
+ /**
+ * Writes string to file.
+ *
+ * @param file File.
+ * @param s String to write.
+ * @param charset Encoding.
+ * @throws IOException Thrown if an I/O error occurs.
+ */
+ public static void writeStringToFile(File file, String s, String charset) throws IOException {
+ writeStringToFile(file, s, charset, false);
+ }
+
+ /**
+ * Reads file to string using specified charset.
+ *
+ * @param fileName File name.
+ * @param charset File charset.
+ * @return File content.
+ * @throws IOException If error occurred.
+ */
+ public static String readFileToString(String fileName, String charset) throws IOException {
+ Reader input = new InputStreamReader(new FileInputStream(fileName), charset);
+
+ StringWriter output = new StringWriter();
+
+ char[] buf = new char[4096];
+
+ int n;
+
+ while ((n = input.read(buf)) != -1)
+ output.write(buf, 0, n);
+
+ return output.toString();
+ }
+
+ /**
+ * Writes string to file.
+ *
+ * @param file File.
+ * @param s String to write.
+ * @param charset Encoding.
+ * @param append If {@code true}, then specified string will be added to the end of the file.
+ * @throws IOException Thrown if an I/O error occurs.
+ */
+ public static void writeStringToFile(File file, String s, String charset, boolean append) throws IOException {
+ if (s == null)
+ return;
+
+ OutputStream out = null;
+
+ try {
+ out = new FileOutputStream(file, append);
+
+ if (s != null)
+ out.write(s.getBytes(charset));
+ } finally {
+ closeQuiet(out);
+ }
+ }
+
+ /**
+ * Utility method that sets cause into exception and returns it.
+ *
+ * @param e Exception to set cause to and return.
+ * @param cause Optional cause to set (if not {@code null}).
+ * @param <E> Type of the exception.
+ * @return Passed in exception with optionally set cause.
+ */
+ public static <E extends Throwable> E withCause(E e, @Nullable Throwable cause) {
+ assert e != null;
+
+ if (cause != null)
+ e.initCause(cause);
+
+ return e;
+ }
+
+ /**
+ * Deletes file or directory with all sub-directories and files.
+ *
+ * @param file File or directory to delete.
+ * @return {@code true} if and only if the file or directory is successfully deleted,
+ * {@code false} otherwise
+ */
+ public static boolean delete(File file) {
+ assert file != null;
+
+ boolean res = true;
+
+ if (file.isDirectory()) {
+ File[] files = file.listFiles();
+
+ if (files != null && files.length > 0)
+ for (File file1 : files)
+ if (file1.isDirectory())
+ res &= delete(file1);
+ else if (file1.getName().endsWith("jar"))
+ try {
+ // Why do we do this?
+ new JarFile(file1, false).close();
+
+ res &= file1.delete();
+ }
+ catch (IOException ignore) {
+ // Ignore it here...
+ }
+ else
+ res &= file1.delete();
+
+ res &= file.delete();
+ }
+ else
+ res = file.delete();
+
+ return res;
+ }
+
+ /**
+ * @param dir Directory to create along with all non-existent parent directories.
+ * @return {@code True} if directory exists (has been created or already existed),
+ * {@code false} if has not been created and does not exist.
+ */
+ public static boolean mkdirs(File dir) {
+ assert dir != null;
+
+ return dir.mkdirs() || dir.exists();
+ }
+
+ /**
+ * Resolve project home directory based on source code base.
+ *
+ * @return Project home directory (or {@code null} if it cannot be resolved).
+ */
+ @Nullable private static String resolveProjectHome() {
+ assert Thread.holdsLock(IgniteUtils.class);
+
+ // Resolve GridGain home via environment variables.
+ String ggHome0 = IgniteSystemProperties.getString(GG_HOME);
+
+ if (!F.isEmpty(ggHome0))
+ return ggHome0;
+
+ String appWorkDir = System.getProperty("user.dir");
+
+ if (appWorkDir != null) {
+ ggHome0 = findProjectHome(new File(appWorkDir));
+
+ if (ggHome0 != null)
+ return ggHome0;
+ }
+
+ URI uri;
+
+ Class<IgniteUtils> cls = IgniteUtils.class;
+
+ try {
+ ProtectionDomain domain = cls.getProtectionDomain();
+
+ // Should not happen, but to make sure our code is not broken.
+ if (domain == null || domain.getCodeSource() == null || domain.getCodeSource().getLocation() == null) {
+ logResolveFailed(cls, null);
+
+ return null;
+ }
+
+ // Resolve path to class-file.
+ uri = domain.getCodeSource().getLocation().toURI();
+
+ // Overcome UNC path problem on Windows (http://www.tomergabel.com/JavaMishandlesUNCPathsOnWindows.aspx)
+ if (isWindows() && uri.getAuthority() != null)
+ uri = new URI(uri.toString().replace("file://", "file:/"));
+ }
+ catch (URISyntaxException | SecurityException e) {
+ logResolveFailed(cls, e);
+
+ return null;
+ }
+
+ return findProjectHome(new File(uri));
+ }
+
+ /**
+ * Tries to find project home starting from specified directory and moving to root.
+ *
+ * @param startDir First directory in search hierarchy.
+ * @return Project home path or {@code null} if it wasn't found.
+ */
+ private static String findProjectHome(File startDir) {
+ for (File cur = startDir.getAbsoluteFile(); cur != null; cur = cur.getParentFile()) {
+ // Check 'cur' is project home directory.
+ if (!new File(cur, "bin").isDirectory() ||
+ !new File(cur, "libs").isDirectory() ||
+ !new File(cur, "config").isDirectory())
+ continue;
+
+ return cur.getPath();
+ }
+
+ return null;
+ }
+
+ /**
+ * @param cls Class.
+ * @param e Exception.
+ */
+ private static void logResolveFailed(Class cls, Exception e) {
+ warn(null, "Failed to resolve GRIDGAIN_HOME automatically for class codebase " +
+ "[class=" + cls + (e == null ? "" : ", e=" + e.getMessage()) + ']');
+ }
+
+ /**
+ * Retrieves {@code GRIDGAIN_HOME} property. The property is retrieved from system
+ * properties or from environment in that order.
+ *
+ * @return {@code GRIDGAIN_HOME} property.
+ */
+ @Nullable public static String getGridGainHome() {
+ GridTuple<String> ggHomeTup = ggHome;
+
+ String ggHome0;
+
+ if (ggHomeTup == null) {
+ synchronized (IgniteUtils.class) {
+ // Double check.
+ ggHomeTup = ggHome;
+
+ if (ggHomeTup == null) {
+ // Resolve GridGain installation home directory.
+ ggHome = F.t(ggHome0 = resolveProjectHome());
+
+ if (ggHome0 != null)
+ System.setProperty(GG_HOME, ggHome0);
+ }
+ else
+ ggHome0 = ggHomeTup.get();
+ }
+ }
+ else
+ ggHome0 = ggHomeTup.get();
+
+ return ggHome0;
+ }
+
+ /**
+ * @param path GridGain home. May be {@code null}.
+ */
+ public static void setGridGainHome(@Nullable String path) {
+ GridTuple<String> ggHomeTup = ggHome;
+
+ String ggHome0;
+
+ if (ggHomeTup == null) {
+ synchronized (IgniteUtils.class) {
+ // Double check.
+ ggHomeTup = ggHome;
+
+ if (ggHomeTup == null) {
+ if (F.isEmpty(path))
+ System.clearProperty(GG_HOME);
+ else
+ System.setProperty(GG_HOME, path);
+
+ ggHome = F.t(path);
+
+ return;
+ }
+ else
+ ggHome0 = ggHomeTup.get();
+ }
+ }
+ else
+ ggHome0 = ggHomeTup.get();
+
+ if (ggHome0 != null && !ggHome0.equals(path))
+ throw new IgniteException("Failed to set GRIDGAIN_HOME after it has been already resolved " +
+ "[ggHome=" + ggHome0 + ", newGgHome=" + path + ']');
+ }
+
+ /**
+ * Gets file associated with path.
+ * <p>
+ * First check if path is relative to {@code GRIDGAIN_HOME}.
+ * If not, check if path is absolute.
+ * If all checks fail, then {@code null} is returned.
+ * <p>
+ * See {@link #getGridGainHome()} for information on how {@code GRIDGAIN_HOME} is retrieved.
+ *
+ * @param path Path to resolve.
+ * @return Resolved path as file, or {@code null} if path cannot be resolved.
+ */
+ @Nullable public static File resolveGridGainPath(String path) {
+ assert path != null;
+
+ /*
+ * 1. Check relative to GRIDGAIN_HOME specified in configuration, if any.
+ */
+
+ String home = getGridGainHome();
+
+ if (home != null) {
+ File file = new File(home, path);
+
+ if (file.exists())
+ return file;
+ }
+
+ /*
+ * 2. Check given path as absolute.
+ */
+
+ File file = new File(path);
+
+ if (file.exists())
+ return file;
+
+ /*
+ * 3. Check development path.
+ */
+
+ if (home != null)
+ file = new File(home, "os/" + path);
+
+ return file.exists() ? file : null;
+ }
+
+ /**
+ * Gets URL representing the path passed in. First the check is made if path is absolute.
+ * If not, then the check is made if path is relative to {@code META-INF} folder in classpath.
+ * If not, then the check is made if path is relative to ${GRIDGAIN_HOME}.
+ * If all checks fail,
+ * then {@code null} is returned, otherwise URL representing path is returned.
+ * <p>
+ * See {@link #getGridGainHome()} for information on how {@code GRIDGAIN_HOME} is retrieved.
+ *
+ * @param path Path to resolve.
+ * @return Resolved path as URL, or {@code null} if path cannot be resolved.
+ * @see #getGridGainHome()
+ */
+ @Nullable public static URL resolveGridGainUrl(String path) {
+ return resolveGridGainUrl(path, true);
+ }
+
+ /**
+ * Gets URL representing the path passed in. First the check is made if path is absolute.
+ * If not, then the check is made if path is relative to {@code META-INF} folder in classpath.
+ * If not, then the check is made if path is relative to ${GRIDGAIN_HOME}.
+ * If all checks fail,
+ * then {@code null} is returned, otherwise URL representing path is returned.
+ * <p>
+ * See {@link #getGridGainHome()} for information on how {@code GRIDGAIN_HOME} is retrieved.
+ *
+ * @param path Path to resolve.
+ * @param metaInf Flag to indicate whether META-INF folder should be checked or class path root.
+ * @return Resolved path as URL, or {@code null} if path cannot be resolved.
+ * @see #getGridGainHome()
+ */
+ @SuppressWarnings({"UnusedCatchParameter"})
+ @Nullable public static URL resolveGridGainUrl(String path, boolean metaInf) {
+ File f = resolveGridGainPath(path);
+
+ if (f == null)
+ f = resolveGridGainPath("os/" + path);
+
+ if (f != null) {
+ try {
+ // Note: we use that method's chain instead of File.getURL() with due
+ // Sun bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6179468
+ return f.toURI().toURL();
+ }
+ catch (MalformedURLException e) {
+ // No-op.
+ }
+ }
+
+ String locPath = (metaInf ? "META-INF/" : "") + path.replaceAll("\\\\", "/");
+
+ return Thread.currentThread().getContextClassLoader().getResource(locPath);
+ }
+
+ /**
+ * Join byte arrays into single one.
+ *
+ * @param bufs list of byte arrays to concatenate.
+ * @return Concatenated byte's array.
+ */
+ public static byte[] join(byte[]... bufs) {
+ int size = 0;
+ for (byte[] buf : bufs) {
+ size += buf.length;
+ }
+
+ byte[] res = new byte[size];
+ int position = 0;
+ for (byte[] buf : bufs) {
+ arrayCopy(buf, 0, res, position, buf.length);
+ position += buf.length;
+ }
+
+ return res;
+ }
+
+ /**
+ * Converts byte array to formatted string. If calling:
+ * <pre name="code" class="java">
+ * ...
+ * byte[] data = {10, 20, 30, 40, 50, 60, 70, 80, 90};
+ *
+ * U.byteArray2String(data, "0x%02X", ",0x%02X")
+ * ...
+ * </pre>
+ * the result will be:
+ * <pre name="code" class="java">
+ * ...
+ * 0x0A, 0x14, 0x1E, 0x28, 0x32, 0x3C, 0x46, 0x50, 0x5A
+ * ...
+ * </pre>
+ *
+ * @param arr Array of byte.
+ * @param hdrFmt C-style string format for the first element.
+ * @param bodyFmt C-style string format for second and following elements, if any.
+ * @return String with converted bytes.
+ */
+ public static String byteArray2String(byte[] arr, String hdrFmt, String bodyFmt) {
+ assert arr != null;
+ assert hdrFmt != null;
+ assert bodyFmt != null;
+
+ SB sb = new SB();
+
+ sb.a('{');
+
+ boolean first = true;
+
+ for (byte b : arr)
+ if (first) {
+ sb.a(String.format(hdrFmt, b));
+
+ first = false;
+ }
+ else
+ sb.a(String.format(bodyFmt, b));
+
+ sb.a('}');
+
+ return sb.toString();
+ }
+
+ /**
+ * Converts byte array to hex string.
+ *
+ * @param arr Array of bytes.
+ * @return Hex string.
+ */
+ public static String byteArray2HexString(byte[] arr) {
+ SB sb = new SB(arr.length << 1);
+
+ for (byte b : arr)
+ sb.a(Integer.toHexString(MASK & b >>> 4)).a(Integer.toHexString(MASK & b));
+
+ return sb.toString().toUpperCase();
+ }
+
+ /**
+ * Convert string with hex values to byte array.
+ *
+ * @param hex Hexadecimal string to convert.
+ * @return array of bytes defined as hex in string.
+ * @throws IllegalArgumentException If input character differs from certain hex characters.
+ */
+ public static byte[] hexString2ByteArray(String hex) throws IllegalArgumentException {
+ // If Hex string has odd character length.
+ if (hex.length() % 2 != 0)
+ hex = '0' + hex;
+
+ char[] chars = hex.toCharArray();
+
+ byte[] bytes = new byte[chars.length / 2];
+
+ int byteCnt = 0;
+
+ for (int i = 0; i < chars.length; i += 2) {
+ int newByte = 0;
+
+ newByte |= hexCharToByte(chars[i]);
+
+ newByte <<= 4;
+
+ newByte |= hexCharToByte(chars[i + 1]);
+
+ bytes[byteCnt] = (byte)newByte;
+
+ byteCnt++;
+ }
+
+ return bytes;
+ }
+
+ /**
+ * Return byte value for certain character.
+ *
+ * @param ch Character
+ * @return Byte value.
+ * @throws IllegalArgumentException If input character differ from certain hex characters.
+ */
+ @SuppressWarnings({"UnnecessaryFullyQualifiedName", "fallthrough"})
+ private static byte hexCharToByte(char ch) throws IllegalArgumentException {
+ switch (ch) {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ return (byte)(ch - '0');
+
+ case 'a':
+ case 'A':
+ return 0xa;
+
+ case 'b':
+ case 'B':
+ return 0xb;
+
+ case 'c':
+ case 'C':
+ return 0xc;
+
+ case 'd':
+ case 'D':
+ return 0xd;
+
+ case 'e':
+ case 'E':
+ return 0xe;
+
+ case 'f':
+ case 'F':
+ return 0xf;
+
+ default:
+ throw new IllegalArgumentException("Hex decoding wrong input character [character=" + ch + ']');
+ }
+ }
+
+ /**
+ * Converts primitive double to byte array.
+ *
+ * @param d Double to convert.
+ * @return Byte array.
+ */
+ public static byte[] doubleToBytes(double d) {
+ return longToBytes(Double.doubleToLongBits(d));
+ }
+
+ /**
+ * Converts primitive {@code double} type to byte array and stores
+ * it in the specified byte array.
+ *
+ * @param d Double to convert.
+ * @param bytes Array of bytes.
+ * @param off Offset.
+ * @return New offset.
+ */
+ public static int doubleToBytes(double d, byte[] bytes, int off) {
+ return longToBytes(Double.doubleToLongBits(d), bytes, off);
+ }
+
+ /**
+ * Converts primitive float to byte array.
+ *
+ * @param f Float to convert.
+ * @return Array of bytes.
+ */
+ public static byte[] floatToBytes(float f) {
+ return intToBytes(Float.floatToIntBits(f));
+ }
+
+ /**
+ * Converts primitive float to byte array.
+ *
+ * @param f Float to convert.
+ * @param bytes Array of bytes.
+ * @param off Offset.
+ * @return New offset.
+ */
+ public static int floatToBytes(float f, byte[] bytes, int off) {
+ return intToBytes(Float.floatToIntBits(f), bytes, off);
+ }
+
+ /**
+ * Converts primitive {@code long} type to byte array.
+ *
+ * @param l Long value.
+ * @return Array of bytes.
+ */
+ public static byte[] longToBytes(long l) {
+ return GridClientByteUtils.longToBytes(l);
+ }
+
+ /**
+ * Converts primitive {@code long} type to byte array and stores it in specified
+ * byte array.
+ *
+ * @param l Long value.
+ * @param bytes Array of bytes.
+ * @param off Offset in {@code bytes} array.
+ * @return Number o
<TRUNCATED>
[28/52] [abbrv] incubator-ignite git commit: IGNITE-109 - Merge
branch 'ignite-109' into sprint-1
Posted by vk...@apache.org.
IGNITE-109 - Merge branch 'ignite-109' into sprint-1
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9550905e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9550905e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9550905e
Branch: refs/heads/ignite-61
Commit: 9550905e62dad06717ab666330c1d5b6523adc02
Parents: 61a9f98
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Thu Jan 29 19:04:43 2015 -0800
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Thu Jan 29 19:04:43 2015 -0800
----------------------------------------------------------------------
.../cache/distributed/IgniteCrossCacheTxStoreSelfTest.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9550905e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCrossCacheTxStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCrossCacheTxStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCrossCacheTxStoreSelfTest.java
index 7df7619..f80549c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCrossCacheTxStoreSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCrossCacheTxStoreSelfTest.java
@@ -108,7 +108,7 @@ public class IgniteCrossCacheTxStoreSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testWriteThrough() throws Exception {
- GridEx grid = grid(0);
+ IgniteEx grid = grid(0);
TestStore firstStore = (TestStore)grid(0).configuration().getCacheConfiguration()[1].getCacheStoreFactory().create();
@@ -153,7 +153,7 @@ public class IgniteCrossCacheTxStoreSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testIncompatibleCaches1() throws Exception {
- GridEx grid = grid(0);
+ IgniteEx grid = grid(0);
try (IgniteTx ignored = grid.transactions().txStart()) {
GridCache<Object, Object> cacheA = grid.cache("cacheA");
@@ -174,7 +174,7 @@ public class IgniteCrossCacheTxStoreSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testIncompatibleCaches2() throws Exception {
- GridEx grid = grid(0);
+ IgniteEx grid = grid(0);
try (IgniteTx ignored = grid.transactions().txStart()) {
GridCache<Object, Object> cacheA = grid.cache("cacheA");
[08/52] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'origin/sprint-1' into sprint-1
Posted by vk...@apache.org.
Merge remote-tracking branch 'origin/sprint-1' into sprint-1
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9ea96070
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9ea96070
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9ea96070
Branch: refs/heads/ignite-61
Commit: 9ea96070ac972ca23ccf1e34c980303a4c45e823
Parents: 535ca6f 4535322
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jan 29 13:33:03 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jan 29 13:33:03 2015 +0300
----------------------------------------------------------------------
assembly/release-base-fabric.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
[05/52] [abbrv] incubator-ignite git commit: GridNamedInstance ->
IgniteNamedInstance GridgainEx -> IgnitionEx
Posted by vk...@apache.org.
GridNamedInstance -> IgniteNamedInstance
GridgainEx -> IgnitionEx
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c5247ab3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c5247ab3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c5247ab3
Branch: refs/heads/ignite-61
Commit: c5247ab37b5233520bb610570d9a1dd2b793d0bb
Parents: c323a8e
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jan 29 12:44:57 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jan 29 12:44:57 2015 +0300
----------------------------------------------------------------------
.../main/java/org/apache/ignite/Ignition.java | 38 +-
.../apache/ignite/cache/CachingProvider.java | 2 +-
.../ignite/internal/ClusterGroupAdapter.java | 2 +-
.../internal/ClusterNodeLocalMapImpl.java | 2 +-
.../org/apache/ignite/internal/GridGainEx.java | 2399 ------------------
.../ignite/internal/GridKernalContextImpl.java | 2 +-
.../apache/ignite/internal/GridLoggerProxy.java | 2 +-
.../org/apache/ignite/internal/IgnitionEx.java | 2399 ++++++++++++++++++
.../processors/cache/GridCacheAdapter.java | 2 +-
.../processors/cache/GridCacheContext.java | 2 +-
.../resource/GridSpringResourceContext.java | 2 +-
.../fs/GridGgfsEventsAbstractSelfTest.java | 2 +-
.../cache/GridCachePutRemoveLoadTest.java | 2 +-
.../testframework/junits/GridAbstractTest.java | 2 +-
.../java/org/apache/ignite/IgniteSpring.java | 8 +-
.../GridServletContextListenerStartup.java | 4 +-
.../startup/servlet/GridServletStartup.java | 4 +-
17 files changed, 2437 insertions(+), 2437 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5247ab3/modules/core/src/main/java/org/apache/ignite/Ignition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/Ignition.java b/modules/core/src/main/java/org/apache/ignite/Ignition.java
index 568b520..a8c3619 100644
--- a/modules/core/src/main/java/org/apache/ignite/Ignition.java
+++ b/modules/core/src/main/java/org/apache/ignite/Ignition.java
@@ -120,7 +120,7 @@ public class Ignition {
* @param daemon Daemon flag to set.
*/
public static void setDaemon(boolean daemon) {
- GridGainEx.setDaemon(daemon);
+ IgnitionEx.setDaemon(daemon);
}
/**
@@ -134,7 +134,7 @@ public class Ignition {
* @return Daemon flag.
*/
public static boolean isDaemon() {
- return GridGainEx.isDaemon();
+ return IgnitionEx.isDaemon();
}
/**
@@ -143,7 +143,7 @@ public class Ignition {
* @return Default grid state.
*/
public static IgniteState state() {
- return GridGainEx.state();
+ return IgnitionEx.state();
}
/**
@@ -155,7 +155,7 @@ public class Ignition {
* @return Grid state.
*/
public static IgniteState state(@Nullable String name) {
- return GridGainEx.state(name);
+ return IgnitionEx.state(name);
}
/**
@@ -170,7 +170,7 @@ public class Ignition {
* {@code false} otherwise (if it was not started).
*/
public static boolean stop(boolean cancel) {
- return GridGainEx.stop(cancel);
+ return IgnitionEx.stop(cancel);
}
/**
@@ -193,7 +193,7 @@ public class Ignition {
* not found).
*/
public static boolean stop(@Nullable String name, boolean cancel) {
- return GridGainEx.stop(name, cancel);
+ return IgnitionEx.stop(name, cancel);
}
/**
@@ -212,7 +212,7 @@ public class Ignition {
* up to the actual job to exit from execution
*/
public static void stopAll(boolean cancel) {
- GridGainEx.stopAll(cancel);
+ IgnitionEx.stopAll(cancel);
}
/**
@@ -236,7 +236,7 @@ public class Ignition {
* @see #RESTART_EXIT_CODE
*/
public static void restart(boolean cancel) {
- GridGainEx.restart(cancel);
+ IgnitionEx.restart(cancel);
}
/**
@@ -259,7 +259,7 @@ public class Ignition {
* @see #KILL_EXIT_CODE
*/
public static void kill(boolean cancel) {
- GridGainEx.kill(cancel);
+ IgnitionEx.kill(cancel);
}
/**
@@ -272,7 +272,7 @@ public class Ignition {
* also if default grid has already been started.
*/
public static Ignite start() throws IgniteCheckedException {
- return GridGainEx.start();
+ return IgnitionEx.start();
}
/**
@@ -285,7 +285,7 @@ public class Ignition {
* also if named grid has already been started.
*/
public static Ignite start(IgniteConfiguration cfg) throws IgniteCheckedException {
- return GridGainEx.start(cfg);
+ return IgnitionEx.start(cfg);
}
/**
@@ -305,7 +305,7 @@ public class Ignition {
* been started or Spring XML configuration file is invalid.
*/
public static Ignite start(@Nullable String springCfgPath) throws IgniteCheckedException {
- return GridGainEx.start(springCfgPath);
+ return IgnitionEx.start(springCfgPath);
}
/**
@@ -325,7 +325,7 @@ public class Ignition {
* been started or Spring XML configuration file is invalid.
*/
public static Ignite start(URL springCfgUrl) throws IgniteCheckedException {
- return GridGainEx.start(springCfgUrl);
+ return IgnitionEx.start(springCfgUrl);
}
/**
@@ -341,7 +341,7 @@ public class Ignition {
* initialized or grid instance was stopped or was not started.
*/
public static Ignite ignite() throws IgniteIllegalStateException {
- return GridGainEx.grid();
+ return IgnitionEx.grid();
}
/**
@@ -350,7 +350,7 @@ public class Ignition {
* @return List of all grids started so far.
*/
public static List<Ignite> allGrids() {
- return GridGainEx.allGrids();
+ return IgnitionEx.allGrids();
}
/**
@@ -366,7 +366,7 @@ public class Ignition {
* initialized or grid instance was stopped or was not started.
*/
public static Ignite ignite(UUID locNodeId) throws IgniteIllegalStateException {
- return GridGainEx.grid(locNodeId);
+ return IgnitionEx.grid(locNodeId);
}
/**
@@ -386,7 +386,7 @@ public class Ignition {
* initialized or grid instance was stopped or was not started.
*/
public static Ignite ignite(@Nullable String name) throws IgniteIllegalStateException {
- return GridGainEx.grid(name);
+ return IgnitionEx.grid(name);
}
/**
@@ -402,7 +402,7 @@ public class Ignition {
* this method is no-op.
*/
public static void addListener(IgniteListener lsnr) {
- GridGainEx.addListener(lsnr);
+ IgnitionEx.addListener(lsnr);
}
/**
@@ -412,6 +412,6 @@ public class Ignition {
* @return {@code true} if lsnr was added before, {@code false} otherwise.
*/
public static boolean removeListener(IgniteListener lsnr) {
- return GridGainEx.removeListener(lsnr);
+ return IgnitionEx.removeListener(lsnr);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5247ab3/modules/core/src/main/java/org/apache/ignite/cache/CachingProvider.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CachingProvider.java b/modules/core/src/main/java/org/apache/ignite/cache/CachingProvider.java
index 1b6c945..c594594 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/CachingProvider.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/CachingProvider.java
@@ -40,7 +40,7 @@ public class CachingProvider implements javax.cache.spi.CachingProvider {
URI uri = null;
try {
- URL dfltCfgURL = U.resolveGridGainUrl(GridGainEx.DFLT_CFG);
+ URL dfltCfgURL = U.resolveGridGainUrl(IgnitionEx.DFLT_CFG);
if (dfltCfgURL != null)
uri = dfltCfgURL.toURI();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5247ab3/modules/core/src/main/java/org/apache/ignite/internal/ClusterGroupAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/ClusterGroupAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/ClusterGroupAdapter.java
index b3f8cc0..820735e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/ClusterGroupAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/ClusterGroupAdapter.java
@@ -638,7 +638,7 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
*/
protected Object readResolve() throws ObjectStreamException {
try {
- IgniteKernal g = GridGainEx.gridx(gridName);
+ IgniteKernal g = IgnitionEx.gridx(gridName);
return ids != null ? new ClusterGroupAdapter(g, g.context(), subjId, ids) :
p != null ? new ClusterGroupAdapter(g, g.context(), subjId, p) : g;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5247ab3/modules/core/src/main/java/org/apache/ignite/internal/ClusterNodeLocalMapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/ClusterNodeLocalMapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/ClusterNodeLocalMapImpl.java
index 5487f0a..c5378a3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/ClusterNodeLocalMapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/ClusterNodeLocalMapImpl.java
@@ -85,7 +85,7 @@ public class ClusterNodeLocalMapImpl<K, V> extends ConcurrentHashMap8<K, V> impl
*/
protected Object readResolve() throws ObjectStreamException {
try {
- return GridGainEx.gridx(stash.get()).nodeLocalMap();
+ return IgnitionEx.gridx(stash.get()).nodeLocalMap();
}
catch (IllegalStateException e) {
throw U.withCause(new InvalidObjectException(e.getMessage()), e);
[30/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-61
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
index 0000000,283f266..350d0b1
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
@@@ -1,0 -1,84 +1,78 @@@
+ /*
+ * 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.util.nio;
+
+ import org.apache.ignite.*;
++import org.apache.ignite.plugin.extensions.communication.*;
+ import org.apache.ignite.spi.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.*;
-import java.util.*;
+
+ /**
+ * Parser for direct messages.
+ */
+ public class GridDirectParser implements GridNioParser {
+ /** Message metadata key. */
+ private static final int MSG_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
+
- /** Message reader. */
- private final GridNioMessageReader msgReader;
-
+ /** */
+ private IgniteSpiAdapter spi;
+
+ /** */
- private GridTcpMessageFactory msgFactory;
++ private MessageFactory msgFactory;
+
+ /**
- * @param msgReader Message reader.
+ * @param spi Spi.
+ */
- public GridDirectParser(GridNioMessageReader msgReader, IgniteSpiAdapter spi) {
- this.msgReader = msgReader;
++ public GridDirectParser(IgniteSpiAdapter spi) {
+ this.spi = spi;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Object decode(GridNioSession ses, ByteBuffer buf) throws IOException, IgniteCheckedException {
+ if (msgFactory == null)
+ msgFactory = spi.getSpiContext().messageFactory();
+
+ GridTcpCommunicationMessageAdapter msg = ses.removeMeta(MSG_META_KEY);
- UUID nodeId = ses.meta(GridNioServer.DIFF_VER_NODE_ID_META_KEY);
+
+ if (msg == null && buf.hasRemaining())
+ msg = msgFactory.create(buf.get());
+
+ boolean finished = false;
+
+ if (buf.hasRemaining())
- finished = msgReader.read(nodeId, msg, buf);
++ finished = msg.readFrom(buf);
+
+ if (finished)
+ return msg;
+ else {
+ ses.addMeta(MSG_META_KEY, msg);
+
+ return null;
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public ByteBuffer encode(GridNioSession ses, Object msg) throws IOException, IgniteCheckedException {
+ // No encoding needed for direct messages.
+ throw new UnsupportedEncodingException();
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index 0000000,5a137a9..0e80d56
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@@ -1,0 -1,2305 +1,2276 @@@
+ /*
+ * 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.util.nio;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.internal.util.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.thread.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.nio.ssl.*;
+ 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.internal.util.worker.*;
+ import org.jdk8.backport.*;
+ import org.jetbrains.annotations.*;
+ import sun.nio.ch.*;
+
+ import java.io.*;
+ import java.net.*;
+ import java.nio.*;
+ import java.nio.channels.*;
+ import java.nio.channels.spi.*;
+ import java.util.*;
+ import java.util.Map.*;
+
+ import static org.apache.ignite.internal.util.nio.GridNioSessionMetaKey.*;
+
+ /**
+ * TCP NIO server. Due to asynchronous nature of connections processing
+ * network events such as client connection, disconnection and message receiving are passed to
+ * the server listener. Once client connected, an associated {@link GridNioSession} object is
+ * created and can be used in communication.
+ * <p>
+ * This implementation supports several selectors and several reading threads.
+ *
+ * @param <T> Message type.
+ *
+ */
+ public class GridNioServer<T> {
+ /** Default session write timeout. */
+ public static final int DFLT_SES_WRITE_TIMEOUT = 5000;
+
+ /** Default send queue limit. */
+ public static final int DFLT_SEND_QUEUE_LIMIT = 1024;
+
+ /** Time, which server will wait before retry operation. */
+ private static final long ERR_WAIT_TIME = 2000;
+
+ /** Buffer metadata key. */
+ private static final int BUF_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
+
- /** SSL sysmtem data buffer metadata key. */
++ /** SSL system data buffer metadata key. */
+ private static final int BUF_SSL_SYSTEM_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
+
- /** Node ID meta key (set only if versions are different). */
- public static final int DIFF_VER_NODE_ID_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
-
+ /** Accept worker thread. */
+ @GridToStringExclude
+ private final IgniteThread acceptThread;
+
+ /** Read worker threads. */
+ private final IgniteThread[] clientThreads;
+
+ /** Read workers. */
+ private final List<AbstractNioClientWorker> clientWorkers;
+
+ /** Filter chain to use. */
+ private final GridNioFilterChain<T> filterChain;
+
+ /** Logger. */
+ @GridToStringExclude
+ private final IgniteLogger log;
+
+ /** Closed flag. */
+ private volatile boolean closed;
+
+ /** Flag indicating if this server should use direct buffers. */
+ private final boolean directBuf;
+
+ /** Index to select which thread will serve next socket channel. Using round-robin balancing. */
+ @GridToStringExclude
+ private int balanceIdx;
+
+ /** Tcp no delay flag. */
+ private final boolean tcpNoDelay;
+
+ /** Socket send buffer. */
+ private final int sockSndBuf;
+
+ /** Socket receive buffer. */
+ private final int sockRcvBuf;
+
+ /** Write timeout */
+ private volatile long writeTimeout = DFLT_SES_WRITE_TIMEOUT;
+
+ /** Idle timeout. */
+ private volatile long idleTimeout = IgniteConfiguration.DFLT_REST_IDLE_TIMEOUT;
+
+ /** For test purposes only. */
+ @SuppressWarnings("UnusedDeclaration")
+ private boolean skipWrite;
+
+ /** Local address. */
+ private final InetSocketAddress locAddr;
+
+ /** Order. */
+ private final ByteOrder order;
+
+ /** Send queue limit. */
+ private final int sndQueueLimit;
+
+ /** Whether direct mode is used. */
+ private final boolean directMode;
+
+ /** Metrics listener. */
+ private final GridNioMetricsListener metricsLsnr;
+
- /** Message writer. */
- private final GridNioMessageWriter msgWriter;
-
+ /** Sessions. */
+ private final GridConcurrentHashSet<GridSelectorNioSessionImpl> sessions = new GridConcurrentHashSet<>();
+
+ /** */
+ private GridNioSslFilter sslFilter;
+
+ /** Static initializer ensures single-threaded execution of workaround. */
+ static {
+ // This is a workaround for JDK bug (NPE in Selector.open()).
+ // http://bugs.sun.com/view_bug.do?bug_id=6427854
+ try {
+ Selector.open().close();
+ }
+ catch (IOException ignored) {
+ }
+ }
+
+ /**
+ * @param addr Address.
+ * @param port Port.
+ * @param log Log.
+ * @param selectorCnt Count of selectors and selecting threads.
+ * @param gridName Grid name.
+ * @param tcpNoDelay If TCP_NODELAY option should be set to accepted sockets.
+ * @param directBuf Direct buffer flag.
+ * @param order Byte order.
+ * @param lsnr Listener.
+ * @param sockSndBuf Socket send buffer.
+ * @param sockRcvBuf Socket receive buffer.
+ * @param sndQueueLimit Send queue limit.
+ * @param directMode Whether direct mode is used.
+ * @param daemon Daemon flag to create threads.
+ * @param metricsLsnr Metrics listener.
- * @param msgWriter Message writer.
+ * @param filters Filters for this server.
+ * @throws IgniteCheckedException If failed.
+ */
+ private GridNioServer(
+ InetAddress addr,
+ int port,
+ IgniteLogger log,
+ int selectorCnt,
+ @Nullable String gridName,
+ boolean tcpNoDelay,
+ boolean directBuf,
+ ByteOrder order,
+ GridNioServerListener<T> lsnr,
+ int sockSndBuf,
+ int sockRcvBuf,
+ int sndQueueLimit,
+ boolean directMode,
+ boolean daemon,
+ GridNioMetricsListener metricsLsnr,
- GridNioMessageWriter msgWriter,
+ GridNioFilter... filters
+ ) throws IgniteCheckedException {
+ A.notNull(addr, "addr");
+ A.notNull(lsnr, "lsnr");
+ A.notNull(log, "log");
+ A.notNull(order, "order");
+
+ A.ensure(port == -1 || (port > 0 && port < 0xffff), "port");
+ A.ensure(selectorCnt > 0, "selectorCnt");
+ A.ensure(sockRcvBuf >= 0, "sockRcvBuf");
+ A.ensure(sockSndBuf >= 0, "sockSndBuf");
+ A.ensure(sndQueueLimit >= 0, "sndQueueLimit");
+
+ this.log = log;
+ this.directBuf = directBuf;
+ this.order = order;
+ this.tcpNoDelay = tcpNoDelay;
+ this.sockRcvBuf = sockRcvBuf;
+ this.sockSndBuf = sockSndBuf;
+ this.sndQueueLimit = sndQueueLimit;
+
+ filterChain = new GridNioFilterChain<>(log, lsnr, new HeadFilter(), filters);
+
+ if (directMode) {
+ for (GridNioFilter filter : filters) {
+ if (filter instanceof GridNioSslFilter) {
+ sslFilter = (GridNioSslFilter)filter;
+
+ assert sslFilter.directMode();
+ }
+ }
+ }
+
+ if (port != -1) {
+ // Once bind, we will not change the port in future.
+ locAddr = new InetSocketAddress(addr, port);
+
+ // This method will throw exception if address already in use.
+ Selector acceptSelector = createSelector(locAddr);
+
+ acceptThread = new IgniteThread(new GridNioAcceptWorker(gridName, "nio-acceptor", log, acceptSelector));
+ }
+ else {
+ locAddr = null;
+ acceptThread = null;
+ }
+
+ clientWorkers = new ArrayList<>(selectorCnt);
+ clientThreads = new IgniteThread[selectorCnt];
+
+ for (int i = 0; i < selectorCnt; i++) {
+ AbstractNioClientWorker worker = directMode ?
+ new DirectNioClientWorker(i, gridName, "grid-nio-worker-" + i, log) :
+ new ByteBufferNioClientWorker(i, gridName, "grid-nio-worker-" + i, log);
+
+ clientWorkers.add(worker);
+
+ clientThreads[i] = new IgniteThread(worker);
+
+ clientThreads[i].setDaemon(daemon);
+ }
+
+ this.directMode = directMode;
+ this.metricsLsnr = metricsLsnr;
- this.msgWriter = msgWriter;
+ }
+
+ /**
+ * Creates and returns a builder for a new instance of this class.
+ *
+ * @return Builder for new instance.
+ */
+ public static <T> Builder<T> builder() {
+ return new Builder<>();
+ }
+
+ /**
+ * Starts all associated threads to perform accept and read activities.
+ */
+ public void start() {
+ filterChain.start();
+
+ if (acceptThread != null)
+ acceptThread.start();
+
+ for (IgniteThread thread : clientThreads)
+ thread.start();
+ }
+
+ /**
+ * Stops all threads and releases all resources.
+ */
+ public void stop() {
+ if (!closed) {
+ closed = true;
+
+ // Make sure to entirely stop acceptor if any.
+ U.interrupt(acceptThread);
+ U.join(acceptThread, log);
+
+ U.cancel(clientWorkers);
+ U.join(clientWorkers, log);
+
+ filterChain.stop();
+ }
+ }
+
+ /**
+ * Gets the address server is bound to.
+ *
+ * @return Address server is bound to.
+ */
+ public InetSocketAddress localAddress() {
+ return locAddr;
+ }
+
+ /**
+ * @param ses Session to close.
+ * @return Future for operation.
+ */
+ public GridNioFuture<Boolean> close(GridNioSession ses) {
+ assert ses instanceof GridSelectorNioSessionImpl;
+
+ GridSelectorNioSessionImpl impl = (GridSelectorNioSessionImpl)ses;
+
+ if (impl.closed())
+ return new GridNioFinishedFuture<>(false);
+
+ NioOperationFuture<Boolean> fut = new NioOperationFuture<>(impl, NioOperation.CLOSE);
+
+ clientWorkers.get(impl.selectorIndex()).offer(fut);
+
+ return fut;
+ }
+
+ /**
+ * @param ses Session.
+ * @param msg Message.
+ * @return Future for operation.
+ */
+ GridNioFuture<?> send(GridNioSession ses, ByteBuffer msg) {
+ assert ses instanceof GridSelectorNioSessionImpl;
+
+ GridSelectorNioSessionImpl impl = (GridSelectorNioSessionImpl)ses;
+
+ NioOperationFuture<?> fut = new NioOperationFuture<Void>(impl, NioOperation.REQUIRE_WRITE, msg);
+
+ send0(impl, fut, false);
+
+ return fut;
+ }
+
+ /**
+ * @param ses Session.
+ * @param msg Message.
+ * @return Future for operation.
+ */
+ GridNioFuture<?> send(GridNioSession ses, GridTcpCommunicationMessageAdapter msg) {
+ assert ses instanceof GridSelectorNioSessionImpl;
+
+ GridSelectorNioSessionImpl impl = (GridSelectorNioSessionImpl)ses;
+
+ NioOperationFuture<?> fut = new NioOperationFuture<Void>(impl, NioOperation.REQUIRE_WRITE, msg);
+
+ send0(impl, fut, false);
+
+ return fut;
+ }
+
+ /**
+ * @param ses Session.
+ * @param fut Future.
+ * @param sys System message flag.
+ */
+ private void send0(GridSelectorNioSessionImpl ses, NioOperationFuture<?> fut, boolean sys) {
+ assert ses != null;
+ assert fut != null;
+
+ int msgCnt = sys ? ses.offerSystemFuture(fut) : ses.offerFuture(fut);
+
+ if (ses.closed()) {
+ if (ses.removeFuture(fut))
+ fut.connectionClosed();
+ }
+ else if (msgCnt == 1)
+ // Change from 0 to 1 means that worker thread should be waken up.
+ clientWorkers.get(ses.selectorIndex()).offer(fut);
+ }
+
+ /**
+ * Adds message at the front of the queue without acquiring back pressure semaphore.
+ *
+ * @param ses Session.
+ * @param msg Message.
+ * @return Future.
+ */
+ public GridNioFuture<?> sendSystem(GridNioSession ses, GridTcpCommunicationMessageAdapter msg) {
+ return sendSystem(ses, msg, null);
+ }
+
+ /**
+ * Adds message at the front of the queue without acquiring back pressure semaphore.
+ *
+ * @param ses Session.
+ * @param msg Message.
+ * @param lsnr Future listener notified from the session thread.
+ * @return Future.
+ */
+ public GridNioFuture<?> sendSystem(GridNioSession ses,
+ GridTcpCommunicationMessageAdapter msg,
+ @Nullable IgniteInClosure<? super GridNioFuture<?>> lsnr) {
+ assert ses instanceof GridSelectorNioSessionImpl;
+
+ GridSelectorNioSessionImpl impl = (GridSelectorNioSessionImpl)ses;
+
+ NioOperationFuture<?> fut = new NioOperationFuture<Void>(impl, NioOperation.REQUIRE_WRITE, msg);
+
+ if (lsnr != null) {
+ fut.listenAsync(lsnr);
+
+ assert !fut.isDone();
+ }
+
+ send0(impl, fut, true);
+
+ return fut;
+ }
+
+ /**
+ * @param ses Session.
+ */
+ public void resend(GridNioSession ses) {
+ assert ses instanceof GridSelectorNioSessionImpl;
+
+ GridNioRecoveryDescriptor recoveryDesc = ses.recoveryDescriptor();
+
+ if (recoveryDesc != null && !recoveryDesc.messagesFutures().isEmpty()) {
+ Deque<GridNioFuture<?>> futs = recoveryDesc.messagesFutures();
+
+ if (log.isDebugEnabled())
+ log.debug("Resend messages [rmtNode=" + recoveryDesc.node().id() + ", msgCnt=" + futs.size() + ']');
+
+ GridSelectorNioSessionImpl ses0 = (GridSelectorNioSessionImpl)ses;
+
+ GridNioFuture<?> fut0 = futs.iterator().next();
+
+ for (GridNioFuture<?> fut : futs) {
+ fut.messageThread(true);
+
+ ((NioOperationFuture)fut).resetMessage(ses0);
+ }
+
+ ses0.resend(futs);
+
+ // Wake up worker.
+ clientWorkers.get(ses0.selectorIndex()).offer(((NioOperationFuture)fut0));
+ }
+ }
+
+ /**
+ * @param ses Session.
+ * @param op Operation.
+ * @return Future for operation.
+ */
+ GridNioFuture<?> pauseResumeReads(GridNioSession ses, NioOperation op) {
+ assert ses instanceof GridSelectorNioSessionImpl;
+ assert op == NioOperation.PAUSE_READ || op == NioOperation.RESUME_READ;
+
+ GridSelectorNioSessionImpl impl = (GridSelectorNioSessionImpl)ses;
+
+ if (impl.closed())
+ return new GridNioFinishedFuture(new IOException("Failed to pause/resume reads " +
+ "(connection was closed): " + ses));
+
+ NioOperationFuture<?> fut = new NioOperationFuture<Void>(impl, op);
+
+ clientWorkers.get(impl.selectorIndex()).offer(fut);
+
+ return fut;
+ }
+
+ /**
+ * Establishes a session.
+ *
+ * @param ch Channel to register within the server and create session for.
+ * @param meta Optional meta for new session.
+ * @return Future to get session.
+ */
+ public GridNioFuture<GridNioSession> createSession(final SocketChannel ch,
+ @Nullable Map<Integer, ?> meta) {
+ try {
+ ch.configureBlocking(false);
+
+ NioOperationFuture<GridNioSession> req = new NioOperationFuture<>(ch, false, meta);
+
+ offerBalanced(req);
+
+ return req;
+ }
+ catch (IOException e) {
+ return new GridNioFinishedFuture<>(e);
+ }
+ }
+
+ /**
+ * Gets configurable write timeout for this session. If not set, default value is {@link #DFLT_SES_WRITE_TIMEOUT}.
+ *
+ * @return Write timeout in milliseconds.
+ */
+ public long writeTimeout() {
+ return writeTimeout;
+ }
+
+ /**
+ * Sets configurable write timeout for session.
+ *
+ * @param writeTimeout Write timeout in milliseconds.
+ */
+ public void writeTimeout(long writeTimeout) {
+ this.writeTimeout = writeTimeout;
+ }
+
+ /**
+ * Gets configurable idle timeout for this session. If not set, default value is
+ * {@link IgniteConfiguration#DFLT_REST_IDLE_TIMEOUT}.
+ *
+ * @return Idle timeout in milliseconds.
+ */
+ public long idleTimeout() {
+ return idleTimeout;
+ }
+
+ /**
+ * Sets configurable idle timeout for session.
+ *
+ * @param idleTimeout Idle timeout in milliseconds.
+ */
+ public void idleTimeout(long idleTimeout) {
+ this.idleTimeout = idleTimeout;
+ }
+
+ /**
+ * Creates selector and binds server socket to a given address and port. If address is null
+ * then will not bind any address and just creates a selector.
+ *
+ * @param addr Local address to listen on.
+ * @return Created selector.
+ * @throws IgniteCheckedException If selector could not be created or port is already in use.
+ */
+ private Selector createSelector(@Nullable SocketAddress addr) throws IgniteCheckedException {
+ Selector selector = null;
+
+ ServerSocketChannel srvrCh = null;
+
+ try {
+ // Create a new selector
+ selector = SelectorProvider.provider().openSelector();
+
+ if (addr != null) {
+ // Create a new non-blocking server socket channel
+ srvrCh = ServerSocketChannel.open();
+
+ srvrCh.configureBlocking(false);
+
+ if (sockRcvBuf > 0)
+ srvrCh.socket().setReceiveBufferSize(sockRcvBuf);
+
+ // Bind the server socket to the specified address and port
+ srvrCh.socket().bind(addr);
+
+ // Register the server socket channel, indicating an interest in
+ // accepting new connections
+ srvrCh.register(selector, SelectionKey.OP_ACCEPT);
+ }
+
+ return selector;
+ }
+ catch (Throwable e) {
+ U.close(srvrCh, log);
+ U.close(selector, log);
+
+ throw new IgniteCheckedException("Failed to initialize NIO selector.", e);
+ }
+ }
+
+ /**
+ * @param req Request to balance.
+ */
+ private synchronized void offerBalanced(NioOperationFuture req) {
+ clientWorkers.get(balanceIdx).offer(req);
+
+ balanceIdx++;
+
+ if (balanceIdx == clientWorkers.size())
+ balanceIdx = 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridNioServer.class, this);
+ }
+
+ /**
+ * Client worker for byte buffer mode.
+ */
+ private class ByteBufferNioClientWorker extends AbstractNioClientWorker {
+ /** Read buffer. */
+ private final ByteBuffer readBuf;
+
+ /**
+ * @param idx Index of this worker in server's array.
+ * @param gridName Grid name.
+ * @param name Worker name.
+ * @param log Logger.
+ * @throws IgniteCheckedException If selector could not be created.
+ */
+ protected ByteBufferNioClientWorker(int idx, @Nullable String gridName, String name, IgniteLogger log)
+ throws IgniteCheckedException {
+ super(idx, gridName, name, log);
+
+ readBuf = directBuf ? ByteBuffer.allocateDirect(8 << 10) : ByteBuffer.allocate(8 << 10);
+
+ readBuf.order(order);
+ }
+
+ /**
+ * Processes read-available event on the key.
+ *
+ * @param key Key that is ready to be read.
+ * @throws IOException If key read failed.
+ */
+ @Override protected void processRead(SelectionKey key) throws IOException {
+ ReadableByteChannel sockCh = (ReadableByteChannel)key.channel();
+
+ final GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment();
+
+ // Reset buffer to read bytes up to its capacity.
+ readBuf.clear();
+
+ // Attempt to read off the channel
+ int cnt = sockCh.read(readBuf);
+
+ if (cnt == -1) {
+ if (log.isDebugEnabled())
+ log.debug("Remote client closed connection: " + ses);
+
+ close(ses, null);
+
+ return;
+ }
+ else if (cnt == 0)
+ return;
+
+ if (log.isTraceEnabled())
+ log.trace("Bytes received [sockCh=" + sockCh + ", cnt=" + cnt + ']');
+
+ if (metricsLsnr != null)
+ metricsLsnr.onBytesReceived(cnt);
+
+ ses.bytesReceived(cnt);
+
+ // Sets limit to current position and
+ // resets position to 0.
+ readBuf.flip();
+
+ try {
+ assert readBuf.hasRemaining();
+
+ filterChain.onMessageReceived(ses, readBuf);
+
+ if (readBuf.remaining() > 0) {
+ LT.warn(log, null, "Read buffer contains data after filter chain processing (will discard " +
+ "remaining bytes) [ses=" + ses + ", remainingCnt=" + readBuf.remaining() + ']');
+
+ readBuf.clear();
+ }
+ }
+ catch (IgniteCheckedException e) {
+ close(ses, e);
+ }
+ }
+
+ /**
+ * Processes write-ready event on the key.
+ *
+ * @param key Key that is ready to be written.
+ * @throws IOException If write failed.
+ */
+ @Override protected void processWrite(SelectionKey key) throws IOException {
+ WritableByteChannel sockCh = (WritableByteChannel)key.channel();
+
+ final GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment();
+
+ while (true) {
+ ByteBuffer buf = ses.removeMeta(BUF_META_KEY);
+ NioOperationFuture<?> req = ses.removeMeta(NIO_OPERATION.ordinal());
+
+ // Check if there were any pending data from previous writes.
+ if (buf == null) {
+ assert req == null;
+
+ req = (NioOperationFuture<?>)ses.pollFuture();
+
+ if (req == null) {
+ key.interestOps(key.interestOps() & (~SelectionKey.OP_WRITE));
+
+ break;
+ }
+
+ buf = req.message();
+ }
+
+ if (!skipWrite) {
+ int cnt = sockCh.write(buf);
+
+ if (log.isTraceEnabled())
+ log.trace("Bytes sent [sockCh=" + sockCh + ", cnt=" + cnt + ']');
+
+ if (metricsLsnr != null)
+ metricsLsnr.onBytesSent(cnt);
+
+ ses.bytesSent(cnt);
+ }
+ else {
+ // For test purposes only (skipWrite is set to true in tests only).
+ try {
+ U.sleep(50);
+ }
+ catch (IgniteInterruptedException e) {
+ throw new IOException("Thread has been interrupted.", e);
+ }
+ }
+
+ if (buf.remaining() > 0) {
+ // Not all data was written.
+ ses.addMeta(BUF_META_KEY, buf);
+ ses.addMeta(NIO_OPERATION.ordinal(), req);
+
+ break;
+ }
+ else {
+ // Message was successfully written.
+ assert req != null;
+
+ req.onDone();
+ }
+ }
+ }
+ }
+
+ /**
+ * Client worker for direct mode.
+ */
+ private class DirectNioClientWorker extends AbstractNioClientWorker {
+ /**
+ * @param idx Index of this worker in server's array.
+ * @param gridName Grid name.
+ * @param name Worker name.
+ * @param log Logger.
+ * @throws IgniteCheckedException If selector could not be created.
+ */
+ protected DirectNioClientWorker(int idx, @Nullable String gridName, String name, IgniteLogger log)
+ throws IgniteCheckedException {
+ super(idx, gridName, name, log);
+ }
+
+ /**
+ * Processes read-available event on the key.
+ *
+ * @param key Key that is ready to be read.
+ * @throws IOException If key read failed.
+ */
+ @Override protected void processRead(SelectionKey key) throws IOException {
+ ReadableByteChannel sockCh = (ReadableByteChannel)key.channel();
+
+ final GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment();
+
+ ByteBuffer readBuf = ses.readBuffer();
+
+ // Attempt to read off the channel.
+ int cnt = sockCh.read(readBuf);
+
+ if (cnt == -1) {
+ if (log.isDebugEnabled())
+ log.debug("Remote client closed connection: " + ses);
+
+ close(ses, null);
+
+ return;
+ }
+ else if (cnt == 0 && !readBuf.hasRemaining())
+ return;
+
+ if (log.isTraceEnabled())
+ log.trace("Bytes received [sockCh=" + sockCh + ", cnt=" + cnt + ']');
+
+ if (metricsLsnr != null)
+ metricsLsnr.onBytesReceived(cnt);
+
+ ses.bytesReceived(cnt);
+
+ // Sets limit to current position and
+ // resets position to 0.
+ readBuf.flip();
+
+ try {
+ assert readBuf.hasRemaining();
+
+ filterChain.onMessageReceived(ses, readBuf);
+
+ if (readBuf.hasRemaining())
+ readBuf.compact();
+ else
+ readBuf.clear();
+ }
+ catch (IgniteCheckedException e) {
+ close(ses, e);
+ }
+ }
+
+ /**
+ * Processes write-ready event on the key.
+ *
+ * @param key Key that is ready to be written.
+ * @throws IOException If write failed.
+ */
+ @Override protected void processWrite(SelectionKey key) throws IOException {
+ if (sslFilter != null)
+ processWriteSsl(key);
+ else
+ processWrite0(key);
+ }
+
+ /**
+ * Processes write-ready event on the key.
+ *
+ * @param key Key that is ready to be written.
+ * @throws IOException If write failed.
+ */
+ @SuppressWarnings("ForLoopReplaceableByForEach")
+ private void processWriteSsl(SelectionKey key) throws IOException {
+ WritableByteChannel sockCh = (WritableByteChannel)key.channel();
+
+ GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment();
+
+ boolean handshakeFinished = sslFilter.lock(ses);
+
+ try {
+ writeSslSystem(ses, sockCh);
+
+ if (!handshakeFinished)
+ return;
+
+ ByteBuffer sslNetBuf = ses.removeMeta(BUF_META_KEY);
+
+ if (sslNetBuf != null) {
+ int cnt = sockCh.write(sslNetBuf);
+
+ if (metricsLsnr != null)
+ metricsLsnr.onBytesSent(cnt);
+
+ ses.bytesSent(cnt);
+
+ if (sslNetBuf.hasRemaining()) {
+ ses.addMeta(BUF_META_KEY, sslNetBuf);
+
+ return;
+ }
+ }
+
+ ByteBuffer buf = ses.writeBuffer();
+ NioOperationFuture<?> req = ses.removeMeta(NIO_OPERATION.ordinal());
- UUID nodeId = ses.meta(DIFF_VER_NODE_ID_META_KEY);
+
+ List<NioOperationFuture<?>> doneFuts = null;
+
+ while (true) {
+ if (req == null) {
+ req = (NioOperationFuture<?>)ses.pollFuture();
+
+ if (req == null && buf.position() == 0) {
+ key.interestOps(key.interestOps() & (~SelectionKey.OP_WRITE));
+
+ break;
+ }
+ }
+
+ GridTcpCommunicationMessageAdapter msg;
+ boolean finished = false;
+
+ if (req != null) {
+ msg = req.directMessage();
+
+ assert msg != null;
- assert msgWriter != null;
+
- finished = msgWriter.write(nodeId, msg, buf);
++ finished = msg.writeTo(buf);
+ }
+
+ // Fill up as many messages as possible to write buffer.
+ while (finished) {
+ if (doneFuts == null)
+ doneFuts = new ArrayList<>();
+
+ doneFuts.add(req);
+
+ req = (NioOperationFuture<?>)ses.pollFuture();
+
+ if (req == null)
+ break;
+
+ msg = req.directMessage();
+
+ assert msg != null;
- assert msgWriter != null;
+
- finished = msgWriter.write(nodeId, msg, buf);
++ finished = msg.writeTo(buf);
+ }
+
+ buf.flip();
+
+ ByteBuffer sesBuf = ses.writeBuffer();
+
+ buf = sslFilter.encrypt(ses, sesBuf);
+
+ sesBuf.clear();
+
+ assert buf.hasRemaining();
+
+ if (!skipWrite) {
+ int cnt = sockCh.write(buf);
+
+ if (!F.isEmpty(doneFuts)) {
+ for (int i = 0; i < doneFuts.size(); i++)
+ doneFuts.get(i).onDone();
+
+ doneFuts.clear();
+ }
+
+ if (log.isTraceEnabled())
+ log.trace("Bytes sent [sockCh=" + sockCh + ", cnt=" + cnt + ']');
+
+ if (metricsLsnr != null)
+ metricsLsnr.onBytesSent(cnt);
+
+ ses.bytesSent(cnt);
+ }
+ else {
+ // For test purposes only (skipWrite is set to true in tests only).
+ try {
+ U.sleep(50);
+ }
+ catch (IgniteInterruptedException e) {
+ throw new IOException("Thread has been interrupted.", e);
+ }
+ }
+
+ ses.addMeta(NIO_OPERATION.ordinal(), req);
+
+ if (buf.hasRemaining()) {
+ ses.addMeta(BUF_META_KEY, buf);
+
+ break;
+ }
+ else
+ buf = ses.writeBuffer();
+ }
+ }
+ finally {
+ sslFilter.unlock(ses);
+ }
+ }
+
+ /**
+ * @param ses NIO session.
+ * @param sockCh Socket channel.
+ * @throws IOException If failed.
+ */
+ private void writeSslSystem(GridSelectorNioSessionImpl ses, WritableByteChannel sockCh)
+ throws IOException {
+ ConcurrentLinkedDeque8<ByteBuffer> queue = ses.meta(BUF_SSL_SYSTEM_META_KEY);
+
+ ByteBuffer buf;
+
+ while ((buf = queue.peek()) != null) {
+ int cnt = sockCh.write(buf);
+
+ if (metricsLsnr != null)
+ metricsLsnr.onBytesSent(cnt);
+
+ ses.bytesSent(cnt);
+
+ if (!buf.hasRemaining())
+ queue.remove(buf);
+ else
+ break;
+ }
+ }
+
+ /**
+ * Processes write-ready event on the key.
+ *
+ * @param key Key that is ready to be written.
+ * @throws IOException If write failed.
+ */
+ @SuppressWarnings("ForLoopReplaceableByForEach")
+ private void processWrite0(SelectionKey key) throws IOException {
+ WritableByteChannel sockCh = (WritableByteChannel)key.channel();
+
+ GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment();
+ ByteBuffer buf = ses.writeBuffer();
+ NioOperationFuture<?> req = ses.removeMeta(NIO_OPERATION.ordinal());
- UUID nodeId = ses.meta(DIFF_VER_NODE_ID_META_KEY);
+
+ List<NioOperationFuture<?>> doneFuts = null;
+
+ while (true) {
+ if (req == null) {
+ req = (NioOperationFuture<?>)ses.pollFuture();
+
+ if (req == null && buf.position() == 0) {
+ key.interestOps(key.interestOps() & (~SelectionKey.OP_WRITE));
+
+ break;
+ }
+ }
+
+ GridTcpCommunicationMessageAdapter msg;
+ boolean finished = false;
+
+ if (req != null) {
+ msg = req.directMessage();
+
+ assert msg != null;
- assert msgWriter != null;
+
- finished = msgWriter.write(nodeId, msg, buf);
++ finished = msg.writeTo(buf);
+ }
+
+ // Fill up as many messages as possible to write buffer.
+ while (finished) {
+ if (doneFuts == null)
+ doneFuts = new ArrayList<>();
+
+ doneFuts.add(req);
+
+ req = (NioOperationFuture<?>)ses.pollFuture();
+
+ if (req == null)
+ break;
+
+ msg = req.directMessage();
+
+ assert msg != null;
- assert msgWriter != null;
+
- finished = msgWriter.write(nodeId, msg, buf);
++ finished = msg.writeTo(buf);
+ }
+
+ buf.flip();
+
+ assert buf.hasRemaining();
+
+ if (!skipWrite) {
+ int cnt = sockCh.write(buf);
+
+ if (!F.isEmpty(doneFuts)) {
+ for (int i = 0; i < doneFuts.size(); i++)
+ doneFuts.get(i).onDone();
+
+ doneFuts.clear();
+ }
+
+ if (log.isTraceEnabled())
+ log.trace("Bytes sent [sockCh=" + sockCh + ", cnt=" + cnt + ']');
+
+ if (metricsLsnr != null)
+ metricsLsnr.onBytesSent(cnt);
+
+ ses.bytesSent(cnt);
+ }
+ else {
+ // For test purposes only (skipWrite is set to true in tests only).
+ try {
+ U.sleep(50);
+ }
+ catch (IgniteInterruptedException e) {
+ throw new IOException("Thread has been interrupted.", e);
+ }
+ }
+
+ if (buf.hasRemaining()) {
+ buf.compact();
+
+ ses.addMeta(NIO_OPERATION.ordinal(), req);
+
+ break;
+ }
+ else
+ buf.clear();
+ }
+ }
+ }
+
+ /**
+ * Thread performing only read operations from the channel.
+ */
+ private abstract class AbstractNioClientWorker extends GridWorker {
+ /** Queue of change requests on this selector. */
+ private final Queue<NioOperationFuture> changeReqs = new ConcurrentLinkedDeque8<>();
+
+ /** Selector to select read events. */
+ private Selector selector;
+
+ /** Worker index. */
+ private final int idx;
+
+ /**
+ * @param idx Index of this worker in server's array.
+ * @param gridName Grid name.
+ * @param name Worker name.
+ * @param log Logger.
+ * @throws IgniteCheckedException If selector could not be created.
+ */
+ protected AbstractNioClientWorker(int idx, @Nullable String gridName, String name, IgniteLogger log)
+ throws IgniteCheckedException {
+ super(gridName, name, log);
+
+ selector = createSelector(null);
+
+ this.idx = idx;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void body() throws InterruptedException, IgniteInterruptedException {
+ try {
+ boolean reset = false;
+ while (!closed) {
+ try {
+ if (reset)
+ selector = createSelector(null);
+
+ bodyInternal();
+ }
+ catch (IgniteCheckedException e) {
+ if (!Thread.currentThread().isInterrupted()) {
+ U.error(log, "Failed to read data from remote connection (will wait for " +
+ ERR_WAIT_TIME + "ms).", e);
+
+ U.sleep(ERR_WAIT_TIME);
+
+ reset = true;
+ }
+ }
+ }
+ }
+ catch (Throwable e) {
+ U.error(log, "Caught unhandled exception in NIO worker thread (restart the node).", e);
+ }
+ }
+
+ /**
+ * Adds socket channel to the registration queue and wakes up reading thread.
+ *
+ * @param req Change request.
+ */
+ private void offer(NioOperationFuture req) {
+ changeReqs.offer(req);
+
+ selector.wakeup();
+ }
+
+ /**
+ * Processes read and write events and registration requests.
+ *
+ * @throws IgniteCheckedException If IOException occurred or thread was unable to add worker to workers pool.
+ */
+ @SuppressWarnings("unchecked")
+ private void bodyInternal() throws IgniteCheckedException {
+ try {
+ while (!closed && selector.isOpen()) {
+ NioOperationFuture req;
+
+ while ((req = changeReqs.poll()) != null) {
+ switch (req.operation()) {
+ case REGISTER: {
+ register(req);
+
+ break;
+ }
+
+ case REQUIRE_WRITE: {
+ //Just register write key.
+ SelectionKey key = req.session().key();
+
+ if (key.isValid()) {
+ key.interestOps(key.interestOps() | SelectionKey.OP_WRITE);
+
+ // Update timestamp to protected against false write timeout.
+ ((GridNioSessionImpl)key.attachment()).bytesSent(0);
+ }
+
+ break;
+ }
+
+ case CLOSE: {
+ if (close(req.session(), null))
+ req.onDone(true);
+ else
+ req.onDone(false);
+
+ break;
+ }
+
+ case PAUSE_READ: {
+ SelectionKey key = req.session().key();
+
+ if (key.isValid()) {
+ key.interestOps(key.interestOps() & (~SelectionKey.OP_READ));
+
+ GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment();
+
+ ses.readsPaused(true);
+
+ req.onDone(true);
+ }
+ else
+ req.onDone(false);
+
+ break;
+ }
+
+ case RESUME_READ: {
+ SelectionKey key = req.session().key();
+
+ if (key.isValid()) {
+ key.interestOps(key.interestOps() | SelectionKey.OP_READ);
+
+ GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment();
+
+ ses.readsPaused(false);
+
+ req.onDone(true);
+ }
+ else
+ req.onDone(false);
+
+ break;
+ }
+ }
+ }
+
+ // Wake up every 2 seconds to check if closed.
+ if (selector.select(2000) > 0)
+ // Walk through the ready keys collection and process network events.
+ processSelectedKeys(selector.selectedKeys());
+
+ checkIdle(selector.keys());
+ }
+ }
+ // Ignore this exception as thread interruption is equal to 'close' call.
+ catch (ClosedByInterruptException e) {
+ if (log.isDebugEnabled())
+ log.debug("Closing selector due to thread interruption: " + e.getMessage());
+ }
+ catch (ClosedSelectorException e) {
+ throw new IgniteCheckedException("Selector got closed while active.", e);
+ }
+ catch (IOException e) {
+ throw new IgniteCheckedException("Failed to select events on selector.", e);
+ }
+ finally {
+ if (selector.isOpen()) {
+ if (log.isDebugEnabled())
+ log.debug("Closing all connected client sockets.");
+
+ // Close all channels registered with selector.
+ for (SelectionKey key : selector.keys())
+ close((GridSelectorNioSessionImpl)key.attachment(), null);
+
+ if (log.isDebugEnabled())
+ log.debug("Closing NIO selector.");
+
+ U.close(selector, log);
+ }
+ }
+ }
+
+ /**
+ * Processes keys selected by a selector.
+ *
+ * @param keys Selected keys.
+ * @throws ClosedByInterruptException If this thread was interrupted while reading data.
+ */
+ private void processSelectedKeys(Set<SelectionKey> keys) throws ClosedByInterruptException {
+ if (log.isTraceEnabled())
+ log.trace("Processing keys in client worker: " + keys.size());
+
+ for (Iterator<SelectionKey> iter = keys.iterator(); iter.hasNext(); ) {
+ SelectionKey key = iter.next();
+
+ iter.remove();
+
+ // Was key closed?
+ if (!key.isValid())
+ continue;
+
+ GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment();
+
+ assert ses != null;
+
+ try {
+ if (key.isReadable())
+ processRead(key);
+
+ if (key.isValid() && key.isWritable())
+ processWrite(key);
+ }
+ catch (ClosedByInterruptException e) {
+ // This exception will be handled in bodyInternal() method.
+ throw e;
+ }
+ catch (IOException e) {
+ if (!closed)
+ U.warn(log, "Failed to process selector key (will close): " + ses, e);
+
+ close(ses, new GridNioException(e));
+ }
+ }
+ }
+
+ /**
+ * Checks sessions assigned to a selector for timeouts.
+ *
+ * @param keys Keys registered to selector.
+ */
+ private void checkIdle(Iterable<SelectionKey> keys) {
+ long now = U.currentTimeMillis();
+
+ for (SelectionKey key : keys) {
+ GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment();
+
+ try {
+ long writeTimeout0 = writeTimeout;
+
+ // If we are writing and timeout passed.
+ if (key.isValid() && (key.interestOps() & SelectionKey.OP_WRITE) != 0 &&
+ now - ses.lastSendTime() > writeTimeout0) {
+ filterChain.onSessionWriteTimeout(ses);
+
+ // Update timestamp to avoid multiple notifications within one timeout interval.
+ ses.bytesSent(0);
+
+ continue;
+ }
+
+ long idleTimeout0 = idleTimeout;
+
+ if (now - ses.lastReceiveTime() > idleTimeout0 && now - ses.lastSendScheduleTime() > idleTimeout0) {
+ filterChain.onSessionIdleTimeout(ses);
+
+ // Update timestamp to avoid multiple notifications within one timeout interval.
+ ses.resetSendScheduleTime();
+ ses.bytesReceived(0);
+ }
+ }
+ catch (IgniteCheckedException e) {
+ close(ses, e);
+ }
+ }
+ }
+
+ /**
+ * Registers given socket channel to the selector, creates a session and notifies the listener.
+ *
+ * @param req Registration request.
+ */
+ private void register(NioOperationFuture<GridNioSession> req) {
+ assert req != null;
+
+ SocketChannel sockCh = req.socketChannel();
+
+ assert sockCh != null;
+
+ Socket sock = sockCh.socket();
+
+ try {
+ ByteBuffer writeBuf = null;
+ ByteBuffer readBuf = null;
+
+ if (directMode) {
+ writeBuf = directBuf ? ByteBuffer.allocateDirect(sock.getSendBufferSize()) :
+ ByteBuffer.allocate(sock.getSendBufferSize());
+ readBuf = directBuf ? ByteBuffer.allocateDirect(sock.getReceiveBufferSize()) :
+ ByteBuffer.allocate(sock.getReceiveBufferSize());
+
+ writeBuf.order(order);
+ readBuf.order(order);
+ }
+
+ final GridSelectorNioSessionImpl ses = new GridSelectorNioSessionImpl(
+ log,
+ idx,
+ filterChain,
+ (InetSocketAddress)sockCh.getLocalAddress(),
+ (InetSocketAddress)sockCh.getRemoteAddress(),
+ req.accepted(),
+ sndQueueLimit,
+ writeBuf,
+ readBuf);
+
+ Map<Integer, ?> meta = req.meta();
+
+ if (meta != null) {
+ for (Entry<Integer, ?> e : meta.entrySet())
+ ses.addMeta(e.getKey(), e.getValue());
+ }
+
+ SelectionKey key = sockCh.register(selector, SelectionKey.OP_READ, ses);
+
+ ses.key(key);
+
+ if (!ses.accepted())
+ resend(ses);
+
+ sessions.add(ses);
+
+ try {
+ filterChain.onSessionOpened(ses);
+
+ req.onDone(ses);
+ }
+ catch (IgniteCheckedException e) {
+ close(ses, e);
+
+ req.onDone(e);
+ }
+ }
+ catch (ClosedChannelException e) {
+ U.warn(log, "Failed to register accepted socket channel to selector (channel was closed): "
+ + sock.getRemoteSocketAddress(), e);
+ }
+ catch (IOException e) {
+ U.error(log, "Failed to get socket addresses.", e);
+ }
+ }
+
+ /**
+ * Closes the ses and all associated resources, then notifies the listener.
+ *
+ * @param ses Session to be closed.
+ * @param e Exception to be passed to the listener, if any.
+ * @return {@code True} if this call closed the ses.
+ */
+ protected boolean close(final GridSelectorNioSessionImpl ses, @Nullable final IgniteCheckedException e) {
+ if (e != null) {
+ // Print stack trace only if has runtime exception in it's cause.
+ if (e.hasCause(IOException.class))
+ U.warn(log, "Closing NIO session because of unhandled exception [cls=" + e.getClass() +
+ ", msg=" + e.getMessage() + ']');
+ else
+ U.error(log, "Closing NIO session because of unhandled exception.", e);
+ }
+
+ sessions.remove(ses);
+
+ SelectionKey key = ses.key();
+
+ // Shutdown input and output so that remote client will see correct socket close.
+ Socket sock = ((SocketChannel)key.channel()).socket();
+
+ if (ses.setClosed()) {
+ if (directBuf) {
+ if (ses.writeBuffer() != null)
+ ((DirectBuffer)ses.writeBuffer()).cleaner().clean();
+
+ if (ses.readBuffer() != null)
+ ((DirectBuffer)ses.readBuffer()).cleaner().clean();
+ }
+
+ try {
+ try {
+ sock.shutdownInput();
+ }
+ catch (IOException ignored) {
+ // No-op.
+ }
+
+ try {
+ sock.shutdownOutput();
+ }
+ catch (IOException ignored) {
+ // No-op.
+ }
+ }
+ finally {
+ U.close(key, log);
+ U.close(sock, log);
+ }
+
+ if (e != null)
+ filterChain.onExceptionCaught(ses, e);
+
+ try {
+ filterChain.onSessionClosed(ses);
+ }
+ catch (IgniteCheckedException e1) {
+ filterChain.onExceptionCaught(ses, e1);
+ }
+
+ ses.removeMeta(BUF_META_KEY);
+
+ // Since ses is in closed state, no write requests will be added.
+ NioOperationFuture<?> fut = ses.removeMeta(NIO_OPERATION.ordinal());
+
+ GridNioRecoveryDescriptor recovery = ses.recoveryDescriptor();
+
+ if (recovery != null) {
+ try {
+ // Poll will update recovery data.
+ while ((fut = (NioOperationFuture<?>)ses.pollFuture()) != null) {
+ if (fut.skipRecovery())
+ fut.connectionClosed();
+ }
+ }
+ finally {
+ recovery.release();
+ }
+ }
+ else {
+ if (fut != null)
+ fut.connectionClosed();
+
+ while ((fut = (NioOperationFuture<?>)ses.pollFuture()) != null)
+ fut.connectionClosed();
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Processes read-available event on the key.
+ *
+ * @param key Key that is ready to be read.
+ * @throws IOException If key read failed.
+ */
+ protected abstract void processRead(SelectionKey key) throws IOException;
+
+ /**
+ * Processes write-ready event on the key.
+ *
+ * @param key Key that is ready to be written.
+ * @throws IOException If write failed.
+ */
+ protected abstract void processWrite(SelectionKey key) throws IOException;
+ }
+
+ /**
+ * Gets outbound messages queue size.
+ *
+ * @return Write queue size.
+ */
+ public int outboundMessagesQueueSize() {
+ int res = 0;
+
+ for (GridSelectorNioSessionImpl ses : sessions)
+ res += ses.writeQueueSize();
+
+ return res;
+ }
+
+ /**
+ * A separate thread that will accept incoming connections and schedule read to some worker.
+ */
+ private class GridNioAcceptWorker extends GridWorker {
+ /** Selector for this thread. */
+ private Selector selector;
+
+ /**
+ * @param gridName Grid name.
+ * @param name Thread name.
+ * @param log Log.
+ * @param selector Which will accept incoming connections.
+ */
+ protected GridNioAcceptWorker(@Nullable String gridName, String name, IgniteLogger log, Selector selector) {
+ super(gridName, name, log);
+
+ this.selector = selector;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void body() throws InterruptedException, IgniteInterruptedException {
+ try {
+ boolean reset = false;
+
+ while (!closed && !Thread.currentThread().isInterrupted()) {
+ try {
+ if (reset)
+ selector = createSelector(locAddr);
+
+ accept();
+ }
+ catch (IgniteCheckedException e) {
+ if (!Thread.currentThread().isInterrupted()) {
+ U.error(log, "Failed to accept remote connection (will wait for " + ERR_WAIT_TIME + "ms).",
+ e);
+
+ U.sleep(ERR_WAIT_TIME);
+
+ reset = true;
+ }
+ }
+ }
+ }
+ finally {
+ closeSelector(); // Safety.
+ }
+ }
+
+ /**
+ * Accepts connections and schedules them for processing by one of read workers.
+ *
+ * @throws IgniteCheckedException If failed.
+ */
+ private void accept() throws IgniteCheckedException {
+ try {
+ while (!closed && selector.isOpen() && !Thread.currentThread().isInterrupted()) {
+ // Wake up every 2 seconds to check if closed.
+ if (selector.select(2000) > 0)
+ // Walk through the ready keys collection and process date requests.
+ processSelectedKeys(selector.selectedKeys());
+ }
+ }
+ // Ignore this exception as thread interruption is equal to 'close' call.
+ catch (ClosedByInterruptException e) {
+ if (log.isDebugEnabled())
+ log.debug("Closing selector due to thread interruption [srvr=" + this +
+ ", err=" + e.getMessage() + ']');
+ }
+ catch (ClosedSelectorException e) {
+ throw new IgniteCheckedException("Selector got closed while active: " + this, e);
+ }
+ catch (IOException e) {
+ throw new IgniteCheckedException("Failed to accept connection: " + this, e);
+ }
+ finally {
+ closeSelector();
+ }
+ }
+
+ /**
+ * Close selector if needed.
+ */
+ private void closeSelector() {
+ if (selector.isOpen()) {
+ if (log.isDebugEnabled())
+ log.debug("Closing all listening sockets.");
+
+ // Close all channels registered with selector.
+ for (SelectionKey key : selector.keys())
+ U.close(key.channel(), log);
+
+ if (log.isDebugEnabled())
+ log.debug("Closing NIO selector.");
+
+ U.close(selector, log);
+ }
+ }
+
+ /**
+ * Processes selected accept requests for server socket.
+ *
+ * @param keys Selected keys from acceptor.
+ * @throws IOException If accept failed or IOException occurred while configuring channel.
+ */
+ private void processSelectedKeys(Set<SelectionKey> keys) throws IOException {
+ if (log.isDebugEnabled())
+ log.debug("Processing keys in accept worker: " + keys.size());
+
+ for (Iterator<SelectionKey> iter = keys.iterator(); iter.hasNext();) {
+ SelectionKey key = iter.next();
+
+ iter.remove();
+
+ // Was key closed?
+ if (!key.isValid())
+ continue;
+
+ if (key.isAcceptable()) {
+ // The key indexes into the selector so we
+ // can retrieve the socket that's ready for I/O
+ ServerSocketChannel srvrCh = (ServerSocketChannel)key.channel();
+
+ SocketChannel sockCh = srvrCh.accept();
+
+ sockCh.configureBlocking(false);
+ sockCh.socket().setTcpNoDelay(tcpNoDelay);
+ sockCh.socket().setKeepAlive(true);
+
+ if (sockSndBuf > 0)
+ sockCh.socket().setSendBufferSize(sockSndBuf);
+
+ if (sockRcvBuf > 0)
+ sockCh.socket().setReceiveBufferSize(sockRcvBuf);
+
+ if (log.isDebugEnabled())
+ log.debug("Accepted new client connection: " + sockCh.socket().getRemoteSocketAddress());
+
+ addRegistrationReq(sockCh);
+ }
+ }
+ }
+
+ /**
+ * Adds registration request for a given socket channel to the next selector. Next selector
+ * is selected according to a round-robin algorithm.
+ *
+ * @param sockCh Socket channel to be registered on one of the selectors.
+ */
+ private void addRegistrationReq(SocketChannel sockCh) {
+ offerBalanced(new NioOperationFuture(sockCh));
+ }
+ }
+
+ /**
+ * Asynchronous operation that may be requested on selector.
+ */
+ private enum NioOperation {
+ /** Register read key selection. */
+ REGISTER,
+
+ /** Register write key selection. */
+ REQUIRE_WRITE,
+
+ /** Close key. */
+ CLOSE,
+
+ /** Pause read. */
+ PAUSE_READ,
+
+ /** Resume read. */
+ RESUME_READ
+ }
+
+ /**
+ * Class for requesting write and session close operations.
+ */
+ private static class NioOperationFuture<R> extends GridNioFutureImpl<R> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Socket channel in register request. */
+ @GridToStringExclude
+ private SocketChannel sockCh;
+
+ /** Session to perform operation on. */
+ private GridSelectorNioSessionImpl ses;
+
+ /** Is it a close request or a write request. */
+ private NioOperation op;
+
+ /** Message. */
+ private ByteBuffer msg;
+
+ /** Direct message. */
+ private GridTcpCommunicationMessageAdapter commMsg;
+
+ /** */
+ private boolean accepted;
+
+ /** */
+ private Map<Integer, ?> meta;
+
+ /**
+ * Creates registration request for a given socket channel.
+ *
+ * @param sockCh Socket channel to register on selector.
+ */
+ NioOperationFuture(SocketChannel sockCh) {
+ this(sockCh, true, null);
+ }
+
+ /**
+ * @param sockCh Socket channel.
+ * @param accepted {@code True} if socket has been accepted.
+ * @param meta Optional meta.
+ */
+ NioOperationFuture(
+ SocketChannel sockCh,
+ boolean accepted,
+ @Nullable Map<Integer, ?> meta
+ ) {
+ op = NioOperation.REGISTER;
+
+ this.sockCh = sockCh;
+ this.accepted = accepted;
+ this.meta = meta;
+ }
+
+ /**
+ * Creates change request.
+ *
+ * @param ses Session to change.
+ * @param op Requested operation.
+ */
+ NioOperationFuture(GridSelectorNioSessionImpl ses, NioOperation op) {
+ assert ses != null;
+ assert op != null;
+ assert op != NioOperation.REGISTER;
+
+ this.ses = ses;
+ this.op = op;
+ }
+
+ /**
+ * Creates change request.
+ *
+ * @param ses Session to change.
+ * @param op Requested operation.
+ * @param msg Message.
+ */
+ NioOperationFuture(GridSelectorNioSessionImpl ses, NioOperation op,
+ ByteBuffer msg) {
+ assert ses != null;
+ assert op != null;
+ assert op != NioOperation.REGISTER;
+ assert msg != null;
+
+ this.ses = ses;
+ this.op = op;
+ this.msg = msg;
+ }
+
+ /**
+ * Creates change request.
+ *
+ * @param ses Session to change.
+ * @param op Requested operation.
+ * @param commMsg Direct message.
+ */
+ NioOperationFuture(GridSelectorNioSessionImpl ses, NioOperation op,
+ GridTcpCommunicationMessageAdapter commMsg) {
+ assert ses != null;
+ assert op != null;
+ assert op != NioOperation.REGISTER;
+ assert commMsg != null;
+
+ this.ses = ses;
+ this.op = op;
+ this.commMsg = commMsg;
+ }
+
+ /**
+ * @return Requested change operation.
+ */
+ private NioOperation operation() {
+ return op;
+ }
+
+ /**
+ * @return Message.
+ */
+ private ByteBuffer message() {
+ return msg;
+ }
+
+ /**
+ * @return Direct message.
+ */
+ private GridTcpCommunicationMessageAdapter directMessage() {
+ return commMsg;
+ }
+
+ /**
+ * @param ses New session instance.
+ */
+ private void resetMessage(GridSelectorNioSessionImpl ses) {
+ assert commMsg != null;
+
+ commMsg = commMsg.clone();
+
+ this.ses = ses;
+ }
+
+ /**
+ * @return Socket channel for register request.
+ */
+ private SocketChannel socketChannel() {
+ return sockCh;
+ }
+
+ /**
+ * @return Session for this change request.
+ */
+ private GridSelectorNioSessionImpl session() {
+ return ses;
+ }
+
+ /**
+ * @return {@code True} if connection has been accepted.
+ */
+ boolean accepted() {
+ return accepted;
+ }
+
+ /**
+ * @return Meta.
+ */
+ public Map<Integer, ?> meta() {
+ return meta;
+ }
+
+ /**
+ * Applicable to write futures only. Fails future with corresponding IOException.
+ */
+ private void connectionClosed() {
+ assert op == NioOperation.REQUIRE_WRITE;
+ assert ses != null;
+
+ onDone(new IOException("Failed to send message (connection was closed): " + ses));
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean skipRecovery() {
+ return commMsg != null && commMsg.skipRecovery();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(NioOperationFuture.class, this);
+ }
+ }
+
+ /**
+ * Filter forwarding messages from chain's head to this server.
+ */
+ private class HeadFilter extends GridNioFilterAdapter {
+ /**
+ * Assigns filter name.
+ */
+ protected HeadFilter() {
+ super("HeadFilter");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onSessionOpened(GridNioSession ses) throws IgniteCheckedException {
+ if (directMode && sslFilter != null)
+ ses.addMeta(BUF_SSL_SYSTEM_META_KEY, new ConcurrentLinkedDeque8<>());
+
+ proceedSessionOpened(ses);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onSessionClosed(GridNioSession ses) throws IgniteCheckedException {
+ proceedSessionClosed(ses);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onExceptionCaught(GridNioSession ses, IgniteCheckedException ex) throws IgniteCheckedException {
+ proceedExceptionCaught(ses, ex);
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridNioFuture<?> onSessionWrite(GridNioSession ses, Object msg) {
+ if (directMode) {
+ boolean sslSys = sslFilter != null && msg instanceof ByteBuffer;
+
+ if (sslSys) {
+ ConcurrentLinkedDeque8<ByteBuffer> queue = ses.meta(BUF_SSL_SYSTEM_META_KEY);
+
+ queue.offer((ByteBuffer)msg);
+
+ SelectionKey key = ((GridSelectorNioSessionImpl)ses).key();
+
+ if (key.isValid())
+ key.interestOps(key.interestOps() | SelectionKey.OP_WRITE);
+
+ return null;
+ }
+ else
+ return send(ses, (GridTcpCommunicationMessageAdapter)msg);
+ }
+ else
+ return send(ses, (ByteBuffer)msg);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onMessageReceived(GridNioSession ses, Object msg) throws IgniteCheckedException {
+ proceedMessageReceived(ses, msg);
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridNioFuture<Boolean> onSessionClose(GridNioSession ses) {
+ return close(ses);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onSessionIdleTimeout(GridNioSession ses) throws IgniteCheckedException {
+ proceedSessionIdleTimeout(ses);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onSessionWriteTimeout(GridNioSession ses) throws IgniteCheckedException {
+ proceedSessionWriteTimeout(ses);
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridNioFuture<?> onPauseReads(GridNioSession ses) throws IgniteCheckedException {
+ return pauseResumeReads(ses, NioOperation.PAUSE_READ);
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridNioFuture<?> onResumeReads(GridNioSession ses) throws IgniteCheckedException {
+ return pauseResumeReads(ses, NioOperation.RESUME_READ);
+ }
+ }
+
+ /**
+ * Constructs a new instance of {@link GridNioServer}.
+ */
+ @SuppressWarnings("PublicInnerClass")
+ public static class Builder<T> {
+ /** Empty filters. */
+ private static final GridNioFilter[] EMPTY_FILTERS = new GridNioFilter[0];
+
+ /** Local address. */
+ private InetAddress addr;
+
+ /** Local port. */
+ private int port;
+
+ /** Logger. */
+ private IgniteLogger log;
+
+ /** Selector count. */
+ private int selectorCnt;
+
+ /** Grid name. */
+ private String gridName;
+
+ /** TCP_NO_DELAY flag. */
+ private boolean tcpNoDelay;
+
+ /** Direct buffer flag. */
+ private boolean directBuf;
+
+ /** Byte order. */
+ private ByteOrder byteOrder = ByteOrder.nativeOrder();
+
+ /** NIO server listener. */
+ private GridNioServerListener<T> lsnr;
+
+ /** Send buffer size. */
+ private int sockSndBufSize;
+
+ /** Receive buffer size. */
+ private int sockRcvBufSize;
+
+ /** Send queue limit. */
+ private int sndQueueLimit = DFLT_SEND_QUEUE_LIMIT;
+
+ /** Whether direct mode is used. */
+ private boolean directMode;
+
+ /** Metrics listener. */
+ private GridNioMetricsListener metricsLsnr;
+
- /** Message writer. */
- private GridNioMessageWriter msgWriter;
-
+ /** NIO filters. */
+ private GridNioFilter[] filters;
+
+ /** Idle timeout. */
+ private long idleTimeout = -1;
+
+ /** Write timeout. */
+ private long writeTimeout = -1;
+
+ /** Daemon flag. */
+ private boolean daemon;
+
+ /**
+ * Finishes building the instance.
+ *
+ * @return Final instance of {@link GridNioServer}.
+ * @throws IgniteCheckedException If NIO client worker creation failed or address is already in use.
+ */
+ public GridNioServer<T> build() throws IgniteCheckedException {
+ GridNioServer<T> ret = new GridNioServer<>(
+ addr,
+ port,
+ log,
+ selectorCnt,
+ gridName,
+ tcpNoDelay,
+ directBuf,
+ byteOrder,
+ lsnr,
+ sockSndBufSize,
+ sockRcvBufSize,
+ sndQueueLimit,
+ directMode,
+ daemon,
+ metricsLsnr,
- msgWriter,
+ filters != null ? Arrays.copyOf(filters, filters.length) : EMPTY_FILTERS
+ );
+
+ if (idleTimeout >= 0)
+ ret.idleTimeout(idleTimeout);
+
+ if (writeTimeout >= 0)
+ ret.writeTimeout(writeTimeout);
+
+ return ret;
+ }
+
+ /**
+ * @param addr Local address.
+ * @return This for chaining.
+ */
+ public Builder<T> address(InetAddress addr) {
+ this.addr = addr;
+
+ return this;
+ }
+
+ /**
+ * @param port Local port. If {@code -1} passed then server will not be
+ * accepting connections and only outgoing connections will be possible.
+ * @return This for chaining.
+ */
+ public Builder<T> port(int port) {
+ this.port = port;
+
+ return this;
+ }
+
+ /**
+ * @param log Logger.
+ * @return This for chaining.
+ */
+ public Builder<T> logger(IgniteLogger log) {
+ this.log = log;
+
+ return this;
+ }
+
+ /**
+ * @param selectorCnt Selector count.
+ * @return This for chaining.
+ */
+ public Builder<T> selectorCount(int selectorCnt) {
+ this.selectorCnt = selectorCnt;
+
+ return this;
+ }
+
+ /**
+ * @param gridName Grid name.
+ * @return This for chaining.
+ */
+ public Builder<T> gridName(@Nullable String gridName) {
+ this.gridName = gridName;
+
+ return this;
+ }
+
+ /**
+ * @param tcpNoDelay If TCP_NODELAY option should be set to accepted sockets.
+ * @return This for chaining.
+ */
+ public Builder<T> tcpNoDelay(boolean tcpNoDelay) {
+ this.tcpNoDelay = tcpNoDelay;
+
+ return this;
+ }
+
+ /**
+ * @param directBuf Whether to use direct buffer.
+ * @return This for chaining.
+ */
+ public Builder<T> directBuffer(boolean directBuf) {
+ this.directBuf = directBuf;
+
+ return this;
+ }
+
+ /**
+ * @param byteOrder Byte order to use.
+ * @return This for chaining.
+ */
+ public Builder<T> byteOrder(ByteOrder byteOrder) {
+ this.byteOrder = byteOrder;
+
+ return this;
+ }
+
+ /**
+ * @param lsnr NIO server listener.
+ * @return This for chaining.
+ */
+ public Builder<T> listener(GridNioServerListener<T> lsnr) {
+ this.lsnr = lsnr;
+
+ return this;
+ }
+
+ /**
+ * @param sockSndBufSize Socket send buffer size.
+ * @return This for chaining.
+ */
+ public Builder<T> socketSendBufferSize(int sockSndBufSize) {
+ this.sockSndBufSize = sockSndBufSize;
+
+ return this;
+ }
+
+ /**
+ * @param sockRcvBufSize Socket receive buffer size.
+ * @return This for chaining.
+ */
+ public Builder<T> socketReceiveBufferSize(int sockRcvBufSize) {
+ this.sockRcvBufSize = sockRcvBufSize;
+
+ return this;
+ }
+
+ /**
+ * @param sndQueueLimit Send queue limit.
+ * @return This for chaining.
+ */
+ public Builder<T> sendQueueLimit(int sndQueueLimit) {
+ this.sndQueueLimit = sndQueueLimit;
+
+ return this;
+ }
+
+ /**
+ * @param directMode Whether direct mode is used.
+ * @return This for chaining.
+ */
+ public Builder<T> directMode(boolean directMode) {
+ this.directMode = directMode;
+
+ return this;
+ }
+
+ /**
+ * @param metricsLsnr Metrics listener.
+ * @return This for chaining.
+ */
+ public Builder<T> metricsListener(GridNioMetricsListener metricsLsnr) {
+ this.metricsLsnr = metricsLsnr;
+
+ return this;
+ }
+
+ /**
- * @param msgWriter Message writer.
- * @return This for chaining.
- */
- public Builder<T> messageWriter(GridNioMessageWriter msgWriter) {
- this.msgWriter = msgWriter;
-
- return this;
- }
-
- /**
+ * @param filters NIO filters.
+ * @return This for chaining.
+ */
+ public Builder<T> filters(GridNioFilter... filters) {
+ this.filters = filters;
+
+ return this;
+ }
+
+ /**
+ * @param idleTimeout Idle timeout.
+ * @return This for chaining.
+ */
+ public Builder<T> idleTimeout(long idleTimeout) {
+ this.idleTimeout = idleTimeout;
+
+ return this;
+ }
+
+ /**
+ * @param writeTimeout Write timeout.
+ * @return This for chaining.
+ */
+ public Builder<T> writeTimeout(long writeTimeout) {
+ this.writeTimeout = writeTimeout;
+
+ return this;
+ }
+
+ /**
+ * @param daemon Daemon flag to create threads.
+ * @return This for chaining.
+ */
+ public Builder<T> daemon(boolean daemon) {
+ this.daemon = daemon;
+
+ return this;
+ }
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3dbb6acc/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridShmemCommunicationClient.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridShmemCommunicationClient.java
index 0000000,5cbc506..1b07b5e
mode 000000,100644..100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridShmemCommunicationClient.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridShmemCommunicationClient.java
@@@ -1,0 -1,148 +1,140 @@@
+ /*
+ * 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.util.nio;
+
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.util.direct.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.apache.ignite.internal.util.ipc.shmem.*;
+ import org.jetbrains.annotations.*;
+ import org.apache.ignite.internal.util.lang.*;
+
+ import java.io.*;
+ import java.nio.*;
+ import java.util.*;
+
+ /**
+ *
+ */
+ public class GridShmemCommunicationClient extends GridAbstractCommunicationClient {
+ /** */
+ private final IpcSharedMemoryClientEndpoint shmem;
+
+ /** */
+ private final ByteBuffer writeBuf;
+
- /** */
- private final GridNioMessageWriter msgWriter;
-
+ /**
+ * @param metricsLsnr Metrics listener.
+ * @param port Shared memory IPC server port.
+ * @param connTimeout Connection timeout.
+ * @param log Logger.
- * @param msgWriter Message writer.
+ * @throws IgniteCheckedException If failed.
+ */
- public GridShmemCommunicationClient(GridNioMetricsListener metricsLsnr, int port, long connTimeout, IgniteLogger log,
- GridNioMessageWriter msgWriter)
- throws IgniteCheckedException {
++ public GridShmemCommunicationClient(GridNioMetricsListener metricsLsnr, int port, long connTimeout,
++ IgniteLogger log) throws IgniteCheckedException {
+ super(metricsLsnr);
+
+ assert metricsLsnr != null;
- assert msgWriter != null;
+ assert port > 0 && port < 0xffff;
+ assert connTimeout >= 0;
+
+ shmem = new IpcSharedMemoryClientEndpoint(port, (int)connTimeout, log);
+
- this.msgWriter = msgWriter;
-
+ writeBuf = ByteBuffer.allocate(8 << 10);
+
+ writeBuf.order(ByteOrder.nativeOrder());
+ }
+
+ /** {@inheritDoc} */
+ @Override public synchronized void doHandshake(IgniteInClosure2X<InputStream, OutputStream> handshakeC)
+ throws IgniteCheckedException {
+ handshakeC.applyx(shmem.inputStream(), shmem.outputStream());
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean close() {
+ boolean res = super.close();
+
+ if (res)
+ shmem.close();
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void forceClose() {
+ super.forceClose();
+
+ // Do not call forceClose() here.
+ shmem.close();
+ }
+
+ /** {@inheritDoc} */
+ @Override public synchronized void sendMessage(byte[] data, int len) throws IgniteCheckedException {
+ if (closed())
+ throw new IgniteCheckedException("Communication client was closed: " + this);
+
+ try {
+ shmem.outputStream().write(data, 0, len);
+
+ metricsLsnr.onBytesSent(len);
+ }
+ catch (IOException e) {
+ throw new IgniteCheckedException("Failed to send message to remote node: " + shmem, e);
+ }
+
+ markUsed();
+ }
+
+ /** {@inheritDoc} */
+ @Override public synchronized boolean sendMessage(@Nullable UUID nodeId, GridTcpCommunicationMessageAdapter msg)
+ throws IgniteCheckedException {
+ if (closed())
+ throw new IgniteCheckedException("Communication client was closed: " + this);
+
+ assert writeBuf.hasArray();
+
+ try {
- int cnt = msgWriter.writeFully(nodeId, msg, shmem.outputStream(), writeBuf);
++ int cnt = U.writeMessageFully(msg, shmem.outputStream(), writeBuf);
+
+ metricsLsnr.onBytesSent(cnt);
+ }
+ catch (IOException e) {
+ throw new IgniteCheckedException("Failed to send message to remote node: " + shmem, e);
+ }
+
+ markUsed();
+
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void sendMessage(ByteBuffer data) throws IgniteCheckedException {
+ throw new UnsupportedOperationException();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void flushIfNeeded(long timeout) throws IOException {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridShmemCommunicationClient.class, this, super.toString());
+ }
+ }
[20/52] [abbrv] incubator-ignite git commit: Merge branch 'sprint-1'
of https://git-wip-us.apache.org/repos/asf/incubator-ignite into sprint-1
Posted by vk...@apache.org.
Merge branch 'sprint-1' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into sprint-1
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4009aaa3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4009aaa3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4009aaa3
Branch: refs/heads/ignite-61
Commit: 4009aaa35cba35752b80d39c03d3b5a87fdf4041
Parents: 9900ae4 7eebc7e
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jan 29 18:14:21 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jan 29 18:14:21 2015 +0300
----------------------------------------------------------------------
ipc/shmem/Makefile.am | 2 +-
ipc/shmem/Makefile.in | 2 +-
ipc/shmem/configure | 4 +-
ipc/shmem/configure.ac | 2 +-
ipc/shmem/ggshmem/Makefile.am | 23 -
ipc/shmem/ggshmem/Makefile.in | 589 --
..._util_ipc_shmem_GridIpcSharedMemoryUtils.cpp | 882 --
ipc/shmem/igniteshmem/Makefile.am | 23 +
ipc/shmem/igniteshmem/Makefile.in | 589 ++
...rnal_util_ipc_shmem_IpcSharedMemoryUtils.cpp | 882 ++
ipc/shmem/include/Makefile.am | 2 +-
ipc/shmem/include/Makefile.in | 2 +-
...ternal_util_ipc_shmem_IpcSharedMemoryUtils.h | 117 +
...id_util_ipc_shmem_GridIpcSharedMemoryUtils.h | 117 -
ipc/shmem/readme.txt | 9 +-
.../spi/checkpoint/s3/S3CheckpointSpi.java | 4 +-
.../ClientAbstractMultiThreadedSelfTest.java | 2 +-
.../ClientPropertiesConfigurationSelfTest.java | 4 +-
.../ClientAbstractMultiNodeSelfTest.java | 4 +-
.../rest/RestBinaryProtocolSelfTest.java | 2 +-
.../rest/TaskCommandHandlerSelfTest.java | 2 +-
.../java/META-INF/native/linux64/libggshmem.so | Bin 138023 -> 0 bytes
.../META-INF/native/linux64/libigniteshmem.so | Bin 0 -> 138345 bytes
.../java/META-INF/native/osx/libggshmem.dylib | Bin 32940 -> 0 bytes
.../META-INF/native/osx/libigniteshmem.dylib | Bin 0 -> 33116 bytes
.../apache/ignite/IgniteCheckedException.java | 2 +-
.../java/org/apache/ignite/IgniteException.java | 2 +-
.../main/java/org/apache/ignite/Ignition.java | 38 +-
.../apache/ignite/cache/CachingProvider.java | 2 +-
.../ignite/fs/mapreduce/IgniteFsTask.java | 2 +-
.../ignite/internal/ClusterGroupAdapter.java | 2 +-
.../internal/ClusterNodeLocalMapImpl.java | 2 +-
.../java/org/apache/ignite/internal/GridEx.java | 143 -
.../org/apache/ignite/internal/GridGainEx.java | 2399 -----
.../org/apache/ignite/internal/GridKernal.java | 3322 -------
.../ignite/internal/GridKernalContext.java | 2 +-
.../ignite/internal/GridKernalContextImpl.java | 8 +-
.../apache/ignite/internal/GridLoggerProxy.java | 2 +-
.../ignite/internal/GridUpdateNotifier.java | 2 +-
.../ignite/internal/IgniteClusterAsyncImpl.java | 4 +-
.../org/apache/ignite/internal/IgniteEx.java | 143 +
.../apache/ignite/internal/IgniteKernal.java | 3322 +++++++
.../org/apache/ignite/internal/IgnitionEx.java | 2396 +++++
.../processors/affinity/GridAffinityUtils.java | 2 +-
.../processors/cache/GridCacheAdapter.java | 8 +-
.../processors/cache/GridCacheContext.java | 4 +-
.../cache/GridCacheDeploymentManager.java | 2 +-
.../cache/GridCacheMvccCandidate.java | 4 +-
.../processors/cache/IgniteCacheProxy.java | 22 +-
.../GridCacheDataStructuresManager.java | 4 +-
.../cache/query/GridCacheQueryManager.java | 2 +-
.../jdbc/GridCacheQueryJdbcMetadataTask.java | 2 +-
.../query/jdbc/GridCacheQueryJdbcTask.java | 2 +-
.../dr/GridDrDataLoadCacheUpdater.java | 2 +-
.../internal/processors/fs/GridGgfsImpl.java | 2 +-
.../internal/processors/fs/GridGgfsServer.java | 26 +-
.../processors/fs/GridGgfsServerManager.java | 8 +-
.../processors/fs/IgniteFsNoopProcessor.java | 2 +-
.../processors/fs/IgniteFsProcessor.java | 4 +-
.../processors/fs/IgniteFsProcessorAdapter.java | 2 +-
.../resource/GridResourceProcessor.java | 2 +-
.../resource/GridSpringResourceContext.java | 2 +-
.../handlers/cache/GridCacheCommandHandler.java | 6 +-
.../handlers/task/GridTaskCommandHandler.java | 2 +-
.../service/GridServiceProcessor.java | 2 +-
.../processors/service/GridServiceProxy.java | 2 +-
.../apache/ignite/internal/util/GridUtils.java | 9100 -----------------
.../ignite/internal/util/IgniteUtils.java | 9141 ++++++++++++++++++
.../internal/util/ipc/GridIpcEndpoint.java | 49 -
.../util/ipc/GridIpcEndpointBindException.java | 47 -
.../util/ipc/GridIpcEndpointFactory.java | 84 -
.../internal/util/ipc/GridIpcEndpointType.java | 29 -
.../util/ipc/GridIpcServerEndpoint.java | 73 -
.../ipc/GridIpcServerEndpointDeserializer.java | 66 -
.../internal/util/ipc/GridIpcToNioAdapter.java | 250 -
.../ignite/internal/util/ipc/IpcEndpoint.java | 49 +
.../util/ipc/IpcEndpointBindException.java | 47 +
.../internal/util/ipc/IpcEndpointFactory.java | 84 +
.../internal/util/ipc/IpcEndpointType.java | 29 +
.../internal/util/ipc/IpcServerEndpoint.java | 73 +
.../util/ipc/IpcServerEndpointDeserializer.java | 66 +
.../internal/util/ipc/IpcToNioAdapter.java | 250 +
.../ipc/loopback/GridIpcClientTcpEndpoint.java | 87 -
.../ipc/loopback/GridIpcServerTcpEndpoint.java | 179 -
.../util/ipc/loopback/IpcClientTcpEndpoint.java | 87 +
.../util/ipc/loopback/IpcServerTcpEndpoint.java | 179 +
.../GridIpcOutOfSystemResourcesException.java | 59 -
.../GridIpcSharedMemoryClientEndpoint.java | 336 -
.../shmem/GridIpcSharedMemoryInitRequest.java | 67 -
.../shmem/GridIpcSharedMemoryInitResponse.java | 171 -
.../shmem/GridIpcSharedMemoryInputStream.java | 99 -
.../shmem/GridIpcSharedMemoryNativeLoader.java | 242 -
...cSharedMemoryOperationTimedoutException.java | 59 -
.../shmem/GridIpcSharedMemoryOutputStream.java | 80 -
.../GridIpcSharedMemoryServerEndpoint.java | 707 --
.../ipc/shmem/GridIpcSharedMemorySpace.java | 374 -
.../ipc/shmem/GridIpcSharedMemoryUtils.java | 242 -
.../shmem/IpcOutOfSystemResourcesException.java | 59 +
.../shmem/IpcSharedMemoryClientEndpoint.java | 336 +
.../ipc/shmem/IpcSharedMemoryInitRequest.java | 67 +
.../ipc/shmem/IpcSharedMemoryInitResponse.java | 171 +
.../ipc/shmem/IpcSharedMemoryInputStream.java | 99 +
.../ipc/shmem/IpcSharedMemoryNativeLoader.java | 261 +
...cSharedMemoryOperationTimedoutException.java | 59 +
.../ipc/shmem/IpcSharedMemoryOutputStream.java | 80 +
.../shmem/IpcSharedMemoryServerEndpoint.java | 707 ++
.../util/ipc/shmem/IpcSharedMemorySpace.java | 374 +
.../util/ipc/shmem/IpcSharedMemoryUtils.java | 242 +
.../util/nio/GridShmemCommunicationClient.java | 4 +-
.../internal/util/typedef/internal/U.java | 4 +-
.../apache/ignite/internal/visor/VisorJob.java | 2 +-
.../internal/visor/VisorMultiNodeTask.java | 2 +-
.../ignite/internal/visor/cache/VisorCache.java | 2 +-
.../compute/VisorComputeMonitoringHolder.java | 10 +-
.../visor/misc/VisorResolveHostNameTask.java | 2 +-
.../visor/node/VisorBasicConfiguration.java | 2 +-
.../visor/node/VisorGridConfiguration.java | 2 +-
.../visor/node/VisorNodeDataCollectorJob.java | 6 +-
.../internal/visor/query/VisorQueryTask.java | 2 +-
.../internal/visor/query/VisorQueryUtils.java | 4 +-
.../ignite/lang/IgniteAsyncSupportAdapter.java | 27 +-
.../optimized/IgniteOptimizedMarshaller.java | 2 +-
.../communication/tcp/TcpCommunicationSpi.java | 24 +-
.../StreamerCacheAffinityEventRouter.java | 2 +-
.../ignite/GridExceptionHelpLinksSelfTest.java | 106 -
.../ignite/GridExternalizableAbstractTest.java | 41 -
.../IgniteExceptionHelpLinksSelfTest.java | 105 +
.../IgniteExternalizableAbstractTest.java | 41 +
...CachePartitionFairAffinityNodesSelfTest.java | 6 +-
...CacheJdbcBlobStoreMultithreadedSelfTest.java | 2 +-
.../fs/GridGgfsEventsAbstractSelfTest.java | 2 +-
.../ignite/fs/GridGgfsFragmentizerSelfTest.java | 2 +-
.../internal/GridDiscoveryEventSelfTest.java | 3 +-
.../ignite/internal/GridDiscoverySelfTest.java | 4 +-
.../GridEventStorageCheckAllEventsSelfTest.java | 2 +-
.../internal/GridExecutorServiceTest.java | 315 -
.../GridExplicitImplicitDeploymentSelfTest.java | 476 -
.../ignite/internal/GridKernalTestUtils.java | 3 +-
.../internal/GridListenActorSelfTest.java | 3 +-
.../GridTopicExternalizableSelfTest.java | 3 +-
.../GridTopologyBuildVersionSelfTest.java | 2 +-
.../internal/GridUpdateNotifierSelfTest.java | 3 +-
.../internal/IgniteExecutorServiceTest.java | 315 +
...gniteExplicitImplicitDeploymentSelfTest.java | 476 +
.../GridCheckpointManagerAbstractSelfTest.java | 2 +-
.../GridCommunicationSendMessageSelfTest.java | 4 +-
.../GridDiscoveryManagerAliveCacheSelfTest.java | 2 +-
.../discovery/GridDiscoveryManagerSelfTest.java | 6 +-
.../swapspace/GridSwapSpaceManagerSelfTest.java | 2 +-
.../GridAffinityProcessorAbstractSelfTest.java | 6 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 4 +-
.../cache/GridCacheAbstractMetricsSelfTest.java | 10 +-
.../cache/GridCacheAbstractSelfTest.java | 2 +-
.../cache/GridCacheAffinityApiSelfTest.java | 4 +-
.../GridCacheConcurrentTxMultiNodeTest.java | 4 +-
.../cache/GridCacheEntryVersionSelfTest.java | 4 +-
.../GridCacheFinishPartitionsSelfTest.java | 4 +-
.../GridCacheGroupLockAbstractSelfTest.java | 4 +-
.../processors/cache/GridCacheLeakTest.java | 2 +-
...GridCacheMixedPartitionExchangeSelfTest.java | 2 +-
.../cache/GridCacheMultiUpdateLockSelfTest.java | 2 +-
.../cache/GridCacheMvccFlagsTest.java | 4 +-
.../cache/GridCacheMvccManagerSelfTest.java | 4 +-
.../cache/GridCacheMvccPartitionedSelfTest.java | 4 +-
.../processors/cache/GridCacheMvccSelfTest.java | 4 +-
.../cache/GridCacheNestedTxAbstractTest.java | 2 +-
.../cache/GridCacheObjectToStringSelfTest.java | 2 +-
.../GridCacheOrderedPreloadingSelfTest.java | 2 +-
.../cache/GridCacheP2PUndeploySelfTest.java | 6 +-
.../cache/GridCachePartitionedGetSelfTest.java | 2 +-
.../GridCachePreloadingEvictionsSelfTest.java | 6 +-
.../GridCacheQueryInternalKeysSelfTest.java | 2 +-
.../GridCacheReturnValueTransferSelfTest.java | 2 +-
.../cache/GridCacheSlowTxWarnTest.java | 4 +-
.../cache/GridCacheStoreValueBytesSelfTest.java | 4 +-
.../cache/GridCacheSwapReloadSelfTest.java | 2 +-
.../cache/GridCacheTtlManagerLoadTest.java | 2 +-
.../cache/GridCacheTtlManagerSelfTest.java | 2 +-
.../IgniteCacheEntryListenerAbstractTest.java | 2 +-
.../cache/IgniteCacheInvokeAbstractTest.java | 4 +-
.../processors/cache/IgniteTxAbstractTest.java | 2 +-
.../IgniteTxConcurrentGetAbstractTest.java | 3 +-
.../IgniteTxExceptionAbstractSelfTest.java | 2 +-
.../cache/IgniteTxMultiNodeAbstractTest.java | 6 +-
.../IgniteTxStoreExceptionAbstractSelfTest.java | 2 +-
...actQueueFailoverDataConsistencySelfTest.java | 2 +-
.../GridCacheCountDownLatchSelfTest.java | 2 +-
.../GridCacheQueueCleanupSelfTest.java | 2 +-
.../GridCacheSetAbstractSelfTest.java | 8 +-
.../GridCacheSetFailoverAbstractSelfTest.java | 2 +-
.../GridCacheAtomicTimeoutSelfTest.java | 2 +-
.../distributed/GridCacheEventAbstractTest.java | 2 +-
...heExpiredEntriesPreloadAbstractSelfTest.java | 2 +-
.../GridCacheMultiNodeLockAbstractTest.java | 2 +-
...iteTxConsistencyRestartAbstractSelfTest.java | 4 +-
...xOriginatingNodeFailureAbstractSelfTest.java | 10 +-
...cOriginatingNodeFailureAbstractSelfTest.java | 20 +-
.../dht/GridCacheAtomicNearCacheSelfTest.java | 2 +-
.../dht/GridCacheColocatedDebugTest.java | 6 +-
.../dht/GridCacheDhtEntrySelfTest.java | 2 +-
...GridCacheDhtEvictionNearReadersSelfTest.java | 4 +-
.../dht/GridCacheDhtEvictionSelfTest.java | 4 +-
.../dht/GridCacheDhtMappingSelfTest.java | 2 +-
.../dht/GridCacheDhtPreloadDelayedSelfTest.java | 2 +-
.../GridCacheDhtPreloadStartStopSelfTest.java | 2 +-
...dCachePartitionedTopologyChangeSelfTest.java | 32 +-
...itionedTxOriginatingNodeFailureSelfTest.java | 8 +-
...eAtomicInvalidPartitionHandlingSelfTest.java | 2 +-
.../atomic/GridCacheAtomicPreloadSelfTest.java | 4 +-
...GridCacheValueConsistencyAtomicSelfTest.java | 2 +-
.../near/GridCacheNearMultiNodeSelfTest.java | 6 +-
.../near/GridCacheNearReadersSelfTest.java | 4 +-
.../near/GridCacheNearTxMultiNodeSelfTest.java | 2 +-
.../GridCachePartitionedFullApiSelfTest.java | 4 +-
...achePartitionedMultiNodeCounterSelfTest.java | 2 +-
.../GridCachePartitionedProjectionSelfTest.java | 4 +-
.../GridCachePartitionedTxSalvageSelfTest.java | 2 +-
.../IgniteCacheExpiryPolicyAbstractTest.java | 2 +-
...ridCacheContinuousQueryAbstractSelfTest.java | 4 +-
.../clock/GridTimeSyncProcessorSelfTest.java | 6 +-
.../continuous/GridEventConsumeSelfTest.java | 2 +-
.../processors/fs/GridGgfsAbstractSelfTest.java | 2 +-
.../processors/fs/GridGgfsModesSelfTest.java | 4 +-
.../fs/GridGgfsProcessorSelfTest.java | 2 +-
...IpcEndpointRegistrationAbstractSelfTest.java | 6 +-
...pcEndpointRegistrationOnWindowsSelfTest.java | 4 +-
.../processors/fs/GridGgfsSizeSelfTest.java | 8 +-
.../cache/GridCacheCommandHandlerSelfTest.java | 10 +-
.../GridServiceReassignmentSelfTest.java | 2 +-
...artupWithSpecifiedWorkDirectorySelfTest.java | 2 +-
...tartupWithUndefinedGridGainHomeSelfTest.java | 4 +-
.../internal/util/GridTestClockTimer.java | 6 +-
.../ignite/internal/util/GridUtilsSelfTest.java | 717 --
.../internal/util/IgniteUtilsSelfTest.java | 728 ++
.../util/future/GridFinishedFutureSelfTest.java | 2 +-
...idIpcServerEndpointDeserializerSelfTest.java | 160 -
.../IpcServerEndpointDeserializerSelfTest.java | 160 +
.../ipc/shmem/GgfsSharedMemoryTestClient.java | 76 +
.../ipc/shmem/GgfsSharedMemoryTestServer.java | 71 +
.../shmem/GridGgfsSharedMemoryTestClient.java | 76 -
.../shmem/GridGgfsSharedMemoryTestServer.java | 71 -
...idIpcSharedMemoryCrashDetectionSelfTest.java | 500 -
.../shmem/GridIpcSharedMemoryFakeClient.java | 36 -
.../shmem/GridIpcSharedMemoryNodeStartup.java | 87 -
.../shmem/GridIpcSharedMemorySpaceSelfTest.java | 267 -
.../shmem/GridIpcSharedMemoryUtilsSelfTest.java | 84 -
.../IpcSharedMemoryCrashDetectionSelfTest.java | 500 +
.../ipc/shmem/IpcSharedMemoryFakeClient.java | 36 +
.../IpcSharedMemoryNativeLoaderSelfTest.java | 78 +
.../ipc/shmem/IpcSharedMemoryNodeStartup.java | 87 +
.../ipc/shmem/IpcSharedMemorySpaceSelfTest.java | 267 +
.../ipc/shmem/IpcSharedMemoryUtilsSelfTest.java | 84 +
.../LoadWithCorruptedLibFileTestRunner.java | 65 +
.../GridIpcSharedMemoryBenchmarkParty.java | 35 -
.../GridIpcSharedMemoryBenchmarkReader.java | 133 -
.../GridIpcSharedMemoryBenchmarkWriter.java | 125 -
.../IpcSharedMemoryBenchmarkParty.java | 35 +
.../IpcSharedMemoryBenchmarkReader.java | 133 +
.../IpcSharedMemoryBenchmarkWriter.java | 125 +
.../ignite/lang/GridSetWrapperSelfTest.java | 2 +-
.../cache/GridCachePutRemoveLoadTest.java | 2 +-
.../communication/GridIoManagerBenchmark.java | 10 +-
.../communication/GridIoManagerBenchmark0.java | 12 +-
.../ignite/loadtests/dsi/GridDsiPerfJob.java | 2 +-
.../marshaller/GridMarshallerAbstractTest.java | 6 +-
.../tcp/GridTcpDiscoveryMultiThreadedTest.java | 2 +-
.../discovery/tcp/GridTcpDiscoverySelfTest.java | 14 +-
.../ignite/testframework/GridTestUtils.java | 4 +-
.../testframework/junits/GridAbstractTest.java | 14 +-
.../junits/GridTestKernalContext.java | 2 +-
.../junits/common/GridCommonAbstractTest.java | 22 +-
.../ignite/testsuites/IgniteBasicTestSuite.java | 2 +-
.../testsuites/IgniteComputeGridTestSuite.java | 4 +-
.../ignite/testsuites/IgniteFsTestSuite.java | 2 +-
.../IgniteIpcSharedMemorySelfTestSuite.java | 7 +-
.../testsuites/IgniteUtilSelfTestSuite.java | 2 +-
.../internal/fs/hadoop/GridGgfsHadoopIpcIo.java | 10 +-
.../GridHadoopDefaultMapReducePlanner.java | 2 +-
.../GridHadoopExternalCommunication.java | 26 +-
.../GridHadoopIpcToNioAdapter.java | 6 +-
...doop20FileSystemLoopbackPrimarySelfTest.java | 2 +-
...sHadoop20FileSystemShmemPrimarySelfTest.java | 2 +-
.../GridGgfsHadoopFileSystemClientSelfTest.java | 4 +-
...idGgfsHadoopFileSystemHandshakeSelfTest.java | 2 +-
...ridGgfsHadoopFileSystemIpcCacheSelfTest.java | 2 +-
...adoopFileSystemLoopbackAbstractSelfTest.java | 2 +-
...fsHadoopFileSystemShmemAbstractSelfTest.java | 8 +-
.../fs/GridGgfsNearOnlyMultiNodeSelfTest.java | 4 +-
.../ignite/fs/IgniteFsEventsTestSuite.java | 4 +-
...idHadoopDefaultMapReducePlannerSelfTest.java | 4 +-
.../hadoop/GridHadoopJobTrackerSelfTest.java | 2 +-
.../cache/GridCacheAbstractQuerySelfTest.java | 6 +-
.../cache/GridCacheOffHeapAndSwapSelfTest.java | 4 +-
.../cache/GridCacheQueryLoadSelfTest.java | 2 +-
.../GridCacheQueryMultiThreadedSelfTest.java | 8 +-
.../GridCacheReplicatedFieldsQuerySelfTest.java | 2 +-
.../GridCacheReplicatedQuerySelfTest.java | 4 +-
.../query/h2/sql/GridQueryParsingTest.java | 2 +-
.../tcp/GridOrderedMessageCancelSelfTest.java | 2 +-
.../GridTmLookupLifecycleAwareSelfTest.java | 2 +-
.../java/org/apache/ignite/IgniteSpring.java | 8 +-
.../cache/spring/SpringDynamicCacheManager.java | 2 +-
.../ignite/visor/commands/VisorConsole.scala | 6 +-
.../commands/alert/VisorAlertCommand.scala | 4 +-
.../config/VisorConfigurationCommand.scala | 6 +-
.../commands/deploy/VisorDeployCommand.scala | 4 +-
.../commands/disco/VisorDiscoveryCommand.scala | 4 +-
.../commands/events/VisorEventsCommand.scala | 4 +-
.../visor/commands/node/VisorNodeCommand.scala | 4 +-
.../commands/start/VisorStartCommand.scala | 4 +-
.../commands/tasks/VisorTasksCommand.scala | 4 +-
.../commands/top/VisorTopologyCommand.scala | 6 +-
.../visor/commands/vvm/VisorVvmCommand.scala | 8 +-
.../scala/org/apache/ignite/visor/visor.scala | 26 +-
.../GridServletContextListenerStartup.java | 4 +-
.../startup/servlet/GridServletStartup.java | 4 +-
316 files changed, 23824 insertions(+), 23627 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4009aaa3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4009aaa3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------