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/10 10:57:23 UTC
[01/50] [abbrv] incubator-ignite git commit: #ignite-964: move
examples to examples module.
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-964 43d8cd3c6 -> 06d3a2969
#ignite-964: move examples to examples 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/5c86f3b0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5c86f3b0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5c86f3b0
Branch: refs/heads/ignite-964
Commit: 5c86f3b01496b5b58a83b41146a4a7869a0c058c
Parents: a5654be
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue Jul 7 17:15:45 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue Jul 7 17:15:45 2015 +0300
----------------------------------------------------------------------
examples/config/js/example-js-cache.xml | 40 ++++++
examples/config/js/rest-jetty.xml | 71 +++++++++++
examples/pom.xml | 6 +
.../examples/js/ExampleJsNodeStartup.java | 36 ++++++
examples/src/main/js/cache-api-example.js | 67 ++++++++++
examples/src/main/js/cache-put-get-example.js | 119 ++++++++++++++++++
examples/src/main/js/cache-query-example.js | 52 ++++++++
.../main/js/compute-callable-cache-example.js | 49 ++++++++
.../src/main/js/compute-callable-example.js | 44 +++++++
.../src/main/js/compute-task-split-example.js | 56 +++++++++
.../IgniteScriptingCommandHandler.java | 2 +-
modules/nodejs/src/main/js/apache-ignite.js | 2 +-
modules/nodejs/src/main/js/cache.js | 10 +-
.../main/js/examples/config/example-ignite.xml | 91 --------------
.../src/main/js/examples/config/rest-jetty.xml | 71 -----------
.../main/js/examples/src/cache-api-example.js | 85 -------------
.../js/examples/src/cache-put-get-example.js | 122 -------------------
.../main/js/examples/src/cache-query-example.js | 59 ---------
.../src/compute-callable-cache-example.js | 57 ---------
.../js/examples/src/compute-callable-example.js | 50 --------
.../js/examples/src/compute-runnable-example.js | 42 -------
.../examples/src/compute-task-split-example.js | 62 ----------
.../ignite/examples/ExampleNodeStartup.java | 36 ------
modules/nodejs/src/test/js/test-cache-api.js | 10 +-
modules/nodejs/src/test/js/test-compute.js | 16 +--
25 files changed, 560 insertions(+), 695 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c86f3b0/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
new file mode 100644
index 0000000..2599e38
--- /dev/null
+++ b/examples/config/js/example-js-cache.xml
@@ -0,0 +1,40 @@
+<?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" />
+
+ <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/5c86f3b0/examples/config/js/rest-jetty.xml
----------------------------------------------------------------------
diff --git a/examples/config/js/rest-jetty.xml b/examples/config/js/rest-jetty.xml
new file mode 100644
index 0000000..abc146b
--- /dev/null
+++ b/examples/config/js/rest-jetty.xml
@@ -0,0 +1,71 @@
+<?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/5c86f3b0/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 2f292e9..ad20a70 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -51,6 +51,12 @@
<dependency>
<groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-rest-http</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
<artifactId>ignite-spring</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c86f3b0/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
new file mode 100644
index 0000000..6fa2e6c
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/js/ExampleJsNodeStartup.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.examples.js;
+
+import org.apache.ignite.*;
+import org.apache.ignite.spi.discovery.tcp.internal.*;
+
+/**
+ * Starts up an empty node with example compute configuration.
+ */
+public class ExampleJsNodeStartup {
+ /**
+ * Start up an empty node with example compute configuration.
+ *
+ * @param args Command line arguments, none required.
+ * @throws IgniteException If failed.
+ */
+ public static void main(String[] args) throws IgniteException {
+ Ignition.start("examples/config/js/example-js-cache.xml");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c86f3b0/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
new file mode 100644
index 0000000..24c31d2
--- /dev/null
+++ b/examples/src/main/js/cache-api-example.js
@@ -0,0 +1,67 @@
+/*
+ * 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(">>> Cache API example started.");
+
+ var cache = ignite.getOrCreateCache("ApiExampleCache");
+
+ atomicMapOperations(cache);
+}
+
+/**
+ * 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.");
+
+ cache.removeAllFromCache(function(err) {
+ cache.getAndPut(1, "1", onGetAndPut.bind(null, cache))
+ });
+}
+
+function onGetAndPut(cache, err, entry) {
+ cache.put(2, "2", onPut.bind(null, cache));
+}
+
+function onPut(cache, err) {
+ cache.putIfAbsent(4, "44", onPutIfAbsent.bind(null, cache, true));
+}
+
+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));
+ }
+}
+
+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
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c86f3b0/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
new file mode 100644
index 0000000..92e0797
--- /dev/null
+++ b/examples/src/main/js/cache-put-get-example.js
@@ -0,0 +1,119 @@
+/*
+ * 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 CacheEntry = apacheIgnite.CacheEntry;
+
+Ignition.start(['127.0.0.1:9095'], null, onConnect);
+
+function onConnect(err, ignite) {
+ if (err)
+ throw err;
+
+ var cache = ignite.getOrCreateCache("PutGetExampleCache");
+
+ 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);
+ }
+
+ var onPut = function(err) {
+ if (err) {
+ console.log("Error: " + err);
+
+ throw new Error(err);
+ }
+
+ if (putCnt < keyCnt - 1) {
+ putCnt++;
+
+ return;
+ }
+
+ console.log(">>> Stored values in cache.");
+
+ for (var i = 0; i < keyCnt; i++) {
+ cache.get(i, onGet);
+ }
+ }
+
+ // 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;
+
+ var batch = [];
+ var keys = [];
+
+ for (var i = keyCnt; i < keyCnt + keyCnt; ++i) {
+ var key = i;
+
+ var val = "bulk-" + i;
+
+ keys.push(key);
+ batch.push(new CacheEntry(key, val));
+ }
+
+ var onGetAll = function(err, entries) {
+ if (err) {
+ console.log("Error: " + err);
+
+ throw new Error(err);
+ }
+
+ for (var e of entries) {
+ console.log("Got entry [key=" + e.key + ", val=" + e.value + ']');
+ }
+ }
+
+ var onPutAll= function(err) {
+ if (err) {
+ console.log("Error: " + err);
+
+ throw new Error(err);
+ }
+
+ cache.getAll(keys, onGetAll);
+ }
+
+ cache.putAll(batch, onPutAll);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c86f3b0/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
new file mode 100644
index 0000000..f31f0d5
--- /dev/null
+++ b/examples/src/main/js/cache-query-example.js
@@ -0,0 +1,52 @@
+/*
+ * 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;
+
+var cacheName = "CacheQueryExample";
+
+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")];
+
+ ignite.getOrCreateCache(cacheName).putAll(entries, onCachePut.bind(null, ignite));
+}
+
+function onCachePut(ignite, err) {
+ var qry = new SqlQuery("Select * from String");
+ qry.setReturnType("String");
+
+ var fullRes = [];
+
+ qry.on("page", function(res) {
+ fullRes = fullRes.concat(res);
+ });
+
+ qry.on("end", function(err) {
+ console.log(fullRes);
+ });
+
+ ignite.cache(cacheName).query(qry);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c86f3b0/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
new file mode 100644
index 0000000..1b92d7c
--- /dev/null
+++ b/examples/src/main/js/compute-callable-cache-example.js
@@ -0,0 +1,49 @@
+/*
+ * 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/5c86f3b0/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
new file mode 100644
index 0000000..1005c9f
--- /dev/null
+++ b/examples/src/main/js/compute-callable-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
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c86f3b0/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
new file mode 100644
index 0000000..e6d7ee9
--- /dev/null
+++ b/examples/src/main/js/compute-task-split-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/5c86f3b0/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 2ccdcbc..f2ddd59 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
@@ -63,7 +63,7 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter
script.addEngineFunction(emitFunction);
- String entryFunction = "Entry = function(key, val) {" +
+ String entryFunction = "CacheEntry = function(key, val) {" +
"this.key = key; this.value = val}";
script.addEngineFunction(entryFunction);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c86f3b0/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 82aa5ca..2379b36 100644
--- a/modules/nodejs/src/main/js/apache-ignite.js
+++ b/modules/nodejs/src/main/js/apache-ignite.js
@@ -17,7 +17,7 @@
module.exports = {
Cache : require('./cache.js').Cache,
- Entry : require('./cache.js').Entry,
+ CacheEntry : require('./cache.js').CacheEntry,
Ignition : require('./ignition.js').Ignition,
Server : require('./server.js').Server,
Ignite : require('./ignite.js').Ignite,
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c86f3b0/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 93ded2d..67a8b6c 100644
--- a/modules/nodejs/src/main/js/cache.js
+++ b/modules/nodejs/src/main/js/cache.js
@@ -144,7 +144,7 @@ Cache.prototype.removeAllFromCache = function(callback) {
* Put keys to cache
*
* @this {Cache}
- * @param {Entry[]} List of entries to put in the cache
+ * @param {CacheEntry[]} List of entries to put in the cache
* @param {noValue} callback Called on finish
*/
Cache.prototype.putAll = function(entries, callback) {
@@ -170,7 +170,7 @@ Cache.prototype.getAll = function(keys, callback) {
var result = [];
for (var key of res) {
- result.push(new Entry(key["key"], key["value"]));
+ result.push(new CacheEntry(key["key"], key["value"]));
}
callback.call(null, null, result);
@@ -374,11 +374,11 @@ Cache.prototype._runCacheCommand = function(command, callback) {
}
}
/**
- * @this{Entry}
+ * @this{CacheEntry}
* @param key Key
* @param val Value
*/
-function Entry(key0, val0) {
+function CacheEntry(key0, val0) {
this.key = key0;
this.value = val0;
}
@@ -392,4 +392,4 @@ function Entry(key0, val0) {
*/
exports.Cache = Cache
-exports.Entry = Entry
\ No newline at end of file
+exports.CacheEntry = CacheEntry
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c86f3b0/modules/nodejs/src/main/js/examples/config/example-ignite.xml
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/examples/config/example-ignite.xml b/modules/nodejs/src/main/js/examples/config/example-ignite.xml
deleted file mode 100644
index d351631..0000000
--- a/modules/nodejs/src/main/js/examples/config/example-ignite.xml
+++ /dev/null
@@ -1,91 +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" />
-
- <property name="connectorConfiguration">
- <bean class="org.apache.ignite.configuration.ConnectorConfiguration">
- <property name="jettyPath" value="modules/nodejs/src/main/js/examples/config/rest-jetty.xml"/>
- </bean>
- </property>
-
- <!-- Set to true to enable distributed class loading for examples, default is false. -->
- <property name="peerClassLoadingEnabled" value="true"/>
-
- <property name="marshaller">
- <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
- <!-- Set to false to allow non-serializable objects in examples, default is true. -->
- <property name="requireSerializable" value="false"/>
- </bean>
- </property>
-
- <!-- Enable task execution events for examples. -->
- <property name="includeEventTypes">
- <list>
- <!--Task execution events-->
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_STARTED"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FINISHED"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FAILED"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_TIMEDOUT"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_SESSION_ATTR_SET"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_REDUCED"/>
-
- <!--Cache events-->
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED"/>
- </list>
- </property>
-
- <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <!--
- Ignite provides several options for automatic discovery that can be used
- instead os static IP based discovery. For information on all options refer
- to our documentation: http://apacheignite.readme.io/docs/cluster-config
- -->
- <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
- <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47509</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c86f3b0/modules/nodejs/src/main/js/examples/config/rest-jetty.xml
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/examples/config/rest-jetty.xml b/modules/nodejs/src/main/js/examples/config/rest-jetty.xml
deleted file mode 100644
index abc146b..0000000
--- a/modules/nodejs/src/main/js/examples/config/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/5c86f3b0/modules/nodejs/src/main/js/examples/src/cache-api-example.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/examples/src/cache-api-example.js b/modules/nodejs/src/main/js/examples/src/cache-api-example.js
deleted file mode 100644
index 30e0739..0000000
--- a/modules/nodejs/src/main/js/examples/src/cache-api-example.js
+++ /dev/null
@@ -1,85 +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 Ignite = require("../../");
-var assert = require("assert");
-
-var Ignition = Ignite.Ignition;
-var Entry = Ignite.Entry;
-
-Ignition.start(['127.0.0.1:9095'], null, onConnect);
-
-function onConnect(err, ignite) {
- assert(err === null);
-
- console.log(">>> Cache API example started.");
-
- var cache = ignite.getOrCreateCache("ApiExampleCache");
-
- atomicMapOperations(cache);
-}
-
-/**
- * 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.");
-
- cache.removeAllFromCache(function(err) {
- assert(err === null);
-
- cache.getAndPut(1, "1", onGetAndPut.bind(null, cache))
- });
-}
-
-function onGetAndPut(cache, err, entry) {
- assert(err == null);
- assert(entry == null);
-
- cache.put(2, "2", onPut.bind(null, cache));
-}
-
-function onPut(cache, err) {
- assert(err === null);
-
- cache.putIfAbsent(4, "44", onPutIfAbsent.bind(null, cache, true));
-}
-
-function onPutIfAbsent(cache, expRes, err, res) {
- assert(err === null);
- assert(res === expRes);
-
- if (expRes) {
- cache.putIfAbsent(4, "44", onPutIfAbsent.bind(null, cache, false));
- }
- else {
- cache.replaceValue(4, "55", "44", onReplaceValue.bind(null, cache, true));
- }
-}
-
-function onReplaceValue(cache, expRes, err, res) {
- assert(err === null);
- assert(res === expRes);
-
- 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
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c86f3b0/modules/nodejs/src/main/js/examples/src/cache-put-get-example.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/examples/src/cache-put-get-example.js b/modules/nodejs/src/main/js/examples/src/cache-put-get-example.js
deleted file mode 100644
index 0906e64..0000000
--- a/modules/nodejs/src/main/js/examples/src/cache-put-get-example.js
+++ /dev/null
@@ -1,122 +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 Ignite = require("../../");
-
-var Ignition = Ignite.Ignition;
-var Entry = Ignite.Entry;
-
-Ignition.start(['127.0.0.1:9095'], null, onConnect);
-
-function onConnect(error, ignite) {
- if (error) {
- console.log("Error: " + error);
-
- throw new Error(error);
- }
-
- var cache = ignite.getOrCreateCache("PutGetExampleCache");
-
- 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);
- }
-
- var onPut = function(err) {
- if (err) {
- console.log("Error: " + err);
-
- throw new Error(err);
- }
-
- if (putCnt < keyCnt - 1) {
- putCnt++;
-
- return;
- }
-
- console.log(">>> Stored values in cache.");
-
- for (var i = 0; i < keyCnt; i++) {
- cache.get(i, onGet);
- }
- }
-
- // 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;
-
- var batch = [];
- var keys = [];
-
- for (var i = keyCnt; i < keyCnt + keyCnt; ++i) {
- var key = i;
-
- var val = "bulk-" + i;
-
- keys.push(key);
- batch.push(new Entry(key, val));
- }
-
- var onGetAll = function(err, entries) {
- if (err) {
- console.log("Error: " + err);
-
- throw new Error(err);
- }
-
- for (var e of entries) {
- console.log("Got entry [key=" + e.key + ", val=" + e.value + ']');
- }
- }
-
- var onPutAll= function(err) {
- if (err) {
- console.log("Error: " + err);
-
- throw new Error(err);
- }
-
- cache.getAll(keys, onGetAll);
- }
-
- cache.putAll(batch, onPutAll);
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c86f3b0/modules/nodejs/src/main/js/examples/src/cache-query-example.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/examples/src/cache-query-example.js b/modules/nodejs/src/main/js/examples/src/cache-query-example.js
deleted file mode 100644
index b6eb37a..0000000
--- a/modules/nodejs/src/main/js/examples/src/cache-query-example.js
+++ /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.
- */
-
-var Ignite = require("../../");
-var assert = require("assert");
-
-var Ignition = Ignite.Ignition;
-var SqlQuery = Ignite.SqlQuery;
-var SqlFieldsQuery = Ignite.SqlFieldsQuery;
-var Entry = Ignite.Entry;
-
-var cacheName = "CacheQueryExample";
-
-Ignition.start(['127.0.0.1:9095'], null, onConnect);
-
-function onConnect(err, ignite) {
- assert(err === null, err);
-
- console.log(">>> Cache query example started.");
-
- var entries = [new Entry("key0", "val0"), new Entry("key1", "val1")];
-
- ignite.getOrCreateCache(cacheName).putAll(entries, onCachePut.bind(null, ignite));
-}
-
-function onCachePut(ignite, err) {
- assert(err == null, err);
-
- var qry = new SqlQuery("Select * from String");
- qry.setReturnType("String");
-
- var fullRes = [];
-
- qry.on("page", function(res) {
- fullRes = fullRes.concat(res);
- });
-
- qry.on("end", function(err) {
- assert(err == null, err);
-
- console.log(fullRes);
- });
-
- ignite.cache(cacheName).query(qry);
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c86f3b0/modules/nodejs/src/main/js/examples/src/compute-callable-cache-example.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/examples/src/compute-callable-cache-example.js b/modules/nodejs/src/main/js/examples/src/compute-callable-cache-example.js
deleted file mode 100644
index a1e8c0f..0000000
--- a/modules/nodejs/src/main/js/examples/src/compute-callable-cache-example.js
+++ /dev/null
@@ -1,57 +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 Ignite = require("../../");
-var assert = require("assert");
-
-var Ignition = Ignite.Ignition;
-
-var cacheName = "ComputeCallableCacheExample";
-
-Ignition.start(['127.0.0.1:9095'], null, onConnect);
-
-function onConnect(err, ignite) {
- assert(err === null);
-
- 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) {
- assert(err == null, err);
-
- var cache = ignite.cache(cacheName);
-
- cache.get(igniteName, function(err, res) {
- assert(err == null, err);
-
- 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/5c86f3b0/modules/nodejs/src/main/js/examples/src/compute-callable-example.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/examples/src/compute-callable-example.js b/modules/nodejs/src/main/js/examples/src/compute-callable-example.js
deleted file mode 100644
index bd923e6..0000000
--- a/modules/nodejs/src/main/js/examples/src/compute-callable-example.js
+++ /dev/null
@@ -1,50 +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 Ignite = require("../../");
-var assert = require("assert");
-
-var Ignition = Ignite.Ignition;
-
-Ignition.start(['127.0.0.1:9095'], null, onConnect);
-
-function onConnect(err, ignite) {
- assert(err === null);
-
- 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) {
- assert(err == null);
-
- 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/5c86f3b0/modules/nodejs/src/main/js/examples/src/compute-runnable-example.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/examples/src/compute-runnable-example.js b/modules/nodejs/src/main/js/examples/src/compute-runnable-example.js
deleted file mode 100644
index 191d750..0000000
--- a/modules/nodejs/src/main/js/examples/src/compute-runnable-example.js
+++ /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.
- */
-
-var Ignite = require("../../");
-var assert = require("assert");
-
-var Ignition = Ignite.Ignition;
-
-Ignition.start(['127.0.0.1:9095'], null, onConnect);
-
-function onConnect(err, ignite) {
- assert(err === null);
-
- console.log(">>> Compute runnable example started.");
-
- var f = function (args) {
- print(">>> Printing '" + args + "' on this node from ignite job.");
- }
-
- var onRunScript = function(err, res) {
- assert(err == null, err);
-
- console.log(">>> Finished printing words using runnable execution.");
- 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/5c86f3b0/modules/nodejs/src/main/js/examples/src/compute-task-split-example.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/examples/src/compute-task-split-example.js b/modules/nodejs/src/main/js/examples/src/compute-task-split-example.js
deleted file mode 100644
index a5b0102..0000000
--- a/modules/nodejs/src/main/js/examples/src/compute-task-split-example.js
+++ /dev/null
@@ -1,62 +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 Ignite = require("../../");
-var assert = require("assert");
-
-var Ignition = Ignite.Ignition;
-
-Ignition.start(['127.0.0.1:9095'], null, onConnect);
-
-function onConnect(err, ignite) {
- assert(err === null);
-
- 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) {
- assert(err === null, err);
-
- 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/5c86f3b0/modules/nodejs/src/main/js/examples/src/org/apache/ignite/examples/ExampleNodeStartup.java
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/examples/src/org/apache/ignite/examples/ExampleNodeStartup.java b/modules/nodejs/src/main/js/examples/src/org/apache/ignite/examples/ExampleNodeStartup.java
deleted file mode 100644
index 1578c18..0000000
--- a/modules/nodejs/src/main/js/examples/src/org/apache/ignite/examples/ExampleNodeStartup.java
+++ /dev/null
@@ -1,36 +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.examples;
-
-import org.apache.ignite.*;
-import org.apache.ignite.spi.discovery.tcp.internal.*;
-
-/**
- * Starts up an empty node with example compute configuration.
- */
-public class ExampleNodeStartup {
- /**
- * Start up an empty node with example compute configuration.
- *
- * @param args Command line arguments, none required.
- * @throws IgniteException If failed.
- */
- public static void main(String[] args) throws IgniteException {
- Ignition.start("modules/nodejs/src/main/js/examples/config/example-ignite.xml");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c86f3b0/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 98a382f..c599a86 100644
--- a/modules/nodejs/src/test/js/test-cache-api.js
+++ b/modules/nodejs/src/test/js/test-cache-api.js
@@ -18,7 +18,7 @@
var TestUtils = require("./test-utils").TestUtils;
var Ignite = require(TestUtils.scriptPath());
-var Entry = Ignite.Entry;
+var CacheEntry = Ignite.CacheEntry;
var assert = require("assert");
@@ -291,8 +291,8 @@ function objectEntries() {
var val1 = {"age" : 12, "books" : ["1", "Book"]};
var val2 = {"age" : 13, "books" : ["1", "Book"]};
- entries.push(new Entry(key1, val1));
- entries.push(new Entry(key2, val2));
+ entries.push(new CacheEntry(key1, val1));
+ entries.push(new CacheEntry(key2, val2));
return entries;
}
@@ -300,8 +300,8 @@ function objectEntries() {
function stringEntries() {
entries = [];
- entries.push(new Entry("key1", "val1"));
- entries.push(new Entry("key2", "val2"));
+ entries.push(new CacheEntry("key1", "val1"));
+ entries.push(new CacheEntry("key2", "val2"));
return entries;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5c86f3b0/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 b99a7ad..111d79f 100644
--- a/modules/nodejs/src/test/js/test-compute.js
+++ b/modules/nodejs/src/test/js/test-compute.js
@@ -18,7 +18,7 @@
var TestUtils = require("./test-utils").TestUtils;
var Ignite = require(TestUtils.scriptPath());
-var Entry = Ignite.Entry;
+var CacheEntry = Ignite.CacheEntry;
var assert = require("assert");
@@ -145,7 +145,7 @@ testComputeRunScriptPutAllGetAll = function() {
var initKey1 = {"2" : "AAA"};
var initVal0 = {"1" : ["1", "2"]};
var initVal1 = {"2" : "AAA"};
- var initEntries = [new Entry(initKey0, initVal0), new Entry(initKey1, initVal1)];
+ var initEntries = [new CacheEntry(initKey0, initVal0), new CacheEntry(initKey1, initVal1)];
comp.runScript(f, [initEntries, [initKey0, initKey1]],
onEnd.bind(null));
@@ -172,7 +172,7 @@ testComputeRunScriptRemoveOperations = function() {
var val0 = {"valName" : 1};
var val1 = {"valName" : 2};
- var entries = [new Entry(key0, val0), new Entry(key1, val1)];
+ var entries = [new CacheEntry(key0, val0), new CacheEntry(key1, val1)];
var keys = [key0, key1];
cache.put(key0, val0);
@@ -347,8 +347,8 @@ testComputeMapReduceGetAndRemoveObject = function() {
var val1 = {"age" : 12, "books" : ["1", "Book"]};
var val2 = {"age" : 13, "books" : ["1", "Book"]};
- entries.push(new Entry(key1, val1));
- entries.push(new Entry(key2, val2));
+ entries.push(new CacheEntry(key1, val1));
+ entries.push(new CacheEntry(key2, val2));
ignite.compute().execute(map, reduce, entries, callback);
}
@@ -362,7 +362,7 @@ function onStart(onPut, error, ignite) {
var params = [];
for (var i = 900; i < 1000; ++i) {
- params.push(new Entry("key" + i, "val" + i));
+ params.push(new CacheEntry("key" + i, "val" + i));
}
cache.putAll(params, onPut.bind(null, ignite))
@@ -517,8 +517,8 @@ function computeCacheExecute(error, ignite) {
var val1 = {"age" : 12, "books" : ["1", "Book"]};
var val2 = {"age" : 13, "books" : ["1", "Book"]};
- entries.push(new Entry(key1, val1));
- entries.push(new Entry(key2, val2));
+ entries.push(new CacheEntry(key1, val1));
+ entries.push(new CacheEntry(key2, val2));
ignite.cache("mycache").putAll(entries, function(err) {
ignite.compute().execute(map, reduce, [key1, val1], callback);
[27/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-964
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.
[16/50] [abbrv] incubator-ignite git commit: Apache license added to
ignite-kafka modeule
Posted by iv...@apache.org.
Apache license added to ignite-kafka modeule
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/1cf479bc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1cf479bc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1cf479bc
Branch: refs/heads/ignite-964
Commit: 1cf479bca360f7381e38f7e1e8ec5e19511d0a33
Parents: 82f4992
Author: agura <ag...@gridgain.com>
Authored: Wed Jul 8 13:30:42 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Wed Jul 8 13:30:42 2015 +0300
----------------------------------------------------------------------
modules/kafka/licenses/apache-2.0.txt | 202 +++++++++++++++++++++++++++++
1 file changed, 202 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1cf479bc/modules/kafka/licenses/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/modules/kafka/licenses/apache-2.0.txt b/modules/kafka/licenses/apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/kafka/licenses/apache-2.0.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
[21/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-964
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(-)
----------------------------------------------------------------------
[17/50] [abbrv] incubator-ignite git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite
Posted by iv...@apache.org.
Merge branch '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/44b52b4a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/44b52b4a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/44b52b4a
Branch: refs/heads/ignite-964
Commit: 44b52b4a8968808ad7c17d510e56c8defe8ee837
Parents: 1cf479b 1a6948e
Author: agura <ag...@gridgain.com>
Authored: Wed Jul 8 13:31:12 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Wed Jul 8 13:31:12 2015 +0300
----------------------------------------------------------------------
.../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 ++-----------------
10 files changed, 167 insertions(+), 360 deletions(-)
----------------------------------------------------------------------
[08/50] [abbrv] incubator-ignite git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-591
Posted by iv...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into 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/9a51cdf8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9a51cdf8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9a51cdf8
Branch: refs/heads/ignite-964
Commit: 9a51cdf8d051dd0a6c0159fe1a2bc4bf56201da7
Parents: bc29797 0f1b31a
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Tue Jul 7 19:09:30 2015 -0700
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Tue Jul 7 19:09:30 2015 -0700
----------------------------------------------------------------------
dev-tools/slurp.sh | 2 +-
.../internal/interop/InteropIgnition.java | 17 +-
.../internal/interop/InteropProcessor.java | 7 +
.../cache/query/GridCacheQueryAdapter.java | 35 ++++-
.../processors/query/GridQueryProcessor.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 +-
scripts/git-patch-prop.sh | 2 +-
15 files changed, 386 insertions(+), 75 deletions(-)
----------------------------------------------------------------------
[45/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();
}
}
}
[38/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-964
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
[03/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/6ed5c1c6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6ed5c1c6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6ed5c1c6
Branch: refs/heads/ignite-964
Commit: 6ed5c1c694dbdf40840aaf7457f883959e8aa917
Parents: 96fa300 9d0aa6f
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Jul 7 18:07:55 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Jul 7 18:07:55 2015 +0300
----------------------------------------------------------------------
.../cache/eviction/fifo/FifoEvictionPolicy.java | 5 -
.../cache/eviction/lru/LruEvictionPolicy.java | 5 -
.../eviction/sorted/SortedEvictionPolicy.java | 19 +--
.../ignite/spi/discovery/tcp/ServerImpl.java | 26 +++
.../cache/CacheFutureExceptionSelfTest.java | 171 +++++++++++++++++++
.../GridCachePartitionedNodeRestartTest.java | 5 -
...ePartitionedOptimisticTxNodeRestartTest.java | 2 +-
.../GridCacheReplicatedFailoverSelfTest.java | 5 -
.../GridCacheReplicatedNodeRestartSelfTest.java | 5 -
...heConcurrentEvictionConsistencySelfTest.java | 15 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 1 +
11 files changed, 217 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
[10/50] [abbrv] incubator-ignite git commit: # review
Posted by iv...@apache.org.
# review
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/839fe79f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/839fe79f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/839fe79f
Branch: refs/heads/ignite-964
Commit: 839fe79fa5ff0ee91b528b43d6a7834aa1ea719f
Parents: cd01e4c
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jul 8 06:16:48 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jul 8 06:16:48 2015 +0300
----------------------------------------------------------------------
.../processors/cache/jta/CacheJtaManager.java | 24 ++++++++++----------
1 file changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/839fe79f/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/CacheJtaManager.java
----------------------------------------------------------------------
diff --git a/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/CacheJtaManager.java b/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/CacheJtaManager.java
index 09d856b..ace5fe7 100644
--- a/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/CacheJtaManager.java
+++ b/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/CacheJtaManager.java
@@ -35,7 +35,7 @@ public class CacheJtaManager extends CacheJtaManagerAdapter {
private final ThreadLocal<GridCacheXAResource> xaRsrc = new ThreadLocal<>();
/** */
- private volatile TransactionManager jtaTm;
+ private TransactionManager jtaTm;
/** */
private final AtomicReference<CacheTmLookup> tmLookupRef = new AtomicReference<>();
@@ -46,7 +46,7 @@ public class CacheJtaManager extends CacheJtaManagerAdapter {
if (cctx.txConfig() != null) {
String txLookupClsName = cctx.txConfig().getTxManagerLookupClassName();
-
+
if (txLookupClsName != null)
tmLookupRef.set(createTmLookup(txLookupClsName));
}
@@ -55,7 +55,7 @@ public class CacheJtaManager extends CacheJtaManagerAdapter {
/** {@inheritDoc} */
@Override protected void stop0(boolean cancel) {
CacheTmLookup tmLookup = tmLookupRef.get();
-
+
if (tmLookup instanceof LifecycleAware)
((LifecycleAware)tmLookup).stop();
}
@@ -70,10 +70,10 @@ public class CacheJtaManager extends CacheJtaManagerAdapter {
CacheTmLookup res = (CacheTmLookup)cls.newInstance();
cctx.kernalContext().resource().injectGeneric(res);
-
+
if (res instanceof LifecycleAware)
((LifecycleAware)res).start();
-
+
return res;
}
catch (Exception e) {
@@ -86,10 +86,10 @@ public class CacheJtaManager extends CacheJtaManagerAdapter {
if (jtaTm == null) {
try {
CacheTmLookup tmLookup = tmLookupRef.get();
-
+
if (tmLookup == null)
return;
-
+
jtaTm = tmLookup.getTm();
}
catch (Exception e) {
@@ -144,23 +144,23 @@ public class CacheJtaManager extends CacheJtaManagerAdapter {
/** {@inheritDoc} */
@Override public void registerCache(CacheConfiguration<?, ?> cfg) throws IgniteCheckedException {
String cacheLookupClsName = cfg.getTransactionManagerLookupClassName();
-
+
if (cacheLookupClsName != null) {
CacheTmLookup tmLookup = tmLookupRef.get();
-
+
if (tmLookup == null) {
tmLookup = createTmLookup(cacheLookupClsName);
-
+
if (tmLookupRef.compareAndSet(null, tmLookup))
return;
-
+
tmLookup = tmLookupRef.get();
}
if (!cacheLookupClsName.equals(tmLookup.getClass().getName()))
throw new IgniteCheckedException("Failed to start cache with CacheTmLookup that specified in cache " +
"configuration, because node uses another CacheTmLookup [cache" + cfg.getName() +
- ", tmLookupClassName=" + cacheLookupClsName + ", tmLookupUsedByNode="
+ ", tmLookupClassName=" + cacheLookupClsName + ", tmLookupUsedByNode="
+ tmLookup.getClass().getName() + ']');
}
}
[36/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-964
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
----------------------------------------------------------------------
[40/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-964
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
[06/50] [abbrv] incubator-ignite git commit: # master: update
DEFAULT_BRANCH to master.
Posted by iv...@apache.org.
# master: update DEFAULT_BRANCH to 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/17ee8a6b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/17ee8a6b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/17ee8a6b
Branch: refs/heads/ignite-964
Commit: 17ee8a6b837c6266b5065b956df0918305ec8814
Parents: 9d0aa6f
Author: ashutak <as...@gridgain.com>
Authored: Tue Jul 7 20:39:14 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Tue Jul 7 20:39:14 2015 +0300
----------------------------------------------------------------------
dev-tools/slurp.sh | 2 +-
scripts/git-patch-prop.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/17ee8a6b/dev-tools/slurp.sh
----------------------------------------------------------------------
diff --git a/dev-tools/slurp.sh b/dev-tools/slurp.sh
index 7edc776..ad7bc01 100755
--- a/dev-tools/slurp.sh
+++ b/dev-tools/slurp.sh
@@ -24,7 +24,7 @@
#
# Default branch name. Need to use last version of "jiraslurp" scripts.
#
-DEFAULT_BRANCH='ignite-sprint-5'
+DEFAULT_BRANCH='master'
#
# TC URL. It is 10.30.0.229 for public TC from agents.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/17ee8a6b/scripts/git-patch-prop.sh
----------------------------------------------------------------------
diff --git a/scripts/git-patch-prop.sh b/scripts/git-patch-prop.sh
index 16f907e..1b531fa 100644
--- a/scripts/git-patch-prop.sh
+++ b/scripts/git-patch-prop.sh
@@ -19,6 +19,6 @@
#
# Git patch-file maker/applier properties.
#
-IGNITE_DEFAULT_BRANCH='ignite-sprint-7'
+IGNITE_DEFAULT_BRANCH='master'
PATCHES_HOME=${IGNITE_HOME}
[15/50] [abbrv] incubator-ignite git commit: Fixed notes
Posted by iv...@apache.org.
Fixed 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/1a6948e8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1a6948e8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1a6948e8
Branch: refs/heads/ignite-964
Commit: 1a6948e8778d0e6379ffc0c99fee0d83d8bbebd7
Parents: 82f4992
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Wed Jul 8 13:04:31 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Wed Jul 8 13:04:31 2015 +0300
----------------------------------------------------------------------
.../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 ++-----------------
10 files changed, 167 insertions(+), 360 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1a6948e8/modules/yardstick/config/benchmark-index-put.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-index-put.properties b/modules/yardstick/config/benchmark-index-put.properties
deleted file mode 100644
index fb73656..0000000
--- a/modules/yardstick/config/benchmark-index-put.properties
+++ /dev/null
@@ -1,64 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#
-# Contains benchmarks for SQL queries.
-#
-
-# JVM options.
-# JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
-
-# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
-JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false" \
- -XX:+UseParNewGC \
- -XX:+UseConcMarkSweepGC \
- -XX:+UseTLAB \
- -XX:NewSize=128m \
- -XX:MaxNewSize=128m \
- -XX:MaxTenuringThreshold=0 \
- -XX:SurvivorRatio=1024 \
- -XX:+UseCMSInitiatingOccupancyOnly \
- -XX:CMSInitiatingOccupancyFraction=60 \
-"
-
-# List of default probes.
-# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
-BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe
-
-# Packages where the specified benchmark is searched by reflection mechanism.
-BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
-
-# Probe point writer class name.
-# BENCHMARK_WRITER=
-
-# Comma-separated list of the hosts to run BenchmarkServers on. 2 nodes on local host are enabled by default.
-SERVER_HOSTS=localhost,localhost
-
-# Comma-separated list of the hosts to run BenchmarkDrivers on. 1 node on local host is enabled by default.
-DRIVER_HOSTS=localhost
-
-# Remote username.
-# REMOTE_USER=
-
-# Number of nodes, used to wait for the specified number of nodes to start.
-nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`))
-
-# Run configuration.
-# Note that each benchmark is set to run for 300 seconds (5 mins) with warm-up set to 60 seconds (1 minute).
-CONFIGS="\
--cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutIndex1Benchmark -sn IgniteNode -ds atomic-indexed1-put,\
--cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutIndex2Benchmark -sn IgniteNode -ds atomic-indexed2-put,\
--cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutIndex8Benchmark -sn IgniteNode -ds atomic-indexed8-put\
-"
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1a6948e8/modules/yardstick/config/benchmark-put-indexed-val.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-put-indexed-val.properties b/modules/yardstick/config/benchmark-put-indexed-val.properties
new file mode 100644
index 0000000..8f3a505
--- /dev/null
+++ b/modules/yardstick/config/benchmark-put-indexed-val.properties
@@ -0,0 +1,64 @@
+# 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.
+
+#
+# Contains benchmarks for SQL queries.
+#
+
+# JVM options.
+# JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
+
+# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false" \
+ -XX:+UseParNewGC \
+ -XX:+UseConcMarkSweepGC \
+ -XX:+UseTLAB \
+ -XX:NewSize=128m \
+ -XX:MaxNewSize=128m \
+ -XX:MaxTenuringThreshold=0 \
+ -XX:SurvivorRatio=1024 \
+ -XX:+UseCMSInitiatingOccupancyOnly \
+ -XX:CMSInitiatingOccupancyFraction=60 \
+"
+
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+# Probe point writer class name.
+# BENCHMARK_WRITER=
+
+# Comma-separated list of the hosts to run BenchmarkServers on. 2 nodes on local host are enabled by default.
+SERVER_HOSTS=localhost,localhost
+
+# Comma-separated list of the hosts to run BenchmarkDrivers on. 1 node on local host is enabled by default.
+DRIVER_HOSTS=localhost
+
+# Remote username.
+# REMOTE_USER=
+
+# Number of nodes, used to wait for the specified number of nodes to start.
+nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`))
+
+# Run configuration.
+# Note that each benchmark is set to run for 300 seconds (5 mins) with warm-up set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutIndexedValue1Benchmark -sn IgniteNode -ds atomic-put-indexed-val-1,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutIndexedValue2Benchmark -sn IgniteNode -ds atomic-put-indexed-val-2,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutIndexedValue8Benchmark -sn IgniteNode -ds atomic-put-indexed-val-8\
+"
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1a6948e8/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex1Benchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex1Benchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex1Benchmark.java
deleted file mode 100644
index 65dd39a..0000000
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex1Benchmark.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.yardstick.cache;
-
-import org.apache.ignite.*;
-import org.apache.ignite.yardstick.cache.model.*;
-
-import java.util.*;
-
-/**
- * Ignite benchmark that performs put operations for entity with indexed fields.
- */
-public class IgnitePutIndex1Benchmark extends IgniteCacheAbstractBenchmark {
- /** {@inheritDoc} */
- @Override public boolean test(Map<Object, Object> ctx) throws Exception {
- int key = nextRandom(args.range());
-
- cache.put(key, new Person1(key));
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteCache<Integer, Object> cache() {
- return ignite().cache("atomic-index");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1a6948e8/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex2Benchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex2Benchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex2Benchmark.java
deleted file mode 100644
index b4cf86f..0000000
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex2Benchmark.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.yardstick.cache;
-
-import org.apache.ignite.*;
-import org.apache.ignite.yardstick.cache.model.*;
-
-import java.util.*;
-
-/**
- * Ignite benchmark that performs put operations for entity with indexed fields.
- */
-public class IgnitePutIndex2Benchmark extends IgniteCacheAbstractBenchmark {
- /** {@inheritDoc} */
- @Override public boolean test(Map<Object, Object> ctx) throws Exception {
- int key = nextRandom(args.range());
-
- cache.put(key, new Person2(key, key + 1));
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteCache<Integer, Object> cache() {
- return ignite().cache("atomic-index");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1a6948e8/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue1Benchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue1Benchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue1Benchmark.java
new file mode 100644
index 0000000..68de785
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue1Benchmark.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.yardstick.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.yardstick.cache.model.*;
+
+import java.util.*;
+
+/**
+ * Ignite benchmark that performs put operations for entity with indexed fields.
+ */
+public class IgnitePutIndexedValue1Benchmark extends IgniteCacheAbstractBenchmark {
+ /** {@inheritDoc} */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ int key = nextRandom(args.range());
+
+ cache.put(key, new Person1(key));
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteCache<Integer, Object> cache() {
+ return ignite().cache("atomic-index");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1a6948e8/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue2Benchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue2Benchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue2Benchmark.java
new file mode 100644
index 0000000..3256ee3
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue2Benchmark.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.yardstick.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.yardstick.cache.model.*;
+
+import java.util.*;
+
+/**
+ * Ignite benchmark that performs put operations for entity with indexed fields.
+ */
+public class IgnitePutIndexedValue2Benchmark extends IgniteCacheAbstractBenchmark {
+ /** {@inheritDoc} */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ int key = nextRandom(args.range());
+
+ cache.put(key, new Person2(key));
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteCache<Integer, Object> cache() {
+ return ignite().cache("atomic-index");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1a6948e8/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue8Benchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue8Benchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue8Benchmark.java
index b51ff34..42aa67d 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue8Benchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue8Benchmark.java
@@ -30,7 +30,7 @@ public class IgnitePutIndexedValue8Benchmark extends IgniteCacheAbstractBenchmar
@Override public boolean test(Map<Object, Object> ctx) throws Exception {
int key = nextRandom(args.range());
- cache.put(key, new Person8(key, key + 1, key + 2, key + 3, key + 4, key + 5, key + 6, key + 7));
+ cache.put(key, new Person8(key));
return true;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1a6948e8/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person1.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person1.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person1.java
index 0b2a0bf..91d1ccc 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person1.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person1.java
@@ -30,35 +30,12 @@ public class Person1 implements Serializable {
private int val1;
/**
- * Empty constructor.
- */
- public Person1() {
- // No-op.
- }
-
- /**
* Constructs.
*
- * @param val1 Indexed value.
- */
- public Person1(int val1) {
- this.val1 = val1;
- }
-
- /**
- * @return Get value.
- */
- public int getVal1() {
- return val1;
- }
-
- /**
- * Set value.
- *
- * @param val1 Value.
+ * @param val Indexed value.
*/
- public void setVal1(int val1) {
- this.val1 = val1;
+ public Person1(int val) {
+ this.val1 = val;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1a6948e8/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person2.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person2.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person2.java
index 3b1cb9e..dc5729c 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person2.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person2.java
@@ -34,50 +34,13 @@ public class Person2 implements Serializable {
private int val2;
/**
- * Empty constructor.
- */
- public Person2() {
- // No-op.
- }
-
- /**
* Constructs.
- */
- public Person2(int val1, int val2) {
- this.val1 = val1;
- this.val2 = val2;
- }
-
- /**
- * @return Get value.
- */
- public int getVal1() {
- return val1;
- }
-
- /**
- * Set value.
- *
- * @param val1 Value.
- */
- public void setVal1(int val1) {
- this.val1 = val1;
- }
-
- /**
- * @return Get value.
- */
- public int getVal2() {
- return val2;
- }
-
- /**
- * Set value.
*
- * @param val2 Value.
+ * @param val Value.
*/
- public void setVal2(int val2) {
- this.val2 = val2;
+ public Person2(int val) {
+ this.val1 = val;
+ this.val2 = val + 1;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1a6948e8/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person8.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person8.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person8.java
index b8e3f7c..92d65ac 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person8.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person8.java
@@ -58,152 +58,19 @@ public class Person8 implements Serializable {
private int val8;
/**
- * Empty constructor.
- */
- public Person8() {
- // No-op.
- }
-
- /**
* Constructs.
- */
- public Person8(int val1, int val2, int val3, int val4, int val5, int val6, int val7, int val8) {
- this.val1 = val1;
- this.val2 = val2;
- this.val3 = val3;
- this.val4 = val4;
- this.val5 = val5;
- this.val6 = val6;
- this.val7 = val7;
- this.val8 = val8;
- }
-
- /**
- * @return Get value.
- */
- public int getVal1() {
- return val1;
- }
-
- /**
- * Set value.
- *
- * @param val1 Value.
- */
- public void setVal1(int val1) {
- this.val1 = val1;
- }
-
- /**
- * @return Get value.
- */
- public int getVal2() {
- return val2;
- }
-
- /**
- * Set value.
- *
- * @param val2 Value.
- */
- public void setVal2(int val2) {
- this.val2 = val2;
- }
-
- /**
- * @return Get value.
- */
- public int getVal3() {
- return val3;
- }
-
- /**
- * Set value.
- *
- * @param val3 Value.
- */
- public void setVal3(int val3) {
- this.val3 = val3;
- }
-
- /**
- * @return Get value.
- */
- public int getVal4() {
- return val4;
- }
-
- /**
- * Set value.
- *
- * @param val4 Value.
- */
- public void setVal4(int val4) {
- this.val4 = val4;
- }
-
- /**
- * @return Get value.
- */
- public int getVal5() {
- return val5;
- }
-
- /**
- * Set value.
- *
- * @param val5 Value.
- */
- public void setVal5(int val5) {
- this.val5 = val5;
- }
-
- /**
- * @return Get value.
- */
- public int getVal6() {
- return val6;
- }
-
- /**
- * Set value.
*
- * @param val6 Value.
- */
- public void setVal6(int val6) {
- this.val6 = val6;
- }
-
- /**
- * @return Get value.
- */
- public int getVal7() {
- return val7;
- }
-
- /**
- * Set value.
- *
- * @param val7 Value.
- */
- public void setVal7(int val7) {
- this.val7 = val7;
- }
-
- /**
- * @return Get value.
- */
- public int getVal8() {
- return val8;
- }
-
- /**
- * Set value.
- *
- * @param val8 Value.
- */
- public void setVal8(int val8) {
- this.val8 = val8;
+ * @param val Indexed value.
+ */
+ public Person8(int val) {
+ this.val1 = val;
+ this.val2 = val + 1;
+ this.val3 = val + 2;
+ this.val4 = val + 3;
+ this.val5 = val + 4;
+ this.val6 = val + 5;
+ this.val7 = val + 6;
+ this.val8 = val + 7;
}
/** {@inheritDoc} */
[18/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'remotes/origin/master' into ignite-591
Posted by iv...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into 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/cfeec2dd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/cfeec2dd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/cfeec2dd
Branch: refs/heads/ignite-964
Commit: cfeec2ddb63770dfe28176c3916630753162631c
Parents: 839fe79 44b52b4
Author: sevdokimov <se...@gridgain.com>
Authored: Wed Jul 8 14:32:52 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed Jul 8 14:32:52 2015 +0300
----------------------------------------------------------------------
.../ignite/spi/discovery/tcp/ServerImpl.java | 20 ++
.../tcp/internal/TcpDiscoveryNode.java | 2 +-
.../tcp/internal/TcpDiscoveryNodesRing.java | 8 +-
.../tcp/internal/TcpDiscoveryStatistics.java | 10 +-
...acheAtomicReplicatedNodeRestartSelfTest.java | 8 +-
.../tcp/TcpDiscoveryMultiThreadedTest.java | 38 ++++
.../IgniteSpiDiscoverySelfTestSuite.java | 3 +
modules/kafka/licenses/apache-2.0.txt | 202 +++++++++++++++++++
.../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 ++++++++++
16 files changed, 727 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
[23/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-964
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(-)
----------------------------------------------------------------------
[44/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-964
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);
[02/50] [abbrv] incubator-ignite git commit: GG-10469: Done.
Posted by iv...@apache.org.
GG-10469: Done.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/96fa3002
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/96fa3002
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/96fa3002
Branch: refs/heads/ignite-964
Commit: 96fa3002904fcad50dafc1f19655c2d44eaece40
Parents: 96c9695
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Jul 7 18:07:05 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Jul 7 18:07:05 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/interop/InteropIgnition.java | 17 ++++++++++++++++-
.../ignite/internal/interop/InteropProcessor.java | 7 +++++++
2 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96fa3002/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java
index 2989a17..faae72b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropIgnition.java
@@ -50,6 +50,9 @@ public class InteropIgnition {
*/
public static synchronized InteropProcessor start(@Nullable String springCfgPath, @Nullable String gridName,
int factoryId, long envPtr, long dataPtr) {
+ if (envPtr <= 0)
+ throw new IgniteException("Environment pointer must be positive.");
+
ClassLoader oldClsLdr = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(InteropIgnition.class.getClassLoader());
@@ -83,13 +86,25 @@ public class InteropIgnition {
* Get instance by environment pointer.
*
* @param gridName Grid name.
- * @return Instance or {@code null} if it doesn't exists (never started or stopped).
+ * @return Instance or {@code null} if it doesn't exist (never started or stopped).
*/
@Nullable public static synchronized InteropProcessor instance(@Nullable String gridName) {
return instances.get(gridName);
}
/**
+ * Get environment pointer of the given instance.
+ *
+ * @param gridName Grid name.
+ * @return Environment pointer or {@code 0} in case grid with such name doesn't exist.
+ */
+ public static synchronized long environmentPointer(@Nullable String gridName) {
+ InteropProcessor proc = instance(gridName);
+
+ return proc != null ? proc.environmentPointer() : 0;
+ }
+
+ /**
* Stop single instance.
*
* @param gridName Grid name,
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/96fa3002/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java
index 325a464..94b733f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/interop/InteropProcessor.java
@@ -32,6 +32,13 @@ public interface InteropProcessor {
public Ignite ignite();
/**
+ * Get environment pointer associated with this processor.
+ *
+ * @return Environment pointer.
+ */
+ public long environmentPointer();
+
+ /**
* Get stop runnable to perform cleanup when interop is not longer used.
* <p/>
* <b>NOTE!</b> This runnable is called when current instance of interop processor is eligible for garbage
[24/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-964
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);
}
}
[07/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/0f1b31a5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0f1b31a5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0f1b31a5
Branch: refs/heads/ignite-964
Commit: 0f1b31a5b89f7406bfe44e488a9a832567ee1ccb
Parents: 17ee8a6 4f46ee8
Author: ashutak <as...@gridgain.com>
Authored: Tue Jul 7 20:39:42 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Tue Jul 7 20:39:42 2015 +0300
----------------------------------------------------------------------
.../internal/interop/InteropIgnition.java | 17 +-
.../internal/interop/InteropProcessor.java | 7 +
.../cache/query/GridCacheQueryAdapter.java | 35 ++++-
.../processors/query/GridQueryProcessor.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 +-
13 files changed, 384 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
[29/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-964
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) {
[30/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-964
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"));
[26/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-964
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
---------------------------------------
[13/50] [abbrv] incubator-ignite git commit: Added benchmarks.
Posted by iv...@apache.org.
Added benchmarks.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/946b08ba
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/946b08ba
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/946b08ba
Branch: refs/heads/ignite-964
Commit: 946b08ba435813881920f8547d7cff36a9faf9a2
Parents: 4031db7
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Wed Jul 8 12:30:41 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Wed Jul 8 12:30:41 2015 +0300
----------------------------------------------------------------------
.../config/benchmark-index-put.properties | 64 +++++
modules/yardstick/config/ignite-base-config.xml | 23 ++
.../cache/IgnitePutIndex1Benchmark.java | 42 ++++
.../cache/IgnitePutIndex2Benchmark.java | 42 ++++
.../cache/IgnitePutIndex8Benchmark.java | 42 ++++
.../ignite/yardstick/cache/model/Person1.java | 78 ++++++
.../ignite/yardstick/cache/model/Person2.java | 104 ++++++++
.../ignite/yardstick/cache/model/Person8.java | 242 +++++++++++++++++++
8 files changed, 637 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/946b08ba/modules/yardstick/config/benchmark-index-put.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-index-put.properties b/modules/yardstick/config/benchmark-index-put.properties
new file mode 100644
index 0000000..fb73656
--- /dev/null
+++ b/modules/yardstick/config/benchmark-index-put.properties
@@ -0,0 +1,64 @@
+# 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.
+
+#
+# Contains benchmarks for SQL queries.
+#
+
+# JVM options.
+# JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
+
+# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false" \
+ -XX:+UseParNewGC \
+ -XX:+UseConcMarkSweepGC \
+ -XX:+UseTLAB \
+ -XX:NewSize=128m \
+ -XX:MaxNewSize=128m \
+ -XX:MaxTenuringThreshold=0 \
+ -XX:SurvivorRatio=1024 \
+ -XX:+UseCMSInitiatingOccupancyOnly \
+ -XX:CMSInitiatingOccupancyFraction=60 \
+"
+
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+# Probe point writer class name.
+# BENCHMARK_WRITER=
+
+# Comma-separated list of the hosts to run BenchmarkServers on. 2 nodes on local host are enabled by default.
+SERVER_HOSTS=localhost,localhost
+
+# Comma-separated list of the hosts to run BenchmarkDrivers on. 1 node on local host is enabled by default.
+DRIVER_HOSTS=localhost
+
+# Remote username.
+# REMOTE_USER=
+
+# Number of nodes, used to wait for the specified number of nodes to start.
+nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`))
+
+# Run configuration.
+# Note that each benchmark is set to run for 300 seconds (5 mins) with warm-up set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutIndex1Benchmark -sn IgniteNode -ds atomic-indexed1-put,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutIndex2Benchmark -sn IgniteNode -ds atomic-indexed2-put,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutIndex8Benchmark -sn IgniteNode -ds atomic-indexed8-put\
+"
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/946b08ba/modules/yardstick/config/ignite-base-config.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/ignite-base-config.xml b/modules/yardstick/config/ignite-base-config.xml
index 9d28774..b2c976a 100644
--- a/modules/yardstick/config/ignite-base-config.xml
+++ b/modules/yardstick/config/ignite-base-config.xml
@@ -104,6 +104,29 @@
</bean>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="atomic-index"/>
+
+ <property name="cacheMode" value="PARTITIONED"/>
+
+ <property name="atomicityMode" value="ATOMIC"/>
+
+ <property name="swapEnabled" value="false"/>
+
+ <property name="indexedTypes">
+ <list>
+ <value>java.lang.Integer</value>
+ <value>org.apache.ignite.yardstick.cache.model.Person1</value>
+
+ <value>java.lang.Integer</value>
+ <value>org.apache.ignite.yardstick.cache.model.Person2</value>
+
+ <value>java.lang.Integer</value>
+ <value>org.apache.ignite.yardstick.cache.model.Person8</value>
+ </list>
+ </property>
+ </bean>
+
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="query"/>
<property name="cacheMode" value="PARTITIONED"/>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/946b08ba/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex1Benchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex1Benchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex1Benchmark.java
new file mode 100644
index 0000000..65dd39a
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex1Benchmark.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.yardstick.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.yardstick.cache.model.*;
+
+import java.util.*;
+
+/**
+ * Ignite benchmark that performs put operations for entity with indexed fields.
+ */
+public class IgnitePutIndex1Benchmark extends IgniteCacheAbstractBenchmark {
+ /** {@inheritDoc} */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ int key = nextRandom(args.range());
+
+ cache.put(key, new Person1(key));
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteCache<Integer, Object> cache() {
+ return ignite().cache("atomic-index");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/946b08ba/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex2Benchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex2Benchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex2Benchmark.java
new file mode 100644
index 0000000..b4cf86f
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex2Benchmark.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.yardstick.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.yardstick.cache.model.*;
+
+import java.util.*;
+
+/**
+ * Ignite benchmark that performs put operations for entity with indexed fields.
+ */
+public class IgnitePutIndex2Benchmark extends IgniteCacheAbstractBenchmark {
+ /** {@inheritDoc} */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ int key = nextRandom(args.range());
+
+ cache.put(key, new Person2(key, key + 1));
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteCache<Integer, Object> cache() {
+ return ignite().cache("atomic-index");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/946b08ba/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex8Benchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex8Benchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex8Benchmark.java
new file mode 100644
index 0000000..542a139
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex8Benchmark.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.yardstick.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.yardstick.cache.model.*;
+
+import java.util.*;
+
+/**
+ * Ignite benchmark that performs put operations for entity with indexed fields.
+ */
+public class IgnitePutIndex8Benchmark extends IgniteCacheAbstractBenchmark {
+ /** {@inheritDoc} */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ int key = nextRandom(args.range());
+
+ cache.put(key, new Person8(key, key + 1, key + 2, key + 3, key + 4, key + 5, key + 6, key + 7));
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteCache<Integer, Object> cache() {
+ return ignite().cache("atomic-index");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/946b08ba/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person1.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person1.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person1.java
new file mode 100644
index 0000000..0b2a0bf
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person1.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.yardstick.cache.model;
+
+import org.apache.ignite.cache.query.annotations.*;
+
+import java.io.*;
+
+/**
+ * Value used for indexed put test.
+ */
+public class Person1 implements Serializable {
+ /** Value. */
+ @QuerySqlField(index = true)
+ private int val1;
+
+ /**
+ * Empty constructor.
+ */
+ public Person1() {
+ // No-op.
+ }
+
+ /**
+ * Constructs.
+ *
+ * @param val1 Indexed value.
+ */
+ public Person1(int val1) {
+ this.val1 = val1;
+ }
+
+ /**
+ * @return Get value.
+ */
+ public int getVal1() {
+ return val1;
+ }
+
+ /**
+ * Set value.
+ *
+ * @param val1 Value.
+ */
+ public void setVal1(int val1) {
+ this.val1 = val1;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ return this == o || (o instanceof Person1) && val1 == ((Person1)o).val1;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return val1;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "IndexedValue1 [val1=" + val1 + ']';
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/946b08ba/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person2.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person2.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person2.java
new file mode 100644
index 0000000..3b1cb9e
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person2.java
@@ -0,0 +1,104 @@
+/*
+ * 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.yardstick.cache.model;
+
+import org.apache.ignite.cache.query.annotations.*;
+
+import java.io.*;
+
+/**
+ * Value used for indexed put test.
+ */
+public class Person2 implements Serializable {
+ /** Value 1. */
+ @QuerySqlField(index = true)
+ private int val1;
+
+ /** Value 2. */
+ @QuerySqlField(index = true)
+ private int val2;
+
+ /**
+ * Empty constructor.
+ */
+ public Person2() {
+ // No-op.
+ }
+
+ /**
+ * Constructs.
+ */
+ public Person2(int val1, int val2) {
+ this.val1 = val1;
+ this.val2 = val2;
+ }
+
+ /**
+ * @return Get value.
+ */
+ public int getVal1() {
+ return val1;
+ }
+
+ /**
+ * Set value.
+ *
+ * @param val1 Value.
+ */
+ public void setVal1(int val1) {
+ this.val1 = val1;
+ }
+
+ /**
+ * @return Get value.
+ */
+ public int getVal2() {
+ return val2;
+ }
+
+ /**
+ * Set value.
+ *
+ * @param val2 Value.
+ */
+ public void setVal2(int val2) {
+ this.val2 = val2;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ Person2 value2 = (Person2)o;
+
+ return val1 == value2.val1 && val2 == value2.val2;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return 31 * val1 + val2;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "IndexedValue2 [val1=" + val1 + ", val2=" + val2 + ']';
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/946b08ba/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person8.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person8.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person8.java
new file mode 100644
index 0000000..b8e3f7c
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person8.java
@@ -0,0 +1,242 @@
+/*
+ * 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.yardstick.cache.model;
+
+import org.apache.ignite.cache.query.annotations.*;
+
+import java.io.*;
+
+/**
+ * Value used for indexed put test.
+ */
+public class Person8 implements Serializable {
+ /** Value 1. */
+ @QuerySqlField(index = true)
+ private int val1;
+
+ /** Value 2. */
+ @QuerySqlField(index = true)
+ private int val2;
+
+ /** Value 3. */
+ @QuerySqlField(index = true)
+ private int val3;
+
+ /** Value 4. */
+ @QuerySqlField(index = true)
+ private int val4;
+
+ /** Value 5. */
+ @QuerySqlField(index = true)
+ private int val5;
+
+ /** Value 6. */
+ @QuerySqlField(index = true)
+ private int val6;
+
+ /** Value 7. */
+ @QuerySqlField(index = true)
+ private int val7;
+
+ /** Value 8. */
+ @QuerySqlField(index = true)
+ private int val8;
+
+ /**
+ * Empty constructor.
+ */
+ public Person8() {
+ // No-op.
+ }
+
+ /**
+ * Constructs.
+ */
+ public Person8(int val1, int val2, int val3, int val4, int val5, int val6, int val7, int val8) {
+ this.val1 = val1;
+ this.val2 = val2;
+ this.val3 = val3;
+ this.val4 = val4;
+ this.val5 = val5;
+ this.val6 = val6;
+ this.val7 = val7;
+ this.val8 = val8;
+ }
+
+ /**
+ * @return Get value.
+ */
+ public int getVal1() {
+ return val1;
+ }
+
+ /**
+ * Set value.
+ *
+ * @param val1 Value.
+ */
+ public void setVal1(int val1) {
+ this.val1 = val1;
+ }
+
+ /**
+ * @return Get value.
+ */
+ public int getVal2() {
+ return val2;
+ }
+
+ /**
+ * Set value.
+ *
+ * @param val2 Value.
+ */
+ public void setVal2(int val2) {
+ this.val2 = val2;
+ }
+
+ /**
+ * @return Get value.
+ */
+ public int getVal3() {
+ return val3;
+ }
+
+ /**
+ * Set value.
+ *
+ * @param val3 Value.
+ */
+ public void setVal3(int val3) {
+ this.val3 = val3;
+ }
+
+ /**
+ * @return Get value.
+ */
+ public int getVal4() {
+ return val4;
+ }
+
+ /**
+ * Set value.
+ *
+ * @param val4 Value.
+ */
+ public void setVal4(int val4) {
+ this.val4 = val4;
+ }
+
+ /**
+ * @return Get value.
+ */
+ public int getVal5() {
+ return val5;
+ }
+
+ /**
+ * Set value.
+ *
+ * @param val5 Value.
+ */
+ public void setVal5(int val5) {
+ this.val5 = val5;
+ }
+
+ /**
+ * @return Get value.
+ */
+ public int getVal6() {
+ return val6;
+ }
+
+ /**
+ * Set value.
+ *
+ * @param val6 Value.
+ */
+ public void setVal6(int val6) {
+ this.val6 = val6;
+ }
+
+ /**
+ * @return Get value.
+ */
+ public int getVal7() {
+ return val7;
+ }
+
+ /**
+ * Set value.
+ *
+ * @param val7 Value.
+ */
+ public void setVal7(int val7) {
+ this.val7 = val7;
+ }
+
+ /**
+ * @return Get value.
+ */
+ public int getVal8() {
+ return val8;
+ }
+
+ /**
+ * Set value.
+ *
+ * @param val8 Value.
+ */
+ public void setVal8(int val8) {
+ this.val8 = val8;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ Person8 p8 = (Person8)o;
+
+ return val1 == p8.val1 && val2 == p8.val2 && val3 == p8.val3 && val4 == p8.val4
+ && val5 == p8.val5 && val6 == p8.val6 && val7 == p8.val7 && val8 == p8.val8;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ int result = val1;
+
+ result = 31 * result + val2;
+ result = 31 * result + val3;
+ result = 31 * result + val4;
+ result = 31 * result + val5;
+ result = 31 * result + val6;
+ result = 31 * result + val7;
+ result = 31 * result + val8;
+
+ return result;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "Person8 [val1=" + val1 + ", val2=" + val2 + ", val3=" + val3 + ", val4=" + val4 + ", val5=" + val5 +
+ ", val6=" + val6 + ", val7=" + val7 + ", val8=" + val8 +']';
+ }
+}
[49/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-964
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
[46/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-964
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();
}
/**
[28/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-964
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.
[33/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-964
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(-)
----------------------------------------------------------------------
[50/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-964
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();
[35/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-964
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);
[37/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-964
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));
}
/**
[14/50] [abbrv] incubator-ignite git commit: # review
Posted by iv...@apache.org.
# review
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/82f49921
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/82f49921
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/82f49921
Branch: refs/heads/ignite-964
Commit: 82f49921969979589e04fb12f9902201a29ac7b2
Parents: 946b08b
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jul 8 12:38:11 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jul 8 12:38:11 2015 +0300
----------------------------------------------------------------------
.../cache/IgnitePutIndex8Benchmark.java | 42 --------------------
.../cache/IgnitePutIndexedValue8Benchmark.java | 42 ++++++++++++++++++++
2 files changed, 42 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/82f49921/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex8Benchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex8Benchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex8Benchmark.java
deleted file mode 100644
index 542a139..0000000
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndex8Benchmark.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.yardstick.cache;
-
-import org.apache.ignite.*;
-import org.apache.ignite.yardstick.cache.model.*;
-
-import java.util.*;
-
-/**
- * Ignite benchmark that performs put operations for entity with indexed fields.
- */
-public class IgnitePutIndex8Benchmark extends IgniteCacheAbstractBenchmark {
- /** {@inheritDoc} */
- @Override public boolean test(Map<Object, Object> ctx) throws Exception {
- int key = nextRandom(args.range());
-
- cache.put(key, new Person8(key, key + 1, key + 2, key + 3, key + 4, key + 5, key + 6, key + 7));
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteCache<Integer, Object> cache() {
- return ignite().cache("atomic-index");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/82f49921/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue8Benchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue8Benchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue8Benchmark.java
new file mode 100644
index 0000000..b51ff34
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutIndexedValue8Benchmark.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.yardstick.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.yardstick.cache.model.*;
+
+import java.util.*;
+
+/**
+ * Ignite benchmark that performs put operations for entity with indexed fields.
+ */
+public class IgnitePutIndexedValue8Benchmark extends IgniteCacheAbstractBenchmark {
+ /** {@inheritDoc} */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ int key = nextRandom(args.range());
+
+ cache.put(key, new Person8(key, key + 1, key + 2, key + 3, key + 4, key + 5, key + 6, key + 7));
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteCache<Integer, Object> cache() {
+ return ignite().cache("atomic-index");
+ }
+}
[42/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-964
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) {
[39/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-964
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
[19/50] [abbrv] incubator-ignite git commit: #ignite-1101: Add test
for cache future runtime exception.
Posted by iv...@apache.org.
#ignite-1101: Add test for cache future runtime exception.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/94a42a48
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/94a42a48
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/94a42a48
Branch: refs/heads/ignite-964
Commit: 94a42a48530998da9895e217c99eec69db71d8c9
Parents: 44b52b4
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Jul 8 14:45:49 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Jul 8 14:45:49 2015 +0300
----------------------------------------------------------------------
.../cache/CacheFutureExceptionSelfTest.java | 121 ++++---------------
1 file changed, 26 insertions(+), 95 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/94a42a48/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 27bfe17..34d2daa 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
@@ -19,16 +19,11 @@ package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.*;
import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.util.*;
-import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.lang.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
import org.apache.ignite.testframework.junits.common.*;
import javax.cache.*;
import java.io.*;
-import java.util.*;
import java.util.concurrent.*;
import static java.util.concurrent.TimeUnit.*;
@@ -39,9 +34,11 @@ import static java.util.concurrent.TimeUnit.*;
public class CacheFutureExceptionSelfTest extends GridCommonAbstractTest {
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = StartNode.createConfiguration();
+ IgniteConfiguration cfg = new IgniteConfiguration();
+ cfg.setGridName(gridName);
- cfg.setClientMode(true);
+ if (gridName.equals(getTestGridName(1)))
+ cfg.setClientMode(true);
return cfg;
}
@@ -50,68 +47,39 @@ public class CacheFutureExceptionSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testAsyncCacheFuture() throws Exception {
- final CountDownLatch readyLatch = new CountDownLatch(1);
+ Ignite srv = startGrid(0);
- GridJavaProcess node1 = null;
+ IgniteCache<String, NotSerializableClass> cache = srv.getOrCreateCache("CACHE");
+ cache.put("key", new NotSerializableClass());
- Collection<String> jvmArgs = Arrays.asList("-ea", "-DIGNITE_QUIET=false");
+ Ignite client = startGrid(1);
- try {
- node1 = GridJavaProcess.exec(
- StartNode.class.getName(), null,
- log,
- new CI1<String>() {
- @Override public void apply(String s) {
- info("Server node1: " + s);
+ IgniteCache<String, NotSerializableClass> asyncCache = client.<String, NotSerializableClass>cache("CACHE").withAsync();
- if (s.contains("Topology snapshot"))
- readyLatch.countDown();
- }
- },
- null,
- jvmArgs,
- null
- );
+ System.setProperty("FAIL", "true");
- assertTrue(readyLatch.await(60, SECONDS));
+ asyncCache.get("key");
- Ignite client = startGrid(0);
+ final CountDownLatch futLatch = new CountDownLatch(1);
- IgniteCache<String, NotSerializableClass> cache = client.getOrCreateCache("CACHE");
+ asyncCache.future().listen(new IgniteInClosure<IgniteFuture<Object>>() {
+ @Override public void apply(IgniteFuture<Object> fut) {
+ assertTrue(fut.isDone());
- cache.put("key", new NotSerializableClass());
+ try {
+ fut.get();
- System.setProperty("FAIL", "true");
-
- IgniteCache<String, NotSerializableClass> asyncCache = cache.withAsync();
-
- asyncCache.get("key");
-
- final CountDownLatch futLatch = new CountDownLatch(1);
-
- asyncCache.future().listen(new IgniteInClosure<IgniteFuture<Object>>() {
- @Override public void apply(IgniteFuture<Object> fut) {
- assertTrue(fut.isDone());
-
- try {
- fut.get();
-
- fail();
- }
- catch (CacheException e) {
- log.info("Expected error: " + e);
+ fail();
+ }
+ catch (CacheException e) {
+ log.info("Expected error: " + e);
- futLatch.countDown();
- }
+ futLatch.countDown();
}
- });
+ }
+ });
- assertTrue(futLatch.await(60, SECONDS));
- }
- finally {
- if (node1 != null)
- node1.killProcess();
- }
+ assertTrue(futLatch.await(60, SECONDS));
}
/**
@@ -131,41 +99,4 @@ public class CacheFutureExceptionSelfTest extends GridCommonAbstractTest {
in.readObject();
}
}
-
- /**
- * Test class.
- */
- public static class StartNode {
- /**
- * @return Configuration.
- */
- public static IgniteConfiguration createConfiguration() {
- IgniteConfiguration cfg = new IgniteConfiguration();
-
- cfg.setPeerClassLoadingEnabled(true);
-
- cfg.setLocalHost("127.0.0.1");
-
- TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
- disco.setIpFinderCleanFrequency(1000);
-
- TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
-
- ipFinder.setAddresses(Collections.singletonList("127.0.0.1:47500..47509"));
-
- disco.setIpFinder(ipFinder);
-
- cfg.setDiscoverySpi(disco);
-
- return cfg;
- }
-
- /**
- * @param args Main parameters.
- */
- public static void main(String[] args) {
- Ignition.start(createConfiguration());
- }
- }
-}
\ No newline at end of file
+}
\ No newline at end of file
[47/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-964
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();
[25/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-964
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(-)
----------------------------------------------------------------------
[31/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-964
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
[22/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-964
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>
[41/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-964
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);
[32/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-964
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
----------------------------------------------------------------------
[48/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-964
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
----------------------------------------------------------------------
[20/50] [abbrv] incubator-ignite git commit: # Fixed unmarshalling
error handling for cache 'get'
Posted by iv...@apache.org.
# 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-964
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
[09/50] [abbrv] incubator-ignite git commit: #IGNITE-591 - Minor
Posted by iv...@apache.org.
#IGNITE-591 - Minor
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/cd01e4c3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/cd01e4c3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/cd01e4c3
Branch: refs/heads/ignite-964
Commit: cd01e4c39362e5c27fe749fcd1cf2788b50bcc3d
Parents: 9a51cdf
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Tue Jul 7 19:21:15 2015 -0700
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Tue Jul 7 19:21:15 2015 -0700
----------------------------------------------------------------------
.../apache/ignite/internal/processors/cache/GridCacheContext.java | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cd01e4c3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index c454da9..eb813c3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -220,7 +220,6 @@ public class GridCacheContext<K, V> implements Externalizable {
* @param dataStructuresMgr Cache dataStructures manager.
* @param ttlMgr TTL manager.
* @param drMgr Data center replication manager.
- * @param jtaMgr JTA manager.
* @param rslvrMgr Conflict resolution manager.
* @param pluginMgr Cache plugin manager.
*/
[34/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-964
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>
[05/50] [abbrv] incubator-ignite git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite
Posted by iv...@apache.org.
Merge branch '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/4f46ee88
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4f46ee88
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4f46ee88
Branch: refs/heads/ignite-964
Commit: 4f46ee886d4b1a40c71d0cbdab273b9eb38e3717
Parents: c04cba9 6ed5c1c
Author: agura <ag...@gridgain.com>
Authored: Tue Jul 7 19:29:18 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Tue Jul 7 19:29:18 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/interop/InteropIgnition.java | 17 ++++++++++++++++-
.../ignite/internal/interop/InteropProcessor.java | 7 +++++++
2 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[12/50] [abbrv] incubator-ignite git commit: merge from ignite-747
Posted by iv...@apache.org.
merge from ignite-747
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4031db76
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4031db76
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4031db76
Branch: refs/heads/ignite-964
Commit: 4031db76d2bd9992001a5b63f17af7739e82cff0
Parents: 0f1b31a
Author: Denis Magda <dm...@gridgain.com>
Authored: Wed Jul 8 10:19:11 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Jul 8 10:19:11 2015 +0300
----------------------------------------------------------------------
.../ignite/spi/discovery/tcp/ServerImpl.java | 20 +++++++++++
.../tcp/internal/TcpDiscoveryNode.java | 2 +-
.../tcp/internal/TcpDiscoveryNodesRing.java | 8 ++++-
.../tcp/internal/TcpDiscoveryStatistics.java | 10 ++++--
...acheAtomicReplicatedNodeRestartSelfTest.java | 8 ++---
.../tcp/TcpDiscoveryMultiThreadedTest.java | 38 ++++++++++++++++++++
.../IgniteSpiDiscoverySelfTestSuite.java | 3 ++
7 files changed, 81 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4031db76/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index f8fae34..d51293e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -2881,6 +2881,24 @@ class ServerImpl extends TcpDiscoveryImpl {
msg.verify(locNodeId);
}
+ else if (!locNodeId.equals(node.id()) && ring.node(node.id()) != null) {
+ // Local node already has node from message in local topology.
+ // Just pass it to coordinator via the ring.
+ if (ring.hasRemoteNodes())
+ sendMessageAcrossRing(msg);
+
+ if (log.isDebugEnabled())
+ log.debug("Local node already has node being added. Passing TcpDiscoveryNodeAddedMessage to " +
+ "coordinator for final processing [ring=" + ring + ", node=" + node + ", locNode="
+ + locNode + ", msg=" + msg + ']');
+
+ if (debugMode)
+ debugLog("Local node already has node being added. Passing TcpDiscoveryNodeAddedMessage to " +
+ "coordinator for final processing [ring=" + ring + ", node=" + node + ", locNode="
+ + locNode + ", msg=" + msg + ']');
+
+ return;
+ }
if (msg.verified() && !locNodeId.equals(node.id())) {
if (node.internalOrder() <= ring.maxInternalOrder()) {
@@ -3163,6 +3181,8 @@ class ServerImpl extends TcpDiscoveryImpl {
if (msg.verified() && locNodeId.equals(nodeId) && spiStateCopy() == CONNECTING) {
assert node != null;
+ assert topVer > 0 : "Invalid topology version: " + msg;
+
ring.topologyVersion(topVer);
node.order(topVer);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4031db76/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 36ae39e..4b4df45 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
@@ -300,7 +300,7 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste
* @param order Order of the node.
*/
public void order(long order) {
- assert order >= 0 : "Order is invalid: " + this;
+ assert order > 0 : "Order is invalid: " + this;
this.order = order;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4031db76/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
index e9eaa1d..acb479d 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
@@ -34,7 +34,13 @@ public class TcpDiscoveryNodesRing {
/** Visible nodes filter. */
public static final IgnitePredicate<TcpDiscoveryNode> VISIBLE_NODES = new P1<TcpDiscoveryNode>() {
@Override public boolean apply(TcpDiscoveryNode node) {
- return node.visible();
+ if (node.visible()) {
+ assert node.order() > 0 : "Invalid node order: " + node;
+
+ return true;
+ }
+
+ return false;
}
};
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4031db76/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryStatistics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryStatistics.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryStatistics.java
index da8c4ea..377d8a8 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryStatistics.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryStatistics.java
@@ -256,7 +256,10 @@ public class TcpDiscoveryStatistics {
if (maxMsgQueueTime < duration)
maxMsgQueueTime = duration;
- avgMsgQueueTime = (avgMsgQueueTime * (totalReceivedMessages() -1)) / totalProcessedMessages();
+ int totalProcMsgs = totalProcessedMessages();
+
+ if (totalProcMsgs != 0)
+ avgMsgQueueTime = (avgMsgQueueTime * (totalProcMsgs - 1)) / totalProcMsgs;
}
msgsProcStartTs.put(msg.id(), U.currentTimeMillis());
@@ -275,7 +278,10 @@ public class TcpDiscoveryStatistics {
if (startTs != null) {
long duration = U.currentTimeMillis() - startTs;
- avgMsgProcTime = (avgMsgProcTime * (totalProcessedMessages() - 1) + duration) / totalProcessedMessages();
+ int totalProcMsgs = totalProcessedMessages();
+
+ if (totalProcMsgs != 0)
+ avgMsgProcTime = (avgMsgProcTime * (totalProcMsgs - 1) + duration) / totalProcMsgs;
if (duration > maxMsgProcTime) {
maxMsgProcTime = duration;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4031db76/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheAtomicReplicatedNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheAtomicReplicatedNodeRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheAtomicReplicatedNodeRestartSelfTest.java
index 54409d1..b4ed18d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheAtomicReplicatedNodeRestartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheAtomicReplicatedNodeRestartSelfTest.java
@@ -26,17 +26,17 @@ import static org.apache.ignite.cache.CacheAtomicityMode.*;
*/
public class IgniteCacheAtomicReplicatedNodeRestartSelfTest extends GridCacheReplicatedNodeRestartSelfTest {
/** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-747");
+ @Override public void testRestartWithPutSixNodesTwoBackups() throws Throwable {
+ fail("https://issues.apache.org/jira/browse/IGNITE-1095");
}
/** {@inheritDoc} */
- @Override public void testRestartWithPutSixNodesTwoBackups() throws Throwable {
+ @Override public void testRestartWithPutEightNodesTwoBackups() throws Throwable {
fail("https://issues.apache.org/jira/browse/IGNITE-1095");
}
/** {@inheritDoc} */
- @Override public void testRestartWithPutEightNodesTwoBackups() throws Throwable {
+ @Override public void testRestartWithPutTenNodesTwoBackups() throws Throwable {
fail("https://issues.apache.org/jira/browse/IGNITE-1095");
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4031db76/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
index cfefff4..0bf7cad 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
@@ -21,8 +21,10 @@ import org.apache.ignite.*;
import org.apache.ignite.configuration.*;
import org.apache.ignite.internal.*;
import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
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 java.util.concurrent.*;
@@ -100,6 +102,8 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
* @throws Exception If any error occurs.
*/
public void testMultiThreaded() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-1100");
+
execute();
}
@@ -126,6 +130,40 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
}
/**
+ * @throws Exception If any error occurs.
+ */
+ public void testMultipleStartOnCoordinatorStop() throws Exception{
+ startGrids(GRID_CNT);
+
+ final CyclicBarrier barrier = new CyclicBarrier(GRID_CNT + 4);
+
+ final AtomicInteger startIdx = new AtomicInteger(GRID_CNT);
+
+ IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ barrier.await();
+
+ Ignite ignite = startGrid(startIdx.getAndIncrement());
+
+ assertFalse(ignite.configuration().isClientMode());
+
+ log.info("Started node: " + ignite.name());
+
+ return null;
+ }
+ }, GRID_CNT + 3, "start-thread");
+
+ barrier.await();
+
+ U.sleep(ThreadLocalRandom.current().nextInt(10, 100));
+
+ for (int i = 0; i < GRID_CNT; i++)
+ stopGrid(i);
+
+ fut.get();
+ }
+
+ /**
* @throws Exception If failed.
*/
private void execute() throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4031db76/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
index 498f50c..6f59f14 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
@@ -57,6 +57,9 @@ public class IgniteSpiDiscoverySelfTestSuite extends TestSuite {
suite.addTest(new TestSuite(TcpDiscoveryNodeConsistentIdSelfTest.class));
+ suite.addTest(new TestSuite(TcpDiscoveryRestartTest.class));
+ suite.addTest(new TestSuite(TcpDiscoveryMultiThreadedTest.class));
+
return suite;
}
}
[43/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-964
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() + "].");
- }
- }
}
[04/50] [abbrv] incubator-ignite git commit: ignite-1031 Query
metrics updated incorrectly
Posted by iv...@apache.org.
ignite-1031 Query metrics updated incorrectly
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c04cba9e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c04cba9e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c04cba9e
Branch: refs/heads/ignite-964
Commit: c04cba9e82d3f9a7a5d851047de92322c54cc568
Parents: 9d0aa6f
Author: agura <ag...@gridgain.com>
Authored: Tue Jul 7 19:28:38 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Tue Jul 7 19:28:38 2015 +0300
----------------------------------------------------------------------
.../cache/query/GridCacheQueryAdapter.java | 35 ++++-
.../processors/query/GridQueryProcessor.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 +-
11 files changed, 361 insertions(+), 72 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c04cba9e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
index 5b82c34..c2425f0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
@@ -36,6 +36,7 @@ import org.jetbrains.annotations.*;
import java.util.*;
+import static org.apache.ignite.cache.CacheMode.*;
import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.*;
/**
@@ -413,12 +414,19 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
@SuppressWarnings("IfMayBeConditional")
private <R> CacheQueryFuture<R> execute(@Nullable IgniteReducer<T, R> rmtReducer,
@Nullable IgniteClosure<T, R> rmtTransform, @Nullable Object... args) {
- Collection<ClusterNode> nodes = nodes();
+ Collection<ClusterNode> nodes;
+
+ try {
+ nodes = nodes();
+ }
+ catch (IgniteCheckedException e) {
+ return queryErrorFuture(cctx, e, log);
+ }
cctx.checkSecurity(SecurityPermission.CACHE_READ);
if (nodes.isEmpty())
- return new GridCacheQueryErrorFuture<>(cctx.kernalContext(), new ClusterGroupEmptyCheckedException());
+ return queryErrorFuture(cctx, new ClusterGroupEmptyCheckedException(), log);
if (log.isDebugEnabled())
log.debug("Executing query [query=" + this + ", nodes=" + nodes + ']');
@@ -429,7 +437,7 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
cctx.deploy().registerClasses(args);
}
catch (IgniteCheckedException e) {
- return new GridCacheQueryErrorFuture<>(cctx.kernalContext(), e);
+ return queryErrorFuture(cctx, e, log);
}
}
@@ -457,7 +465,7 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
/**
* @return Nodes to execute on.
*/
- private Collection<ClusterNode> nodes() {
+ private Collection<ClusterNode> nodes() throws IgniteCheckedException {
CacheMode cacheMode = cctx.config().getCacheMode();
switch (cacheMode) {
@@ -466,6 +474,10 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
U.warn(log, "Ignoring query projection because it's executed over LOCAL cache " +
"(only local node will be queried): " + this);
+ if (type == SCAN && cctx.config().getCacheMode() == LOCAL &&
+ partition() != null && partition() >= cctx.affinity().partitions())
+ throw new IgniteCheckedException("Invalid partition number: " + partition());
+
return Collections.singletonList(cctx.localNode());
case REPLICATED:
@@ -513,6 +525,21 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
});
}
+ /**
+ * @param cctx Cache context.
+ * @param e Exception.
+ * @param log Logger.
+ */
+ private static <T> GridCacheQueryErrorFuture<T> queryErrorFuture(GridCacheContext<?, ?> cctx,
+ Exception e, IgniteLogger log) {
+
+ GridCacheQueryMetricsAdapter metrics = (GridCacheQueryMetricsAdapter)cctx.queries().metrics();
+
+ GridQueryProcessor.onExecuted(cctx, metrics, null, e, 0, 0, log);
+
+ return new GridCacheQueryErrorFuture<>(cctx.kernalContext(), e);
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(GridCacheQueryAdapter.class, this);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c04cba9e/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index e080c6d..6af0f40 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -1453,6 +1453,11 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw (IgniteCheckedException)err;
}
+ catch (Exception e) {
+ err = e;
+
+ throw new IgniteCheckedException(e);
+ }
finally {
GridCacheQueryMetricsAdapter metrics = (GridCacheQueryMetricsAdapter)cctx.queries().metrics();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c04cba9e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java
index 63912bf..3eb96b6 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java
@@ -33,7 +33,7 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
*/
public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstractTest {
/** Grid count. */
- private static final int GRID_CNT = 2;
+ protected int gridCnt;
/** Cache mode. */
protected CacheMode cacheMode;
@@ -43,7 +43,7 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
- startGridsMultiThreaded(GRID_CNT);
+ startGridsMultiThreaded(gridCnt);
}
/** {@inheritDoc} */
@@ -122,6 +122,57 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
}
/**
+ * Test metrics for failed SQL queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlFieldsQueryFailedMetrics() throws Exception {
+ IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+
+ // Execute query.
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from UNKNOWN");
+
+ try {
+ cache.query(qry).getAll();
+ }
+ catch (Exception e) {
+ // No-op.
+ }
+
+ QueryMetrics m = cache.queryMetrics();
+
+ assert m != null;
+
+ info("Metrics: " + m);
+
+ assertEquals(1, m.executions());
+ assertEquals(1, m.fails());
+ assertTrue(m.averageTime() >= 0);
+ assertTrue(m.maximumTime() >= 0);
+ assertTrue(m.minimumTime() >= 0);
+
+ // Execute again with the same parameters.
+ try {
+ cache.query(qry).getAll();
+ }
+ catch (Exception e) {
+ // No-op.
+ }
+
+ m = cache.queryMetrics();
+
+ assert m != null;
+
+ info("Metrics: " + m);
+
+ assertEquals(2, m.executions());
+ assertEquals(2, m.fails());
+ assertTrue(m.averageTime() >= 0);
+ assertTrue(m.maximumTime() >= 0);
+ assertTrue(m.minimumTime() >= 0);
+ }
+
+ /**
* Test metrics for Scan queries.
*
* @throws Exception In case of error.
@@ -163,6 +214,57 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
}
/**
+ * Test metrics for failed Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testScanQueryFailedMetrics() throws Exception {
+ IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+
+ // Execute query.
+ ScanQuery<String, Integer> qry = new ScanQuery<>(Integer.MAX_VALUE);
+
+ try {
+ cache.query(qry).getAll();
+ }
+ catch (Exception e) {
+ // No-op.
+ }
+
+ QueryMetrics m = cache.queryMetrics();
+
+ assert m != null;
+
+ info("Metrics: " + m);
+
+ assertEquals(1, m.executions());
+ assertEquals(1, m.fails());
+ assertTrue(m.averageTime() >= 0);
+ assertTrue(m.maximumTime() >= 0);
+ assertTrue(m.minimumTime() >= 0);
+
+ // Execute again with the same parameters.
+ try {
+ cache.query(qry).getAll();
+ }
+ catch (Exception e) {
+ // No-op.
+ }
+
+ m = cache.queryMetrics();
+
+ assert m != null;
+
+ info("Metrics: " + m);
+
+ assertEquals(2, m.executions());
+ assertEquals(2, m.fails());
+ assertTrue(m.averageTime() >= 0);
+ assertTrue(m.maximumTime() >= 0);
+ assertTrue(m.minimumTime() >= 0);
+ }
+
+ /**
* Test metrics for SQL cross cache queries.
*
* @throws Exception In case of error.
@@ -202,4 +304,55 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
assertTrue(m.maximumTime() >= 0);
assertTrue(m.minimumTime() >= 0);
}
+
+ /**
+ * Test metrics for failed SQL cross cache queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlCrossCacheQueryFailedMetrics() throws Exception {
+ IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+
+ // Execute query.
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"G\".Integer");
+
+ try {
+ cache.query(qry).getAll();
+ }
+ catch (Exception e) {
+ // No-op
+ }
+
+ QueryMetrics m = cache.queryMetrics();
+
+ assert m != null;
+
+ info("Metrics: " + m);
+
+ assertEquals(1, m.executions());
+ assertEquals(1, m.fails());
+ assertTrue(m.averageTime() >= 0);
+ assertTrue(m.maximumTime() >= 0);
+ assertTrue(m.minimumTime() >= 0);
+
+ // Execute again with the same parameters.
+ try {
+ cache.query(qry).getAll();
+ }
+ catch (Exception e) {
+ // No-op.
+ }
+
+ m = cache.queryMetrics();
+
+ assert m != null;
+
+ info("Metrics: " + m);
+
+ assertEquals(2, m.executions());
+ assertEquals(2, m.fails());
+ assertTrue(m.averageTime() >= 0);
+ assertTrue(m.maximumTime() >= 0);
+ assertTrue(m.minimumTime() >= 0);
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c04cba9e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheLocalQueryMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheLocalQueryMetricsSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheLocalQueryMetricsSelfTest.java
new file mode 100644
index 0000000..d28d3a0
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheLocalQueryMetricsSelfTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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 static org.apache.ignite.cache.CacheMode.*;
+
+/**
+ * Tests for local cache query metrics.
+ */
+public class CacheLocalQueryMetricsSelfTest extends CacheAbstractQueryMetricsSelfTest {
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ gridCnt = 1;
+ cacheMode = LOCAL;
+
+ super.beforeTest();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c04cba9e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryMetricsDistributedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryMetricsDistributedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryMetricsDistributedSelfTest.java
new file mode 100644
index 0000000..f54a091
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryMetricsDistributedSelfTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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 static org.apache.ignite.cache.CacheMode.*;
+
+/**
+ * Tests for partitioned distributed cache query metrics.
+ */
+public class CachePartitionedQueryMetricsDistributedSelfTest extends CacheAbstractQueryMetricsSelfTest {
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ gridCnt = 2;
+ cacheMode = PARTITIONED;
+
+ super.beforeTest();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c04cba9e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryMetricsLocalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryMetricsLocalSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryMetricsLocalSelfTest.java
new file mode 100644
index 0000000..efeb5d3
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryMetricsLocalSelfTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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 static org.apache.ignite.cache.CacheMode.*;
+
+/**
+ * Tests for partitioned local cache query metrics.
+ */
+public class CachePartitionedQueryMetricsLocalSelfTest extends CacheAbstractQueryMetricsSelfTest {
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ gridCnt = 1;
+ cacheMode = PARTITIONED;
+
+ super.beforeTest();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c04cba9e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryMetricsSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryMetricsSelfTest.java
deleted file mode 100644
index 666acfb..0000000
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryMetricsSelfTest.java
+++ /dev/null
@@ -1,32 +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.cache;
-
-import static org.apache.ignite.cache.CacheMode.*;
-
-/**
- * Tests for partitioned cache query metrics.
- */
-public class CachePartitionedQueryMetricsSelfTest extends CacheAbstractQueryMetricsSelfTest {
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- cacheMode = PARTITIONED;
-
- super.beforeTest();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c04cba9e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryMetricsDistributedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryMetricsDistributedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryMetricsDistributedSelfTest.java
new file mode 100644
index 0000000..ae2a420
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryMetricsDistributedSelfTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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 static org.apache.ignite.cache.CacheMode.*;
+
+/**
+ * Tests for replicated distributed cache query metrics.
+ */
+public class CacheReplicatedQueryMetricsDistributedSelfTest extends CacheAbstractQueryMetricsSelfTest {
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ gridCnt = 2;
+ cacheMode = REPLICATED;
+
+ super.beforeTest();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c04cba9e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryMetricsLocalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryMetricsLocalSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryMetricsLocalSelfTest.java
new file mode 100644
index 0000000..d411f9c
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryMetricsLocalSelfTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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 static org.apache.ignite.cache.CacheMode.*;
+
+/**
+ * Tests for replicated local cache query metrics.
+ */
+public class CacheReplicatedQueryMetricsLocalSelfTest extends CacheAbstractQueryMetricsSelfTest {
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ gridCnt = 1;
+ cacheMode = REPLICATED;
+
+ super.beforeTest();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c04cba9e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryMetricsSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryMetricsSelfTest.java
deleted file mode 100644
index 2be6dd3..0000000
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryMetricsSelfTest.java
+++ /dev/null
@@ -1,32 +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.cache;
-
-import static org.apache.ignite.cache.CacheMode.*;
-
-/**
- * Tests for replicated cache query metrics.
- */
-public class CacheReplicatedQueryMetricsSelfTest extends CacheAbstractQueryMetricsSelfTest {
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- cacheMode = REPLICATED;
-
- super.beforeTest();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c04cba9e/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index 181ff0c..2d7d0ce 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -116,8 +116,11 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
suite.addTestSuite(H2CompareBigQueryTest.class);
// Cache query metrics.
- suite.addTestSuite(CachePartitionedQueryMetricsSelfTest.class);
- suite.addTestSuite(CacheReplicatedQueryMetricsSelfTest.class);
+ suite.addTestSuite(CacheLocalQueryMetricsSelfTest.class);
+ suite.addTestSuite(CachePartitionedQueryMetricsDistributedSelfTest.class);
+ suite.addTestSuite(CachePartitionedQueryMetricsLocalSelfTest.class);
+ suite.addTestSuite(CacheReplicatedQueryMetricsDistributedSelfTest.class);
+ suite.addTestSuite(CacheReplicatedQueryMetricsLocalSelfTest.class);
//Unmarshallig query test.
suite.addTestSuite(IgniteCacheP2pUnmarshallingQueryErrorTest.class);
[11/50] [abbrv] incubator-ignite git commit: # ignite-gg-10416
Exclude lifecycleBeans for daemon node.
Posted by iv...@apache.org.
# ignite-gg-10416 Exclude lifecycleBeans for daemon node.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8cc75fc5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8cc75fc5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8cc75fc5
Branch: refs/heads/ignite-964
Commit: 8cc75fc562706be8aebb837b708c03a9be264027
Parents: 0f1b31a
Author: Andrey <an...@gridgain.com>
Authored: Wed Jul 8 10:50:16 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Wed Jul 8 10:50:16 2015 +0700
----------------------------------------------------------------------
.../org/apache/ignite/visor/commands/open/VisorOpenCommand.scala | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8cc75fc5/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
index 6498baf..632a96b 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
@@ -144,7 +144,7 @@ class VisorOpenCommand extends VisorConsoleCommand {
try
// Cache, IGFS, indexing SPI configurations should be excluded from daemon node config.
spring.loadConfigurations(url, "cacheConfiguration", "fileSystemConfiguration",
- "indexingSpi").get1()
+ "lifecycleBeans", "indexingSpi").get1()
finally {
if (log4jTup != null)
U.removeLog4jNoOpLogger(log4jTup)