You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by iv...@apache.org on 2015/07/13 08:35:02 UTC
[01/50] [abbrv] incubator-ignite git commit: # Fixed unmarshalling
error handling for cache 'get'
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-961 d5aa28c01 -> 42ab9f425
# Fixed unmarshalling error handling for cache 'get'
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6d6ec778
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6d6ec778
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6d6ec778
Branch: refs/heads/ignite-961
Commit: 6d6ec778b43d730dd19001011aaaa49ec86c5d20
Parents: 94a42a4
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jul 8 15:08:33 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jul 8 15:08:33 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheIoManager.java | 8 ++-
.../distributed/near/GridNearGetFuture.java | 4 +-
.../cache/CacheFutureExceptionSelfTest.java | 72 +++++++++++++++++---
3 files changed, 71 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d6ec778/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index 0707096..29e3551 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -445,8 +445,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
case 50: {
GridNearGetResponse res = (GridNearGetResponse)msg;
- GridPartitionedGetFuture fut = (GridPartitionedGetFuture)ctx.mvcc().future(
- res.version(), res.futureId());
+ GridCacheFuture fut = ctx.mvcc().future(res.version(), res.futureId());
if (fut == null) {
if (log.isDebugEnabled())
@@ -457,7 +456,10 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
res.error(res.classError());
- fut.onResult(nodeId, res);
+ if (fut instanceof GridNearGetFuture)
+ ((GridNearGetFuture)fut).onResult(nodeId, res);
+ else
+ ((GridPartitionedGetFuture)fut).onResult(nodeId, res);
}
break;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d6ec778/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
index 74438bb..58f6fe5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
@@ -223,7 +223,7 @@ public final class GridNearGetFuture<K, V> extends GridCompoundIdentityFuture<Ma
* @param nodeId Sender.
* @param res Result.
*/
- void onResult(UUID nodeId, GridNearGetResponse res) {
+ public void onResult(UUID nodeId, GridNearGetResponse res) {
for (IgniteInternalFuture<Map<K, V>> fut : futures())
if (isMini(fut)) {
MiniFuture f = (MiniFuture)fut;
@@ -649,7 +649,7 @@ public final class GridNearGetFuture<K, V> extends GridCompoundIdentityFuture<Ma
if (log.isDebugEnabled())
log.debug("Got removed entry while processing get response (will not retry).");
}
- catch (IgniteCheckedException e) {
+ catch (Exception e) {
// Fail.
onDone(e);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d6ec778/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java
index 34d2daa..372c859 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java
@@ -20,6 +20,9 @@ package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.*;
import org.apache.ignite.configuration.*;
import org.apache.ignite.lang.*;
+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.testframework.junits.common.*;
import javax.cache.*;
@@ -32,31 +35,82 @@ import static java.util.concurrent.TimeUnit.*;
* Cache future self test.
*/
public class CacheFutureExceptionSelfTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static volatile boolean fail;
+
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = new IgniteConfiguration();
+
cfg.setGridName(gridName);
+ TcpDiscoverySpi spi = new TcpDiscoverySpi();
+
+ spi.setIpFinder(IP_FINDER);
+
+ cfg.setDiscoverySpi(spi);
+
if (gridName.equals(getTestGridName(1)))
cfg.setClientMode(true);
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+
/**
* @throws Exception If failed.
*/
public void testAsyncCacheFuture() throws Exception {
- Ignite srv = startGrid(0);
+ startGrid(0);
+
+ startGrid(1);
+
+ testGet(false, false);
+
+ testGet(false, true);
+
+ testGet(true, false);
+
+ testGet(true, true);
+ }
+
+ /**
+ * @param nearCache If {@code true} creates near cache on client.
+ * @param cpyOnRead Cache copy on read flag.
+ * @throws Exception If failed.
+ */
+ private void testGet(boolean nearCache, boolean cpyOnRead) throws Exception {
+ fail = false;
+
+ Ignite srv = grid(0);
+
+ Ignite client = grid(1);
+
+ final String cacheName = nearCache ? ("NEAR-CACHE-" + cpyOnRead) : ("CACHE-" + cpyOnRead);
+
+ CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+
+ ccfg.setCopyOnRead(cpyOnRead);
+
+ ccfg.setName(cacheName);
+
+ IgniteCache<Object, Object> cache = srv.createCache(ccfg);
- IgniteCache<String, NotSerializableClass> cache = srv.getOrCreateCache("CACHE");
cache.put("key", new NotSerializableClass());
- Ignite client = startGrid(1);
+ IgniteCache<Object, Object> clientCache = nearCache ? client.createNearCache(cacheName,
+ new NearCacheConfiguration<>()) : client.cache(cacheName);
- IgniteCache<String, NotSerializableClass> asyncCache = client.<String, NotSerializableClass>cache("CACHE").withAsync();
+ IgniteCache<Object, Object> asyncCache = clientCache.withAsync();
- System.setProperty("FAIL", "true");
+ fail = true;
asyncCache.get("key");
@@ -79,7 +133,9 @@ public class CacheFutureExceptionSelfTest extends GridCommonAbstractTest {
}
});
- assertTrue(futLatch.await(60, SECONDS));
+ assertTrue(futLatch.await(5, SECONDS));
+
+ srv.destroyCache(cache.getName());
}
/**
@@ -93,10 +149,10 @@ public class CacheFutureExceptionSelfTest extends GridCommonAbstractTest {
/** {@inheritDoc}*/
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
- if (System.getProperty("FAIL") != null)
+ if (fail)
throw new RuntimeException("Deserialization failed.");
in.readObject();
}
}
-}
\ No newline at end of file
+}
\ No newline at end of file
[39/50] [abbrv] incubator-ignite git commit: #ignite-964: java8 js is
working
Posted by iv...@apache.org.
#ignite-964: java8 js is working
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/eebdd647
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/eebdd647
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/eebdd647
Branch: refs/heads/ignite-961
Commit: eebdd64755d215fb24262e0542d691a623af475c
Parents: 4e4547a
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 10 18:03:17 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 10 18:03:17 2015 +0300
----------------------------------------------------------------------
.../handlers/scripting/IgniteScriptingCommandHandler.java | 7 +++----
.../processors/scripting/IgniteScriptingProcessor.java | 6 +++---
.../ScriptingObjectConverter8.java | 7 +++++++
3 files changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eebdd647/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
index 21381f1..088e6be 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
@@ -156,7 +156,7 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter
List<T3<Object, Object, Object>> jsMapRes = emitRes.getEmitResult();
for (T3<Object, Object, Object> task : jsMapRes) {
- map.put(new JsCallFunctionJob((String)task.get1(), task.get2()),
+ map.put(new JsCallFunctionJob(ctx.scripting(), (String)task.get1(), task.get2()),
(ClusterNode)task.get3());
}
@@ -207,14 +207,13 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter
private Ignite ignite;
/**
+ * @param proc Scripting processor.
* @param func Function to call.
* @param argv Function argument.
*/
- public JsCallFunctionJob(String func, Object argv) {
+ public JsCallFunctionJob(IgniteScriptingProcessor proc, String func, Object argv) {
this.func = func;
- IgniteScriptingProcessor proc = ((IgniteKernal) ignite).context().scripting();
-
this.argv = proc.toScriptingObject(proc.toJavaObject(argv));
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eebdd647/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
index e5eba31..733fc10 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
@@ -32,7 +32,7 @@ import static javax.script.ScriptContext.*;
*/
public class IgniteScriptingProcessor extends GridProcessorAdapter {
/** Javascript engine name. */
- public static final String JAVA_SCRIPT_ENGINE_NAME = "rhino";
+ public static final String JAVA_SCRIPT_ENGINE_NAME = "JavaScript";
/** Java8 scripting converter class. */
private static final String CONV_CLS_JAVA8 =
@@ -56,9 +56,9 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
try {
Class<?> cls = Class.forName(CONV_CLS_JAVA8);
- Constructor<?> ctor = cls.getConstructor(GridKernalContext.class);
+ Constructor<?> ctor = cls.getConstructor();
- converter = (ScriptingObjectConverter)ctor.newInstance(ctx);
+ converter = (ScriptingObjectConverter)ctor.newInstance();
System.out.println("JDK 8 is found!!!!");
}
catch (ClassNotFoundException ignored) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eebdd647/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java b/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java
index 1355b46..ae4051e 100644
--- a/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java
+++ b/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java
@@ -31,6 +31,13 @@ public class ScriptingObjectConverter8 extends ScriptingObjectConverter implemen
private final JSONCacheObject fields;
/**
+ * Default constructor.
+ */
+ public ScriptingObjectConverter8() {
+ fields = null;
+ }
+
+ /**
* @param o JSON object.
*/
private ScriptingObjectConverter8(JSONCacheObject o) {
[09/50] [abbrv] incubator-ignite git commit: release notes
Posted by iv...@apache.org.
release notes
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0a569b8a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0a569b8a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0a569b8a
Branch: refs/heads/ignite-961
Commit: 0a569b8acfa4918dcd98a9fa0e4873f1e5b5737a
Parents: f13f594
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jul 8 19:55:58 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jul 8 19:55:58 2015 +0300
----------------------------------------------------------------------
RELEASE_NOTES.txt | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0a569b8a/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index ec8c4e6..0e22f1f 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -6,6 +6,7 @@ Apache Ignite In-Memory Data Fabric 1.3
* Added auto-retries for cache operations in recoverable cases.
* Fixed several issues with JTA integration.
+* Fixed several issues with Hibernate L2 cache.
* Fixed issue with GAR files in source release.
* Stability fixes for TCP discovery SPI.
* Stability fixes for onheap and offheap SQL queries.
[41/50] [abbrv] incubator-ignite git commit: #ignite-964: remove
unused functions.
Posted by iv...@apache.org.
#ignite-964: remove unused functions.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2d47f7bc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2d47f7bc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2d47f7bc
Branch: refs/heads/ignite-961
Commit: 2d47f7bcbc739ae8727741d92fcb34012ecdc429
Parents: 84938dd
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 10 18:28:30 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 10 18:28:30 2015 +0300
----------------------------------------------------------------------
.../main/java/org/apache/ignite/json/JSONCacheObject.java | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2d47f7bc/modules/core/src/main/java/org/apache/ignite/json/JSONCacheObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/json/JSONCacheObject.java b/modules/core/src/main/java/org/apache/ignite/json/JSONCacheObject.java
index 9f1b601..2b8de1b 100644
--- a/modules/core/src/main/java/org/apache/ignite/json/JSONCacheObject.java
+++ b/modules/core/src/main/java/org/apache/ignite/json/JSONCacheObject.java
@@ -26,19 +26,11 @@ public class JSONCacheObject extends HashMap<Object, Object> {
/**
* Empty constructor.
*/
- public JSONCacheObject() {
+ private JSONCacheObject() {
// No-op.
}
/**
- * @param o Map.
- */
- public JSONCacheObject(Map o) {
- for (Object key : o.keySet())
- addField(JSONCacheObject.toSimpleObject(key), JSONCacheObject.toSimpleObject(o.get(key)));
- }
-
- /**
* @param key Field name.
* @param val Field value.
*/
[43/50] [abbrv] incubator-ignite git commit: #ignite-964: remove
unused functions.
Posted by iv...@apache.org.
#ignite-964: remove unused functions.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7d4f378c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7d4f378c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7d4f378c
Branch: refs/heads/ignite-961
Commit: 7d4f378c62b21cb5a708e88fa41a78c88a6aa87e
Parents: 3ab0552
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 10 18:41:47 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 10 18:41:47 2015 +0300
----------------------------------------------------------------------
examples/src/main/js/compute-run-example.js | 82 ++++++++++++++++++++
examples/src/main/js/run-cache-script.js | 82 --------------------
.../IgniteScriptingCommandHandler.java | 2 +-
.../scripting/IgniteScriptingProcessor.java | 8 --
.../processors/scripting/ScriptingJsCache.java | 13 ++--
5 files changed, 89 insertions(+), 98 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7d4f378c/examples/src/main/js/compute-run-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/compute-run-example.js b/examples/src/main/js/compute-run-example.js
new file mode 100644
index 0000000..18d5452
--- /dev/null
+++ b/examples/src/main/js/compute-run-example.js
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+var apacheIgnite = require("apache-ignite");
+var Ignition = apacheIgnite.Ignition;
+
+/**
+ * This example demonstrates very basic operations on cache in functions for Compute.run.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
+ * <p>
+ * Alternatively you can run ExampleJsNodeStartup in another JVM which will
+ * start node with {@code examples/config/js/example-js-cache.xml} configuration.
+ */
+function main() {
+ /** Cache name. */
+ var cacheName = "RunCacheScriptCache";
+
+ /** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
+ Ignition.start(['127.0.0.1:9095'], null, onConnect);
+
+ function onConnect(err, ignite) {
+ if (err !== null)
+ throw "Start remote node with config examples/config/js/example-js-cache.xml.";
+
+ console.log(">>> Run cache script example started.");
+
+ ignite.getOrCreateCache(cacheName, function(err, cache) { runCacheScript(ignite, cache); });
+ }
+
+ function runCacheScript(ignite, cache) {
+ var key = "John";
+ var person = {"firstName": "John", "lastName": "Doe", "salary" : 2000};
+
+ // Store person in the cache
+ cache.put(key, person, onPut);
+
+ function onPut(err) {
+ var job = function (args) {
+ print(">>> Hello node: " + ignite.name());
+
+ var cacheName = args[0];
+ var key = args[1];
+
+ /** Get cache with name. */
+ var cache = ignite.cache(cacheName);
+
+ /** Get person with name John. */
+ var val = cache.get(key);
+
+ return val.salary;
+ }
+
+ var onRun = function(err, salary) {
+ console.log(">>> " + key + "'s salary is " + salary);
+
+ // Destroying cache.
+ ignite.destroyCache(cacheName, function(err) { console.log(">>> End of run cache script example."); });
+ }
+
+ /** Run remote job on server ignite node with arguments [cacheName, key]. */
+ ignite.compute().run(job, [cacheName, key], onRun);
+ }
+ }
+}
+
+main();
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7d4f378c/examples/src/main/js/run-cache-script.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/run-cache-script.js b/examples/src/main/js/run-cache-script.js
deleted file mode 100644
index 18d5452..0000000
--- a/examples/src/main/js/run-cache-script.js
+++ /dev/null
@@ -1,82 +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.
- */
-
-var apacheIgnite = require("apache-ignite");
-var Ignition = apacheIgnite.Ignition;
-
-/**
- * This example demonstrates very basic operations on cache in functions for Compute.run.
- * <p>
- * Remote nodes should always be started with special configuration file which
- * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
- * <p>
- * Alternatively you can run ExampleJsNodeStartup in another JVM which will
- * start node with {@code examples/config/js/example-js-cache.xml} configuration.
- */
-function main() {
- /** Cache name. */
- var cacheName = "RunCacheScriptCache";
-
- /** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
- Ignition.start(['127.0.0.1:9095'], null, onConnect);
-
- function onConnect(err, ignite) {
- if (err !== null)
- throw "Start remote node with config examples/config/js/example-js-cache.xml.";
-
- console.log(">>> Run cache script example started.");
-
- ignite.getOrCreateCache(cacheName, function(err, cache) { runCacheScript(ignite, cache); });
- }
-
- function runCacheScript(ignite, cache) {
- var key = "John";
- var person = {"firstName": "John", "lastName": "Doe", "salary" : 2000};
-
- // Store person in the cache
- cache.put(key, person, onPut);
-
- function onPut(err) {
- var job = function (args) {
- print(">>> Hello node: " + ignite.name());
-
- var cacheName = args[0];
- var key = args[1];
-
- /** Get cache with name. */
- var cache = ignite.cache(cacheName);
-
- /** Get person with name John. */
- var val = cache.get(key);
-
- return val.salary;
- }
-
- var onRun = function(err, salary) {
- console.log(">>> " + key + "'s salary is " + salary);
-
- // Destroying cache.
- ignite.destroyCache(cacheName, function(err) { console.log(">>> End of run cache script example."); });
- }
-
- /** Run remote job on server ignite node with arguments [cacheName, key]. */
- ignite.compute().run(job, [cacheName, key], onRun);
- }
- }
-}
-
-main();
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7d4f378c/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
index 088e6be..dbfda37 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
@@ -214,7 +214,7 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter
public JsCallFunctionJob(IgniteScriptingProcessor proc, String func, Object argv) {
this.func = func;
- this.argv = proc.toScriptingObject(proc.toJavaObject(argv));
+ this.argv = proc.toJavaObject(argv);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7d4f378c/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
index 52847ec..b38c4c3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
@@ -150,14 +150,6 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
/**
* @param o Object.
- * @return Object for script.
- */
- public Object toScriptingObject(Object o) {
- return o;
- }
-
- /**
- * @param o Object.
* @return Object for Ignite cache.
*/
public Object toJavaObject(Object o) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7d4f378c/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
index e6c271c..a38a5b0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
@@ -58,7 +58,7 @@ public class ScriptingJsCache {
public Object get(Object key) {
Object cacheKey = proc.toJavaObject(key);
- return proc.toScriptingObject(cache.get(cacheKey));
+ return cache.get(cacheKey);
}
/**
@@ -93,8 +93,7 @@ public class ScriptingJsCache {
List<Object> res = new ArrayList<>();
for (Map.Entry<Object, Object> e : entries.entrySet())
- res.add(proc.createScriptingEntry(proc.toScriptingObject(e.getKey()),
- proc.toScriptingObject(e.getValue())));
+ res.add(proc.createScriptingEntry(e.getKey(), e.getValue()));
return res;
}
@@ -131,7 +130,7 @@ public class ScriptingJsCache {
Object cacheKey = proc.toJavaObject(key);
Object cacheVal = proc.toJavaObject(val);
- return proc.toScriptingObject(cache.getAndPut(cacheKey, cacheVal));
+ return cache.getAndPut(cacheKey, cacheVal);
}
/**
@@ -143,7 +142,7 @@ public class ScriptingJsCache {
Object cacheKey = proc.toJavaObject(key);
Object cacheVal = proc.toJavaObject(val);
- Object o = proc.toScriptingObject(cache.getAndReplace(cacheKey, cacheVal));
+ Object o = cache.getAndReplace(cacheKey, cacheVal);
return o;
}
@@ -157,7 +156,7 @@ public class ScriptingJsCache {
Object cacheKey = proc.toJavaObject(key);
Object cacheVal = proc.toJavaObject(val);
- return proc.toScriptingObject(cache.getAndPutIfAbsent(cacheKey, cacheVal));
+ return cache.getAndPutIfAbsent(cacheKey, cacheVal);
}
/**
@@ -167,7 +166,7 @@ public class ScriptingJsCache {
public Object getAndRemove(Object key) {
Object cacheKey = proc.toJavaObject(key);
- return proc.toScriptingObject(cache.getAndRemove(cacheKey));
+ return cache.getAndRemove(cacheKey);
}
/**
[16/50] [abbrv] incubator-ignite git commit: # ignite-gg-10416 Fixed
tests.
Posted by iv...@apache.org.
# ignite-gg-10416 Fixed tests.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/546d5955
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/546d5955
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/546d5955
Branch: refs/heads/ignite-961
Commit: 546d5955a1fdb4a16c186242945d4a27ba13c52c
Parents: d04c104
Author: Andrey <an...@gridgain.com>
Authored: Thu Jul 9 17:14:10 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Thu Jul 9 17:14:10 2015 +0700
----------------------------------------------------------------------
.../util/spring/IgniteSpringHelperImpl.java | 10 +++++-----
.../spring/IgniteExcludeInConfigurationTest.java | 5 ++++-
.../org/apache/ignite/spring/sprint-exclude.xml | 19 +++++++++++++++++++
3 files changed, 28 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/546d5955/modules/spring/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelperImpl.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelperImpl.java b/modules/spring/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelperImpl.java
index 6cfca36..435f522 100644
--- a/modules/spring/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelperImpl.java
+++ b/modules/spring/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelperImpl.java
@@ -422,6 +422,8 @@ public class IgniteSpringHelperImpl implements IgniteSpringHelper {
GenericApplicationContext springCtx = new GenericApplicationContext();
if (excludedProps.length > 0) {
+ final List<String> excludedPropsList = Arrays.asList(excludedProps);
+
BeanFactoryPostProcessor postProc = new BeanFactoryPostProcessor() {
/**
* @param def Registered BeanDefinition.
@@ -433,12 +435,10 @@ public class IgniteSpringHelperImpl implements IgniteSpringHelper {
while (iterVals.hasNext()) {
PropertyValue val = iterVals.next();
- for (String excludedProp : excludedProps) {
- if (val.getName().equals(excludedProp)) {
- iterVals.remove();
+ if (excludedPropsList.contains(val.getName())) {
+ iterVals.remove();
- return;
- }
+ continue;
}
if (val.getValue() instanceof Iterable) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/546d5955/modules/spring/src/test/java/org/apache/ignite/spring/IgniteExcludeInConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/IgniteExcludeInConfigurationTest.java b/modules/spring/src/test/java/org/apache/ignite/spring/IgniteExcludeInConfigurationTest.java
index 1edca77..b708f21 100644
--- a/modules/spring/src/test/java/org/apache/ignite/spring/IgniteExcludeInConfigurationTest.java
+++ b/modules/spring/src/test/java/org/apache/ignite/spring/IgniteExcludeInConfigurationTest.java
@@ -40,7 +40,8 @@ public class IgniteExcludeInConfigurationTest extends GridCommonAbstractTest {
public void testExclude() throws Exception {
IgniteSpringHelper spring = SPRING.create(false);
- Collection<IgniteConfiguration> cfgs = spring.loadConfigurations(cfgLocation, "typeMetadata").get1();
+ Collection<IgniteConfiguration> cfgs = spring.loadConfigurations(cfgLocation, "fileSystemConfiguration",
+ "typeMetadata").get1();
assertNotNull(cfgs);
assertEquals(1, cfgs.size());
@@ -50,6 +51,8 @@ public class IgniteExcludeInConfigurationTest extends GridCommonAbstractTest {
assertEquals(1, cfg.getCacheConfiguration().length);
assertNull(cfg.getCacheConfiguration()[0].getTypeMetadata());
+ assertNull(cfg.getFileSystemConfiguration());
+
cfgs = spring.loadConfigurations(cfgLocation, "keyType").get1();
assertNotNull(cfgs);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/546d5955/modules/spring/src/test/java/org/apache/ignite/spring/sprint-exclude.xml
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/sprint-exclude.xml b/modules/spring/src/test/java/org/apache/ignite/spring/sprint-exclude.xml
index 494f786..e6bf426 100644
--- a/modules/spring/src/test/java/org/apache/ignite/spring/sprint-exclude.xml
+++ b/modules/spring/src/test/java/org/apache/ignite/spring/sprint-exclude.xml
@@ -29,6 +29,25 @@
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+ <property name="fileSystemConfiguration">
+ <list>
+ <bean class="org.apache.ignite.configuration.FileSystemConfiguration">
+ <property name="name" value="test"/>
+ <property name="metaCacheName" value="meta"/>
+ <property name="dataCacheName" value="data"/>
+
+ <property name="maxSpaceSize" value="#{100L * 1024 * 1024}"/>
+
+ <!-- Loopback endpoint. -->
+ <property name="ipcEndpointConfiguration">
+ <bean class="org.apache.ignite.igfs.IgfsIpcEndpointConfiguration">
+ <property name="type" value="TCP" />
+ </bean>
+ </property>
+ </bean>
+ </list>
+ </property>
+
<!-- Cache configurations (all properties are optional). -->
<property name="cacheConfiguration">
<list>
[38/50] [abbrv] incubator-ignite git commit: #ignite-964: java7 js
cache is working
Posted by iv...@apache.org.
#ignite-964: java7 js cache is working
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4e4547a9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4e4547a9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4e4547a9
Branch: refs/heads/ignite-961
Commit: 4e4547a9e7114a6a376298010a53f3a81cc7083e
Parents: b19536b
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 10 17:51:40 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 10 17:51:40 2015 +0300
----------------------------------------------------------------------
.../processors/rest/GridRestProcessor.java | 5 +-
.../IgniteScriptingCommandHandler.java | 6 +-
.../scripting/IgniteScriptingProcessor.java | 86 +++++++++++++++++++-
.../scripting/ScriptingCacheEntry.java | 57 -------------
.../processors/scripting/ScriptingJSIgnite.java | 5 +-
.../processors/scripting/ScriptingJsCache.java | 15 ++--
.../scripting/ScriptingObjectConverter.java | 2 +-
.../ScriptingObjectConverter8.java | 24 ++++++
.../http/jetty/GridJettyRestHandler.java | 44 +++++-----
.../http/jetty/GridJettyRestProtocol.java | 2 +-
10 files changed, 148 insertions(+), 98 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4e4547a9/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
index df2304a..e387f98 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
@@ -248,7 +248,7 @@ public class GridRestProcessor extends GridProcessorAdapter {
}
/** {@inheritDoc} */
- @Override public void start() throws IgniteCheckedException {
+ @Override public void onKernalStart() throws IgniteCheckedException {
if (isRestEnabled()) {
// Start protocols.
startTcpProtocol();
@@ -273,10 +273,7 @@ public class GridRestProcessor extends GridProcessorAdapter {
}
}
}
- }
- /** {@inheritDoc} */
- @Override public void onKernalStart() throws IgniteCheckedException {
if (isRestEnabled()) {
for (GridRestProtocol proto : protos)
proto.onKernalStart();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4e4547a9/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
index 2d0a06e..21381f1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
@@ -28,7 +28,6 @@ import org.apache.ignite.internal.processors.scripting.*;
import org.apache.ignite.internal.util.future.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.json.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.resources.*;
import org.jetbrains.annotations.*;
@@ -214,8 +213,9 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter
public JsCallFunctionJob(String func, Object argv) {
this.func = func;
- this.argv = ScriptingObjectConverter8.convertToRestObject(
- JSONCacheObject.toSimpleObject(argv));
+ IgniteScriptingProcessor proc = ((IgniteKernal) ignite).context().scripting();
+
+ this.argv = proc.toScriptingObject(proc.toJavaObject(argv));
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4e4547a9/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
index 9ff89e2..e5eba31 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
@@ -32,7 +32,7 @@ import static javax.script.ScriptContext.*;
*/
public class IgniteScriptingProcessor extends GridProcessorAdapter {
/** Javascript engine name. */
- public static final String JAVA_SCRIPT_ENGINE_NAME = "javascript";
+ public static final String JAVA_SCRIPT_ENGINE_NAME = "rhino";
/** Java8 scripting converter class. */
private static final String CONV_CLS_JAVA8 =
@@ -59,8 +59,10 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
Constructor<?> ctor = cls.getConstructor(GridKernalContext.class);
converter = (ScriptingObjectConverter)ctor.newInstance(ctx);
+ System.out.println("JDK 8 is found!!!!");
}
catch (ClassNotFoundException ignored) {
+ System.out.println("JDK 8 is not found!!!!");
converter = new ScriptingObjectConverter();
}
catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) {
@@ -69,7 +71,9 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
ScriptEngineManager factory = new ScriptEngineManager();
+ System.out.println("ENGINE!!!!");
jsEngine = factory.getEngineByName(JAVA_SCRIPT_ENGINE_NAME);
+ System.out.println("ENGINE FOUND!!!!");
addBinding("ignite", new ScriptingJSIgnite(ctx.grid()));
@@ -183,4 +187,84 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
public Object toJavaObject(Object o) {
return converter.toJavaObject(o);
}
+
+ /**
+ * @param o Object from script.
+ * @return Object to store in cache.
+ */
+ public Object getField(String key, Object o) {
+ return converter.getField(key, o);
+ }
+
+ /**
+ * @param o Object from script.
+ * @return Object to store in cache.
+ */
+ public Object getFields(Object o) {
+ return converter.getFields(o);
+ }
+
+ /**
+ * @param key Key.
+ * @param val Value.
+ * @return Scripting entry.
+ */
+ public Object createScriptingEntry(Object key, Object val) {
+ return new ScriptingCacheEntry(getFields(key), getFields(val));
+ }
+
+ /**
+ * Scripting cache entry.
+ */
+ public static class ScriptingCacheEntry {
+ /** Key. */
+ private Object key;
+
+ /** Value. */
+ private Object val;
+
+ /**
+ * @param key Key.
+ * @param val Value.
+ */
+ public ScriptingCacheEntry(Object key, Object val) {
+ if (key instanceof ScriptingObjectConverter)
+ this.key = key;
+ else
+ this.key = key;
+
+ if (val instanceof ScriptingObjectConverter)
+ this.val = val;
+ else
+ this.val = val;
+ }
+
+ /**
+ * @return Key.
+ */
+ public Object getKey() {
+ return key;
+ }
+
+ /**
+ * @param key Key.
+ */
+ public void setKey(Object key) {
+ this.key = key;
+ }
+
+ /**
+ * @return Value.
+ */
+ public Object getValue() {
+ return val;
+ }
+
+ /**
+ * @param val Value.
+ */
+ public void setValue(Object val) {
+ this.val = val;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4e4547a9/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingCacheEntry.java
deleted file mode 100644
index adb43d1..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingCacheEntry.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.apache.ignite.internal.processors.scripting;
-
-
-/**
- * Scripting cache entry.
- */
-public class ScriptingCacheEntry {
- /** Key. */
- private Object key;
-
- /** Value. */
- private Object val;
-
- /**
- * @param key Key.
- * @param val Value.
- */
- public ScriptingCacheEntry(Object key, Object val) {
- if (key instanceof ScriptingObjectConverter)
- this.key = ((ScriptingObjectConverter)key).getFields();
- else
- this.key = key;
-
- if (val instanceof ScriptingObjectConverter)
- this.val = ((ScriptingObjectConverter)val).getFields();
- else
- this.val = val;
- }
-
- /**
- * @return Key.
- */
- public Object getKey() {
- return key;
- }
-
- /**
- * @param key Key.
- */
- public void setKey(Object key) {
- this.key = key;
- }
-
- /**
- * @return Value.
- */
- public Object getValue() {
- return val;
- }
-
- /**
- * @param val Value.
- */
- public void setValue(Object val) {
- this.val = val;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4e4547a9/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJSIgnite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJSIgnite.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJSIgnite.java
index 1c89318..a10d1e5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJSIgnite.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJSIgnite.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.scripting;
import org.apache.ignite.*;
+import org.apache.ignite.internal.*;
/**
* Node js ignite.
@@ -38,7 +39,7 @@ public class ScriptingJSIgnite {
* @return Node js cache.
*/
public ScriptingJsCache cache(String cache) {
- return new ScriptingJsCache(ignite.cache(cache));
+ return new ScriptingJsCache(ignite.cache(cache), ((IgniteKernal)ignite).context().scripting());
}
/**
@@ -46,7 +47,7 @@ public class ScriptingJSIgnite {
* @return Node js cache.
*/
public ScriptingJsCache getOrCreateCache(String cache) {
- return new ScriptingJsCache(ignite.getOrCreateCache(cache));
+ return new ScriptingJsCache(ignite.getOrCreateCache(cache), ((IgniteKernal)ignite).context().scripting());
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4e4547a9/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
index ce3975f..e6c271c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
@@ -34,9 +34,11 @@ public class ScriptingJsCache {
/**
* @param cache Ignite cache.
+ * @param proc Ignite scripting processor.
*/
public ScriptingJsCache(IgniteCache cache, IgniteScriptingProcessor proc) {
this.cache = cache;
+ this.proc = proc;
}
/**
@@ -83,16 +85,15 @@ public class ScriptingJsCache {
* @param keys Keys.
* @return Cache entries.
*/
- public List<ScriptingCacheEntry> getAll(List keys) {
+ public List<Object> getAll(List keys) {
List cacheKeys = (List)proc.toJavaObject(keys);
Map<Object, Object> entries = cache.getAll(new HashSet<>(cacheKeys));
- List<ScriptingCacheEntry> res = new ArrayList<>();
+ List<Object> res = new ArrayList<>();
for (Map.Entry<Object, Object> e : entries.entrySet())
- res.add(new ScriptingCacheEntry(
- proc.toScriptingObject(e.getKey()),
+ res.add(proc.createScriptingEntry(proc.toScriptingObject(e.getKey()),
proc.toScriptingObject(e.getValue())));
return res;
@@ -115,10 +116,8 @@ public class ScriptingJsCache {
Map<Object, Object> cacheEntries = U.newHashMap(entries.size());
- for (Object e : cacheKeys) {
- JSONCacheObject e0 = (JSONCacheObject)e;
- cacheEntries.put(e0.getField("key"), e0.getField("value"));
- }
+ for (Object e : cacheKeys)
+ cacheEntries.put(proc.getField("key", e), proc.getField("value", e));
cache.putAll(cacheEntries);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4e4547a9/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java
index 7e2758b..d5c6dfd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java
@@ -54,6 +54,6 @@ public class ScriptingObjectConverter {
* @return Object to store in cache.
*/
public Object getFields(Object o) {
- return JSONCacheObject.toSimpleObject(o);
+ return o;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4e4547a9/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java b/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java
index 23ea93d..1355b46 100644
--- a/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java
+++ b/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java
@@ -68,6 +68,30 @@ public class ScriptingObjectConverter8 extends ScriptingObjectConverter implemen
return fields.get(key);
}
+ /**
+ * @param o Object from script.
+ * @return Object to store in cache.
+ */
+ public Object getField(String key, Object o) {
+ if (o instanceof JSONCacheObject)
+ return ((JSONCacheObject)o).getField(key);
+ if (o instanceof ScriptingObjectConverter8)
+ return ((ScriptingObjectConverter8)o).getField(key);
+
+ return null;
+ }
+
+ /**
+ * @param o Object from script.
+ * @return Object to store in cache.
+ */
+ public Object getFields(Object o) {
+ if (o instanceof ScriptingObjectConverter8)
+ return ((ScriptingObjectConverter8)o).getFields();
+
+ return o;
+ }
+
@Override public Object call(Object o, Object... objects) {
System.out.println("!!!!CALL");
return null;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4e4547a9/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index 0828779..f576a3e 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -26,7 +26,6 @@ import org.apache.ignite.internal.processors.rest.request.*;
import org.apache.ignite.internal.processors.scripting.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.json.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.plugin.security.*;
import org.eclipse.jetty.server.*;
@@ -73,20 +72,26 @@ public class GridJettyRestHandler extends AbstractHandler {
/** Authentication checker. */
private final IgniteClosure<String, Boolean> authChecker;
+ /** Ignite scripting processor. */
+ IgniteScriptingProcessor proc;
+
/**
* Creates new HTTP requests handler.
*
+ * @param proc Scripting processor.
* @param hnd Handler.
* @param authChecker Authentication checking closure.
* @param log Logger.
*/
- GridJettyRestHandler(GridRestProtocolHandler hnd, IgniteClosure<String, Boolean> authChecker, IgniteLogger log) {
+ GridJettyRestHandler(IgniteScriptingProcessor proc, GridRestProtocolHandler hnd,
+ IgniteClosure<String, Boolean> authChecker, IgniteLogger log) {
assert hnd != null;
assert log != null;
this.hnd = hnd;
this.log = log;
this.authChecker = authChecker;
+ this.proc = proc;
// Init default page and favicon.
try {
@@ -330,10 +335,10 @@ public class GridJettyRestHandler extends AbstractHandler {
if (cmd == CACHE_GET_ALL) {
Map o = (Map)cmdRes.getResponse();
- List<ScriptingCacheEntry> res = new ArrayList<>();
+ List<Object> res = new ArrayList<>();
for (Object k : o.keySet())
- res.add(new ScriptingCacheEntry(k, o.get(k)));
+ res.add(proc.createScriptingEntry(k, o.get(k)));
cmdRes.setResponse(res);
@@ -341,8 +346,7 @@ public class GridJettyRestHandler extends AbstractHandler {
else {
Object o = cmdRes.getResponse();
- if (o instanceof ScriptingObjectConverter8)
- cmdRes.setResponse(((ScriptingObjectConverter8)o).getFields());
+ cmdRes.setResponse(proc.getFields(o));
}
}
@@ -411,19 +415,17 @@ public class GridJettyRestHandler extends AbstractHandler {
String cacheName = (String)params.get("cacheName");
if (req.getHeader("JSONObject") != null) {
- JSONObject o = parseRequest(req);
+ Object o = proc.toJavaObject(parseRequest(req));
- Map<Object, Object> map = U.newHashMap(o.keySet().size());
+ Map<Object, Object> map = new HashMap<>();
switch (cmd) {
case CACHE_PUT_ALL: {
- List entries = (List) o.get("entries");
+ List entries = (List)proc.getField("entries", o);
for (Object entry : entries) {
- JSONCacheObject cacheEntry = new JSONCacheObject((JSONObject) entry);
-
- Object key = cacheEntry.getField("key");
- Object val = cacheEntry.getField("value");
+ Object key = proc.getField("key", entry);
+ Object val = proc.getField("value", entry);
map.put(key, val);
}
@@ -438,9 +440,9 @@ public class GridJettyRestHandler extends AbstractHandler {
case CACHE_GET_ALL:
case CACHE_REMOVE_ALL:
case CACHE_CONTAINS_KEYS: {
- JSONCacheObject cacheObj = new JSONCacheObject(o);
+ Object cacheObj = proc.toJavaObject(o);
- List keys = (List) cacheObj.getField("keys");
+ List keys = (List)proc.getField("keys", cacheObj);
for (Object key : keys)
map.put(key, null);
@@ -464,13 +466,13 @@ public class GridJettyRestHandler extends AbstractHandler {
case CACHE_REPLACE:
case CACHE_GET_AND_REPLACE:
case CACHE_REPLACE_VALUE: {
- JSONCacheObject cacheObj = new JSONCacheObject(o);
+ Object cacheObj = proc.toJavaObject(o);
restReq0.cacheName(F.isEmpty(cacheName) ? null : cacheName);
- restReq0.key(cacheObj.getField("key"));
- restReq0.value(cacheObj.getField("val"));
- restReq0.value2(cacheObj.getField("oldVal"));
+ restReq0.key(proc.getField("key", cacheObj));
+ restReq0.value(proc.getField("val", cacheObj));
+ restReq0.value2(proc.getField("oldVal", cacheObj));
break;
}
@@ -588,12 +590,12 @@ public class GridJettyRestHandler extends AbstractHandler {
RestRunScriptRequest restReq0 = new RestRunScriptRequest();
restReq0.script((String)params.get("func"));
- restReq0.cacheName((String)params.get("cacheName"));
+ restReq0.cacheName((String) params.get("cacheName"));
JSONObject o = parseRequest(req);
restReq0.argument(o.get("arg"));
- Object cacheObj = JSONCacheObject.toSimpleObject(o.get("key"));
+ Object cacheObj = proc.toJavaObject(o.get("key"));
restReq0.affinityKey(cacheObj);
restReq = restReq0;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4e4547a9/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
index d02e73b..7051fb6 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
@@ -116,7 +116,7 @@ public class GridJettyRestProtocol extends GridRestProtocolAdapter {
System.setProperty(IGNITE_JETTY_HOST, locHost.getHostAddress());
- jettyHnd = new GridJettyRestHandler(hnd, new C1<String, Boolean>() {
+ jettyHnd = new GridJettyRestHandler(ctx.scripting(), hnd, new C1<String, Boolean>() {
@Override public Boolean apply(String tok) {
return F.isEmpty(secretKey) || authenticate(tok);
}
[28/50] [abbrv] incubator-ignite git commit: # ignite-929 close does
not destroy cache
Posted by iv...@apache.org.
# ignite-929 close does not destroy cache
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e3fba883
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e3fba883
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e3fba883
Branch: refs/heads/ignite-961
Commit: e3fba883ab69cd7f32296633558db3b7f6442ab2
Parents: 90580d8
Author: sboikov <sb...@gridgain.com>
Authored: Fri Jul 10 09:20:11 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jul 10 09:20:11 2015 +0300
----------------------------------------------------------------------
.../examples/ScalarCacheAffinityExample.scala | 2 +-
.../scalar/examples/ScalarCacheExample.scala | 2 +-
.../ScalarCachePopularNumbersExample.scala | 2 +-
.../examples/ScalarCacheQueryExample.scala | 2 +-
.../examples/ScalarSnowflakeSchemaExample.scala | 4 +-
.../java/org/apache/ignite/IgniteCache.java | 14 +-
.../org/apache/ignite/cache/CacheManager.java | 13 +-
.../apache/ignite/internal/IgniteKernal.java | 2 +-
.../discovery/GridDiscoveryManager.java | 23 +-
.../cache/DynamicCacheChangeRequest.java | 39 +-
.../processors/cache/GridCacheGateway.java | 4 +-
.../GridCachePartitionExchangeManager.java | 6 +-
.../processors/cache/GridCacheProcessor.java | 102 ++-
.../processors/cache/IgniteCacheProxy.java | 448 +++++++---
.../distributed/dht/GridDhtCacheEntry.java | 4 +-
.../GridDhtPartitionsExchangeFuture.java | 30 +-
.../visor/cache/VisorCacheStopTask.java | 2 +-
.../affinity/IgniteClientNodeAffinityTest.java | 14 +-
.../IgniteFairAffinityDynamicCacheSelfTest.java | 3 +-
...cheStoreSessionListenerAbstractSelfTest.java | 111 ++-
.../GridCacheTxLoadFromStoreOnLockSelfTest.java | 34 +-
.../CacheMetricsForClusterGroupSelfTest.java | 10 +-
.../cache/CacheOffheapMapEntrySelfTest.java | 7 +-
.../cache/CacheStopAndDestroySelfTest.java | 859 +++++++++++++++++++
...eUsageMultinodeDynamicStartAbstractTest.java | 2 +-
...ProjectionForCachesOnDaemonNodeSelfTest.java | 2 +-
.../cache/IgniteDynamicCacheStartSelfTest.java | 140 +--
...teCacheClientNodePartitionsExchangeTest.java | 29 +-
...CacheLocalOffHeapAndSwapMetricsSelfTest.java | 2 +-
.../DataStreamerMultinodeCreateCacheTest.java | 14 +-
.../testsuites/IgniteCacheTestSuite4.java | 2 +
.../CacheConfigurationP2PTestClient.java | 4 +-
32 files changed, 1593 insertions(+), 339 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample.scala b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample.scala
index fbf66bc..40b947d 100644
--- a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample.scala
+++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheAffinityExample.scala
@@ -62,7 +62,7 @@ object ScalarCacheAffinityExample extends App {
visitUsingMapKeysToNodes(cache)
}
finally {
- cache.close()
+ cache.destroy()
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheExample.scala b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheExample.scala
index 42e8ca4..0bf8d6f 100644
--- a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheExample.scala
+++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheExample.scala
@@ -50,7 +50,7 @@ object ScalarCacheExample extends App {
basicOperations()
}
finally {
- cache.close()
+ cache.destroy()
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCachePopularNumbersExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCachePopularNumbersExample.scala b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCachePopularNumbersExample.scala
index 828c5a3..d113297 100644
--- a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCachePopularNumbersExample.scala
+++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCachePopularNumbersExample.scala
@@ -93,7 +93,7 @@ object ScalarCachePopularNumbersExample extends App {
}
}
finally {
- cache.close()
+ cache.destroy()
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheQueryExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheQueryExample.scala b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheQueryExample.scala
index b8054eb..1a42947 100644
--- a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheQueryExample.scala
+++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarCacheQueryExample.scala
@@ -55,7 +55,7 @@ object ScalarCacheQueryExample {
example(ignite$)
}
finally {
- cache.close()
+ cache.destroy()
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarSnowflakeSchemaExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarSnowflakeSchemaExample.scala b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarSnowflakeSchemaExample.scala
index 2656f44..33b2fcc 100644
--- a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarSnowflakeSchemaExample.scala
+++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarSnowflakeSchemaExample.scala
@@ -86,11 +86,11 @@ object ScalarSnowflakeSchemaExample {
queryProductPurchases()
}
finally {
- factCache.close()
+ factCache.destroy()
}
}
finally {
- dimCache.close()
+ dimCache.destroy()
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index c8d6d7a..4938ab1 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -543,9 +543,21 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
CacheEntryProcessor<K, V, T> entryProcessor, Object... args);
/**
+ * Closes this cache instance.
+ * <p>
+ * For local cache equivalent to {@link #destroy()}.
+ * For distributed caches, if called on clients, stops client cache, if called on a server node,
+ * just closes this cache instance and does not destroy cache data.
+ * <p>
+ * After cache instance is closed another {@link IgniteCache} instance for the same
+ * cache can be created using {@link Ignite#cache(String)} method.
+ */
+ @Override public void close();
+
+ /**
* Completely deletes the cache with all its data from the system on all cluster nodes.
*/
- @Override void close();
+ public void destroy();
/**
* This cache node to re-balance its partitions. This method is usually used when
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/main/java/org/apache/ignite/cache/CacheManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheManager.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheManager.java
index 9ba50d1..bc6df76 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/CacheManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheManager.java
@@ -130,6 +130,7 @@ public class CacheManager implements javax.cache.CacheManager {
}
/** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
@Override public <K, V, C extends Configuration<K, V>> Cache<K, V> createCache(String cacheName, C cacheCfg)
throws IllegalArgumentException {
kernalGateway.readLock();
@@ -155,11 +156,11 @@ public class CacheManager implements javax.cache.CacheManager {
IgniteCache<K, V> res = ignite.createCache(igniteCacheCfg);
- ((IgniteCacheProxy<K, V>)res).setCacheManager(this);
-
if (res == null)
throw new CacheException();
+ ((IgniteCacheProxy<K, V>)res).setCacheManager(this);
+
if (igniteCacheCfg.isManagementEnabled())
enableManagement(cacheName, true);
@@ -219,6 +220,7 @@ public class CacheManager implements javax.cache.CacheManager {
/**
* @param cacheName Cache name.
+ * @return Cache.
*/
@Nullable private <K, V> IgniteCache<K, V> getCache0(String cacheName) {
if (cacheName == null)
@@ -272,11 +274,13 @@ public class CacheManager implements javax.cache.CacheManager {
}
if (cache != null)
- cache.close();
+ cache.destroy();
}
/**
* @param cacheName Cache name.
+ * @param objName Object name.
+ * @return Object name instance.
*/
private ObjectName getObjectName(String cacheName, String objName) {
String mBeanName = "javax.cache:type=" + objName + ",CacheManager="
@@ -339,7 +343,8 @@ public class CacheManager implements javax.cache.CacheManager {
/**
* @param mxbean MXBean.
- * @param name cache name.
+ * @param name Cache name.
+ * @param beanType Bean type.
*/
private void registerCacheObject(Object mxbean, String name, String beanType) {
MBeanServer mBeanSrv = ignite.configuration().getMBeanServer();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index d6ddf79..024dc7b 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
@@ -2436,7 +2436,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
IgniteInternalFuture<?> stopFut;
try {
- stopFut = ctx.cache().dynamicStopCache(cacheName);
+ stopFut = ctx.cache().dynamicDestroyCache(cacheName);
}
finally {
unguard();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index a8ce8ff..eae07ed 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -263,6 +263,19 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
}
/**
+ * Removes near node ID from cache filter.
+ *
+ * @param cacheName Cache name.
+ * @param clientNodeId Near node ID.
+ */
+ public void onClientCacheClose(String cacheName, UUID clientNodeId) {
+ CachePredicate predicate = registeredCaches.get(cacheName);
+
+ if (predicate != null)
+ predicate.onNodeLeft(clientNodeId);
+ }
+
+ /**
* @return Client nodes map.
*/
public Map<String, Map<UUID, Boolean>> clientNodesMap() {
@@ -1079,9 +1092,17 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
* @return {@code True} if node for given ID is alive.
*/
public boolean alive(UUID nodeId) {
+ return getAlive(nodeId) != null;
+ }
+
+ /**
+ * @param nodeId Node ID.
+ * @return Node if node is alive.
+ */
+ @Nullable public ClusterNode getAlive(UUID nodeId) {
assert nodeId != null;
- return getSpi().getNode(nodeId) != null; // Go directly to SPI without checking disco cache.
+ return getSpi().getNode(nodeId); // Go directly to SPI without checking disco cache.
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
index c08a179..7af1572 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
@@ -57,6 +57,9 @@ public class DynamicCacheChangeRequest implements Serializable {
/** Stop flag. */
private boolean stop;
+ /** Close flag. */
+ private boolean close;
+
/** Fail if exists flag. */
private boolean failIfExists;
@@ -68,23 +71,10 @@ public class DynamicCacheChangeRequest implements Serializable {
*
* @param cacheName Cache stop name.
* @param initiatingNodeId Initiating node ID.
- * @param stop Stop flag.
*/
- public DynamicCacheChangeRequest(String cacheName, UUID initiatingNodeId, boolean stop) {
+ public DynamicCacheChangeRequest(String cacheName, UUID initiatingNodeId) {
this.cacheName = cacheName;
this.initiatingNodeId = initiatingNodeId;
-
- this.stop = stop;
- }
-
- /**
- * Constructor means for start requests.
- *
- * @param cacheName Cache name.
- * @param initiatingNodeId Initiating node ID.
- */
- public DynamicCacheChangeRequest(String cacheName, UUID initiatingNodeId) {
- this(cacheName, initiatingNodeId, false);
}
/**
@@ -130,6 +120,13 @@ public class DynamicCacheChangeRequest implements Serializable {
}
/**
+ * @param stop New stop flag.
+ */
+ public void stop(boolean stop) {
+ this.stop = stop;
+ }
+
+ /**
* @return Cache name.
*/
public String cacheName() {
@@ -220,6 +217,20 @@ public class DynamicCacheChangeRequest implements Serializable {
this.failIfExists = failIfExists;
}
+ /**
+ * @return Close flag.
+ */
+ public boolean close() {
+ return close;
+ }
+
+ /**
+ * @param close New close flag.
+ */
+ public void close(boolean close) {
+ this.close = close;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(DynamicCacheChangeRequest.class, this, "cacheName", cacheName());
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java
index d9d151c..f2beb0a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java
@@ -68,7 +68,7 @@ public class GridCacheGateway<K, V> {
*
* @return {@code True} if enter successful, {@code false} if the cache or the node was stopped.
*/
- public boolean enterIfNotClosed() {
+ public boolean enterIfNotStopped() {
onEnter();
// Must unlock in case of unexpected errors to avoid
@@ -89,7 +89,7 @@ public class GridCacheGateway<K, V> {
*
* @return {@code True} if enter successful, {@code false} if the cache or the node was stopped.
*/
- public boolean enterIfNotClosedNoLock() {
+ public boolean enterIfNotStoppedNoLock() {
onEnter();
return !stopped;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index af87685..4398b4c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -156,16 +156,14 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
// Validate requests to check if event should trigger partition exchange.
for (DynamicCacheChangeRequest req : batch.requests()) {
- if (cctx.cache().dynamicCacheRegistered(req))
+ if (cctx.cache().exchangeNeeded(req))
valid.add(req);
else
cctx.cache().completeStartFuture(req);
}
if (!F.isEmpty(valid)) {
- exchId = exchangeId(n.id(),
- affinityTopologyVersion(e),
- e.type());
+ exchId = exchangeId(n.id(), affinityTopologyVersion(e), e.type());
exchFut = exchangeFuture(exchId, e, valid);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index de1eac2..bb87a86 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -1390,10 +1390,16 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @return {@code True} if change request was registered to apply.
*/
@SuppressWarnings("IfMayBeConditional")
- public boolean dynamicCacheRegistered(DynamicCacheChangeRequest req) {
+ public boolean exchangeNeeded(DynamicCacheChangeRequest req) {
DynamicCacheDescriptor desc = registeredCaches.get(maskNull(req.cacheName()));
if (desc != null) {
+ if (req.close()) {
+ assert req.initiatingNodeId() != null : req;
+
+ return true;
+ }
+
if (desc.deploymentId().equals(req.deploymentId())) {
if (req.start())
return !desc.cancelled();
@@ -1515,20 +1521,26 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @param req Stop request.
*/
public void blockGateway(DynamicCacheChangeRequest req) {
- assert req.stop();
+ assert req.stop() || req.close();
- // Break the proxy before exchange future is done.
- IgniteCacheProxy<?, ?> proxy = jCacheProxies.get(maskNull(req.cacheName()));
+ if (req.stop() || (req.close() && req.initiatingNodeId().equals(ctx.localNodeId()))) {
+ // Break the proxy before exchange future is done.
+ IgniteCacheProxy<?, ?> proxy = jCacheProxies.get(maskNull(req.cacheName()));
- if (proxy != null)
- proxy.gate().block();
+ if (proxy != null) {
+ if (req.stop())
+ proxy.gate().block();
+ else
+ proxy.closeProxy();
+ }
+ }
}
/**
* @param req Request.
*/
private void stopGateway(DynamicCacheChangeRequest req) {
- assert req.stop();
+ assert req.stop() : req;
// Break the proxy before exchange future is done.
IgniteCacheProxy<?, ?> proxy = jCacheProxies.remove(maskNull(req.cacheName()));
@@ -1541,7 +1553,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @param req Stop request.
*/
public void prepareCacheStop(DynamicCacheChangeRequest req) {
- assert req.stop();
+ assert req.stop() || req.close() : req;
GridCacheAdapter<?, ?> cache = caches.remove(maskNull(req.cacheName()));
@@ -1597,6 +1609,23 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (desc != null && desc.cancelled() && desc.deploymentId().equals(req.deploymentId()))
registeredCaches.remove(masked, desc);
}
+ else if (req.close() && req.initiatingNodeId().equals(ctx.localNodeId())) {
+ IgniteCacheProxy<?, ?> proxy = jCacheProxies.remove(masked);
+
+ if (proxy != null) {
+ if (proxy.context().affinityNode()) {
+ GridCacheAdapter<?, ?> cache = caches.get(masked);
+
+ if (cache != null)
+ jCacheProxies.put(masked, new IgniteCacheProxy(cache.context(), cache, null, false));
+ }
+ else {
+ proxy.context().gate().onStopped();
+
+ prepareCacheStop(req);
+ }
+ }
+ }
completeStartFuture(req);
}
@@ -2005,13 +2034,35 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/**
- * @param cacheName Cache name to stop.
- * @return Future that will be completed when cache is stopped.
+ * @param cacheName Cache name to destroy.
+ * @return Future that will be completed when cache is destroyed.
*/
- public IgniteInternalFuture<?> dynamicStopCache(String cacheName) {
+ public IgniteInternalFuture<?> dynamicDestroyCache(String cacheName) {
checkEmptyTransactions();
- DynamicCacheChangeRequest t = new DynamicCacheChangeRequest(cacheName, ctx.localNodeId(), true);
+ DynamicCacheChangeRequest t = new DynamicCacheChangeRequest(cacheName, ctx.localNodeId());
+
+ t.stop(true);
+
+ return F.first(initiateCacheChanges(F.asList(t), false));
+ }
+
+
+ /**
+ * @param cacheName Cache name to close.
+ * @return Future that will be completed when cache is closed.
+ */
+ public IgniteInternalFuture<?> dynamicCloseCache(String cacheName) {
+ IgniteCacheProxy<?, ?> proxy = jCacheProxies.get(maskNull(cacheName));
+
+ if (proxy == null || proxy.proxyClosed())
+ return new GridFinishedFuture<>(); // No-op.
+
+ checkEmptyTransactions();
+
+ DynamicCacheChangeRequest t = new DynamicCacheChangeRequest(cacheName, ctx.localNodeId());
+
+ t.close(true);
return F.first(initiateCacheChanges(F.asList(t), false));
}
@@ -2031,16 +2082,24 @@ public class GridCacheProcessor extends GridProcessorAdapter {
DynamicCacheStartFuture fut = new DynamicCacheStartFuture(req.cacheName(), req.deploymentId(), req);
try {
- if (req.stop()) {
+ if (req.stop() || req.close()) {
DynamicCacheDescriptor desc = registeredCaches.get(maskNull(req.cacheName()));
if (desc == null)
// No-op.
fut.onDone();
else {
+ assert desc.cacheConfiguration() != null : desc;
+
+ if (req.close() && desc.cacheConfiguration().getCacheMode() == LOCAL) {
+ req.close(false);
+
+ req.stop(true);
+ }
+
IgniteUuid dynamicDeploymentId = desc.deploymentId();
- assert dynamicDeploymentId != null;
+ assert dynamicDeploymentId != null : desc;
// Save deployment ID to avoid concurrent stops.
req.deploymentId(dynamicDeploymentId);
@@ -2188,9 +2247,12 @@ public class GridCacheProcessor extends GridProcessorAdapter {
req.nearCacheConfiguration() != null);
}
else {
+ assert req.stop() || req.close() : req;
+
if (desc == null) {
- // If local node initiated start, fail the start future.
- DynamicCacheStartFuture changeFut = (DynamicCacheStartFuture)pendingFuts.get(maskNull(req.cacheName()));
+ // If local node initiated start, finish future.
+ DynamicCacheStartFuture changeFut =
+ (DynamicCacheStartFuture)pendingFuts.get(maskNull(req.cacheName()));
if (changeFut != null && changeFut.deploymentId().equals(req.deploymentId())) {
// No-op.
@@ -2200,9 +2262,13 @@ public class GridCacheProcessor extends GridProcessorAdapter {
return;
}
- desc.onCancelled();
+ if (req.stop()) {
+ desc.onCancelled();
- ctx.discovery().removeCacheFilter(req.cacheName());
+ ctx.discovery().removeCacheFilter(req.cacheName());
+ }
+ else
+ ctx.discovery().onClientCacheClose(req.cacheName(), req.initiatingNodeId());
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/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 b31b2e8..9767f49 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
@@ -18,8 +18,8 @@
package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.*;
-import org.apache.ignite.cache.CacheManager;
import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.CacheManager;
import org.apache.ignite.cache.query.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.configuration.*;
@@ -171,19 +171,23 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public CacheMetrics metrics() {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
return ctx.cache().metrics();
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public CacheMetrics metrics(ClusterGroup grp) {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
List<CacheMetrics> metrics = new ArrayList<>(grp.nodes().size());
@@ -202,19 +206,21 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return new CacheMetricsSnapshot(ctx.cache().metrics(), metrics);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public CacheMetricsMXBean mxBean() {
- CacheOperationContext prev = gate.enter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
return ctx.cache().mxBean();
}
finally {
- gate.leave(prev);
+ onLeave(gate, prev);
}
}
@@ -230,19 +236,23 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Nullable @Override public Cache.Entry<K, V> randomEntry() {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
return ctx.cache().randomEntry();
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public IgniteCache<K, V> withExpiryPolicy(ExpiryPolicy plc) {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
CacheOperationContext prj0 = opCtx != null ? opCtx.withExpiryPolicy(plc) :
@@ -251,7 +261,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return new IgniteCacheProxy<>(ctx, delegate, prj0, isAsync(), lock);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
@@ -262,7 +272,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public IgniteCache<K, V> withNoRetries() {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
boolean noRetries = opCtx != null && opCtx.noRetries();
@@ -280,14 +292,16 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
lock);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public void loadCache(@Nullable IgniteBiPredicate<K, V> p, @Nullable Object... args) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync())
@@ -296,7 +310,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
ctx.cache().globalLoadCache(p, args);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -307,7 +321,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public void localLoadCache(@Nullable IgniteBiPredicate<K, V> p, @Nullable Object... args) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync())
@@ -316,7 +332,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
delegate.localLoadCache(p, args);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -327,7 +343,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Nullable @Override public V getAndPutIfAbsent(K key, V val) throws CacheException {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -339,7 +357,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return delegate.getAndPutIfAbsent(key, val);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -359,13 +377,15 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public boolean isLocalLocked(K key, boolean byCurrThread) {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
return byCurrThread ? delegate.isLockedByThread(key) : delegate.isLocked(key);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
@@ -379,7 +399,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
final CacheQuery<Map.Entry<K,V>> qry;
final CacheQueryFuture<Map.Entry<K,V>> fut;
- boolean isKeepPortable = opCtx != null ? opCtx.isKeepPortable() : false;
+ boolean isKeepPortable = opCtx != null && opCtx.isKeepPortable();
if (filter instanceof ScanQuery) {
IgniteBiPredicate<K, V> p = ((ScanQuery)filter).getFilter();
@@ -444,11 +464,11 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/**
- * @param local Enforce local.
+ * @param loc Enforce local.
* @return Local node cluster group.
*/
- private ClusterGroup projection(boolean local) {
- if (local || ctx.isLocal() || isReplicatedDataNode())
+ private ClusterGroup projection(boolean loc) {
+ if (loc || ctx.isLocal() || isReplicatedDataNode())
return ctx.kernalContext().grid().cluster().forLocal();
if (ctx.isReplicated())
@@ -517,7 +537,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
@Override public <R> QueryCursor<R> query(Query<R> qry) {
A.notNull(qry, "qry");
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
ctx.checkSecurity(SecurityPermission.CACHE_READ);
@@ -558,7 +580,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
throw new CacheException(e);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
@@ -589,7 +611,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public Iterable<Cache.Entry<K, V>> localEntries(CachePeekMode... peekModes) throws CacheException {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
return delegate.localEntries(peekModes);
@@ -598,37 +622,43 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
throw cacheException(e);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public QueryMetrics queryMetrics() {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
return delegate.context().queries().metrics();
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public void localEvict(Collection<? extends K> keys) {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
delegate.evictAll(keys);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Nullable @Override public V localPeek(K key, CachePeekMode... peekModes) {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
return delegate.localPeek(key, peekModes, null);
@@ -637,20 +667,22 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
throw cacheException(e);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public void localPromote(Set<? extends K> keys) throws CacheException {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
delegate.promoteAll(keys);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -660,7 +692,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public int size(CachePeekMode... peekModes) throws CacheException {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -675,13 +709,15 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
throw cacheException(e);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public int localSize(CachePeekMode... peekModes) {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
return delegate.localSize(peekModes);
@@ -690,14 +726,16 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
throw cacheException(e);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public V get(K key) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -709,7 +747,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return delegate.get(key);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -720,7 +758,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public Map<K, V> getAll(Set<? extends K> keys) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -732,7 +772,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return delegate.getAll(keys);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -743,7 +783,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public Map<K, V> getAllOutTx(Set<? extends K> keys) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -755,7 +797,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return delegate.getAllOutTx(keys);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -769,7 +811,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
*/
public Map<K, V> getAll(Collection<? extends K> keys) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -781,7 +825,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return delegate.getAll(keys);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -796,19 +840,23 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
* @return Entry set.
*/
public Set<Cache.Entry<K, V>> entrySetx(CacheEntryPredicate... filter) {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
return delegate.entrySetx(filter);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public boolean containsKey(K key) {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -820,13 +868,15 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return delegate.containsKey(key);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public boolean containsKeys(Set<? extends K> keys) {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -838,7 +888,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return delegate.containsKeys(keys);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
@@ -848,7 +898,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
boolean replaceExisting,
@Nullable final CompletionListener completionLsnr
) {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
IgniteInternalFuture<?> fut = ctx.cache().loadAll(keys, replaceExisting);
@@ -869,14 +921,16 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public void put(K key, V val) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -896,7 +950,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
delegate.put(key, val);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -907,7 +961,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public V getAndPut(K key, V val) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -919,7 +975,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return delegate.getAndPut(key, val);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -930,7 +986,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public void putAll(Map<? extends K, ? extends V> map) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync())
@@ -939,7 +997,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
delegate.putAll(map);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -950,7 +1008,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public boolean putIfAbsent(K key, V val) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -962,7 +1022,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return delegate.putIfAbsent(key, val);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -973,7 +1033,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public boolean remove(K key) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -985,7 +1047,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return delegate.remove(key);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -996,7 +1058,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public boolean remove(K key, V oldVal) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -1008,7 +1072,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return delegate.remove(key, oldVal);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -1019,7 +1083,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public V getAndRemove(K key) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -1031,7 +1097,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return delegate.getAndRemove(key);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -1042,7 +1108,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public boolean replace(K key, V oldVal, V newVal) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -1054,7 +1122,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return delegate.replace(key, oldVal, newVal);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -1065,7 +1133,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public boolean replace(K key, V val) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -1077,7 +1147,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return delegate.replace(key, val);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -1088,7 +1158,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public V getAndReplace(K key, V val) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -1100,7 +1172,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return delegate.getAndReplace(key, val);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -1111,7 +1183,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public void removeAll(Set<? extends K> keys) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync())
@@ -1120,7 +1194,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
delegate.removeAll(keys);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -1130,7 +1204,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public void removeAll() {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync())
@@ -1142,13 +1218,15 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
throw cacheException(e);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public void clear(K key) {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync())
@@ -1160,13 +1238,15 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
throw cacheException(e);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public void clearAll(Set<? extends K> keys) {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync())
@@ -1178,13 +1258,15 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
throw cacheException(e);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public void clear() {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync())
@@ -1196,32 +1278,36 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
throw cacheException(e);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public void localClear(K key) {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
delegate.clearLocally(key);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public void localClearAll(Set<? extends K> keys) {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
for (K key : keys)
delegate.clearLocally(key);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
@@ -1229,7 +1315,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
@Override public <T> T invoke(K key, EntryProcessor<K, V, T> entryProcessor, Object... args)
throws EntryProcessorException {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -1255,7 +1343,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -1267,7 +1355,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
@Override public <T> T invoke(K key, CacheEntryProcessor<K, V, T> entryProcessor, Object... args)
throws EntryProcessorException {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -1293,7 +1383,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -1303,10 +1393,12 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public <T> Map<K, EntryProcessorResult<T>> invokeAll(Set<? extends K> keys,
- EntryProcessor<K, V, T> entryProcessor,
- Object... args) {
+ EntryProcessor<K, V, T> entryProcessor,
+ Object... args) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -1318,7 +1410,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return delegate.invokeAll(keys, entryProcessor, args);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -1331,7 +1423,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
CacheEntryProcessor<K, V, T> entryProcessor,
Object... args) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -1343,7 +1437,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return delegate.invokeAll(keys, entryProcessor, args);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -1356,7 +1450,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
Map<? extends K, ? extends EntryProcessor<K, V, T>> map,
Object... args) {
try {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
if (isAsync()) {
@@ -1368,7 +1464,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
return delegate.invokeAll(map, args);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
catch (IgniteCheckedException e) {
@@ -1394,17 +1490,43 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public void destroy() {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ if (!onEnterIfNoStop(gate))
+ return;
+
+ IgniteInternalFuture<?> fut;
+
+ try {
+ fut = ctx.kernalContext().cache().dynamicDestroyCache(ctx.name());
+ }
+ finally {
+ onLeave(gate);
+ }
+
+ try {
+ fut.get();
+ }
+ catch (IgniteCheckedException e) {
+ throw cacheException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void close() {
- if (!onEnterIfNoClose())
+ GridCacheGateway<K, V> gate = this.gate;
+
+ if (!onEnterIfNoStop(gate))
return;
IgniteInternalFuture<?> fut;
try {
- fut = ctx.kernalContext().cache().dynamicStopCache(ctx.name());
+ fut = ctx.kernalContext().cache().dynamicCloseCache(ctx.name());
}
finally {
- onLeave();
+ onLeave(gate);
}
try {
@@ -1417,14 +1539,16 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public boolean isClosed() {
- if (!onEnterIfNoClose())
+ GridCacheGateway<K, V> gate = this.gate;
+
+ if (!onEnterIfNoStop(gate))
return true;
try {
return ctx.kernalContext().cache().context().closed(ctx);
}
finally {
- onLeave();
+ onLeave(gate);
}
}
@@ -1448,7 +1572,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
/** {@inheritDoc} */
@Override public void registerCacheEntryListener(CacheEntryListenerConfiguration<K, V> lsnrCfg) {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
ctx.continuousQueries().executeJCacheQuery(lsnrCfg, false);
@@ -1457,13 +1583,15 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
throw cacheException(e);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public void deregisterCacheEntryListener(CacheEntryListenerConfiguration<K, V> lsnrCfg) {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
ctx.continuousQueries().cancelJCacheQuery(lsnrCfg);
@@ -1472,19 +1600,21 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
throw cacheException(e);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
/** {@inheritDoc} */
@Override public Iterator<Cache.Entry<K, V>> iterator() {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
return ctx.cache().igniteIterator();
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
@@ -1516,8 +1646,11 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
*
* @return Projection for portable objects.
*/
+ @SuppressWarnings("unchecked")
public <K1, V1> IgniteCache<K1, V1> keepPortable() {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
CacheOperationContext opCtx0 =
@@ -1535,7 +1668,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
lock);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
@@ -1543,7 +1676,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
* @return Cache with skip store enabled.
*/
public IgniteCache<K, V> skipStore() {
- CacheOperationContext prev = onEnter(opCtx);
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
try {
boolean skip = opCtx != null && opCtx.skipStore();
@@ -1565,7 +1700,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
lock);
}
finally {
- onLeave(prev);
+ onLeave(gate, prev);
}
}
@@ -1592,10 +1727,69 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/**
+ * @return {@code True} if proxy was closed.
+ */
+ public boolean proxyClosed() {
+ return !gate.getClass().equals(GridCacheGateway.class);
+ }
+
+ /**
+ * Closes this proxy instance.
+ */
+ public void closeProxy() {
+ gate = new GridCacheGateway<K, V>(ctx) {
+ @Override public void enter() {
+ throw new IllegalStateException("Cache has been closed: " + ctx.name());
+ }
+
+ @Override public boolean enterIfNotStopped() {
+ return false;
+ }
+
+ @Override public boolean enterIfNotStoppedNoLock() {
+ return false;
+ }
+
+ @Override public void leaveNoLock() {
+ assert false;
+ }
+
+ @Override public void leave() {
+ assert false;
+ }
+
+ @Nullable @Override public CacheOperationContext enter(@Nullable CacheOperationContext opCtx) {
+ throw new IllegalStateException("Cache has been closed: " + ctx.name());
+ }
+
+ @Nullable @Override public CacheOperationContext enterNoLock(@Nullable CacheOperationContext opCtx) {
+ throw new IllegalStateException("Cache has been closed: " + ctx.name());
+ }
+
+ @Override public void leave(CacheOperationContext prev) {
+ assert false;
+ }
+
+ @Override public void leaveNoLock(CacheOperationContext prev) {
+ assert false;
+ }
+
+ @Override public void block() {
+ // No-op.
+ }
+
+ @Override public void onStopped() {
+ // No-op.
+ }
+ };
+ }
+
+ /**
+ * @param gate Cache gateway.
* @param opCtx Cache operation context to guard.
* @return Previous projection set on this thread.
*/
- private CacheOperationContext onEnter(CacheOperationContext opCtx) {
+ private CacheOperationContext onEnter(GridCacheGateway<K, V> gate, CacheOperationContext opCtx) {
if (lock)
return gate.enter(opCtx);
else
@@ -1603,21 +1797,21 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/**
- * On enter.
- *
+ * @param gate Cache gateway.
* @return {@code True} if enter successful.
*/
- private boolean onEnterIfNoClose() {
+ private boolean onEnterIfNoStop(GridCacheGateway<K, V> gate) {
if (lock)
- return gate.enterIfNotClosed();
+ return gate.enterIfNotStopped();
else
- return gate.enterIfNotClosedNoLock();
+ return gate.enterIfNotStoppedNoLock();
}
/**
+ * @param gate Cache gateway.
* @param opCtx Operation context to guard.
*/
- private void onLeave(CacheOperationContext opCtx) {
+ private void onLeave(GridCacheGateway<K, V> gate, CacheOperationContext opCtx) {
if (lock)
gate.leave(opCtx);
else
@@ -1625,9 +1819,9 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/**
- * On leave.
+ * @param gate Cache gateway.
*/
- private void onLeave() {
+ private void onLeave(GridCacheGateway<K, V> gate) {
if (lock)
gate.leave();
else
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
index 89b85c4..3b411b5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
@@ -597,7 +597,9 @@ public class GridDhtCacheEntry extends GridDistributedCacheEntry {
List<ReaderId> newRdrs = null;
for (int i = 0; i < rdrs.length; i++) {
- if (!cctx.discovery().alive(rdrs[i].nodeId())) {
+ ClusterNode node = cctx.discovery().getAlive(rdrs[i].nodeId());
+
+ if (node == null || !cctx.discovery().cacheNode(node, cacheName())) {
// Node has left and if new list has already been created, just skip.
// Otherwise, create new list and add alive nodes.
if (newRdrs == null) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 38a0d55..5701749 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -474,6 +474,9 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
oldestNode.set(oldest);
+ if (!F.isEmpty(reqs))
+ blockGateways();
+
startCaches();
// True if client node joined or failed.
@@ -489,24 +492,25 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
else {
assert discoEvt.type() == EVT_DISCOVERY_CUSTOM_EVT : discoEvt;
- boolean clientOnlyStart = true;
+ boolean clientOnlyCacheEvt = true;
for (DynamicCacheChangeRequest req : reqs) {
- if (!req.clientStartOnly()) {
- clientOnlyStart = false;
+ if (req.clientStartOnly() || req.close())
+ continue;
- break;
- }
+ clientOnlyCacheEvt = false;
+
+ break;
}
- clientNodeEvt = clientOnlyStart;
+ clientNodeEvt = clientOnlyCacheEvt;
}
if (clientNodeEvt) {
ClusterNode node = discoEvt.eventNode();
// Client need to initialize affinity for local join event or for stated client caches.
- if (!node.isLocal()) {
+ if (!node.isLocal() || clientCacheClose()) {
for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
if (cacheCtx.isLocal())
continue;
@@ -733,9 +737,6 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
if (log.isDebugEnabled())
log.debug("After waiting for partition release future: " + this);
- if (!F.isEmpty(reqs))
- blockGateways();
-
if (exchId.isLeft())
cctx.mvcc().removeExplicitNodeLocks(exchId.nodeId(), exchId.topologyVersion());
@@ -839,6 +840,13 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
}
/**
+ * @return {@code True} if exchange initiated for client cache close.
+ */
+ private boolean clientCacheClose() {
+ return reqs != null && reqs.size() == 1 && reqs.iterator().next().close();
+ }
+
+ /**
*
*/
private void dumpPendingObjects() {
@@ -903,7 +911,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
*/
private void blockGateways() {
for (DynamicCacheChangeRequest req : reqs) {
- if (req.stop())
+ if (req.stop() || req.close())
cctx.cache().blockGateway(req);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStopTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStopTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStopTask.java
index 0e848f9..83d19f1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStopTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStopTask.java
@@ -56,7 +56,7 @@ public class VisorCacheStopTask extends VisorOneNodeTask<String, Void> {
@Override protected Void run(String cacheName) {
IgniteCache cache = ignite.cache(cacheName);
- cache.close();
+ cache.destroy();
return null;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/test/java/org/apache/ignite/cache/affinity/IgniteClientNodeAffinityTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/affinity/IgniteClientNodeAffinityTest.java b/modules/core/src/test/java/org/apache/ignite/cache/affinity/IgniteClientNodeAffinityTest.java
index 467349f..da27fb2 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/affinity/IgniteClientNodeAffinityTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/affinity/IgniteClientNodeAffinityTest.java
@@ -127,13 +127,23 @@ public class IgniteClientNodeAffinityTest extends GridCommonAbstractTest {
ccfg.setNodeFilter(new TestNodesFilter());
- try (IgniteCache<Integer, Integer> cache = client.createCache(ccfg)) {
+ IgniteCache<Integer, Integer> cache = client.createCache(ccfg);
+
+ try {
checkCache(null, 1);
}
+ finally {
+ cache.destroy();
+ }
- try (IgniteCache<Integer, Integer> cache = client.createCache(ccfg, new NearCacheConfiguration())) {
+ cache = client.createCache(ccfg, new NearCacheConfiguration());
+
+ try {
checkCache(null, 1);
}
+ finally {
+ cache.destroy();
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/IgniteFairAffinityDynamicCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/IgniteFairAffinityDynamicCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/IgniteFairAffinityDynamicCacheSelfTest.java
index 18b77e0..e51be58 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/IgniteFairAffinityDynamicCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/IgniteFairAffinityDynamicCacheSelfTest.java
@@ -84,8 +84,7 @@ public class IgniteFairAffinityDynamicCacheSelfTest extends GridCommonAbstractTe
cache.put(i, i);
IgniteInternalFuture<Object> destFut = GridTestUtils.runAsync(new Callable<Object>() {
- @Override
- public Object call() throws Exception {
+ @Override public Object call() throws Exception {
ignite(0).destroyCache(cache.getName());
return null;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerAbstractSelfTest.java
index 0634197..8e53f05 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerAbstractSelfTest.java
@@ -113,12 +113,17 @@ public abstract class CacheStoreSessionListenerAbstractSelfTest extends GridComm
public void testAtomicCache() throws Exception {
CacheConfiguration<Integer, Integer> cfg = cacheConfiguration(null, CacheAtomicityMode.ATOMIC);
- try (IgniteCache<Integer, Integer> cache = ignite(0).createCache(cfg)) {
+ IgniteCache<Integer, Integer> cache = ignite(0).createCache(cfg);
+
+ try {
cache.loadCache(null);
cache.get(1);
cache.put(1, 1);
cache.remove(1);
}
+ finally {
+ cache.destroy();
+ }
assertEquals(3, loadCacheCnt.get());
assertEquals(1, loadCnt.get());
@@ -133,12 +138,17 @@ public abstract class CacheStoreSessionListenerAbstractSelfTest extends GridComm
public void testTransactionalCache() throws Exception {
CacheConfiguration<Integer, Integer> cfg = cacheConfiguration(null, CacheAtomicityMode.TRANSACTIONAL);
- try (IgniteCache<Integer, Integer> cache = ignite(0).createCache(cfg)) {
+ IgniteCache<Integer, Integer> cache = ignite(0).createCache(cfg);
+
+ try {
cache.loadCache(null);
cache.get(1);
cache.put(1, 1);
cache.remove(1);
}
+ finally {
+ cache.destroy();
+ }
assertEquals(3, loadCacheCnt.get());
assertEquals(1, loadCnt.get());
@@ -153,15 +163,18 @@ public abstract class CacheStoreSessionListenerAbstractSelfTest extends GridComm
public void testExplicitTransaction() throws Exception {
CacheConfiguration<Integer, Integer> cfg = cacheConfiguration(null, CacheAtomicityMode.TRANSACTIONAL);
- try (IgniteCache<Integer, Integer> cache = ignite(0).createCache(cfg)) {
- try (Transaction tx = ignite(0).transactions().txStart()) {
- cache.put(1, 1);
- cache.put(2, 2);
- cache.remove(3);
- cache.remove(4);
+ IgniteCache<Integer, Integer> cache = ignite(0).createCache(cfg);
- tx.commit();
- }
+ try (Transaction tx = ignite(0).transactions().txStart()) {
+ cache.put(1, 1);
+ cache.put(2, 2);
+ cache.remove(3);
+ cache.remove(4);
+
+ tx.commit();
+ }
+ finally {
+ cache.destroy();
}
assertEquals(2, writeCnt.get());
@@ -176,18 +189,20 @@ public abstract class CacheStoreSessionListenerAbstractSelfTest extends GridComm
CacheConfiguration<Integer, Integer> cfg1 = cacheConfiguration("cache1", CacheAtomicityMode.TRANSACTIONAL);
CacheConfiguration<Integer, Integer> cfg2 = cacheConfiguration("cache2", CacheAtomicityMode.TRANSACTIONAL);
- try (
- IgniteCache<Integer, Integer> cache1 = ignite(0).createCache(cfg1);
- IgniteCache<Integer, Integer> cache2 = ignite(0).createCache(cfg2)
- ) {
- try (Transaction tx = ignite(0).transactions().txStart()) {
- cache1.put(1, 1);
- cache2.put(2, 2);
- cache1.remove(3);
- cache2.remove(4);
-
- tx.commit();
- }
+ IgniteCache<Integer, Integer> cache1 = ignite(0).createCache(cfg1);
+ IgniteCache<Integer, Integer> cache2 = ignite(0).createCache(cfg2);
+
+ try (Transaction tx = ignite(0).transactions().txStart()) {
+ cache1.put(1, 1);
+ cache2.put(2, 2);
+ cache1.remove(3);
+ cache2.remove(4);
+
+ tx.commit();
+ }
+ finally {
+ cache1.destroy();
+ cache2.destroy();
}
assertEquals(2, writeCnt.get());
@@ -204,16 +219,18 @@ public abstract class CacheStoreSessionListenerAbstractSelfTest extends GridComm
CacheConfiguration<Integer, Integer> cfg1 = cacheConfiguration("cache1", CacheAtomicityMode.TRANSACTIONAL);
CacheConfiguration<Integer, Integer> cfg2 = cacheConfiguration("cache2", CacheAtomicityMode.TRANSACTIONAL);
- try (
- IgniteCache<Integer, Integer> cache1 = ignite(0).createCache(cfg1);
- IgniteCache<Integer, Integer> cache2 = ignite(0).createCache(cfg2)
- ) {
- try (Transaction tx = ignite(0).transactions().txStart()) {
- cache1.put(1, 1);
- cache2.put(2, 2);
+ IgniteCache<Integer, Integer> cache1 = ignite(0).createCache(cfg1);
+ IgniteCache<Integer, Integer> cache2 = ignite(0).createCache(cfg2);
- tx.commit();
- }
+ try (Transaction tx = ignite(0).transactions().txStart()) {
+ cache1.put(1, 1);
+ cache2.put(2, 2);
+
+ tx.commit();
+ }
+ finally {
+ cache1.destroy();
+ cache2.destroy();
}
try (Connection conn = DriverManager.getConnection(URL)) {
@@ -232,25 +249,27 @@ public abstract class CacheStoreSessionListenerAbstractSelfTest extends GridComm
CacheConfiguration<Integer, Integer> cfg1 = cacheConfiguration("cache1", CacheAtomicityMode.TRANSACTIONAL);
CacheConfiguration<Integer, Integer> cfg2 = cacheConfiguration("cache2", CacheAtomicityMode.TRANSACTIONAL);
- try (
- IgniteCache<Integer, Integer> cache1 = ignite(0).createCache(cfg1);
- IgniteCache<Integer, Integer> cache2 = ignite(0).createCache(cfg2)
- ) {
- try (Transaction tx = ignite(0).transactions().txStart()) {
- cache1.put(1, 1);
- cache2.put(2, 2);
+ IgniteCache<Integer, Integer> cache1 = ignite(0).createCache(cfg1);
+ IgniteCache<Integer, Integer> cache2 = ignite(0).createCache(cfg2);
- tx.commit();
+ try (Transaction tx = ignite(0).transactions().txStart()) {
+ cache1.put(1, 1);
+ cache2.put(2, 2);
- assert false : "Exception was not thrown.";
- }
- catch (IgniteException e) {
- CacheWriterException we = X.cause(e, CacheWriterException.class);
+ tx.commit();
- assertNotNull(we);
+ assert false : "Exception was not thrown.";
+ }
+ catch (IgniteException e) {
+ CacheWriterException we = X.cause(e, CacheWriterException.class);
+
+ assertNotNull(we);
- assertEquals("Expected failure.", we.getMessage());
- }
+ assertEquals("Expected failure.", we.getMessage());
+ }
+ finally {
+ cache1.destroy();
+ cache2.destroy();
}
try (Connection conn = DriverManager.getConnection(URL)) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java
index 7b01f0f..bc6b443 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java
@@ -92,31 +92,33 @@ public class GridCacheTxLoadFromStoreOnLockSelfTest extends GridCommonAbstractTe
cacheCfg.setBackups(backups);
cacheCfg.setLoadPreviousValue(true);
- try (IgniteCache<Integer, Integer> cache = ignite(0).createCache(cacheCfg)) {
- for (int i = 0; i < 10; i++)
- assertEquals((Integer)i, cache.get(i));
+ IgniteCache<Integer, Integer> cache = ignite(0).createCache(cacheCfg);
- cache.removeAll();
+ for (int i = 0; i < 10; i++)
+ assertEquals((Integer)i, cache.get(i));
- assertEquals(0, cache.size());
+ cache.removeAll();
- for (TransactionConcurrency conc : TransactionConcurrency.values()) {
- for (TransactionIsolation iso : TransactionIsolation.values()) {
- info("Checking transaction [conc=" + conc + ", iso=" + iso + ']');
+ assertEquals(0, cache.size());
- try (Transaction tx = ignite(0).transactions().txStart(conc, iso)) {
- for (int i = 0; i < 10; i++)
- assertEquals("Invalid value for transaction [conc=" + conc + ", iso=" + iso + ']',
- (Integer)i, cache.get(i));
+ for (TransactionConcurrency conc : TransactionConcurrency.values()) {
+ for (TransactionIsolation iso : TransactionIsolation.values()) {
+ info("Checking transaction [conc=" + conc + ", iso=" + iso + ']');
- tx.commit();
- }
+ try (Transaction tx = ignite(0).transactions().txStart(conc, iso)) {
+ for (int i = 0; i < 10; i++)
+ assertEquals("Invalid value for transaction [conc=" + conc + ", iso=" + iso + ']',
+ (Integer)i, cache.get(i));
- cache.removeAll();
- assertEquals(0, cache.size());
+ tx.commit();
}
+
+ cache.removeAll();
+ assertEquals(0, cache.size());
}
}
+
+ cache.destroy();
}
/**
[20/50] [abbrv] incubator-ignite git commit: #ignite-964: change
cache-put-get-example.js
Posted by iv...@apache.org.
#ignite-964: change cache-put-get-example.js
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/bfc899e4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bfc899e4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bfc899e4
Branch: refs/heads/ignite-961
Commit: bfc899e42dcb652412e9a203dd46295ff6f5affa
Parents: 242c21b
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jul 9 17:40:03 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jul 9 17:40:03 2015 +0300
----------------------------------------------------------------------
examples/src/main/js/cache-api-example.js | 2 +-
examples/src/main/js/cache-put-get-example.js | 132 +++++++++------------
2 files changed, 59 insertions(+), 75 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bfc899e4/examples/src/main/js/cache-api-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-api-example.js b/examples/src/main/js/cache-api-example.js
index d17276a..1514941 100644
--- a/examples/src/main/js/cache-api-example.js
+++ b/examples/src/main/js/cache-api-example.js
@@ -55,7 +55,7 @@ function main() {
cache.getAndPut(1, "1", onGetAndPut)
});
- onGetAndPut = function(err, entry) {
+ function onGetAndPut(err, entry) {
console.log(">>> Get and put finished [result=" + entry + "]");
// Put and do not return previous value.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bfc899e4/examples/src/main/js/cache-put-get-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-put-get-example.js b/examples/src/main/js/cache-put-get-example.js
index 7a9b035..75da096 100644
--- a/examples/src/main/js/cache-put-get-example.js
+++ b/examples/src/main/js/cache-put-get-example.js
@@ -16,104 +16,88 @@
*/
var apacheIgnite = require("apache-ignite");
-
var Ignition = apacheIgnite.Ignition;
var CacheEntry = apacheIgnite.CacheEntry;
-Ignition.start(['127.0.0.1:9095'], null, onConnect);
-
-function onConnect(err, ignite) {
- if (err)
- throw err;
-
- ignite.getOrCreateCache("PutGetExampleCache", function(err, cache) {
- putGet(cache);
-
- putAllGetAll(cache);
- });
-}
-
-putGet = function(cache) {
- console.log(">>> Cache put-get example started.");
-
- var keyCnt = 20;
-
- var putCnt = 0;
-
- var onGet = function(err, res) {
- if (err) {
- console.log("Error: " + err);
-
- throw new Error(err);
- }
-
- console.log("Get val=" + res);
+/**
+ * This example demonstrates very basic operations on cache, such as 'put' and 'get'.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleJsNodeStartup} in another JVM which will
+ * start node with {@code examples/config/js/example-js-cache.xml} configuration.
+ */
+function main() {
+ /** Cache name. */
+ var cacheName = "PutGetExampleCache";
+
+ /** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
+ Ignition.start(['127.0.0.1:9095'], null, onConnect);
+
+ function onConnect(err, ignite) {
+ ignite.getOrCreateCache(cacheName, function(err, cache) { putGetExample(ignite, cache); });
}
- var onPut = function(err) {
- if (err) {
- console.log("Error: " + err);
+ /** Execute individual puts and gets. */
+ putGetExample = function(ignite, cache) {
+ console.log(">>> Cache put-get example started.");
- throw new Error(err);
- }
+ var key = 1;
+
+ // Store key in cache.
+ cache.put(key, "1", onPut);
- if (putCnt < keyCnt - 1) {
- putCnt++;
+ function onPut(err) {
+ console.log(">>> Stored values in cache.");
- return;
+ cache.get(key, onGet);
}
- console.log(">>> Stored values in cache.");
+ function onGet(err, res) {
+ console.log("Get val=" + res);
- for (var i = 0; i < keyCnt; i++) {
- cache.get(i, onGet);
+ putAllGetAll(ignite, cache);
}
}
- // Store keys in cache.
- for (var i = 0; i < keyCnt; i++) {
- cache.put(i, i.toString(), onPut);
- }
-}
-
-putAllGetAll = function(cache) {
- console.log(">>> Starting putAll-getAll example.");
-
- var keyCnt = 20;
+ /** Execute bulk {@code putAll(...)} and {@code getAll(...)} operations. */
+ function putAllGetAll(ignite, cache) {
+ console.log(">>> Starting putAll-getAll example.");
- var batch = [];
- var keys = [];
+ var keyCnt = 20;
- for (var i = keyCnt; i < keyCnt + keyCnt; ++i) {
- var key = i;
+ // Create batch.
+ var batch = [];
+ var keys = [];
- var val = "bulk-" + i;
+ for (var i = keyCnt; i < keyCnt + keyCnt; ++i) {
+ var key = i;
+ var val = "bulk-" + i;
- keys.push(key);
- batch.push(new CacheEntry(key, val));
- }
+ keys.push(key);
+ batch.push(new CacheEntry(key, val));
+ }
- var onGetAll = function(err, entries) {
- if (err) {
- console.log("Error: " + err);
+ cache.putAll(batch, onPutAll);
- throw new Error(err);
- }
+ function onPutAll(err) {
+ console.log(">>> Stored values in cache.");
- for (var e of entries) {
- console.log("Got entry [key=" + e.key + ", val=" + e.value + ']');
+ cache.getAll(keys, onGetAll);
}
- }
- var onPutAll= function(err) {
- if (err) {
- console.log("Error: " + err);
+ function onGetAll(err, entries) {
+ for (var e of entries) {
+ console.log("Got entry [key=" + e.key + ", val=" + e.value + ']');
+ }
- throw new Error(err);
+ // Destroying cache.
+ ignite.destroyCache(cacheName, function(err) {
+ console.log(">>> End of cache put-get example.");
+ });
}
-
- cache.getAll(keys, onGetAll);
}
+}
- cache.putAll(batch, onPutAll);
-}
\ No newline at end of file
+main();
\ No newline at end of file
[12/50] [abbrv] incubator-ignite git commit: #ignite-964: rename
examples files.
Posted by iv...@apache.org.
#ignite-964: rename examples files.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/bdf65670
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bdf65670
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bdf65670
Branch: refs/heads/ignite-961
Commit: bdf65670454b71266c27393a28606837a01a998a
Parents: 8733ba2
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Jul 8 20:32:51 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Jul 8 20:32:51 2015 +0300
----------------------------------------------------------------------
.../src/main/js/compute-callable-example.js | 44 ---------------
.../src/main/js/compute-task-split-example.js | 56 --------------------
examples/src/main/js/map-reduce-example.js | 56 ++++++++++++++++++++
examples/src/main/js/run-function-example.js | 44 +++++++++++++++
4 files changed, 100 insertions(+), 100 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bdf65670/examples/src/main/js/compute-callable-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/compute-callable-example.js b/examples/src/main/js/compute-callable-example.js
deleted file mode 100644
index 1005c9f..0000000
--- a/examples/src/main/js/compute-callable-example.js
+++ /dev/null
@@ -1,44 +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.
- */
-
-var apacheIgnite = require("apache-ignite");
-var Ignition = apacheIgnite.Ignition;
-
-Ignition.start(['127.0.0.1:9095'], null, onConnect);
-
-function onConnect(err, ignite) {
- console.log(">>> Compute callable example started");
-
- var f = function (args) {
- var words = args.split(" ");
-
- var sum = 0;
-
- for (var i = 0; i < words.length; ++i) {
- sum += words[i].length;
- }
-
- return sum;
- }
-
- var onRunScript = function(err, sum) {
- console.log(">>> Total number of characters in the phrase is '" + sum + "'.");
- console.log(">>> Check all nodes for output (this node is also part of the cluster).");
- }
-
- ignite.compute().runScript(f, "Hello Ignite Enabled World!", onRunScript);
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bdf65670/examples/src/main/js/compute-task-split-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/compute-task-split-example.js b/examples/src/main/js/compute-task-split-example.js
deleted file mode 100644
index e6d7ee9..0000000
--- a/examples/src/main/js/compute-task-split-example.js
+++ /dev/null
@@ -1,56 +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.
- */
-
-var apacheIgnite = require("apache-ignite");
-var Ignition = apacheIgnite.Ignition;
-
-Ignition.start(['127.0.0.1:9095'], null, onConnect);
-
-function onConnect(err, ignite) {
- console.log(">>> Compute task split example started.");
-
- var map = function(nodes, args) {
- var words = args.split(" ");
-
- for (var i = 0; i < words.length; i++) {
- var f = function (word) {
- print(">>> Printing '" + word + "' on this node from ignite job.");
-
- return word.length;
- };
-
- emit(f, words[i], nodes[i % nodes.length]);
- }
- }
-
- var reduce = function(results) {
- var sum = 0;
-
- for (var i = 0; i < results.length; ++i) {
- sum += results[i];
- }
-
- return sum;
- }
-
- var onMapReduce = function(err, cnt) {
- console.log(">>> Total number of characters in the phrase is '" + cnt + "'.");
- console.log(">>> Check all nodes for output (this node is also part of the cluster).");
- }
-
- ignite.compute().execute(map, reduce, "Hello Ignite Enabled World!", onMapReduce);
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bdf65670/examples/src/main/js/map-reduce-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/map-reduce-example.js b/examples/src/main/js/map-reduce-example.js
new file mode 100644
index 0000000..e6d7ee9
--- /dev/null
+++ b/examples/src/main/js/map-reduce-example.js
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var apacheIgnite = require("apache-ignite");
+var Ignition = apacheIgnite.Ignition;
+
+Ignition.start(['127.0.0.1:9095'], null, onConnect);
+
+function onConnect(err, ignite) {
+ console.log(">>> Compute task split example started.");
+
+ var map = function(nodes, args) {
+ var words = args.split(" ");
+
+ for (var i = 0; i < words.length; i++) {
+ var f = function (word) {
+ print(">>> Printing '" + word + "' on this node from ignite job.");
+
+ return word.length;
+ };
+
+ emit(f, words[i], nodes[i % nodes.length]);
+ }
+ }
+
+ var reduce = function(results) {
+ var sum = 0;
+
+ for (var i = 0; i < results.length; ++i) {
+ sum += results[i];
+ }
+
+ return sum;
+ }
+
+ var onMapReduce = function(err, cnt) {
+ console.log(">>> Total number of characters in the phrase is '" + cnt + "'.");
+ console.log(">>> Check all nodes for output (this node is also part of the cluster).");
+ }
+
+ ignite.compute().execute(map, reduce, "Hello Ignite Enabled World!", onMapReduce);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bdf65670/examples/src/main/js/run-function-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/run-function-example.js b/examples/src/main/js/run-function-example.js
new file mode 100644
index 0000000..1005c9f
--- /dev/null
+++ b/examples/src/main/js/run-function-example.js
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+var apacheIgnite = require("apache-ignite");
+var Ignition = apacheIgnite.Ignition;
+
+Ignition.start(['127.0.0.1:9095'], null, onConnect);
+
+function onConnect(err, ignite) {
+ console.log(">>> Compute callable example started");
+
+ var f = function (args) {
+ var words = args.split(" ");
+
+ var sum = 0;
+
+ for (var i = 0; i < words.length; ++i) {
+ sum += words[i].length;
+ }
+
+ return sum;
+ }
+
+ var onRunScript = function(err, sum) {
+ console.log(">>> Total number of characters in the phrase is '" + sum + "'.");
+ console.log(">>> Check all nodes for output (this node is also part of the cluster).");
+ }
+
+ ignite.compute().runScript(f, "Hello Ignite Enabled World!", onRunScript);
+}
\ No newline at end of file
[05/50] [abbrv] incubator-ignite git commit: moved link to the
project site to the top of the log
Posted by iv...@apache.org.
moved link to the project site to the top of the log
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/459d7022
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/459d7022
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/459d7022
Branch: refs/heads/ignite-961
Commit: 459d7022f8685858eb01792f2c99db5f5efc8e9a
Parents: 82f4992
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jul 8 19:39:09 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jul 8 19:39:09 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/internal/IgniteKernal.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/459d7022/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 30931fa..c12d2cf 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
@@ -1486,10 +1486,12 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
" / _/ ___/ |/ / _/_ __/ __/ ",
" _/ // (7 7 // / / / / _/ ",
"/___/\\___/_/|_/___/ /_/ /___/ ",
- " ",
+ "",
ver,
COPYRIGHT,
"",
+ "Ignite documentation: " + "http://" + SITE,
+ "",
"Quiet mode.");
if (fileName != null)
@@ -1508,7 +1510,9 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
">>> /___/\\___/_/|_/___/ /_/ /___/ " + NL +
">>> " + NL +
">>> " + ver + NL +
- ">>> " + COPYRIGHT + NL
+ ">>> " + COPYRIGHT + NL +
+ ">>> " + NL +
+ ">>> Ignite documentation: " + "http://" + SITE + NL
);
}
}
@@ -1557,8 +1561,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
">>> Local node addresses: " + U.addressesAsString(locNode) + NL +
">>> Local ports: " + sb + NL;
- str += ">>> Ignite documentation: http://" + SITE + NL;
-
log.info(str);
}
}
[33/50] [abbrv] incubator-ignite git commit: #ignite-964: renaming.
Posted by iv...@apache.org.
#ignite-964: 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/38239701
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/38239701
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/38239701
Branch: refs/heads/ignite-961
Commit: 38239701076ad8e1938910e057643b32fec1dffe
Parents: 06d3a29
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 10 12:57:55 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 10 12:57:55 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/GridKernalContext.java | 2 +-
.../ignite/internal/GridKernalContextImpl.java | 8 +-
.../apache/ignite/internal/IgniteKernal.java | 2 +-
.../IgniteScriptingCommandHandler.java | 14 +-
.../rest/handlers/scripting/NodeJSIgnite.java | 65 -----
.../rest/handlers/scripting/NodeJsCache.java | 259 ------------------
.../handlers/scripting/NodeJsClusterNode.java | 42 ---
.../rest/handlers/scripting/RestEntry.java | 57 ----
.../handlers/scripting/RestJSONCacheObject.java | 166 ------------
.../scripting/ScriptingJSONCacheObject.java | 166 ++++++++++++
.../scripting/IgniteScriptProcessor.java | 147 -----------
.../scripting/IgniteScriptingProcessor.java | 147 +++++++++++
.../processors/scripting/JSONCacheObject.java | 108 --------
.../scripting/ScriptingCacheEntry.java | 59 +++++
.../scripting/ScriptingClusterNode.java | 42 +++
.../processors/scripting/ScriptingJSIgnite.java | 65 +++++
.../processors/scripting/ScriptingJsCache.java | 260 +++++++++++++++++++
.../org/apache/ignite/json/JSONCacheObject.java | 108 ++++++++
.../ignite/internal/NodeJsCacheApiSelfTest.java | 227 ----------------
.../internal/ScriptingJsCacheApiSelfTest.java | 227 ++++++++++++++++
.../testsuites/IgniteNodeJsTestSuite.java | 2 +-
.../http/jetty/GridJettyRestHandler.java | 9 +-
22 files changed, 1090 insertions(+), 1092 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
index 16615fa..dad144c 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
@@ -240,7 +240,7 @@ public interface GridKernalContext extends Iterable<GridComponent> {
*
* @return Scripting processor.
*/
- public IgniteScriptProcessor scripting();
+ public IgniteScriptingProcessor scripting();
/**
* Gets segmentation processor.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/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 5f8ba6c..caa34a8 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
@@ -199,7 +199,7 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
/** */
@GridToStringInclude
- private IgniteScriptProcessor scriptProc;
+ private IgniteScriptingProcessor scriptProc;
/** */
@GridToStringInclude
@@ -482,8 +482,8 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
dataStructuresProc = (DataStructuresProcessor)comp;
else if (comp instanceof ClusterProcessor)
cluster = (ClusterProcessor)comp;
- else if (comp instanceof IgniteScriptProcessor)
- scriptProc = (IgniteScriptProcessor) comp;
+ else if (comp instanceof IgniteScriptingProcessor)
+ scriptProc = (IgniteScriptingProcessor) comp;
else if (!(comp instanceof DiscoveryNodeValidationProcessor))
assert (comp instanceof GridPluginComponent) : "Unknown manager class: " + comp.getClass();
@@ -664,7 +664,7 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
}
/** {@inheritDoc} */
- @Override public IgniteScriptProcessor scripting() {
+ @Override public IgniteScriptingProcessor scripting() {
return scriptProc;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 1de6f5a..6fab5f9 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
@@ -776,7 +776,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
startProcessor(new GridTaskProcessor(ctx));
startProcessor((GridProcessor)SCHEDULE.createOptional(ctx));
startProcessor(new GridRestProcessor(ctx));
- startProcessor(new IgniteScriptProcessor(ctx));
+ startProcessor(new IgniteScriptingProcessor(ctx));
startProcessor(new DataStreamProcessor(ctx));
startProcessor((GridProcessor)IGFS.create(ctx, F.isEmpty(cfg.getFileSystemConfiguration())));
startProcessor(new GridContinuousProcessor(ctx));
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
index d3f26da..8469e1c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
@@ -28,6 +28,7 @@ import org.apache.ignite.internal.processors.scripting.*;
import org.apache.ignite.internal.util.future.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.json.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.resources.*;
import org.jetbrains.annotations.*;
@@ -57,23 +58,16 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter
super(ctx);
try {
- IgniteScriptProcessor script = ctx.scripting();
+ IgniteScriptingProcessor script = ctx.scripting();
String emitFunction = "function emit(f, args, nodeId) {" +
"__emitResult.add(f.toString(), args, nodeId);}";
script.addEngineFunction(emitFunction);
- String entryFunction = "CacheEntry = function(key, val) {" +
- "this.key = key; this.value = val}";
-
- script.addEngineFunction(entryFunction);
-
emitRes = new IgniteJsEmitResult();
script.addBinding("__emitResult", emitRes);
-
- script.addBinding("ignite", new NodeJSIgnite(ctx.grid()));
}
catch (IgniteCheckedException e) {
ctx.log().error(e.getMessage());
@@ -102,7 +96,7 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter
case AFFINITY_RUN_SCRIPT: {
assert req instanceof RestRunScriptRequest : "Invalid type of run script request.";
- return ctx.closure().callLocalSafe(new AffinityRunScriptCallable(ctx, (RestRunScriptRequest)req));
+ return ctx.closure().callLocalSafe(new AffinityRunScriptCallable(ctx, (RestRunScriptRequest) req));
}
case EXECUTE_MAP_REDUCE_SCRIPT: {
@@ -220,7 +214,7 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter
public JsCallFunctionJob(String func, Object argv) {
this.func = func;
- this.argv = RestJSONCacheObject.convertToRestObject(
+ this.argv = ScriptingJSONCacheObject.convertToRestObject(
JSONCacheObject.toSimpleObject(argv));
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/NodeJSIgnite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/NodeJSIgnite.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/NodeJSIgnite.java
deleted file mode 100644
index 3e1ef4e..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/NodeJSIgnite.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.rest.handlers.scripting;
-
-import org.apache.ignite.*;
-
-/**
- * Node js ignite.
- */
-public class NodeJSIgnite {
- /** Ignite. */
- private Ignite ignite;
-
- /**
- * @param ignite Ignite.
- */
- public NodeJSIgnite(Ignite ignite) {
- this.ignite = ignite;
- }
-
- /**
- * @param cache Cache name.
- * @return Node js cache.
- */
- public NodeJsCache cache(String cache) {
- return new NodeJsCache(ignite.cache(cache));
- }
-
- /**
- * @param cache Cache name.
- * @return Node js cache.
- */
- public NodeJsCache getOrCreateCache(String cache) {
- return new NodeJsCache(ignite.getOrCreateCache(cache));
- }
-
- /**
- * @return Local node.
- */
- public NodeJsClusterNode localNode() {
- return new NodeJsClusterNode(ignite.cluster().localNode());
- }
-
- /**
- * @return Ignite name.
- */
- public String name() {
- return ignite.name();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/NodeJsCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/NodeJsCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/NodeJsCache.java
deleted file mode 100644
index 5c21e28..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/NodeJsCache.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.rest.handlers.scripting;
-
-import org.apache.ignite.*;
-import org.apache.ignite.internal.processors.scripting.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-
-import java.util.*;
-
-/**
- * Node js cache.
- */
-public class NodeJsCache {
- /** Ignite cache. */
- private IgniteCache<Object, Object> cache;
-
- /**
- * @param cache Ignite cache.
- */
- public NodeJsCache(IgniteCache cache) {
- this.cache = cache;
- }
-
- /**
- * @param key Key.
- * @param val Value.
- */
- public void put(Object key, Object val) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
- Object cacheVal = JSONCacheObject.toSimpleObject(val);
-
- cache.put(cacheKey, cacheVal);
- }
-
- /**
- * @param key Key.
- */
- public Object get(Object key) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
-
- return RestJSONCacheObject.convertToRestObject(cache.get(cacheKey));
- }
-
- /**
- * @param key Key
- * @return True if cache contains key.
- */
- public boolean containsKey(Object key) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
-
- return cache.containsKey(cacheKey);
- }
-
- /**
- * @param keys Keys
- * @return True if cache contains key.
- */
- public boolean containsKeys(List keys) {
- List<Object> cacheKeys = (List<Object>)JSONCacheObject.toSimpleObject(keys);
-
- return cache.containsKeys(new HashSet<>(cacheKeys));
- }
-
- /**
- * @param keys Keys.
- * @return Cache entries.
- */
- public List<RestEntry> getAll(List keys) {
- List cacheKeys = (List)JSONCacheObject.toSimpleObject(keys);
-
- Map<Object, Object> entries = cache.getAll(new HashSet<>(cacheKeys));
-
- List<RestEntry> res = new ArrayList<>();
-
- for (Map.Entry<Object, Object> e : entries.entrySet())
- res.add(new RestEntry(
- RestJSONCacheObject.convertToRestObject(e.getKey()),
- RestJSONCacheObject.convertToRestObject(e.getValue())));
-
- return res;
- }
-
- /**
- * @param keys Keys.
- */
- public void removeAll(List keys) {
- List cacheKeys = (List)JSONCacheObject.toSimpleObject(keys);
-
- cache.removeAll(new HashSet<>(cacheKeys));
- }
-
- /**
- * @param entries Entries.
- */
- public void putAll(List entries) {
- List cacheKeys = (List)JSONCacheObject.toSimpleObject(entries);
-
- Map<Object, Object> cacheEntries = U.newHashMap(entries.size());
-
- for (Object e : cacheKeys) {
- JSONCacheObject e0 = (JSONCacheObject)e;
- cacheEntries.put(e0.getField("key"), e0.getField("value"));
- }
-
- cache.putAll(cacheEntries);
- }
-
- /**
- * @param key Key.
- * @param val Value.
- * @return Previous value.
- */
- public Object getAndPut(Object key, Object val) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
- Object cacheVal = JSONCacheObject.toSimpleObject(val);
-
- return RestJSONCacheObject.convertToRestObject(cache.getAndPut(cacheKey, cacheVal));
- }
-
- /**
- * @param key Key.
- * @param val Value.
- * @return Previous value.
- */
- public Object getAndReplace(Object key, Object val) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
- Object cacheVal = JSONCacheObject.toSimpleObject(val);
-
- Object o = RestJSONCacheObject.convertToRestObject(cache.getAndReplace(cacheKey, cacheVal));
-
- return o;
- }
-
- /**
- * @param key Key.
- * @param val Value.
- * @return Previous value.
- */
- public Object getAndPutIfAbsent(Object key, Object val) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
- Object cacheVal = JSONCacheObject.toSimpleObject(val);
-
- return RestJSONCacheObject.convertToRestObject(cache.getAndPutIfAbsent(cacheKey, cacheVal));
- }
-
- /**
- * @param key Key.
- * @return Previous value.
- */
- public Object getAndRemove(Object key) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
-
- return RestJSONCacheObject.convertToRestObject(cache.getAndRemove(cacheKey));
- }
-
- /**
- * @param key Key.
- * @return If operation success.
- */
- public boolean remove(Object key) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
-
- return cache.remove(cacheKey);
- }
-
- /**
- * @param key Key.
- * @param val Value.
- * @return If operation success.
- */
- public boolean removeValue(Object key, Object val) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
- Object cacheVal = JSONCacheObject.toSimpleObject(val);
-
- return cache.remove(cacheKey, cacheVal);
- }
-
- /**
- * @param key Key.
- * @param val Value.
- * @return If operation success.
- */
- public boolean replace(Object key, Object val) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
- Object cacheVal = JSONCacheObject.toSimpleObject(val);
-
- return cache.replace(cacheKey, cacheVal);
- }
-
- /**
- * @param key Key.
- * @param val Value.
- * @param oldVal Old value.
- * @return If operation success.
- */
- public boolean replaceValue(Object key, Object val, Object oldVal) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
- Object cacheVal = JSONCacheObject.toSimpleObject(val);
- Object oldCacheVal = JSONCacheObject.toSimpleObject(oldVal);
-
- return cache.replace(cacheKey, oldCacheVal, cacheVal);
- }
-
- /**
- * Removes all from cache.
- */
- public void removeAllFromCache() {
- cache.removeAll();
- }
-
- /**
- * @param key Key.
- * @param val Value.
- * @return Previous value.
- */
- public Object putIfAbsent(Object key, Object val) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
- Object cacheVal = JSONCacheObject.toSimpleObject(val);
-
- return cache.putIfAbsent(cacheKey, cacheVal);
- }
-
- /**
- * @return Cache name.
- */
- public String getName() {
- return cache.getName();
- }
-
- /**
- * @return Local size.
- */
- public int localSize() {
- return cache.localSize();
- }
-
- /**
- * @return Size.
- */
- public int size() {
- return cache.size();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/NodeJsClusterNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/NodeJsClusterNode.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/NodeJsClusterNode.java
deleted file mode 100644
index fb513fb..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/NodeJsClusterNode.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.rest.handlers.scripting;
-
-import org.apache.ignite.cluster.*;
-
-/**
- * Node js cluster node.
- */
-public class NodeJsClusterNode {
- /** Cluster node. */
- private String id;
-
- /**
- * @param node Cluster node.
- */
- public NodeJsClusterNode(ClusterNode node) {
- this.id = node.id().toString();
- }
-
- /**
- * @return Node id.
- */
- public String id() {
- return id;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/RestEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/RestEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/RestEntry.java
deleted file mode 100644
index c4f9fd1..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/RestEntry.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.apache.ignite.internal.processors.rest.handlers.scripting;
-
-
-/**
- * Rest entry.
- */
-public class RestEntry {
- /** Key. */
- private Object key;
-
- /** Value. */
- private Object val;
-
- /**
- * @param key Key.
- * @param val Value.
- */
- public RestEntry(Object key, Object val) {
- if (key instanceof RestJSONCacheObject)
- this.key = ((RestJSONCacheObject)key).getFields();
- else
- this.key = key;
-
- if (val instanceof RestJSONCacheObject)
- this.val = ((RestJSONCacheObject)val).getFields();
- else
- this.val = val;
- }
-
- /**
- * @return Key.
- */
- public Object getKey() {
- return key;
- }
-
- /**
- * @param key Key.
- */
- public void setKey(Object key) {
- this.key = key;
- }
-
- /**
- * @return Value.
- */
- public Object getValue() {
- return val;
- }
-
- /**
- * @param val Value.
- */
- public void setValue(Object val) {
- this.val = val;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/RestJSONCacheObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/RestJSONCacheObject.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/RestJSONCacheObject.java
deleted file mode 100644
index 3bb615c..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/RestJSONCacheObject.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.rest.handlers.scripting;
-
-import jdk.nashorn.api.scripting.*;
-import org.apache.ignite.internal.processors.scripting.*;
-import org.apache.ignite.internal.util.typedef.internal.U;
-
-import java.util.*;
-
-/**
- * Json cache object.
- */
-public class RestJSONCacheObject implements JSObject {
- /** Fields. */
- private final JSONCacheObject fields;
-
- /**
- * @param o JSON object.
- */
- private RestJSONCacheObject(JSONCacheObject o) {
- fields = o;
- }
-
- /**
- * @param o Object.
- * @return Rest JSON cache object.
- */
- public static Object convertToRestObject(Object o) {
- if (o instanceof JSONCacheObject)
- return new RestJSONCacheObject((JSONCacheObject)o);
-
- return o;
- }
-
- /**
- * @return Fields.
- */
- public Map<Object, Object> getFields() {
- return fields;
- }
-
- /**
- * @param key Field name.
- * @return Field value.
- */
- public Object getField(Object key) {
- return fields.get(key);
- }
-
- @Override public Object call(Object o, Object... objects) {
- System.out.println("!!!!CALL");
- return null;
- }
-
- @Override public Object newObject(Object... objects) {
- System.out.println("!!!!newObject");
- return null;
- }
-
- @Override public Object eval(String s) {
- System.out.println("!!!!eval");
- return null;
- }
-
- @Override public Object getMember(String s) {
- System.out.println("!!!!getMember + " + s);
- return fields.get(s);
- }
-
- @Override public Object getSlot(int i) {
- System.out.println("!!!!getSlot");
- return null;
- }
-
- @Override public boolean hasMember(String s) {
- System.out.println("!!!!hasMember");
- return fields.containsKey(s);
- }
-
- @Override public boolean hasSlot(int i) {
- System.out.println("!!!!hasSlot");
- return false;
- }
-
- @Override public void removeMember(String s) {
- System.out.println("!!!!removeMember");
- fields.remove(s);
- }
-
- @Override public void setMember(String s, Object o) {
- System.out.println("!!!!setMember");
- fields.put(s, o);
- }
-
- @Override public void setSlot(int i, Object o) {
- System.out.println("!!!!setSlot");
-
- }
-
- @Override public Set<String> keySet() {
- System.out.println("!!!!keySet");
- Set<String> keys = new HashSet<>();
-
- for (Object o : fields.keySet()) {
- if (!(o instanceof RestJSONCacheObject))
- keys.add(o.toString());
- }
-
- return keys;
- }
-
- @Override public Collection<Object> values() {
- System.out.println("!!!!values");
- return fields.values();
- }
-
- @Override public boolean isInstance(Object o) {
- System.out.println("!!!!isInstance");
- return false;
- }
-
- @Override public boolean isInstanceOf(Object o) {
- System.out.println("!!!!isInstanceOf");
- return false;
- }
-
- @Override public String getClassName() {
- System.out.println("!!!!getClassName");
- return U.getSimpleName(RestJSONCacheObject.class);
- }
-
- @Override public boolean isFunction() {
- System.out.println("!!!!isFunction");
- return false;
- }
-
- @Override public boolean isStrictFunction() {
- System.out.println("!!!!isStrictFunction");
- return false;
- }
-
- @Override public boolean isArray() {
- System.out.println("!!!!isArray");
- return false;
- }
-
- @Override public double toNumber() {
- return 0;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/ScriptingJSONCacheObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/ScriptingJSONCacheObject.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/ScriptingJSONCacheObject.java
new file mode 100644
index 0000000..8d446ba
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/ScriptingJSONCacheObject.java
@@ -0,0 +1,166 @@
+/*
+ * 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.scripting;
+
+import jdk.nashorn.api.scripting.*;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.json.*;
+
+import java.util.*;
+
+/**
+ * Json cache object.
+ */
+public class ScriptingJSONCacheObject implements JSObject {
+ /** Fields. */
+ private final JSONCacheObject fields;
+
+ /**
+ * @param o JSON object.
+ */
+ private ScriptingJSONCacheObject(JSONCacheObject o) {
+ fields = o;
+ }
+
+ /**
+ * @param o Object.
+ * @return Rest JSON cache object.
+ */
+ public static Object convertToRestObject(Object o) {
+ if (o instanceof JSONCacheObject)
+ return new ScriptingJSONCacheObject((JSONCacheObject)o);
+
+ return o;
+ }
+
+ /**
+ * @return Fields.
+ */
+ public Map<Object, Object> getFields() {
+ return fields;
+ }
+
+ /**
+ * @param key Field name.
+ * @return Field value.
+ */
+ public Object getField(Object key) {
+ return fields.get(key);
+ }
+
+ @Override public Object call(Object o, Object... objects) {
+ System.out.println("!!!!CALL");
+ return null;
+ }
+
+ @Override public Object newObject(Object... objects) {
+ System.out.println("!!!!newObject");
+ return null;
+ }
+
+ @Override public Object eval(String s) {
+ System.out.println("!!!!eval");
+ return null;
+ }
+
+ @Override public Object getMember(String s) {
+ System.out.println("!!!!getMember + " + s);
+ return fields.get(s);
+ }
+
+ @Override public Object getSlot(int i) {
+ System.out.println("!!!!getSlot");
+ return null;
+ }
+
+ @Override public boolean hasMember(String s) {
+ System.out.println("!!!!hasMember");
+ return fields.containsKey(s);
+ }
+
+ @Override public boolean hasSlot(int i) {
+ System.out.println("!!!!hasSlot");
+ return false;
+ }
+
+ @Override public void removeMember(String s) {
+ System.out.println("!!!!removeMember");
+ fields.remove(s);
+ }
+
+ @Override public void setMember(String s, Object o) {
+ System.out.println("!!!!setMember");
+ fields.put(s, o);
+ }
+
+ @Override public void setSlot(int i, Object o) {
+ System.out.println("!!!!setSlot");
+
+ }
+
+ @Override public Set<String> keySet() {
+ System.out.println("!!!!keySet");
+ Set<String> keys = new HashSet<>();
+
+ for (Object o : fields.keySet()) {
+ if (!(o instanceof ScriptingJSONCacheObject))
+ keys.add(o.toString());
+ }
+
+ return keys;
+ }
+
+ @Override public Collection<Object> values() {
+ System.out.println("!!!!values");
+ return fields.values();
+ }
+
+ @Override public boolean isInstance(Object o) {
+ System.out.println("!!!!isInstance");
+ return false;
+ }
+
+ @Override public boolean isInstanceOf(Object o) {
+ System.out.println("!!!!isInstanceOf");
+ return false;
+ }
+
+ @Override public String getClassName() {
+ System.out.println("!!!!getClassName");
+ return U.getSimpleName(ScriptingJSONCacheObject.class);
+ }
+
+ @Override public boolean isFunction() {
+ System.out.println("!!!!isFunction");
+ return false;
+ }
+
+ @Override public boolean isStrictFunction() {
+ System.out.println("!!!!isStrictFunction");
+ return false;
+ }
+
+ @Override public boolean isArray() {
+ System.out.println("!!!!isArray");
+ return false;
+ }
+
+ @Override public double toNumber() {
+ return 0;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java
deleted file mode 100644
index 1f6dfbc..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.scripting;
-
-import org.apache.ignite.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.processors.*;
-
-import javax.script.*;
-
-import static javax.script.ScriptContext.*;
-
-/**
- * Ignite scripting processor.
- */
-public class IgniteScriptProcessor extends GridProcessorAdapter {
- /** Javascript engine name. */
- public static final String JAVA_SCRIPT_ENGINE_NAME = "nashorn";
-
- /** Javascript engine. */
- private ScriptEngine jsEngine;
-
- /**
- * @param ctx Kernal context.
- */
- public IgniteScriptProcessor(GridKernalContext ctx) {
- super(ctx);
- }
-
- /** {@inheritDoc} */
- @Override public void start() throws IgniteCheckedException {
- ScriptEngineManager factory = new ScriptEngineManager();
-
- jsEngine = factory.getEngineByName(JAVA_SCRIPT_ENGINE_NAME);
-
- Bindings bind = jsEngine.createBindings();
-
- bind.put("ignite", ctx.grid());
-
- jsEngine.setBindings(bind, ENGINE_SCOPE);
-
- String createJSFunction = "function __createJSFunction(mapFunc) {" +
- "return eval('(function() { return ' + mapFunc.trim() + '})()'); }";
-
- String internalCall = "function __internalCall(funcSource, arg1, arg2) { " +
- "var func = __createJSFunction(funcSource); " +
- "return func.apply(null, [arg1, arg2]); }";
-
- String internalJSCall = "function __internalJSCall(funcSource, arg1, arg2) { " +
- "var func = __createJSFunction(funcSource); " +
- "return func.apply(null, [JSON.parse(arg1), arg2]); }";
-
- addEngineFunction(createJSFunction);
- addEngineFunction(internalCall);
- addEngineFunction(internalJSCall);
- }
-
- /**
- * Add function to scope.
- *
- * @param script Function script.
- * @throws IgniteCheckedException If script failed.
- */
- public void addEngineFunction(String script) throws IgniteCheckedException {
- try {
- jsEngine.eval(script);
- }
- catch (ScriptException e) {
- throw new IgniteCheckedException("Script evaluation failed [script=" + script + "].", e);
- }
- }
-
- /**
- * Add binding.
- *
- * @param name Binding name.
- * @param o Object to bind.
- */
- public void addBinding(String name, Object o) {
- Bindings b = jsEngine.getBindings(ENGINE_SCOPE);
-
- b.put(name, o);
-
- jsEngine.setBindings(b, ENGINE_SCOPE);
- }
-
- /**
- * @param src Script src.
- * @return Result of the function.
- * @throws IgniteCheckedException If script failed.
- */
- public Object invokeFunction(String src) throws IgniteCheckedException {
- try {
- return jsEngine.eval("(" + src + ")()");
- }
- catch (ScriptException e) {
- throw new IgniteCheckedException("Function evaluation failed [funcName=" + src + "].");
- }
- }
-
- /**
- * @param src Script src.
- * @param arg Argument.
- * @return Result of the function.
- * @throws IgniteCheckedException If script failed.
- */
- public Object invokeFunction(String src, Object arg) throws IgniteCheckedException {
- return invokeFunction(src, arg, null);
- }
-
- /**
- * @param src Script src.
- * @param arg Argument.
- * @return Result of the function.
- * @throws IgniteCheckedException If script failed.
- */
- public Object invokeFunction(String src, Object arg, Object arg2) throws IgniteCheckedException {
- try {
- Invocable invocable = (Invocable) jsEngine;
-
- return invocable.invokeFunction("__internalCall", src, arg, arg2);
- }
- catch (ScriptException e) {
- throw new IgniteCheckedException("Function evaluation failed [funcName=" + src +
- ", err= " + e.getMessage() + "].");
- }
- catch (NoSuchMethodException e) {
- throw new IgniteCheckedException("Cannot find function [func=__internalCall" +
- ", err= " + e.getMessage() + "].");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
new file mode 100644
index 0000000..4224b22
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
@@ -0,0 +1,147 @@
+/*
+ * 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.scripting;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.*;
+
+import javax.script.*;
+
+import static javax.script.ScriptContext.*;
+
+/**
+ * Ignite scripting processor.
+ */
+public class IgniteScriptingProcessor extends GridProcessorAdapter {
+ /** Javascript engine name. */
+ public static final String JAVA_SCRIPT_ENGINE_NAME = "nashorn";
+
+ /** Javascript engine. */
+ private ScriptEngine jsEngine;
+
+ /**
+ * @param ctx Kernal context.
+ */
+ public IgniteScriptingProcessor(GridKernalContext ctx) {
+ super(ctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void start() throws IgniteCheckedException {
+ ScriptEngineManager factory = new ScriptEngineManager();
+
+ jsEngine = factory.getEngineByName(JAVA_SCRIPT_ENGINE_NAME);
+
+ addBinding("ignite", new ScriptingJSIgnite(ctx.grid()));
+
+ String createJSFunction = "function __createJSFunction(mapFunc) {" +
+ "return eval('(function() { return ' + mapFunc.trim() + '})()'); }";
+
+ String internalCall = "function __internalCall(funcSource, arg1, arg2) { " +
+ "var func = __createJSFunction(funcSource); " +
+ "return func.apply(null, [arg1, arg2]); }";
+
+ String internalJSCall = "function __internalJSCall(funcSource, arg1, arg2) { " +
+ "var func = __createJSFunction(funcSource); " +
+ "return func.apply(null, [JSON.parse(arg1), arg2]); }";
+
+ String entryFunction = "CacheEntry = function(key, val) {" +
+ "this.key = key; this.value = val}";
+
+ addEngineFunction(entryFunction);
+ addEngineFunction(createJSFunction);
+ addEngineFunction(internalCall);
+ addEngineFunction(internalJSCall);
+ }
+
+ /**
+ * Add function to scope.
+ *
+ * @param script Function script.
+ * @throws IgniteCheckedException If script failed.
+ */
+ public void addEngineFunction(String script) throws IgniteCheckedException {
+ try {
+ jsEngine.eval(script);
+ }
+ catch (ScriptException e) {
+ throw new IgniteCheckedException("Script evaluation failed [script=" + script + "].", e);
+ }
+ }
+
+ /**
+ * Add binding.
+ *
+ * @param name Binding name.
+ * @param o Object to bind.
+ */
+ public void addBinding(String name, Object o) {
+ Bindings b = jsEngine.getBindings(ENGINE_SCOPE);
+
+ b.put(name, o);
+
+ jsEngine.setBindings(b, ENGINE_SCOPE);
+ }
+
+ /**
+ * @param src Script src.
+ * @return Result of the function.
+ * @throws IgniteCheckedException If script failed.
+ */
+ public Object invokeFunction(String src) throws IgniteCheckedException {
+ try {
+ return jsEngine.eval("(" + src + ")()");
+ }
+ catch (ScriptException e) {
+ throw new IgniteCheckedException("Function evaluation failed [funcName=" + src + "].");
+ }
+ }
+
+ /**
+ * @param src Script src.
+ * @param arg Argument.
+ * @return Result of the function.
+ * @throws IgniteCheckedException If script failed.
+ */
+ public Object invokeFunction(String src, Object arg) throws IgniteCheckedException {
+ return invokeFunction(src, arg, null);
+ }
+
+ /**
+ * @param src Script src.
+ * @param arg Argument.
+ * @return Result of the function.
+ * @throws IgniteCheckedException If script failed.
+ */
+ public Object invokeFunction(String src, Object arg, Object arg2) throws IgniteCheckedException {
+ try {
+ Invocable invocable = (Invocable) jsEngine;
+
+ return invocable.invokeFunction("__internalCall", src, arg, arg2);
+ }
+ catch (ScriptException e) {
+ throw new IgniteCheckedException("Function evaluation failed [funcName=" + src +
+ ", err= " + e.getMessage() + "].");
+ }
+ catch (NoSuchMethodException e) {
+ throw new IgniteCheckedException("Cannot find function [func=__internalCall" +
+ ", err= " + e.getMessage() + "].");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java
deleted file mode 100644
index 8116fa0..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.scripting;
-
-import java.util.*;
-
-/**
- * JSON cache object.
- */
-public class JSONCacheObject extends HashMap<Object, Object> {
- /**
- * Empty constructor.
- */
- public JSONCacheObject() {
- // No-op.
- }
-
- /**
- * @param o Map.
- */
- public JSONCacheObject(Map o) {
- for (Object key : o.keySet())
- addField(JSONCacheObject.toSimpleObject(key), JSONCacheObject.toSimpleObject(o.get(key)));
- }
-
- /**
- * @param key Field name.
- * @param val Field value.
- */
- public void addField(Object key, Object val) {
- put(key, val);
- }
-
- /**
- * @param key Field name.
- * @return Field value.
- */
- public Object getField(Object key) {
- return get(key);
- }
-
- /**
- * Convert JSON object to RestJSONCacheObject
- *
- * @param o Object to convert.
- * @return Converted object.
- */
- public static Object toSimpleObject(Object o) {
- if (o == null)
- return null;
-
- if (o instanceof Map) {
- Map o1 = (Map)o;
-
- JSONCacheObject res = new JSONCacheObject();
-
- for (Object key : o1.keySet())
- res.addField(toSimpleObject(key), toSimpleObject(o1.get(key)));
-
- return res;
- }
- else if (o instanceof List) {
- List o1 = (List) o;
-
- List<Object> val = new ArrayList<>();
-
- for (Object v : o1)
- val.add(toSimpleObject(v));
-
- return val;
- }
- else if (o.getClass().isArray()) {
- Object[] o1 = (Object[]) o;
-
- List<Object> val = new ArrayList<>();
-
- for (Object v : o1)
- val.add(toSimpleObject(v));
-
- return val;
- }
-
- return o;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object obj) {
- if (obj == null || !(obj instanceof JSONCacheObject))
- return false;
-
- return super.equals(obj);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingCacheEntry.java
new file mode 100644
index 0000000..96c98d0
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingCacheEntry.java
@@ -0,0 +1,59 @@
+package org.apache.ignite.internal.processors.scripting;
+
+
+import org.apache.ignite.internal.processors.rest.handlers.scripting.*;
+
+/**
+ * Scripting cache entry.
+ */
+public class ScriptingCacheEntry {
+ /** Key. */
+ private Object key;
+
+ /** Value. */
+ private Object val;
+
+ /**
+ * @param key Key.
+ * @param val Value.
+ */
+ public ScriptingCacheEntry(Object key, Object val) {
+ if (key instanceof ScriptingJSONCacheObject)
+ this.key = ((ScriptingJSONCacheObject)key).getFields();
+ else
+ this.key = key;
+
+ if (val instanceof ScriptingJSONCacheObject)
+ this.val = ((ScriptingJSONCacheObject)val).getFields();
+ else
+ this.val = val;
+ }
+
+ /**
+ * @return Key.
+ */
+ public Object getKey() {
+ return key;
+ }
+
+ /**
+ * @param key Key.
+ */
+ public void setKey(Object key) {
+ this.key = key;
+ }
+
+ /**
+ * @return Value.
+ */
+ public Object getValue() {
+ return val;
+ }
+
+ /**
+ * @param val Value.
+ */
+ public void setValue(Object val) {
+ this.val = val;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingClusterNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingClusterNode.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingClusterNode.java
new file mode 100644
index 0000000..7c42274
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingClusterNode.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.scripting;
+
+import org.apache.ignite.cluster.*;
+
+/**
+ * Node js cluster node.
+ */
+public class ScriptingClusterNode {
+ /** Cluster node. */
+ private String id;
+
+ /**
+ * @param node Cluster node.
+ */
+ public ScriptingClusterNode(ClusterNode node) {
+ this.id = node.id().toString();
+ }
+
+ /**
+ * @return Node id.
+ */
+ public String id() {
+ return id;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJSIgnite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJSIgnite.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJSIgnite.java
new file mode 100644
index 0000000..1c89318
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJSIgnite.java
@@ -0,0 +1,65 @@
+/*
+ * 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.scripting;
+
+import org.apache.ignite.*;
+
+/**
+ * Node js ignite.
+ */
+public class ScriptingJSIgnite {
+ /** Ignite. */
+ private Ignite ignite;
+
+ /**
+ * @param ignite Ignite.
+ */
+ public ScriptingJSIgnite(Ignite ignite) {
+ this.ignite = ignite;
+ }
+
+ /**
+ * @param cache Cache name.
+ * @return Node js cache.
+ */
+ public ScriptingJsCache cache(String cache) {
+ return new ScriptingJsCache(ignite.cache(cache));
+ }
+
+ /**
+ * @param cache Cache name.
+ * @return Node js cache.
+ */
+ public ScriptingJsCache getOrCreateCache(String cache) {
+ return new ScriptingJsCache(ignite.getOrCreateCache(cache));
+ }
+
+ /**
+ * @return Local node.
+ */
+ public ScriptingClusterNode localNode() {
+ return new ScriptingClusterNode(ignite.cluster().localNode());
+ }
+
+ /**
+ * @return Ignite name.
+ */
+ public String name() {
+ return ignite.name();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
new file mode 100644
index 0000000..cc1dd18
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
@@ -0,0 +1,260 @@
+/*
+ * 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.scripting;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.processors.rest.handlers.scripting.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.json.*;
+
+import java.util.*;
+
+/**
+ * Scripting cache.
+ */
+public class ScriptingJsCache {
+ /** Ignite cache. */
+ private IgniteCache<Object, Object> cache;
+
+ /**
+ * @param cache Ignite cache.
+ */
+ public ScriptingJsCache(IgniteCache cache) {
+ this.cache = cache;
+ }
+
+ /**
+ * @param key Key.
+ * @param val Value.
+ */
+ public void put(Object key, Object val) {
+ Object cacheKey = JSONCacheObject.toSimpleObject(key);
+ Object cacheVal = JSONCacheObject.toSimpleObject(val);
+
+ cache.put(cacheKey, cacheVal);
+ }
+
+ /**
+ * @param key Key.
+ */
+ public Object get(Object key) {
+ Object cacheKey = JSONCacheObject.toSimpleObject(key);
+
+ return ScriptingJSONCacheObject.convertToRestObject(cache.get(cacheKey));
+ }
+
+ /**
+ * @param key Key
+ * @return True if cache contains key.
+ */
+ public boolean containsKey(Object key) {
+ Object cacheKey = JSONCacheObject.toSimpleObject(key);
+
+ return cache.containsKey(cacheKey);
+ }
+
+ /**
+ * @param keys Keys
+ * @return True if cache contains key.
+ */
+ public boolean containsKeys(List keys) {
+ List<Object> cacheKeys = (List<Object>)JSONCacheObject.toSimpleObject(keys);
+
+ return cache.containsKeys(new HashSet<>(cacheKeys));
+ }
+
+ /**
+ * @param keys Keys.
+ * @return Cache entries.
+ */
+ public List<ScriptingCacheEntry> getAll(List keys) {
+ List cacheKeys = (List)JSONCacheObject.toSimpleObject(keys);
+
+ Map<Object, Object> entries = cache.getAll(new HashSet<>(cacheKeys));
+
+ List<ScriptingCacheEntry> res = new ArrayList<>();
+
+ for (Map.Entry<Object, Object> e : entries.entrySet())
+ res.add(new ScriptingCacheEntry(
+ ScriptingJSONCacheObject.convertToRestObject(e.getKey()),
+ ScriptingJSONCacheObject.convertToRestObject(e.getValue())));
+
+ return res;
+ }
+
+ /**
+ * @param keys Keys.
+ */
+ public void removeAll(List keys) {
+ List cacheKeys = (List)JSONCacheObject.toSimpleObject(keys);
+
+ cache.removeAll(new HashSet<>(cacheKeys));
+ }
+
+ /**
+ * @param entries Entries.
+ */
+ public void putAll(List entries) {
+ List cacheKeys = (List)JSONCacheObject.toSimpleObject(entries);
+
+ Map<Object, Object> cacheEntries = U.newHashMap(entries.size());
+
+ for (Object e : cacheKeys) {
+ JSONCacheObject e0 = (JSONCacheObject)e;
+ cacheEntries.put(e0.getField("key"), e0.getField("value"));
+ }
+
+ cache.putAll(cacheEntries);
+ }
+
+ /**
+ * @param key Key.
+ * @param val Value.
+ * @return Previous value.
+ */
+ public Object getAndPut(Object key, Object val) {
+ Object cacheKey = JSONCacheObject.toSimpleObject(key);
+ Object cacheVal = JSONCacheObject.toSimpleObject(val);
+
+ return ScriptingJSONCacheObject.convertToRestObject(cache.getAndPut(cacheKey, cacheVal));
+ }
+
+ /**
+ * @param key Key.
+ * @param val Value.
+ * @return Previous value.
+ */
+ public Object getAndReplace(Object key, Object val) {
+ Object cacheKey = JSONCacheObject.toSimpleObject(key);
+ Object cacheVal = JSONCacheObject.toSimpleObject(val);
+
+ Object o = ScriptingJSONCacheObject.convertToRestObject(cache.getAndReplace(cacheKey, cacheVal));
+
+ return o;
+ }
+
+ /**
+ * @param key Key.
+ * @param val Value.
+ * @return Previous value.
+ */
+ public Object getAndPutIfAbsent(Object key, Object val) {
+ Object cacheKey = JSONCacheObject.toSimpleObject(key);
+ Object cacheVal = JSONCacheObject.toSimpleObject(val);
+
+ return ScriptingJSONCacheObject.convertToRestObject(cache.getAndPutIfAbsent(cacheKey, cacheVal));
+ }
+
+ /**
+ * @param key Key.
+ * @return Previous value.
+ */
+ public Object getAndRemove(Object key) {
+ Object cacheKey = JSONCacheObject.toSimpleObject(key);
+
+ return ScriptingJSONCacheObject.convertToRestObject(cache.getAndRemove(cacheKey));
+ }
+
+ /**
+ * @param key Key.
+ * @return If operation success.
+ */
+ public boolean remove(Object key) {
+ Object cacheKey = JSONCacheObject.toSimpleObject(key);
+
+ return cache.remove(cacheKey);
+ }
+
+ /**
+ * @param key Key.
+ * @param val Value.
+ * @return If operation success.
+ */
+ public boolean removeValue(Object key, Object val) {
+ Object cacheKey = JSONCacheObject.toSimpleObject(key);
+ Object cacheVal = JSONCacheObject.toSimpleObject(val);
+
+ return cache.remove(cacheKey, cacheVal);
+ }
+
+ /**
+ * @param key Key.
+ * @param val Value.
+ * @return If operation success.
+ */
+ public boolean replace(Object key, Object val) {
+ Object cacheKey = JSONCacheObject.toSimpleObject(key);
+ Object cacheVal = JSONCacheObject.toSimpleObject(val);
+
+ return cache.replace(cacheKey, cacheVal);
+ }
+
+ /**
+ * @param key Key.
+ * @param val Value.
+ * @param oldVal Old value.
+ * @return If operation success.
+ */
+ public boolean replaceValue(Object key, Object val, Object oldVal) {
+ Object cacheKey = JSONCacheObject.toSimpleObject(key);
+ Object cacheVal = JSONCacheObject.toSimpleObject(val);
+ Object oldCacheVal = JSONCacheObject.toSimpleObject(oldVal);
+
+ return cache.replace(cacheKey, oldCacheVal, cacheVal);
+ }
+
+ /**
+ * Removes all from cache.
+ */
+ public void removeAllFromCache() {
+ cache.removeAll();
+ }
+
+ /**
+ * @param key Key.
+ * @param val Value.
+ * @return Previous value.
+ */
+ public Object putIfAbsent(Object key, Object val) {
+ Object cacheKey = JSONCacheObject.toSimpleObject(key);
+ Object cacheVal = JSONCacheObject.toSimpleObject(val);
+
+ return cache.putIfAbsent(cacheKey, cacheVal);
+ }
+
+ /**
+ * @return Cache name.
+ */
+ public String getName() {
+ return cache.getName();
+ }
+
+ /**
+ * @return Local size.
+ */
+ public int localSize() {
+ return cache.localSize();
+ }
+
+ /**
+ * @return Size.
+ */
+ public int size() {
+ return cache.size();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/core/src/main/java/org/apache/ignite/json/JSONCacheObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/json/JSONCacheObject.java b/modules/core/src/main/java/org/apache/ignite/json/JSONCacheObject.java
new file mode 100644
index 0000000..9f1b601
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/json/JSONCacheObject.java
@@ -0,0 +1,108 @@
+/*
+ * 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.json;
+
+import java.util.*;
+
+/**
+ * JSON cache object.
+ */
+public class JSONCacheObject extends HashMap<Object, Object> {
+ /**
+ * Empty constructor.
+ */
+ public JSONCacheObject() {
+ // No-op.
+ }
+
+ /**
+ * @param o Map.
+ */
+ public JSONCacheObject(Map o) {
+ for (Object key : o.keySet())
+ addField(JSONCacheObject.toSimpleObject(key), JSONCacheObject.toSimpleObject(o.get(key)));
+ }
+
+ /**
+ * @param key Field name.
+ * @param val Field value.
+ */
+ public void addField(Object key, Object val) {
+ put(key, val);
+ }
+
+ /**
+ * @param key Field name.
+ * @return Field value.
+ */
+ public Object getField(Object key) {
+ return get(key);
+ }
+
+ /**
+ * Convert JSON object to RestJSONCacheObject
+ *
+ * @param o Object to convert.
+ * @return Converted object.
+ */
+ public static Object toSimpleObject(Object o) {
+ if (o == null)
+ return null;
+
+ if (o instanceof Map) {
+ Map o1 = (Map)o;
+
+ JSONCacheObject res = new JSONCacheObject();
+
+ for (Object key : o1.keySet())
+ res.addField(toSimpleObject(key), toSimpleObject(o1.get(key)));
+
+ return res;
+ }
+ else if (o instanceof List) {
+ List o1 = (List) o;
+
+ List<Object> val = new ArrayList<>();
+
+ for (Object v : o1)
+ val.add(toSimpleObject(v));
+
+ return val;
+ }
+ else if (o.getClass().isArray()) {
+ Object[] o1 = (Object[]) o;
+
+ List<Object> val = new ArrayList<>();
+
+ for (Object v : o1)
+ val.add(toSimpleObject(v));
+
+ return val;
+ }
+
+ return o;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object obj) {
+ if (obj == null || !(obj instanceof JSONCacheObject))
+ return false;
+
+ return super.equals(obj);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java
deleted file mode 100644
index cd55500..0000000
--- a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java
+++ /dev/null
@@ -1,227 +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;
-
-/**
- * Test node js client put/get.
- */
-public class NodeJsCacheApiSelfTest extends NodeJsAbstractTest {
- /**
- * Constructor.
- */
- public NodeJsCacheApiSelfTest() {
- super("test-cache-api.js");
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGrid(0);
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- stopAllGrids();
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- grid(0).cache(NodeJsAbstractTest.CACHE_NAME).removeAll();
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPutGet() throws Exception {
- runJsScript("testPutGet");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPutGetObject() throws Exception {
- runJsScript("testPutGetObject");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testIncorrectCache() throws Exception {
- runJsScript("testIncorrectCacheName");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testGetOrCreateCacheName() throws Exception {
- runJsScript("testGetOrCreateCacheName");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testRemove() throws Exception {
- runJsScript("testRemove");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testRemoveNoKey() throws Exception {
- runJsScript("testRemoveNoKey");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testRemoveAll() throws Exception {
- runJsScript("testRemoveAll");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPutAllGetAll() throws Exception {
- runJsScript("testPutAllGetAll");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPutAllObjectGetAll() throws Exception {
- runJsScript("testPutAllObjectGetAll");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testRemoveAllObjectGetAll() throws Exception {
- runJsScript("testRemoveAllObjectGetAll");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testContains() throws Exception {
- runJsScript("testContains");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPutContains() throws Exception {
- runJsScript("testPutContains");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPutContainsAll() throws Exception {
- runJsScript("testPutContainsAll");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testNotContainsAll() throws Exception {
- runJsScript("testNotContainsAll");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testGetAndPut() throws Exception {
- runJsScript("testGetAndPut");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testGetAndPutIfAbsent() throws Exception {
- runJsScript("testGetAndPutIfAbsent");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPutIfAbsent() throws Exception {
- runJsScript("testPutIfAbsent");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testGetAndRemove() throws Exception {
- runJsScript("testGetAndRemove");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testRemoveValue() throws Exception {
- runJsScript("testRemoveValue");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testRemoveAllFromCache() throws Exception {
- runJsScript("testRemoveAllFromCache");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testReplace() throws Exception {
- runJsScript("testReplace");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testIncorrectReplaceObject() throws Exception {
- runJsScript("testIncorrectReplaceObject");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testReplaceObject() throws Exception {
- runJsScript("testReplaceObject");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testGetAndReplaceObject() throws Exception {
- runJsScript("testGetAndReplaceObject");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testReplaceValueObject() throws Exception {
- runJsScript("testReplaceValueObject");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testSize() throws Exception {
- runJsScript("testSize");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/nodejs/src/test/java/org/apache/ignite/internal/ScriptingJsCacheApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/test/java/org/apache/ignite/internal/ScriptingJsCacheApiSelfTest.java b/modules/nodejs/src/test/java/org/apache/ignite/internal/ScriptingJsCacheApiSelfTest.java
new file mode 100644
index 0000000..445d6d3
--- /dev/null
+++ b/modules/nodejs/src/test/java/org/apache/ignite/internal/ScriptingJsCacheApiSelfTest.java
@@ -0,0 +1,227 @@
+/*
+ * 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;
+
+/**
+ * Test node js client put/get.
+ */
+public class ScriptingJsCacheApiSelfTest extends NodeJsAbstractTest {
+ /**
+ * Constructor.
+ */
+ public ScriptingJsCacheApiSelfTest() {
+ super("test-cache-api.js");
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ startGrid(0);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ grid(0).cache(NodeJsAbstractTest.CACHE_NAME).removeAll();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutGet() throws Exception {
+ runJsScript("testPutGet");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutGetObject() throws Exception {
+ runJsScript("testPutGetObject");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testIncorrectCache() throws Exception {
+ runJsScript("testIncorrectCacheName");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testGetOrCreateCacheName() throws Exception {
+ runJsScript("testGetOrCreateCacheName");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRemove() throws Exception {
+ runJsScript("testRemove");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRemoveNoKey() throws Exception {
+ runJsScript("testRemoveNoKey");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRemoveAll() throws Exception {
+ runJsScript("testRemoveAll");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutAllGetAll() throws Exception {
+ runJsScript("testPutAllGetAll");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutAllObjectGetAll() throws Exception {
+ runJsScript("testPutAllObjectGetAll");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRemoveAllObjectGetAll() throws Exception {
+ runJsScript("testRemoveAllObjectGetAll");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testContains() throws Exception {
+ runJsScript("testContains");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutContains() throws Exception {
+ runJsScript("testPutContains");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutContainsAll() throws Exception {
+ runJsScript("testPutContainsAll");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNotContainsAll() throws Exception {
+ runJsScript("testNotContainsAll");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testGetAndPut() throws Exception {
+ runJsScript("testGetAndPut");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testGetAndPutIfAbsent() throws Exception {
+ runJsScript("testGetAndPutIfAbsent");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutIfAbsent() throws Exception {
+ runJsScript("testPutIfAbsent");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testGetAndRemove() throws Exception {
+ runJsScript("testGetAndRemove");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRemoveValue() throws Exception {
+ runJsScript("testRemoveValue");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRemoveAllFromCache() throws Exception {
+ runJsScript("testRemoveAllFromCache");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testReplace() throws Exception {
+ runJsScript("testReplace");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testIncorrectReplaceObject() throws Exception {
+ runJsScript("testIncorrectReplaceObject");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testReplaceObject() throws Exception {
+ runJsScript("testReplaceObject");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testGetAndReplaceObject() throws Exception {
+ runJsScript("testGetAndReplaceObject");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testReplaceValueObject() throws Exception {
+ runJsScript("testReplaceValueObject");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSize() throws Exception {
+ runJsScript("testSize");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/nodejs/src/test/java/org/apache/ignite/testsuites/IgniteNodeJsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/test/java/org/apache/ignite/testsuites/IgniteNodeJsTestSuite.java b/modules/nodejs/src/test/java/org/apache/ignite/testsuites/IgniteNodeJsTestSuite.java
index f6ab879..c52799c 100644
--- a/modules/nodejs/src/test/java/org/apache/ignite/testsuites/IgniteNodeJsTestSuite.java
+++ b/modules/nodejs/src/test/java/org/apache/ignite/testsuites/IgniteNodeJsTestSuite.java
@@ -32,7 +32,7 @@ public class IgniteNodeJsTestSuite extends TestSuite {
TestSuite suite = new TestSuite("Ignite Node JS Test Suite");
suite.addTest(new TestSuite(NodeJsIgnitionSelfTest.class));
- suite.addTest(new TestSuite(NodeJsCacheApiSelfTest.class));
+ suite.addTest(new TestSuite(ScriptingJsCacheApiSelfTest.class));
suite.addTest(new TestSuite(NodeJsSecretKeySelfTest.class));
suite.addTest(new TestSuite(NodeJsComputeSelfTest.class));
suite.addTest(new TestSuite(NodeJsIgniteSelfTest.class));
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38239701/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index cad7cc2..3d662e5 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -27,6 +27,7 @@ import org.apache.ignite.internal.processors.rest.request.*;
import org.apache.ignite.internal.processors.scripting.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.json.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.plugin.security.*;
import org.eclipse.jetty.server.*;
@@ -330,10 +331,10 @@ public class GridJettyRestHandler extends AbstractHandler {
if (cmd == CACHE_GET_ALL) {
Map o = (Map)cmdRes.getResponse();
- List<RestEntry> res = new ArrayList<>();
+ List<ScriptingCacheEntry> res = new ArrayList<>();
for (Object k : o.keySet())
- res.add(new RestEntry(k, o.get(k)));
+ res.add(new ScriptingCacheEntry(k, o.get(k)));
cmdRes.setResponse(res);
@@ -341,8 +342,8 @@ public class GridJettyRestHandler extends AbstractHandler {
else {
Object o = cmdRes.getResponse();
- if (o instanceof RestJSONCacheObject)
- cmdRes.setResponse(((RestJSONCacheObject)o).getFields());
+ if (o instanceof ScriptingJSONCacheObject)
+ cmdRes.setResponse(((ScriptingJSONCacheObject)o).getFields());
}
}
[19/50] [abbrv] incubator-ignite git commit: #ignite-964: change
cache-api-example.js
Posted by iv...@apache.org.
#ignite-964: change cache-api-example.js
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/242c21bb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/242c21bb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/242c21bb
Branch: refs/heads/ignite-961
Commit: 242c21bb10ee0578055adeda1014a536e73ef88f
Parents: 7763a37
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jul 9 17:08:06 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jul 9 17:08:06 2015 +0300
----------------------------------------------------------------------
examples/config/js/example-js-cache.xml | 3 +
.../examples/js/ExampleJsNodeStartup.java | 4 +-
examples/src/main/js/cache-api-example.js | 103 ++++++++++++-------
modules/nodejs/src/main/js/ignite.js | 4 +-
4 files changed, 74 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/242c21bb/examples/config/js/example-js-cache.xml
----------------------------------------------------------------------
diff --git a/examples/config/js/example-js-cache.xml b/examples/config/js/example-js-cache.xml
index 2599e38..e8ffc8a 100644
--- a/examples/config/js/example-js-cache.xml
+++ b/examples/config/js/example-js-cache.xml
@@ -31,6 +31,9 @@
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="gridName" value="ServerNode" />
+ <!-- Set to true to enable distributed class loading for examples, default is false. -->
+ <property name="peerClassLoadingEnabled" value="true"/>
+
<property name="connectorConfiguration">
<bean class="org.apache.ignite.configuration.ConnectorConfiguration">
<property name="jettyPath" value="examples/config/js/rest-jetty.xml"/>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/242c21bb/examples/src/main/java/org/apache/ignite/examples/js/ExampleJsNodeStartup.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/js/ExampleJsNodeStartup.java b/examples/src/main/java/org/apache/ignite/examples/js/ExampleJsNodeStartup.java
index 6fa2e6c..0de6047 100644
--- a/examples/src/main/java/org/apache/ignite/examples/js/ExampleJsNodeStartup.java
+++ b/examples/src/main/java/org/apache/ignite/examples/js/ExampleJsNodeStartup.java
@@ -21,11 +21,11 @@ import org.apache.ignite.*;
import org.apache.ignite.spi.discovery.tcp.internal.*;
/**
- * Starts up an empty node with example compute configuration.
+ * Starts up an empty node with example node js configuration.
*/
public class ExampleJsNodeStartup {
/**
- * Start up an empty node with example compute configuration.
+ * Start up an empty node with example node js configuration.
*
* @param args Command line arguments, none required.
* @throws IgniteException If failed.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/242c21bb/examples/src/main/js/cache-api-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-api-example.js b/examples/src/main/js/cache-api-example.js
index 13368d5..d17276a 100644
--- a/examples/src/main/js/cache-api-example.js
+++ b/examples/src/main/js/cache-api-example.js
@@ -18,50 +18,81 @@
var apacheIgnite = require("apache-ignite");
var Ignition = apacheIgnite.Ignition;
-Ignition.start(['127.0.0.1:9095'], null, onConnect);
+/**
+ * This example demonstrates some of the cache rich API capabilities.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleJsNodeStartup} in another JVM which will
+ * start node with {@code examples/config/js/example-js-cache.xml} configuration.
+ */
+function main() {
+ /** Cache name. */
+ var cacheName = "ApiExampleCache";
+
+ /** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
+ Ignition.start(['127.0.0.1:9095'], null, onConnect);
+
+ function onConnect(err, ignite) {
+ console.log(">>> Cache API example started.");
+
+ // Create cache on server with cacheName.
+ ignite.getOrCreateCache(cacheName, function(err, cache) {
+ atomicMapOperations(ignite, cache);
+ });
+ }
-function onConnect(err, ignite) {
- console.log(">>> Cache API example started.");
+ /**
+ * Demonstrates cache operations similar to {@link ConcurrentMap} API. Note that
+ * cache API is a lot richer than the JDK {@link ConcurrentMap}.
+ */
+ atomicMapOperations = function(ignite, cache) {
+ console.log(">>> Cache atomic map operation examples.");
- ignite.getOrCreateCache("ApiExampleCache", function(err, cache) {
- atomicMapOperations(cache);
+ cache.removeAllFromCache(function(err) {
+ // Put and return previous value.
+ cache.getAndPut(1, "1", onGetAndPut)
});
-}
-/**
- * Demonstrates cache operations similar to {@link ConcurrentMap} API. Note that
- * cache API is a lot richer than the JDK {@link ConcurrentMap}.
- */
-atomicMapOperations = function(cache) {
- console.log(">>> Cache atomic map operation examples.");
+ onGetAndPut = function(err, entry) {
+ console.log(">>> Get and put finished [result=" + entry + "]");
- cache.removeAllFromCache(function(err) {
- cache.getAndPut(1, "1", onGetAndPut.bind(null, cache))
- });
-}
+ // Put and do not return previous value.
+ // Performs better when previous value is not needed.
+ cache.put(2, "2", onPut);
+ }
-function onGetAndPut(cache, err, entry) {
- cache.put(2, "2", onPut.bind(null, cache));
-}
+ onPut = function(err) {
+ console.log(">>> Put finished.");
-function onPut(cache, err) {
- cache.putIfAbsent(4, "44", onPutIfAbsent.bind(null, cache, true));
-}
+ // Put-if-absent.
+ cache.putIfAbsent(4, "44", onPutIfAbsent);
+ }
-function onPutIfAbsent(cache, expRes, err, res) {
- if (expRes) {
- cache.putIfAbsent(4, "44", onPutIfAbsent.bind(null, cache, false));
- }
- else {
- cache.replaceValue(4, "55", "44", onReplaceValue.bind(null, cache, true));
+ onPutIfAbsent = function(err, res) {
+ console.log(">>> Put if absent finished [result=" + res + "]");
+
+ // Replace.
+ cache.replaceValue(4, "55", "44", onReplaceValue);
+ }
+
+ onReplaceValue = function(err, res) {
+ console.log(">>> Replace value finished [result=" + res + "]");
+
+ // Replace not correct value.
+ cache.replaceValue(4, "555", "44", onEnd);
+ }
+
+ onEnd = function(err) {
+ console.log(">>> Replace finished.");
+
+ // Destroying cache.
+ ignite.destroyCache(cacheName, function(err) {
+ console.log(">>> End of Cache API example.");
+ });
+ }
}
}
-function onReplaceValue(cache, expRes, err, res) {
- if (expRes) {
- cache.replaceValue(4, "555", "44", onReplaceValue.bind(null, cache, false));
- }
- else {
- console.log("End of the example.")
- }
-}
\ No newline at end of file
+main();
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/242c21bb/modules/nodejs/src/main/js/ignite.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/ignite.js b/modules/nodejs/src/main/js/ignite.js
index 5dfb15b..a4a1dd9 100644
--- a/modules/nodejs/src/main/js/ignite.js
+++ b/modules/nodejs/src/main/js/ignite.js
@@ -59,7 +59,7 @@ Ignite.prototype.cache = function(cacheName) {
* @param callback Callback with cache.
*/
Ignite.prototype.getOrCreateCache = function(cacheName, callback) {
- var onCreateCallback = function(err) {
+ var onCreateCallback = function(callback, err, res) {
if (err !== null) {
callback.call(null, err, null);
@@ -70,7 +70,7 @@ Ignite.prototype.getOrCreateCache = function(cacheName, callback) {
}
this._server.runCommand(new Command("getorcreatecache").addParam("cacheName", cacheName),
- onCreateCallback.bind(this));
+ onCreateCallback.bind(this, callback));
}
/**
[26/50] [abbrv] incubator-ignite git commit: GG-10507 Need to add
StreamReceiver to .NET
Posted by iv...@apache.org.
GG-10507 Need to add StreamReceiver to .NET
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/90580d8f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/90580d8f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/90580d8f
Branch: refs/heads/ignite-961
Commit: 90580d8ff47b4f2a56b794c2a8596d0f9db28310
Parents: bee6f68
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Thu Jul 9 21:18:10 2015 +0300
Committer: Pavel Tupitsyn <pt...@gridgain.com>
Committed: Thu Jul 9 21:18:10 2015 +0300
----------------------------------------------------------------------
.../internal/processors/datastreamer/DataStreamProcessor.java | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/90580d8f/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
index 9e53bb5..54478f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
@@ -255,6 +255,9 @@ public class DataStreamProcessor<K, V> extends GridProcessorAdapter {
try {
updater = marsh.unmarshal(req.updaterBytes(), clsLdr);
+
+ if (updater != null)
+ ctx.resource().injectGeneric(updater);
}
catch (IgniteCheckedException e) {
U.error(log, "Failed to unmarshal message [nodeId=" + nodeId + ", req=" + req + ']', e);
[31/50] [abbrv] incubator-ignite git commit: #ignite-964: add sql
query examples.
Posted by iv...@apache.org.
#ignite-964: add sql query examples.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d4c223ca
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d4c223ca
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d4c223ca
Branch: refs/heads/ignite-961
Commit: d4c223cac244255a8bf38430e51e47f60762a44c
Parents: 91f18fb
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 10 11:26:48 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 10 11:26:48 2015 +0300
----------------------------------------------------------------------
examples/src/main/js/cache-query-example.js | 99 +++++++++++++----
.../main/js/cache-sql-fields-query-example.js | 106 +++++++++++++++++++
2 files changed, 183 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d4c223ca/examples/src/main/js/cache-query-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-query-example.js b/examples/src/main/js/cache-query-example.js
index 5241e69..18b1482 100644
--- a/examples/src/main/js/cache-query-example.js
+++ b/examples/src/main/js/cache-query-example.js
@@ -22,36 +22,91 @@ var SqlQuery = apacheIgnite.SqlQuery;
var SqlFieldsQuery = apacheIgnite.SqlFieldsQuery;
var CacheEntry = apacheIgnite.CacheEntry;
-var cacheName = "CacheQueryExample";
-Ignition.start(['127.0.0.1:9095'], null, onConnect);
+/**
+ * Cache queries example. This example demonstrates SQL queries over cache.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
+ * <p>
+ * Alternatively you can run ExampleJsNodeStartup in another JVM which will
+ * start node with {@code examples/config/js/example-js-cache.xml} configuration.
+ */
+main() {
+ /** Cache name. */
+ var cacheName = "CacheQueryExample";
-function onConnect(err, ignite) {
- if (err !== null)
- throw "Start remote node with config examples/config/js/example-js-cache.xml.";
+ /** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
+ Ignition.start(['127.0.0.1:9095'], null, onConnect);
- console.log(">>> Cache query example started.");
+ function onConnect(err, ignite) {
+ if (err !== null)
+ throw "Start remote node with config examples/config/js/example-js-cache.xml.";
- var entries = [new CacheEntry("key0", "val0"), new CacheEntry("key1", "val1")];
+ console.log(">>> Cache query example started.");
- ignite.getOrCreateCache(cacheName, function(err, cache) {
- cache.putAll(entries, onCachePut.bind(null, ignite));
- });
-}
+ var entries = initializeEntries();
-function onCachePut(ignite, err) {
- var qry = new SqlQuery("Select * from String");
- qry.setReturnType("String");
+ ignite.getOrCreateCache(cacheName, function(err, cache) {
+ cacheQuery(ignite, cache, entries);
+ });
+ }
- var fullRes = [];
+ function cacheQuery(ignite, cache, entries) {
+ cache.putAll(entries, onCachePut.bind(null, ignite));
- qry.on("page", function(res) {
- fullRes = fullRes.concat(res);
- });
+ function onCachePut(ignite, err) {
+ console.log(">>> Create cache for people.")
- qry.on("end", function(err) {
- console.log(fullRes);
- });
+ //SQL clause which selects salaries based on range.
+ var qry = new SqlQuery("salary > ? and salary <= ?");
+ qry.setReturnType("Object");
- ignite.cache(cacheName).query(qry);
+ // Set page size for query.
+ qry.setPageSize(2);
+
+ //Set salary range.
+ qry.setArguments([0, 2000]);
+
+ var fullRes = [];
+
+ //This function is called when we get part of query result.
+ qry.on("page", function(res) {
+ console.log(">>> Get result on page: " + JSON.stringify(res));
+
+ fullRes = fullRes.concat(res);
+ });
+
+ //This function is called when query is finished.
+ qry.on("end", function(err) {
+ console.log(">>> People with salaries between 0 and 2000 (queried with SQL query): " +
+ JSON.stringify(fullRes));
+
+ // Destroying cache.
+ ignite.destroyCache(cacheName, function(err) {
+ console.log(">>> End of query example.");
+ });
+ });
+
+ //Run query.
+ ignite.cache(cacheName).query(qry);
+ }
+ }
+
+ // Initialize cache for people.
+ function initializeEntries() {
+ var key1 = "1";
+ var value1 = {"firstName" : "John", "lastName" : "Doe", "salary" : 2000};
+ var key2 = "2";
+ var value2 = {"firstName" : "Jane", "lastName" : "Doe", "salary" : 1000};
+ var key3 = "3";
+ var value3 = {"firstName" : "John", "lastName" : "Smith", "salary" : 1000};
+ var key4 = "4";
+ var value4 = {"firstName" : "Jane", "lastName" : "Smith", "salary" : 2000};
+ var key5 = "5";
+ var value5 = {"firstName" : "Ann", "lastName" : "Smith", "salary" : 3000};
+
+ return [new CacheEntry(key1, value1), new CacheEntry(key2, value2),
+ new CacheEntry(key3, value3), new CacheEntry(key4, entry4)];
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d4c223ca/examples/src/main/js/cache-sql-fields-query-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-sql-fields-query-example.js b/examples/src/main/js/cache-sql-fields-query-example.js
new file mode 100644
index 0000000..64a50f7
--- /dev/null
+++ b/examples/src/main/js/cache-sql-fields-query-example.js
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+
+var apacheIgnite = require("apache-ignite");
+
+var Ignition = apacheIgnite.Ignition;
+var SqlQuery = apacheIgnite.SqlQuery;
+var SqlFieldsQuery = apacheIgnite.SqlFieldsQuery;
+var CacheEntry = apacheIgnite.CacheEntry;
+
+/**
+ * Cache queries example. This example demonstrates SQL queries over cache.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
+ * <p>
+ * Alternatively you can run ExampleJsNodeStartup in another JVM which will
+ * start node with {@code examples/config/js/example-js-cache.xml} configuration.
+ */
+main() {
+ /** Cache name. */
+ var cacheName = "CacheSqlFieldsQueryExample";
+
+ /** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
+ Ignition.start(['127.0.0.1:9095'], null, onConnect);
+
+ function onConnect(err, ignite) {
+ if (err !== null)
+ throw "Start remote node with config examples/config/js/example-js-cache.xml.";
+
+ console.log(">>> Cache sql fields query example started.");
+
+ var entries = initializeEntries();
+
+ ignite.getOrCreateCache(cacheName, function(err, cache) {
+ cacheSqlFieldsQuery(ignite, cache, entries);
+ });
+ }
+
+ function cacheSqlFieldsQuery(ignite, cache, entries) {
+ cache.putAll(entries, onCachePut.bind(null, ignite));
+
+ function onCachePut(ignite, err) {
+ console.log(">>> Create cache for people.")
+
+ //Sql query to get names of all employees.
+ var qry = new SqlFieldsQuery("select concat(firstName, ' ', lastName) from Person");
+
+ // Set page size for query.
+ qry.setPageSize(2);
+
+ var fullRes = [];
+
+ //This function is called when we get part of query result.
+ qry.on("page", function(res) {
+ console.log(">>> Get result on page: " + JSON.stringify(res));
+
+ fullRes = fullRes.concat(res);
+ });
+
+ //This function is called when query is finished.
+ qry.on("end", function(err) {
+ console.log(">>> Names of all employees:): " + JSON.stringify(fullRes));
+
+ // Destroying cache.
+ ignite.destroyCache(cacheName, function(err) {
+ console.log(">>> End of sql fields query example.");
+ });
+ });
+
+ //Run query.
+ ignite.cache(cacheName).query(qry);
+ }
+ }
+
+ // Initialize cache for people.
+ function initializeEntries() {
+ var key1 = "1";
+ var value1 = {"firstName" : "John", "lastName" : "Doe", "salary" : 2000};
+ var key2 = "2";
+ var value2 = {"firstName" : "Jane", "lastName" : "Doe", "salary" : 1000};
+ var key3 = "3";
+ var value3 = {"firstName" : "John", "lastName" : "Smith", "salary" : 1000};
+ var key4 = "4";
+ var value4 = {"firstName" : "Jane", "lastName" : "Smith", "salary" : 2000};
+ var key5 = "5";
+ var value5 = {"firstName" : "Ann", "lastName" : "Smith", "salary" : 3000};
+
+ return [new CacheEntry(key1, value1), new CacheEntry(key2, value2),
+ new CacheEntry(key3, value3), new CacheEntry(key4, entry4)];
+ }
+}
\ No newline at end of file
[50/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'remotes/origin/master' into ignite-961
Posted by iv...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-961
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/42ab9f42
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/42ab9f42
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/42ab9f42
Branch: refs/heads/ignite-961
Commit: 42ab9f42527fc5bf757e6fb723fcb28c2c40f7c7
Parents: f69f25f aa2d7cb
Author: ivasilinets <iv...@gridgain.com>
Authored: Mon Jul 13 09:33:37 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Mon Jul 13 09:33:37 2015 +0300
----------------------------------------------------------------------
modules/core/pom.xml | 7 +
.../affinity/fair/FairAffinityFunction.java | 5 +-
.../configuration/CacheConfiguration.java | 2 +-
.../META-INF/classnames-jdk.properties | 3 +
.../cache/GridCacheAbstractFullApiSelfTest.java | 323 ++++++----
.../cache/GridCacheAbstractSelfTest.java | 14 +-
...eAtomicNearOnlyMultiNodeFullApiSelfTest.java | 3 +
...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 5 +-
.../near/GridCacheNearTxMultiNodeSelfTest.java | 10 +-
...achePartitionedMultiNodeFullApiSelfTest.java | 48 +-
...OnlyFairAffinityMultiJvmFullApiSelfTest.java | 31 +
...AtomicClientOnlyMultiJvmFullApiSelfTest.java | 31 +
...tOnlyMultiJvmP2PDisabledFullApiSelfTest.java | 31 +
...pyOnReadDisabledMultiJvmFullApiSelfTest.java | 31 +
...omicFairAffinityMultiJvmFullApiSelfTest.java | 31 +
.../GridCacheAtomicMultiJvmFullApiSelfTest.java | 30 +
...tomicMultiJvmP2PDisabledFullApiSelfTest.java | 31 +
...bledFairAffinityMultiJvmFullApiSelfTest.java | 31 +
...tomicNearEnabledMultiJvmFullApiSelfTest.java | 31 +
...rimaryWriteOrderMultiJvmFullApiSelfTest.java | 31 +
...heAtomicNearOnlyMultiJvmFullApiSelfTest.java | 31 +
...rOnlyMultiJvmP2PDisabledFullApiSelfTest.java | 31 +
...cheAtomicOffHeapMultiJvmFullApiSelfTest.java | 31 +
...micOffHeapTieredMultiJvmFullApiSelfTest.java | 36 ++
...rderFairAffinityMultiJvmFullApiSelfTest.java | 31 +
...rimaryWriteOrderMultiJvmFullApiSelfTest.java | 31 +
...OrderMultiJvmP2PDisabledFullApiSelfTest.java | 31 +
...rityOrderOffHeapMultiJvmFullApiSelfTest.java | 31 +
...derOffHeapTieredMultiJvmFullApiSelfTest.java | 36 ++
...OnlyFairAffinityMultiJvmFullApiSelfTest.java | 31 +
...ridCacheNearOnlyMultiJvmFullApiSelfTest.java | 30 +
...rOnlyMultiJvmP2PDisabledFullApiSelfTest.java | 31 +
...pyOnReadDisabledMultiJvmFullApiSelfTest.java | 31 +
...onedFairAffinityMultiJvmFullApiSelfTest.java | 31 +
...CachePartitionedMultiJvmFullApiSelfTest.java | 30 +
...ionedMultiJvmP2PDisabledFullApiSelfTest.java | 31 +
...micOffHeapTieredMultiJvmFullApiSelfTest.java | 36 ++
...bledFairAffinityMultiJvmFullApiSelfTest.java | 31 +
...onedNearDisabledMultiJvmFullApiSelfTest.java | 31 +
...abledMultiJvmP2PDisabledFullApiSelfTest.java | 31 +
...rDisabledOffHeapMultiJvmFullApiSelfTest.java | 31 +
...ledOffHeapTieredMultiJvmFullApiSelfTest.java | 36 ++
...rtitionedOffHeapMultiJvmFullApiSelfTest.java | 31 +
...nedOffHeapTieredMultiJvmFullApiSelfTest.java | 36 ++
...ReplicatedAtomicMultiJvmFullApiSelfTest.java | 31 +
...rimaryWriteOrderMultiJvmFullApiSelfTest.java | 31 +
...dCacheReplicatedMultiJvmFullApiSelfTest.java | 30 +
...catedMultiJvmP2PDisabledFullApiSelfTest.java | 31 +
...plicatedNearOnlyMultiJvmFullApiSelfTest.java | 37 ++
...eplicatedOffHeapMultiJvmFullApiSelfTest.java | 31 +
...tedOffHeapTieredMultiJvmFullApiSelfTest.java | 36 ++
.../GridCommandLineTransformerSelfTest.java | 12 +-
.../testframework/junits/GridAbstractTest.java | 380 +++++++++++-
.../junits/common/GridCommonAbstractTest.java | 50 +-
.../junits/multijvm/AffinityProcessProxy.java | 195 ++++++
.../multijvm/IgniteCacheProcessProxy.java | 602 +++++++++++++++++++
.../multijvm/IgniteClusterProcessProxy.java | 320 ++++++++++
.../multijvm/IgniteEventsProcessProxy.java | 148 +++++
.../junits/multijvm/IgniteNodeRunner.java | 184 ++++++
.../junits/multijvm/IgniteProcessProxy.java | 571 ++++++++++++++++++
...IgniteCacheFullApiMultiJvmSelfTestSuite.java | 89 +++
parent/pom.xml | 40 ++
pom.xml | 1 -
63 files changed, 4104 insertions(+), 211 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/42ab9f42/parent/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/42ab9f42/pom.xml
----------------------------------------------------------------------
[40/50] [abbrv] incubator-ignite git commit: #ignite-964: do not need
java8 part.
Posted by iv...@apache.org.
#ignite-964: do not need java8 part.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/84938ddc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/84938ddc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/84938ddc
Branch: refs/heads/ignite-961
Commit: 84938ddca47336b0590fb233f9eac81fe0defb52
Parents: eebdd64
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 10 18:27:16 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 10 18:27:16 2015 +0300
----------------------------------------------------------------------
modules/core/pom.xml | 52 -----
.../scripting/IgniteScriptingProcessor.java | 58 +-----
.../scripting/ScriptingObjectConverter.java | 59 ------
.../ScriptingObjectConverter8.java | 202 -------------------
.../http/jetty/GridJettyRestHandler.java | 2 +-
5 files changed, 12 insertions(+), 361 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84938ddc/modules/core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index 85a5f76..6c5af02 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -248,58 +248,6 @@
<profiles>
<profile>
- <id>java8-scripting</id>
-
- <activation>
- <jdk>[1.8,)</jdk>
- </activation>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.9.1</version>
- <executions>
- <execution>
- <id>add-sources</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>src/main/java8</source>
- <source>schema-import/src/main/java</source>
- </sources>
- </configuration>
- </execution>
- <execution>
- <id>add-tests</id>
- <phase>generate-test-sources</phase>
- <goals>
- <goal>add-test-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>src/test/java8</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
<id>release</id>
<activation>
<activeByDefault>true</activeByDefault>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84938ddc/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
index 733fc10..52847ec 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.scripting;
import org.apache.ignite.*;
import org.apache.ignite.internal.*;
import org.apache.ignite.internal.processors.*;
+import org.apache.ignite.json.*;
import javax.script.*;
@@ -34,13 +35,6 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
/** Javascript engine name. */
public static final String JAVA_SCRIPT_ENGINE_NAME = "JavaScript";
- /** Java8 scripting converter class. */
- private static final String CONV_CLS_JAVA8 =
- "org.apache.ignite.internal.processors.scripting.ScriptingObjectConverter8";
-
- /** Script object converter. */
- private ScriptingObjectConverter converter;
-
/** Javascript engine. */
private ScriptEngine jsEngine;
@@ -53,27 +47,9 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@Override public void start() throws IgniteCheckedException {
- try {
- Class<?> cls = Class.forName(CONV_CLS_JAVA8);
-
- Constructor<?> ctor = cls.getConstructor();
-
- converter = (ScriptingObjectConverter)ctor.newInstance();
- System.out.println("JDK 8 is found!!!!");
- }
- catch (ClassNotFoundException ignored) {
- System.out.println("JDK 8 is not found!!!!");
- converter = new ScriptingObjectConverter();
- }
- catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) {
- throw new IgniteCheckedException("Failed to initialize HTTP REST protocol.", e);
- }
-
ScriptEngineManager factory = new ScriptEngineManager();
- System.out.println("ENGINE!!!!");
jsEngine = factory.getEngineByName(JAVA_SCRIPT_ENGINE_NAME);
- System.out.println("ENGINE FOUND!!!!");
addBinding("ignite", new ScriptingJSIgnite(ctx.grid()));
@@ -164,11 +140,11 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
}
catch (ScriptException e) {
throw new IgniteCheckedException("Function evaluation failed [funcName=" + src +
- ", err= " + e.getMessage() + "].");
+ ", err= " + e.getMessage() + "].");
}
catch (NoSuchMethodException e) {
throw new IgniteCheckedException("Cannot find function [func=__internalCall" +
- ", err= " + e.getMessage() + "].");
+ ", err= " + e.getMessage() + "].");
}
}
@@ -177,7 +153,7 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
* @return Object for script.
*/
public Object toScriptingObject(Object o) {
- return converter.toScriptingObject(o);
+ return o;
}
/**
@@ -185,7 +161,7 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
* @return Object for Ignite cache.
*/
public Object toJavaObject(Object o) {
- return converter.toJavaObject(o);
+ return JSONCacheObject.toSimpleObject(o);
}
/**
@@ -193,15 +169,10 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
* @return Object to store in cache.
*/
public Object getField(String key, Object o) {
- return converter.getField(key, o);
- }
+ if (o instanceof JSONCacheObject)
+ return ((JSONCacheObject)o).getField(key);
- /**
- * @param o Object from script.
- * @return Object to store in cache.
- */
- public Object getFields(Object o) {
- return converter.getFields(o);
+ return null;
}
/**
@@ -210,7 +181,7 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
* @return Scripting entry.
*/
public Object createScriptingEntry(Object key, Object val) {
- return new ScriptingCacheEntry(getFields(key), getFields(val));
+ return new ScriptingCacheEntry(key, val);
}
/**
@@ -228,15 +199,8 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
* @param val Value.
*/
public ScriptingCacheEntry(Object key, Object val) {
- if (key instanceof ScriptingObjectConverter)
- this.key = key;
- else
- this.key = key;
-
- if (val instanceof ScriptingObjectConverter)
- this.val = val;
- else
- this.val = val;
+ this.key = key;
+ this.val = val;
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84938ddc/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java
deleted file mode 100644
index d5c6dfd..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ignite.internal.processors.scripting;
-
-import org.apache.ignite.json.*;
-
-/**
- * Script object converter.
- */
-public class ScriptingObjectConverter {
- /**
- * @param o Object to convert.
- * @return Object to use in script.
- */
- public Object toScriptingObject(Object o) {
- return o;
- }
-
- /**
- * @param o Object from script.
- * @return Object to store in cache.
- */
- public Object toJavaObject(Object o) {
- return JSONCacheObject.toSimpleObject(o);
- }
-
- /**
- * @param o Object from script.
- * @return Object to store in cache.
- */
- public Object getField(String key, Object o) {
- if (o instanceof JSONCacheObject)
- return ((JSONCacheObject)o).getField(key);
-
- return null;
- }
-
- /**
- * @param o Object from script.
- * @return Object to store in cache.
- */
- public Object getFields(Object o) {
- return o;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84938ddc/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java b/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java
deleted file mode 100644
index ae4051e..0000000
--- a/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.scripting;
-
-import jdk.nashorn.api.scripting.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.json.*;
-
-import java.util.*;
-
-/**
- * Json cache object.
- */
-public class ScriptingObjectConverter8 extends ScriptingObjectConverter implements JSObject {
- /** Fields. */
- private final JSONCacheObject fields;
-
- /**
- * Default constructor.
- */
- public ScriptingObjectConverter8() {
- fields = null;
- }
-
- /**
- * @param o JSON object.
- */
- private ScriptingObjectConverter8(JSONCacheObject o) {
- fields = o;
- }
-
- /**
- * @param o Object.
- * @return Rest JSON cache object.
- */
- public static Object convertToRestObject(Object o) {
- if (o instanceof JSONCacheObject)
- return new ScriptingObjectConverter8((JSONCacheObject)o);
-
- return o;
- }
-
- /**
- * @return Fields.
- */
- public Map<Object, Object> getFields() {
- return fields;
- }
-
- /** {@inheritDoc} */
- @Override public Object toScriptingObject(Object o) {
- return convertToRestObject(o);
- }
-
- /**
- * @param key Field name.
- * @return Field value.
- */
- public Object getField(Object key) {
- return fields.get(key);
- }
-
- /**
- * @param o Object from script.
- * @return Object to store in cache.
- */
- public Object getField(String key, Object o) {
- if (o instanceof JSONCacheObject)
- return ((JSONCacheObject)o).getField(key);
- if (o instanceof ScriptingObjectConverter8)
- return ((ScriptingObjectConverter8)o).getField(key);
-
- return null;
- }
-
- /**
- * @param o Object from script.
- * @return Object to store in cache.
- */
- public Object getFields(Object o) {
- if (o instanceof ScriptingObjectConverter8)
- return ((ScriptingObjectConverter8)o).getFields();
-
- return o;
- }
-
- @Override public Object call(Object o, Object... objects) {
- System.out.println("!!!!CALL");
- return null;
- }
-
- @Override public Object newObject(Object... objects) {
- System.out.println("!!!!newObject");
- return null;
- }
-
- @Override public Object eval(String s) {
- System.out.println("!!!!eval");
- return null;
- }
-
- @Override public Object getMember(String s) {
- System.out.println("!!!!getMember + " + s);
- return fields.get(s);
- }
-
- @Override public Object getSlot(int i) {
- System.out.println("!!!!getSlot");
- return null;
- }
-
- @Override public boolean hasMember(String s) {
- System.out.println("!!!!hasMember");
- return fields.containsKey(s);
- }
-
- @Override public boolean hasSlot(int i) {
- System.out.println("!!!!hasSlot");
- return false;
- }
-
- @Override public void removeMember(String s) {
- System.out.println("!!!!removeMember");
- fields.remove(s);
- }
-
- @Override public void setMember(String s, Object o) {
- System.out.println("!!!!setMember");
- fields.put(s, o);
- }
-
- @Override public void setSlot(int i, Object o) {
- System.out.println("!!!!setSlot");
-
- }
-
- @Override public Set<String> keySet() {
- System.out.println("!!!!keySet");
- Set<String> keys = new HashSet<>();
-
- for (Object o : fields.keySet()) {
- if (!(o instanceof ScriptingObjectConverter8))
- keys.add(o.toString());
- }
-
- return keys;
- }
-
- @Override public Collection<Object> values() {
- System.out.println("!!!!values");
- return fields.values();
- }
-
- @Override public boolean isInstance(Object o) {
- System.out.println("!!!!isInstance");
- return false;
- }
-
- @Override public boolean isInstanceOf(Object o) {
- System.out.println("!!!!isInstanceOf");
- return false;
- }
-
- @Override public String getClassName() {
- System.out.println("!!!!getClassName");
- return U.getSimpleName(ScriptingObjectConverter8.class);
- }
-
- @Override public boolean isFunction() {
- System.out.println("!!!!isFunction");
- return false;
- }
-
- @Override public boolean isStrictFunction() {
- System.out.println("!!!!isStrictFunction");
- return false;
- }
-
- @Override public boolean isArray() {
- System.out.println("!!!!isArray");
- return false;
- }
-
- @Override public double toNumber() {
- return 0;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84938ddc/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index f576a3e..20f0a88 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -346,7 +346,7 @@ public class GridJettyRestHandler extends AbstractHandler {
else {
Object o = cmdRes.getResponse();
- cmdRes.setResponse(proc.getFields(o));
+ cmdRes.setResponse(o);
}
}
[48/50] [abbrv] incubator-ignite git commit: # ignite-648:
Implemented.
Posted by iv...@apache.org.
# ignite-648: Implemented.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8218fe6f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8218fe6f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8218fe6f
Branch: refs/heads/ignite-961
Commit: 8218fe6fa42b2daa6816cf862fe1450ad0cf11d3
Parents: ab655ed
Author: ashutak <as...@gridgain.com>
Authored: Fri Jul 10 21:40:31 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Fri Jul 10 21:40:31 2015 +0300
----------------------------------------------------------------------
modules/core/pom.xml | 7 +
.../affinity/fair/FairAffinityFunction.java | 5 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 323 ++++++----
.../cache/GridCacheAbstractSelfTest.java | 14 +-
...eAtomicNearOnlyMultiNodeFullApiSelfTest.java | 3 +
...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 5 +-
.../near/GridCacheNearTxMultiNodeSelfTest.java | 10 +-
...achePartitionedMultiNodeFullApiSelfTest.java | 48 +-
...OnlyFairAffinityMultiJvmFullApiSelfTest.java | 31 +
...AtomicClientOnlyMultiJvmFullApiSelfTest.java | 31 +
...tOnlyMultiJvmP2PDisabledFullApiSelfTest.java | 31 +
...pyOnReadDisabledMultiJvmFullApiSelfTest.java | 31 +
...omicFairAffinityMultiJvmFullApiSelfTest.java | 31 +
.../GridCacheAtomicMultiJvmFullApiSelfTest.java | 30 +
...tomicMultiJvmP2PDisabledFullApiSelfTest.java | 31 +
...bledFairAffinityMultiJvmFullApiSelfTest.java | 31 +
...tomicNearEnabledMultiJvmFullApiSelfTest.java | 31 +
...rimaryWriteOrderMultiJvmFullApiSelfTest.java | 31 +
...heAtomicNearOnlyMultiJvmFullApiSelfTest.java | 31 +
...rOnlyMultiJvmP2PDisabledFullApiSelfTest.java | 31 +
...cheAtomicOffHeapMultiJvmFullApiSelfTest.java | 31 +
...micOffHeapTieredMultiJvmFullApiSelfTest.java | 36 ++
...rderFairAffinityMultiJvmFullApiSelfTest.java | 31 +
...rimaryWriteOrderMultiJvmFullApiSelfTest.java | 31 +
...OrderMultiJvmP2PDisabledFullApiSelfTest.java | 31 +
...rityOrderOffHeapMultiJvmFullApiSelfTest.java | 31 +
...derOffHeapTieredMultiJvmFullApiSelfTest.java | 36 ++
...OnlyFairAffinityMultiJvmFullApiSelfTest.java | 31 +
...ridCacheNearOnlyMultiJvmFullApiSelfTest.java | 30 +
...rOnlyMultiJvmP2PDisabledFullApiSelfTest.java | 31 +
...pyOnReadDisabledMultiJvmFullApiSelfTest.java | 31 +
...onedFairAffinityMultiJvmFullApiSelfTest.java | 31 +
...CachePartitionedMultiJvmFullApiSelfTest.java | 30 +
...ionedMultiJvmP2PDisabledFullApiSelfTest.java | 31 +
...micOffHeapTieredMultiJvmFullApiSelfTest.java | 36 ++
...bledFairAffinityMultiJvmFullApiSelfTest.java | 31 +
...onedNearDisabledMultiJvmFullApiSelfTest.java | 31 +
...abledMultiJvmP2PDisabledFullApiSelfTest.java | 31 +
...rDisabledOffHeapMultiJvmFullApiSelfTest.java | 31 +
...ledOffHeapTieredMultiJvmFullApiSelfTest.java | 36 ++
...rtitionedOffHeapMultiJvmFullApiSelfTest.java | 31 +
...nedOffHeapTieredMultiJvmFullApiSelfTest.java | 36 ++
...ReplicatedAtomicMultiJvmFullApiSelfTest.java | 31 +
...rimaryWriteOrderMultiJvmFullApiSelfTest.java | 31 +
...dCacheReplicatedMultiJvmFullApiSelfTest.java | 30 +
...catedMultiJvmP2PDisabledFullApiSelfTest.java | 31 +
...plicatedNearOnlyMultiJvmFullApiSelfTest.java | 37 ++
...eplicatedOffHeapMultiJvmFullApiSelfTest.java | 31 +
...tedOffHeapTieredMultiJvmFullApiSelfTest.java | 36 ++
.../testframework/junits/GridAbstractTest.java | 380 +++++++++++-
.../junits/common/GridCommonAbstractTest.java | 50 +-
.../junits/multijvm/AffinityProcessProxy.java | 195 ++++++
.../multijvm/IgniteCacheProcessProxy.java | 602 +++++++++++++++++++
.../multijvm/IgniteClusterProcessProxy.java | 320 ++++++++++
.../multijvm/IgniteEventsProcessProxy.java | 148 +++++
.../junits/multijvm/IgniteNodeRunner.java | 184 ++++++
.../junits/multijvm/IgniteProcessProxy.java | 571 ++++++++++++++++++
...IgniteCacheFullApiMultiJvmSelfTestSuite.java | 89 +++
parent/pom.xml | 40 ++
pom.xml | 1 -
60 files changed, 4094 insertions(+), 204 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index 6c5af02..5ac49ae 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -55,6 +55,13 @@
</dependency>
<dependency>
+ <groupId>com.thoughtworks.xstream</groupId>
+ <artifactId>xstream</artifactId>
+ <version>1.4.8</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.2</version>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/main/java/org/apache/ignite/cache/affinity/fair/FairAffinityFunction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/fair/FairAffinityFunction.java b/modules/core/src/main/java/org/apache/ignite/cache/affinity/fair/FairAffinityFunction.java
index 0253e62..14a4f53 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/affinity/fair/FairAffinityFunction.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/affinity/fair/FairAffinityFunction.java
@@ -19,7 +19,7 @@ package org.apache.ignite.cache.affinity.fair;
import org.apache.ignite.cache.affinity.*;
import org.apache.ignite.cluster.*;
-import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.*;
import org.apache.ignite.events.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
@@ -31,7 +31,8 @@ import java.util.*;
* Fair affinity function which tries to ensure that all nodes get equal number of partitions with
* minimum amount of reassignments between existing nodes.
* <p>
- * Cache affinity can be configured for individual caches via {@link CacheConfiguration#getAffinity()} method.
+ * Cache affinity can be configured for individual caches via
+ * {@link CacheConfiguration#setAffinity(AffinityFunction)} method.
*/
@AffinityCentralizedFunction
public class FairAffinityFunction implements AffinityFunction {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 151c249..f8d1ce3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -61,6 +61,7 @@ import static org.apache.ignite.transactions.TransactionState.*;
/**
* Full API cache test.
*/
+@SuppressWarnings("TransientFieldInNonSerializableClass")
public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstractSelfTest {
/** Increment processor for invoke operations. */
public static final EntryProcessor<String, Integer, String> INCR_PROCESSOR = new EntryProcessor<String, Integer, String>() {
@@ -105,7 +106,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
};
/** Dflt grid. */
- protected Ignite dfltIgnite;
+ protected transient Ignite dfltIgnite;
/** */
private Map<String, CacheConfiguration[]> cacheCfgMap;
@@ -162,7 +163,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
super.beforeTestsStarted();
for (Map.Entry<String, CacheConfiguration[]> entry : cacheCfgMap.entrySet()) {
- Ignite ignite = IgnitionEx.grid(entry.getKey());
+ Ignite ignite = grid(entry.getKey());
for (CacheConfiguration cfg : entry.getValue())
ignite.createCache(cfg);
@@ -206,7 +207,10 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
cfg.setCacheConfiguration();
- return IgnitionEx.start(optimize(cfg), ctx);
+ if (!isRemoteJvm(gridName))
+ return IgnitionEx.start(optimize(cfg), ctx);
+ else
+ return startRemoteGrid(gridName, optimize(cfg), ctx);
}
/** {@inheritDoc} */
@@ -251,7 +255,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
int size = 10;
- Map<String, Integer> map = new HashMap<>();
+ final Map<String, Integer> map = new HashMap<>();
for (int i = 0; i < size; i++)
map.put("key" + i, i);
@@ -284,15 +288,19 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
}
for (int i = 0; i < gridCount(); i++) {
- GridCacheContext<String, Integer> ctx = context(i);
+ executeOnLocalOrRemoteJvm(i, new TestIgniteIdxRunnable() {
+ @Override public void run(int idx) throws Exception {
+ GridCacheContext<String, Integer> ctx = context(idx);
- int sum = 0;
+ int sum = 0;
- for (String key : map.keySet())
- if (ctx.affinity().localNode(key, new AffinityTopologyVersion(ctx.discovery().topologyVersion())))
- sum++;
+ for (String key : map.keySet())
+ if (ctx.affinity().localNode(key, new AffinityTopologyVersion(ctx.discovery().topologyVersion())))
+ sum++;
- assertEquals("Incorrect key size on cache #" + i, sum, jcache(i).localSize(ALL));
+ assertEquals("Incorrect key size on cache #" + idx, sum, jcache(idx).localSize(ALL));
+ }
+ });
}
for (int i = 0; i < gridCount(); i++) {
@@ -359,6 +367,9 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testRemoveAllSkipStore() throws Exception {
+ if (isMultiJvm())
+ fail("https://issues.apache.org/jira/browse/IGNITE-1088");
+
IgniteCache<String, Integer> jcache = jcache();
jcache.putAll(F.asMap("1", 1, "2", 2, "3", 3));
@@ -448,7 +459,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception In case of error.
*/
public void testGetAll() throws Exception {
- Transaction tx = txEnabled() ? transactions().txStart() : null;
+ Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
final IgniteCache<String, Integer> cache = jcache();
@@ -495,7 +506,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assertNull(map2.get("key9999"));
// Now do the same checks but within transaction.
- if (txEnabled()) {
+ if (txShouldBeUsed()) {
try (Transaction tx0 = transactions().txStart()) {
assert cache.getAll(Collections.<String>emptySet()).isEmpty();
@@ -548,7 +559,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testGetTxNonExistingKey() throws Exception {
- if (txEnabled()) {
+ if (txShouldBeUsed()) {
try (Transaction ignored = transactions().txStart()) {
assert jcache().get("key999123") == null;
}
@@ -626,7 +637,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception In case of error.
*/
public void testPutTx() throws Exception {
- if (txEnabled()) {
+ if (txShouldBeUsed()) {
IgniteCache<String, Integer> cache = jcache();
try (Transaction tx = transactions().txStart()) {
@@ -729,7 +740,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
cache.put("key2", 1);
cache.put("key3", 3);
- Transaction tx = txEnabled() ? ignite(0).transactions().txStart(concurrency, isolation) : null;
+ Transaction tx = txShouldBeUsed() ? ignite(0).transactions().txStart(concurrency, isolation) : null;
try {
assertEquals("null", cache.invoke("key1", INCR_IGNITE_PROCESSOR));
@@ -783,7 +794,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
cache.put("key2", 1);
cache.put("key3", 3);
- Transaction tx = txEnabled() ? ignite(0).transactions().txStart(concurrency, isolation) : null;
+ Transaction tx = txShouldBeUsed() ? ignite(0).transactions().txStart(concurrency, isolation) : null;
try {
assertEquals("null", cache.invoke("key1", INCR_PROCESSOR));
@@ -866,7 +877,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
cache.put("key2", 1);
cache.put("key3", 3);
- if (txEnabled()) {
+ if (txShouldBeUsed()) {
Map<String, EntryProcessorResult<String>> res;
try (Transaction tx = ignite(0).transactions().txStart(concurrency, isolation)) {
@@ -1022,7 +1033,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
final String key = primaryKeysForCache(cache, 1).get(0);
- Transaction tx = txEnabled() ? ignite(0).transactions().txStart(concurrency, READ_COMMITTED) : null;
+ Transaction tx = txShouldBeUsed() ? ignite(0).transactions().txStart(concurrency, READ_COMMITTED) : null;
try {
if (startVal)
@@ -1083,7 +1094,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
cache.put("key", 4);
- Transaction tx = txEnabled() ? ignite(0).transactions().txStart(concurrency, READ_COMMITTED) : null;
+ Transaction tx = txShouldBeUsed() ? ignite(0).transactions().txStart(concurrency, READ_COMMITTED) : null;
try {
cache.remove("key");
@@ -1154,7 +1165,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
if (!put)
cache.put("key", 1);
- Transaction tx = txEnabled() ? ignite(0).transactions().txStart(concurrency, isolation) : null;
+ Transaction tx = txShouldBeUsed() ? ignite(0).transactions().txStart(concurrency, isolation) : null;
try {
if (put)
@@ -1313,7 +1324,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception In case of error.
*/
public void testPutx() throws Exception {
- if (txEnabled())
+ if (txShouldBeUsed())
checkPut(true);
}
@@ -1365,7 +1376,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testPutAsync() throws Exception {
- Transaction tx = txEnabled() ? transactions().txStart() : null;
+ Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
IgniteCache<String, Integer> cacheAsync = jcache().withAsync();
@@ -1436,7 +1447,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception In case of error.
*/
public void testNullInTx() throws Exception {
- if (!txEnabled())
+ if (!txShouldBeUsed())
return;
final IgniteCache<String, Integer> cache = jcache();
@@ -1685,7 +1696,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception In case of error.
*/
public void testGetAndPutIfAbsent() throws Exception {
- Transaction tx = txEnabled() ? transactions().txStart() : null;
+ Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
IgniteCache<String, Integer> cache = jcache();
@@ -1729,17 +1740,20 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assertEquals((Integer)1, cache.getAndPutIfAbsent("key2", 3));
// Check db.
- putToStore("key3", 3);
+ if (!isMultiJvm()) {
+ putToStore("key3", 3);
+
+ assertEquals((Integer)3, cache.getAndPutIfAbsent("key3", 4));
- assertEquals((Integer)3, cache.getAndPutIfAbsent("key3", 4));
+ assertEquals((Integer)3, cache.get("key3"));
+ }
assertEquals((Integer)1, cache.get("key2"));
- assertEquals((Integer)3, cache.get("key3"));
cache.localEvict(Collections.singleton("key2"));
// Same checks inside tx.
- tx = txEnabled() ? transactions().txStart() : null;
+ tx = txShouldBeUsed() ? transactions().txStart() : null;
try {
assertEquals((Integer)1, cache.getAndPutIfAbsent("key2", 3));
@@ -1759,7 +1773,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testGetAndPutIfAbsentAsync() throws Exception {
- Transaction tx = txEnabled() ? transactions().txStart() : null;
+ Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
IgniteCache<String, Integer> cache = jcache();
@@ -1798,16 +1812,18 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assertEquals((Integer)1, cacheAsync.<Integer>future().get());
// Check db.
- putToStore("key3", 3);
+ if (!isMultiJvm()) {
+ putToStore("key3", 3);
- cacheAsync.getAndPutIfAbsent("key3", 4);
+ cacheAsync.getAndPutIfAbsent("key3", 4);
- assertEquals((Integer)3, cacheAsync.<Integer>future().get());
+ assertEquals((Integer)3, cacheAsync.<Integer>future().get());
+ }
cache.localEvict(Collections.singleton("key2"));
// Same checks inside tx.
- tx = txEnabled() ? transactions().txStart() : null;
+ tx = txShouldBeUsed() ? transactions().txStart() : null;
try {
cacheAsync.getAndPutIfAbsent("key2", 3);
@@ -1845,14 +1861,16 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assertFalse(cache.putIfAbsent("key2", 3));
// Check db.
- putToStore("key3", 3);
+ if (!isMultiJvm()) {
+ putToStore("key3", 3);
- assertFalse(cache.putIfAbsent("key3", 4));
+ assertFalse(cache.putIfAbsent("key3", 4));
+ }
cache.localEvict(Collections.singleton("key2"));
// Same checks inside tx.
- Transaction tx = txEnabled() ? transactions().txStart() : null;
+ Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
try {
assertFalse(cache.putIfAbsent("key2", 3));
@@ -1872,7 +1890,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception In case of error.
*/
public void testPutxIfAbsentAsync() throws Exception {
- if (txEnabled())
+ if (txShouldBeUsed())
checkPutxIfAbsentAsync(true);
}
@@ -1916,11 +1934,13 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assertFalse(cacheAsync.<Boolean>future().get());
// Check db.
- putToStore("key3", 3);
+ if (!isMultiJvm()) {
+ putToStore("key3", 3);
- cacheAsync.putIfAbsent("key3", 4);
+ cacheAsync.putIfAbsent("key3", 4);
- assertFalse(cacheAsync.<Boolean>future().get());
+ assertFalse(cacheAsync.<Boolean>future().get());
+ }
cache.localEvict(Arrays.asList("key2"));
@@ -1932,9 +1952,11 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assertFalse(cacheAsync.<Boolean>future().get());
- cacheAsync.putIfAbsent("key3", 4);
+ if (!isMultiJvm()) {
+ cacheAsync.putIfAbsent("key3", 4);
- assertFalse(cacheAsync.<Boolean>future().get());
+ assertFalse(cacheAsync.<Boolean>future().get());
+ }
if (tx != null)
tx.commit();
@@ -1945,7 +1967,9 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
}
assertEquals((Integer)1, cache.get("key2"));
- assertEquals((Integer)3, cache.get("key3"));
+
+ if (!isMultiJvm())
+ assertEquals((Integer)3, cache.get("key3"));
}
/**
@@ -2014,11 +2038,13 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assert cache.get("key") == 4;
- putToStore("key2", 5);
+ if (!isMultiJvm()) {
+ putToStore("key2", 5);
- info("key2 5 -> 6");
+ info("key2 5 -> 6");
- assert cache.replace("key2", 5, 6);
+ assert cache.replace("key2", 5, 6);
+ }
for (int i = 0; i < gridCount(); i++) {
info("Peek key on grid [i=" + i + ", nodeId=" + grid(i).localNode().id() +
@@ -2028,11 +2054,12 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
", peekVal=" + grid(i).cache(null).localPeek("key2", ONHEAP) + ']');
}
- assertEquals((Integer)6, cache.get("key2"));
+ if (!isMultiJvm())
+ assertEquals((Integer)6, cache.get("key2"));
cache.localEvict(Collections.singleton("key"));
- Transaction tx = txEnabled() ? transactions().txStart() : null;
+ Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
try {
assert cache.replace("key", 4, 5);
@@ -2070,15 +2097,17 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assert cache.get("key") == 4;
- putToStore("key2", 5);
+ if (!isMultiJvm()) {
+ putToStore("key2", 5);
- assert cache.replace("key2", 6);
+ assert cache.replace("key2", 6);
- assertEquals((Integer)6, cache.get("key2"));
+ assertEquals((Integer)6, cache.get("key2"));
+ }
cache.localEvict(Collections.singleton("key"));
- Transaction tx = txEnabled() ? transactions().txStart() : null;
+ Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
try {
assert cache.replace("key", 5);
@@ -2144,17 +2173,19 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assert cache.get("key") == 4;
- putToStore("key2", 5);
+ if (!isMultiJvm()) {
+ putToStore("key2", 5);
- cacheAsync.replace("key2", 5, 6);
+ cacheAsync.replace("key2", 5, 6);
- assert cacheAsync.<Boolean>future().get();
+ assert cacheAsync.<Boolean>future().get();
- assertEquals((Integer)6, cache.get("key2"));
+ assertEquals((Integer)6, cache.get("key2"));
+ }
cache.localEvict(Collections.singleton("key"));
- Transaction tx = txEnabled() ? transactions().txStart() : null;
+ Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
try {
cacheAsync.replace("key", 4, 5);
@@ -2204,17 +2235,19 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assert cache.get("key") == 4;
- putToStore("key2", 5);
+ if (!isMultiJvm()) {
+ putToStore("key2", 5);
- cacheAsync.replace("key2", 6);
+ cacheAsync.replace("key2", 6);
- assert cacheAsync.<Boolean>future().get();
+ assert cacheAsync.<Boolean>future().get();
- assert cache.get("key2") == 6;
+ assert cache.get("key2") == 6;
+ }
cache.localEvict(Collections.singleton("key"));
- Transaction tx = txEnabled() ? transactions().txStart() : null;
+ Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
try {
cacheAsync.replace("key", 5);
@@ -2255,7 +2288,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
*/
public void testDeletedEntriesFlag() throws Exception {
if (cacheMode() != LOCAL && cacheMode() != REPLICATED && memoryMode() != OFFHEAP_TIERED) {
- int cnt = 3;
+ final int cnt = 3;
IgniteCache<String, Integer> cache = jcache();
@@ -2266,21 +2299,25 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
cache.remove(String.valueOf(i));
for (int g = 0; g < gridCount(); g++) {
- for (int i = 0; i < cnt; i++) {
- String key = String.valueOf(i);
-
- GridCacheContext<String, Integer> cctx = context(g);
-
- GridCacheEntryEx entry = cctx.isNear() ? cctx.near().dht().peekEx(key) :
- cctx.cache().peekEx(key);
-
- if (grid(0).affinity(null).mapKeyToPrimaryAndBackups(key).contains(grid(g).localNode())) {
- assertNotNull(entry);
- assertTrue(entry.deleted());
+ executeOnLocalOrRemoteJvm(g, new TestIgniteIdxRunnable() {
+ @Override public void run(int idx) throws Exception {
+ for (int i = 0; i < cnt; i++) {
+ String key = String.valueOf(i);
+
+ GridCacheContext<String, Integer> cctx = context(idx);
+
+ GridCacheEntryEx entry = cctx.isNear() ? cctx.near().dht().peekEx(key) :
+ cctx.cache().peekEx(key);
+
+ if (grid(idx).affinity(null).mapKeyToPrimaryAndBackups(key).contains(grid(idx).localNode())) {
+ assertNotNull(entry);
+ assertTrue(entry.deleted());
+ }
+ else
+ assertNull(entry);
+ }
}
- else
- assertNull(entry);
- }
+ });
}
}
}
@@ -2289,6 +2326,9 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testRemoveLoad() throws Exception {
+ if (isMultiJvm())
+ fail("https://issues.apache.org/jira/browse/IGNITE-1088");
+
int cnt = 10;
Set<String> keys = new HashSet<>();
@@ -2542,7 +2582,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception In case of error.
*/
public void testRemoveAllDuplicatesTx() throws Exception {
- if (txEnabled()) {
+ if (txShouldBeUsed()) {
try (Transaction tx = transactions().txStart()) {
jcache().removeAll(ImmutableSet.of("key1", "key1", "key1"));
@@ -2957,7 +2997,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
private void checkPeekTxRemove(TransactionConcurrency concurrency) throws Exception {
- if (txEnabled()) {
+ if (txShouldBeUsed()) {
Ignite ignite = primaryIgnite("key");
IgniteCache<String, Integer> cache = ignite.cache(null);
@@ -3065,7 +3105,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testPeekExpiredTx() throws Exception {
- if (txEnabled()) {
+ if (txShouldBeUsed()) {
IgniteCache<String, Integer> c = jcache();
String key = "1";
@@ -3091,7 +3131,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testTtlTx() throws Exception {
- if (txEnabled())
+ if (txShouldBeUsed())
checkTtl(true, false);
}
@@ -3115,6 +3155,9 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
private void checkTtl(boolean inTx, boolean oldEntry) throws Exception {
+ if (isMultiJvm())
+ fail("https://issues.apache.org/jira/browse/IGNITE-1089");
+
if (memoryMode() == OFFHEAP_TIERED)
return;
@@ -3610,7 +3653,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testOptimisticTxMissingKey() throws Exception {
- if (txEnabled()) {
+ if (txShouldBeUsed()) {
try (Transaction tx = transactions().txStart(OPTIMISTIC, READ_COMMITTED)) {
// Remove missing key.
assertTrue(jcache().remove(UUID.randomUUID().toString()));
@@ -3626,7 +3669,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testOptimisticTxMissingKeyNoCommit() throws Exception {
- if (txEnabled()) {
+ if (txShouldBeUsed()) {
try (Transaction tx = transactions().txStart(OPTIMISTIC, READ_COMMITTED)) {
// Remove missing key.
assertTrue(jcache().remove(UUID.randomUUID().toString()));
@@ -3670,7 +3713,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
private void checkRemovexInTx(TransactionConcurrency concurrency, TransactionIsolation isolation) throws Exception {
- if (txEnabled()) {
+ if (txShouldBeUsed()) {
final int cnt = 10;
CU.inTx(ignite(0), jcache(), concurrency, isolation, new CIX1<IgniteCache<String, Integer>>() {
@@ -3709,7 +3752,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testPessimisticTxMissingKey() throws Exception {
- if (txEnabled()) {
+ if (txShouldBeUsed()) {
try (Transaction tx = transactions().txStart(PESSIMISTIC, READ_COMMITTED)) {
// Remove missing key.
assertFalse(jcache().remove(UUID.randomUUID().toString()));
@@ -3725,7 +3768,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testPessimisticTxMissingKeyNoCommit() throws Exception {
- if (txEnabled()) {
+ if (txShouldBeUsed()) {
try (Transaction tx = transactions().txStart(PESSIMISTIC, READ_COMMITTED)) {
// Remove missing key.
assertFalse(jcache().remove(UUID.randomUUID().toString()));
@@ -3739,7 +3782,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testPessimisticTxRepeatableRead() throws Exception {
- if (txEnabled()) {
+ if (txShouldBeUsed()) {
try (Transaction ignored = transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
jcache().put("key", 1);
@@ -3752,7 +3795,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testPessimisticTxRepeatableReadOnUpdate() throws Exception {
- if (txEnabled()) {
+ if (txShouldBeUsed()) {
try (Transaction ignored = transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
jcache().put("key", 1);
@@ -3790,7 +3833,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @param keys Expected keys.
* @throws Exception If failed.
*/
- protected void checkSize(Collection<String> keys) throws Exception {
+ protected void checkSize(final Collection<String> keys) throws Exception {
if (memoryMode() == OFFHEAP_TIERED)
return;
@@ -3798,26 +3841,30 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assertEquals(keys.size(), jcache().localSize(CachePeekMode.ALL));
else {
for (int i = 0; i < gridCount(); i++) {
- GridCacheContext<String, Integer> ctx = context(i);
+ executeOnLocalOrRemoteJvm(i, new TestIgniteIdxRunnable() {
+ @Override public void run(int idx) throws Exception {
+ GridCacheContext<String, Integer> ctx = context(idx);
- if (ctx.cache().configuration().getMemoryMode() == OFFHEAP_TIERED)
- continue;
+ if (ctx.cache().configuration().getMemoryMode() == OFFHEAP_TIERED)
+ return;
- int size = 0;
+ int size = 0;
- for (String key : keys) {
- if (ctx.affinity().localNode(key, ctx.discovery().topologyVersionEx())) {
- GridCacheEntryEx e =
- ctx.isNear() ? ctx.near().dht().peekEx(key) : ctx.cache().peekEx(key);
+ for (String key : keys) {
+ if (ctx.affinity().localNode(key, ctx.discovery().topologyVersionEx())) {
+ GridCacheEntryEx e =
+ ctx.isNear() ? ctx.near().dht().peekEx(key) : ctx.cache().peekEx(key);
- assert e != null : "Entry is null [idx=" + i + ", key=" + key + ", ctx=" + ctx + ']';
- assert !e.deleted() : "Entry is deleted: " + e;
+ assert e != null : "Entry is null [idx=" + idx + ", key=" + key + ", ctx=" + ctx + ']';
+ assert !e.deleted() : "Entry is deleted: " + e;
- size++;
- }
- }
+ size++;
+ }
+ }
- assertEquals("Incorrect size on cache #" + i, size, jcache(i).localSize(ALL));
+ assertEquals("Incorrect size on cache #" + idx, size, jcache(idx).localSize(ALL));
+ }
+ });
}
}
}
@@ -3826,21 +3873,25 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @param keys Expected keys.
* @throws Exception If failed.
*/
- protected void checkKeySize(Collection<String> keys) throws Exception {
+ protected void checkKeySize(final Collection<String> keys) throws Exception {
if (nearEnabled())
assertEquals("Invalid key size: " + jcache().localSize(ALL),
keys.size(), jcache().localSize(ALL));
else {
for (int i = 0; i < gridCount(); i++) {
- GridCacheContext<String, Integer> ctx = context(i);
+ executeOnLocalOrRemoteJvm(i, new TestIgniteIdxRunnable() {
+ @Override public void run(int idx) throws Exception {
+ GridCacheContext<String, Integer> ctx = context(idx);
- int size = 0;
+ int size = 0;
- for (String key : keys)
- if (ctx.affinity().localNode(key, ctx.discovery().topologyVersionEx()))
- size++;
+ for (String key : keys)
+ if (ctx.affinity().localNode(key, ctx.discovery().topologyVersionEx()))
+ size++;
- assertEquals("Incorrect key size on cache #" + i, size, jcache(i).localSize(ALL));
+ assertEquals("Incorrect key size on cache #" + idx, size, jcache(idx).localSize(ALL));
+ }
+ });
}
}
}
@@ -3879,7 +3930,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
UUID nodeId = node.id();
for (int i = 0; i < gridCount(); i++) {
- if (context(i).localNodeId().equals(nodeId))
+ if (grid(i).localNode().id().equals(nodeId))
return ignite(i);
}
@@ -3899,24 +3950,27 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @param cnt Keys count.
* @return Collection of keys for which given cache is primary.
*/
- protected List<String> primaryKeysForCache(IgniteCache<String, Integer> cache, int cnt, int startFrom) {
- List<String> found = new ArrayList<>(cnt);
+ protected List<String> primaryKeysForCache(final IgniteCache<String, Integer> cache, final int cnt, final int startFrom) {
+ return executeOnLocalOrRemoteJvm(cache, new TestCacheCallable<String, Integer, List<String>>() {
+ @Override public List<String> call(Ignite ignite, IgniteCache<String, Integer> cache) throws Exception {
+ List<String> found = new ArrayList<>();
- Ignite ignite = cache.unwrap(Ignite.class);
- Affinity<Object> affinity = ignite.affinity(cache.getName());
+ Affinity<Object> affinity = ignite.affinity(cache.getName());
- for (int i = startFrom; i < startFrom + 100_000; i++) {
- String key = "key" + i;
+ for (int i = startFrom; i < startFrom + 100_000; i++) {
+ String key = "key" + i;
- if (affinity.isPrimary(ignite.cluster().localNode(), key)) {
- found.add(key);
+ if (affinity.isPrimary(ignite.cluster().localNode(), key)) {
+ found.add(key);
- if (found.size() == cnt)
- return found;
- }
- }
+ if (found.size() == cnt)
+ return found;
+ }
+ }
- throw new IgniteException("Unable to find " + cnt + " keys as primary for cache.");
+ throw new IgniteException("Unable to find " + cnt + " keys as primary for cache.");
+ }
+ });
}
/**
@@ -4108,13 +4162,16 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
*/
private void checkIteratorsCleared() {
for (int j = 0; j < gridCount(); j++) {
+ executeOnLocalOrRemoteJvm(j, new TestIgniteIdxRunnable() {
+ @Override public void run(int idx) throws Exception {
+ GridCacheQueryManager queries = context(idx).queries();
- GridCacheQueryManager queries = context(j).queries();
-
- Map map = GridTestUtils.getFieldValue(queries, GridCacheQueryManager.class, "qryIters");
+ Map map = GridTestUtils.getFieldValue(queries, GridCacheQueryManager.class, "qryIters");
- for (Object obj : map.values())
- assertEquals("Iterators not removed for grid " + j, 0, ((Map) obj).size());
+ for (Object obj : map.values())
+ assertEquals("Iterators not removed for grid " + idx, 0, ((Map)obj).size());
+ }
+ });
}
}
@@ -4358,6 +4415,9 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testWithSkipStore() throws Exception {
+ if(isMultiJvm())
+ fail("https://issues.apache.org/jira/browse/IGNITE-1088");
+
IgniteCache<String, Integer> cache = grid(0).cache(null);
IgniteCache<String, Integer> cacheSkipStore = cache.withSkipStore();
@@ -4567,6 +4627,9 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testWithSkipStoreRemoveAll() throws Exception {
+ if (isMultiJvm())
+ fail("https://issues.apache.org/jira/browse/IGNITE-1088");
+
if (atomicityMode() == TRANSACTIONAL || (atomicityMode() == ATOMIC && nearEnabled())) // TODO IGNITE-373.
return;
@@ -4608,7 +4671,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testWithSkipStoreTx() throws Exception {
- if (txEnabled()) {
+ if (txShouldBeUsed()) {
IgniteCache<String, Integer> cache = grid(0).cache(null);
IgniteCache<String, Integer> cacheSkipStore = cache.withSkipStore();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
index 468aec1..4cd208d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
@@ -313,12 +313,20 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest {
/**
* @return {@code True} if transactions are enabled.
+ * @see #txShouldBeUsed()
*/
protected boolean txEnabled() {
return true;
}
/**
+ * @return {@code True} if transactions should be used.
+ */
+ protected boolean txShouldBeUsed() {
+ return txEnabled() && !isMultiJvm();
+ }
+
+ /**
* @return {@code True} if locking is enabled.
*/
protected boolean lockingEnabled() {
@@ -360,7 +368,11 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest {
* @param idx Index of grid.
* @return Cache context.
*/
- protected GridCacheContext<String, Integer> context(int idx) {
+ protected GridCacheContext<String, Integer> context(final int idx) {
+ if (isRemoteJvm(idx) && !isRemoteJvm())
+ throw new UnsupportedOperationException("Operation can't be done automatically via proxy. " +
+ "Send task with this logic on remote jvm instead.");
+
return ((IgniteKernal)grid(idx)).<String, Integer>internalCache().context();
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
index ac93adb..c592395 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
@@ -114,6 +114,9 @@ public class GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest extends GridCacheNe
/** {@inheritDoc} */
@Override public void testEvictExpired() throws Exception {
+ if (isMultiJvm())
+ fail("https://issues.apache.org/jira/browse/IGNITE-1113");
+
IgniteCache<String, Integer> cache = jcache();
String key = primaryKeysForCache(cache, 1).get(0);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
index d40e9e3..f30ea71 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
@@ -125,7 +125,7 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
return F.view(super.affinityNodes(), new P1<ClusterNode>() {
@Override public boolean apply(ClusterNode n) {
- return !F.eq(G.ignite(n.id()).name(), grid(nearIdx).name());
+ return !F.eq(grid(n).name(), grid(nearIdx).name());
}
});
}
@@ -211,6 +211,9 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
* @throws Exception If failed.
*/
private void checkReaderTtl(boolean inTx) throws Exception {
+ if (isMultiJvm())
+ fail("https://issues.apache.org/jira/browse/IGNITE-1089");
+
int ttl = 1000;
final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS, ttl));
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java
index ef0ab48..962e80d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java
@@ -104,9 +104,9 @@ public class GridCacheNearTxMultiNodeSelfTest extends GridCommonAbstractTest {
assert backupNode != otherNode;
assert priNode != otherNode;
- Ignite priIgnite = G.ignite(priNode.id());
- Ignite backupIgnite = G.ignite(backupNode.id());
- Ignite otherIgnite = G.ignite(otherNode.id());
+ final Ignite priIgnite = grid(priNode);
+ Ignite backupIgnite = grid(backupNode);
+ Ignite otherIgnite = grid(otherNode);
List<Ignite> ignites = F.asList(otherIgnite, priIgnite, backupIgnite);
@@ -152,8 +152,8 @@ public class GridCacheNearTxMultiNodeSelfTest extends GridCommonAbstractTest {
tx.close();
}
- G.stop(priIgnite.name(), true);
- G.stop(backupIgnite.name(), true);
+ stopGrid(priIgnite.name(), true);
+ stopGrid(backupIgnite.name(), true);
Ignite newIgnite = startGrid(GRID_CNT);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
index 30c9e8a..a5e7a31 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
@@ -28,7 +28,6 @@ import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.lang.*;
import java.util.*;
-import java.util.concurrent.atomic.*;
import static org.apache.ignite.cache.CacheMode.*;
import static org.apache.ignite.cache.CachePeekMode.*;
@@ -135,7 +134,7 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
for (int i = 0; i < gridCount(); i++)
info(">>>>> Grid" + i + ": " + grid(i).localNode().id());
- int size = 10;
+ final int size = 10;
IgniteCache<Object, Object> chache0 = grid(0).cache(null);
@@ -148,16 +147,20 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
}
for (int i = 0; i < gridCount(); i++) {
- assertEquals(0, context(i).tm().idMapSize());
+ executeOnLocalOrRemoteJvm(i, new TestIgniteIdxRunnable() {
+ @Override public void run(int idx) throws Exception {
+ assertEquals(0, context(idx).tm().idMapSize());
- IgniteCache<Object, Object> cache = grid(i).cache(null);
- ClusterNode node = grid(i).localNode();
+ IgniteCache<Object, Object> cache = grid(idx).cache(null);
+ ClusterNode node = grid(idx).localNode();
- for (int k = 0; k < size; k++) {
- if (affinity(cache).isPrimaryOrBackup(node, k))
- assertEquals("Check failed for node: " + node.id(), k,
- cache.localPeek(k, CachePeekMode.ONHEAP, CachePeekMode.OFFHEAP));
- }
+ for (int k = 0; k < size; k++) {
+ if (affinity(cache).isPrimaryOrBackup(node, k))
+ assertEquals("Check failed for node: " + node.id(), k,
+ cache.localPeek(k, CachePeekMode.ONHEAP, CachePeekMode.OFFHEAP));
+ }
+ }
+ });
}
for (int i = 0; i < size; i++) {
@@ -179,21 +182,24 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
if (memoryMode() == CacheMemoryMode.OFFHEAP_TIERED)
return;
- final AtomicInteger swapEvts = new AtomicInteger(0);
- final AtomicInteger unswapEvts = new AtomicInteger(0);
+ final IgniteAtomicLong swapEvts = grid(0).atomicLong("swapEvts", 0, true);
+
+ final IgniteAtomicLong unswapEvts = grid(0).atomicLong("unswapEvts", 0, true);
for (int i = 0; i < gridCount(); i++) {
+ final int iCopy = i;
+
grid(i).events().localListen(new IgnitePredicate<Event>() {
@Override public boolean apply(Event evt) {
info("Received event: " + evt);
switch (evt.type()) {
case EVT_CACHE_OBJECT_SWAPPED:
- swapEvts.incrementAndGet();
+ grid(iCopy).atomicLong("swapEvts", 0, false).incrementAndGet();
break;
case EVT_CACHE_OBJECT_UNSWAPPED:
- unswapEvts.incrementAndGet();
+ grid(iCopy).atomicLong("unswapEvts", 0, false).incrementAndGet();
break;
}
@@ -235,8 +241,13 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
boolean nearEnabled = nearEnabled(c);
- if (nearEnabled)
- assertTrue(((IgniteKernal)ignite(i)).internalCache().context().isNear());
+ if (nearEnabled) {
+ executeOnLocalOrRemoteJvm(i, new TestIgniteIdxRunnable() {
+ @Override public void run(int idx) throws Exception {
+ assertTrue(((IgniteKernal)ignite(idx)).internalCache().context().isNear());
+ }
+ });
+ }
Integer nearPeekVal = nearEnabled ? 1 : null;
@@ -306,7 +317,7 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
for (int i = 0; i < gridCount(); i++) {
IgniteEx ignite = grid(i);
- if (!ignite.configuration().isClientMode()) {
+ if (!Boolean.TRUE.equals(ignite.configuration().isClientMode())) {
if (ignite0 == null)
ignite0 = ignite;
else if (ignite1 == null)
@@ -396,7 +407,8 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
}
};
- info("All affinity nodes: " + affinityNodes());
+ if (!isMultiJvm())
+ info("All affinity nodes: " + affinityNodes());
IgniteCache<Object, Object> cache = grid(0).cache(null);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicClientOnlyFairAffinityMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicClientOnlyFairAffinityMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicClientOnlyFairAffinityMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..e2ac8a7
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicClientOnlyFairAffinityMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicClientOnlyFairAffinityMultiJvmFullApiSelfTest
+ extends GridCacheAtomicClientOnlyFairAffinityMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicClientOnlyMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicClientOnlyMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicClientOnlyMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..dfffc70
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicClientOnlyMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicClientOnlyMultiJvmFullApiSelfTest extends
+ GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicClientOnlyMultiJvmP2PDisabledFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicClientOnlyMultiJvmP2PDisabledFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicClientOnlyMultiJvmP2PDisabledFullApiSelfTest.java
new file mode 100644
index 0000000..2d8b9a5
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicClientOnlyMultiJvmP2PDisabledFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicClientOnlyMultiJvmP2PDisabledFullApiSelfTest extends
+ GridCacheAtomicClientOnlyMultiNodeP2PDisabledFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicCopyOnReadDisabledMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicCopyOnReadDisabledMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicCopyOnReadDisabledMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..1388a75
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicCopyOnReadDisabledMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicCopyOnReadDisabledMultiJvmFullApiSelfTest extends
+ GridCacheAtomicCopyOnReadDisabledMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicFairAffinityMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicFairAffinityMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicFairAffinityMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..5808f28
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicFairAffinityMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicFairAffinityMultiJvmFullApiSelfTest extends
+ GridCacheAtomicFairAffinityMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..0d6a1ce
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicMultiJvmFullApiSelfTest.java
@@ -0,0 +1,30 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicMultiJvmFullApiSelfTest extends GridCacheAtomicMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicMultiJvmP2PDisabledFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicMultiJvmP2PDisabledFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicMultiJvmP2PDisabledFullApiSelfTest.java
new file mode 100644
index 0000000..0f35862
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicMultiJvmP2PDisabledFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicMultiJvmP2PDisabledFullApiSelfTest extends
+ GridCacheAtomicMultiNodeP2PDisabledFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearEnabledFairAffinityMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearEnabledFairAffinityMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearEnabledFairAffinityMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..44e0a6d
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearEnabledFairAffinityMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicNearEnabledFairAffinityMultiJvmFullApiSelfTest extends
+ GridCacheAtomicNearEnabledFairAffinityMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearEnabledMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearEnabledMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearEnabledMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..44f3c6f
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearEnabledMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicNearEnabledMultiJvmFullApiSelfTest extends
+ GridCacheAtomicNearEnabledMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearEnabledPrimaryWriteOrderMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearEnabledPrimaryWriteOrderMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearEnabledPrimaryWriteOrderMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..e23ab52
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearEnabledPrimaryWriteOrderMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicNearEnabledPrimaryWriteOrderMultiJvmFullApiSelfTest extends
+ GridCacheAtomicNearEnabledPrimaryWriteOrderMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearOnlyMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearOnlyMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearOnlyMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..a2850c2
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearOnlyMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicNearOnlyMultiJvmFullApiSelfTest extends
+ GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearOnlyMultiJvmP2PDisabledFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearOnlyMultiJvmP2PDisabledFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearOnlyMultiJvmP2PDisabledFullApiSelfTest.java
new file mode 100644
index 0000000..f07d51d
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicNearOnlyMultiJvmP2PDisabledFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicNearOnlyMultiJvmP2PDisabledFullApiSelfTest extends
+ GridCacheAtomicNearOnlyMultiNodeP2PDisabledFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicOffHeapMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicOffHeapMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicOffHeapMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..8eb4db1
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicOffHeapMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicOffHeapMultiJvmFullApiSelfTest extends
+ GridCacheAtomicOffHeapMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicOffHeapTieredMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicOffHeapTieredMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicOffHeapTieredMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..185e8c7
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicOffHeapTieredMultiJvmFullApiSelfTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicOffHeapTieredMultiJvmFullApiSelfTest
+ extends GridCacheAtomicOffHeapTieredMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void testLocalClearKeys() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-1107");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderFairAffinityMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderFairAffinityMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderFairAffinityMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..421ce32
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderFairAffinityMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicPrimaryWriteOrderFairAffinityMultiJvmFullApiSelfTest extends
+ GridCacheAtomicPrimaryWriteOrderFairAffinityMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..928b955
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest extends
+ GridCacheAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderMultiJvmP2PDisabledFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderMultiJvmP2PDisabledFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderMultiJvmP2PDisabledFullApiSelfTest.java
new file mode 100644
index 0000000..c805377
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWriteOrderMultiJvmP2PDisabledFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicPrimaryWriteOrderMultiJvmP2PDisabledFullApiSelfTest extends
+ GridCacheAtomicPrimaryWriteOrderMultiNodeP2PDisabledFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
[32/50] [abbrv] incubator-ignite git commit: #ignite-964: add
affinityRun
Posted by iv...@apache.org.
#ignite-964: add affinityRun
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/06d3a296
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/06d3a296
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/06d3a296
Branch: refs/heads/ignite-961
Commit: 06d3a2969c09fd614fe4ccd5aad0081970c4dc3a
Parents: d4c223c
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 10 11:52:20 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 10 11:52:20 2015 +0300
----------------------------------------------------------------------
.../processors/rest/GridRestCommand.java | 3 ++
.../IgniteScriptingCommandHandler.java | 53 +++++++++++++++++++-
.../rest/request/RestRunScriptRequest.java | 34 +++++++++++++
modules/nodejs/src/main/js/compute.js | 17 ++++++-
.../ignite/internal/NodeJsComputeSelfTest.java | 7 +++
modules/nodejs/src/test/js/test-compute.js | 35 +++++++++++++
.../http/jetty/GridJettyRestHandler.java | 17 +++++++
7 files changed, 163 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d3a296/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
index 00eb746..45e86e0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
@@ -138,6 +138,9 @@ public enum GridRestCommand {
/** Run script. */
RUN_SCRIPT("runscript"),
+ /** Affinity run script. */
+ AFFINITY_RUN_SCRIPT("affrun"),
+
/** Execute map reduce script. */
EXECUTE_MAP_REDUCE_SCRIPT("excmapreduce"),
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d3a296/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
index f2ddd59..d3f26da 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
@@ -44,7 +44,8 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter
/** Supported commands. */
private static final Collection<GridRestCommand> SUPPORTED_COMMANDS = U.sealList(
EXECUTE_MAP_REDUCE_SCRIPT,
- RUN_SCRIPT);
+ RUN_SCRIPT,
+ AFFINITY_RUN_SCRIPT);
/** Emit result. */
private IgniteJsEmitResult emitRes;
@@ -95,7 +96,13 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter
assert req instanceof RestRunScriptRequest : "Invalid type of run script request.";
return ctx.closure().callLocalSafe(
- new RunScriptCallable(ctx, (RestRunScriptRequest) req), false);
+ new RunScriptCallable(ctx, (RestRunScriptRequest)req), false);
+ }
+
+ case AFFINITY_RUN_SCRIPT: {
+ assert req instanceof RestRunScriptRequest : "Invalid type of run script request.";
+
+ return ctx.closure().callLocalSafe(new AffinityRunScriptCallable(ctx, (RestRunScriptRequest)req));
}
case EXECUTE_MAP_REDUCE_SCRIPT: {
@@ -300,6 +307,48 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter
}
/**
+ * Affinity run script callable.
+ */
+ private static class AffinityRunScriptCallable implements IgniteCallable<GridRestResponse> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Kernal context. */
+ private GridKernalContext ctx;
+
+ /** Run script request. */
+ private RestRunScriptRequest req;
+
+ /** Cache name. */
+ private String cacheName;
+
+ /** Key. */
+ private Object key;
+
+ /**
+ * @param ctx Kernal context.
+ * @param req Run script request.
+ */
+ public AffinityRunScriptCallable(GridKernalContext ctx, RestRunScriptRequest req) {
+ this.cacheName = req.cacheName();
+ this.key = req.affinityKey();
+ this.ctx = ctx;
+ this.req = req;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridRestResponse call() throws Exception {
+ try {
+ return new GridRestResponse(ctx.grid().compute().affinityCall(cacheName, key,
+ new JsFunctionCallable(req.script(), req.argument())));
+ }
+ catch (Exception e) {
+ return new GridRestResponse(GridRestResponse.STATUS_FAILED, e.getMessage());
+ }
+ }
+ }
+
+ /**
* Map reduce callable.
*/
private static class MapReduceCallable implements Callable<GridRestResponse> {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d3a296/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestRunScriptRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestRunScriptRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestRunScriptRequest.java
index cf74802..416fbf9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestRunScriptRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestRunScriptRequest.java
@@ -27,6 +27,12 @@ public class RestRunScriptRequest extends GridRestRequest {
/** Function arguments. */
private Object arg;
+ /** Key for affinity run. */
+ private Object key;
+
+ /** Cache name for affinity run. */
+ private String cacheName;
+
/**
* @return Java script function.
*/
@@ -54,4 +60,32 @@ public class RestRunScriptRequest extends GridRestRequest {
public void argument(Object arg) {
this.arg = arg;
}
+
+ /**
+ * @return Key for affinity run.
+ */
+ public Object affinityKey() {
+ return key;
+ }
+
+ /**
+ * @param key Key for affinity run.
+ */
+ public void affinityKey(Object key) {
+ this.key = key;
+ }
+
+ /**
+ * @return Cache name for affinity run.
+ */
+ public String cacheName() {
+ return cacheName;
+ }
+
+ /**
+ * @param cacheName Cache name for affinity run.
+ */
+ public void cacheName(String cacheName) {
+ this.cacheName = cacheName;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d3a296/modules/nodejs/src/main/js/compute.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/compute.js b/modules/nodejs/src/main/js/compute.js
index 16de9e4..5c28418 100644
--- a/modules/nodejs/src/main/js/compute.js
+++ b/modules/nodejs/src/main/js/compute.js
@@ -35,7 +35,22 @@ function Compute(server) {
*/
Compute.prototype.run = function(job, args, callback) {
this._server.runCommand(new Command("runscript").addParam("func", job).
- setPostData(JSON.stringify({"arg" : args})), callback);
+ setPostData(JSON.stringify({"arg" : args})), callback);
+}
+
+/**
+ * Executes given job on the node where data for provided affinity key is located.
+ *
+ * @this {Compute}
+ * @param {string} cacheName Cache name
+ * @param {string|number|JSONObject} key Key.
+ * @param job Function
+ * @param args Function arguments
+ * @param {onGet} callback Callback
+ */
+Compute.prototype.affinityRun = function(cacheName, key, job, args, callback) {
+ this._server.runCommand(new Command("affrun").addParam("func", job).addParam("cacheName", cacheName).
+ setPostData(JSON.stringify({"arg" : args, "key" : key})), callback);
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d3a296/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsComputeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsComputeSelfTest.java b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsComputeSelfTest.java
index 48b2855..1f8c3de 100644
--- a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsComputeSelfTest.java
+++ b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsComputeSelfTest.java
@@ -156,6 +156,13 @@ public class NodeJsComputeSelfTest extends NodeJsAbstractTest {
/**
* @throws Exception If failed.
*/
+ public void testComputeAffinityRunScriptContainsKey() throws Exception {
+ runJsScript("testComputeAffinityRunScriptContainsKey");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void _testRestartGrid() throws Exception {
final AtomicInteger id = new AtomicInteger(2);
IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d3a296/modules/nodejs/src/test/js/test-compute.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/test/js/test-compute.js b/modules/nodejs/src/test/js/test-compute.js
index 5d865ce..5cdc3e0 100644
--- a/modules/nodejs/src/test/js/test-compute.js
+++ b/modules/nodejs/src/test/js/test-compute.js
@@ -77,6 +77,41 @@ testComputeRunScriptContainsKey = function() {
TestUtils.startIgniteNode(computeRunScriptContainsKey);
}
+testComputeAffinityRunScriptContainsKey = function() {
+ function computeRunScriptContainsKey(error, ignite) {
+ assert(error == null, "Error on start:" + error);
+
+ var comp = ignite.compute();
+
+ var f = function(key) {
+ var cache = ignite.cache("mycache");
+ cache.put(key, "[AAAAAAA]");
+
+ if (!cache.containsKey(key))
+ throw "Contains key does not work."
+
+ return key;
+ }
+
+ function onEnd(err, res) {
+ assert(err == null, err);
+ assert(TestUtils.compareObject(initKey, res), "Incorrect result after script.")
+
+ ignite.cache("mycache").containsKey(initKey, function(err0, res0) {
+ assert(err0 === null, "Get error on js contatins key [err=" + err0 + "]");
+ assert(res0 === true, "Incorrect value on js contains key [res=" + res0 + "]");
+ TestUtils.testDone();
+ });
+ }
+
+ var initKey = {"1" : ["1", "2"]};
+
+ comp.affinityRun("mycache", initKey, f, initKey, onEnd.bind(null));
+ }
+
+ TestUtils.startIgniteNode(computeRunScriptContainsKey);
+}
+
testComputeRunScriptContainsKeys = function() {
function computeRunScriptContainsKey(error, ignite) {
assert(error == null, "Error on start:" + error);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d3a296/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index d601c17..cad7cc2 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -584,6 +584,23 @@ public class GridJettyRestHandler extends AbstractHandler {
break;
}
+ case AFFINITY_RUN_SCRIPT: {
+ RestRunScriptRequest restReq0 = new RestRunScriptRequest();
+
+ restReq0.script((String)params.get("func"));
+ restReq0.cacheName((String)params.get("cacheName"));
+
+ JSONObject o = parseRequest(req);
+ restReq0.argument(o.get("arg"));
+
+ Object cacheObj = JSONCacheObject.toSimpleObject(o.get("key"));
+ restReq0.affinityKey(cacheObj);
+
+ restReq = restReq0;
+
+ break;
+ }
+
case EXECUTE_MAP_REDUCE_SCRIPT: {
RestMapReduceScriptRequest restReq0 = new RestMapReduceScriptRequest();
[24/50] [abbrv] incubator-ignite git commit: #ignite-964: throw error
if no node started in example.
Posted by iv...@apache.org.
#ignite-964: throw error if no node started in example.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ba4c59a2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ba4c59a2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ba4c59a2
Branch: refs/heads/ignite-961
Commit: ba4c59a2320d82a4f493827a91e7dcc298485a29
Parents: 1749345
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jul 9 18:34:54 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jul 9 18:34:54 2015 +0300
----------------------------------------------------------------------
examples/src/main/js/cache-api-example.js | 3 +++
examples/src/main/js/cache-put-get-example.js | 3 +++
examples/src/main/js/cache-query-example.js | 3 +++
examples/src/main/js/map-reduce-example.js | 3 +++
examples/src/main/js/run-cache-script.js | 3 +++
examples/src/main/js/run-function-example.js | 3 +++
6 files changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba4c59a2/examples/src/main/js/cache-api-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-api-example.js b/examples/src/main/js/cache-api-example.js
index 9308353..85f9fde 100644
--- a/examples/src/main/js/cache-api-example.js
+++ b/examples/src/main/js/cache-api-example.js
@@ -35,6 +35,9 @@ function main() {
Ignition.start(['127.0.0.1:9095'], null, onConnect);
function onConnect(err, ignite) {
+ if (err !== null)
+ throw "Start remote node with config examples/config/js/example-js-cache.xml.";
+
console.log(">>> Cache API example started.");
// Create cache on server with cacheName.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba4c59a2/examples/src/main/js/cache-put-get-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-put-get-example.js b/examples/src/main/js/cache-put-get-example.js
index bf2c472..42a9cf8 100644
--- a/examples/src/main/js/cache-put-get-example.js
+++ b/examples/src/main/js/cache-put-get-example.js
@@ -36,6 +36,9 @@ function main() {
Ignition.start(['127.0.0.1:9095'], null, onConnect);
function onConnect(err, ignite) {
+ if (err !== null)
+ throw "Start remote node with config examples/config/js/example-js-cache.xml.";
+
ignite.getOrCreateCache(cacheName, function(err, cache) { putGetExample(ignite, cache); });
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba4c59a2/examples/src/main/js/cache-query-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-query-example.js b/examples/src/main/js/cache-query-example.js
index 04ffb1e..5241e69 100644
--- a/examples/src/main/js/cache-query-example.js
+++ b/examples/src/main/js/cache-query-example.js
@@ -27,6 +27,9 @@ var cacheName = "CacheQueryExample";
Ignition.start(['127.0.0.1:9095'], null, onConnect);
function onConnect(err, ignite) {
+ if (err !== null)
+ throw "Start remote node with config examples/config/js/example-js-cache.xml.";
+
console.log(">>> Cache query example started.");
var entries = [new CacheEntry("key0", "val0"), new CacheEntry("key1", "val1")];
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba4c59a2/examples/src/main/js/map-reduce-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/map-reduce-example.js b/examples/src/main/js/map-reduce-example.js
index ab02bf8..8adf095 100644
--- a/examples/src/main/js/map-reduce-example.js
+++ b/examples/src/main/js/map-reduce-example.js
@@ -36,6 +36,9 @@ function main() {
Ignition.start(['127.0.0.1:9095'], null, onConnect);
function onConnect(err, ignite) {
+ if (err !== null)
+ throw "Start remote node with config examples/config/js/example-js-cache.xml.";
+
console.log(">>> Compute map reduce example started.");
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba4c59a2/examples/src/main/js/run-cache-script.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/run-cache-script.js b/examples/src/main/js/run-cache-script.js
index b27721d..18d5452 100644
--- a/examples/src/main/js/run-cache-script.js
+++ b/examples/src/main/js/run-cache-script.js
@@ -35,6 +35,9 @@ function main() {
Ignition.start(['127.0.0.1:9095'], null, onConnect);
function onConnect(err, ignite) {
+ if (err !== null)
+ throw "Start remote node with config examples/config/js/example-js-cache.xml.";
+
console.log(">>> Run cache script example started.");
ignite.getOrCreateCache(cacheName, function(err, cache) { runCacheScript(ignite, cache); });
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba4c59a2/examples/src/main/js/run-function-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/run-function-example.js b/examples/src/main/js/run-function-example.js
index 740dc20..bec1e9f 100644
--- a/examples/src/main/js/run-function-example.js
+++ b/examples/src/main/js/run-function-example.js
@@ -37,6 +37,9 @@ function main() {
Ignition.start(['127.0.0.1:9095'], null, onConnect);
function onConnect(err, ignite) {
+ if (err !== null)
+ throw "Start remote node with config examples/config/js/example-js-cache.xml.";
+
console.log(">>> Compute callable example started");
var job = function (args) {
[44/50] [abbrv] incubator-ignite git commit: #ignite-964: fix review
comments.
Posted by iv...@apache.org.
#ignite-964: fix review comments.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/86e5d093
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/86e5d093
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/86e5d093
Branch: refs/heads/ignite-961
Commit: 86e5d093b67907eb7fe4e5ea1ce86a006ca6089c
Parents: 7d4f378
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 10 18:48:57 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 10 18:48:57 2015 +0300
----------------------------------------------------------------------
examples/src/main/js/cache-api-example.js | 13 ++--
examples/src/main/js/cache-put-get-example.js | 5 +-
examples/src/main/js/cache-query-example.js | 15 ++---
.../main/js/cache-sql-fields-query-example.js | 15 ++---
examples/src/main/js/compute-run-example.js | 5 +-
examples/src/main/js/map-reduce-example.js | 14 ++--
examples/src/main/js/run-function-example.js | 67 --------------------
7 files changed, 31 insertions(+), 103 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86e5d093/examples/src/main/js/cache-api-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-api-example.js b/examples/src/main/js/cache-api-example.js
index 85f9fde..07d14f3 100644
--- a/examples/src/main/js/cache-api-example.js
+++ b/examples/src/main/js/cache-api-example.js
@@ -21,10 +21,9 @@ var Ignition = apacheIgnite.Ignition;
/**
* This example demonstrates some of the cache rich API capabilities.
* <p>
- * Remote nodes should always be started with special configuration file which
- * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
+ * Start Ignite node with {@code examples/config/js/example-js-cache.xml} configuration before running example.
* <p>
- * Alternatively you can run ExampleJsNodeStartup in another JVM which will
+ * Alternatively you can run ExampleJsNodeStartup which will
* start node with {@code examples/config/js/example-js-cache.xml} configuration.
*/
function main() {
@@ -42,8 +41,8 @@ function main() {
// Create cache on server with cacheName.
ignite.getOrCreateCache(cacheName, function(err, cache) {
- atomicMapOperations(ignite, cache);
- });
+ atomicMapOperations(ignite, cache);
+ });
}
/**
@@ -92,8 +91,8 @@ function main() {
// Destroying cache.
ignite.destroyCache(cacheName, function(err) {
- console.log(">>> End of Cache API example.");
- });
+ console.log(">>> End of Cache API example.");
+ });
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86e5d093/examples/src/main/js/cache-put-get-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-put-get-example.js b/examples/src/main/js/cache-put-get-example.js
index 42a9cf8..8155cb7 100644
--- a/examples/src/main/js/cache-put-get-example.js
+++ b/examples/src/main/js/cache-put-get-example.js
@@ -22,10 +22,9 @@ var CacheEntry = apacheIgnite.CacheEntry;
/**
* This example demonstrates very basic operations on cache, such as 'put' and 'get'.
* <p>
- * Remote nodes should always be started with special configuration file which
- * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
+ * Start Ignite node with {@code examples/config/js/example-js-cache.xml} configuration before running example.
* <p>
- * Alternatively you can run ExampleJsNodeStartup in another JVM which will
+ * Alternatively you can run ExampleJsNodeStartup which will
* start node with {@code examples/config/js/example-js-cache.xml} configuration.
*/
function main() {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86e5d093/examples/src/main/js/cache-query-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-query-example.js b/examples/src/main/js/cache-query-example.js
index 18b1482..3566ac8 100644
--- a/examples/src/main/js/cache-query-example.js
+++ b/examples/src/main/js/cache-query-example.js
@@ -26,10 +26,9 @@ var CacheEntry = apacheIgnite.CacheEntry;
/**
* Cache queries example. This example demonstrates SQL queries over cache.
* <p>
- * Remote nodes should always be started with special configuration file which
- * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
+ * Start Ignite node with {@code examples/config/js/example-js-cache.xml} configuration before running example.
* <p>
- * Alternatively you can run ExampleJsNodeStartup in another JVM which will
+ * Alternatively you can run ExampleJsNodeStartup which will
* start node with {@code examples/config/js/example-js-cache.xml} configuration.
*/
main() {
@@ -48,12 +47,12 @@ main() {
var entries = initializeEntries();
ignite.getOrCreateCache(cacheName, function(err, cache) {
- cacheQuery(ignite, cache, entries);
- });
+ cacheQuery(ignite, cache, entries);
+ });
}
function cacheQuery(ignite, cache, entries) {
- cache.putAll(entries, onCachePut.bind(null, ignite));
+ cache.putAll(entries, onCachePut);
function onCachePut(ignite, err) {
console.log(">>> Create cache for people.")
@@ -84,8 +83,8 @@ main() {
// Destroying cache.
ignite.destroyCache(cacheName, function(err) {
- console.log(">>> End of query example.");
- });
+ console.log(">>> End of query example.");
+ });
});
//Run query.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86e5d093/examples/src/main/js/cache-sql-fields-query-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-sql-fields-query-example.js b/examples/src/main/js/cache-sql-fields-query-example.js
index 64a50f7..c16fbe6 100644
--- a/examples/src/main/js/cache-sql-fields-query-example.js
+++ b/examples/src/main/js/cache-sql-fields-query-example.js
@@ -25,10 +25,9 @@ var CacheEntry = apacheIgnite.CacheEntry;
/**
* Cache queries example. This example demonstrates SQL queries over cache.
* <p>
- * Remote nodes should always be started with special configuration file which
- * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
+ * Start Ignite node with {@code examples/config/js/example-js-cache.xml} configuration before running example.
* <p>
- * Alternatively you can run ExampleJsNodeStartup in another JVM which will
+ * Alternatively you can run ExampleJsNodeStartup which will
* start node with {@code examples/config/js/example-js-cache.xml} configuration.
*/
main() {
@@ -47,8 +46,8 @@ main() {
var entries = initializeEntries();
ignite.getOrCreateCache(cacheName, function(err, cache) {
- cacheSqlFieldsQuery(ignite, cache, entries);
- });
+ cacheSqlFieldsQuery(ignite, cache, entries);
+ });
}
function cacheSqlFieldsQuery(ignite, cache, entries) {
@@ -74,12 +73,12 @@ main() {
//This function is called when query is finished.
qry.on("end", function(err) {
- console.log(">>> Names of all employees:): " + JSON.stringify(fullRes));
+ console.log(">>> Names of all employees: " + JSON.stringify(fullRes));
// Destroying cache.
ignite.destroyCache(cacheName, function(err) {
- console.log(">>> End of sql fields query example.");
- });
+ console.log(">>> End of sql fields query example.");
+ });
});
//Run query.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86e5d093/examples/src/main/js/compute-run-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/compute-run-example.js b/examples/src/main/js/compute-run-example.js
index 18d5452..a14dcda 100644
--- a/examples/src/main/js/compute-run-example.js
+++ b/examples/src/main/js/compute-run-example.js
@@ -21,10 +21,9 @@ var Ignition = apacheIgnite.Ignition;
/**
* This example demonstrates very basic operations on cache in functions for Compute.run.
* <p>
- * Remote nodes should always be started with special configuration file which
- * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
+ * Start Ignite node with {@code examples/config/js/example-js-cache.xml} configuration before running example.
* <p>
- * Alternatively you can run ExampleJsNodeStartup in another JVM which will
+ * Alternatively you can run ExampleJsNodeStartup which will
* start node with {@code examples/config/js/example-js-cache.xml} configuration.
*/
function main() {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86e5d093/examples/src/main/js/map-reduce-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/map-reduce-example.js b/examples/src/main/js/map-reduce-example.js
index 8adf095..98b863b 100644
--- a/examples/src/main/js/map-reduce-example.js
+++ b/examples/src/main/js/map-reduce-example.js
@@ -24,13 +24,12 @@ var Ignition = apacheIgnite.Ignition;
* Phrase passed as task argument is split into jobs each taking one word. Then jobs are distributed among
* cluster nodes. Each node computes word length and returns result to master node where total phrase length
* is calculated on reduce stage.
- * <p>
- * Remote nodes should always be started with special configuration file which
- * enables P2P class loading: {@code examples/config/js/example-js-cache.xml}.
- * <p>
- * Alternatively you can run ExampleJsNodeStartup in another JVM which will start node
- * with {@code examples/config/js/example-js-cache.xml} configuration.
- */
+ * <p>
+ * Start Ignite node with {@code examples/config/js/example-js-cache.xml} configuration before running example.
+ * <p>
+ * Alternatively you can run ExampleJsNodeStartup which will
+ * start node with {@code examples/config/js/example-js-cache.xml} configuration.
+ */
function main() {
/** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
Ignition.start(['127.0.0.1:9095'], null, onConnect);
@@ -55,6 +54,7 @@ function main() {
return word.length;
};
+ //Add job to node with arguments.
emit(job, words[i], nodes[i % nodes.length]);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86e5d093/examples/src/main/js/run-function-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/run-function-example.js b/examples/src/main/js/run-function-example.js
deleted file mode 100644
index bec1e9f..0000000
--- a/examples/src/main/js/run-function-example.js
+++ /dev/null
@@ -1,67 +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.
- */
-
-var apacheIgnite = require("apache-ignite");
-var Ignition = apacheIgnite.Ignition;
-
-/**
- * Demonstrates using of Compute job execution on the cluster.
- * <p>
- * This example takes a sentence composed of multiple words and counts number of non-space
- * characters in the sentence by having each compute job count characters in each individual
- * word.
-* <p>
- * <p>
- * Remote nodes should always be started with special configuration file which
- * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
- * <p>
- * Alternatively you can run ExampleJsNodeStartup in another JVM which will
- * start node with {@code examples/config/js/example-js-cache.xml} configuration.
- */
-function main() {
- /** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
- Ignition.start(['127.0.0.1:9095'], null, onConnect);
-
- function onConnect(err, ignite) {
- if (err !== null)
- throw "Start remote node with config examples/config/js/example-js-cache.xml.";
-
- console.log(">>> Compute callable example started");
-
- var job = function (args) {
- var words = args.split(" ");
-
- var sum = 0;
-
- for (var i = 0; i < words.length; ++i) {
- sum += words[i].length;
- }
-
- return sum;
- }
-
- var onRun = function(err, sum) {
- console.log(">>> Total number of characters in the phrase is '" + sum + "'.");
- console.log(">>> End of compute callable example.");
- }
-
- // Execute job on ignite server node.
- ignite.compute().run(job, "Hello Ignite Enabled World!", onRun);
- }
-}
-
-main();
\ No newline at end of file
[35/50] [abbrv] incubator-ignite git commit: # ignite-1055: fix
GridCommandLineTransformerSelfTest
Posted by iv...@apache.org.
# ignite-1055: fix GridCommandLineTransformerSelfTest
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/a747ca4f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a747ca4f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a747ca4f
Branch: refs/heads/ignite-961
Commit: a747ca4f6215ca55a9daf95c073a4d7e7aa756a7
Parents: 6386794
Author: ashutak <as...@gridgain.com>
Authored: Fri Jul 10 16:24:47 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Fri Jul 10 16:24:47 2015 +0300
----------------------------------------------------------------------
.../cmdline/GridCommandLineTransformerSelfTest.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a747ca4f/modules/core/src/test/java/org/apache/ignite/startup/cmdline/GridCommandLineTransformerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/startup/cmdline/GridCommandLineTransformerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/startup/cmdline/GridCommandLineTransformerSelfTest.java
index ec85532..dafc649 100644
--- a/modules/core/src/test/java/org/apache/ignite/startup/cmdline/GridCommandLineTransformerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/startup/cmdline/GridCommandLineTransformerSelfTest.java
@@ -32,7 +32,7 @@ public class GridCommandLineTransformerSelfTest extends GridCommonAbstractTest {
public void testTransformIfNoArguments() throws Exception {
assertEquals(
"\"INTERACTIVE=0\" \"QUIET=-DIGNITE_QUIET=true\" \"NO_PAUSE=0\" " +
- "\"JVM_XOPTS=\" \"CONFIG=\"",
+ "\"NO_JMX=0\" \"JVM_XOPTS=\" \"CONFIG=\"",
CommandLineTransformer.transform());
}
@@ -101,7 +101,7 @@ public class GridCommandLineTransformerSelfTest extends GridCommonAbstractTest {
*/
public void testTransformIfOnlyPathToConfigSpecified() throws Exception {
assertEquals(
- "\"INTERACTIVE=0\" \"QUIET=-DIGNITE_QUIET=true\" \"NO_PAUSE=0\" " +
+ "\"INTERACTIVE=0\" \"QUIET=-DIGNITE_QUIET=true\" \"NO_PAUSE=0\" \"NO_JMX=0\" " +
"\"JVM_XOPTS=\" \"CONFIG=c:\\qw.xml\"",
CommandLineTransformer.transform("c:\\qw.xml"));
}
@@ -111,10 +111,10 @@ public class GridCommandLineTransformerSelfTest extends GridCommonAbstractTest {
*/
public void testTransformIfAllSupportedArguments() throws Exception {
assertEquals(
- "\"INTERACTIVE=1\" \"QUIET=-DIGNITE_QUIET=false\" \"NO_PAUSE=1\" " +
- "\"JVM_XOPTS=-Xmx1g -Xms1m\" " +
- "\"CONFIG=\"c:\\path to\\русский каталог\"\"",
- CommandLineTransformer.transform("-i", "-np", "-v", "-J-Xmx1g", "-J-Xms1m",
+ "\"INTERACTIVE=1\" \"QUIET=-DIGNITE_QUIET=false\" \"NO_PAUSE=1\" \"NO_JMX=1\" " +
+ "\"JVM_XOPTS=-Xmx1g -Xms1m\" " +
+ "\"CONFIG=\"c:\\path to\\русский каталог\"\"",
+ CommandLineTransformer.transform("-i", "-np", "-v", "-J-Xmx1g", "-J-Xms1m", "-nojmx",
"\"c:\\path to\\русский каталог\""));
}
}
[14/50] [abbrv] incubator-ignite git commit: Merge branches
'ignite-1076' and 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1076
Posted by iv...@apache.org.
Merge branches 'ignite-1076' and 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1076
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/297d2506
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/297d2506
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/297d2506
Branch: refs/heads/ignite-961
Commit: 297d250639156e22eecc6b7f41a98b6c54538a84
Parents: 2cfe455 c134dcf
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Wed Jul 8 20:36:44 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Wed Jul 8 20:36:44 2015 -0700
----------------------------------------------------------------------
RELEASE_NOTES.txt | 12 +
bin/ignite.bat | 8 +-
bin/ignite.sh | 6 +-
bin/include/parseargs.bat | 1 +
bin/include/parseargs.sh | 3 +
dev-tools/slurp.sh | 2 +-
modules/core/pom.xml | 4 +-
.../src/main/java/org/apache/ignite/Ignite.java | 2 +-
.../java/org/apache/ignite/IgniteCache.java | 5 +
.../apache/ignite/IgniteSystemProperties.java | 3 +
.../cache/eviction/fifo/FifoEvictionPolicy.java | 5 -
.../cache/eviction/lru/LruEvictionPolicy.java | 5 -
.../eviction/sorted/SortedEvictionPolicy.java | 19 +-
.../configuration/CacheConfiguration.java | 4 +
.../configuration/TransactionConfiguration.java | 23 ++
.../apache/ignite/internal/IgniteKernal.java | 33 +-
.../internal/interop/InteropIgnition.java | 48 ++-
.../internal/interop/InteropProcessor.java | 7 +
.../managers/communication/GridIoManager.java | 124 ++++--
.../managers/communication/GridIoMessage.java | 15 +-
.../managers/communication/GridIoPolicy.java | 32 +-
.../eventstorage/GridEventStorageManager.java | 2 +-
.../processors/cache/CacheObjectImpl.java | 1 -
.../processors/cache/CacheOperationContext.java | 44 ++-
.../internal/processors/cache/CacheType.java | 8 +-
.../processors/cache/GridCacheAdapter.java | 91 +++--
.../processors/cache/GridCacheAtomicFuture.java | 12 +-
.../processors/cache/GridCacheAttributes.java | 3 +
.../processors/cache/GridCacheContext.java | 12 +-
.../processors/cache/GridCacheIoManager.java | 20 +-
.../processors/cache/GridCacheMvccManager.java | 8 +-
.../processors/cache/GridCacheProcessor.java | 118 ++----
.../processors/cache/GridCacheProxyImpl.java | 10 +-
.../cache/GridCacheSharedContext.java | 15 +-
.../processors/cache/GridCacheSwapManager.java | 257 ++++++++-----
.../processors/cache/GridCacheUtils.java | 42 +++
.../processors/cache/IgniteCacheProxy.java | 36 +-
.../GridDistributedTxFinishRequest.java | 11 +-
.../GridDistributedTxPrepareRequest.java | 9 +-
.../GridDistributedTxRemoteAdapter.java | 3 +-
.../distributed/dht/GridDhtTxFinishRequest.java | 3 +-
.../cache/distributed/dht/GridDhtTxLocal.java | 3 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 3 +-
.../cache/distributed/dht/GridDhtTxRemote.java | 5 +-
.../dht/GridPartitionedGetFuture.java | 13 +-
.../dht/atomic/GridDhtAtomicCache.java | 18 +-
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 15 +-
.../dht/atomic/GridNearAtomicUpdateFuture.java | 177 ++++++++-
.../distributed/near/GridNearGetFuture.java | 4 +-
.../near/GridNearTxFinishRequest.java | 3 +-
.../cache/distributed/near/GridNearTxLocal.java | 3 +-
.../distributed/near/GridNearTxRemote.java | 5 +-
.../cache/jta/CacheJtaManagerAdapter.java | 17 +-
.../cache/jta/CacheNoopJtaManager.java | 2 +-
.../cache/query/GridCacheQueryAdapter.java | 35 +-
.../continuous/CacheContinuousQueryHandler.java | 4 +-
.../cache/transactions/IgniteInternalTx.java | 3 +-
.../cache/transactions/IgniteTxAdapter.java | 11 +-
.../transactions/IgniteTxLocalAdapter.java | 3 +-
.../datastructures/DataStructuresProcessor.java | 39 +-
.../datastructures/GridCacheAtomicLongImpl.java | 25 +-
.../GridCacheAtomicSequenceImpl.java | 11 +-
.../GridCacheAtomicStampedImpl.java | 21 +-
.../GridCacheCountDownLatchImpl.java | 31 +-
.../internal/processors/igfs/IgfsContext.java | 5 +-
.../plugin/IgnitePluginProcessor.java | 3 +-
.../processors/query/GridQueryProcessor.java | 5 +
.../ignite/internal/util/IgniteUtils.java | 6 +-
.../visor/cache/VisorCacheConfiguration.java | 11 -
.../plugin/extensions/communication/IoPool.java | 42 +++
.../communication/tcp/TcpCommunicationSpi.java | 2 +-
.../ignite/spi/discovery/tcp/ClientImpl.java | 5 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 51 ++-
.../tcp/internal/TcpDiscoveryNode.java | 2 +-
.../tcp/internal/TcpDiscoveryNodesRing.java | 8 +-
.../tcp/internal/TcpDiscoveryStatistics.java | 10 +-
.../TcpDiscoveryMulticastIpFinder.java | 2 +-
.../startup/cmdline/CommandLineStartup.java | 3 +-
.../startup/cmdline/CommandLineTransformer.java | 9 +
...cheStoreSessionListenerAbstractSelfTest.java | 1 -
.../communication/GridIoManagerSelfTest.java | 2 +-
.../cache/CacheFutureExceptionSelfTest.java | 158 ++++++++
.../IgniteCacheConfigurationTemplateTest.java | 26 +-
.../cache/IgniteDynamicCacheStartSelfTest.java | 16 +-
.../IgniteDynamicClientCacheStartSelfTest.java | 5 +-
.../cache/IgniteInternalCacheTypesTest.java | 3 +-
.../IgniteClientDataStructuresAbstractTest.java | 109 ++++--
.../IgniteCountDownLatchAbstractSelfTest.java | 12 +-
.../IgniteCachePutRetryAbstractSelfTest.java | 147 ++++++++
.../dht/IgniteCachePutRetryAtomicSelfTest.java | 34 ++
...gniteCachePutRetryTransactionalSelfTest.java | 74 ++++
...eAtomicInvalidPartitionHandlingSelfTest.java | 5 +-
.../GridCachePartitionedFailoverSelfTest.java | 5 +
.../GridCachePartitionedNodeRestartTest.java | 5 -
...ePartitionedOptimisticTxNodeRestartTest.java | 2 +-
.../GridCacheReplicatedFailoverSelfTest.java | 5 -
.../GridCacheReplicatedNodeRestartSelfTest.java | 5 -
...acheAtomicReplicatedNodeRestartSelfTest.java | 14 +-
...heConcurrentEvictionConsistencySelfTest.java | 15 +-
.../GridCacheEvictionFilterSelfTest.java | 2 -
.../loadtests/hashmap/GridCacheTestContext.java | 4 +-
.../tcp/TcpDiscoveryMultiThreadedTest.java | 38 ++
.../TcpDiscoveryNodeConsistentIdSelfTest.java | 80 ++++
.../inmemory/GridTestSwapSpaceSpi.java | 3 +-
.../IgniteCacheFailoverTestSuite.java | 3 +
.../ignite/testsuites/IgniteCacheTestSuite.java | 1 +
.../IgniteSpiDiscoverySelfTestSuite.java | 5 +
.../HibernateTransactionalDataRegion.java | 12 +-
.../hibernate/HibernateL2CacheSelfTest.java | 7 +-
.../HibernateL2CacheTransactionalSelfTest.java | 5 -
.../query/h2/opt/GridH2KeyValueRowOffheap.java | 8 +-
.../processors/query/h2/opt/GridH2Table.java | 2 +-
.../CacheAbstractQueryMetricsSelfTest.java | 157 +++++++-
.../cache/CacheLocalQueryMetricsSelfTest.java | 33 ++
...titionedQueryMetricsDistributedSelfTest.java | 33 ++
...chePartitionedQueryMetricsLocalSelfTest.java | 33 ++
.../CachePartitionedQueryMetricsSelfTest.java | 32 --
...plicatedQueryMetricsDistributedSelfTest.java | 33 ++
...acheReplicatedQueryMetricsLocalSelfTest.java | 33 ++
.../CacheReplicatedQueryMetricsSelfTest.java | 32 --
.../cache/IgniteCacheOffheapEvictQueryTest.java | 2 +-
.../IgniteCacheQueryMultiThreadedSelfTest.java | 4 +-
...QueryOffheapEvictsMultiThreadedSelfTest.java | 5 -
.../IgniteCacheQueryNodeRestartSelfTest2.java | 5 +
.../IgniteCacheQuerySelfTestSuite.java | 7 +-
.../apache/ignite/cache/jta/CacheTmLookup.java | 3 +-
.../processors/cache/jta/CacheJtaManager.java | 72 +++-
.../cache/jta/GridCacheXAResource.java | 16 +-
.../processors/cache/GridCacheJtaSelfTest.java | 52 ++-
.../GridTmLookupLifecycleAwareSelfTest.java | 29 +-
modules/kafka/licenses/apache-2.0.txt | 202 ++++++++++
modules/kafka/pom.xml | 105 ++++++
.../ignite/stream/kafka/KafkaStreamer.java | 220 +++++++++++
.../kafka/IgniteKafkaStreamerSelfTestSuite.java | 37 ++
.../stream/kafka/KafkaEmbeddedBroker.java | 378 +++++++++++++++++++
.../kafka/KafkaIgniteStreamerSelfTest.java | 227 +++++++++++
.../ignite/stream/kafka/SimplePartitioner.java | 53 +++
modules/mesos/pom.xml | 1 -
modules/rest-http/pom.xml | 14 +-
.../util/spring/IgniteSpringHelperImpl.java | 72 +++-
.../IgniteExcludeInConfigurationTest.java | 78 ++++
.../org/apache/ignite/spring/sprint-exclude.xml | 57 +++
.../testsuites/IgniteSpringTestSuite.java | 2 +
modules/urideploy/pom.xml | 22 +-
.../ignite/visor/commands/VisorConsole.scala | 3 +-
.../commands/cache/VisorCacheCommand.scala | 2 -
.../visor/commands/open/VisorOpenCommand.scala | 319 ++++++++++++++++
.../scala/org/apache/ignite/visor/visor.scala | 230 +----------
.../ignite/visor/VisorRuntimeBaseSpec.scala | 2 +
.../commands/kill/VisorKillCommandSpec.scala | 1 +
.../commands/start/VisorStartCommandSpec.scala | 1 +
.../commands/tasks/VisorTasksCommandSpec.scala | 1 +
.../commands/vvm/VisorVvmCommandSpec.scala | 1 +
modules/web/pom.xml | 6 +-
.../config/benchmark-put-indexed-val.properties | 64 ++++
modules/yardstick/config/ignite-base-config.xml | 23 ++
.../cache/IgnitePutIndexedValue1Benchmark.java | 42 +++
.../cache/IgnitePutIndexedValue2Benchmark.java | 42 +++
.../cache/IgnitePutIndexedValue8Benchmark.java | 42 +++
.../ignite/yardstick/cache/model/Person1.java | 55 +++
.../ignite/yardstick/cache/model/Person2.java | 67 ++++
.../ignite/yardstick/cache/model/Person8.java | 109 ++++++
parent/pom.xml | 1 +
pom.xml | 1 +
scripts/git-patch-prop.sh | 2 +-
165 files changed, 4512 insertions(+), 1045 deletions(-)
----------------------------------------------------------------------
[25/50] [abbrv] incubator-ignite git commit: #ignite-964: remove
unused method.
Posted by iv...@apache.org.
#ignite-964: remove unused method.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/acb56269
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/acb56269
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/acb56269
Branch: refs/heads/ignite-961
Commit: acb56269c98a04ab11d684e775988a68cd03f776
Parents: ba4c59a
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jul 9 18:46:28 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jul 9 18:46:28 2015 +0300
----------------------------------------------------------------------
.../scripting/IgniteScriptProcessor.java | 27 --------------------
1 file changed, 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/acb56269/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java
index 34d35d8..1f6dfbc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java
@@ -144,31 +144,4 @@ public class IgniteScriptProcessor extends GridProcessorAdapter {
", err= " + e.getMessage() + "].");
}
}
-
- /**
- * @param src Script src.
- * @param arg Argument.
- * @return Result of the function.
- * @throws IgniteCheckedException If script failed.
- */
- public Object invokeJSFunction(String src, Object arg, Object arg2) throws IgniteCheckedException {
- try {
- Invocable invocable = (Invocable) jsEngine;
- if (arg != null && arg2 != null)
- return invocable.invokeFunction("__internalJSCall", src, arg.toString(), arg2.toString());
- if (arg != null && arg2 == null)
- return invocable.invokeFunction("__internalJSCall", src, arg.toString(), arg2);
-
- return invocable.invokeFunction("__internalJSCall", src, arg, arg2);
-
- }
- catch (ScriptException e) {
- throw new IgniteCheckedException("Function evaluation failed [funcName=" + src +
- ", err= " + e.getMessage() + "].");
- }
- catch (NoSuchMethodException e) {
- throw new IgniteCheckedException("Cannot find function [func=__internalCall" +
- ", err= " + e.getMessage() + "].");
- }
- }
}
[45/50] [abbrv] incubator-ignite git commit: #ignite-964: fix review
comments.
Posted by iv...@apache.org.
#ignite-964: fix review comments.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f69f25f9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f69f25f9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f69f25f9
Branch: refs/heads/ignite-961
Commit: f69f25f99e7246577b2d59c8c6591fb7960d6856
Parents: 86e5d09
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 10 19:06:28 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 10 19:06:28 2015 +0300
----------------------------------------------------------------------
examples/config/js/example-js-cache.xml | 43 ------------
examples/config/js/rest-jetty.xml | 71 --------------------
examples/src/main/js/cache-api-example.js | 8 +--
examples/src/main/js/cache-put-get-example.js | 6 +-
examples/src/main/js/cache-query-example.js | 6 +-
.../main/js/cache-sql-fields-query-example.js | 6 +-
examples/src/main/js/compute-run-example.js | 6 +-
examples/src/main/js/map-reduce-example.js | 16 ++---
8 files changed, 24 insertions(+), 138 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f69f25f9/examples/config/js/example-js-cache.xml
----------------------------------------------------------------------
diff --git a/examples/config/js/example-js-cache.xml b/examples/config/js/example-js-cache.xml
deleted file mode 100644
index e8ffc8a..0000000
--- a/examples/config/js/example-js-cache.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<!--
- Ignite configuration with all defaults and enabled p2p deployment and enabled events.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="gridName" value="ServerNode" />
-
- <!-- Set to true to enable distributed class loading for examples, default is false. -->
- <property name="peerClassLoadingEnabled" value="true"/>
-
- <property name="connectorConfiguration">
- <bean class="org.apache.ignite.configuration.ConnectorConfiguration">
- <property name="jettyPath" value="examples/config/js/rest-jetty.xml"/>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f69f25f9/examples/config/js/rest-jetty.xml
----------------------------------------------------------------------
diff --git a/examples/config/js/rest-jetty.xml b/examples/config/js/rest-jetty.xml
deleted file mode 100644
index abc146b..0000000
--- a/examples/config/js/rest-jetty.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
-<Configure id="Server" class="org.eclipse.jetty.server.Server">
- <Arg name="threadPool">
- <!-- Default queued blocking thread pool -->
- <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
- <Set name="minThreads">20</Set>
- <Set name="maxThreads">200</Set>
- </New>
- </Arg>
- <New id="httpCfg" class="org.eclipse.jetty.server.HttpConfiguration">
- <Set name="secureScheme">https</Set>
- <Set name="securePort">8443</Set>
- <Set name="sendServerVersion">true</Set>
- <Set name="sendDateHeader">true</Set>
- </New>
- <Call name="addConnector">
- <Arg>
- <New class="org.eclipse.jetty.server.ServerConnector">
- <Arg name="server"><Ref refid="Server"/></Arg>
- <Arg name="factories">
- <Array type="org.eclipse.jetty.server.ConnectionFactory">
- <Item>
- <New class="org.eclipse.jetty.server.HttpConnectionFactory">
- <Ref refid="httpCfg"/>
- </New>
- </Item>
- </Array>
- </Arg>
- <Set name="host">
- <SystemProperty name="IGNITE_JETTY_HOST" default="localhost"/>
- </Set>
- <Set name="port">
- <SystemProperty name="IGNITE_JETTY_PORT" default="9095"/>
- </Set>
- <Set name="idleTimeout">30000</Set>
- <Set name="reuseAddress">true</Set>
- </New>
- </Arg>
- </Call>
- <Set name="handler">
- <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
- <Set name="handlers">
- <Array type="org.eclipse.jetty.server.Handler">
- <Item>
- <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
- </Item>
- </Array>
- </Set>
- </New>
- </Set>
- <Set name="stopAtShutdown">false</Set>
-</Configure>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f69f25f9/examples/src/main/js/cache-api-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-api-example.js b/examples/src/main/js/cache-api-example.js
index 07d14f3..dad0f34 100644
--- a/examples/src/main/js/cache-api-example.js
+++ b/examples/src/main/js/cache-api-example.js
@@ -21,21 +21,21 @@ var Ignition = apacheIgnite.Ignition;
/**
* This example demonstrates some of the cache rich API capabilities.
* <p>
- * Start Ignite node with {@code examples/config/js/example-js-cache.xml} configuration before running example.
+ * Start Ignite node with {@code examples/config/example-ignite.xml} configuration before running example.
* <p>
* Alternatively you can run ExampleJsNodeStartup which will
- * start node with {@code examples/config/js/example-js-cache.xml} configuration.
+ * start node with {@code examples/config/example-ignite.xml} configuration.
*/
function main() {
/** Cache name. */
var cacheName = "ApiExampleCache";
/** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
- Ignition.start(['127.0.0.1:9095'], null, onConnect);
+ Ignition.start(['127.0.0.1:8000..9000'], null, onConnect);
function onConnect(err, ignite) {
if (err !== null)
- throw "Start remote node with config examples/config/js/example-js-cache.xml.";
+ throw "Start remote node with config examples/config/js/example-js-cache.xml." + err;
console.log(">>> Cache API example started.");
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f69f25f9/examples/src/main/js/cache-put-get-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-put-get-example.js b/examples/src/main/js/cache-put-get-example.js
index 8155cb7..ce6b47a 100644
--- a/examples/src/main/js/cache-put-get-example.js
+++ b/examples/src/main/js/cache-put-get-example.js
@@ -22,17 +22,17 @@ var CacheEntry = apacheIgnite.CacheEntry;
/**
* This example demonstrates very basic operations on cache, such as 'put' and 'get'.
* <p>
- * Start Ignite node with {@code examples/config/js/example-js-cache.xml} configuration before running example.
+ * Start Ignite node with {@code examples/config/example-ignite.xml} configuration before running example.
* <p>
* Alternatively you can run ExampleJsNodeStartup which will
- * start node with {@code examples/config/js/example-js-cache.xml} configuration.
+ * start node with {@code examples/config/example-ignite.xml} configuration.
*/
function main() {
/** Cache name. */
var cacheName = "PutGetExampleCache";
/** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
- Ignition.start(['127.0.0.1:9095'], null, onConnect);
+ Ignition.start(['127.0.0.1:8000..9000'], null, onConnect);
function onConnect(err, ignite) {
if (err !== null)
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f69f25f9/examples/src/main/js/cache-query-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-query-example.js b/examples/src/main/js/cache-query-example.js
index 3566ac8..ba5e270 100644
--- a/examples/src/main/js/cache-query-example.js
+++ b/examples/src/main/js/cache-query-example.js
@@ -26,17 +26,17 @@ var CacheEntry = apacheIgnite.CacheEntry;
/**
* Cache queries example. This example demonstrates SQL queries over cache.
* <p>
- * Start Ignite node with {@code examples/config/js/example-js-cache.xml} configuration before running example.
+ * Start Ignite node with {@code examples/config/example-ignite.xml} configuration before running example.
* <p>
* Alternatively you can run ExampleJsNodeStartup which will
- * start node with {@code examples/config/js/example-js-cache.xml} configuration.
+ * start node with {@code examples/config/example-ignite.xml} configuration.
*/
main() {
/** Cache name. */
var cacheName = "CacheQueryExample";
/** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
- Ignition.start(['127.0.0.1:9095'], null, onConnect);
+ Ignition.start(['127.0.0.1:8000..9000'], null, onConnect);
function onConnect(err, ignite) {
if (err !== null)
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f69f25f9/examples/src/main/js/cache-sql-fields-query-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-sql-fields-query-example.js b/examples/src/main/js/cache-sql-fields-query-example.js
index c16fbe6..e8deb43 100644
--- a/examples/src/main/js/cache-sql-fields-query-example.js
+++ b/examples/src/main/js/cache-sql-fields-query-example.js
@@ -25,17 +25,17 @@ var CacheEntry = apacheIgnite.CacheEntry;
/**
* Cache queries example. This example demonstrates SQL queries over cache.
* <p>
- * Start Ignite node with {@code examples/config/js/example-js-cache.xml} configuration before running example.
+ * Start Ignite node with {@code examples/config/example-ignite.xml} configuration before running example.
* <p>
* Alternatively you can run ExampleJsNodeStartup which will
- * start node with {@code examples/config/js/example-js-cache.xml} configuration.
+ * start node with {@code examples/config/example-ignite.xml} configuration.
*/
main() {
/** Cache name. */
var cacheName = "CacheSqlFieldsQueryExample";
/** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
- Ignition.start(['127.0.0.1:9095'], null, onConnect);
+ Ignition.start(['127.0.0.1:8000..9000'], null, onConnect);
function onConnect(err, ignite) {
if (err !== null)
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f69f25f9/examples/src/main/js/compute-run-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/compute-run-example.js b/examples/src/main/js/compute-run-example.js
index a14dcda..61b9bbd 100644
--- a/examples/src/main/js/compute-run-example.js
+++ b/examples/src/main/js/compute-run-example.js
@@ -21,17 +21,17 @@ var Ignition = apacheIgnite.Ignition;
/**
* This example demonstrates very basic operations on cache in functions for Compute.run.
* <p>
- * Start Ignite node with {@code examples/config/js/example-js-cache.xml} configuration before running example.
+ * Start Ignite node with {@code examples/config/example-ignite.xml} configuration before running example.
* <p>
* Alternatively you can run ExampleJsNodeStartup which will
- * start node with {@code examples/config/js/example-js-cache.xml} configuration.
+ * start node with {@code examples/config/example-ignite.xml} configuration.
*/
function main() {
/** Cache name. */
var cacheName = "RunCacheScriptCache";
/** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
- Ignition.start(['127.0.0.1:9095'], null, onConnect);
+ Ignition.start(['127.0.0.1:8000..9000'], null, onConnect);
function onConnect(err, ignite) {
if (err !== null)
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f69f25f9/examples/src/main/js/map-reduce-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/map-reduce-example.js b/examples/src/main/js/map-reduce-example.js
index 98b863b..a3e8305 100644
--- a/examples/src/main/js/map-reduce-example.js
+++ b/examples/src/main/js/map-reduce-example.js
@@ -19,20 +19,20 @@ var apacheIgnite = require("apache-ignite");
var Ignition = apacheIgnite.Ignition;
/**
- * Demonstrates a simple use of Compute.mapReduce.
- * <p>
- * Phrase passed as task argument is split into jobs each taking one word. Then jobs are distributed among
- * cluster nodes. Each node computes word length and returns result to master node where total phrase length
- * is calculated on reduce stage.
+ * Demonstrates a simple use of Compute.mapReduce.
* <p>
- * Start Ignite node with {@code examples/config/js/example-js-cache.xml} configuration before running example.
+ * Phrase passed as task argument is split into jobs each taking one word. Then jobs are distributed among
+ * cluster nodes. Each node computes word length and returns result to master node where total phrase length
+ * is calculated on reduce stage.
+ * <p>
+ * Start Ignite node with {@code examples/config/example-ignite.xml} configuration before running example.
* <p>
* Alternatively you can run ExampleJsNodeStartup which will
- * start node with {@code examples/config/js/example-js-cache.xml} configuration.
+ * start node with {@code examples/config/example-ignite.xml} configuration.
*/
function main() {
/** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
- Ignition.start(['127.0.0.1:9095'], null, onConnect);
+ Ignition.start(['127.0.0.1:8000..9000'], null, onConnect);
function onConnect(err, ignite) {
if (err !== null)
[18/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'remotes/origin/master' into ignite-964-1
Posted by iv...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-964-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/7763a37b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7763a37b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7763a37b
Branch: refs/heads/ignite-961
Commit: 7763a37b1d02bc4136dad8e0be1e481a7edfd573
Parents: bdf6567 c134dcf
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jul 9 15:57:54 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jul 9 15:57:54 2015 +0300
----------------------------------------------------------------------
RELEASE_NOTES.txt | 12 ++
.../src/main/java/org/apache/ignite/Ignite.java | 2 +-
.../apache/ignite/internal/IgniteKernal.java | 32 +++---
.../processors/cache/GridCacheProcessor.java | 97 +++++------------
.../continuous/CacheContinuousQueryHandler.java | 4 +-
.../datastructures/DataStructuresProcessor.java | 39 +++++--
.../GridCacheCountDownLatchImpl.java | 15 ++-
...cheStoreSessionListenerAbstractSelfTest.java | 1 -
.../IgniteCacheConfigurationTemplateTest.java | 26 +----
.../cache/IgniteDynamicCacheStartSelfTest.java | 16 +--
.../IgniteDynamicClientCacheStartSelfTest.java | 5 +-
.../IgniteClientDataStructuresAbstractTest.java | 109 ++++++++++++++-----
.../IgniteCountDownLatchAbstractSelfTest.java | 12 +-
13 files changed, 200 insertions(+), 170 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7763a37b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
[13/50] [abbrv] incubator-ignite git commit: Merge branches
'ignite-1026' and 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1026
Posted by iv...@apache.org.
Merge branches 'ignite-1026' and 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1026
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c134dcfa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c134dcfa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c134dcfa
Branch: refs/heads/ignite-961
Commit: c134dcfa5e7bb5dbc7a533f3d047e6e40cf2ce4e
Parents: 3089ace 0a569b8
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Wed Jul 8 12:20:13 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Wed Jul 8 12:20:13 2015 -0700
----------------------------------------------------------------------
RELEASE_NOTES.txt | 12 ++
dev-tools/slurp.sh | 2 +-
modules/core/pom.xml | 4 +-
.../cache/eviction/fifo/FifoEvictionPolicy.java | 5 -
.../cache/eviction/lru/LruEvictionPolicy.java | 5 -
.../eviction/sorted/SortedEvictionPolicy.java | 19 +-
.../configuration/CacheConfiguration.java | 4 +
.../configuration/TransactionConfiguration.java | 23 +++
.../apache/ignite/internal/IgniteKernal.java | 10 +-
.../internal/interop/InteropIgnition.java | 48 +++--
.../internal/interop/InteropProcessor.java | 7 +
.../processors/cache/CacheObjectImpl.java | 1 -
.../processors/cache/GridCacheAttributes.java | 3 +
.../processors/cache/GridCacheContext.java | 8 +-
.../processors/cache/GridCacheIoManager.java | 8 +-
.../processors/cache/GridCacheProcessor.java | 21 +-
.../cache/GridCacheSharedContext.java | 15 +-
.../dht/GridPartitionedGetFuture.java | 13 +-
.../distributed/near/GridNearGetFuture.java | 4 +-
.../cache/jta/CacheJtaManagerAdapter.java | 17 +-
.../cache/jta/CacheNoopJtaManager.java | 2 +-
.../cache/query/GridCacheQueryAdapter.java | 35 +++-
.../processors/query/GridQueryProcessor.java | 5 +
.../ignite/internal/util/IgniteUtils.java | 6 +-
.../visor/cache/VisorCacheConfiguration.java | 11 -
.../ignite/spi/discovery/tcp/ServerImpl.java | 46 +++++
.../tcp/internal/TcpDiscoveryNode.java | 2 +-
.../tcp/internal/TcpDiscoveryNodesRing.java | 8 +-
.../tcp/internal/TcpDiscoveryStatistics.java | 10 +-
.../cache/CacheFutureExceptionSelfTest.java | 158 +++++++++++++++
.../GridCachePartitionedNodeRestartTest.java | 5 -
...ePartitionedOptimisticTxNodeRestartTest.java | 2 +-
.../GridCacheReplicatedFailoverSelfTest.java | 5 -
.../GridCacheReplicatedNodeRestartSelfTest.java | 5 -
...acheAtomicReplicatedNodeRestartSelfTest.java | 14 +-
...heConcurrentEvictionConsistencySelfTest.java | 15 +-
.../loadtests/hashmap/GridCacheTestContext.java | 4 +-
.../tcp/TcpDiscoveryMultiThreadedTest.java | 38 ++++
.../TcpDiscoveryNodeConsistentIdSelfTest.java | 80 ++++++++
.../ignite/testsuites/IgniteCacheTestSuite.java | 1 +
.../IgniteSpiDiscoverySelfTestSuite.java | 5 +
.../HibernateTransactionalDataRegion.java | 12 +-
.../hibernate/HibernateL2CacheSelfTest.java | 7 +-
.../HibernateL2CacheTransactionalSelfTest.java | 5 -
.../CacheAbstractQueryMetricsSelfTest.java | 157 +++++++++++++-
.../cache/CacheLocalQueryMetricsSelfTest.java | 33 +++
...titionedQueryMetricsDistributedSelfTest.java | 33 +++
...chePartitionedQueryMetricsLocalSelfTest.java | 33 +++
.../CachePartitionedQueryMetricsSelfTest.java | 32 ---
...plicatedQueryMetricsDistributedSelfTest.java | 33 +++
...acheReplicatedQueryMetricsLocalSelfTest.java | 33 +++
.../CacheReplicatedQueryMetricsSelfTest.java | 32 ---
.../IgniteCacheQuerySelfTestSuite.java | 7 +-
.../apache/ignite/cache/jta/CacheTmLookup.java | 3 +-
.../processors/cache/jta/CacheJtaManager.java | 72 ++++++-
.../cache/jta/GridCacheXAResource.java | 16 +-
.../processors/cache/GridCacheJtaSelfTest.java | 52 +++--
.../GridTmLookupLifecycleAwareSelfTest.java | 29 ++-
modules/kafka/licenses/apache-2.0.txt | 202 +++++++++++++++++++
modules/kafka/pom.xml | 11 -
modules/mesos/pom.xml | 1 -
modules/rest-http/pom.xml | 14 +-
modules/urideploy/pom.xml | 8 +-
.../commands/cache/VisorCacheCommand.scala | 2 -
modules/web/pom.xml | 6 +-
.../config/benchmark-put-indexed-val.properties | 64 ++++++
modules/yardstick/config/ignite-base-config.xml | 23 +++
.../cache/IgnitePutIndexedValue1Benchmark.java | 42 ++++
.../cache/IgnitePutIndexedValue2Benchmark.java | 42 ++++
.../cache/IgnitePutIndexedValue8Benchmark.java | 42 ++++
.../ignite/yardstick/cache/model/Person1.java | 55 +++++
.../ignite/yardstick/cache/model/Person2.java | 67 ++++++
.../ignite/yardstick/cache/model/Person8.java | 109 ++++++++++
parent/pom.xml | 1 +
scripts/git-patch-prop.sh | 2 +-
75 files changed, 1695 insertions(+), 271 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c134dcfa/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c134dcfa/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
[27/50] [abbrv] incubator-ignite git commit: # ignite-929 close does
not destroy cache
Posted by iv...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsForClusterGroupSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsForClusterGroupSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsForClusterGroupSelfTest.java
index 1ba24e3..5093af5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsForClusterGroupSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsForClusterGroupSelfTest.java
@@ -107,7 +107,7 @@ public class CacheMetricsForClusterGroupSelfTest extends GridCommonAbstractTest
assertMetrics(cache1);
assertMetrics(cache2);
- closeCaches();
+ destroyCaches();
}
/**
@@ -135,7 +135,7 @@ public class CacheMetricsForClusterGroupSelfTest extends GridCommonAbstractTest
assertMetrics(cache1);
assertMetrics(cache2);
- closeCaches();
+ destroyCaches();
}
/**
@@ -157,9 +157,9 @@ public class CacheMetricsForClusterGroupSelfTest extends GridCommonAbstractTest
/**
* Closes caches.
*/
- private void closeCaches() {
- cache1.close();
- cache2.close();
+ private void destroyCaches() {
+ cache1.destroy();
+ cache2.destroy();
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java
index 8c7d33d..f4d7607 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java
@@ -149,7 +149,9 @@ public class CacheOffheapMapEntrySelfTest extends GridCacheAbstractSelfTest {
cacheMode,
"Cache");
- try (IgniteCache jcache = grid(0).getOrCreateCache(cfg)) {
+ IgniteCache jcache = grid(0).getOrCreateCache(cfg);
+
+ try {
GridCacheAdapter<Integer, String> cache = ((IgniteKernal)grid(0)).internalCache(jcache.getName());
Integer key = primaryKey(grid(0).cache(null));
@@ -164,5 +166,8 @@ public class CacheOffheapMapEntrySelfTest extends GridCacheAbstractSelfTest {
assertEquals(entry.getClass(), entryCls);
}
+ finally {
+ jcache.destroy();
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
new file mode 100644
index 0000000..20284a8
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java
@@ -0,0 +1,859 @@
+/*
+ * 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.cluster.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.managers.communication.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.plugin.extensions.communication.*;
+import org.apache.ignite.spi.*;
+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.testframework.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import javax.cache.*;
+import javax.cache.CacheManager;
+import javax.cache.configuration.*;
+import java.util.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.cache.CacheMode.*;
+
+/**
+ * Checks stop and destroy methods behavior.
+ */
+public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest {
+ /** */
+ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** key-value used at test. */
+ protected static String KEY_VAL = "1";
+
+ /** cache name 1. */
+ protected static String CACHE_NAME_DHT = "cache";
+
+ /** cache name 2. */
+ protected static String CACHE_NAME_CLIENT = "cache_client";
+
+ /** near cache name. */
+ protected static String CACHE_NAME_NEAR = "cache_near";
+
+ /** local cache name. */
+ protected static String CACHE_NAME_LOC = "cache_local";
+
+ /** */
+ private static volatile boolean stop;
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ startGridsMultiThreaded(gridCount());
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ stopAllGrids();
+ }
+
+ /**
+ * @return Grids count to start.
+ */
+ protected int gridCount() {
+ return 3;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration iCfg = super.getConfiguration(gridName);
+
+ if (getTestGridName(2).equals(gridName))
+ iCfg.setClientMode(true);
+
+ ((TcpDiscoverySpi)iCfg.getDiscoverySpi()).setIpFinder(ipFinder);
+ ((TcpDiscoverySpi)iCfg.getDiscoverySpi()).setForceServerMode(true);
+
+ iCfg.setCacheConfiguration();
+
+ TcpCommunicationSpi commSpi = new CountingTxRequestsToClientNodeTcpCommunicationSpi();
+
+ commSpi.setLocalPort(GridTestUtils.getNextCommPort(getClass()));
+ commSpi.setTcpNoDelay(true);
+
+ iCfg.setCommunicationSpi(commSpi);
+
+ return iCfg;
+ }
+
+ /**
+ * Helps to count messages.
+ */
+ public static class CountingTxRequestsToClientNodeTcpCommunicationSpi extends TcpCommunicationSpi {
+ /** Counter. */
+ public static AtomicInteger cnt = new AtomicInteger();
+
+ /** Node filter. */
+ public static UUID nodeFilter;
+
+ /** {@inheritDoc} */
+ @Override public void sendMessage(ClusterNode node, Message msg) throws IgniteSpiException {
+ super.sendMessage(node, msg);
+
+ if (nodeFilter != null &&
+ node.id().equals(nodeFilter) &&
+ msg instanceof GridIoMessage &&
+ ((GridIoMessage)msg).message() instanceof GridDhtTxPrepareRequest)
+ cnt.incrementAndGet();
+ }
+ }
+
+ /**
+ * @return dht config
+ */
+ private CacheConfiguration getDhtConfig() {
+ CacheConfiguration cfg = defaultCacheConfiguration();
+
+ cfg.setName(CACHE_NAME_DHT);
+ cfg.setCacheMode(PARTITIONED);
+ cfg.setNearConfiguration(null);
+
+ return cfg;
+ }
+
+ /**
+ * @return client config
+ */
+ private CacheConfiguration getClientConfig() {
+ CacheConfiguration cfg = defaultCacheConfiguration();
+
+ cfg.setName(CACHE_NAME_CLIENT);
+ cfg.setCacheMode(PARTITIONED);
+ cfg.setNearConfiguration(null);
+
+ return cfg;
+ }
+
+ /**
+ * @return near config
+ */
+ private CacheConfiguration getNearConfig() {
+ CacheConfiguration cfg = defaultCacheConfiguration();
+
+ cfg.setName(CACHE_NAME_NEAR);
+ cfg.setCacheMode(PARTITIONED);
+ cfg.setNearConfiguration(new NearCacheConfiguration());
+
+ return cfg;
+ }
+
+ /**
+ * @return local config
+ */
+ private CacheConfiguration getLocalConfig() {
+ CacheConfiguration cfg = defaultCacheConfiguration();
+
+ cfg.setName(CACHE_NAME_LOC);
+ cfg.setCacheMode(LOCAL);
+ cfg.setNearConfiguration(null);
+
+ return cfg;
+ }
+
+ /**
+ * Test Double Destroy.
+ *
+ * @throws Exception If failed.
+ */
+ public void testDhtDoubleDestroy() throws Exception {
+ dhtDestroy();
+
+ dhtDestroy();
+ }
+
+ /**
+ * Test DHT Destroy.
+ *
+ * @throws Exception If failed.
+ */
+ private void dhtDestroy() throws Exception {
+ grid(0).getOrCreateCache(getDhtConfig());
+
+ assertNull(grid(0).cache(CACHE_NAME_DHT).get(KEY_VAL));
+
+ grid(0).cache(CACHE_NAME_DHT).put(KEY_VAL, KEY_VAL);
+
+ assertEquals(KEY_VAL, grid(0).cache(CACHE_NAME_DHT).get(KEY_VAL));
+ assertEquals(KEY_VAL, grid(1).cache(CACHE_NAME_DHT).get(KEY_VAL));
+ assertEquals(KEY_VAL, grid(2).cache(CACHE_NAME_DHT).get(KEY_VAL));
+
+ assertFalse(grid(0).configuration().isClientMode());
+
+ // DHT Destroy. Cache should be removed from each node.
+
+ IgniteCache<Object, Object> cache = grid(0).cache(CACHE_NAME_DHT);
+
+ cache.destroy();
+
+ checkDestroyed(cache);
+ }
+
+ /**
+ * Test Double Destroy.
+ *
+ * @throws Exception If failed.
+ */
+ public void testClientDoubleDestroy() throws Exception {
+ clientDestroy();
+
+ clientDestroy();
+ }
+
+ /**
+ * Test Client Destroy.
+ *
+ * @throws Exception If failed.
+ */
+ private void clientDestroy() throws Exception {
+ grid(0).getOrCreateCache(getClientConfig());
+
+ assertNull(grid(0).cache(CACHE_NAME_CLIENT).get(KEY_VAL));
+
+ grid(0).cache(CACHE_NAME_CLIENT).put(KEY_VAL, KEY_VAL);
+
+ assertEquals(KEY_VAL, grid(0).cache(CACHE_NAME_CLIENT).get(KEY_VAL));
+ assertEquals(KEY_VAL, grid(1).cache(CACHE_NAME_CLIENT).get(KEY_VAL));
+ assertEquals(KEY_VAL, grid(2).cache(CACHE_NAME_CLIENT).get(KEY_VAL));
+
+ // DHT Destroy from client node. Cache should be removed from each node.
+
+ assertTrue(grid(2).configuration().isClientMode());
+
+ IgniteCache<Object, Object> cache = grid(2).cache(CACHE_NAME_CLIENT);
+
+ cache.destroy(); // Client node.
+
+ checkDestroyed(cache);
+ }
+
+ /**
+ * Test Double Destroy.
+ *
+ * @throws Exception If failed.
+ */
+ public void testNearDoubleDestroy() throws Exception {
+ nearDestroy();
+
+ nearDestroy();
+ }
+
+ /**
+ * Test Near Destroy.
+ *
+ * @throws Exception If failed.
+ */
+ private void nearDestroy() throws Exception {
+ grid(0).getOrCreateCache(getNearConfig());
+
+ grid(2).getOrCreateNearCache(CACHE_NAME_NEAR, new NearCacheConfiguration());
+
+ assertNull(grid(0).cache(CACHE_NAME_NEAR).get(KEY_VAL));
+ assertNull(grid(2).cache(CACHE_NAME_NEAR).get(KEY_VAL));
+
+ grid(2).cache(CACHE_NAME_NEAR).put(KEY_VAL, KEY_VAL);
+ grid(0).cache(CACHE_NAME_NEAR).put(KEY_VAL, "near-test");
+
+ assertEquals("near-test", grid(2).cache(CACHE_NAME_NEAR).localPeek(KEY_VAL));
+
+ // Near cache destroy. Cache should be removed from each node.
+
+ IgniteCache<Object, Object> cache = grid(2).cache(CACHE_NAME_NEAR);
+
+ cache.destroy();
+
+ checkDestroyed(cache);
+ }
+
+ /**
+ * Test Double Destroy.
+ *
+ * @throws Exception If failed.
+ */
+ public void testLocalDoubleDestroy() throws Exception {
+ localDestroy();
+
+ localDestroy();
+ }
+
+ /**
+ * Test Local Destroy.
+ *
+ * @throws Exception If failed.
+ */
+ private void localDestroy() throws Exception {
+ grid(0).getOrCreateCache(getLocalConfig());
+
+ assert grid(0).cache(CACHE_NAME_LOC).get(KEY_VAL) == null;
+ assert grid(1).cache(CACHE_NAME_LOC).get(KEY_VAL) == null;
+
+ grid(0).cache(CACHE_NAME_LOC).put(KEY_VAL, KEY_VAL + 0);
+ grid(1).cache(CACHE_NAME_LOC).put(KEY_VAL, KEY_VAL + 1);
+
+ assert grid(0).cache(CACHE_NAME_LOC).get(KEY_VAL).equals(KEY_VAL + 0);
+ assert grid(1).cache(CACHE_NAME_LOC).get(KEY_VAL).equals(KEY_VAL + 1);
+
+ grid(0).cache(CACHE_NAME_LOC).destroy();
+
+ assertNull(grid(0).cache(CACHE_NAME_LOC));
+ }
+
+ /**
+ * Test Dht close.
+ *
+ * @throws Exception If failed.
+ */
+ public void testDhtClose() throws Exception {
+ IgniteCache<Integer, Integer> dhtCache0 = grid(0).getOrCreateCache(getDhtConfig());
+
+ final Integer key = primaryKey(dhtCache0);
+
+ assertNull(dhtCache0.get(key));
+
+ dhtCache0.put(key, key);
+
+ assertEquals(key, dhtCache0.get(key));
+
+ // DHT Close. No-op.
+
+ IgniteCache<Integer, Integer> dhtCache1 = grid(1).cache(CACHE_NAME_DHT);
+ IgniteCache<Integer, Integer> dhtCache2 = grid(2).cache(CACHE_NAME_DHT);
+
+ dhtCache0.close();
+
+ try {
+ dhtCache0.get(key);// Not affected, but can not be taken.
+
+ fail();
+ }
+ catch (IllegalStateException ignored) {
+ // No-op
+ }
+
+ assertEquals(key, dhtCache1.get(key)); // Not affected.
+ assertEquals(key, dhtCache2.get(key));// Not affected.
+
+ // DHT Creation after closed.
+
+ IgniteCache<Integer, Integer> dhtCache0New = grid(0).cache(CACHE_NAME_DHT);
+
+ assertNotSame(dhtCache0, dhtCache0New);
+
+ assertEquals(key, dhtCache0New.get(key)); // Not affected, can be taken since cache reopened.
+
+ dhtCache2.put(key, key + 1);
+
+ assertEquals((Object)(key + 1), dhtCache0New.get(key));
+
+ // Check close at last node.
+
+ stopAllGrids(true);
+
+ startGrid(0);
+
+ dhtCache0 = grid(0).getOrCreateCache(getDhtConfig());
+
+ assertNull(dhtCache0.get(key));
+
+ dhtCache0.put(key, key);
+
+ assertEquals(key, dhtCache0.get(key));
+
+ // Closing last node.
+ dhtCache0.close();
+
+ try {
+ dhtCache0.get(key);// Can not be taken.
+
+ fail();
+ }
+ catch (IllegalStateException ignored) {
+ // No-op
+ }
+
+ // Reopening cache.
+ dhtCache0 = grid(0).cache(CACHE_NAME_DHT);
+
+ assertEquals(key, dhtCache0.get(key)); // Entry not loosed.
+ }
+
+ /**
+ * Test Dht close.
+ *
+ * @throws Exception If failed.
+ */
+ public void testDhtCloseWithTry() throws Exception {
+ String curVal = null;
+
+ for (int i = 0; i < 3; i++) {
+ try (IgniteCache<String, String> cache0 = grid(0).getOrCreateCache(getDhtConfig())) {
+ IgniteCache<String, String> cache1 = grid(1).cache(CACHE_NAME_DHT);
+ IgniteCache<String, String> cache2 = grid(2).cache(CACHE_NAME_DHT);
+
+ if (i == 0) {
+ assert cache0.get(KEY_VAL) == null;
+ assert cache1.get(KEY_VAL) == null;
+ assert cache2.get(KEY_VAL) == null;
+ }
+ else {
+ assert cache0.get(KEY_VAL).equals(curVal);
+ assert cache1.get(KEY_VAL).equals(curVal);
+ assert cache2.get(KEY_VAL).equals(curVal);
+ }
+
+ curVal = KEY_VAL + curVal;
+
+ cache0.put(KEY_VAL, curVal);
+
+ assert cache0.get(KEY_VAL).equals(curVal);
+ assert cache1.get(KEY_VAL).equals(curVal);
+ assert cache2.get(KEY_VAL).equals(curVal);
+ }
+ }
+ }
+
+ /**
+ * Test Client close.
+ *
+ * @throws Exception If failed.
+ */
+ public void testClientClose() throws Exception {
+ IgniteCache<String, String> cache0 = grid(0).getOrCreateCache(getClientConfig());
+
+ assert cache0.get(KEY_VAL) == null;
+
+ cache0.put(KEY_VAL, KEY_VAL);
+
+ assert cache0.get(KEY_VAL).equals(KEY_VAL);
+
+ // DHT Close from client node. Should affect only client node.
+
+ IgniteCache<String, String> cache1 = grid(1).cache(CACHE_NAME_CLIENT);
+ IgniteCache<String, String> cache2 = grid(2).cache(CACHE_NAME_CLIENT);
+
+ assert cache2.get(KEY_VAL).equals(KEY_VAL);
+
+ cache2.close();// Client node.
+
+ assert cache0.get(KEY_VAL).equals(KEY_VAL);// Not affected.
+ assert cache1.get(KEY_VAL).equals(KEY_VAL);// Not affected.
+
+ try {
+ cache2.get(KEY_VAL);// Affected.
+
+ assert false;
+ }
+ catch (IllegalStateException ignored) {
+ // No-op
+ }
+
+ // DHT Creation from client node after closed.
+ IgniteCache<String, String> cache2New = grid(2).cache(CACHE_NAME_CLIENT);
+
+ assertNotSame(cache2, cache2New);
+
+ assert cache2New.get(KEY_VAL).equals(KEY_VAL);
+
+ cache0.put(KEY_VAL, KEY_VAL + "recreated");
+
+ assert cache0.get(KEY_VAL).equals(KEY_VAL + "recreated");
+ assert cache1.get(KEY_VAL).equals(KEY_VAL + "recreated");
+ assert cache2New.get(KEY_VAL).equals(KEY_VAL + "recreated");
+ }
+
+ /**
+ * Test Client close.
+ *
+ * @throws Exception If failed.
+ */
+ public void testClientCloseWithTry() throws Exception {
+ String curVal = null;
+
+ for (int i = 0; i < 3; i++) {
+ try (IgniteCache<String, String> cache2 = grid(2).getOrCreateCache(getClientConfig())) {
+ IgniteCache<String, String> cache0 = grid(0).cache(CACHE_NAME_CLIENT);
+ IgniteCache<String, String> cache1 = grid(1).cache(CACHE_NAME_CLIENT);
+
+ if (i == 0) {
+ assert cache0.get(KEY_VAL) == null;
+ assert cache1.get(KEY_VAL) == null;
+ assert cache2.get(KEY_VAL) == null;
+ }
+ else {
+ assert cache0.get(KEY_VAL).equals(curVal);
+ assert cache1.get(KEY_VAL).equals(curVal);
+ assert cache2.get(KEY_VAL).equals(curVal);
+ }
+
+ curVal = KEY_VAL + curVal;
+
+ cache2.put(KEY_VAL, curVal);
+
+ assert cache0.get(KEY_VAL).equals(curVal);
+ assert cache1.get(KEY_VAL).equals(curVal);
+ assert cache2.get(KEY_VAL).equals(curVal);
+ }
+
+ awaitPartitionMapExchange();
+ }
+ }
+
+ /**
+ * Test Near close.
+ *
+ * @throws Exception If failed.
+ */
+ public void testNearClose() throws Exception {
+ IgniteCache<String, String> cache0 = grid(0).getOrCreateCache(getNearConfig());
+
+ // GridDhtTxPrepareRequest requests to Client node will be counted.
+ CountingTxRequestsToClientNodeTcpCommunicationSpi.nodeFilter = grid(2).context().localNodeId();
+
+ // Near Close from client node.
+
+ IgniteCache<String, String> cache1 = grid(1).cache(CACHE_NAME_NEAR);
+ IgniteCache<String, String> cache2 = grid(2).createNearCache(CACHE_NAME_NEAR, new NearCacheConfiguration());
+
+ assert cache2.get(KEY_VAL) == null;
+
+ // Subscribing to events.
+ cache2.put(KEY_VAL, KEY_VAL);
+
+ CountingTxRequestsToClientNodeTcpCommunicationSpi.cnt.set(0);
+
+ cache0.put(KEY_VAL, "near-test");
+
+ U.sleep(1000);
+
+ //Ensure near cache was automatically updated.
+ assert CountingTxRequestsToClientNodeTcpCommunicationSpi.cnt.get() != 0;
+
+ assert cache2.localPeek(KEY_VAL).equals("near-test");
+
+ cache2.close();
+
+ CountingTxRequestsToClientNodeTcpCommunicationSpi.cnt.set(0);
+
+ // Should not produce messages to client node.
+ cache0.put(KEY_VAL, KEY_VAL + 0);
+
+ U.sleep(1000);
+
+ // Ensure near cache was NOT automatically updated.
+ assert CountingTxRequestsToClientNodeTcpCommunicationSpi.cnt.get() == 0;
+
+ assert cache0.get(KEY_VAL).equals(KEY_VAL + 0);// Not affected.
+ assert cache1.get(KEY_VAL).equals(KEY_VAL + 0);// Not affected.
+
+ try {
+ cache2.get(KEY_VAL);// Affected.
+
+ assert false;
+ }
+ catch (IllegalArgumentException | IllegalStateException ignored) {
+ // No-op
+ }
+
+ // Near Creation from client node after closed.
+
+ IgniteCache<String, String> cache2New = grid(2).createNearCache(CACHE_NAME_NEAR, new NearCacheConfiguration());
+
+ assertNotSame(cache2, cache2New);
+
+ // Subscribing to events.
+ cache2New.put(KEY_VAL, KEY_VAL);
+
+ assert cache2New.localPeek(KEY_VAL).equals(KEY_VAL);
+
+ cache0.put(KEY_VAL, KEY_VAL + "recreated");
+
+ assert cache0.get(KEY_VAL).equals(KEY_VAL + "recreated");
+ assert cache1.get(KEY_VAL).equals(KEY_VAL + "recreated");
+ assert cache2New.localPeek(KEY_VAL).equals(KEY_VAL + "recreated");
+ }
+
+ /**
+ * Test Near close.
+ *
+ * @throws Exception If failed.
+ */
+ public void testNearCloseWithTry() throws Exception {
+ String curVal = null;
+
+ grid(0).getOrCreateCache(getNearConfig());
+
+ NearCacheConfiguration nearCfg = new NearCacheConfiguration();
+
+ for (int i = 0; i < 3; i++) {
+ try (IgniteCache<String, String> cache2 = grid(2).getOrCreateNearCache(CACHE_NAME_NEAR, nearCfg)) {
+ IgniteCache<String, String> cache0 = grid(0).cache(CACHE_NAME_NEAR);
+ IgniteCache<String, String> cache1 = grid(1).cache(CACHE_NAME_NEAR);
+
+ assert cache2.localPeek(KEY_VAL) == null;
+
+ assert cache0.get(KEY_VAL) == null || cache0.get(KEY_VAL).equals(curVal);
+ assert cache1.get(KEY_VAL) == null || cache1.get(KEY_VAL).equals(curVal);
+ assert cache2.get(KEY_VAL) == null || cache2.get(KEY_VAL).equals(curVal);
+
+ curVal = KEY_VAL + curVal;
+
+ cache2.put(KEY_VAL, curVal);
+
+ assert cache2.localPeek(KEY_VAL).equals(curVal);
+
+ assert cache0.get(KEY_VAL).equals(curVal);
+ assert cache1.get(KEY_VAL).equals(curVal);
+ assert cache2.get(KEY_VAL).equals(curVal);
+ }
+ }
+ }
+
+ /**
+ * Test Local close.
+ *
+ * @throws Exception If failed.
+ */
+ public void testLocalClose() throws Exception {
+ grid(0).getOrCreateCache(getLocalConfig());
+
+ assert grid(0).cache(CACHE_NAME_LOC).get(KEY_VAL) == null;
+ assert grid(1).cache(CACHE_NAME_LOC).get(KEY_VAL) == null;
+
+ grid(0).cache(CACHE_NAME_LOC).put(KEY_VAL, KEY_VAL + 0);
+ grid(1).cache(CACHE_NAME_LOC).put(KEY_VAL, KEY_VAL + 1);
+
+ assert grid(0).cache(CACHE_NAME_LOC).get(KEY_VAL).equals(KEY_VAL + 0);
+ assert grid(1).cache(CACHE_NAME_LOC).get(KEY_VAL).equals(KEY_VAL + 1);
+
+ // Local close. Same as Local destroy.
+
+ IgniteCache<Object, Object> cache = grid(1).cache(CACHE_NAME_LOC);
+
+ cache.close();
+
+ checkUsageFails(cache);
+
+ assertNull(grid(1).cache(CACHE_NAME_LOC));
+
+ // Local creation after closed.
+
+ grid(0).getOrCreateCache(getLocalConfig());
+
+ grid(0).cache(CACHE_NAME_LOC).put(KEY_VAL, KEY_VAL + "recreated0");
+ grid(1).cache(CACHE_NAME_LOC).put(KEY_VAL, KEY_VAL + "recreated1");
+ grid(2).cache(CACHE_NAME_LOC).put(KEY_VAL, KEY_VAL + "recreated2");
+
+ assert grid(0).cache(CACHE_NAME_LOC).get(KEY_VAL).equals(KEY_VAL + "recreated0");
+ assert grid(1).cache(CACHE_NAME_LOC).get(KEY_VAL).equals(KEY_VAL + "recreated1");
+ assert grid(2).cache(CACHE_NAME_LOC).get(KEY_VAL).equals(KEY_VAL + "recreated2");
+ }
+
+ /**
+ * Test Local close.
+ *
+ * @throws Exception If failed.
+ */
+ public void testLocalCloseWithTry() throws Exception {
+ String curVal = null;
+
+ for (int i = 0; i < 3; i++) {
+ try (IgniteCache<String, String> cache2 = grid(2).getOrCreateCache(getLocalConfig())) {
+ IgniteCache<String, String> cache0 = grid(0).cache(CACHE_NAME_LOC);
+ IgniteCache<String, String> cache1 = grid(1).cache(CACHE_NAME_LOC);
+
+ assert cache0.get(KEY_VAL) == null;
+ assert cache1.get(KEY_VAL) == null;
+ assert cache2.get(KEY_VAL) == null;
+
+ curVal = KEY_VAL + curVal;
+
+ cache0.put(KEY_VAL, curVal + 1);
+ cache1.put(KEY_VAL, curVal + 2);
+ cache2.put(KEY_VAL, curVal + 3);
+
+ assert cache0.get(KEY_VAL).equals(curVal + 1);
+ assert cache1.get(KEY_VAL).equals(curVal + 2);
+ assert cache2.get(KEY_VAL).equals(curVal + 3);
+ }
+ }
+ }
+
+ /**
+ * Tests concurrent close.
+ *
+ * @throws Exception If failed.
+ */
+ public void testConcurrentCloseSetWithTry() throws Exception {
+ final AtomicInteger a1 = new AtomicInteger();
+ final AtomicInteger a2 = new AtomicInteger();
+ final AtomicInteger a3 = new AtomicInteger();
+ final AtomicInteger a4 = new AtomicInteger();
+
+ Thread t1 = new Thread(new Runnable() {
+ @Override public void run() {
+ Thread.currentThread().setName("test-thread-1");
+
+ closeWithTry(a1, 0);
+ }
+ });
+ Thread t2 = new Thread(new Runnable() {
+ @Override public void run() {
+ Thread.currentThread().setName("test-thread-2");
+
+ closeWithTry(a2, 0);
+ }
+ });
+ Thread t3 = new Thread(new Runnable() {
+ @Override public void run() {
+ Thread.currentThread().setName("test-thread-3");
+
+ closeWithTry(a3, 2);
+ }
+ });
+ Thread t4 = new Thread(new Runnable() {
+ @Override public void run() {
+ Thread.currentThread().setName("test-thread-4");
+
+ closeWithTry(a4, 2);
+ }
+ });
+
+ IgniteCache<Object, Object> cache = grid(0).getOrCreateCache(getDhtConfig());
+
+ cache.close();
+
+ t1.start();
+ t2.start();
+ t3.start();
+ t4.start();
+
+ try {
+ U.sleep(1000);
+ }
+ finally {
+ stop = true;
+ }
+
+ t1.join();
+ t2.join();
+ t3.join();
+ t4.join();
+
+ assert a1.get() > 1;
+ assert a2.get() > 1;
+ assert a3.get() > 1;
+ assert a4.get() > 1;
+
+ checkUsageFails(cache);
+ }
+
+ /**
+ * @param a AtomicInteger.
+ * @param node Node.
+ */
+ public void closeWithTry(AtomicInteger a, int node) {
+ while (!stop) {
+ try (IgniteCache<String, String> cache = grid(node).getOrCreateCache(getDhtConfig())) {
+ a.incrementAndGet();
+
+ assert cache.get(KEY_VAL) == null || cache.get(KEY_VAL).equals(KEY_VAL);
+
+ cache.put(KEY_VAL, KEY_VAL);
+
+ assert cache.get(KEY_VAL).equals(KEY_VAL);
+ }
+ }
+ }
+
+ /**
+ * Tests start -> destroy -> start -> close using CacheManager.
+ */
+ public void testTckStyleCreateDestroyClose() {
+ CacheManager mgr = Caching.getCachingProvider().getCacheManager();
+
+ String cacheName = "cache";
+
+ mgr.createCache(cacheName, new MutableConfiguration<Integer, String>().setTypes(Integer.class, String.class));
+
+ mgr.destroyCache(cacheName);
+
+ Cache<Integer, String> cache = mgr.createCache(cacheName,
+ new MutableConfiguration<Integer, String>().setTypes(Integer.class, String.class));
+
+ cache.close();
+
+ cache.close();
+
+ try {
+ cache.get(1);
+
+ fail();
+ }
+ catch (IllegalStateException e) {
+ // No-op;
+ }
+ }
+
+ /**
+ * @param cache Cache.
+ * @throws Exception If failed.
+ */
+ private void checkDestroyed(IgniteCache<Object, Object> cache) throws Exception {
+ checkUsageFails(cache);
+
+ awaitPartitionMapExchange();
+
+ String cacheName = cache.getName();
+
+ for (int i = 0; i < 3; i++)
+ assertNull("Unexpected cache for node: " + i, grid(i).cache(cacheName));
+ }
+
+ /**
+ * @param cache Cache.
+ * @throws Exception If failed.
+ */
+ private void checkUsageFails(IgniteCache<Object, Object> cache) throws Exception {
+ try {
+ cache.get(0);
+
+ fail();
+ }
+ catch (IllegalStateException e) {
+ // No-op.
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartAbstractTest.java
index 82667d9..2d52933 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartAbstractTest.java
@@ -163,7 +163,7 @@ public abstract class CacheStoreUsageMultinodeDynamicStartAbstractTest extends C
cache = srv.cache(null);
if (cache != null)
- cache.close();
+ cache.destroy();
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridProjectionForCachesOnDaemonNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridProjectionForCachesOnDaemonNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridProjectionForCachesOnDaemonNodeSelfTest.java
index b9acd99..e640f82 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridProjectionForCachesOnDaemonNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridProjectionForCachesOnDaemonNodeSelfTest.java
@@ -88,7 +88,7 @@ public class GridProjectionForCachesOnDaemonNodeSelfTest extends GridCommonAbstr
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
- ignite.cache(null).close();
+ ignite.cache(null).destroy();
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
index cd19703..d1f8016 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
@@ -175,7 +175,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
GridTestUtils.runMultiThreaded(new Callable<Object>() {
@Override public Object call() throws Exception {
- futs.add(kernal.context().cache().dynamicStopCache(DYNAMIC_CACHE_NAME));
+ futs.add(kernal.context().cache().dynamicDestroyCache(DYNAMIC_CACHE_NAME));
return null;
}
@@ -237,7 +237,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
@Override public Object call() throws Exception {
IgniteEx kernal = grid(ThreadLocalRandom.current().nextInt(nodeCount()));
- futs.add(kernal.context().cache().dynamicStopCache(DYNAMIC_CACHE_NAME));
+ futs.add(kernal.context().cache().dynamicDestroyCache(DYNAMIC_CACHE_NAME));
return null;
}
@@ -300,7 +300,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
for (int g = 0; g < nodeCount(); g++)
caches[g] = grid(g).cache(DYNAMIC_CACHE_NAME);
- kernal.context().cache().dynamicStopCache(DYNAMIC_CACHE_NAME).get();
+ kernal.context().cache().dynamicDestroyCache(DYNAMIC_CACHE_NAME).get();
for (int g = 0; g < nodeCount(); g++) {
final IgniteKernal kernal0 = (IgniteKernal) grid(g);
@@ -353,7 +353,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
}
// Undeploy cache.
- kernal.context().cache().dynamicStopCache(DYNAMIC_CACHE_NAME).get();
+ kernal.context().cache().dynamicDestroyCache(DYNAMIC_CACHE_NAME).get();
startGrid(nodeCount() + 1);
@@ -430,7 +430,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
}, IllegalArgumentException.class, null);
}
- kernal.context().cache().dynamicStopCache(DYNAMIC_CACHE_NAME).get();
+ kernal.context().cache().dynamicDestroyCache(DYNAMIC_CACHE_NAME).get();
stopGrid(nodeCount() + 1);
stopGrid(nodeCount());
@@ -483,7 +483,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override public Object call() throws Exception {
- IgniteKernal ignite = (IgniteKernal) grid(nodeCount());
+ IgniteKernal ignite = (IgniteKernal)grid(nodeCount());
return ignite.getCache(DYNAMIC_CACHE_NAME);
}
@@ -497,7 +497,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
for (int g = 0; g < nodeCount() + 1; g++)
assertEquals("1", ignite(g).cache(DYNAMIC_CACHE_NAME).get("1"));
- kernal.context().cache().dynamicStopCache(DYNAMIC_CACHE_NAME).get();
+ kernal.context().cache().dynamicDestroyCache(DYNAMIC_CACHE_NAME).get();
}
finally {
stopGrid(nodeCount());
@@ -539,7 +539,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
for (int g = 0; g < nodeCount() + 1; g++)
assertEquals("1", ignite(g).cache(DYNAMIC_CACHE_NAME).get("1"));
- kernal.context().cache().dynamicStopCache(DYNAMIC_CACHE_NAME).get();
+ kernal.context().cache().dynamicDestroyCache(DYNAMIC_CACHE_NAME).get();
}
finally {
stopGrid(nodeCount());
@@ -585,7 +585,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
for (int g = 0; g < nodeCount() + 1; g++)
assertEquals("1", ignite(g).cache(DYNAMIC_CACHE_NAME).get("1"));
- kernal.context().cache().dynamicStopCache(DYNAMIC_CACHE_NAME).get();
+ kernal.context().cache().dynamicDestroyCache(DYNAMIC_CACHE_NAME).get();
}
finally {
stopGrid(nodeCount());
@@ -638,10 +638,15 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
ignite(i).events().localListen(lsnrs[i], EventType.EVTS_CACHE_LIFECYCLE);
}
- try (IgniteCache<Object, Object> ignored = ignite(0).createCache(cfg)) {
+ IgniteCache<Object, Object> cache = ignite(0).createCache(cfg);
+
+ try {
for (CountDownLatch start : starts)
start.await();
}
+ finally {
+ cache.destroy();
+ }
for (CountDownLatch stop : stops)
stop.await();
@@ -665,28 +670,29 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
ccfg.setCacheMode(CacheMode.PARTITIONED);
ccfg.setNodeFilter(NODE_FILTER);
- try (IgniteCache cache = ig.createCache(ccfg, new NearCacheConfiguration())) {
- assertNotNull(cache);
+ IgniteCache cache = ig.createCache(ccfg, new NearCacheConfiguration());
+ assertNotNull(cache);
- GridCacheAdapter<Object, Object> cacheAdapter =
- ((IgniteKernal)ig).internalCache(DYNAMIC_CACHE_NAME);
+ GridCacheAdapter<Object, Object> cacheAdapter =
+ ((IgniteKernal)ig).internalCache(DYNAMIC_CACHE_NAME);
- assertNotNull(cacheAdapter);
- assertFalse(cacheAdapter.context().affinityNode());
- assertTrue(cacheAdapter.context().isNear());
+ assertNotNull(cacheAdapter);
+ assertFalse(cacheAdapter.context().affinityNode());
+ assertTrue(cacheAdapter.context().isNear());
- try {
- IgniteEx grid = startGrid(nodeCount() + 1);
+ try {
+ IgniteEx grid = startGrid(nodeCount() + 1);
- // Check that new node sees near node.
- GridDiscoveryManager disco = grid.context().discovery();
+ // Check that new node sees near node.
+ GridDiscoveryManager disco = grid.context().discovery();
- assertTrue(disco.cacheNearNode(disco.node(ig.cluster().localNode().id()),
- DYNAMIC_CACHE_NAME));
- }
- finally {
- stopGrid(nodeCount() + 1);
- }
+ assertTrue(disco.cacheNearNode(disco.node(ig.cluster().localNode().id()),
+ DYNAMIC_CACHE_NAME));
+ }
+ finally {
+ cache.destroy();
+
+ stopGrid(nodeCount() + 1);
}
}
finally {
@@ -955,14 +961,14 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
cfg.setNodeFilter(F.not(NODE_FILTER));
- try (IgniteCache<Object, Object> ignored = ignite(0).createCache(cfg)) {
+ IgniteCache<Object, Object> cache = ignite(0).createCache(cfg);
- final CountDownLatch[] latches = new CountDownLatch[nodeCount()];
+ final CountDownLatch[] latches = new CountDownLatch[nodeCount()];
- IgnitePredicate[] lsnrs = new IgnitePredicate[nodeCount()];
+ IgnitePredicate[] lsnrs = new IgnitePredicate[nodeCount()];
- for (int i = 0; i < nodeCount(); i++) {
- final int idx = i;
+ for (int i = 0; i < nodeCount(); i++) {
+ final int idx = i;
latches[i] = new CountDownLatch(1);
lsnrs[i] = new IgnitePredicate<CacheEvent>() {
@@ -971,29 +977,30 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
case EventType.EVT_CACHE_NODES_LEFT:
latches[idx].countDown();
- break;
+ break;
- default:
- assert false;
- }
+ default:
+ assert false;
+ }
- assertEquals(DYNAMIC_CACHE_NAME, e.cacheName());
+ assertEquals(DYNAMIC_CACHE_NAME, e.cacheName());
- return true;
- }
- };
+ return true;
+ }
+ };
- ignite(i).events().localListen(lsnrs[i], EventType.EVTS_CACHE_LIFECYCLE);
- }
+ ignite(i).events().localListen(lsnrs[i], EventType.EVTS_CACHE_LIFECYCLE);
+ }
- stopGrid(nodeCount());
+ stopGrid(nodeCount());
- for (CountDownLatch latch : latches)
- latch.await();
+ for (CountDownLatch latch : latches)
+ latch.await();
- for (int i = 0; i < nodeCount(); i++)
- ignite(i).events().stopLocalListen(lsnrs[i]);
- }
+ for (int i = 0; i < nodeCount(); i++)
+ ignite(i).events().stopLocalListen(lsnrs[i]);
+
+ cache.destroy();
}
/**
@@ -1007,7 +1014,9 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
try {
CacheConfiguration cfg = new CacheConfiguration(DYNAMIC_CACHE_NAME);
- try (IgniteCache cache = ignite(0).createCache(cfg)) {
+ IgniteCache cache = ignite(0).createCache(cfg);
+
+ try {
for (int i = 0; i < 100; i++) {
assertFalse(ignite(0).affinity(DYNAMIC_CACHE_NAME).mapKeyToPrimaryAndBackups(i)
.contains(dNode.cluster().localNode()));
@@ -1015,6 +1024,9 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
cache.put(i, i);
}
}
+ finally {
+ cache.destroy();
+ }
}
finally {
stopGrid(nodeCount());
@@ -1027,23 +1039,25 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testAwaitPartitionMapExchange() throws Exception {
- try (IgniteCache ignored = grid(0).getOrCreateCache(new CacheConfiguration(DYNAMIC_CACHE_NAME))) {
- awaitPartitionMapExchange();
+ IgniteCache cache = grid(0).getOrCreateCache(new CacheConfiguration(DYNAMIC_CACHE_NAME));
- startGrid(nodeCount());
+ awaitPartitionMapExchange();
- awaitPartitionMapExchange();
+ startGrid(nodeCount());
- startGrid(nodeCount() + 1);
+ awaitPartitionMapExchange();
- awaitPartitionMapExchange();
+ startGrid(nodeCount() + 1);
- stopGrid(nodeCount() + 1);
+ awaitPartitionMapExchange();
- awaitPartitionMapExchange();
+ stopGrid(nodeCount() + 1);
- stopGrid(nodeCount());
- }
+ awaitPartitionMapExchange();
+
+ stopGrid(nodeCount());
+
+ cache.destroy();
}
/**
@@ -1084,9 +1098,11 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
if (iter % 10 == 0)
log.info("Cache start/stop iteration: " + iter);
- try (IgniteCache<Object, Object> cache = ignite1.getOrCreateCache("cache-" + iter)) {
- assertNotNull(cache);
- }
+ IgniteCache<Object, Object> cache = ignite1.getOrCreateCache("cache-" + iter);
+
+ assertNotNull(cache);
+
+ cache.destroy();
iter++;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
index d60a0c3..5a51a1b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
@@ -498,7 +498,7 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
spi1.reset();
spi2.reset();
- assertNull(((IgniteKernal)ignite2).context().cache().context().cache().internalCache("cache1"));
+ assertNull(((IgniteKernal)ignite2).context().cache().context().cache().internalCache(CACHE_NAME1));
if (nearCache)
ignite2.getOrCreateNearCache(CACHE_NAME1, new NearCacheConfiguration<>());
@@ -507,7 +507,7 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
waitForTopologyUpdate(3, new AffinityTopologyVersion(3, 1));
- GridCacheAdapter cache = ((IgniteKernal)ignite2).context().cache().context().cache().internalCache("cache1");
+ GridCacheAdapter cache = ((IgniteKernal)ignite2).context().cache().context().cache().internalCache(CACHE_NAME1);
assertNotNull(cache);
assertEquals(nearCache, cache.context().isNear());
@@ -533,6 +533,29 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
spi1.reset();
spi2.reset();
+ AffinityTopologyVersion topVer;
+
+ if (!srvNode) {
+ log.info("Close client cache: " + CACHE_NAME1);
+
+ ignite2.cache(CACHE_NAME1).close();
+
+ assertNull(((IgniteKernal)ignite2).context().cache().context().cache().internalCache(CACHE_NAME1));
+
+ waitForTopologyUpdate(3, new AffinityTopologyVersion(3, 2));
+
+ assertEquals(0, spi0.partitionsSingleMessages());
+ assertEquals(0, spi0.partitionsFullMessages());
+ assertEquals(0, spi1.partitionsSingleMessages());
+ assertEquals(0, spi1.partitionsFullMessages());
+ assertEquals(0, spi2.partitionsSingleMessages());
+ assertEquals(0, spi2.partitionsFullMessages());
+
+ topVer = new AffinityTopologyVersion(3, 3);
+ }
+ else
+ topVer = new AffinityTopologyVersion(3, 2);
+
final String CACHE_NAME2 = "cache2";
ccfg = new CacheConfiguration();
@@ -541,7 +564,7 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
ignite2.createCache(ccfg);
- waitForTopologyUpdate(3, new AffinityTopologyVersion(3, 2));
+ waitForTopologyUpdate(3, topVer);
assertEquals(0, spi0.partitionsSingleMessages());
assertEquals(2, spi0.partitionsFullMessages());
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/CacheLocalOffHeapAndSwapMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/CacheLocalOffHeapAndSwapMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/CacheLocalOffHeapAndSwapMetricsSelfTest.java
index 3d44600..f4b0d2d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/CacheLocalOffHeapAndSwapMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/CacheLocalOffHeapAndSwapMetricsSelfTest.java
@@ -96,7 +96,7 @@ public class CacheLocalOffHeapAndSwapMetricsSelfTest extends GridCommonAbstractT
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
if (cache != null)
- cache.close();
+ cache.destroy();
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultinodeCreateCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultinodeCreateCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultinodeCreateCacheTest.java
index 12b6458..470ac79 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultinodeCreateCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultinodeCreateCacheTest.java
@@ -76,15 +76,17 @@ public class DataStreamerMultinodeCreateCacheTest extends GridCommonAbstractTest
while (System.currentTimeMillis() < stopTime) {
String cacheName = "cache-" + threadIdx + "-" + (iter % 10);
- try (IgniteCache<Integer, String> cache = ignite.getOrCreateCache(cacheName)) {
- try (IgniteDataStreamer<Object, Object> stmr = ignite.dataStreamer(cacheName)) {
- ((DataStreamerImpl<Object, Object>)stmr).maxRemapCount(0);
+ IgniteCache<Integer, String> cache = ignite.getOrCreateCache(cacheName);
- for (int i = 0; i < 1000; i++)
- stmr.addData(i, i);
- }
+ try (IgniteDataStreamer<Object, Object> stmr = ignite.dataStreamer(cacheName)) {
+ ((DataStreamerImpl<Object, Object>)stmr).maxRemapCount(0);
+
+ for (int i = 0; i < 1000; i++)
+ stmr.addData(i, i);
}
+ cache.destroy();
+
iter++;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index 12d2b05..bde3a72 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -131,6 +131,8 @@ public class IgniteCacheTestSuite4 extends TestSuite {
suite.addTestSuite(CacheRemoveAllSelfTest.class);
+ suite.addTestSuite(CacheStopAndDestroySelfTest.class);
+
suite.addTestSuite(CacheOffheapMapEntrySelfTest.class);
suite.addTestSuite(CacheJdbcStoreSessionListenerSelfTest.class);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e3fba883/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/startcache/CacheConfigurationP2PTestClient.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/startcache/CacheConfigurationP2PTestClient.java b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/startcache/CacheConfigurationP2PTestClient.java
index eea3a9b..701668b0 100644
--- a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/startcache/CacheConfigurationP2PTestClient.java
+++ b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/startcache/CacheConfigurationP2PTestClient.java
@@ -109,9 +109,9 @@ public class CacheConfigurationP2PTestClient {
if (cnt != 600)
throw new Exception("Unexpected query result: " + cnt);
- cache1.close();
+ cache1.destroy();
- cache2.close();
+ cache2.destroy();
}
}
}
[34/50] [abbrv] incubator-ignite git commit: #ignite-964: wip.
Posted by iv...@apache.org.
#ignite-964: wip.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5390b679
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5390b679
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5390b679
Branch: refs/heads/ignite-961
Commit: 5390b679421060278f2dfb4c5932a6a1effe8805
Parents: 3823970
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 10 13:20:19 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 10 13:20:19 2015 +0300
----------------------------------------------------------------------
modules/core/pom.xml | 52 ++++++
.../IgniteScriptingCommandHandler.java | 2 +-
.../scripting/ScriptingJSONCacheObject.java | 166 ------------------
.../scripting/IgniteScriptingProcessor.java | 8 +
.../scripting/ScriptingCacheEntry.java | 10 +-
.../processors/scripting/ScriptingJsCache.java | 15 +-
.../scripting/ScriptingObjectConverter.java | 40 +++++
.../ScriptingObjectConverter8.java | 171 +++++++++++++++++++
.../http/jetty/GridJettyRestHandler.java | 5 +-
9 files changed, 285 insertions(+), 184 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5390b679/modules/core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index 6c5af02..85a5f76 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -248,6 +248,58 @@
<profiles>
<profile>
+ <id>java8-scripting</id>
+
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.9.1</version>
+ <executions>
+ <execution>
+ <id>add-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/main/java8</source>
+ <source>schema-import/src/main/java</source>
+ </sources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>add-tests</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/test/java8</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
<id>release</id>
<activation>
<activeByDefault>true</activeByDefault>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5390b679/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
index 8469e1c..2d0a06e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
@@ -214,7 +214,7 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter
public JsCallFunctionJob(String func, Object argv) {
this.func = func;
- this.argv = ScriptingJSONCacheObject.convertToRestObject(
+ this.argv = ScriptingObjectConverter8.convertToRestObject(
JSONCacheObject.toSimpleObject(argv));
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5390b679/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/ScriptingJSONCacheObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/ScriptingJSONCacheObject.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/ScriptingJSONCacheObject.java
deleted file mode 100644
index 8d446ba..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/ScriptingJSONCacheObject.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.rest.handlers.scripting;
-
-import jdk.nashorn.api.scripting.*;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.json.*;
-
-import java.util.*;
-
-/**
- * Json cache object.
- */
-public class ScriptingJSONCacheObject implements JSObject {
- /** Fields. */
- private final JSONCacheObject fields;
-
- /**
- * @param o JSON object.
- */
- private ScriptingJSONCacheObject(JSONCacheObject o) {
- fields = o;
- }
-
- /**
- * @param o Object.
- * @return Rest JSON cache object.
- */
- public static Object convertToRestObject(Object o) {
- if (o instanceof JSONCacheObject)
- return new ScriptingJSONCacheObject((JSONCacheObject)o);
-
- return o;
- }
-
- /**
- * @return Fields.
- */
- public Map<Object, Object> getFields() {
- return fields;
- }
-
- /**
- * @param key Field name.
- * @return Field value.
- */
- public Object getField(Object key) {
- return fields.get(key);
- }
-
- @Override public Object call(Object o, Object... objects) {
- System.out.println("!!!!CALL");
- return null;
- }
-
- @Override public Object newObject(Object... objects) {
- System.out.println("!!!!newObject");
- return null;
- }
-
- @Override public Object eval(String s) {
- System.out.println("!!!!eval");
- return null;
- }
-
- @Override public Object getMember(String s) {
- System.out.println("!!!!getMember + " + s);
- return fields.get(s);
- }
-
- @Override public Object getSlot(int i) {
- System.out.println("!!!!getSlot");
- return null;
- }
-
- @Override public boolean hasMember(String s) {
- System.out.println("!!!!hasMember");
- return fields.containsKey(s);
- }
-
- @Override public boolean hasSlot(int i) {
- System.out.println("!!!!hasSlot");
- return false;
- }
-
- @Override public void removeMember(String s) {
- System.out.println("!!!!removeMember");
- fields.remove(s);
- }
-
- @Override public void setMember(String s, Object o) {
- System.out.println("!!!!setMember");
- fields.put(s, o);
- }
-
- @Override public void setSlot(int i, Object o) {
- System.out.println("!!!!setSlot");
-
- }
-
- @Override public Set<String> keySet() {
- System.out.println("!!!!keySet");
- Set<String> keys = new HashSet<>();
-
- for (Object o : fields.keySet()) {
- if (!(o instanceof ScriptingJSONCacheObject))
- keys.add(o.toString());
- }
-
- return keys;
- }
-
- @Override public Collection<Object> values() {
- System.out.println("!!!!values");
- return fields.values();
- }
-
- @Override public boolean isInstance(Object o) {
- System.out.println("!!!!isInstance");
- return false;
- }
-
- @Override public boolean isInstanceOf(Object o) {
- System.out.println("!!!!isInstanceOf");
- return false;
- }
-
- @Override public String getClassName() {
- System.out.println("!!!!getClassName");
- return U.getSimpleName(ScriptingJSONCacheObject.class);
- }
-
- @Override public boolean isFunction() {
- System.out.println("!!!!isFunction");
- return false;
- }
-
- @Override public boolean isStrictFunction() {
- System.out.println("!!!!isStrictFunction");
- return false;
- }
-
- @Override public boolean isArray() {
- System.out.println("!!!!isArray");
- return false;
- }
-
- @Override public double toNumber() {
- return 0;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5390b679/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
index 4224b22..cf380c0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
@@ -144,4 +144,12 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
", err= " + e.getMessage() + "].");
}
}
+
+ public Object toScriptingObject(Object o) {
+
+ }
+
+ public Object toJavaObject(Object o) {
+
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5390b679/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingCacheEntry.java
index 96c98d0..bcb2458 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingCacheEntry.java
@@ -1,8 +1,6 @@
package org.apache.ignite.internal.processors.scripting;
-import org.apache.ignite.internal.processors.rest.handlers.scripting.*;
-
/**
* Scripting cache entry.
*/
@@ -18,13 +16,13 @@ public class ScriptingCacheEntry {
* @param val Value.
*/
public ScriptingCacheEntry(Object key, Object val) {
- if (key instanceof ScriptingJSONCacheObject)
- this.key = ((ScriptingJSONCacheObject)key).getFields();
+ if (key instanceof ScriptingObjectConverter8)
+ this.key = ((ScriptingObjectConverter8)key).getFields();
else
this.key = key;
- if (val instanceof ScriptingJSONCacheObject)
- this.val = ((ScriptingJSONCacheObject)val).getFields();
+ if (val instanceof ScriptingObjectConverter8)
+ this.val = ((ScriptingObjectConverter8)val).getFields();
else
this.val = val;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5390b679/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
index cc1dd18..9ab5e21 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.scripting;
import org.apache.ignite.*;
-import org.apache.ignite.internal.processors.rest.handlers.scripting.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.json.*;
@@ -55,7 +54,7 @@ public class ScriptingJsCache {
public Object get(Object key) {
Object cacheKey = JSONCacheObject.toSimpleObject(key);
- return ScriptingJSONCacheObject.convertToRestObject(cache.get(cacheKey));
+ return ScriptingObjectConverter8.convertToRestObject(cache.get(cacheKey));
}
/**
@@ -91,8 +90,8 @@ public class ScriptingJsCache {
for (Map.Entry<Object, Object> e : entries.entrySet())
res.add(new ScriptingCacheEntry(
- ScriptingJSONCacheObject.convertToRestObject(e.getKey()),
- ScriptingJSONCacheObject.convertToRestObject(e.getValue())));
+ ScriptingObjectConverter8.convertToRestObject(e.getKey()),
+ ScriptingObjectConverter8.convertToRestObject(e.getValue())));
return res;
}
@@ -131,7 +130,7 @@ public class ScriptingJsCache {
Object cacheKey = JSONCacheObject.toSimpleObject(key);
Object cacheVal = JSONCacheObject.toSimpleObject(val);
- return ScriptingJSONCacheObject.convertToRestObject(cache.getAndPut(cacheKey, cacheVal));
+ return ScriptingObjectConverter8.convertToRestObject(cache.getAndPut(cacheKey, cacheVal));
}
/**
@@ -143,7 +142,7 @@ public class ScriptingJsCache {
Object cacheKey = JSONCacheObject.toSimpleObject(key);
Object cacheVal = JSONCacheObject.toSimpleObject(val);
- Object o = ScriptingJSONCacheObject.convertToRestObject(cache.getAndReplace(cacheKey, cacheVal));
+ Object o = ScriptingObjectConverter8.convertToRestObject(cache.getAndReplace(cacheKey, cacheVal));
return o;
}
@@ -157,7 +156,7 @@ public class ScriptingJsCache {
Object cacheKey = JSONCacheObject.toSimpleObject(key);
Object cacheVal = JSONCacheObject.toSimpleObject(val);
- return ScriptingJSONCacheObject.convertToRestObject(cache.getAndPutIfAbsent(cacheKey, cacheVal));
+ return ScriptingObjectConverter8.convertToRestObject(cache.getAndPutIfAbsent(cacheKey, cacheVal));
}
/**
@@ -167,7 +166,7 @@ public class ScriptingJsCache {
public Object getAndRemove(Object key) {
Object cacheKey = JSONCacheObject.toSimpleObject(key);
- return ScriptingJSONCacheObject.convertToRestObject(cache.getAndRemove(cacheKey));
+ return ScriptingObjectConverter8.convertToRestObject(cache.getAndRemove(cacheKey));
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5390b679/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java
new file mode 100644
index 0000000..a02a762
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java
@@ -0,0 +1,40 @@
+/*
+ * 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.scripting;
+
+import org.apache.ignite.json.*;
+
+/**
+ * Script object converter.
+ */
+public class ScriptingObjectConverter {
+ /**
+ * @param o Object to convert.
+ * @return Object to use in script.
+ */
+ public Object toScriptingObject(Object o) {
+ return o;
+ }
+
+ /**
+ * @param o Object from script.
+ * @return Object to store in cache.
+ */
+ public Object toJavaObject(Object o) {
+ return JSONCacheObject.toSimpleObject(o);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5390b679/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java b/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java
new file mode 100644
index 0000000..23ea93d
--- /dev/null
+++ b/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java
@@ -0,0 +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.processors.scripting;
+
+import jdk.nashorn.api.scripting.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.json.*;
+
+import java.util.*;
+
+/**
+ * Json cache object.
+ */
+public class ScriptingObjectConverter8 extends ScriptingObjectConverter implements JSObject {
+ /** Fields. */
+ private final JSONCacheObject fields;
+
+ /**
+ * @param o JSON object.
+ */
+ private ScriptingObjectConverter8(JSONCacheObject o) {
+ fields = o;
+ }
+
+ /**
+ * @param o Object.
+ * @return Rest JSON cache object.
+ */
+ public static Object convertToRestObject(Object o) {
+ if (o instanceof JSONCacheObject)
+ return new ScriptingObjectConverter8((JSONCacheObject)o);
+
+ return o;
+ }
+
+ /**
+ * @return Fields.
+ */
+ public Map<Object, Object> getFields() {
+ return fields;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Object toScriptingObject(Object o) {
+ return convertToRestObject(o);
+ }
+
+ /**
+ * @param key Field name.
+ * @return Field value.
+ */
+ public Object getField(Object key) {
+ return fields.get(key);
+ }
+
+ @Override public Object call(Object o, Object... objects) {
+ System.out.println("!!!!CALL");
+ return null;
+ }
+
+ @Override public Object newObject(Object... objects) {
+ System.out.println("!!!!newObject");
+ return null;
+ }
+
+ @Override public Object eval(String s) {
+ System.out.println("!!!!eval");
+ return null;
+ }
+
+ @Override public Object getMember(String s) {
+ System.out.println("!!!!getMember + " + s);
+ return fields.get(s);
+ }
+
+ @Override public Object getSlot(int i) {
+ System.out.println("!!!!getSlot");
+ return null;
+ }
+
+ @Override public boolean hasMember(String s) {
+ System.out.println("!!!!hasMember");
+ return fields.containsKey(s);
+ }
+
+ @Override public boolean hasSlot(int i) {
+ System.out.println("!!!!hasSlot");
+ return false;
+ }
+
+ @Override public void removeMember(String s) {
+ System.out.println("!!!!removeMember");
+ fields.remove(s);
+ }
+
+ @Override public void setMember(String s, Object o) {
+ System.out.println("!!!!setMember");
+ fields.put(s, o);
+ }
+
+ @Override public void setSlot(int i, Object o) {
+ System.out.println("!!!!setSlot");
+
+ }
+
+ @Override public Set<String> keySet() {
+ System.out.println("!!!!keySet");
+ Set<String> keys = new HashSet<>();
+
+ for (Object o : fields.keySet()) {
+ if (!(o instanceof ScriptingObjectConverter8))
+ keys.add(o.toString());
+ }
+
+ return keys;
+ }
+
+ @Override public Collection<Object> values() {
+ System.out.println("!!!!values");
+ return fields.values();
+ }
+
+ @Override public boolean isInstance(Object o) {
+ System.out.println("!!!!isInstance");
+ return false;
+ }
+
+ @Override public boolean isInstanceOf(Object o) {
+ System.out.println("!!!!isInstanceOf");
+ return false;
+ }
+
+ @Override public String getClassName() {
+ System.out.println("!!!!getClassName");
+ return U.getSimpleName(ScriptingObjectConverter8.class);
+ }
+
+ @Override public boolean isFunction() {
+ System.out.println("!!!!isFunction");
+ return false;
+ }
+
+ @Override public boolean isStrictFunction() {
+ System.out.println("!!!!isStrictFunction");
+ return false;
+ }
+
+ @Override public boolean isArray() {
+ System.out.println("!!!!isArray");
+ return false;
+ }
+
+ @Override public double toNumber() {
+ return 0;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5390b679/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index 3d662e5..0828779 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -22,7 +22,6 @@ import net.sf.json.processors.*;
import org.apache.ignite.*;
import org.apache.ignite.internal.processors.rest.*;
import org.apache.ignite.internal.processors.rest.client.message.*;
-import org.apache.ignite.internal.processors.rest.handlers.scripting.*;
import org.apache.ignite.internal.processors.rest.request.*;
import org.apache.ignite.internal.processors.scripting.*;
import org.apache.ignite.internal.util.typedef.*;
@@ -342,8 +341,8 @@ public class GridJettyRestHandler extends AbstractHandler {
else {
Object o = cmdRes.getResponse();
- if (o instanceof ScriptingJSONCacheObject)
- cmdRes.setResponse(((ScriptingJSONCacheObject)o).getFields());
+ if (o instanceof ScriptingObjectConverter8)
+ cmdRes.setResponse(((ScriptingObjectConverter8)o).getFields());
}
}
[42/50] [abbrv] incubator-ignite git commit: #ignite-964: remove
unused functions.
Posted by iv...@apache.org.
#ignite-964: remove unused functions.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3ab0552e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3ab0552e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3ab0552e
Branch: refs/heads/ignite-961
Commit: 3ab0552e12b0d0f110363c58b2263046bffab81e
Parents: 2d47f7b
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 10 18:29:22 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 10 18:29:22 2015 +0300
----------------------------------------------------------------------
.../main/java/org/apache/ignite/json/JSONCacheObject.java | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ab0552e/modules/core/src/main/java/org/apache/ignite/json/JSONCacheObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/json/JSONCacheObject.java b/modules/core/src/main/java/org/apache/ignite/json/JSONCacheObject.java
index 2b8de1b..0eb5f28 100644
--- a/modules/core/src/main/java/org/apache/ignite/json/JSONCacheObject.java
+++ b/modules/core/src/main/java/org/apache/ignite/json/JSONCacheObject.java
@@ -32,14 +32,6 @@ public class JSONCacheObject extends HashMap<Object, Object> {
/**
* @param key Field name.
- * @param val Field value.
- */
- public void addField(Object key, Object val) {
- put(key, val);
- }
-
- /**
- * @param key Field name.
* @return Field value.
*/
public Object getField(Object key) {
@@ -62,7 +54,7 @@ public class JSONCacheObject extends HashMap<Object, Object> {
JSONCacheObject res = new JSONCacheObject();
for (Object key : o1.keySet())
- res.addField(toSimpleObject(key), toSimpleObject(o1.get(key)));
+ res.put(toSimpleObject(key), toSimpleObject(o1.get(key)));
return res;
}
[10/50] [abbrv] incubator-ignite git commit: #ignite-964: NodeJs
ignite.getOrCreateCache is async function.
Posted by iv...@apache.org.
#ignite-964: NodeJs ignite.getOrCreateCache is async function.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ae2d0c2f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ae2d0c2f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ae2d0c2f
Branch: refs/heads/ignite-961
Commit: ae2d0c2ff32dd2ba56f915876a35c99feac930f7
Parents: 43ab939
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Jul 8 20:07:10 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Jul 8 20:07:10 2015 +0300
----------------------------------------------------------------------
examples/src/main/js/cache-api-example.js | 6 +-
examples/src/main/js/cache-put-get-example.js | 8 +--
examples/src/main/js/cache-query-example.js | 4 +-
modules/nodejs/src/main/js/apache-ignite.js | 1 -
modules/nodejs/src/main/js/cache.js | 75 +++++++++-------------
modules/nodejs/src/main/js/ignite.js | 19 ++++--
modules/nodejs/src/test/js/test-cache-api.js | 39 +++++++----
7 files changed, 83 insertions(+), 69 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ae2d0c2f/examples/src/main/js/cache-api-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-api-example.js b/examples/src/main/js/cache-api-example.js
index 24c31d2..13368d5 100644
--- a/examples/src/main/js/cache-api-example.js
+++ b/examples/src/main/js/cache-api-example.js
@@ -23,9 +23,9 @@ Ignition.start(['127.0.0.1:9095'], null, onConnect);
function onConnect(err, ignite) {
console.log(">>> Cache API example started.");
- var cache = ignite.getOrCreateCache("ApiExampleCache");
-
- atomicMapOperations(cache);
+ ignite.getOrCreateCache("ApiExampleCache", function(err, cache) {
+ atomicMapOperations(cache);
+ });
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ae2d0c2f/examples/src/main/js/cache-put-get-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-put-get-example.js b/examples/src/main/js/cache-put-get-example.js
index 92e0797..7a9b035 100644
--- a/examples/src/main/js/cache-put-get-example.js
+++ b/examples/src/main/js/cache-put-get-example.js
@@ -26,11 +26,11 @@ function onConnect(err, ignite) {
if (err)
throw err;
- var cache = ignite.getOrCreateCache("PutGetExampleCache");
+ ignite.getOrCreateCache("PutGetExampleCache", function(err, cache) {
+ putGet(cache);
- putGet(cache);
-
- putAllGetAll(cache);
+ putAllGetAll(cache);
+ });
}
putGet = function(cache) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ae2d0c2f/examples/src/main/js/cache-query-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-query-example.js b/examples/src/main/js/cache-query-example.js
index f31f0d5..1b774a0 100644
--- a/examples/src/main/js/cache-query-example.js
+++ b/examples/src/main/js/cache-query-example.js
@@ -31,7 +31,9 @@ function onConnect(err, ignite) {
var entries = [new Entry("key0", "val0"), new Entry("key1", "val1")];
- ignite.getOrCreateCache(cacheName).putAll(entries, onCachePut.bind(null, ignite));
+ ignite.getOrCreateCache(cacheName, function(err, cache) {
+ cache.putAll(entries, onCachePut.bind(null, ignite));
+ });
}
function onCachePut(ignite, err) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ae2d0c2f/modules/nodejs/src/main/js/apache-ignite.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/apache-ignite.js b/modules/nodejs/src/main/js/apache-ignite.js
index 2379b36..053b88a 100644
--- a/modules/nodejs/src/main/js/apache-ignite.js
+++ b/modules/nodejs/src/main/js/apache-ignite.js
@@ -19,7 +19,6 @@ module.exports = {
Cache : require('./cache.js').Cache,
CacheEntry : require('./cache.js').CacheEntry,
Ignition : require('./ignition.js').Ignition,
- Server : require('./server.js').Server,
Ignite : require('./ignite.js').Ignite,
Compute : require('./compute.js').Compute,
SqlQuery : require('./sql-query.js').SqlQuery,
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ae2d0c2f/modules/nodejs/src/main/js/cache.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js
index 67a8b6c..893a945 100644
--- a/modules/nodejs/src/main/js/cache.js
+++ b/modules/nodejs/src/main/js/cache.js
@@ -27,12 +27,20 @@ var SqlQuery = require("./sql-query").SqlQuery
* @this {Cache}
* @param {Server} server Server class
* @param {string} cacheName Cache name
- * @param {boolean} create True if cache is not exist.
*/
-function Cache(server, cacheName, create) {
+function Cache(server, cacheName) {
this._server = server;
this._cacheName = cacheName;
- this._create = create;
+}
+
+/**
+ * Get cache name.
+ *
+ * @this{Cache}
+ * @returns {string} Cache name.
+ */
+Cache.prototype.name = function() {
+ return this._cacheName;
}
/**
@@ -43,7 +51,7 @@ function Cache(server, cacheName, create) {
* @param {onGet} callback Called on finish
*/
Cache.prototype.get = function(key, callback) {
- this._runCacheCommand(this._createCommand("get").
+ this._server.runCommand(this._createCommand("get").
setPostData(JSON.stringify({"key": key})),
callback);
};
@@ -57,7 +65,7 @@ Cache.prototype.get = function(key, callback) {
* @param {noValue} callback Called on finish
*/
Cache.prototype.put = function(key, value, callback) {
- this._runCacheCommand(this._createCommand("put").
+ this._server.runCommand(this._createCommand("put").
setPostData(JSON.stringify({"key": key, "val" : value})),
callback);
}
@@ -71,7 +79,7 @@ Cache.prototype.put = function(key, value, callback) {
* @param {onGet} callback Called on finish
*/
Cache.prototype.putIfAbsent = function(key, value, callback) {
- this._runCacheCommand(this._createCommand("putifabsent").
+ this._server.runCommand(this._createCommand("putifabsent").
setPostData(JSON.stringify({"key": key, "val" : value})),
callback);
}
@@ -84,7 +92,7 @@ Cache.prototype.putIfAbsent = function(key, value, callback) {
* @param {noValue} callback Called on finish
*/
Cache.prototype.remove = function(key, callback) {
- this._runCacheCommand(this._createCommand("rmv").
+ this._server.runCommand(this._createCommand("rmv").
setPostData(JSON.stringify({"key": key})),
callback);
}
@@ -98,7 +106,7 @@ Cache.prototype.remove = function(key, callback) {
* @param {noValue} callback Called on finish
*/
Cache.prototype.removeValue = function(key, value, callback) {
- this._runCacheCommand(this._createCommand("rmvvalue").
+ this._server.runCommand(this._createCommand("rmvvalue").
setPostData(JSON.stringify({"key": key, "val" : value})),
callback);
}
@@ -111,7 +119,7 @@ Cache.prototype.removeValue = function(key, value, callback) {
* @param {onGet} callback Called on finish with previous value
*/
Cache.prototype.getAndRemove = function(key, callback) {
- this._runCacheCommand(this._createCommand("getandrmv").
+ this._server.runCommand(this._createCommand("getandrmv").
setPostData(JSON.stringify({"key": key})),
callback);
}
@@ -124,7 +132,7 @@ Cache.prototype.getAndRemove = function(key, callback) {
* @param {noValue} callback Called on finish
*/
Cache.prototype.removeAll = function(keys, callback) {
- this._runCacheCommand(this._createCommand("rmvall").
+ this._server.runCommand(this._createCommand("rmvall").
setPostData(JSON.stringify({"keys" : keys})),
callback);
}
@@ -136,7 +144,7 @@ Cache.prototype.removeAll = function(keys, callback) {
* @param {noValue} callback Called on finish
*/
Cache.prototype.removeAllFromCache = function(callback) {
- this._runCacheCommand(this._createCommand("rmvall"),
+ this._server.runCommand(this._createCommand("rmvall"),
callback);
}
@@ -148,7 +156,7 @@ Cache.prototype.removeAllFromCache = function(callback) {
* @param {noValue} callback Called on finish
*/
Cache.prototype.putAll = function(entries, callback) {
- this._runCacheCommand(this._createCommand("putall").setPostData(
+ this._server.runCommand(this._createCommand("putall").setPostData(
JSON.stringify({"entries" : entries})), callback);
}
@@ -176,7 +184,7 @@ Cache.prototype.getAll = function(keys, callback) {
callback.call(null, null, result);
}
- this._runCacheCommand(this._createCommand("getall").setPostData(
+ this._server.runCommand(this._createCommand("getall").setPostData(
JSON.stringify({"keys" : keys})),
onGetAll.bind(null, callback));
}
@@ -189,7 +197,7 @@ Cache.prototype.getAll = function(keys, callback) {
* @param {Cache~onGetAll} callback Called on finish with boolean result
*/
Cache.prototype.containsKey = function(key, callback) {
- this._runCacheCommand(this._createCommand("containskey").
+ this._server.runCommand(this._createCommand("containskey").
setPostData(JSON.stringify({"key" : key})), callback);
}
@@ -201,7 +209,7 @@ Cache.prototype.containsKey = function(key, callback) {
* @param {Cache~onGetAll} callback Called on finish with boolean result
*/
Cache.prototype.containsKeys = function(keys, callback) {
- this._runCacheCommand(this._createCommand("containskeys").
+ this._server.runCommand(this._createCommand("containskeys").
setPostData(JSON.stringify({"keys" : keys})), callback);
}
@@ -214,7 +222,7 @@ Cache.prototype.containsKeys = function(keys, callback) {
* @param {onGet} callback Called on finish
*/
Cache.prototype.getAndPut = function(key, val, callback) {
- this._runCacheCommand(this._createCommand("getandput").
+ this._server.runCommand(this._createCommand("getandput").
setPostData(JSON.stringify({"key" : key, "val" : val})), callback);
}
@@ -227,7 +235,7 @@ Cache.prototype.getAndPut = function(key, val, callback) {
* @param {onGet} callback Called on finish
*/
Cache.prototype.replace = function(key, val, callback) {
- this._runCacheCommand(this._createCommand("rep").
+ this._server.runCommand(this._createCommand("rep").
setPostData(JSON.stringify({"key" : key, "val" : val})), callback);
}
@@ -241,7 +249,7 @@ Cache.prototype.replace = function(key, val, callback) {
* @param {onGet} callback Called on finish
*/
Cache.prototype.replaceValue = function(key, val, oldVal, callback) {
- this._runCacheCommand(this._createCommand("repVal").
+ this._server.runCommand(this._createCommand("repVal").
setPostData(JSON.stringify({"key" : key, "val" : val, "oldVal" : oldVal})), callback);
}
@@ -254,7 +262,7 @@ Cache.prototype.replaceValue = function(key, val, oldVal, callback) {
* @param {onGet} callback Called on finish
*/
Cache.prototype.getAndReplace = function(key, val, callback) {
- this._runCacheCommand(this._createCommand("getandreplace").
+ this._server.runCommand(this._createCommand("getandreplace").
setPostData(JSON.stringify({"key" : key, "val" : val})), callback);
}
@@ -267,7 +275,7 @@ Cache.prototype.getAndReplace = function(key, val, callback) {
* @param {onGet} callback Called on finish
*/
Cache.prototype.getAndPutIfAbsent = function(key, val, callback) {
- this._runCacheCommand(this._createCommand("getandputifabsent").
+ this._server.runCommand(this._createCommand("getandputifabsent").
setPostData(JSON.stringify({"key" : key, "val" : val})), callback);
}
@@ -276,7 +284,7 @@ Cache.prototype.getAndPutIfAbsent = function(key, val, callback) {
* @param {onGet} callback Called on finish
*/
Cache.prototype.size = function(callback) {
- this._runCacheCommand(this._createCommand("cachesize"), callback);
+ this._server.runCommand(this._createCommand("cachesize"), callback);
}
/**
@@ -319,7 +327,7 @@ Cache.prototype._sqlFieldsQuery = function(qry, onQueryExecute) {
command.setPostData(JSON.stringify({"arg" : qry.arguments()}));
- this._runCacheCommand(command, onQueryExecute.bind(this, qry));
+ this._server.runCommand(command, onQueryExecute.bind(this, qry));
}
Cache.prototype._sqlQuery = function(qry, onQueryExecute) {
@@ -335,7 +343,7 @@ Cache.prototype._sqlQuery = function(qry, onQueryExecute) {
command.setPostData(JSON.stringify({"arg" : qry.arguments()}));
- this._runCacheCommand(command, onQueryExecute.bind(this, qry));
+ this._server.runCommand(command, onQueryExecute.bind(this, qry));
}
Cache.prototype._createCommand = function(name) {
@@ -352,27 +360,6 @@ Cache.prototype._createQueryCommand = function(name, qry) {
return command.addParam("psz", qry.pageSize());
}
-Cache.prototype._runCacheCommand = function(command, callback) {
- if (this._create) {
- var onCreateCallback = function(command, callback, err) {
- if (err !== null) {
- callback.call(null, err, null);
-
- return;
- }
-
- this._create = false;
-
- this._server.runCommand(command, callback);
- }
-
- this._server.runCommand(this._createCommand("getorcreatecache"),
- onCreateCallback.bind(this, command, callback));
- }
- else {
- this._server.runCommand(command, callback);
- }
-}
/**
* @this{CacheEntry}
* @param key Key
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ae2d0c2f/modules/nodejs/src/main/js/ignite.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/ignite.js b/modules/nodejs/src/main/js/ignite.js
index fea34f9..cbe8552 100644
--- a/modules/nodejs/src/main/js/ignite.js
+++ b/modules/nodejs/src/main/js/ignite.js
@@ -48,7 +48,7 @@ Ignite.prototype.server = function() {
* @returns {Cache} Cache
*/
Ignite.prototype.cache = function(cacheName) {
- return new Cache(this._server, cacheName, false);
+ return new Cache(this._server, cacheName);
}
/**
@@ -56,10 +56,21 @@ Ignite.prototype.cache = function(cacheName) {
*
* @this {Ignite}
* @param {string} Cache name
- * @returns {Cache} Cache
+ * @param callback Callback with cache.
*/
-Ignite.prototype.getOrCreateCache = function(cacheName) {
- return new Cache(this._server, cacheName, true);
+Ignite.prototype.getOrCreateCache = function(cacheName, callback) {
+ var onCreateCallback = function(err) {
+ if (err !== null) {
+ callback.call(null, err, null);
+
+ return;
+ }
+
+ callback.call(null, null, new Cache(this._server, cacheName))
+ }
+
+ this._server.runCommand(new Command("getorcreatecache").addParam("cacheName", cacheName),
+ onCreateCallback.bind(this));
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ae2d0c2f/modules/nodejs/src/test/js/test-cache-api.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/test/js/test-cache-api.js b/modules/nodejs/src/test/js/test-cache-api.js
index c599a86..9855fa3 100644
--- a/modules/nodejs/src/test/js/test-cache-api.js
+++ b/modules/nodejs/src/test/js/test-cache-api.js
@@ -311,23 +311,38 @@ function startTest(createCache, cacheName, testDescription) {
}
function onStart(createCache, cacheName, testDescription, error, ignite) {
- var cache;
if (createCache) {
- cache = ignite.getOrCreateCache(cacheName);
+ ignite.getOrCreateCache(cacheName, function(err, cache) {
+ assert(err === null, err);
+
+ function callNext(error) {
+ assert(!error);
+ var next = testDescription.trace.shift();
+ if (next)
+ next.call(null, cache, testDescription.entry, callNext);
+ else
+ TestUtils.testDone();
+ }
+
+ callNext();
+ });
}
else {
- cache = ignite.cache(cacheName);
- }
- callNext();
+ var cache = ignite.cache(cacheName);
+
+ function callNext(error) {
+ assert(!error);
+ var next = testDescription.trace.shift();
+ if (next)
+ next.call(null, cache, testDescription.entry, callNext);
+ else
+ TestUtils.testDone();
+ }
- function callNext(error) {
- assert(!error);
- var next = testDescription.trace.shift();
- if (next)
- next.call(null, cache, testDescription.entry, callNext);
- else
- TestUtils.testDone();
+ callNext();
}
+
+
}
function put(cache, entry, next) {
[04/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'remotes/origin/master' into ignite-964-1
Posted by iv...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-964-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/43ab9398
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/43ab9398
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/43ab9398
Branch: refs/heads/ignite-961
Commit: 43ab9398d42e6cb5fb6d3fd6e10fe3561737cb27
Parents: 5c86f3b 4c9d8c2
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Jul 8 19:32:17 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Jul 8 19:32:17 2015 +0300
----------------------------------------------------------------------
dev-tools/slurp.sh | 2 +-
.../cache/eviction/fifo/FifoEvictionPolicy.java | 5 -
.../cache/eviction/lru/LruEvictionPolicy.java | 5 -
.../eviction/sorted/SortedEvictionPolicy.java | 19 +-
.../configuration/CacheConfiguration.java | 4 +
.../configuration/TransactionConfiguration.java | 23 +++
.../internal/interop/InteropIgnition.java | 17 +-
.../internal/interop/InteropProcessor.java | 7 +
.../processors/cache/GridCacheAttributes.java | 3 +
.../processors/cache/GridCacheContext.java | 8 +-
.../processors/cache/GridCacheIoManager.java | 8 +-
.../processors/cache/GridCacheProcessor.java | 21 +-
.../cache/GridCacheSharedContext.java | 15 +-
.../distributed/near/GridNearGetFuture.java | 4 +-
.../cache/jta/CacheJtaManagerAdapter.java | 17 +-
.../cache/jta/CacheNoopJtaManager.java | 2 +-
.../cache/query/GridCacheQueryAdapter.java | 35 +++-
.../processors/query/GridQueryProcessor.java | 5 +
.../visor/cache/VisorCacheConfiguration.java | 11 -
.../ignite/spi/discovery/tcp/ServerImpl.java | 46 +++++
.../tcp/internal/TcpDiscoveryNode.java | 2 +-
.../tcp/internal/TcpDiscoveryNodesRing.java | 8 +-
.../tcp/internal/TcpDiscoveryStatistics.java | 10 +-
.../cache/CacheFutureExceptionSelfTest.java | 161 +++++++--------
.../GridCachePartitionedNodeRestartTest.java | 5 -
...ePartitionedOptimisticTxNodeRestartTest.java | 2 +-
.../GridCacheReplicatedFailoverSelfTest.java | 5 -
.../GridCacheReplicatedNodeRestartSelfTest.java | 5 -
...acheAtomicReplicatedNodeRestartSelfTest.java | 8 +-
...heConcurrentEvictionConsistencySelfTest.java | 15 +-
.../loadtests/hashmap/GridCacheTestContext.java | 4 +-
.../tcp/TcpDiscoveryMultiThreadedTest.java | 38 ++++
.../IgniteSpiDiscoverySelfTestSuite.java | 3 +
.../HibernateTransactionalDataRegion.java | 12 +-
.../hibernate/HibernateL2CacheSelfTest.java | 7 +-
.../HibernateL2CacheTransactionalSelfTest.java | 5 -
.../CacheAbstractQueryMetricsSelfTest.java | 157 +++++++++++++-
.../cache/CacheLocalQueryMetricsSelfTest.java | 33 +++
...titionedQueryMetricsDistributedSelfTest.java | 33 +++
...chePartitionedQueryMetricsLocalSelfTest.java | 33 +++
.../CachePartitionedQueryMetricsSelfTest.java | 32 ---
...plicatedQueryMetricsDistributedSelfTest.java | 33 +++
...acheReplicatedQueryMetricsLocalSelfTest.java | 33 +++
.../CacheReplicatedQueryMetricsSelfTest.java | 32 ---
.../IgniteCacheQuerySelfTestSuite.java | 7 +-
.../apache/ignite/cache/jta/CacheTmLookup.java | 3 +-
.../processors/cache/jta/CacheJtaManager.java | 72 ++++++-
.../cache/jta/GridCacheXAResource.java | 16 +-
.../processors/cache/GridCacheJtaSelfTest.java | 52 +++--
.../GridTmLookupLifecycleAwareSelfTest.java | 29 ++-
modules/kafka/licenses/apache-2.0.txt | 202 +++++++++++++++++++
modules/kafka/pom.xml | 11 -
.../commands/cache/VisorCacheCommand.scala | 2 -
.../config/benchmark-put-indexed-val.properties | 64 ++++++
modules/yardstick/config/ignite-base-config.xml | 23 +++
.../cache/IgnitePutIndexedValue1Benchmark.java | 42 ++++
.../cache/IgnitePutIndexedValue2Benchmark.java | 42 ++++
.../cache/IgnitePutIndexedValue8Benchmark.java | 42 ++++
.../ignite/yardstick/cache/model/Person1.java | 55 +++++
.../ignite/yardstick/cache/model/Person2.java | 67 ++++++
.../ignite/yardstick/cache/model/Person8.java | 109 ++++++++++
scripts/git-patch-prop.sh | 2 +-
62 files changed, 1450 insertions(+), 323 deletions(-)
----------------------------------------------------------------------
[17/50] [abbrv] incubator-ignite git commit: # Hive version changed
in tests: 1.2.0 -> 1.2.1
Posted by iv...@apache.org.
# Hive version changed in tests: 1.2.0 -> 1.2.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/bee6f688
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bee6f688
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bee6f688
Branch: refs/heads/ignite-961
Commit: bee6f6884ba0da9b9418842f7926d1dbd3ddd624
Parents: 546d595
Author: iveselovskiy <iv...@gridgain.com>
Authored: Thu Jul 9 15:05:01 2015 +0300
Committer: iveselovskiy <iv...@gridgain.com>
Committed: Thu Jul 9 15:05:01 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bee6f688/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java b/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java
index 2ab3e8c..7393f69 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java
@@ -130,7 +130,7 @@ public class IgniteHadoopTestSuite extends TestSuite {
* @throws Exception If failed.
*/
public static void downloadHive() throws Exception {
- String ver = IgniteSystemProperties.getString("hive.version", "1.2.0");
+ String ver = IgniteSystemProperties.getString("hive.version", "1.2.1");
X.println("Will use Hive version: " + ver);
[47/50] [abbrv] incubator-ignite git commit: # ignite-648:
Implemented.
Posted by iv...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWrityOrderOffHeapMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWrityOrderOffHeapMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWrityOrderOffHeapMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..3732cd2
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWrityOrderOffHeapMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicPrimaryWrityOrderOffHeapMultiJvmFullApiSelfTest extends
+ GridCacheAtomicPrimaryWrityOrderOffHeapMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWrityOrderOffHeapTieredMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWrityOrderOffHeapTieredMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWrityOrderOffHeapTieredMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..02e6857
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheAtomicPrimaryWrityOrderOffHeapTieredMultiJvmFullApiSelfTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheAtomicPrimaryWrityOrderOffHeapTieredMultiJvmFullApiSelfTest
+ extends GridCacheAtomicPrimaryWrityOrderOffHeapTieredMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void testLocalClearKeys() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-1107");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearOnlyFairAffinityMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearOnlyFairAffinityMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearOnlyFairAffinityMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..c8829a1
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearOnlyFairAffinityMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheNearOnlyFairAffinityMultiJvmFullApiSelfTest extends
+ GridCacheNearOnlyFairAffinityMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearOnlyMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearOnlyMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearOnlyMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..40504d8
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearOnlyMultiJvmFullApiSelfTest.java
@@ -0,0 +1,30 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheNearOnlyMultiJvmFullApiSelfTest extends GridCacheNearOnlyMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearOnlyMultiJvmP2PDisabledFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearOnlyMultiJvmP2PDisabledFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearOnlyMultiJvmP2PDisabledFullApiSelfTest.java
new file mode 100644
index 0000000..5e48504
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearOnlyMultiJvmP2PDisabledFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheNearOnlyMultiJvmP2PDisabledFullApiSelfTest extends
+ GridCacheNearOnlyMultiNodeP2PDisabledFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedCopyOnReadDisabledMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedCopyOnReadDisabledMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedCopyOnReadDisabledMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..2aa8ed8
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedCopyOnReadDisabledMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCachePartitionedCopyOnReadDisabledMultiJvmFullApiSelfTest extends
+ GridCachePartitionedCopyOnReadDisabledMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedFairAffinityMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedFairAffinityMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedFairAffinityMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..7bd0043
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedFairAffinityMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.replicated.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCachePartitionedFairAffinityMultiJvmFullApiSelfTest extends
+ GridCachePartitionedFairAffinityMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..c88f360
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedMultiJvmFullApiSelfTest.java
@@ -0,0 +1,30 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCachePartitionedMultiJvmFullApiSelfTest extends GridCachePartitionedMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedMultiJvmP2PDisabledFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedMultiJvmP2PDisabledFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedMultiJvmP2PDisabledFullApiSelfTest.java
new file mode 100644
index 0000000..1e619eb
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedMultiJvmP2PDisabledFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCachePartitionedMultiJvmP2PDisabledFullApiSelfTest extends
+ GridCachePartitionedMultiNodeP2PDisabledFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledAtomicOffHeapTieredMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledAtomicOffHeapTieredMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledAtomicOffHeapTieredMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..ff249a7
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledAtomicOffHeapTieredMultiJvmFullApiSelfTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCachePartitionedNearDisabledAtomicOffHeapTieredMultiJvmFullApiSelfTest
+ extends GridCachePartitionedNearDisabledAtomicOffHeapTieredMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void testLocalClearKeys() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-1107");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledFairAffinityMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledFairAffinityMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledFairAffinityMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..b3e45ad
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledFairAffinityMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCachePartitionedNearDisabledFairAffinityMultiJvmFullApiSelfTest extends
+ GridCachePartitionedNearDisabledFairAffinityMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..6cdd3be
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCachePartitionedNearDisabledMultiJvmFullApiSelfTest extends
+ GridCachePartitionedNearDisabledMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledMultiJvmP2PDisabledFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledMultiJvmP2PDisabledFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledMultiJvmP2PDisabledFullApiSelfTest.java
new file mode 100644
index 0000000..c873b11
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledMultiJvmP2PDisabledFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCachePartitionedNearDisabledMultiJvmP2PDisabledFullApiSelfTest extends
+ GridCachePartitionedNearDisabledMultiNodeP2PDisabledFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledOffHeapMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledOffHeapMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledOffHeapMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..8d0bc7f
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledOffHeapMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCachePartitionedNearDisabledOffHeapMultiJvmFullApiSelfTest extends
+ GridCachePartitionedNearDisabledOffHeapMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledOffHeapTieredMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledOffHeapTieredMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledOffHeapTieredMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..c797d5b
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedNearDisabledOffHeapTieredMultiJvmFullApiSelfTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCachePartitionedNearDisabledOffHeapTieredMultiJvmFullApiSelfTest
+ extends GridCachePartitionedNearDisabledOffHeapTieredMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void testLocalClearKeys() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-1107");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedOffHeapMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedOffHeapMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedOffHeapMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..5cf5d8a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedOffHeapMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCachePartitionedOffHeapMultiJvmFullApiSelfTest extends
+ GridCachePartitionedOffHeapMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedOffHeapTieredMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedOffHeapTieredMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedOffHeapTieredMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..f843ae5
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedOffHeapTieredMultiJvmFullApiSelfTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCachePartitionedOffHeapTieredMultiJvmFullApiSelfTest
+ extends GridCachePartitionedOffHeapTieredMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void testLocalClearKeys() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-1107");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedAtomicMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedAtomicMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedAtomicMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..7f8bfa1
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedAtomicMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.replicated.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheReplicatedAtomicMultiJvmFullApiSelfTest extends
+ GridCacheReplicatedAtomicMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..fb87c9c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.replicated.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheReplicatedAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest extends
+ GridCacheReplicatedAtomicPrimaryWriteOrderMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..19a5abd
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedMultiJvmFullApiSelfTest.java
@@ -0,0 +1,30 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.replicated.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheReplicatedMultiJvmFullApiSelfTest extends GridCacheReplicatedMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedMultiJvmP2PDisabledFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedMultiJvmP2PDisabledFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedMultiJvmP2PDisabledFullApiSelfTest.java
new file mode 100644
index 0000000..7473bdc
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedMultiJvmP2PDisabledFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.replicated.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheReplicatedMultiJvmP2PDisabledFullApiSelfTest extends
+ GridCacheReplicatedMultiNodeP2PDisabledFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedNearOnlyMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedNearOnlyMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedNearOnlyMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..9d7639c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedNearOnlyMultiJvmFullApiSelfTest.java
@@ -0,0 +1,37 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.replicated.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheReplicatedNearOnlyMultiJvmFullApiSelfTest extends
+ GridCacheReplicatedNearOnlyMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void testNearDhtKeySize() throws Exception {
+ if (isMultiJvm())
+ fail("https://issues.apache.org/jira/browse/IGNITE-648");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedOffHeapMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedOffHeapMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedOffHeapMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..f054f4b
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedOffHeapMultiJvmFullApiSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.replicated.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheReplicatedOffHeapMultiJvmFullApiSelfTest extends
+ GridCacheReplicatedOffHeapMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedOffHeapTieredMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedOffHeapTieredMultiJvmFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedOffHeapTieredMultiJvmFullApiSelfTest.java
new file mode 100644
index 0000000..2006972
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheReplicatedOffHeapTieredMultiJvmFullApiSelfTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.multijvm;
+
+import org.apache.ignite.internal.processors.cache.distributed.replicated.*;
+
+/**
+ * Multi-JVM tests.
+ */
+public class GridCacheReplicatedOffHeapTieredMultiJvmFullApiSelfTest
+ extends GridCacheReplicatedOffHeapTieredMultiNodeFullApiSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void testLocalClearKeys() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-1107");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/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 9a63b3a..06a1523 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
@@ -33,10 +33,13 @@ import org.apache.ignite.marshaller.jdk.*;
import org.apache.ignite.spi.checkpoint.sharedfs.*;
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.multicast.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
import org.apache.ignite.testframework.*;
import org.apache.ignite.testframework.config.*;
import org.apache.ignite.testframework.junits.logger.*;
+import org.apache.ignite.testframework.junits.multijvm.*;
import org.apache.log4j.*;
import org.jetbrains.annotations.*;
import org.springframework.beans.*;
@@ -72,6 +75,11 @@ public abstract class GridAbstractTest extends TestCase {
/** Null name for execution map. */
private static final String NULL_NAME = UUID.randomUUID().toString();
+ /** Ip finder for TCP discovery. */
+ public static final TcpDiscoveryIpFinder LOCAL_IP_FINDER = new TcpDiscoveryVmIpFinder(false) {{
+ setAddresses(Collections.singleton("127.0.0.1:47500..47509"));
+ }};
+
/** */
private static final long DFLT_TEST_TIMEOUT = 5 * 60 * 1000;
@@ -203,6 +211,9 @@ public abstract class GridAbstractTest extends TestCase {
* @return logger.
*/
protected IgniteLogger log() {
+ if (isRemoteJvm())
+ return IgniteNodeRunner.startedInstance().log();
+
return log;
}
@@ -464,6 +475,11 @@ public abstract class GridAbstractTest extends TestCase {
}
try {
+ List<Integer> jvmIds = IgniteNodeRunner.killAll();
+
+ if (!jvmIds.isEmpty())
+ log.info("Next processes of IgniteNodeRunner were killed: " + jvmIds);
+
beforeTestsStarted();
}
catch (Exception | Error t) {
@@ -556,6 +572,9 @@ public abstract class GridAbstractTest extends TestCase {
* @throws Exception If failed.
*/
protected final Ignite startGridsMultiThreaded(int init, int cnt) throws Exception {
+ if (isMultiJvm())
+ fail("https://issues.apache.org/jira/browse/IGNITE-648");
+
assert init >= 0;
assert cnt > 0;
@@ -657,14 +676,37 @@ public abstract class GridAbstractTest extends TestCase {
* @throws Exception If failed.
*/
protected Ignite startGrid(String gridName, GridSpringResourceContext ctx) throws Exception {
- startingGrid.set(gridName);
+ if (!isRemoteJvm(gridName)) {
+ startingGrid.set(gridName);
- try {
- return IgnitionEx.start(optimize(getConfiguration(gridName)), ctx);
- }
- finally {
- startingGrid.set(null);
+ try {
+ return IgnitionEx.start(optimize(getConfiguration(gridName)), ctx);
+ }
+ finally {
+ startingGrid.set(null);
+ }
}
+ else
+ return startRemoteGrid(gridName, null, ctx);
+ }
+
+ /**
+ * Starts new grid at another JVM with given name.
+ *
+ * @param gridName Grid name.
+ * @param ctx Spring context.
+ * @return Started grid.
+ * @throws Exception If failed.
+ */
+ protected Ignite startRemoteGrid(String gridName, IgniteConfiguration cfg, GridSpringResourceContext ctx)
+ throws Exception {
+ if (ctx != null)
+ throw new UnsupportedOperationException("Starting of grid at another jvm by context doesn't supported.");
+
+ if (cfg == null)
+ cfg = optimize(getConfiguration(gridName));
+
+ return new IgniteProcessProxy(cfg, log, grid(0));
}
/**
@@ -707,13 +749,16 @@ public abstract class GridAbstractTest extends TestCase {
@SuppressWarnings({"deprecation"})
protected void stopGrid(@Nullable String gridName, boolean cancel) {
try {
- Ignite ignite = G.ignite(gridName);
+ Ignite ignite = grid(gridName);
assert ignite != null : "Ignite returned null grid for name: " + gridName;
info(">>> Stopping grid [name=" + ignite.name() + ", id=" + ignite.cluster().localNode().id() + ']');
- G.stop(gridName, cancel);
+ if (!isRemoteJvm(gridName))
+ G.stop(gridName, cancel);
+ else
+ IgniteProcessProxy.stop(gridName, cancel);
}
catch (IllegalStateException ignored) {
// Ignore error if grid already stopped.
@@ -736,23 +781,28 @@ public abstract class GridAbstractTest extends TestCase {
* @param cancel Cancel flag.
*/
protected void stopAllGrids(boolean cancel) {
- Collection<Ignite> clients = new ArrayList<>();
- Collection<Ignite> srvs = new ArrayList<>();
-
- for (Ignite g : G.allGrids()) {
- if (g.configuration().getDiscoverySpi().isClientMode())
- clients.add(g);
- else
- srvs.add(g);
- }
+ try {
+ Collection<Ignite> clients = new ArrayList<>();
+ Collection<Ignite> srvs = new ArrayList<>();
+
+ for (Ignite g : G.allGrids()) {
+ if (g.configuration().getDiscoverySpi().isClientMode())
+ clients.add(g);
+ else
+ srvs.add(g);
+ }
- for (Ignite g : clients)
- stopGrid(g.name(), cancel);
+ for (Ignite g : clients)
+ stopGrid(g.name(), cancel);
- for (Ignite g : srvs)
- stopGrid(g.name(), cancel);
+ for (Ignite g : srvs)
+ stopGrid(g.name(), cancel);
- assert G.allGrids().isEmpty();
+ assert G.allGrids().isEmpty();
+ }
+ finally {
+ IgniteProcessProxy.killAll(); // In multi-JVM case.
+ }
}
/**
@@ -821,7 +871,14 @@ public abstract class GridAbstractTest extends TestCase {
* @return Grid instance.
*/
protected IgniteEx grid(String name) {
- return (IgniteEx)G.ignite(name);
+ if (!isRemoteJvm(name))
+ return (IgniteEx)G.ignite(name);
+ else {
+ if (isRemoteJvm())
+ return IgniteNodeRunner.startedInstance();
+ else
+ return IgniteProcessProxy.ignite(name);
+ }
}
/**
@@ -831,7 +888,7 @@ public abstract class GridAbstractTest extends TestCase {
* @return Grid instance.
*/
protected IgniteEx grid(int idx) {
- return (IgniteEx)G.ignite(getTestGridName(idx));
+ return grid(getTestGridName(idx));
}
/**
@@ -839,7 +896,7 @@ public abstract class GridAbstractTest extends TestCase {
* @return Ignite instance.
*/
protected Ignite ignite(int idx) {
- return G.ignite(getTestGridName(idx));
+ return grid(idx);
}
/**
@@ -848,7 +905,10 @@ public abstract class GridAbstractTest extends TestCase {
* @return Grid for given test.
*/
protected IgniteEx grid() {
- return (IgniteEx)G.ignite(getTestGridName());
+ if (!isMultiJvm())
+ return (IgniteEx)G.ignite(getTestGridName());
+ else
+ throw new UnsupportedOperationException("Operation doesn't supported yet.");
}
/**
@@ -856,7 +916,17 @@ public abstract class GridAbstractTest extends TestCase {
* @return Ignite instance with given local node.
*/
protected final Ignite grid(ClusterNode node) {
- return G.ignite(node.id());
+ if (!isMultiJvm())
+ return G.ignite(node.id());
+ else {
+ try {
+ return IgniteProcessProxy.ignite(node.id());
+ }
+ catch (Exception ignore) {
+ // A hack if it is local grid.
+ return G.ignite(node.id());
+ }
+ }
}
/**
@@ -886,7 +956,10 @@ public abstract class GridAbstractTest extends TestCase {
protected Ignite startGrid(String gridName, IgniteConfiguration cfg) throws Exception {
cfg.setGridName(gridName);
- return G.start(cfg);
+ if (!isRemoteJvm(gridName))
+ return G.start(cfg);
+ else
+ return startRemoteGrid(gridName, cfg, null);
}
/**
@@ -1015,6 +1088,9 @@ public abstract class GridAbstractTest extends TestCase {
cfg.setNodeId(UUID.fromString(new String(chars)));
}
+ if (isMultiJvm())
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(LOCAL_IP_FINDER);
+
return cfg;
}
@@ -1286,6 +1362,183 @@ public abstract class GridAbstractTest extends TestCase {
}
/**
+ * Gets flag whether nodes will run in one JVM or in separate JVMs.
+ *
+ * @return <code>True</code> to run nodes in separate JVMs.
+ * @see IgniteNodeRunner
+ * @see IgniteProcessProxy
+ * @see #isRemoteJvm()
+ * @see #isRemoteJvm(int)
+ * @see #isRemoteJvm(String)
+ * @see #executeOnLocalOrRemoteJvm(int, TestIgniteIdxCallable)
+ * @see #executeOnLocalOrRemoteJvm(Ignite, TestIgniteCallable)
+ * @see #executeOnLocalOrRemoteJvm(IgniteCache, TestCacheCallable)
+ */
+ protected boolean isMultiJvm() {
+ return false;
+ }
+
+ /**
+ * @param gridName Grid name.
+ * @return <code>True</code> if test was run in multi-JVM mode and grid with this name was started at another JVM.
+ */
+ protected boolean isRemoteJvm(String gridName) {
+ return isMultiJvm() && !"0".equals(gridName.substring(getTestGridName().length()));
+ }
+
+ /**
+ * @param idx Grid index.
+ * @return <code>True</code> if test was run in multi-JVM mode and grid with this ID was started at another JVM.
+ */
+ protected boolean isRemoteJvm(int idx) {
+ return isMultiJvm() && idx != 0;
+ }
+
+ /**
+ * @return <code>True</code> if current JVM contains remote started node
+ * (It differs from JVM where tests executing).
+ */
+ protected boolean isRemoteJvm() {
+ return IgniteNodeRunner.hasStartedInstance();
+ }
+
+ /**
+ * @param cache Cache.
+ * @return <code>True</code> if cache is an instance of {@link IgniteCacheProcessProxy}
+ */
+ public static boolean isMultiJvmObject(IgniteCache cache) {
+ return cache instanceof IgniteCacheProcessProxy;
+ }
+
+ /**
+ * @param ignite Ignite.
+ * @return <code>True</code> if cache is an instance of {@link IgniteProcessProxy}
+ */
+ public static boolean isMultiJvmObject(Ignite ignite) {
+ return ignite instanceof IgniteProcessProxy;
+ }
+
+ /**
+ * Calls job on local JVM or on remote JVM in multi-JVM case.
+ *
+ * @param idx Grid index.
+ * @param job Job.
+ */
+ public <R> R executeOnLocalOrRemoteJvm(final int idx, final TestIgniteIdxCallable<R> job) {
+ IgniteEx ignite = grid(idx);
+
+ if (!isMultiJvmObject(ignite))
+ try {
+ return job.call(idx);
+ }
+ catch (Exception e) {
+ throw new IgniteException(e);
+ }
+ else
+ return executeRemotely(idx, job);
+ }
+
+ /**
+ * Calls job on local JVM or on remote JVM in multi-JVM case.
+ *
+ * @param ignite Ignite.
+ * @param job Job.
+ */
+ public static <R> R executeOnLocalOrRemoteJvm(Ignite ignite, final TestIgniteCallable<R> job) {
+ if (!isMultiJvmObject(ignite))
+ try {
+ return job.call(ignite);
+ }
+ catch (Exception e) {
+ throw new IgniteException(e);
+ }
+ else
+ return executeRemotely((IgniteProcessProxy)ignite, job);
+ }
+
+ /**
+ * Calls job on local JVM or on remote JVM in multi-JVM case.
+ *
+ * @param cache Cache.
+ * @param job Job.
+ */
+ public static <K,V,R> R executeOnLocalOrRemoteJvm(IgniteCache<K,V> cache, TestCacheCallable<K,V,R> job) {
+ Ignite ignite = cache.unwrap(Ignite.class);
+
+ if (!isMultiJvmObject(ignite))
+ try {
+ return job.call(ignite, cache);
+ }
+ catch (Exception e) {
+ throw new IgniteException(e);
+ }
+ else
+ return executeRemotely((IgniteCacheProcessProxy<K, V>)cache, job);
+ }
+
+ /**
+ * Calls job on remote JVM.
+ *
+ * @param idx Grid index.
+ * @param job Job.
+ */
+ public <R> R executeRemotely(final int idx, final TestIgniteIdxCallable<R> job) {
+ IgniteEx ignite = grid(idx);
+
+ if (!isMultiJvmObject(ignite))
+ throw new IllegalArgumentException("Ignite have to be process proxy.");
+
+ IgniteProcessProxy proxy = (IgniteProcessProxy)ignite;
+
+ return proxy.remoteCompute().call(new IgniteCallable<R>() {
+ @Override public R call() throws Exception {
+ return job.call(idx);
+ }
+ });
+ }
+
+ /**
+ * Calls job on remote JVM.
+ *
+ * @param proxy Ignite.
+ * @param job Job.
+ */
+ public static <R> R executeRemotely(IgniteProcessProxy proxy, final TestIgniteCallable<R> job) {
+ final UUID id = proxy.getId();
+
+ return proxy.remoteCompute().call(new IgniteCallable<R>() {
+ @Override public R call() throws Exception {
+ Ignite ignite = Ignition.ignite(id);
+
+ return job.call(ignite);
+ }
+ });
+ }
+
+ /**
+ * Runs job on remote JVM.
+ *
+ * @param cache Cache.
+ * @param job Job.
+ */
+ public static <K, V, R> R executeRemotely(IgniteCacheProcessProxy<K, V> cache,
+ final TestCacheCallable<K, V, R> job) {
+ IgniteProcessProxy proxy = (IgniteProcessProxy)cache.unwrap(Ignite.class);
+
+ final UUID id = proxy.getId();
+ final String cacheName = cache.getName();
+
+ return proxy.remoteCompute().call(new IgniteCallable<R>() {
+ @Override public R call() throws Exception {
+ Ignite ignite = Ignition.ignite(id);
+ IgniteCache<K,V> cache = ignite.cache(cacheName);
+
+ return job.call(ignite, cache);
+ }
+ });
+ }
+
+ /**
* @return Test counters.
*/
protected synchronized TestCounters getTestCounters() throws IgniteCheckedException {
@@ -1598,4 +1851,75 @@ public abstract class GridAbstractTest extends TestCase {
return numOfTests;
}
}
+
+ /** */
+ public static interface TestIgniteCallable<R> extends Serializable {
+ /**
+ * @param ignite Ignite.
+ */
+ R call(Ignite ignite) throws Exception;
+ }
+
+ /** */
+ public abstract static class TestIgniteRunnable implements TestIgniteCallable<Object> {
+ /** {@inheritDoc} */
+ @Override public Object call(Ignite ignite) throws Exception {
+ run(ignite);
+
+ return null;
+ }
+
+ /**
+ * @param ignite Ignite.
+ */
+ public abstract void run(Ignite ignite) throws Exception;
+ }
+
+ /** */
+ public static interface TestIgniteIdxCallable<R> extends Serializable {
+ /**
+ * @param idx Grid index.
+ */
+ R call(int idx) throws Exception;
+ }
+
+ /** */
+ public abstract static class TestIgniteIdxRunnable implements TestIgniteIdxCallable<Object> {
+ /** {@inheritDoc} */
+ @Override public Object call(int idx) throws Exception {
+ run(idx);
+
+ return null;
+ }
+
+ /**
+ * @param idx Index.
+ */
+ public abstract void run(int idx) throws Exception;
+ }
+
+ /** */
+ public static interface TestCacheCallable<K, V, R> extends Serializable {
+ /**
+ * @param ignite Ignite.
+ * @param cache Cache.
+ */
+ R call(Ignite ignite, IgniteCache<K, V> cache) throws Exception;
+ }
+
+ /** */
+ public abstract static class TestCacheRunnable<K, V> implements TestCacheCallable<K, V, Object> {
+ /** {@inheritDoc} */
+ @Override public Object call(Ignite ignite, IgniteCache cache) throws Exception {
+ run(ignite, cache);
+
+ return null;
+ }
+
+ /**
+ * @param ignite Ignite.
+ * @param cache Cache.
+ */
+ public abstract void run(Ignite ignite, IgniteCache<K, V> cache) throws Exception;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 9941ca8..8698b4a 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -116,6 +116,10 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
* @return Cache.
*/
protected <K, V> GridCacheAdapter<K, V> internalCache(IgniteCache<K, V> cache) {
+ if (isMultiJvmObject(cache))
+ throw new UnsupportedOperationException("Oparetion can't be supported automatically for multi jvm " +
+ "(send closure instead).");
+
return ((IgniteKernal)cache.unwrap(Ignite.class)).internalCache(cache.getName());
}
@@ -201,9 +205,13 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
* @param cache Cache.
* @return {@code True} if near cache is enabled.
*/
- protected static <K, V> boolean nearEnabled(IgniteCache<K,V> cache) {
- CacheConfiguration cfg = ((IgniteKernal)cache.unwrap(Ignite.class)).
- <K, V>internalCache(cache.getName()).context().config();
+ protected static <K, V> boolean nearEnabled(final IgniteCache<K,V> cache) {
+ CacheConfiguration cfg = GridAbstractTest.executeOnLocalOrRemoteJvm(cache,
+ new TestCacheCallable<K, V, CacheConfiguration>() {
+ @Override public CacheConfiguration call(Ignite ignite, IgniteCache<K, V> cache) throws Exception {
+ return ((IgniteKernal)ignite).<K, V>internalCache(cache.getName()).context().config();
+ }
+ });
return isNearEnabled(cfg);
}
@@ -238,27 +246,33 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
* @param replaceExistingValues Replace existing values.
* @throws Exception If failed.
*/
- protected static <K> void loadAll(Cache<K, ?> cache, Set<K> keys, boolean replaceExistingValues) throws Exception {
- final AtomicReference<Exception> ex = new AtomicReference<>();
+ protected static <K> void loadAll(Cache<K, ?> cache, final Set<K> keys, final boolean replaceExistingValues) throws Exception {
+ IgniteCache<K, Object> cacheCp = (IgniteCache<K, Object>)cache;
- final CountDownLatch latch = new CountDownLatch(1);
+ GridAbstractTest.executeOnLocalOrRemoteJvm(cacheCp, new TestCacheRunnable<K, Object>() {
+ @Override public void run(Ignite ignite, IgniteCache<K, Object> cache) throws Exception {
+ final AtomicReference<Exception> ex = new AtomicReference<>();
- cache.loadAll(keys, replaceExistingValues, new CompletionListener() {
- @Override public void onCompletion() {
- latch.countDown();
- }
+ final CountDownLatch latch = new CountDownLatch(1);
- @Override public void onException(Exception e) {
- ex.set(e);
+ cache.loadAll(keys, replaceExistingValues, new CompletionListener() {
+ @Override public void onCompletion() {
+ latch.countDown();
+ }
- latch.countDown();
- }
- });
+ @Override public void onException(Exception e) {
+ ex.set(e);
+
+ latch.countDown();
+ }
+ });
- latch.await();
+ latch.await();
- if (ex.get() != null)
- throw ex.get();
+ if (ex.get() != null)
+ throw ex.get();
+ }
+ });
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/AffinityProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/AffinityProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/AffinityProcessProxy.java
new file mode 100644
index 0000000..e87895d
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/AffinityProcessProxy.java
@@ -0,0 +1,195 @@
+/*
+ * 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.junits.multijvm;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.lang.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+
+/**
+ * Proxy class for affinity at another JVM.
+ */
+@SuppressWarnings("TransientFieldInNonSerializableClass")
+public class AffinityProcessProxy<K> implements Affinity<K> {
+ /** Compute. */
+ private final transient IgniteCompute compute;
+
+ /** Cache name. */
+ private final String cacheName;
+
+ /** Grid id. */
+ private final UUID gridId;
+
+ /**
+ * @param cacheName Cache name.
+ * @param proxy Ignite ptocess proxy.
+ */
+ public AffinityProcessProxy(String cacheName, IgniteProcessProxy proxy) {
+ this.cacheName = cacheName;
+ gridId = proxy.getId();
+ compute = proxy.remoteCompute();
+ }
+
+ /**
+ * Returns cache instance. Method to be called from closure at another JVM.
+ *
+ * @return Cache.
+ */
+ private Affinity<Object> affinity() {
+ return Ignition.ignite(gridId).affinity(cacheName);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int partitions() {
+ return (int)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return affinity().partitions();
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public int partition(final K key) {
+ return (int)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return affinity().partition(key);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isPrimary(final ClusterNode n, final K key) {
+ return (boolean)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return affinity().isPrimary(n, key);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isBackup(final ClusterNode n, final K key) {
+ return (boolean)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return affinity().isBackup(n, key);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isPrimaryOrBackup(final ClusterNode n, final K key) {
+ return (boolean)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return affinity().isPrimaryOrBackup(n, key);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public int[] primaryPartitions(final ClusterNode n) {
+ return (int[])compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return affinity().primaryPartitions(n);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public int[] backupPartitions(final ClusterNode n) {
+ return (int[])compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return affinity().backupPartitions(n);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public int[] allPartitions(final ClusterNode n) {
+ return (int[])compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return affinity().allPartitions(n);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public Object affinityKey(final K key) {
+ return compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return affinity().affinityKey(key);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public Map<ClusterNode, Collection<K>> mapKeysToNodes(final Collection<? extends K> keys) {
+ return (Map<ClusterNode, Collection<K>>)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return affinity().mapKeysToNodes(keys);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public ClusterNode mapKeyToNode(final K key) {
+ return (ClusterNode)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return affinity().mapKeyToNode(key);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<ClusterNode> mapKeyToPrimaryAndBackups(final K key) {
+ return (Collection<ClusterNode>)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return affinity().mapKeyToPrimaryAndBackups(key);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterNode mapPartitionToNode(final int part) {
+ return (ClusterNode)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return affinity().mapPartitionToNode(part);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public Map<Integer, ClusterNode> mapPartitionsToNodes(final Collection<Integer> parts) {
+ return (Map<Integer, ClusterNode>)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return affinity().mapPartitionsToNodes(parts);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<ClusterNode> mapPartitionToPrimaryAndBackups(final int part) {
+ return (Collection<ClusterNode>)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return affinity().mapPartitionToPrimaryAndBackups(part);
+ }
+ });
+ }
+}
[02/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'remotes/origin/ignite-591'
Posted by iv...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-591'
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/23dc8fc8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/23dc8fc8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/23dc8fc8
Branch: refs/heads/ignite-961
Commit: 23dc8fc87352bdb38a0ff7d01dab048c22ceae77
Parents: 6d6ec77 cfeec2d
Author: sevdokimov <se...@gridgain.com>
Authored: Wed Jul 8 15:57:06 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed Jul 8 15:57:06 2015 +0300
----------------------------------------------------------------------
.../configuration/CacheConfiguration.java | 4 ++
.../configuration/TransactionConfiguration.java | 23 +++++++
.../processors/cache/GridCacheAttributes.java | 3 +
.../processors/cache/GridCacheContext.java | 8 +--
.../processors/cache/GridCacheProcessor.java | 21 +++---
.../cache/GridCacheSharedContext.java | 15 +++-
.../cache/jta/CacheJtaManagerAdapter.java | 17 +++--
.../cache/jta/CacheNoopJtaManager.java | 2 +-
.../visor/cache/VisorCacheConfiguration.java | 11 ---
.../loadtests/hashmap/GridCacheTestContext.java | 4 +-
.../HibernateTransactionalDataRegion.java | 12 +++-
.../hibernate/HibernateL2CacheSelfTest.java | 7 +-
.../HibernateL2CacheTransactionalSelfTest.java | 5 --
.../apache/ignite/cache/jta/CacheTmLookup.java | 3 +-
.../processors/cache/jta/CacheJtaManager.java | 72 ++++++++++++++++++--
.../cache/jta/GridCacheXAResource.java | 16 ++---
.../processors/cache/GridCacheJtaSelfTest.java | 52 ++++++++++----
.../GridTmLookupLifecycleAwareSelfTest.java | 29 ++++++--
.../commands/cache/VisorCacheCommand.scala | 2 -
19 files changed, 211 insertions(+), 95 deletions(-)
----------------------------------------------------------------------
[23/50] [abbrv] incubator-ignite git commit: #ignite-964: rename
mapReduce method.
Posted by iv...@apache.org.
#ignite-964: rename mapReduce method.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/1749345e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1749345e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1749345e
Branch: refs/heads/ignite-961
Commit: 1749345ed60c35388e1917c47848897655a62ead
Parents: 29300a4
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jul 9 18:30:09 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jul 9 18:30:09 2015 +0300
----------------------------------------------------------------------
examples/src/main/js/cache-query-example.js | 2 +-
examples/src/main/js/map-reduce-example.js | 2 +-
examples/src/main/js/run-cache-script.js | 6 +++---
examples/src/main/js/run-function-example.js | 8 ++++----
modules/nodejs/src/main/js/compute.js | 8 ++++----
modules/nodejs/src/test/js/test-compute.js | 24 +++++++++++------------
6 files changed, 25 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1749345e/examples/src/main/js/cache-query-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-query-example.js b/examples/src/main/js/cache-query-example.js
index 1b774a0..04ffb1e 100644
--- a/examples/src/main/js/cache-query-example.js
+++ b/examples/src/main/js/cache-query-example.js
@@ -29,7 +29,7 @@ Ignition.start(['127.0.0.1:9095'], null, onConnect);
function onConnect(err, ignite) {
console.log(">>> Cache query example started.");
- var entries = [new Entry("key0", "val0"), new Entry("key1", "val1")];
+ var entries = [new CacheEntry("key0", "val0"), new CacheEntry("key1", "val1")];
ignite.getOrCreateCache(cacheName, function(err, cache) {
cache.putAll(entries, onCachePut.bind(null, ignite));
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1749345e/examples/src/main/js/map-reduce-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/map-reduce-example.js b/examples/src/main/js/map-reduce-example.js
index e56b99d..ab02bf8 100644
--- a/examples/src/main/js/map-reduce-example.js
+++ b/examples/src/main/js/map-reduce-example.js
@@ -75,7 +75,7 @@ function main() {
console.log(">>> End of compute map reduce example.");
}
- ignite.compute().execute(map, reduce, "Hello Ignite Enabled World!", onMapReduce);
+ ignite.compute().mapReduce(map, reduce, "Hello Ignite Enabled World!", onMapReduce);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1749345e/examples/src/main/js/run-cache-script.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/run-cache-script.js b/examples/src/main/js/run-cache-script.js
index d4d72cc..b27721d 100644
--- a/examples/src/main/js/run-cache-script.js
+++ b/examples/src/main/js/run-cache-script.js
@@ -63,15 +63,15 @@ function main() {
return val.salary;
}
- /** Run remote job on server ignite node with arguments [cacheName, key]. */
- ignite.compute().runScript(job, [cacheName, key], onRun);
-
var onRun = function(err, salary) {
console.log(">>> " + key + "'s salary is " + salary);
// Destroying cache.
ignite.destroyCache(cacheName, function(err) { console.log(">>> End of run cache script example."); });
}
+
+ /** Run remote job on server ignite node with arguments [cacheName, key]. */
+ ignite.compute().run(job, [cacheName, key], onRun);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1749345e/examples/src/main/js/run-function-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/run-function-example.js b/examples/src/main/js/run-function-example.js
index 832f9d6..740dc20 100644
--- a/examples/src/main/js/run-function-example.js
+++ b/examples/src/main/js/run-function-example.js
@@ -51,13 +51,13 @@ function main() {
return sum;
}
- // Execute job on ignite server node.
- ignite.compute().runScript(job, "Hello Ignite Enabled World!", onRun);
-
- function onRun(err, sum) {
+ var onRun = function(err, sum) {
console.log(">>> Total number of characters in the phrase is '" + sum + "'.");
console.log(">>> End of compute callable example.");
}
+
+ // Execute job on ignite server node.
+ ignite.compute().run(job, "Hello Ignite Enabled World!", onRun);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1749345e/modules/nodejs/src/main/js/compute.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/compute.js b/modules/nodejs/src/main/js/compute.js
index 7f56e1c..16de9e4 100644
--- a/modules/nodejs/src/main/js/compute.js
+++ b/modules/nodejs/src/main/js/compute.js
@@ -29,12 +29,12 @@ function Compute(server) {
/**
* @this {Compute}
- * @param runnable Function without parameters
+ * @param job Function
* @param args Function arguments
* @param {onGet} callback Callback
*/
-Compute.prototype.runScript = function(runnable, args, callback) {
- this._server.runCommand(new Command("runscript").addParam("func", runnable).
+Compute.prototype.run = function(job, args, callback) {
+ this._server.runCommand(new Command("runscript").addParam("func", job).
setPostData(JSON.stringify({"arg" : args})), callback);
}
@@ -45,7 +45,7 @@ Compute.prototype.runScript = function(runnable, args, callback) {
* @param {string} arg Argument
* @param {onGet} callback Callback
*/
-Compute.prototype.execute = function(map, reduce, arg, callback) {
+Compute.prototype.mapReduce = function(map, reduce, arg, callback) {
var command = new Command("excmapreduce");
command.addParam("map", map).addParam("reduce", reduce);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1749345e/modules/nodejs/src/test/js/test-compute.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/test/js/test-compute.js b/modules/nodejs/src/test/js/test-compute.js
index 111d79f..5d865ce 100644
--- a/modules/nodejs/src/test/js/test-compute.js
+++ b/modules/nodejs/src/test/js/test-compute.js
@@ -71,7 +71,7 @@ testComputeRunScriptContainsKey = function() {
var initKey = {"1" : ["1", "2"]};
- comp.runScript(f, initKey, onEnd.bind(null));
+ comp.run(f, initKey, onEnd.bind(null));
}
TestUtils.startIgniteNode(computeRunScriptContainsKey);
@@ -108,7 +108,7 @@ testComputeRunScriptContainsKeys = function() {
var initKey0 = {"1" : ["1", "2"]};
var initKey1 = {"2" : "AAA"};
- comp.runScript(f, [initKey0, initKey1], onEnd.bind(null));
+ comp.run(f, [initKey0, initKey1], onEnd.bind(null));
}
TestUtils.startIgniteNode(computeRunScriptContainsKey);
@@ -147,7 +147,7 @@ testComputeRunScriptPutAllGetAll = function() {
var initVal1 = {"2" : "AAA"};
var initEntries = [new CacheEntry(initKey0, initVal0), new CacheEntry(initKey1, initVal1)];
- comp.runScript(f, [initEntries, [initKey0, initKey1]],
+ comp.run(f, [initEntries, [initKey0, initKey1]],
onEnd.bind(null));
}
@@ -236,7 +236,7 @@ testComputeRunScriptRemoveOperations = function() {
TestUtils.testDone();
}
- comp.runScript(f, [], onEnd.bind(null));
+ comp.run(f, [], onEnd.bind(null));
}
TestUtils.startIgniteNode(computeRunScriptRemoveOperations);
@@ -289,7 +289,7 @@ testComputeMapReduceGetAndPut = function() {
TestUtils.testDone();
}
- ignite.compute().execute(map, reduce, [], callback);
+ ignite.compute().mapReduce(map, reduce, [], callback);
}
TestUtils.startIgniteNode(computeMapReduceGetAndPut);
@@ -350,7 +350,7 @@ testComputeMapReduceGetAndRemoveObject = function() {
entries.push(new CacheEntry(key1, val1));
entries.push(new CacheEntry(key2, val2));
- ignite.compute().execute(map, reduce, entries, callback);
+ ignite.compute().mapReduce(map, reduce, entries, callback);
}
TestUtils.startIgniteNode(computeMapReduceGetAndRemove);
@@ -386,7 +386,7 @@ function computeRunScript(ignite, error) {
TestUtils.testDone();
}
- comp.runScript(f, "GridGain", onEnd.bind(null));
+ comp.run(f, "GridGain", onEnd.bind(null));
}
function computeExecute(error, ignite) {
@@ -423,7 +423,7 @@ function computeExecute(error, ignite) {
TestUtils.testDone();
}
- ignite.compute().execute(map, reduce, "Hi Alice", callback);
+ ignite.compute().mapReduce(map, reduce, "Hi Alice", callback);
}
function computeAllNodeExecute(error, ignite) {
@@ -448,7 +448,7 @@ function computeAllNodeExecute(error, ignite) {
TestUtils.testDone();
}
- ignite.compute().execute(map, reduce, "", callback);
+ ignite.compute().mapReduce(map, reduce, "", callback);
}
function computeCacheExecute(error, ignite) {
@@ -521,7 +521,7 @@ function computeCacheExecute(error, ignite) {
entries.push(new CacheEntry(key2, val2));
ignite.cache("mycache").putAll(entries, function(err) {
- ignite.compute().execute(map, reduce, [key1, val1], callback);
+ ignite.compute().mapReduce(map, reduce, [key1, val1], callback);
});
}
@@ -561,7 +561,7 @@ function computeCacheSizeExecute(error, ignite) {
ignite.cache("mycache").put("key", "val",
function(err) {
- ignite.compute().execute(map, reduce, "", callback);
+ ignite.compute().mapReduce(map, reduce, "", callback);
});
}
@@ -616,7 +616,7 @@ function testComputeWithErrors(map) {
TestUtils.testDone();
}
- ignite.compute().execute(map, function (args) {}, "Hi Alice", callback);
+ ignite.compute().mapReduce(map, function (args) {}, "Hi Alice", callback);
}
TestUtils.startIgniteNode(computeErrorExecute);
[37/50] [abbrv] incubator-ignite git commit: Javadoc fixed
Posted by iv...@apache.org.
Javadoc fixed
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ab655edf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ab655edf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ab655edf
Branch: refs/heads/ignite-961
Commit: ab655edf102328c654cac3dbd1ab31db1392fa47
Parents: a747ca4
Author: agura <ag...@gridgain.com>
Authored: Fri Jul 10 17:10:09 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Fri Jul 10 17:10:09 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/configuration/CacheConfiguration.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ab655edf/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 63c7269..57f1e9d 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -828,7 +828,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
/**
* Gets caching mode to use. You can configure cache either to be local-only,
- * fully replicated, partitioned, or near. If not provided, {@link CacheMode#REPLICATED}
+ * fully replicated, partitioned, or near. If not provided, {@link CacheMode#PARTITIONED}
* mode will be used by default (defined by {@link #DFLT_CACHE_MODE} constant).
*
* @return {@code True} if cache is local.
[11/50] [abbrv] incubator-ignite git commit: #ignite-964: NodeJs add
method ignite.destroyCache()
Posted by iv...@apache.org.
#ignite-964: NodeJs add method ignite.destroyCache()
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8733ba25
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8733ba25
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8733ba25
Branch: refs/heads/ignite-961
Commit: 8733ba258a004d9ce74665ce90c5c8289014ec0f
Parents: ae2d0c2
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Jul 8 20:31:32 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Jul 8 20:31:32 2015 +0300
----------------------------------------------------------------------
.../processors/rest/GridRestCommand.java | 3 ++
.../handlers/cache/GridCacheCommandHandler.java | 35 +++++++++++++++++--
modules/nodejs/src/main/js/ignite.js | 11 ++++++
.../ignite/internal/NodeJsIgniteSelfTest.java | 7 ++++
modules/nodejs/src/test/js/test-ignite.js | 36 ++++++++++++++++++++
.../http/jetty/GridJettyRestHandler.java | 3 +-
6 files changed, 91 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8733ba25/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
index 987269c..00eb746 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
@@ -132,6 +132,9 @@ public enum GridRestCommand {
/** Get or create cache. */
GET_OR_CREATE_CACHE("getorcreatecache"),
+ /** Stops dynamically started cache. */
+ DESTROY_CACHE("destroycache"),
+
/** Run script. */
RUN_SCRIPT("runscript"),
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8733ba25/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
index abc195c..c20360a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
@@ -53,6 +53,7 @@ import static org.apache.ignite.transactions.TransactionIsolation.*;
public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
/** Supported commands. */
private static final Collection<GridRestCommand> SUPPORTED_COMMANDS = U.sealList(
+ DESTROY_CACHE,
GET_OR_CREATE_CACHE,
CACHE_CONTAINS_KEYS,
CACHE_CONTAINS_KEY,
@@ -156,6 +157,12 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
IgniteInternalFuture<GridRestResponse> fut;
switch (cmd) {
+ case DESTROY_CACHE: {
+ fut = ctx.closure().callLocalSafe(new DestroyCacheCommand(ctx, cacheName));
+
+ break;
+ }
+
case GET_OR_CREATE_CACHE: {
fut = ctx.closure().callLocalSafe(new GetOrCreateCacheCallable(ctx, cacheName));
@@ -1331,14 +1338,36 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
}
/**
- * Map reduce callable.
+ * Destroy cache callable.
+ */
+ private static class DestroyCacheCommand extends GetOrCreateCacheCallable {
+
+ public DestroyCacheCommand(GridKernalContext ctx, String cacheName) {
+ super(ctx, cacheName);
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridRestResponse call() throws Exception {
+ try {
+ ctx.grid().destroyCache(cacheName);
+
+ return new GridRestResponse();
+ }
+ catch (Exception e) {
+ return new GridRestResponse(GridRestResponse.STATUS_FAILED, e.getMessage());
+ }
+ }
+ }
+
+ /**
+ * Get or create cache callable.
*/
private static class GetOrCreateCacheCallable implements Callable<GridRestResponse> {
/** Kernal context. */
- private GridKernalContext ctx;
+ protected GridKernalContext ctx;
/** Cache name. */
- private String cacheName;
+ protected String cacheName;
/**
* @param ctx Kernal context.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8733ba25/modules/nodejs/src/main/js/ignite.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/ignite.js b/modules/nodejs/src/main/js/ignite.js
index cbe8552..5dfb15b 100644
--- a/modules/nodejs/src/main/js/ignite.js
+++ b/modules/nodejs/src/main/js/ignite.js
@@ -74,6 +74,17 @@ Ignite.prototype.getOrCreateCache = function(cacheName, callback) {
}
/**
+ * Stops dynamically started cache
+ *
+ * @this {Ignite}
+ * @param {string} cacheName Cache name to stop
+ * @param {noValue} callback Callback contains only error
+ */
+Ignite.prototype.destroyCache = function(cacheName, callback) {
+ this._server.runCommand(new Command("destroycache").addParam("cacheName", cacheName), callback);
+}
+
+/**
* Get an instance of compute
*
* @this {Ignite}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8733ba25/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsIgniteSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsIgniteSelfTest.java b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsIgniteSelfTest.java
index 293409b..dcb0aa4 100644
--- a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsIgniteSelfTest.java
+++ b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsIgniteSelfTest.java
@@ -58,4 +58,11 @@ public class NodeJsIgniteSelfTest extends NodeJsAbstractTest {
public void testCluster() throws Exception {
runJsScript("testCluster");
}
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDestroyCache() throws Exception {
+ runJsScript("testDestroyCache");
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8733ba25/modules/nodejs/src/test/js/test-ignite.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/test/js/test-ignite.js b/modules/nodejs/src/test/js/test-ignite.js
index 99c5242..29501d7 100644
--- a/modules/nodejs/src/test/js/test-ignite.js
+++ b/modules/nodejs/src/test/js/test-ignite.js
@@ -78,4 +78,40 @@ testCluster = function() {
}
TestUtils.startIgniteNode(onStart.bind(null));
+}
+
+testDestroyCache = function() {
+ var cacheName = "NEW_CACHE";
+
+ function onErrorPut(err) {
+ assert(err !== null);
+
+ TestUtils.testDone();
+ }
+
+ function onDestroy(cache, err) {
+ assert(err === null, err);
+
+ cache.put("1", "1", onErrorPut);
+ }
+
+ function onPut(ignite, cache, err) {
+ assert(err === null, err);
+
+ ignite.destroyCache(cacheName, onDestroy.bind(null, cache));
+ }
+
+ function onGetOrCreateCache(ignite, err, cache) {
+ assert(err === null, err);
+
+ cache.put("1", "1", onPut.bind(null, ignite, cache));
+ }
+
+ function onStart(err, ignite) {
+ assert.equal(err, null);
+
+ ignite.getOrCreateCache(cacheName, onGetOrCreateCache.bind(null, ignite));
+ }
+
+ TestUtils.startIgniteNode(onStart.bind(null));
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8733ba25/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index 13917f8..d601c17 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -360,7 +360,8 @@ public class GridJettyRestHandler extends AbstractHandler {
GridRestRequest restReq;
switch (cmd) {
- case GET_OR_CREATE_CACHE: {
+ case GET_OR_CREATE_CACHE:
+ case DESTROY_CACHE: {
GridRestCacheRequest restReq0 = new GridRestCacheRequest();
restReq0.cacheName((String)params.get("cacheName"));
[03/50] [abbrv] incubator-ignite git commit: Redundant dependencies
removed from ignite-kafka module
Posted by iv...@apache.org.
Redundant dependencies removed from ignite-kafka module
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4c9d8c2e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4c9d8c2e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4c9d8c2e
Branch: refs/heads/ignite-961
Commit: 4c9d8c2e4d5421d4088a3f3bfe3f17df589a4f0f
Parents: 23dc8fc
Author: agura <ag...@gridgain.com>
Authored: Wed Jul 8 17:09:19 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Wed Jul 8 17:09:56 2015 +0300
----------------------------------------------------------------------
modules/kafka/pom.xml | 11 -----------
1 file changed, 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4c9d8c2e/modules/kafka/pom.xml
----------------------------------------------------------------------
diff --git a/modules/kafka/pom.xml b/modules/kafka/pom.xml
index d0e9cd9..c492100 100644
--- a/modules/kafka/pom.xml
+++ b/modules/kafka/pom.xml
@@ -87,17 +87,6 @@
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.gridgain</groupId>
- <artifactId>ignite-shmem</artifactId>
- <version>1.0.0</version>
- </dependency>
-
- <dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-spring</artifactId>
<version>${project.version}</version>
[30/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'remotes/origin/master' into ignite-964-1
Posted by iv...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-964-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/91f18fb6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/91f18fb6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/91f18fb6
Branch: refs/heads/ignite-961
Commit: 91f18fb634caa9e97ab73b31f8014859bfad9403
Parents: acb5626 6386794
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 10 10:51:00 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 10 10:51:00 2015 +0300
----------------------------------------------------------------------
.../examples/ScalarCacheAffinityExample.scala | 2 +-
.../scalar/examples/ScalarCacheExample.scala | 2 +-
.../ScalarCachePopularNumbersExample.scala | 2 +-
.../examples/ScalarCacheQueryExample.scala | 2 +-
.../examples/ScalarSnowflakeSchemaExample.scala | 4 +-
.../java/org/apache/ignite/IgniteCache.java | 14 +-
.../org/apache/ignite/cache/CacheManager.java | 13 +-
.../apache/ignite/internal/IgniteKernal.java | 2 +-
.../discovery/GridDiscoveryManager.java | 23 +-
.../cache/DynamicCacheChangeRequest.java | 39 +-
.../processors/cache/GridCacheGateway.java | 4 +-
.../GridCachePartitionExchangeManager.java | 6 +-
.../processors/cache/GridCacheProcessor.java | 102 ++-
.../processors/cache/IgniteCacheProxy.java | 448 +++++++---
.../distributed/dht/GridDhtCacheEntry.java | 4 +-
.../GridDhtPartitionsExchangeFuture.java | 30 +-
.../datastreamer/DataStreamProcessor.java | 3 +
.../ignite/internal/util/IgniteUtils.java | 6 +-
.../visor/cache/VisorCacheStopTask.java | 2 +-
.../tcp/internal/TcpDiscoveryNode.java | 8 +-
.../affinity/IgniteClientNodeAffinityTest.java | 14 +-
.../IgniteFairAffinityDynamicCacheSelfTest.java | 3 +-
...cheStoreSessionListenerAbstractSelfTest.java | 111 ++-
.../GridCacheTxLoadFromStoreOnLockSelfTest.java | 34 +-
.../CacheMetricsForClusterGroupSelfTest.java | 10 +-
.../cache/CacheOffheapMapEntrySelfTest.java | 7 +-
.../cache/CacheStopAndDestroySelfTest.java | 859 +++++++++++++++++++
...eUsageMultinodeDynamicStartAbstractTest.java | 2 +-
...ProjectionForCachesOnDaemonNodeSelfTest.java | 2 +-
.../cache/IgniteDynamicCacheStartSelfTest.java | 140 +--
...teCacheClientNodePartitionsExchangeTest.java | 29 +-
...CacheLocalOffHeapAndSwapMetricsSelfTest.java | 2 +-
.../DataStreamerMultinodeCreateCacheTest.java | 14 +-
.../testsuites/IgniteCacheTestSuite4.java | 2 +
.../CacheConfigurationP2PTestClient.java | 4 +-
.../testsuites/IgniteHadoopTestSuite.java | 2 +-
.../util/spring/IgniteSpringHelperImpl.java | 10 +-
.../IgniteExcludeInConfigurationTest.java | 5 +-
.../org/apache/ignite/spring/sprint-exclude.xml | 19 +
.../visor/commands/open/VisorOpenCommand.scala | 2 +-
40 files changed, 1633 insertions(+), 354 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91f18fb6/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
[36/50] [abbrv] incubator-ignite git commit: #ignite-964: wip.
Posted by iv...@apache.org.
#ignite-964: wip.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b19536b7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b19536b7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b19536b7
Branch: refs/heads/ignite-961
Commit: b19536b7397a25a42d38e3a6029c793c070d8592
Parents: 5390b67
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 10 16:50:20 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 10 16:50:20 2015 +0300
----------------------------------------------------------------------
.../scripting/IgniteScriptingProcessor.java | 37 ++++++++++-
.../scripting/ScriptingCacheEntry.java | 8 +--
.../processors/scripting/ScriptingJsCache.java | 70 ++++++++++----------
.../scripting/ScriptingObjectConverter.java | 19 ++++++
4 files changed, 93 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b19536b7/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
index cf380c0..9ff89e2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
@@ -23,6 +23,8 @@ import org.apache.ignite.internal.processors.*;
import javax.script.*;
+import java.lang.reflect.*;
+
import static javax.script.ScriptContext.*;
/**
@@ -30,7 +32,14 @@ import static javax.script.ScriptContext.*;
*/
public class IgniteScriptingProcessor extends GridProcessorAdapter {
/** Javascript engine name. */
- public static final String JAVA_SCRIPT_ENGINE_NAME = "nashorn";
+ public static final String JAVA_SCRIPT_ENGINE_NAME = "javascript";
+
+ /** Java8 scripting converter class. */
+ private static final String CONV_CLS_JAVA8 =
+ "org.apache.ignite.internal.processors.scripting.ScriptingObjectConverter8";
+
+ /** Script object converter. */
+ private ScriptingObjectConverter converter;
/** Javascript engine. */
private ScriptEngine jsEngine;
@@ -44,6 +53,20 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@Override public void start() throws IgniteCheckedException {
+ try {
+ Class<?> cls = Class.forName(CONV_CLS_JAVA8);
+
+ Constructor<?> ctor = cls.getConstructor(GridKernalContext.class);
+
+ converter = (ScriptingObjectConverter)ctor.newInstance(ctx);
+ }
+ catch (ClassNotFoundException ignored) {
+ converter = new ScriptingObjectConverter();
+ }
+ catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) {
+ throw new IgniteCheckedException("Failed to initialize HTTP REST protocol.", e);
+ }
+
ScriptEngineManager factory = new ScriptEngineManager();
jsEngine = factory.getEngineByName(JAVA_SCRIPT_ENGINE_NAME);
@@ -145,11 +168,19 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
}
}
+ /**
+ * @param o Object.
+ * @return Object for script.
+ */
public Object toScriptingObject(Object o) {
-
+ return converter.toScriptingObject(o);
}
+ /**
+ * @param o Object.
+ * @return Object for Ignite cache.
+ */
public Object toJavaObject(Object o) {
-
+ return converter.toJavaObject(o);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b19536b7/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingCacheEntry.java
index bcb2458..adb43d1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingCacheEntry.java
@@ -16,13 +16,13 @@ public class ScriptingCacheEntry {
* @param val Value.
*/
public ScriptingCacheEntry(Object key, Object val) {
- if (key instanceof ScriptingObjectConverter8)
- this.key = ((ScriptingObjectConverter8)key).getFields();
+ if (key instanceof ScriptingObjectConverter)
+ this.key = ((ScriptingObjectConverter)key).getFields();
else
this.key = key;
- if (val instanceof ScriptingObjectConverter8)
- this.val = ((ScriptingObjectConverter8)val).getFields();
+ if (val instanceof ScriptingObjectConverter)
+ this.val = ((ScriptingObjectConverter)val).getFields();
else
this.val = val;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b19536b7/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
index 9ab5e21..ce3975f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.scripting;
import org.apache.ignite.*;
import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.json.*;
import java.util.*;
@@ -30,10 +29,13 @@ public class ScriptingJsCache {
/** Ignite cache. */
private IgniteCache<Object, Object> cache;
+ /** Scripting processor. */
+ private IgniteScriptingProcessor proc;
+
/**
* @param cache Ignite cache.
*/
- public ScriptingJsCache(IgniteCache cache) {
+ public ScriptingJsCache(IgniteCache cache, IgniteScriptingProcessor proc) {
this.cache = cache;
}
@@ -42,8 +44,8 @@ public class ScriptingJsCache {
* @param val Value.
*/
public void put(Object key, Object val) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
- Object cacheVal = JSONCacheObject.toSimpleObject(val);
+ Object cacheKey = proc.toJavaObject(key);
+ Object cacheVal = proc.toJavaObject(val);
cache.put(cacheKey, cacheVal);
}
@@ -52,9 +54,9 @@ public class ScriptingJsCache {
* @param key Key.
*/
public Object get(Object key) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
+ Object cacheKey = proc.toJavaObject(key);
- return ScriptingObjectConverter8.convertToRestObject(cache.get(cacheKey));
+ return proc.toScriptingObject(cache.get(cacheKey));
}
/**
@@ -62,7 +64,7 @@ public class ScriptingJsCache {
* @return True if cache contains key.
*/
public boolean containsKey(Object key) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
+ Object cacheKey = proc.toJavaObject(key);
return cache.containsKey(cacheKey);
}
@@ -72,7 +74,7 @@ public class ScriptingJsCache {
* @return True if cache contains key.
*/
public boolean containsKeys(List keys) {
- List<Object> cacheKeys = (List<Object>)JSONCacheObject.toSimpleObject(keys);
+ List<Object> cacheKeys = (List<Object>)proc.toJavaObject(keys);
return cache.containsKeys(new HashSet<>(cacheKeys));
}
@@ -82,7 +84,7 @@ public class ScriptingJsCache {
* @return Cache entries.
*/
public List<ScriptingCacheEntry> getAll(List keys) {
- List cacheKeys = (List)JSONCacheObject.toSimpleObject(keys);
+ List cacheKeys = (List)proc.toJavaObject(keys);
Map<Object, Object> entries = cache.getAll(new HashSet<>(cacheKeys));
@@ -90,8 +92,8 @@ public class ScriptingJsCache {
for (Map.Entry<Object, Object> e : entries.entrySet())
res.add(new ScriptingCacheEntry(
- ScriptingObjectConverter8.convertToRestObject(e.getKey()),
- ScriptingObjectConverter8.convertToRestObject(e.getValue())));
+ proc.toScriptingObject(e.getKey()),
+ proc.toScriptingObject(e.getValue())));
return res;
}
@@ -100,7 +102,7 @@ public class ScriptingJsCache {
* @param keys Keys.
*/
public void removeAll(List keys) {
- List cacheKeys = (List)JSONCacheObject.toSimpleObject(keys);
+ List cacheKeys = (List)proc.toJavaObject(keys);
cache.removeAll(new HashSet<>(cacheKeys));
}
@@ -109,7 +111,7 @@ public class ScriptingJsCache {
* @param entries Entries.
*/
public void putAll(List entries) {
- List cacheKeys = (List)JSONCacheObject.toSimpleObject(entries);
+ List cacheKeys = (List)proc.toJavaObject(entries);
Map<Object, Object> cacheEntries = U.newHashMap(entries.size());
@@ -127,10 +129,10 @@ public class ScriptingJsCache {
* @return Previous value.
*/
public Object getAndPut(Object key, Object val) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
- Object cacheVal = JSONCacheObject.toSimpleObject(val);
+ Object cacheKey = proc.toJavaObject(key);
+ Object cacheVal = proc.toJavaObject(val);
- return ScriptingObjectConverter8.convertToRestObject(cache.getAndPut(cacheKey, cacheVal));
+ return proc.toScriptingObject(cache.getAndPut(cacheKey, cacheVal));
}
/**
@@ -139,10 +141,10 @@ public class ScriptingJsCache {
* @return Previous value.
*/
public Object getAndReplace(Object key, Object val) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
- Object cacheVal = JSONCacheObject.toSimpleObject(val);
+ Object cacheKey = proc.toJavaObject(key);
+ Object cacheVal = proc.toJavaObject(val);
- Object o = ScriptingObjectConverter8.convertToRestObject(cache.getAndReplace(cacheKey, cacheVal));
+ Object o = proc.toScriptingObject(cache.getAndReplace(cacheKey, cacheVal));
return o;
}
@@ -153,10 +155,10 @@ public class ScriptingJsCache {
* @return Previous value.
*/
public Object getAndPutIfAbsent(Object key, Object val) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
- Object cacheVal = JSONCacheObject.toSimpleObject(val);
+ Object cacheKey = proc.toJavaObject(key);
+ Object cacheVal = proc.toJavaObject(val);
- return ScriptingObjectConverter8.convertToRestObject(cache.getAndPutIfAbsent(cacheKey, cacheVal));
+ return proc.toScriptingObject(cache.getAndPutIfAbsent(cacheKey, cacheVal));
}
/**
@@ -164,9 +166,9 @@ public class ScriptingJsCache {
* @return Previous value.
*/
public Object getAndRemove(Object key) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
+ Object cacheKey = proc.toJavaObject(key);
- return ScriptingObjectConverter8.convertToRestObject(cache.getAndRemove(cacheKey));
+ return proc.toScriptingObject(cache.getAndRemove(cacheKey));
}
/**
@@ -174,7 +176,7 @@ public class ScriptingJsCache {
* @return If operation success.
*/
public boolean remove(Object key) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
+ Object cacheKey = proc.toJavaObject(key);
return cache.remove(cacheKey);
}
@@ -185,8 +187,8 @@ public class ScriptingJsCache {
* @return If operation success.
*/
public boolean removeValue(Object key, Object val) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
- Object cacheVal = JSONCacheObject.toSimpleObject(val);
+ Object cacheKey = proc.toJavaObject(key);
+ Object cacheVal = proc.toJavaObject(val);
return cache.remove(cacheKey, cacheVal);
}
@@ -197,8 +199,8 @@ public class ScriptingJsCache {
* @return If operation success.
*/
public boolean replace(Object key, Object val) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
- Object cacheVal = JSONCacheObject.toSimpleObject(val);
+ Object cacheKey = proc.toJavaObject(key);
+ Object cacheVal = proc.toJavaObject(val);
return cache.replace(cacheKey, cacheVal);
}
@@ -210,9 +212,9 @@ public class ScriptingJsCache {
* @return If operation success.
*/
public boolean replaceValue(Object key, Object val, Object oldVal) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
- Object cacheVal = JSONCacheObject.toSimpleObject(val);
- Object oldCacheVal = JSONCacheObject.toSimpleObject(oldVal);
+ Object cacheKey = proc.toJavaObject(key);
+ Object cacheVal = proc.toJavaObject(val);
+ Object oldCacheVal = proc.toJavaObject(oldVal);
return cache.replace(cacheKey, oldCacheVal, cacheVal);
}
@@ -230,8 +232,8 @@ public class ScriptingJsCache {
* @return Previous value.
*/
public Object putIfAbsent(Object key, Object val) {
- Object cacheKey = JSONCacheObject.toSimpleObject(key);
- Object cacheVal = JSONCacheObject.toSimpleObject(val);
+ Object cacheKey = proc.toJavaObject(key);
+ Object cacheVal = proc.toJavaObject(val);
return cache.putIfAbsent(cacheKey, cacheVal);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b19536b7/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java
index a02a762..7e2758b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java
@@ -37,4 +37,23 @@ public class ScriptingObjectConverter {
public Object toJavaObject(Object o) {
return JSONCacheObject.toSimpleObject(o);
}
+
+ /**
+ * @param o Object from script.
+ * @return Object to store in cache.
+ */
+ public Object getField(String key, Object o) {
+ if (o instanceof JSONCacheObject)
+ return ((JSONCacheObject)o).getField(key);
+
+ return null;
+ }
+
+ /**
+ * @param o Object from script.
+ * @return Object to store in cache.
+ */
+ public Object getFields(Object o) {
+ return JSONCacheObject.toSimpleObject(o);
+ }
}
[22/50] [abbrv] incubator-ignite git commit: #ignite-964: change
map-reduce-example.js
Posted by iv...@apache.org.
#ignite-964: change map-reduce-example.js
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/29300a4d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/29300a4d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/29300a4d
Branch: refs/heads/ignite-961
Commit: 29300a4dc3f90dbf1e13c1a5a30a83b20abd6bdd
Parents: 9413747
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jul 9 18:15:40 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jul 9 18:15:40 2015 +0300
----------------------------------------------------------------------
examples/src/main/js/cache-api-example.js | 2 +-
examples/src/main/js/cache-put-get-example.js | 2 +-
examples/src/main/js/map-reduce-example.js | 72 +++++++++++++++-------
examples/src/main/js/run-cache-script.js | 13 ++--
examples/src/main/js/run-function-example.js | 50 ++++++++++-----
5 files changed, 94 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/29300a4d/examples/src/main/js/cache-api-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-api-example.js b/examples/src/main/js/cache-api-example.js
index 1514941..9308353 100644
--- a/examples/src/main/js/cache-api-example.js
+++ b/examples/src/main/js/cache-api-example.js
@@ -24,7 +24,7 @@ var Ignition = apacheIgnite.Ignition;
* Remote nodes should always be started with special configuration file which
* enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
* <p>
- * Alternatively you can run {@link ExampleJsNodeStartup} in another JVM which will
+ * Alternatively you can run ExampleJsNodeStartup in another JVM which will
* start node with {@code examples/config/js/example-js-cache.xml} configuration.
*/
function main() {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/29300a4d/examples/src/main/js/cache-put-get-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-put-get-example.js b/examples/src/main/js/cache-put-get-example.js
index 80c2080..bf2c472 100644
--- a/examples/src/main/js/cache-put-get-example.js
+++ b/examples/src/main/js/cache-put-get-example.js
@@ -25,7 +25,7 @@ var CacheEntry = apacheIgnite.CacheEntry;
* Remote nodes should always be started with special configuration file which
* enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
* <p>
- * Alternatively you can run {@link ExampleJsNodeStartup} in another JVM which will
+ * Alternatively you can run ExampleJsNodeStartup in another JVM which will
* start node with {@code examples/config/js/example-js-cache.xml} configuration.
*/
function main() {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/29300a4d/examples/src/main/js/map-reduce-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/map-reduce-example.js b/examples/src/main/js/map-reduce-example.js
index e6d7ee9..e56b99d 100644
--- a/examples/src/main/js/map-reduce-example.js
+++ b/examples/src/main/js/map-reduce-example.js
@@ -18,39 +18,65 @@
var apacheIgnite = require("apache-ignite");
var Ignition = apacheIgnite.Ignition;
-Ignition.start(['127.0.0.1:9095'], null, onConnect);
+/**
+ * Demonstrates a simple use of Compute.mapReduce.
+ * <p>
+ * Phrase passed as task argument is split into jobs each taking one word. Then jobs are distributed among
+ * cluster nodes. Each node computes word length and returns result to master node where total phrase length
+ * is calculated on reduce stage.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code examples/config/js/example-js-cache.xml}.
+ * <p>
+ * Alternatively you can run ExampleJsNodeStartup in another JVM which will start node
+ * with {@code examples/config/js/example-js-cache.xml} configuration.
+ */
+function main() {
+ /** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
+ Ignition.start(['127.0.0.1:9095'], null, onConnect);
-function onConnect(err, ignite) {
- console.log(">>> Compute task split example started.");
+ function onConnect(err, ignite) {
+ console.log(">>> Compute map reduce example started.");
- var map = function(nodes, args) {
- var words = args.split(" ");
+ /**
+ * Splits the received string to words, creates a child job for each word, and sends
+ * these jobs to other nodes for processing. Each such job simply prints out the received word.
+ */
+ var map = function(nodes, str) {
+ var words = str.split(" ");
- for (var i = 0; i < words.length; i++) {
- var f = function (word) {
- print(">>> Printing '" + word + "' on this node from ignite job.");
+ for (var i = 0; i < words.length; i++) {
+ var job = function (word) {
+ print(">>> Printing '" + word + "' on this node from job.");
- return word.length;
- };
+ return word.length;
+ };
- emit(f, words[i], nodes[i % nodes.length]);
+ emit(job, words[i], nodes[i % nodes.length]);
+ }
}
- }
- var reduce = function(results) {
- var sum = 0;
+ /**
+ * Reduces results received so far into one compound result to be returned.
+ */
+ var reduce = function(results) {
+ var sum = 0;
+
+ for (var i = 0; i < results.length; ++i) {
+ sum += results[i];
+ }
- for (var i = 0; i < results.length; ++i) {
- sum += results[i];
+ return sum;
}
- return sum;
- }
+ // Called when map reduced finished.
+ var onMapReduce = function(err, cnt) {
+ console.log(">>> Total number of characters in the phrase is '" + cnt + "'.");
+ console.log(">>> End of compute map reduce example.");
+ }
- var onMapReduce = function(err, cnt) {
- console.log(">>> Total number of characters in the phrase is '" + cnt + "'.");
- console.log(">>> Check all nodes for output (this node is also part of the cluster).");
+ ignite.compute().execute(map, reduce, "Hello Ignite Enabled World!", onMapReduce);
}
+}
- ignite.compute().execute(map, reduce, "Hello Ignite Enabled World!", onMapReduce);
-}
\ No newline at end of file
+main();
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/29300a4d/examples/src/main/js/run-cache-script.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/run-cache-script.js b/examples/src/main/js/run-cache-script.js
index 1640cea..d4d72cc 100644
--- a/examples/src/main/js/run-cache-script.js
+++ b/examples/src/main/js/run-cache-script.js
@@ -24,7 +24,7 @@ var Ignition = apacheIgnite.Ignition;
* Remote nodes should always be started with special configuration file which
* enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
* <p>
- * Alternatively you can run {@link ExampleJsNodeStartup} in another JVM which will
+ * Alternatively you can run ExampleJsNodeStartup in another JVM which will
* start node with {@code examples/config/js/example-js-cache.xml} configuration.
*/
function main() {
@@ -63,12 +63,15 @@ function main() {
return val.salary;
}
- var onRunScript = function(err, salary) {
+ /** Run remote job on server ignite node with arguments [cacheName, key]. */
+ ignite.compute().runScript(job, [cacheName, key], onRun);
+
+ var onRun = function(err, salary) {
console.log(">>> " + key + "'s salary is " + salary);
- }
- /** Run remote job on server ignite node with arguments [cacheName, key]. */
- ignite.compute().runScript(job, [cacheName, key], onRunScript);
+ // Destroying cache.
+ ignite.destroyCache(cacheName, function(err) { console.log(">>> End of run cache script example."); });
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/29300a4d/examples/src/main/js/run-function-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/run-function-example.js b/examples/src/main/js/run-function-example.js
index 1005c9f..832f9d6 100644
--- a/examples/src/main/js/run-function-example.js
+++ b/examples/src/main/js/run-function-example.js
@@ -18,27 +18,47 @@
var apacheIgnite = require("apache-ignite");
var Ignition = apacheIgnite.Ignition;
-Ignition.start(['127.0.0.1:9095'], null, onConnect);
+/**
+ * Demonstrates using of Compute job execution on the cluster.
+ * <p>
+ * This example takes a sentence composed of multiple words and counts number of non-space
+ * characters in the sentence by having each compute job count characters in each individual
+ * word.
+* <p>
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
+ * <p>
+ * Alternatively you can run ExampleJsNodeStartup in another JVM which will
+ * start node with {@code examples/config/js/example-js-cache.xml} configuration.
+ */
+function main() {
+ /** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
+ Ignition.start(['127.0.0.1:9095'], null, onConnect);
-function onConnect(err, ignite) {
- console.log(">>> Compute callable example started");
+ function onConnect(err, ignite) {
+ console.log(">>> Compute callable example started");
- var f = function (args) {
- var words = args.split(" ");
+ var job = function (args) {
+ var words = args.split(" ");
- var sum = 0;
+ var sum = 0;
- for (var i = 0; i < words.length; ++i) {
- sum += words[i].length;
+ for (var i = 0; i < words.length; ++i) {
+ sum += words[i].length;
+ }
+
+ return sum;
}
- return sum;
- }
+ // Execute job on ignite server node.
+ ignite.compute().runScript(job, "Hello Ignite Enabled World!", onRun);
- var onRunScript = function(err, sum) {
- console.log(">>> Total number of characters in the phrase is '" + sum + "'.");
- console.log(">>> Check all nodes for output (this node is also part of the cluster).");
+ function onRun(err, sum) {
+ console.log(">>> Total number of characters in the phrase is '" + sum + "'.");
+ console.log(">>> End of compute callable example.");
+ }
}
+}
- ignite.compute().runScript(f, "Hello Ignite Enabled World!", onRunScript);
-}
\ No newline at end of file
+main();
\ No newline at end of file
[46/50] [abbrv] incubator-ignite git commit: # ignite-648:
Implemented.
Posted by iv...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
new file mode 100644
index 0000000..b15b6ef
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
@@ -0,0 +1,602 @@
+/*
+ * 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.junits.multijvm;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.internal.util.future.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.mxbean.*;
+import org.jetbrains.annotations.*;
+
+import javax.cache.*;
+import javax.cache.CacheManager;
+import javax.cache.configuration.*;
+import javax.cache.expiry.*;
+import javax.cache.integration.*;
+import javax.cache.processor.*;
+import java.util.*;
+import java.util.concurrent.locks.*;
+
+/**
+ * Ignite cache proxy for ignite instance at another JVM.
+ */
+@SuppressWarnings("TransientFieldInNonSerializableClass")
+public class IgniteCacheProcessProxy<K, V> implements IgniteCache<K, V> {
+ /** Compute. */
+ private final transient IgniteCompute compute;
+
+ /** Cache name. */
+ private final String cacheName;
+
+ /** Grid id. */
+ private final UUID gridId;
+
+ /** With async. */
+ private final boolean isAsync;
+
+ /** Ignite proxy. */
+ private final transient IgniteProcessProxy igniteProxy;
+
+ /**
+ * @param name Name.
+ * @param proxy Ignite Process Proxy.
+ */
+ public IgniteCacheProcessProxy(String name, IgniteProcessProxy proxy) {
+ this(name, false, proxy);
+ }
+
+ /**
+ * @param name Name.
+ * @param async
+ * @param proxy Ignite Process Proxy.
+ */
+ public IgniteCacheProcessProxy(String name, boolean async, IgniteProcessProxy proxy) {
+ cacheName = name;
+ isAsync = async;
+ gridId = proxy.getId();
+ igniteProxy = proxy;
+ compute = proxy.remoteCompute();
+ }
+
+ /**
+ * Returns cache instance. Method to be called from closure at another JVM.
+ *
+ * @return Cache.
+ */
+ private IgniteCache<Object, Object> cache() {
+ IgniteCache cache = Ignition.ignite(gridId).cache(cacheName);
+
+ if (isAsync)
+ cache = cache.withAsync();
+
+ return cache;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteCache<K, V> withAsync() {
+ return new IgniteCacheProcessProxy<>(cacheName, true, igniteProxy);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isAsync() {
+ return isAsync;
+ }
+
+ /** {@inheritDoc} */
+ @Override public <R> IgniteFuture<R> future() {
+ // Return fake future. Future should be called in the same place where operation done.
+ return new IgniteFinishedFutureImpl<>();
+ }
+
+ /** {@inheritDoc} */
+ @Override public <C extends Configuration<K, V>> C getConfiguration(final Class<C> clazz) {
+ final Class cl = clazz;
+
+ return (C)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().getConfiguration(cl);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public Entry<K, V> randomEntry() {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteCache<K, V> withExpiryPolicy(ExpiryPolicy plc) {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteCache<K, V> withSkipStore() {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ @Override public IgniteCache<K, V> withNoRetries() {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void loadCache(@Nullable IgniteBiPredicate<K, V> p, @Nullable Object... args) throws CacheException {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void localLoadCache(@Nullable final IgniteBiPredicate<K, V> p, @Nullable final Object... args) throws CacheException {
+ final IgniteBiPredicate pCopy = p;
+
+ compute.run(new IgniteRunnable() {
+ @Override public void run() {
+ cache().localLoadCache(pCopy, args);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public V getAndPutIfAbsent(final K key, final V val) throws CacheException {
+ return (V)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().getAndPutIfAbsent(key, val);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public Lock lock(K key) {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public Lock lockAll(Collection<? extends K> keys) {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isLocalLocked(final K key, final boolean byCurrThread) {
+ return compute.call(new IgniteCallable<Boolean>() {
+ @Override public Boolean call() throws Exception {
+ return cache().isLocalLocked(key, byCurrThread);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public <R> QueryCursor<R> query(Query<R> qry) {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public Iterable<Entry<K, V>> localEntries(final CachePeekMode... peekModes) throws CacheException {
+ return (Iterable<Entry<K, V>>)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ Collection<Entry> res = new ArrayList<>();
+
+ for (Entry e : cache().localEntries(peekModes))
+ res.add(e);
+
+ return res;
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public QueryMetrics queryMetrics() {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void localEvict(final Collection<? extends K> keys) {
+ compute.run(new IgniteRunnable() {
+ @Override public void run() {
+ cache().localEvict(keys);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public V localPeek(final K key, final CachePeekMode... peekModes) {
+ return (V)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().localPeek(key, peekModes);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public void localPromote(Set<? extends K> keys) throws CacheException {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public int size(final CachePeekMode... peekModes) throws CacheException {
+ return (int)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().size(peekModes);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public int localSize(final CachePeekMode... peekModes) {
+ return (int)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().localSize(peekModes);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> Map<K, EntryProcessorResult<T>> invokeAll(Map<? extends K, ? extends EntryProcessor<K, V, T>> map,
+ Object... args) {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public V get(final K key) {
+ return (V)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().get(key);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public Map<K, V> getAll(final Set<? extends K> keys) {
+ return (Map<K, V>)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().getAll(keys);
+ }
+ });
+ }
+
+ @Override public Map<K, V> getAllOutTx(final Set<? extends K> keys) {
+ return (Map<K, V>)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().getAllOutTx(keys);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean containsKey(final K key) {
+ return (boolean)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().containsKey(key);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public void loadAll(Set<? extends K> keys, boolean replaceExistingValues, CompletionListener completionLsnr) {
+ throw new UnsupportedOperationException("Oparetion can't be supported automatically.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean containsKeys(final Set<? extends K> keys) {
+ return (boolean)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().containsKeys(keys);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public void put(final K key, final V val) {;
+ compute.run(new IgniteRunnable() {
+ @Override public void run() {
+ cache().put(key, val);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public V getAndPut(final K key, final V val) {
+ return (V)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().getAndPut(key, val);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public void putAll(final Map<? extends K, ? extends V> map) {
+ compute.run(new IgniteRunnable() {
+ @Override public void run() {
+ cache().putAll(map);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean putIfAbsent(final K key, final V val) {
+ return (boolean)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().putIfAbsent(key, val);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean remove(final K key) {
+ return (boolean)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().remove(key);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean remove(final K key, final V oldVal) {
+ return (boolean)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().remove(key, oldVal);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public V getAndRemove(final K key) {
+ return (V)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().getAndRemove(key);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean replace(final K key, final V oldVal, final V newVal) {
+ return (boolean)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().replace(key, oldVal, newVal);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean replace(final K key, final V val) {
+ return (boolean)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().replace(key, val);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public V getAndReplace(final K key, final V val) {
+ return (V)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().getAndReplace(key, val);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public void removeAll(final Set<? extends K> keys) {
+ compute.run(new IgniteRunnable() {
+ @Override public void run() {
+ cache().removeAll(keys);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public void removeAll() {
+ compute.run(new IgniteRunnable() {
+ @Override public void run() {
+ IgniteCache<Object, Object> cache = cache();
+
+ cache.removeAll();
+
+ if (isAsync)
+ cache.future().get();
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public void clear() {
+ compute.run(new IgniteRunnable() {
+ @Override public void run() {
+ cache().clear();
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public void clear(final K key) {
+ compute.run(new IgniteRunnable() {
+ @Override public void run() {
+ cache().clear(key);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public void clearAll(final Set<? extends K> keys) {
+ compute.run(new IgniteRunnable() {
+ @Override public void run() {
+ cache().clearAll(keys);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public void localClear(final K key) {
+ compute.run(new IgniteRunnable() {
+ @Override public void run() {
+ cache().localClear(key);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public void localClearAll(final Set<? extends K> keys) {
+ compute.run(new IgniteRunnable() {
+ @Override public void run() {
+ cache().localClearAll(keys);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> T invoke(final K key, final EntryProcessor<K, V, T> entryProcessor, final Object... arguments) {
+ return (T)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().invoke(key,
+ (EntryProcessor<Object, Object, Object>)entryProcessor, arguments);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> T invoke(final K key, final CacheEntryProcessor<K, V, T> entryProcessor, final Object... arguments) {
+ return (T)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().invoke(key,
+ (CacheEntryProcessor<Object, Object, Object>)entryProcessor, arguments);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> Map<K, EntryProcessorResult<T>> invokeAll(final Set<? extends K> keys, final EntryProcessor<K, V, T> entryProcessor,
+ final Object... args) {
+ return (Map<K, EntryProcessorResult<T>>)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().invokeAll(keys,
+ (EntryProcessor<Object, Object, Object>)entryProcessor, args);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getName() {
+ return (String)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().getName();
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public CacheManager getCacheManager() {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void close() {
+ compute.run(new IgniteRunnable() {
+ @Override public void run() {
+ cache().close();
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public void destroy() {
+ compute.run(new IgniteRunnable() {
+ @Override public void run() {
+ cache().destroy();
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isClosed() {
+ return (boolean)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().isClosed();
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> T unwrap(final Class<T> clazz) {
+ if (Ignite.class.equals(clazz))
+ return (T)igniteProxy;
+
+ try {
+ return (T)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ return cache().unwrap(clazz);
+ }
+ });
+ }
+ catch (Exception e) {
+ throw new IllegalArgumentException("Looks like class " + clazz + " is unmarshallable. Exception type:" + e.getClass(), e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void registerCacheEntryListener(CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void deregisterCacheEntryListener(CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public Iterator<Entry<K, V>> iterator() {
+ final Collection<Entry<K, V>> col = (Collection<Entry<K, V>>)compute.call(new IgniteCallable<Object>() {
+ @Override public Object call() throws Exception {
+ Collection res = new ArrayList();
+
+ for (Object o : cache())
+ res.add(o);
+
+ return res;
+ }
+ });
+
+ return col.iterator();
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> Map<K, EntryProcessorResult<T>> invokeAll(Set<? extends K> keys,
+ CacheEntryProcessor<K, V, T> entryProcessor, Object... args) {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteFuture<?> rebalance() {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public CacheMetrics metrics() {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public CacheMetrics metrics(ClusterGroup grp) {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public CacheMetricsMXBean mxBean() {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteClusterProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteClusterProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteClusterProcessProxy.java
new file mode 100644
index 0000000..159c451
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteClusterProcessProxy.java
@@ -0,0 +1,320 @@
+/*
+ * 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.junits.multijvm;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.internal.cluster.*;
+import org.apache.ignite.lang.*;
+import org.jetbrains.annotations.*;
+
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+/**
+ * Proxy class for cluster at another JVM.
+ */
+@SuppressWarnings("TransientFieldInNonSerializableClass")
+public class IgniteClusterProcessProxy implements IgniteClusterEx {
+ /** Grid id. */
+ private final UUID gridId;
+
+ /** Compute. */
+ private final transient IgniteCompute compute;
+
+ /** */
+ private final IgniteProcessProxy proxy;
+
+ /**
+ * @param proxy Ignite Proxy.
+ */
+ public IgniteClusterProcessProxy(IgniteProcessProxy proxy) {
+ this.proxy = proxy;
+ gridId = proxy.getId();
+ compute = proxy.remoteCompute();
+ }
+
+ /**
+ * Returns cluster instance. Method to be called from closure at another JVM.
+ *
+ * @return Cache.
+ */
+ private IgniteClusterEx cluster() {
+ return (IgniteClusterEx)Ignition.ignite(gridId).cluster();
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroupEx forSubjectId(final UUID subjId) {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forCacheNodes(@Nullable String cacheName, boolean affNodes, boolean nearNodes,
+ boolean clientNodes) {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterNode localNode() {
+ return compute.call(new IgniteCallable<ClusterNode>() {
+ @Override public ClusterNode call() throws Exception {
+ return cluster().localNode();
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forLocal() {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K, V> ConcurrentMap<K, V> nodeLocalMap() {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean pingNode(UUID nodeId) {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public long topologyVersion() {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<ClusterNode> topology(long topVer) throws UnsupportedOperationException {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K> Map<ClusterNode, Collection<K>> mapKeysToNodes(@Nullable String cacheName,
+ @Nullable Collection<? extends K> keys) throws IgniteException {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K> ClusterNode mapKeyToNode(@Nullable String cacheName, K key) throws IgniteException {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<ClusterStartNodeResult> startNodes(File file, boolean restart, int timeout,
+ int maxConn) throws IgniteException {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<ClusterStartNodeResult> startNodes(Collection<Map<String, Object>> hosts,
+ @Nullable Map<String, Object> dflts, boolean restart, int timeout, int maxConn) throws IgniteException {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void stopNodes() throws IgniteException {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void stopNodes(Collection<UUID> ids) throws IgniteException {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void restartNodes() throws IgniteException {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void restartNodes(Collection<UUID> ids) throws IgniteException {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void resetMetrics() {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteCluster withAsync() {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isAsync() {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <R> IgniteFuture<R> future() {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public Ignite ignite() {
+ return proxy;
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forNodes(Collection<? extends ClusterNode> nodes) {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forNode(ClusterNode node, ClusterNode... nodes) {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forOthers(ClusterNode node, ClusterNode... nodes) {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forOthers(ClusterGroup prj) {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forNodeIds(Collection<UUID> ids) {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forNodeId(UUID id, UUID... ids) {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forPredicate(IgnitePredicate<ClusterNode> p) {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forAttribute(String name, @Nullable Object val) {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forServers() {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forClients() {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forCacheNodes(String cacheName) {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forDataNodes(String cacheName) {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forClientNodes(String cacheName) {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forRemotes() {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forHost(ClusterNode node) {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forHost(String host, String... hosts) {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forDaemons() {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forRandom() {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forOldest() {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup forYoungest() {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<ClusterNode> nodes() {
+ return compute.call(new IgniteCallable<Collection<ClusterNode>>() {
+ @Override public Collection<ClusterNode> call() throws Exception {
+ return cluster().nodes();
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterNode node(final UUID nid) {
+ return compute.call(new IgniteCallable<ClusterNode>() {
+ @Override public ClusterNode call() throws Exception {
+ return cluster().node(nid);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterNode node() {
+ return compute.call(new IgniteCallable<ClusterNode>() {
+ @Override public ClusterNode call() throws Exception {
+ return cluster().node();
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<String> hostNames() {
+ return compute.call(new IgniteCallable<Collection<String>>() {
+ @Override public Collection<String> call() throws Exception {
+ return cluster().hostNames();
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgnitePredicate<ClusterNode> predicate() {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterMetrics metrics() throws IgniteException {
+ throw new UnsupportedOperationException("Operation is not supported yet.");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteEventsProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteEventsProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteEventsProcessProxy.java
new file mode 100644
index 0000000..018aa8d
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteEventsProcessProxy.java
@@ -0,0 +1,148 @@
+/*
+ * 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.junits.multijvm;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.events.*;
+import org.apache.ignite.lang.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+
+/**
+ * Ignite events proxy for ignite instance at another JVM.
+ */
+@SuppressWarnings("TransientFieldInNonSerializableClass")
+public class IgniteEventsProcessProxy implements IgniteEvents {
+ /** Ignite proxy. */
+ private final transient IgniteProcessProxy igniteProxy;
+
+ /** Grid id. */
+ private final UUID gridId;
+
+ /**
+ * @param igniteProxy Ignite proxy.
+ */
+ public IgniteEventsProcessProxy(IgniteProcessProxy igniteProxy) {
+ this.igniteProxy = igniteProxy;
+
+ gridId = igniteProxy.getId();
+ }
+
+ /**
+ * @return Events instance.
+ */
+ private IgniteEvents events() {
+ return Ignition.ignite(gridId).events();
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterGroup clusterGroup() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T extends Event> List<T> remoteQuery(IgnitePredicate<T> p, long timeout,
+ @Nullable int... types) throws IgniteException {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T extends Event> UUID remoteListen(@Nullable IgniteBiPredicate<UUID, T> locLsnr,
+ @Nullable IgnitePredicate<T> rmtFilter, @Nullable int... types) throws IgniteException {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T extends Event> UUID remoteListen(int bufSize, long interval, boolean autoUnsubscribe,
+ @Nullable IgniteBiPredicate<UUID, T> locLsnr, @Nullable IgnitePredicate<T> rmtFilter,
+ @Nullable int... types) throws IgniteException {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void stopRemoteListen(UUID opId) throws IgniteException {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T extends Event> T waitForLocal(@Nullable IgnitePredicate<T> filter,
+ @Nullable int... types) throws IgniteException {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T extends Event> Collection<T> localQuery(IgnitePredicate<T> p, @Nullable int... types) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void recordLocal(Event evt) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void localListen(final IgnitePredicate<? extends Event> lsnr, final int... types) {
+ igniteProxy.remoteCompute().run(new IgniteRunnable() {
+ @Override public void run() {
+ events().localListen(lsnr, types);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean stopLocalListen(IgnitePredicate<? extends Event> lsnr, @Nullable int... types) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void enableLocal(int... types) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void disableLocal(int... types) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public int[] enabledEvents() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isEnabled(int type) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteEvents withAsync() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isAsync() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <R> IgniteFuture<R> future() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
new file mode 100644
index 0000000..2703d2b
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
@@ -0,0 +1,184 @@
+/*
+ * 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.junits.multijvm;
+
+import com.thoughtworks.xstream.*;
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.util.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.marshaller.optimized.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import sun.jvmstat.monitor.*;
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+/**
+ * Run ignite node.
+ */
+public class IgniteNodeRunner {
+ /** */
+ private static final String IGNITE_CONFIGURATION_FILE = System.getProperty("java.io.tmpdir") +
+ File.separator + "igniteConfiguration.tmp_";
+
+ /** */
+ private static volatile Ignite ignite;
+
+ /**
+ * Starts {@link Ignite} instance accorging to given arguments.
+ *
+ * @param args Arguments.
+ * @throws Exception If failed.
+ */
+ public static void main(String[] args) throws Exception {
+ X.println(GridJavaProcess.PID_MSG_PREFIX + U.jvmPid());
+
+ X.println("Starting Ignite Node... Args=" + Arrays.toString(args));
+
+ IgniteConfiguration cfg = readCfgFromFileAndDeleteFile(args[0]);
+
+ ignite = Ignition.start(cfg);
+ }
+
+ /**
+ * @return Ignite instance started at main.
+ */
+ public static IgniteEx startedInstance(){
+ return (IgniteEx)ignite;
+ }
+
+ /**
+ * @return <code>True</code> if there is ignite node started via {@link IgniteNodeRunner} at this JVM.
+ */
+ public static boolean hasStartedInstance() {
+ return ignite != null;
+ }
+
+ /**
+ * Stores {@link IgniteConfiguration} to file as xml.
+ *
+ * @param cfg Ignite Configuration.
+ * @return A name of file where the configuration was stored.
+ * @throws IOException If failed.
+ * @see #readCfgFromFileAndDeleteFile(String)
+ */
+ public static String storeToFile(IgniteConfiguration cfg) throws IOException {
+ String fileName = IGNITE_CONFIGURATION_FILE + cfg.getNodeId();
+
+ // Check marshaller configuration, because read configuration method expect specific marshaller.
+ if (cfg.getMarshaller() instanceof OptimizedMarshaller){
+ OptimizedMarshaller marsh = (OptimizedMarshaller)cfg.getMarshaller();
+
+ try {
+ Field isRequireFiled = marsh.getClass().getDeclaredField("requireSer");
+
+ isRequireFiled.setAccessible(true);
+
+ boolean isRequireSer = isRequireFiled.getBoolean(marsh);
+
+ if (isRequireSer)
+ throw new UnsupportedOperationException("Unsupported marshaller configuration. " +
+ "readCfgFromFileAndDeleteFile method expect " + OptimizedMarshaller.class.getSimpleName() +
+ "with requireSerializeble flag in 'false'.");
+ }
+ catch (NoSuchFieldException|IllegalAccessException e) {
+ throw new IgniteException("Failed to check filed of " + OptimizedMarshaller.class.getSimpleName(), e);
+ }
+ }
+ else
+ throw new UnsupportedOperationException("Unsupported marshaller. " +
+ "readCfgFromFileAndDeleteFile method expect " + OptimizedMarshaller.class.getSimpleName());
+
+ try(OutputStream out = new BufferedOutputStream(new FileOutputStream(fileName))) {
+ cfg.setMBeanServer(null);
+ cfg.setMarshaller(null);
+ cfg.setDiscoverySpi(null);
+ cfg.setGridLogger(null);
+
+ new XStream().toXML(cfg, out);
+ }
+
+ return fileName;
+ }
+
+ /**
+ * Reads configuration from given file and delete the file after.
+ *
+ * @param fileName File name.
+ * @return Readed configuration.
+ * @throws IOException If failed.
+ * @see #storeToFile(IgniteConfiguration)
+ */
+ private static IgniteConfiguration readCfgFromFileAndDeleteFile(String fileName) throws IOException {
+ try(BufferedReader cfgReader = new BufferedReader(new FileReader(fileName))) {
+ IgniteConfiguration cfg = (IgniteConfiguration)new XStream().fromXML(cfgReader);
+
+ cfg.setMarshaller(new OptimizedMarshaller(false));
+
+ TcpDiscoverySpi disco = new TcpDiscoverySpi();
+ disco.setIpFinder(GridCacheAbstractFullApiSelfTest.LOCAL_IP_FINDER);
+ cfg.setDiscoverySpi(disco);
+
+ return cfg;
+ }
+ finally {
+ new File(fileName).delete();
+ }
+ }
+
+ /**
+ * Kill all Jvm runned by {#link IgniteNodeRunner}. Works based on jps command.
+ *
+ * @return List of killed process ids.
+ * @throws Exception If exception.
+ */
+ public static List<Integer> killAll() throws Exception{
+ MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost(new HostIdentifier("localhost"));
+
+ Set<Integer> jvms = monitoredHost.activeVms();
+
+ List<Integer> res = new ArrayList<>();
+
+ for (Integer jvmId : jvms) {
+ try {
+ MonitoredVm vm = monitoredHost.getMonitoredVm(new VmIdentifier("//" + jvmId + "?mode=r"), 0);
+
+ if (IgniteNodeRunner.class.getName().equals(MonitoredVmUtil.mainClass(vm, true))) {
+ Process killProc = U.isWindows() ?
+ Runtime.getRuntime().exec(new String[] {"taskkill", "/pid", jvmId.toString(), "/f", "/t"}) :
+ Runtime.getRuntime().exec(new String[] {"kill", "-9", jvmId.toString()});
+
+ killProc.waitFor();
+
+ res.add(jvmId);
+ }
+ }
+ catch (Exception e) {
+ // Print stack trace just for information.
+ X.printerrln("Could not kill IgniteNodeRunner java processes. Jvm pid = " + jvmId, e);
+ }
+ }
+
+ return res;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
new file mode 100644
index 0000000..220424a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
@@ -0,0 +1,571 @@
+/*
+ * 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.junits.multijvm;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.events.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.cluster.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.hadoop.*;
+import org.apache.ignite.internal.util.*;
+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.lang.*;
+import org.apache.ignite.plugin.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+
+/**
+ * Ignite proxy for ignite instance at another JVM.
+ */
+@SuppressWarnings("TransientFieldInNonSerializableClass")
+public class IgniteProcessProxy implements IgniteEx {
+ /** Grid proxies. */
+ private static final transient ConcurrentMap<String, IgniteProcessProxy> gridProxies = new ConcurrentHashMap<>();
+
+ /** Jvm process with ignite instance. */
+ private final transient GridJavaProcess proc;
+
+ /** Configuration. */
+ private final transient IgniteConfiguration cfg;
+
+ /** Local JVM grid. */
+ private final transient Ignite locJvmGrid;
+
+ /** Logger. */
+ private final transient IgniteLogger log;
+
+ /** Grid id. */
+ private final UUID id = UUID.randomUUID();
+
+ /**
+ * @param cfg Configuration.
+ * @param log Logger.
+ * @param locJvmGrid Local JVM grid.
+ */
+ public IgniteProcessProxy(final IgniteConfiguration cfg, final IgniteLogger log, final Ignite locJvmGrid)
+ throws Exception {
+ this.cfg = cfg;
+ this.locJvmGrid = locJvmGrid;
+ this.log = log.getLogger("jvm-" + id.toString().substring(0, id.toString().indexOf('-')));
+
+ String cfgFileName = IgniteNodeRunner.storeToFile(cfg.setNodeId(id));
+
+ List<String> jvmArgs = U.jvmArgs();
+
+ Collection<String> filteredJvmArgs = new ArrayList<>();
+
+ for (String arg : jvmArgs) {
+ if(!arg.toLowerCase().startsWith("-agentlib"))
+ filteredJvmArgs.add(arg);
+ }
+
+ final CountDownLatch rmtNodeStartedLatch = new CountDownLatch(1);
+
+ locJvmGrid.events().localListen(new NodeStartedListener(id, rmtNodeStartedLatch), EventType.EVT_NODE_JOINED);
+
+ proc = GridJavaProcess.exec(
+ IgniteNodeRunner.class,
+ cfgFileName, // Params.
+ this.log,
+ // Optional closure to be called each time wrapped process prints line to system.out or system.err.
+ new IgniteInClosure<String>() {
+ @Override public void apply(String s) {
+ IgniteProcessProxy.this.log.info(s);
+ }
+ },
+ null,
+ filteredJvmArgs, // JVM Args.
+ System.getProperty("surefire.test.class.path")
+ );
+
+ assert rmtNodeStartedLatch.await(30, TimeUnit.SECONDS): "Remote node has not joined [id=" + id + ']';
+
+ IgniteProcessProxy prevVal = gridProxies.putIfAbsent(cfg.getGridName(), this);
+
+ if (prevVal != null) {
+ remoteCompute().run(new IgniteRunnable() {
+ @Override public void run() {
+ G.stop(cfg.getGridName(), true);
+ }
+ });
+
+ throw new IllegalStateException("There was found instance assotiated with " + cfg.getGridName() +
+ ", instance= " + prevVal + ". New started node was stopped.");
+ }
+ }
+
+ /**
+ */
+ private static class NodeStartedListener extends IgnitePredicateX<Event> {
+ /** Id. */
+ private final UUID id;
+
+ /** Remote node started latch. */
+ private final CountDownLatch rmtNodeStartedLatch;
+
+ /**
+ * @param id Id.
+ * @param rmtNodeStartedLatch Remote node started latch.
+ */
+ NodeStartedListener(UUID id, CountDownLatch rmtNodeStartedLatch) {
+ this.id = id;
+ this.rmtNodeStartedLatch = rmtNodeStartedLatch;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean applyx(Event e) {
+ if (((DiscoveryEvent)e).eventNode().id().equals(id)) {
+ rmtNodeStartedLatch.countDown();
+
+ return false;
+ }
+
+ return true;
+ }
+ }
+
+ /**
+ * @param gridName Grid name.
+ * @return Instance by name or exception wiil be thrown.
+ */
+ public static IgniteProcessProxy ignite(String gridName) {
+ IgniteProcessProxy res = gridProxies.get(gridName);
+
+ if (res == null)
+ throw new IgniteIllegalStateException("Grid instance was not properly started " +
+ "or was already stopped: " + gridName + ". All known grid instances: " + gridProxies.keySet());
+
+ return res;
+ }
+
+ /**
+ * @param gridName Grid name.
+ * @param cancel Cacnel flag.
+ */
+ public static void stop(final String gridName, final boolean cancel) {
+ IgniteProcessProxy proxy = gridProxies.get(gridName);
+
+ if (proxy != null) {
+ proxy.remoteCompute().run(new IgniteRunnable() {
+ @Override public void run() {
+ G.stop(gridName, cancel);
+ }
+ });
+
+ gridProxies.remove(gridName, proxy);
+ }
+ }
+
+ /**
+ * For usage in closures.
+ *
+ * @return Ignite instance.
+ */
+ private Ignite igniteById() {
+ return Ignition.ignite(id);
+ }
+
+ /**
+ * @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 IgniteIllegalStateException Thrown if grid was not properly initialized or grid instance was stopped or
+ * was not started.
+ */
+ public static Ignite ignite(UUID locNodeId) {
+ A.notNull(locNodeId, "locNodeId");
+
+ for (IgniteProcessProxy ignite : gridProxies.values()) {
+ if (ignite.getId().equals(locNodeId))
+ return ignite;
+ }
+
+ throw new IgniteIllegalStateException("Grid instance with given local node ID was not properly " +
+ "started or was stopped: " + locNodeId);
+ }
+
+ /**
+ * Kill all running processes.
+ */
+ public static void killAll() {
+ for (IgniteProcessProxy ignite : gridProxies.values()) {
+ try {
+ ignite.getProcess().kill();
+ }
+ catch (Exception e) {
+ U.error(ignite.log, "Killing failed.", e);
+ }
+ }
+
+ gridProxies.clear();
+ }
+
+ /**
+ * @return Local JVM grid instance.
+ */
+ public Ignite localJvmGrid() {
+ return locJvmGrid;
+ }
+
+ /**
+ * @return Grid id.
+ */
+ public UUID getId() {
+ return id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String name() {
+ return cfg.getGridName();
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteLogger log() {
+ return log;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteConfiguration configuration() {
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K extends GridCacheUtilityKey, V> IgniteInternalCache<K, V> utilityCache() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public <K, V> IgniteInternalCache<K, V> cachex(@Nullable String name) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public <K, V> IgniteInternalCache<K, V> cachex() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<IgniteInternalCache<?, ?>> cachesx(
+ @Nullable IgnitePredicate<? super IgniteInternalCache<?, ?>>... p) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean eventUserRecordable(int type) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean allEventsUserRecordable(int[] types) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isJmxRemoteEnabled() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isRestartEnabled() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public IgniteFileSystem igfsx(@Nullable String name) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public Hadoop hadoop() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteClusterEx cluster() {
+ return new IgniteClusterProcessProxy(this);
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public String latestVersion() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterNode localNode() {
+ return remoteCompute().call(new IgniteCallable<ClusterNode>() {
+ @Override public ClusterNode call() throws Exception {
+ return ((IgniteEx)Ignition.ignite(id)).localNode();
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridKernalContext context() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteCompute compute() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteCompute compute(ClusterGroup grp) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteMessaging message() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteMessaging message(ClusterGroup grp) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteEvents events() {
+ return new IgniteEventsProcessProxy(this);
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteEvents events(ClusterGroup grp) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteServices services() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteServices services(ClusterGroup grp) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ExecutorService executorService() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public ExecutorService executorService(ClusterGroup grp) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteProductVersion version() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteScheduler scheduler() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K, V> IgniteCache<K, V> createCache(CacheConfiguration<K, V> cacheCfg) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K, V> IgniteCache<K, V> createCache(String cacheName) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K, V> IgniteCache<K, V> getOrCreateCache(CacheConfiguration<K, V> cacheCfg) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K, V> IgniteCache<K, V> getOrCreateCache(String cacheName) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K, V> void addCacheConfiguration(CacheConfiguration<K, V> cacheCfg) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K, V> IgniteCache<K, V> createCache(CacheConfiguration<K, V> cacheCfg,
+ NearCacheConfiguration<K, V> nearCfg) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K, V> IgniteCache<K, V> getOrCreateCache(CacheConfiguration<K, V> cacheCfg,
+ NearCacheConfiguration<K, V> nearCfg) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K, V> IgniteCache<K, V> createNearCache(@Nullable String cacheName, NearCacheConfiguration<K, V> nearCfg) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K, V> IgniteCache<K, V> getOrCreateNearCache(@Nullable String cacheName,
+ NearCacheConfiguration<K, V> nearCfg) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void destroyCache(String cacheName) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K, V> IgniteCache<K, V> cache(@Nullable final String name) {
+ return new IgniteCacheProcessProxy<>(name, this);
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteTransactions transactions() {
+ throw new UnsupportedOperationException("Transactions can't be supported automatically in multi JVM mode.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K, V> IgniteDataStreamer<K, V> dataStreamer(@Nullable String cacheName) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteFileSystem fileSystem(String name) {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<IgniteFileSystem> fileSystems() {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteAtomicSequence atomicSequence(String name, long initVal, boolean create) throws IgniteException {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteAtomicLong atomicLong(String name, long initVal, boolean create) throws IgniteException {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> IgniteAtomicReference<T> atomicReference(String name, @Nullable T initVal,
+ boolean create) throws IgniteException {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T, S> IgniteAtomicStamped<T, S> atomicStamped(String name, @Nullable T initVal, @Nullable S initStamp,
+ boolean create) throws IgniteException {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteCountDownLatch countDownLatch(String name, int cnt, boolean autoDel,
+ boolean create) throws IgniteException {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> IgniteQueue<T> queue(String name, int cap,
+ @Nullable CollectionConfiguration cfg) throws IgniteException {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T> IgniteSet<T> set(String name, @Nullable CollectionConfiguration cfg) throws IgniteException {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public <T extends IgnitePlugin> T plugin(String name) throws PluginNotFoundException {
+ throw new UnsupportedOperationException("Operation isn't supported yet.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void close() throws IgniteException {
+ final CountDownLatch rmtNodeStoppedLatch = new CountDownLatch(1);
+
+ locJvmGrid.events().localListen(new IgnitePredicateX<Event>() {
+ @Override public boolean applyx(Event e) {
+ if (((DiscoveryEvent)e).eventNode().id().equals(id)) {
+ rmtNodeStoppedLatch.countDown();
+
+ return false;
+ }
+
+ return true;
+ }
+ }, EventType.EVT_NODE_LEFT, EventType.EVT_NODE_FAILED);
+
+ compute().run(new IgniteRunnable() {
+ @Override public void run() {
+ igniteById().close();
+ }
+ });
+
+ try {
+ assert U.await(rmtNodeStoppedLatch, 15, TimeUnit.SECONDS) : "NodeId=" + id;
+ }
+ catch (IgniteInterruptedCheckedException e) {
+ throw new IgniteException(e);
+ }
+
+ try {
+ getProcess().kill();
+ }
+ catch (Exception e) {
+ X.printerr("Could not kill process after close.", e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public <K> Affinity<K> affinity(String cacheName) {
+ return new AffinityProcessProxy<>(cacheName, this);
+ }
+
+ /**
+ * @return Jvm process in which grid node started.
+ */
+ public GridJavaProcess getProcess() {
+ return proc;
+ }
+
+ /**
+ * @return {@link IgniteCompute} instance to communicate with remote node.
+ */
+ public IgniteCompute remoteCompute() {
+ ClusterGroup grp = locJvmGrid.cluster().forNodeId(id);
+
+ if (grp.nodes().isEmpty())
+ throw new IllegalStateException("Could not found node with id=" + id + ".");
+
+ return locJvmGrid.compute(grp);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java
new file mode 100644
index 0000000..272305b
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java
@@ -0,0 +1,89 @@
+/*
+ * 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.testsuites;
+
+import junit.framework.*;
+import org.apache.ignite.internal.processors.cache.multijvm.*;
+
+/**
+ * Multi-JVM test suite.
+ */
+public class IgniteCacheFullApiMultiJvmSelfTestSuite extends TestSuite {
+ /**
+ * @return Multi-JVM tests suite.
+ * @throws Exception If failed.
+ */
+ public static TestSuite suite() throws Exception {
+ TestSuite suite = new TestSuite("Cache Full API Multi Jvm Test Suite");
+
+ // Multi-node.
+ suite.addTestSuite(GridCacheReplicatedMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheReplicatedMultiJvmP2PDisabledFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheReplicatedAtomicMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheReplicatedAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.class);
+
+ suite.addTestSuite(GridCachePartitionedMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCachePartitionedCopyOnReadDisabledMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheAtomicMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheAtomicCopyOnReadDisabledMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCachePartitionedMultiJvmP2PDisabledFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheAtomicMultiJvmP2PDisabledFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderMultiJvmP2PDisabledFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheAtomicNearEnabledMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheAtomicNearEnabledPrimaryWriteOrderMultiJvmFullApiSelfTest.class);
+
+ suite.addTestSuite(GridCachePartitionedNearDisabledMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCachePartitionedNearDisabledMultiJvmP2PDisabledFullApiSelfTest.class);
+
+ suite.addTestSuite(GridCacheNearOnlyMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheNearOnlyMultiJvmP2PDisabledFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheReplicatedNearOnlyMultiJvmFullApiSelfTest.class);
+
+ suite.addTestSuite(GridCacheAtomicClientOnlyMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheAtomicClientOnlyMultiJvmP2PDisabledFullApiSelfTest.class);
+
+ suite.addTestSuite(GridCacheAtomicNearOnlyMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheAtomicNearOnlyMultiJvmP2PDisabledFullApiSelfTest.class);
+
+ suite.addTestSuite(GridCachePartitionedFairAffinityMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCachePartitionedNearDisabledFairAffinityMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheAtomicFairAffinityMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheAtomicNearEnabledFairAffinityMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderFairAffinityMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheNearOnlyFairAffinityMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheAtomicClientOnlyFairAffinityMultiJvmFullApiSelfTest.class);
+
+ // Multi-node with off-heap values.
+ suite.addTestSuite(GridCacheReplicatedOffHeapMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCachePartitionedOffHeapMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheAtomicOffHeapMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheAtomicPrimaryWrityOrderOffHeapMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCachePartitionedNearDisabledOffHeapMultiJvmFullApiSelfTest.class);
+
+ // Multi-node with off-heap tiered mode.
+ suite.addTestSuite(GridCacheReplicatedOffHeapTieredMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCachePartitionedOffHeapTieredMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheAtomicOffHeapTieredMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCacheAtomicPrimaryWrityOrderOffHeapTieredMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCachePartitionedNearDisabledOffHeapTieredMultiJvmFullApiSelfTest.class);
+ suite.addTestSuite(GridCachePartitionedNearDisabledAtomicOffHeapTieredMultiJvmFullApiSelfTest.class);
+
+ return suite;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index bfa9f62..dbaa330 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -720,5 +720,45 @@
</plugins>
</build>
</profile>
+
+ <profile>
+ <id>tools.jar-default</id>
+
+ <activation>
+ <file>
+ <exists>${java.home}/../lib/tools.jar</exists>
+ </file>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.sun</groupId>
+ <artifactId>tools</artifactId>
+ <version>1.4.2</version>
+ <scope>system</scope>
+ <systemPath>${java.home}/../lib/tools.jar</systemPath>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>tools.jar-mac</id>
+
+ <activation>
+ <file>
+ <exists>${java.home}/../Classes/classes.jar</exists>
+ </file>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.sun</groupId>
+ <artifactId>tools</artifactId>
+ <version>1.4.2</version>
+ <scope>system</scope>
+ <systemPath>${java.home}/../Classes/classes.jar</systemPath>
+ </dependency>
+ </dependencies>
+ </profile>
</profiles>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8218fe6f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b47d34b..9d1b7d9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -678,7 +678,6 @@
</build>
</profile>
-
<profile>
<id>schema-import</id>
<activation>
[15/50] [abbrv] incubator-ignite git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-gg-10416
Posted by iv...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-gg-10416
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d04c1042
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d04c1042
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d04c1042
Branch: refs/heads/ignite-961
Commit: d04c1042ec120027c1ddc84d672726db7b7135b0
Parents: 8cc75fc c134dcf
Author: Andrey <an...@gridgain.com>
Authored: Thu Jul 9 17:04:20 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Thu Jul 9 17:04:20 2015 +0700
----------------------------------------------------------------------
RELEASE_NOTES.txt | 12 ++
.../src/main/java/org/apache/ignite/Ignite.java | 2 +-
.../configuration/CacheConfiguration.java | 4 +
.../configuration/TransactionConfiguration.java | 23 +++
.../apache/ignite/internal/IgniteKernal.java | 32 +--
.../processors/cache/GridCacheAttributes.java | 3 +
.../processors/cache/GridCacheContext.java | 8 +-
.../processors/cache/GridCacheIoManager.java | 8 +-
.../processors/cache/GridCacheProcessor.java | 118 ++++-------
.../cache/GridCacheSharedContext.java | 15 +-
.../distributed/near/GridNearGetFuture.java | 4 +-
.../cache/jta/CacheJtaManagerAdapter.java | 17 +-
.../cache/jta/CacheNoopJtaManager.java | 2 +-
.../continuous/CacheContinuousQueryHandler.java | 4 +-
.../datastructures/DataStructuresProcessor.java | 39 +++-
.../GridCacheCountDownLatchImpl.java | 15 +-
.../visor/cache/VisorCacheConfiguration.java | 11 -
.../ignite/spi/discovery/tcp/ServerImpl.java | 20 ++
.../tcp/internal/TcpDiscoveryNode.java | 2 +-
.../tcp/internal/TcpDiscoveryNodesRing.java | 8 +-
.../tcp/internal/TcpDiscoveryStatistics.java | 10 +-
...cheStoreSessionListenerAbstractSelfTest.java | 1 -
.../cache/CacheFutureExceptionSelfTest.java | 161 +++++++--------
.../IgniteCacheConfigurationTemplateTest.java | 26 +--
.../cache/IgniteDynamicCacheStartSelfTest.java | 16 +-
.../IgniteDynamicClientCacheStartSelfTest.java | 5 +-
.../IgniteClientDataStructuresAbstractTest.java | 109 +++++++---
.../IgniteCountDownLatchAbstractSelfTest.java | 12 +-
...acheAtomicReplicatedNodeRestartSelfTest.java | 8 +-
.../loadtests/hashmap/GridCacheTestContext.java | 4 +-
.../tcp/TcpDiscoveryMultiThreadedTest.java | 38 ++++
.../IgniteSpiDiscoverySelfTestSuite.java | 3 +
.../HibernateTransactionalDataRegion.java | 12 +-
.../hibernate/HibernateL2CacheSelfTest.java | 7 +-
.../HibernateL2CacheTransactionalSelfTest.java | 5 -
.../apache/ignite/cache/jta/CacheTmLookup.java | 3 +-
.../processors/cache/jta/CacheJtaManager.java | 72 ++++++-
.../cache/jta/GridCacheXAResource.java | 16 +-
.../processors/cache/GridCacheJtaSelfTest.java | 52 +++--
.../GridTmLookupLifecycleAwareSelfTest.java | 29 ++-
modules/kafka/licenses/apache-2.0.txt | 202 +++++++++++++++++++
modules/kafka/pom.xml | 11 -
.../commands/cache/VisorCacheCommand.scala | 2 -
.../config/benchmark-put-indexed-val.properties | 64 ++++++
modules/yardstick/config/ignite-base-config.xml | 23 +++
.../cache/IgnitePutIndexedValue1Benchmark.java | 42 ++++
.../cache/IgnitePutIndexedValue2Benchmark.java | 42 ++++
.../cache/IgnitePutIndexedValue8Benchmark.java | 42 ++++
.../ignite/yardstick/cache/model/Person1.java | 55 +++++
.../ignite/yardstick/cache/model/Person2.java | 67 ++++++
.../ignite/yardstick/cache/model/Person8.java | 109 ++++++++++
51 files changed, 1219 insertions(+), 376 deletions(-)
----------------------------------------------------------------------
[21/50] [abbrv] incubator-ignite git commit: #ignite-964: change
run-cache-script.js
Posted by iv...@apache.org.
#ignite-964: change run-cache-script.js
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9413747c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9413747c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9413747c
Branch: refs/heads/ignite-961
Commit: 9413747ce03999b5e746c4387eae207f75268799
Parents: bfc899e
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jul 9 17:59:17 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jul 9 17:59:17 2015 +0300
----------------------------------------------------------------------
examples/src/main/js/cache-put-get-example.js | 10 +--
.../main/js/compute-callable-cache-example.js | 49 -------------
examples/src/main/js/run-cache-script.js | 76 ++++++++++++++++++++
3 files changed, 81 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9413747c/examples/src/main/js/cache-put-get-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-put-get-example.js b/examples/src/main/js/cache-put-get-example.js
index 75da096..80c2080 100644
--- a/examples/src/main/js/cache-put-get-example.js
+++ b/examples/src/main/js/cache-put-get-example.js
@@ -55,7 +55,7 @@ function main() {
}
function onGet(err, res) {
- console.log("Get val=" + res);
+ console.log("Get value=" + res);
putAllGetAll(ignite, cache);
}
@@ -79,23 +79,23 @@ function main() {
batch.push(new CacheEntry(key, val));
}
+ // Bulk-store entries in cache.
cache.putAll(batch, onPutAll);
function onPutAll(err) {
console.log(">>> Stored values in cache.");
+ // Bulk-get values from cache.
cache.getAll(keys, onGetAll);
}
function onGetAll(err, entries) {
for (var e of entries) {
- console.log("Got entry [key=" + e.key + ", val=" + e.value + ']');
+ console.log("Got entry [key=" + e.key + ", value=" + e.value + ']');
}
// Destroying cache.
- ignite.destroyCache(cacheName, function(err) {
- console.log(">>> End of cache put-get example.");
- });
+ ignite.destroyCache(cacheName, function(err) { console.log(">>> End of cache put-get example."); });
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9413747c/examples/src/main/js/compute-callable-cache-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/compute-callable-cache-example.js b/examples/src/main/js/compute-callable-cache-example.js
deleted file mode 100644
index 1b92d7c..0000000
--- a/examples/src/main/js/compute-callable-cache-example.js
+++ /dev/null
@@ -1,49 +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.
- */
-
-var apacheIgnite = require("apache-ignite");
-var Ignition = apacheIgnite.Ignition;
-
-var cacheName = "ComputeCallableCacheExample";
-
-Ignition.start(['127.0.0.1:9095'], null, onConnect);
-
-function onConnect(err, ignite) {
- console.log(">>> Compute callable example started.");
-
- var f = function (args) {
- print(">>> Hello node: " + ignite.name());
-
- var cache = ignite.getOrCreateCache(args);
-
- cache.put(ignite.name(), "Hello");
-
- return ignite.name();
- }
-
- var onRunScript = function(err, igniteName) {
- var cache = ignite.cache(cacheName);
-
- cache.get(igniteName, function(err, res) {
- console.log(res+ " " + igniteName);
-
- console.log(">>> Check all nodes for output (this node is also part of the cluster).");
- });
- }
-
- ignite.compute().runScript(f, cacheName, onRunScript);
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9413747c/examples/src/main/js/run-cache-script.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/run-cache-script.js b/examples/src/main/js/run-cache-script.js
new file mode 100644
index 0000000..1640cea
--- /dev/null
+++ b/examples/src/main/js/run-cache-script.js
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+var apacheIgnite = require("apache-ignite");
+var Ignition = apacheIgnite.Ignition;
+
+/**
+ * This example demonstrates very basic operations on cache in functions for Compute.run.
+ * <p>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
+ * <p>
+ * Alternatively you can run {@link ExampleJsNodeStartup} in another JVM which will
+ * start node with {@code examples/config/js/example-js-cache.xml} configuration.
+ */
+function main() {
+ /** Cache name. */
+ var cacheName = "RunCacheScriptCache";
+
+ /** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
+ Ignition.start(['127.0.0.1:9095'], null, onConnect);
+
+ function onConnect(err, ignite) {
+ console.log(">>> Run cache script example started.");
+
+ ignite.getOrCreateCache(cacheName, function(err, cache) { runCacheScript(ignite, cache); });
+ }
+
+ function runCacheScript(ignite, cache) {
+ var key = "John";
+ var person = {"firstName": "John", "lastName": "Doe", "salary" : 2000};
+
+ // Store person in the cache
+ cache.put(key, person, onPut);
+
+ function onPut(err) {
+ var job = function (args) {
+ print(">>> Hello node: " + ignite.name());
+
+ var cacheName = args[0];
+ var key = args[1];
+
+ /** Get cache with name. */
+ var cache = ignite.cache(cacheName);
+
+ /** Get person with name John. */
+ var val = cache.get(key);
+
+ return val.salary;
+ }
+
+ var onRunScript = function(err, salary) {
+ console.log(">>> " + key + "'s salary is " + salary);
+ }
+
+ /** Run remote job on server ignite node with arguments [cacheName, key]. */
+ ignite.compute().runScript(job, [cacheName, key], onRunScript);
+ }
+ }
+}
+
+main();
\ No newline at end of file
[49/50] [abbrv] incubator-ignite git commit: Merge branches
'ignite-1076' and 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite
Posted by iv...@apache.org.
Merge branches 'ignite-1076' and 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/aa2d7cb4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/aa2d7cb4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/aa2d7cb4
Branch: refs/heads/ignite-961
Commit: aa2d7cb4a5c9f17d6a7a5b739feee7a2b84aad2b
Parents: 8218fe6 297d250
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Sun Jul 12 14:59:31 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Sun Jul 12 14:59:31 2015 -0700
----------------------------------------------------------------------
.../core/src/main/resources/META-INF/classnames-jdk.properties | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
[29/50] [abbrv] incubator-ignite git commit: #ignite-gg-10526: fix
consistentId.
Posted by iv...@apache.org.
#ignite-gg-10526: fix consistentId.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/63867945
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/63867945
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/63867945
Branch: refs/heads/ignite-961
Commit: 638679451df99499b5699534b39da08b665cf5ba
Parents: e3fba88
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 10 10:42:17 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 10 10:48:38 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/internal/util/IgniteUtils.java | 6 +-----
.../ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java | 8 ++++++--
2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/63867945/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 46a23d6..f457d6c 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
@@ -8048,13 +8048,9 @@ public abstract class IgniteUtils {
public static String consistentId(Collection<String> addrs, int port) {
assert !F.isEmpty(addrs);
- List<String> sortedAddrs = new ArrayList<>(addrs);
-
- Collections.sort(sortedAddrs);
-
StringBuilder sb = new StringBuilder();
- for (String addr : sortedAddrs)
+ for (String addr : addrs)
sb.append(addr).append(',');
sb.delete(sb.length() - 1, sb.length());
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/63867945/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
index 4b4df45..22f56c3 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
@@ -143,13 +143,17 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste
assert ver != null;
this.id = id;
- this.addrs = addrs;
+
+ List<String> sortedAddrs = new ArrayList<>(addrs);
+ Collections.sort(sortedAddrs);
+
+ this.addrs = sortedAddrs;
this.hostNames = hostNames;
this.discPort = discPort;
this.metricsProvider = metricsProvider;
this.ver = ver;
- consistentId = U.consistentId(addrs, discPort);
+ consistentId = U.consistentId(sortedAddrs, discPort);
metrics = metricsProvider.metrics();
cacheMetrics = metricsProvider.cacheMetrics();
[07/50] [abbrv] incubator-ignite git commit: release notes
Posted by iv...@apache.org.
release notes
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/064d079c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/064d079c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/064d079c
Branch: refs/heads/ignite-961
Commit: 064d079ce4f7cc501936b95a1eaae144c6b823bb
Parents: fa5cb91
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jul 8 19:51:33 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jul 8 19:51:33 2015 +0300
----------------------------------------------------------------------
RELEASE_NOTES.txt | 10 ++++++++++
1 file changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/064d079c/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 3a5043e..bcfed27 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,6 +1,16 @@
Apache Ignite Release Notes
===========================
+Apache Ignite In-Memory Data Fabric 1.3
+---------------------------------------
+
+* Added auto-retries for cache operations in recoverable cases.
+* Fixed several issues with JTA integration.
+* Stability fixes for TCP discovery SPI.
+* Stability fixes for onheap and offheap SQL queries.
+* Bug fixes in In-Memory Accelerator For Apache Hadoop.
+* Many stability and fault-tolerance fixes.
+
Apache Ignite In-Memory Data Fabric 1.2
---------------------------------------
[06/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'origin/master'
Posted by iv...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/fa5cb918
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/fa5cb918
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/fa5cb918
Branch: refs/heads/ignite-961
Commit: fa5cb918dcb0fe4253332fd9be859803ad014ddb
Parents: 459d702 4c9d8c2
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jul 8 19:39:36 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jul 8 19:39:36 2015 +0300
----------------------------------------------------------------------
.../configuration/CacheConfiguration.java | 4 +
.../configuration/TransactionConfiguration.java | 23 +++
.../processors/cache/GridCacheAttributes.java | 3 +
.../processors/cache/GridCacheContext.java | 8 +-
.../processors/cache/GridCacheIoManager.java | 8 +-
.../processors/cache/GridCacheProcessor.java | 21 +-
.../cache/GridCacheSharedContext.java | 15 +-
.../distributed/near/GridNearGetFuture.java | 4 +-
.../cache/jta/CacheJtaManagerAdapter.java | 17 +-
.../cache/jta/CacheNoopJtaManager.java | 2 +-
.../visor/cache/VisorCacheConfiguration.java | 11 -
.../cache/CacheFutureExceptionSelfTest.java | 161 +++++++--------
.../loadtests/hashmap/GridCacheTestContext.java | 4 +-
.../HibernateTransactionalDataRegion.java | 12 +-
.../hibernate/HibernateL2CacheSelfTest.java | 7 +-
.../HibernateL2CacheTransactionalSelfTest.java | 5 -
.../apache/ignite/cache/jta/CacheTmLookup.java | 3 +-
.../processors/cache/jta/CacheJtaManager.java | 72 ++++++-
.../cache/jta/GridCacheXAResource.java | 16 +-
.../processors/cache/GridCacheJtaSelfTest.java | 52 +++--
.../GridTmLookupLifecycleAwareSelfTest.java | 29 ++-
modules/kafka/licenses/apache-2.0.txt | 202 +++++++++++++++++++
modules/kafka/pom.xml | 11 -
.../commands/cache/VisorCacheCommand.scala | 2 -
.../config/benchmark-index-put.properties | 64 ------
.../config/benchmark-put-indexed-val.properties | 64 ++++++
.../cache/IgnitePutIndex1Benchmark.java | 42 ----
.../cache/IgnitePutIndex2Benchmark.java | 42 ----
.../cache/IgnitePutIndexedValue1Benchmark.java | 42 ++++
.../cache/IgnitePutIndexedValue2Benchmark.java | 42 ++++
.../cache/IgnitePutIndexedValue8Benchmark.java | 2 +-
.../ignite/yardstick/cache/model/Person1.java | 29 +--
.../ignite/yardstick/cache/model/Person2.java | 45 +----
.../ignite/yardstick/cache/model/Person8.java | 155 +-------------
34 files changed, 661 insertions(+), 558 deletions(-)
----------------------------------------------------------------------
[08/50] [abbrv] incubator-ignite git commit: release notes
Posted by iv...@apache.org.
release notes
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f13f5946
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f13f5946
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f13f5946
Branch: refs/heads/ignite-961
Commit: f13f5946beaae7115f2ca5796988624ac36c193a
Parents: 064d079
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jul 8 19:52:13 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jul 8 19:52:13 2015 +0300
----------------------------------------------------------------------
RELEASE_NOTES.txt | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f13f5946/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index bcfed27..ec8c4e6 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -6,6 +6,7 @@ Apache Ignite In-Memory Data Fabric 1.3
* Added auto-retries for cache operations in recoverable cases.
* Fixed several issues with JTA integration.
+* Fixed issue with GAR files in source release.
* Stability fixes for TCP discovery SPI.
* Stability fixes for onheap and offheap SQL queries.
* Bug fixes in In-Memory Accelerator For Apache Hadoop.