You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ra...@apache.org on 2015/11/30 14:33:47 UTC
[01/50] [abbrv] ignite git commit: Fixed test to do not hang if some
asserts fail.
Repository: ignite
Updated Branches:
refs/heads/master 14e162823 -> 03ceffa36
Fixed test to do not hang if some asserts fail.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2d62bbb9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2d62bbb9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2d62bbb9
Branch: refs/heads/master
Commit: 2d62bbb96b568b0cf45f29540a2b440f1cbb0a34
Parents: e706216
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 11:07:49 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 11:07:49 2015 +0300
----------------------------------------------------------------------
.../IgniteClientReconnectCacheTest.java | 26 ++++++++++++--------
1 file changed, 16 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2d62bbb9/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
index 3d8f601..14a770a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
@@ -723,15 +723,18 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
TestTcpDiscoverySpi srvSpi = spi(srv);
- assertTrue(joinLatch.await(5000, MILLISECONDS));
-
- U.sleep(1000);
+ try {
+ assertTrue(joinLatch.await(5000, MILLISECONDS));
- assertNotDone(fut);
+ U.sleep(1000);
- srvSpi.failNode(clientId, null);
+ assertNotDone(fut);
- srvCommSpi.stopBlock(false);
+ srvSpi.failNode(clientId, null);
+ }
+ finally {
+ srvCommSpi.stopBlock(false);
+ }
assertTrue(fut.get());
}
@@ -1286,10 +1289,13 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
srvSpi.failNode(client.localNode().id(), null);
- fut.get();
-
- for (int i = 0; i < SRV_CNT; i++)
- ((TestCommunicationSpi)grid(i).configuration().getCommunicationSpi()).stopBlock(false);
+ try {
+ fut.get();
+ }
+ finally {
+ for (int i = 0; i < SRV_CNT; i++)
+ ((TestCommunicationSpi)grid(i).configuration().getCommunicationSpi()).stopBlock(false);
+ }
cache.put(1, 1);
[07/50] [abbrv] ignite git commit: Fixed hang in data structures
failover tests.
Posted by ra...@apache.org.
Fixed hang in data structures failover tests.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/41fe4695
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/41fe4695
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/41fe4695
Branch: refs/heads/master
Commit: 41fe46953af80304e05c76007df3c30b8d681742
Parents: e9f22ab
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 12:33:14 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 12:33:14 2015 +0300
----------------------------------------------------------------------
.../CacheDataStructuresManager.java | 45 ++++++++++++--------
.../datastructures/DataStructuresProcessor.java | 20 +--------
...gniteAtomicLongChangingTopologySelfTest.java | 30 ++++++++++---
3 files changed, 53 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/41fe4695/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
index 431be1e..ec787f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java
@@ -383,7 +383,7 @@ public class CacheDataStructuresManager extends GridCacheManagerAdapter {
if (create) {
hdr = new GridCacheSetHeader(IgniteUuid.randomUuid(), collocated);
- GridCacheSetHeader old = retryPutIfAbsent(cache, key, hdr);
+ GridCacheSetHeader old = (GridCacheSetHeader)cache.getAndPutIfAbsent(key, hdr);
if (old != null)
hdr = old;
@@ -493,6 +493,12 @@ public class CacheDataStructuresManager extends GridCacheManagerAdapter {
continue;
}
+ else if (!pingNodes(nodes)) {
+ if (log.isDebugEnabled())
+ log.debug("RemoveSetData job failed and set data node left, will retry: " + e);
+
+ continue;
+ }
else
throw e;
}
@@ -510,6 +516,12 @@ public class CacheDataStructuresManager extends GridCacheManagerAdapter {
continue;
}
+ else if (!pingNodes(nodes)) {
+ if (log.isDebugEnabled())
+ log.debug("RemoveSetData job failed and set data node left, will retry: " + e);
+
+ continue;
+ }
else
throw e;
}
@@ -526,6 +538,20 @@ public class CacheDataStructuresManager extends GridCacheManagerAdapter {
}
/**
+ * @param nodes Nodes to ping.
+ * @return {@code True} if was able to ping all nodes.
+ * @throws IgniteCheckedException If failed/
+ */
+ private boolean pingNodes(Collection<ClusterNode> nodes) throws IgniteCheckedException {
+ for (ClusterNode node : nodes) {
+ if (!cctx.discovery().pingNode(node.id()))
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
* @param key Set item key.
* @param rmv {@code True} if item was removed.
*/
@@ -562,23 +588,6 @@ public class CacheDataStructuresManager extends GridCacheManagerAdapter {
/**
* @param cache Cache.
- * @param key Key.
- * @param val Value.
- * @throws IgniteCheckedException If failed.
- * @return Previous value.
- */
- @SuppressWarnings("unchecked")
- @Nullable private <T> T retryPutIfAbsent(final IgniteInternalCache cache, final Object key, final T val)
- throws IgniteCheckedException {
- return DataStructuresProcessor.retry(log, new Callable<T>() {
- @Nullable @Override public T call() throws Exception {
- return (T)cache.getAndPutIfAbsent(key, val);
- }
- });
- }
-
- /**
- * @param cache Cache.
* @param keys Keys to remove.
* @throws IgniteCheckedException If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/41fe4695/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
index 23d64cf..998bd92 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
@@ -973,7 +973,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
IgniteOutClosureX<GridCacheQueueHeader> rmv = new IgniteOutClosureX<GridCacheQueueHeader>() {
@Override public GridCacheQueueHeader applyx() throws IgniteCheckedException {
- return (GridCacheQueueHeader)retryRemove(cctx.cache(), new GridCacheQueueHeaderKey(name));
+ return (GridCacheQueueHeader)cctx.cache().getAndRemove(new GridCacheQueueHeaderKey(name));
}
};
@@ -1569,7 +1569,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
IgniteOutClosureX<GridCacheSetHeader> rmv = new IgniteOutClosureX<GridCacheSetHeader>() {
@Override public GridCacheSetHeader applyx() throws IgniteCheckedException {
- return (GridCacheSetHeader)retryRemove(cctx.cache(), new GridCacheSetHeaderKey(name));
+ return (GridCacheSetHeader)cctx.cache().getAndRemove(new GridCacheSetHeaderKey(name));
}
};
@@ -1583,22 +1583,6 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
}
/**
- * @param cache Cache.
- * @param key Key to remove.
- * @throws IgniteCheckedException If failed.
- * @return Removed value.
- */
- @SuppressWarnings("unchecked")
- @Nullable private <T> T retryRemove(final IgniteInternalCache cache, final Object key)
- throws IgniteCheckedException {
- return retry(log, new Callable<T>() {
- @Nullable @Override public T call() throws Exception {
- return (T)cache.getAndRemove(key);
- }
- });
- }
-
- /**
* @param log Logger.
* @param call Callable.
* @return Callable result.
http://git-wip-us.apache.org/repos/asf/ignite/blob/41fe4695/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
index c00557d..a8d5801 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
@@ -32,6 +32,7 @@ import java.util.concurrent.atomic.AtomicReferenceArray;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteAtomicLong;
import org.apache.ignite.IgniteQueue;
+import org.apache.ignite.IgniteSet;
import org.apache.ignite.configuration.AtomicConfiguration;
import org.apache.ignite.configuration.CollectionConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -56,7 +57,7 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
/** Grid count. */
private static final int GRID_CNT = 5;
- /** Restart cound. */
+ /** Restart count. */
private static final int RESTART_CNT = 15;
/** Atomic long name. */
@@ -133,8 +134,6 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
* @throws Exception If failed.
*/
public void testClientAtomicLongCreateCloseFailover() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-1732");
-
testFailoverWithClient(new IgniteInClosure<Ignite>() {
@Override public void apply(Ignite ignite) {
for (int i = 0; i < 100; i++) {
@@ -150,8 +149,6 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
* @throws Exception If failed.
*/
public void testClientQueueCreateCloseFailover() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-1976");
-
testFailoverWithClient(new IgniteInClosure<Ignite>() {
@Override public void apply(Ignite ignite) {
for (int i = 0; i < 100; i++) {
@@ -170,6 +167,27 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
}
/**
+ * @throws Exception If failed.
+ */
+ public void testClientSetCreateCloseFailover() throws Exception {
+ testFailoverWithClient(new IgniteInClosure<Ignite>() {
+ @Override public void apply(Ignite ignite) {
+ for (int i = 0; i < 100; i++) {
+ CollectionConfiguration colCfg = new CollectionConfiguration();
+
+ colCfg.setBackups(1);
+ colCfg.setCacheMode(PARTITIONED);
+ colCfg.setAtomicityMode(i % 2 == 0 ? TRANSACTIONAL : ATOMIC);
+
+ IgniteSet set = ignite.set("set-" + i, colCfg);
+
+ set.close();
+ }
+ }
+ });
+ }
+
+ /**
* @param c Test iteration closure.
* @throws Exception If failed.
*/
@@ -188,7 +206,7 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
IgniteInternalFuture<?> fut = restartThread(finished);
- long stop = System.currentTimeMillis() + 30_000;
+ long stop = System.currentTimeMillis() + 60_000;
try {
int iter = 0;
[45/50] [abbrv] ignite git commit: Package-info files.
Posted by ra...@apache.org.
Package-info files.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/346733f4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/346733f4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/346733f4
Branch: refs/heads/master
Commit: 346733f43da891c2c343ea8e924032acaa5f41b7
Parents: 0b61333
Author: Anton Vinogradov <av...@apache.org>
Authored: Mon Nov 30 14:25:50 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Mon Nov 30 14:25:50 2015 +0300
----------------------------------------------------------------------
.../ignite/stream/camel/package-info.java | 21 ++++++++++++++++++++
.../ignite/stream/camel/package-info.java | 21 ++++++++++++++++++++
.../ignite/stream/flume/package-info.java | 21 ++++++++++++++++++++
.../ignite/stream/flume/package-info.java | 21 ++++++++++++++++++++
.../ignite/stream/jms11/package-info.java | 21 ++++++++++++++++++++
.../ignite/stream/jms11/package-info.java | 21 ++++++++++++++++++++
.../ignite/stream/kafka/package-info.java | 21 ++++++++++++++++++++
.../ignite/stream/kafka/package-info.java | 21 ++++++++++++++++++++
.../apache/ignite/stream/mqtt/package-info.java | 21 ++++++++++++++++++++
.../apache/ignite/stream/mqtt/package-info.java | 21 ++++++++++++++++++++
.../ignite/stream/twitter/package-info.java | 21 ++++++++++++++++++++
.../ignite/stream/twitter/package-info.java | 21 ++++++++++++++++++++
12 files changed, 252 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/346733f4/modules/camel/src/main/java/org/apache/ignite/stream/camel/package-info.java
----------------------------------------------------------------------
diff --git a/modules/camel/src/main/java/org/apache/ignite/stream/camel/package-info.java b/modules/camel/src/main/java/org/apache/ignite/stream/camel/package-info.java
new file mode 100644
index 0000000..f084813
--- /dev/null
+++ b/modules/camel/src/main/java/org/apache/ignite/stream/camel/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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 implementation of Camel Streamer.
+ */
+package org.apache.ignite.stream.camel;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/346733f4/modules/camel/src/test/java/org/apache/ignite/stream/camel/package-info.java
----------------------------------------------------------------------
diff --git a/modules/camel/src/test/java/org/apache/ignite/stream/camel/package-info.java b/modules/camel/src/test/java/org/apache/ignite/stream/camel/package-info.java
new file mode 100644
index 0000000..f084813
--- /dev/null
+++ b/modules/camel/src/test/java/org/apache/ignite/stream/camel/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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 implementation of Camel Streamer.
+ */
+package org.apache.ignite.stream.camel;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/346733f4/modules/flume/src/main/java/org/apache/ignite/stream/flume/package-info.java
----------------------------------------------------------------------
diff --git a/modules/flume/src/main/java/org/apache/ignite/stream/flume/package-info.java b/modules/flume/src/main/java/org/apache/ignite/stream/flume/package-info.java
new file mode 100644
index 0000000..a88e39e
--- /dev/null
+++ b/modules/flume/src/main/java/org/apache/ignite/stream/flume/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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 implementation of Flume Sink.
+ */
+package org.apache.ignite.stream.flume;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/346733f4/modules/flume/src/test/java/org/apache/ignite/stream/flume/package-info.java
----------------------------------------------------------------------
diff --git a/modules/flume/src/test/java/org/apache/ignite/stream/flume/package-info.java b/modules/flume/src/test/java/org/apache/ignite/stream/flume/package-info.java
new file mode 100644
index 0000000..a88e39e
--- /dev/null
+++ b/modules/flume/src/test/java/org/apache/ignite/stream/flume/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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 implementation of Flume Sink.
+ */
+package org.apache.ignite.stream.flume;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/346733f4/modules/jms11/src/main/java/org/apache/ignite/stream/jms11/package-info.java
----------------------------------------------------------------------
diff --git a/modules/jms11/src/main/java/org/apache/ignite/stream/jms11/package-info.java b/modules/jms11/src/main/java/org/apache/ignite/stream/jms11/package-info.java
new file mode 100644
index 0000000..b3393ee
--- /dev/null
+++ b/modules/jms11/src/main/java/org/apache/ignite/stream/jms11/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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 implementation of JMS queue and topic messages consumer.
+ */
+package org.apache.ignite.stream.jms11;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/346733f4/modules/jms11/src/test/java/org/apache/ignite/stream/jms11/package-info.java
----------------------------------------------------------------------
diff --git a/modules/jms11/src/test/java/org/apache/ignite/stream/jms11/package-info.java b/modules/jms11/src/test/java/org/apache/ignite/stream/jms11/package-info.java
new file mode 100644
index 0000000..b3393ee
--- /dev/null
+++ b/modules/jms11/src/test/java/org/apache/ignite/stream/jms11/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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 implementation of JMS queue and topic messages consumer.
+ */
+package org.apache.ignite.stream.jms11;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/346733f4/modules/kafka/src/main/java/org/apache/ignite/stream/kafka/package-info.java
----------------------------------------------------------------------
diff --git a/modules/kafka/src/main/java/org/apache/ignite/stream/kafka/package-info.java b/modules/kafka/src/main/java/org/apache/ignite/stream/kafka/package-info.java
new file mode 100644
index 0000000..3b76237
--- /dev/null
+++ b/modules/kafka/src/main/java/org/apache/ignite/stream/kafka/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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 implementation of Kafka Streamer.
+ */
+package org.apache.ignite.stream.kafka;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/346733f4/modules/kafka/src/test/java/org/apache/ignite/stream/kafka/package-info.java
----------------------------------------------------------------------
diff --git a/modules/kafka/src/test/java/org/apache/ignite/stream/kafka/package-info.java b/modules/kafka/src/test/java/org/apache/ignite/stream/kafka/package-info.java
new file mode 100644
index 0000000..3b76237
--- /dev/null
+++ b/modules/kafka/src/test/java/org/apache/ignite/stream/kafka/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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 implementation of Kafka Streamer.
+ */
+package org.apache.ignite.stream.kafka;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/346733f4/modules/mqtt/src/main/java/org/apache/ignite/stream/mqtt/package-info.java
----------------------------------------------------------------------
diff --git a/modules/mqtt/src/main/java/org/apache/ignite/stream/mqtt/package-info.java b/modules/mqtt/src/main/java/org/apache/ignite/stream/mqtt/package-info.java
new file mode 100644
index 0000000..67b949a
--- /dev/null
+++ b/modules/mqtt/src/main/java/org/apache/ignite/stream/mqtt/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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 implementation of MQTT topic messages consumer.
+ */
+package org.apache.ignite.stream.mqtt;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/346733f4/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/package-info.java
----------------------------------------------------------------------
diff --git a/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/package-info.java b/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/package-info.java
new file mode 100644
index 0000000..67b949a
--- /dev/null
+++ b/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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 implementation of MQTT topic messages consumer.
+ */
+package org.apache.ignite.stream.mqtt;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/346733f4/modules/twitter/src/main/java/org/apache/ignite/stream/twitter/package-info.java
----------------------------------------------------------------------
diff --git a/modules/twitter/src/main/java/org/apache/ignite/stream/twitter/package-info.java b/modules/twitter/src/main/java/org/apache/ignite/stream/twitter/package-info.java
new file mode 100644
index 0000000..cff6d81
--- /dev/null
+++ b/modules/twitter/src/main/java/org/apache/ignite/stream/twitter/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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 implementation of Twitter Streamer.
+ */
+package org.apache.ignite.stream.twitter;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/346733f4/modules/twitter/src/test/java/org/apache/ignite/stream/twitter/package-info.java
----------------------------------------------------------------------
diff --git a/modules/twitter/src/test/java/org/apache/ignite/stream/twitter/package-info.java b/modules/twitter/src/test/java/org/apache/ignite/stream/twitter/package-info.java
new file mode 100644
index 0000000..cff6d81
--- /dev/null
+++ b/modules/twitter/src/test/java/org/apache/ignite/stream/twitter/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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 implementation of Twitter Streamer.
+ */
+package org.apache.ignite.stream.twitter;
\ No newline at end of file
[41/50] [abbrv] ignite git commit: format
Posted by ra...@apache.org.
format
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3a6a4632
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3a6a4632
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3a6a4632
Branch: refs/heads/master
Commit: 3a6a46322c97d04cf649cad57e9d67cc2213b320
Parents: 59ee87e
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Sat Nov 28 18:45:28 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Sat Nov 28 18:45:28 2015 +0300
----------------------------------------------------------------------
.../processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3a6a4632/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
index 832f076..07e44da 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
@@ -1041,4 +1041,4 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
return res;
}
}
-}
\ No newline at end of file
+}
[40/50] [abbrv] ignite git commit: Fixing metadata update under
changing topology. This closes #280
Posted by ra...@apache.org.
Fixing metadata update under changing topology. This closes #280
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/59ee87e1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/59ee87e1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/59ee87e1
Branch: refs/heads/master
Commit: 59ee87e17d4cb4cc1232dd883e2f708552139c13
Parents: ba28eaf
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Sat Nov 28 18:42:26 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Sat Nov 28 18:42:26 2015 +0300
----------------------------------------------------------------------
.../internal/portable/BinaryEnumObjectImpl.java | 2 +-
.../internal/portable/BinaryObjectImpl.java | 10 +-
.../internal/portable/BinaryReaderExImpl.java | 6 +-
.../internal/portable/BinaryWriterExImpl.java | 10 +-
.../internal/portable/PortableContext.java | 31 ++-
.../ignite/internal/portable/PortableUtils.java | 10 +-
.../builder/BinaryObjectBuilderImpl.java | 2 +-
.../portable/builder/PortableBuilderEnum.java | 2 +-
.../builder/PortableEnumArrayLazyValue.java | 2 +-
.../builder/PortableObjectArrayLazyValue.java | 2 +-
.../CacheDefaultBinaryAffinityKeyMapper.java | 51 ++++
.../distributed/dht/GridDhtTxFinishFuture.java | 12 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 2 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 37 ++-
.../dht/atomic/GridDhtAtomicCache.java | 5 +-
.../colocated/GridDhtColocatedLockFuture.java | 17 +-
.../distributed/near/GridNearLockFuture.java | 24 +-
...arOptimisticSerializableTxPrepareFuture.java | 12 +-
.../near/GridNearOptimisticTxPrepareFuture.java | 134 +++++-----
.../portable/CacheObjectPortableContext.java | 3 +-
.../cache/transactions/IgniteTxHandler.java | 6 +-
.../cache/transactions/IgniteTxManager.java | 22 +-
.../portable/BinaryMarshallerSelfTest.java | 2 +-
.../CachePutEventListenerErrorSelfTest.java | 180 ++++++++++++++
.../GridCacheOnCopyFlagAbstractSelfTest.java | 14 +-
...yMetadataUpdateChangingTopologySelfTest.java | 245 +++++++++++++++++++
.../replicated/GridReplicatedTxPreloadTest.java | 6 +
...CacheReplicatedPreloadLifecycleSelfTest.java | 100 +++++---
.../ignite/testsuites/IgniteCacheTestSuite.java | 3 +
.../IgnitePortableObjectsTestSuite.java | 2 +
30 files changed, 791 insertions(+), 163 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryEnumObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryEnumObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryEnumObjectImpl.java
index e13c076..467d767 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryEnumObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryEnumObjectImpl.java
@@ -110,7 +110,7 @@ public class BinaryEnumObjectImpl implements BinaryObjectEx, Externalizable, Cac
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public <T> T deserialize() throws BinaryObjectException {
- Class cls = PortableUtils.resolveClass(ctx, typeId, clsName, null);
+ Class cls = PortableUtils.resolveClass(ctx, typeId, clsName, null, true);
return BinaryEnumCache.get(cls, ord);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
index 87a03dc..cf5a659 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
@@ -127,7 +127,7 @@ public final class BinaryObjectImpl extends BinaryObjectExImpl implements Extern
@Nullable @Override public <T> T value(CacheObjectContext ctx, boolean cpy) {
Object obj0 = obj;
- if (obj0 == null || cpy)
+ if (obj0 == null || (cpy && needCopy(ctx)))
obj0 = deserializeValue(ctx);
return (T)obj0;
@@ -561,6 +561,14 @@ public final class BinaryObjectImpl extends BinaryObjectExImpl implements Extern
}
/**
+ * @param ctx Context.
+ * @return {@code True} need to copy value returned to user.
+ */
+ private boolean needCopy(CacheObjectContext ctx) {
+ return ctx.copyOnGet() && obj != null && !ctx.processor().immutable(obj);
+ }
+
+ /**
* Create new reader for this object.
*
* @param rCtx Reader context.
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
index 3cc2fbe..b9f851c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
@@ -234,7 +234,7 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Bina
int off = in.position();
// Registers class by type ID, at least locally if the cache is not ready yet.
- typeId = ctx.descriptorForClass(PortableUtils.doReadClass(in, ctx, ldr, typeId0)).typeId();
+ typeId = ctx.descriptorForClass(PortableUtils.doReadClass(in, ctx, ldr, typeId0), false).typeId();
int clsNameLen = in.position() - off;
@@ -277,7 +277,7 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Bina
* @return Descriptor.
*/
PortableClassDescriptor descriptor() {
- return ctx.descriptorForTypeId(userType, typeId, ldr);
+ return ctx.descriptorForTypeId(userType, typeId, ldr, true);
}
/**
@@ -1427,7 +1427,7 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Bina
break;
case OBJ:
- PortableClassDescriptor desc = ctx.descriptorForTypeId(userType, typeId, ldr);
+ PortableClassDescriptor desc = ctx.descriptorForTypeId(userType, typeId, ldr, true);
streamPosition(dataStart);
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
index 9d1d037..95807ea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
@@ -182,7 +182,7 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
Class<?> cls = obj.getClass();
- PortableClassDescriptor desc = ctx.descriptorForClass(cls);
+ PortableClassDescriptor desc = ctx.descriptorForClass(cls, false);
if (desc == null)
throw new BinaryObjectException("Object is not portable: [class=" + cls + ']');
@@ -697,7 +697,7 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
if (tryWriteAsHandle(val))
return;
- PortableClassDescriptor desc = ctx.descriptorForClass(val.getClass().getComponentType());
+ PortableClassDescriptor desc = ctx.descriptorForClass(val.getClass().getComponentType(), false);
out.unsafeEnsure(1 + 4);
out.unsafeWriteByte(OBJ_ARR);
@@ -785,7 +785,7 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
if (val == null)
out.writeByte(NULL);
else {
- PortableClassDescriptor desc = ctx.descriptorForClass(val.getClass());
+ PortableClassDescriptor desc = ctx.descriptorForClass(val.getClass(), false);
out.unsafeEnsure(1 + 4);
@@ -830,7 +830,7 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
if (val == null)
out.writeByte(NULL);
else {
- PortableClassDescriptor desc = ctx.descriptorForClass(val.getClass().getComponentType());
+ PortableClassDescriptor desc = ctx.descriptorForClass(val.getClass().getComponentType(), false);
out.unsafeEnsure(1 + 4);
@@ -859,7 +859,7 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
if (val == null)
out.writeByte(NULL);
else {
- PortableClassDescriptor desc = ctx.descriptorForClass(val);
+ PortableClassDescriptor desc = ctx.descriptorForClass(val, false);
out.unsafeEnsure(1 + 4);
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
index ae0d940..1482df9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
@@ -402,14 +402,14 @@ public class PortableContext implements Externalizable {
* @return Class descriptor.
* @throws org.apache.ignite.binary.BinaryObjectException In case of error.
*/
- public PortableClassDescriptor descriptorForClass(Class<?> cls)
+ public PortableClassDescriptor descriptorForClass(Class<?> cls, boolean deserialize)
throws BinaryObjectException {
assert cls != null;
PortableClassDescriptor desc = descByCls.get(cls);
if (desc == null || !desc.registered())
- desc = registerClassDescriptor(cls);
+ desc = registerClassDescriptor(cls, deserialize);
return desc;
}
@@ -420,7 +420,12 @@ public class PortableContext implements Externalizable {
* @param ldr Class loader.
* @return Class descriptor.
*/
- public PortableClassDescriptor descriptorForTypeId(boolean userType, int typeId, ClassLoader ldr) {
+ public PortableClassDescriptor descriptorForTypeId(
+ boolean userType,
+ int typeId,
+ ClassLoader ldr,
+ boolean deserialize
+ ) {
assert typeId != GridPortableMarshaller.UNREGISTERED_TYPE_ID;
//TODO: As a workaround for IGNITE-1358 we always check the predefined map before without checking 'userType'
@@ -450,21 +455,21 @@ public class PortableContext implements Externalizable {
}
catch (ClassNotFoundException e) {
// Class might have been loaded by default class loader.
- if (userType && !ldr.equals(dfltLdr) && (desc = descriptorForTypeId(true, typeId, dfltLdr)) != null)
+ if (userType && !ldr.equals(dfltLdr) && (desc = descriptorForTypeId(true, typeId, dfltLdr, deserialize)) != null)
return desc;
throw new BinaryInvalidTypeException(e);
}
catch (IgniteCheckedException e) {
// Class might have been loaded by default class loader.
- if (userType && !ldr.equals(dfltLdr) && (desc = descriptorForTypeId(true, typeId, dfltLdr)) != null)
+ if (userType && !ldr.equals(dfltLdr) && (desc = descriptorForTypeId(true, typeId, dfltLdr, deserialize)) != null)
return desc;
throw new BinaryObjectException("Failed resolve class for ID: " + typeId, e);
}
if (desc == null) {
- desc = registerClassDescriptor(cls);
+ desc = registerClassDescriptor(cls, deserialize);
assert desc.typeId() == typeId;
}
@@ -478,7 +483,7 @@ public class PortableContext implements Externalizable {
* @param cls Class.
* @return Class descriptor.
*/
- private PortableClassDescriptor registerClassDescriptor(Class<?> cls) {
+ private PortableClassDescriptor registerClassDescriptor(Class<?> cls, boolean deserialize) {
PortableClassDescriptor desc;
String clsName = cls.getName();
@@ -503,7 +508,7 @@ public class PortableContext implements Externalizable {
desc = old;
}
else
- desc = registerUserClassDescriptor(cls);
+ desc = registerUserClassDescriptor(cls, deserialize);
return desc;
}
@@ -514,7 +519,7 @@ public class PortableContext implements Externalizable {
* @param cls Class.
* @return Class descriptor.
*/
- private PortableClassDescriptor registerUserClassDescriptor(Class<?> cls) {
+ private PortableClassDescriptor registerUserClassDescriptor(Class<?> cls, boolean deserialize) {
boolean registered;
String typeName = typeName(cls.getName());
@@ -545,10 +550,12 @@ public class PortableContext implements Externalizable {
false /* predefined */
);
- Collection<PortableSchema> schemas = desc.schema() != null ? Collections.singleton(desc.schema()) : null;
+ if (!deserialize) {
+ Collection<PortableSchema> schemas = desc.schema() != null ? Collections.singleton(desc.schema()) : null;
- metaHnd.addMeta(typeId,
- new BinaryMetadata(typeId, typeName, desc.fieldsMeta(), affFieldName, schemas, desc.isEnum()).wrap(this));
+ metaHnd.addMeta(typeId,
+ new BinaryMetadata(typeId, typeName, desc.fieldsMeta(), affFieldName, schemas, desc.isEnum()).wrap(this));
+ }
// perform put() instead of putIfAbsent() because "registered" flag might have been changed or class loader
// might have reloaded described class.
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
index 1a8f156..5d794ca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
@@ -1366,7 +1366,7 @@ public class PortableUtils {
return Object.class;
if (typeId != UNREGISTERED_TYPE_ID)
- cls = ctx.descriptorForTypeId(true, typeId, ldr).describedClass();
+ cls = ctx.descriptorForTypeId(true, typeId, ldr, false).describedClass();
else {
String clsName = doReadClassName(in);
@@ -1378,7 +1378,7 @@ public class PortableUtils {
}
// forces registering of class by type id, at least locally
- ctx.descriptorForClass(cls);
+ ctx.descriptorForClass(cls, true);
}
return cls;
@@ -1394,14 +1394,14 @@ public class PortableUtils {
* @return Resovled class.
*/
public static Class resolveClass(PortableContext ctx, int typeId, @Nullable String clsName,
- @Nullable ClassLoader ldr) {
+ @Nullable ClassLoader ldr, boolean deserialize) {
Class cls;
if (typeId == OBJECT_TYPE_ID)
return Object.class;
if (typeId != UNREGISTERED_TYPE_ID)
- cls = ctx.descriptorForTypeId(true, typeId, ldr).describedClass();
+ cls = ctx.descriptorForTypeId(true, typeId, ldr, deserialize).describedClass();
else {
try {
cls = U.forName(clsName, ldr);
@@ -1411,7 +1411,7 @@ public class PortableUtils {
}
// forces registering of class by type id, at least locally
- ctx.descriptorForClass(cls);
+ ctx.descriptorForClass(cls, true);
}
return cls;
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
index cadc781..c4ce9e6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
@@ -161,7 +161,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
throw new BinaryInvalidTypeException("Failed to load the class: " + clsNameToWrite, e);
}
- this.typeId = ctx.descriptorForClass(cls).typeId();
+ this.typeId = ctx.descriptorForClass(cls, false).typeId();
registeredType = false;
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
index 9eb77b4..6f79e73 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
@@ -64,7 +64,7 @@ public class PortableBuilderEnum implements PortableBuilderSerializationAware {
throw new BinaryInvalidTypeException("Failed to load the class: " + clsName, e);
}
- this.typeId = reader.portableContext().descriptorForClass(cls).typeId();
+ this.typeId = reader.portableContext().descriptorForClass(cls, false).typeId();
}
else {
this.typeId = typeId;
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
index 1e2ebc9..91c1c87 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
@@ -57,7 +57,7 @@ class PortableEnumArrayLazyValue extends PortableAbstractLazyValue {
throw new BinaryInvalidTypeException("Failed to load the class: " + clsName, e);
}
- compTypeId = reader.portableContext().descriptorForClass(cls).typeId();
+ compTypeId = reader.portableContext().descriptorForClass(cls, true).typeId();
}
else {
compTypeId = typeId;
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
index 6634eea..8c8022b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
@@ -56,7 +56,7 @@ class PortableObjectArrayLazyValue extends PortableAbstractLazyValue {
throw new BinaryInvalidTypeException("Failed to load the class: " + clsName, e);
}
- compTypeId = reader.portableContext().descriptorForClass(cls).typeId();
+ compTypeId = reader.portableContext().descriptorForClass(cls, true).typeId();
}
else {
compTypeId = typeId;
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheDefaultBinaryAffinityKeyMapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheDefaultBinaryAffinityKeyMapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheDefaultBinaryAffinityKeyMapper.java
new file mode 100644
index 0000000..efd38f7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheDefaultBinaryAffinityKeyMapper.java
@@ -0,0 +1,51 @@
+/*
+ * 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.IgniteException;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.binary.BinaryObject;
+
+/**
+ *
+ */
+public class CacheDefaultBinaryAffinityKeyMapper extends GridCacheDefaultAffinityKeyMapper {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override public Object affinityKey(Object key) {
+ IgniteKernal kernal = (IgniteKernal)ignite;
+
+ CacheObjectBinaryProcessorImpl proc = (CacheObjectBinaryProcessorImpl)kernal.context().cacheObjects();
+
+ try {
+ key = proc.toPortable(key);
+ }
+ catch (IgniteException e) {
+ U.error(log, "Failed to marshal key to portable: " + key, e);
+ }
+
+ if (key instanceof BinaryObject)
+ return proc.affinityKey((BinaryObject)key);
+ else
+ return super.affinityKey(key);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
index c4a90b1..9a0d778 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
@@ -201,9 +201,17 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
Throwable e = this.err.get();
- if (super.onDone(tx, e != null ? e : err)) {
+ if (e == null && commit)
+ e = this.tx.commitError();
+
+ Throwable finishErr = e != null ? e : err;
+
+ if (super.onDone(tx, finishErr)) {
+ if (finishErr == null)
+ finishErr = this.tx.commitError();
+
// Always send finish reply.
- this.tx.sendFinishReply(commit, error());
+ this.tx.sendFinishReply(commit, finishErr);
// Don't forget to clean up.
cctx.mvcc().removeFuture(futId);
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
index 2330a95..534a560 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
@@ -822,7 +822,7 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter {
/**
* @return {@code True} if transaction is finished on prepare step.
*/
- protected final boolean commitOnPrepare() {
+ public final boolean commitOnPrepare() {
return onePhaseCommit() && !near() && !nearOnOriginatingNode;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 1d418ea..34addfa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -58,6 +58,7 @@ import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.processors.dr.GridDrType;
+import org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException;
import org.apache.ignite.internal.transactions.IgniteTxOptimisticCheckedException;
import org.apache.ignite.internal.util.F0;
import org.apache.ignite.internal.util.GridLeanSet;
@@ -602,13 +603,8 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
if (tx.markFinalizing(IgniteInternalTx.FinalizationStatus.USER_FINISH)) {
IgniteInternalFuture<IgniteInternalTx> fut = null;
- if (prepErr == null)
- fut = tx.commitAsync();
- else if (!cctx.kernalContext().isStopping())
- fut = tx.rollbackAsync();
-
- if (fut != null) {
- fut.listen(new CIX1<IgniteInternalFuture<IgniteInternalTx>>() {
+ CIX1<IgniteInternalFuture<IgniteInternalTx>> responseClo =
+ new CIX1<IgniteInternalFuture<IgniteInternalTx>>() {
@Override public void applyx(IgniteInternalFuture<IgniteInternalTx> fut) {
try {
if (replied.compareAndSet(false, true))
@@ -618,8 +614,33 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
U.error(log, "Failed to send prepare response for transaction: " + tx, e);
}
}
- });
+ };
+
+ if (prepErr == null) {
+ try {
+ fut = tx.commitAsync();
+ }
+ catch (RuntimeException | Error e) {
+ Exception hEx = new IgniteTxHeuristicCheckedException("Commit produced a runtime " +
+ "exception: " + CU.txString(tx), e);
+
+ res.error(hEx);
+
+ tx.systemInvalidate(true);
+
+ fut = tx.rollbackAsync();
+
+ fut.listen(responseClo);
+
+ throw e;
+ }
+
}
+ else if (!cctx.kernalContext().isStopping())
+ fut = tx.rollbackAsync();
+
+ if (fut != null)
+ fut.listen(responseClo);
}
}
else {
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 8fe1b3a..a49341b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -1393,7 +1393,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
remap = true;
}
- catch (Exception e) {
+ catch (Throwable e) {
// At least RuntimeException can be thrown by the code above when GridCacheContext is cleaned and there is
// an attempt to use cleaned resources.
U.error(log, "Unexpected exception during cache update", e);
@@ -1402,6 +1402,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
completionCb.apply(req, res);
+ if (e instanceof Error)
+ throw e;
+
return;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
index ecdf641..d3028ca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
@@ -977,12 +977,27 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
}
/**
+ * @throws IgniteCheckedException If failed.
+ */
+ private void proceedMapping() throws IgniteCheckedException {
+ boolean set = tx != null && cctx.shared().tm().setTxTopologyHint(tx);
+
+ try {
+ proceedMapping0();
+ }
+ finally {
+ if (set)
+ cctx.tm().setTxTopologyHint(null);
+ }
+ }
+
+ /**
* Gets next near lock mapping and either acquires dht locks locally or sends near lock request to
* remote primary node.
*
* @throws IgniteCheckedException If mapping can not be completed.
*/
- private void proceedMapping()
+ private void proceedMapping0()
throws IgniteCheckedException {
GridNearLockMapping map;
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
index f1f9990..4cb7248 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
@@ -263,13 +263,6 @@ public final class GridNearLockFuture extends GridCompoundIdentityFuture<Boolean
}
/**
- * @return {@code True} if commit is synchronous.
- */
- private boolean syncCommit() {
- return tx != null && tx.syncCommit();
- }
-
- /**
* @return {@code True} if rollback is synchronous.
*/
private boolean syncRollback() {
@@ -1082,13 +1075,28 @@ public final class GridNearLockFuture extends GridCompoundIdentityFuture<Boolean
}
/**
+ * @throws IgniteCheckedException If failed.
+ */
+ private void proceedMapping() throws IgniteCheckedException {
+ boolean set = tx != null && cctx.shared().tm().setTxTopologyHint(tx);
+
+ try {
+ proceedMapping0();
+ }
+ finally {
+ if (set)
+ cctx.tm().setTxTopologyHint(null);
+ }
+ }
+
+ /**
* Gets next near lock mapping and either acquires dht locks locally or sends near lock request to
* remote primary node.
*
* @throws IgniteCheckedException If mapping can not be completed.
*/
@SuppressWarnings("unchecked")
- private void proceedMapping()
+ private void proceedMapping0()
throws IgniteCheckedException {
GridNearLockMapping map;
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
index 916c7ab..f52b3fc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
@@ -304,9 +304,17 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
return;
}
- prepare(tx.readEntries(), tx.writeEntries(), remap, topLocked);
+ boolean set = cctx.tm().setTxTopologyHint(tx);
- markInitialized();
+ try {
+ prepare(tx.readEntries(), tx.writeEntries(), remap, topLocked);
+
+ markInitialized();
+ }
+ finally {
+ if (set)
+ cctx.tm().setTxTopologyHint(null);
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
index ca1d36c..2ce14af 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -405,82 +405,90 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
if (isDone())
return;
- assert !m.empty();
-
- final ClusterNode n = m.node();
-
- GridNearTxPrepareRequest req = new GridNearTxPrepareRequest(
- futId,
- tx.topologyVersion(),
- tx,
- null,
- m.writes(),
- m.near(),
- txMapping.transactionNodes(),
- m.last(),
- tx.onePhaseCommit(),
- tx.needReturnValue() && tx.implicit(),
- tx.implicitSingle(),
- m.explicitLock(),
- tx.subjectId(),
- tx.taskNameHash(),
- m.clientFirst(),
- tx.activeCachesDeploymentEnabled());
-
- for (IgniteTxEntry txEntry : m.writes()) {
- if (txEntry.op() == TRANSFORM)
- req.addDhtVersion(txEntry.txKey(), null);
- }
-
- // Must lock near entries separately.
- if (m.near()) {
- try {
- tx.optimisticLockEntries(req.writes());
+ boolean set = cctx.tm().setTxTopologyHint(tx);
- tx.userPrepare();
+ try {
+ assert !m.empty();
+
+ final ClusterNode n = m.node();
+
+ GridNearTxPrepareRequest req = new GridNearTxPrepareRequest(
+ futId,
+ tx.topologyVersion(),
+ tx,
+ null,
+ m.writes(),
+ m.near(),
+ txMapping.transactionNodes(),
+ m.last(),
+ tx.onePhaseCommit(),
+ tx.needReturnValue() && tx.implicit(),
+ tx.implicitSingle(),
+ m.explicitLock(),
+ tx.subjectId(),
+ tx.taskNameHash(),
+ m.clientFirst(),
+ tx.activeCachesDeploymentEnabled());
+
+ for (IgniteTxEntry txEntry : m.writes()) {
+ if (txEntry.op() == TRANSFORM)
+ req.addDhtVersion(txEntry.txKey(), null);
}
- catch (IgniteCheckedException e) {
- onError(e);
+
+ // Must lock near entries separately.
+ if (m.near()) {
+ try {
+ tx.optimisticLockEntries(req.writes());
+
+ tx.userPrepare();
+ }
+ catch (IgniteCheckedException e) {
+ onError(e);
+ }
}
- }
- final MiniFuture fut = new MiniFuture(m, mappings);
+ final MiniFuture fut = new MiniFuture(m, mappings);
- req.miniId(fut.futureId());
+ req.miniId(fut.futureId());
- add(fut); // Append new future.
+ add(fut); // Append new future.
- // If this is the primary node for the keys.
- if (n.isLocal()) {
- // At this point, if any new node joined, then it is
- // waiting for this transaction to complete, so
- // partition reassignments are not possible here.
- IgniteInternalFuture<GridNearTxPrepareResponse> prepFut = cctx.tm().txHandler().prepareTx(n.id(), tx, req);
+ // If this is the primary node for the keys.
+ if (n.isLocal()) {
+ // At this point, if any new node joined, then it is
+ // waiting for this transaction to complete, so
+ // partition reassignments are not possible here.
+ IgniteInternalFuture<GridNearTxPrepareResponse> prepFut = cctx.tm().txHandler().prepareTx(n.id(), tx, req);
- prepFut.listen(new CI1<IgniteInternalFuture<GridNearTxPrepareResponse>>() {
- @Override public void apply(IgniteInternalFuture<GridNearTxPrepareResponse> prepFut) {
- try {
- fut.onResult(n.id(), prepFut.get());
- }
- catch (IgniteCheckedException e) {
- fut.onResult(e);
+ prepFut.listen(new CI1<IgniteInternalFuture<GridNearTxPrepareResponse>>() {
+ @Override public void apply(IgniteInternalFuture<GridNearTxPrepareResponse> prepFut) {
+ try {
+ fut.onResult(n.id(), prepFut.get());
+ }
+ catch (IgniteCheckedException e) {
+ fut.onResult(e);
+ }
}
- }
- });
- }
- else {
- try {
- cctx.io().send(n, req, tx.ioPolicy());
+ });
}
- catch (ClusterTopologyCheckedException e) {
- e.retryReadyFuture(cctx.nextAffinityReadyFuture(tx.topologyVersion()));
+ else {
+ try {
+ cctx.io().send(n, req, tx.ioPolicy());
+ }
+ catch (ClusterTopologyCheckedException e) {
+ e.retryReadyFuture(cctx.nextAffinityReadyFuture(tx.topologyVersion()));
- fut.onResult(e);
- }
- catch (IgniteCheckedException e) {
- fut.onResult(e);
+ fut.onResult(e);
+ }
+ catch (IgniteCheckedException e) {
+ fut.onResult(e);
+ }
}
}
+ finally {
+ if (set)
+ cctx.tm().setTxTopologyHint(null);
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java
index c83c9af..719d0a9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.cache.portable;
import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.cache.CacheDefaultBinaryAffinityKeyMapper;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper;
@@ -40,7 +41,7 @@ public class CacheObjectPortableContext extends CacheObjectContext {
boolean storeVal,
boolean portableEnabled,
boolean depEnabled) {
- super(kernalCtx, portableEnabled ? new CacheDefaultPortableAffinityKeyMapper() :
+ super(kernalCtx, portableEnabled ? new CacheDefaultBinaryAffinityKeyMapper() :
new GridCacheDefaultAffinityKeyMapper(), cpyOnGet, storeVal, depEnabled);
this.portableEnabled = portableEnabled;
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index 63a4cbe..61a9bed 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -413,7 +413,7 @@ public class IgniteTxHandler {
req.transactionNodes(),
req.last());
- if (tx.isRollbackOnly()) {
+ if (tx.isRollbackOnly() && !tx.commitOnPrepare()) {
try {
if (tx.state() != TransactionState.ROLLED_BACK && tx.state() != TransactionState.ROLLING_BACK)
tx.rollback();
@@ -713,6 +713,10 @@ public class IgniteTxHandler {
}
}
catch (Throwable e) {
+ tx.commitError(e);
+
+ tx.systemInvalidate(true);
+
U.error(log, "Failed completing transaction [commit=" + req.commit() + ", tx=" + tx + ']', e);
IgniteInternalFuture<IgniteInternalTx> res = null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
index 421b0e6..243c4cb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
@@ -114,6 +114,9 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
/** Committing transactions. */
private final ThreadLocal<IgniteInternalTx> threadCtx = new ThreadLocal<>();
+ /** Transaction which topology version should be used when mapping internal tx. */
+ private final ThreadLocal<IgniteInternalTx> txTopology = new ThreadLocal<>();
+
/** Per-thread transaction map. */
private final ConcurrentMap<Long, IgniteInternalTx> threadMap = newMap();
@@ -622,7 +625,24 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
return tx;
}
- return null;
+ return txTopology.get();
+ }
+
+ /**
+ * @param tx Transaction.
+ */
+ public boolean setTxTopologyHint(IgniteInternalTx tx) {
+ if (tx == null)
+ txTopology.remove();
+ else {
+ if (txTopology.get() == null) {
+ txTopology.set(tx);
+
+ return true;
+ }
+ }
+
+ return false;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
index ad0dcf2..cc035f6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
@@ -2105,7 +2105,7 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
if (id == GridPortableMarshaller.UNREGISTERED_TYPE_ID)
continue;
- PortableClassDescriptor desc = pCtx.descriptorForTypeId(false, entry.getValue(), null);
+ PortableClassDescriptor desc = pCtx.descriptorForTypeId(false, entry.getValue(), null, false);
assertEquals(desc.typeId(), pCtx.typeId(desc.describedClass().getName()));
assertEquals(desc.typeId(), pCtx.typeId(pCtx.typeName(desc.describedClass().getName())));
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutEventListenerErrorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutEventListenerErrorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutEventListenerErrorSelfTest.java
new file mode 100644
index 0000000..0e0e521
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutEventListenerErrorSelfTest.java
@@ -0,0 +1,180 @@
+/*
+ * 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 java.util.UUID;
+import javax.cache.CacheException;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMemoryMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.events.Event;
+import org.apache.ignite.events.EventType;
+import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Test for cache put with error in event listener.
+ */
+public class CachePutEventListenerErrorSelfTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+ disco.setIpFinder(IP_FINDER);
+
+ cfg.setDiscoverySpi(disco);
+
+ cfg.setIncludeEventTypes(EventType.EVT_CACHE_OBJECT_PUT);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ startGridsMultiThreaded(3);
+
+ Ignition.setClientMode(true);
+
+ Ignite ignite = startGrid("client");
+
+ ignite.events().remoteListen(
+ new IgniteBiPredicate<UUID, Event>() {
+ @Override public boolean apply(UUID uuid, Event evt) {
+ return true;
+ }
+ },
+ new IgnitePredicate<Event>() {
+ @Override public boolean apply(Event evt) {
+ throw new NoClassDefFoundError("XXX");
+ }
+ },
+ EventType.EVT_CACHE_OBJECT_PUT
+ );
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPartitionedAtomicOnHeap() throws Exception {
+ doTest(CacheMode.PARTITIONED, CacheAtomicityMode.ATOMIC, CacheMemoryMode.ONHEAP_TIERED);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPartitionedAtomicOffHeap() throws Exception {
+ doTest(CacheMode.PARTITIONED, CacheAtomicityMode.ATOMIC, CacheMemoryMode.OFFHEAP_TIERED);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPartitionedTransactionalOnHeap() throws Exception {
+ doTest(CacheMode.PARTITIONED, CacheAtomicityMode.TRANSACTIONAL, CacheMemoryMode.ONHEAP_TIERED);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPartitionedTransactionalOffHeap() throws Exception {
+ doTest(CacheMode.PARTITIONED, CacheAtomicityMode.TRANSACTIONAL, CacheMemoryMode.OFFHEAP_TIERED);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testReplicatedAtomicOnHeap() throws Exception {
+ doTest(CacheMode.REPLICATED, CacheAtomicityMode.ATOMIC, CacheMemoryMode.ONHEAP_TIERED);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testReplicatedAtomicOffHeap() throws Exception {
+ doTest(CacheMode.REPLICATED, CacheAtomicityMode.ATOMIC, CacheMemoryMode.OFFHEAP_TIERED);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testReplicatedTransactionalOnHeap() throws Exception {
+ doTest(CacheMode.REPLICATED, CacheAtomicityMode.TRANSACTIONAL, CacheMemoryMode.ONHEAP_TIERED);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testReplicatedTransactionalOffHeap() throws Exception {
+ doTest(CacheMode.REPLICATED, CacheAtomicityMode.TRANSACTIONAL, CacheMemoryMode.OFFHEAP_TIERED);
+ }
+
+ /**
+ * @param cacheMode Cache mode.
+ * @param atomicityMode Atomicity mode.
+ * @param memMode Memory mode.
+ * @throws Exception If failed.
+ */
+ private void doTest(CacheMode cacheMode, CacheAtomicityMode atomicityMode, CacheMemoryMode memMode)
+ throws Exception {
+ Ignite ignite = grid("client");
+
+ try {
+ CacheConfiguration<Integer, Integer> cfg = defaultCacheConfiguration();
+
+ cfg.setName("cache");
+ cfg.setCacheMode(cacheMode);
+ cfg.setAtomicityMode(atomicityMode);
+ cfg.setMemoryMode(memMode);
+
+ IgniteCache<Integer, Integer> cache = ignite.createCache(cfg).withAsync();
+
+ cache.put(0, 0);
+
+ try {
+ cache.future().get(2000);
+
+ assert false : "Exception was not thrown";
+ }
+ catch (CacheException e) {
+ info("Caught expected exception: " + e);
+ }
+ }
+ finally {
+ ignite.destroyCache("cache");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
index 10fb661..b9c1449 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
@@ -284,6 +284,8 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
GridCacheContext cctx = cache0.context();
+ boolean binary = cctx.cacheObjects().isPortableEnabled(null);
+
for (Map.Entry<TestKey, TestValue> e : map.entrySet()) {
GridCacheEntryEx entry = cache0.peekEx(e.getKey());
@@ -295,7 +297,10 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
TestKey key1 = entry.key().value(cctx.cacheObjectContext(), true);
- assertSame(key0, key1);
+ if (!binary)
+ assertSame(key0, key1);
+ else
+ assertNotSame(key0, key1);
TestValue val0 = entry.rawGet().value(cctx.cacheObjectContext(), false);
@@ -330,6 +335,8 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
GridCacheContext cctx = cache0.context();
+ boolean binary = cctx.cacheObjects().isPortableEnabled(null);
+
for (Map.Entry<TestKey, byte[]> e : map.entrySet()) {
GridCacheEntryEx entry = cache0.peekEx(e.getKey());
@@ -341,7 +348,10 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
TestKey key1 = entry.key().value(cctx.cacheObjectContext(), true);
- assertSame(key0, key1);
+ if (!binary)
+ assertSame(key0, key1);
+ else
+ assertNotSame(key0, key1);
byte[] val0 = entry.rawGet().value(cctx.cacheObjectContext(), false);
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java
new file mode 100644
index 0000000..e53650c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteNodeAttributes;
+import org.apache.ignite.internal.managers.communication.GridIoMessage;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.resources.LoggerResource;
+import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Tests specific scenario when binary metadata should be updated from a system thread
+ * and topology has been already changed since the original transaction start.
+ */
+public class IgniteBinaryMetadataUpdateChangingTopologySelfTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setMarshaller(null);
+
+ CacheConfiguration ccfg = new CacheConfiguration("cache");
+
+ ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+ ccfg.setBackups(1);
+
+ cfg.setCacheConfiguration(ccfg);
+
+ TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+ discoSpi.setIpFinder(IP_FINDER);
+
+ cfg.setDiscoverySpi(discoSpi);
+
+ cfg.setCommunicationSpi(new TestCommunicationSpi());
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ startGrids(4);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNoDeadlockOptimistic() throws Exception {
+ int key1 = primaryKey(ignite(1).cache("cache"));
+ int key2 = primaryKey(ignite(2).cache("cache"));
+
+ TestCommunicationSpi spi = (TestCommunicationSpi)ignite(1).configuration().getCommunicationSpi();
+
+ spi.blockMessages(GridNearTxPrepareResponse.class, ignite(0).cluster().localNode().id());
+
+ IgniteCache<Object, Object> cache = ignite(0).cache("cache").withAsync();
+
+ cache.putAll(F.asMap(key1, "val1", key2, new TestValue()));
+
+ try {
+ Thread.sleep(500);
+
+ IgniteInternalFuture<Void> fut = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ startGrid(4);
+
+ return null;
+ }
+ });
+
+ Thread.sleep(500);
+
+ spi.stopBlock();
+
+ cache.future().get();
+
+ fut.get();
+ }
+ finally {
+ stopGrid(4);
+ }
+ }
+
+ /**
+ *
+ */
+ private static class TestCommunicationSpi extends TcpCommunicationSpi {
+ /** */
+ @LoggerResource
+ private IgniteLogger log;
+
+ /** */
+ private List<T2<ClusterNode, GridIoMessage>> blockedMsgs = new ArrayList<>();
+
+ /** */
+ private Map<Class<?>, Set<UUID>> blockCls = new HashMap<>();
+
+ /** */
+ private Class<?> recordCls;
+
+ /** */
+ private List<Object> recordedMsgs = new ArrayList<>();
+
+ /** {@inheritDoc} */
+ @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackClosure)
+ throws IgniteSpiException {
+ if (msg instanceof GridIoMessage) {
+ Object msg0 = ((GridIoMessage)msg).message();
+
+ synchronized (this) {
+ if (recordCls != null && msg0.getClass().equals(recordCls))
+ recordedMsgs.add(msg0);
+
+ Set<UUID> blockNodes = blockCls.get(msg0.getClass());
+
+ if (F.contains(blockNodes, node.id())) {
+ log.info("Block message [node=" + node.attribute(IgniteNodeAttributes.ATTR_GRID_NAME) +
+ ", msg=" + msg0 + ']');
+
+ blockedMsgs.add(new T2<>(node, (GridIoMessage)msg));
+
+ return;
+ }
+ }
+ }
+
+ super.sendMessage(node, msg, ackClosure);
+ }
+
+ /**
+ * @param recordCls Message class to record.
+ */
+ void record(@Nullable Class<?> recordCls) {
+ synchronized (this) {
+ this.recordCls = recordCls;
+ }
+ }
+
+ /**
+ * @return Recorded messages.
+ */
+ List<Object> recordedMessages() {
+ synchronized (this) {
+ List<Object> msgs = recordedMsgs;
+
+ recordedMsgs = new ArrayList<>();
+
+ return msgs;
+ }
+ }
+
+ /**
+ * @param cls Message class.
+ * @param nodeId Node ID.
+ */
+ void blockMessages(Class<?> cls, UUID nodeId) {
+ synchronized (this) {
+ Set<UUID> set = blockCls.get(cls);
+
+ if (set == null) {
+ set = new HashSet<>();
+
+ blockCls.put(cls, set);
+ }
+
+ set.add(nodeId);
+ }
+ }
+
+ /**
+ *
+ */
+ void stopBlock() {
+ synchronized (this) {
+ blockCls.clear();
+
+ for (T2<ClusterNode, GridIoMessage> msg : blockedMsgs) {
+ ClusterNode node = msg.get1();
+
+ log.info("Send blocked message: [node=" + node.attribute(IgniteNodeAttributes.ATTR_GRID_NAME) +
+ ", msg=" + msg.get2().message() + ']');
+
+ sendMessage(msg.get1(), msg.get2());
+ }
+
+ blockedMsgs.clear();
+ }
+ }
+ }
+
+ private static class TestValue {
+ /** Field1. */
+ private String field1;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java
index e7560c7..126ce61 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.cache.distributed.replicated;
import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.processors.cache.distributed.IgniteTxPreloadAbstractTest;
import static org.apache.ignite.cache.CacheMode.REPLICATED;
@@ -32,6 +33,11 @@ public class GridReplicatedTxPreloadTest extends IgniteTxPreloadAbstractTest {
}
/** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ return super.getConfiguration(gridName).setMarshaller(null);
+ }
+
+ /** {@inheritDoc} */
@Override public void testLocalTxPreloadingOptimistic() throws Exception {
fail("https://issues.apache.org/jira/browse/IGNITE-1755");
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java
index fcaafd7..6a7a68b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java
@@ -192,46 +192,7 @@ public class GridCacheReplicatedPreloadLifecycleSelfTest extends GridCachePreloa
qry = qry.projection(grid(j).cluster());
- int totalCnt = F.sumInt(qry.execute(new IgniteReducer<Map.Entry<Object, MyValue>, Integer>() {
- @IgniteInstanceResource
- private Ignite grid;
-
- @LoggerResource
- private IgniteLogger log0;
-
- private int cnt;
-
- @Override public boolean collect(Map.Entry<Object, MyValue> e) {
- if (!quiet && log0.isInfoEnabled())
- log0.info("Collecting entry: " + e);
-
- Object key = e.getKey();
-
- assertNotNull(e.getValue());
-
- try {
- Object v1 = e.getValue();
- Object v2 = ((IgniteKernal)grid).getCache("one").get(key);
-
- assertNotNull("Cache c1 misses value for key [i=" + j0 + ", j=" + i0 + ", missedKey=" +
- key + ", cache=" + ((IgniteKernal)grid).getCache("one").values() + ']', v2);
- assertEquals(v1, v2);
- }
- catch (IgniteCheckedException e1) {
- e1.printStackTrace();
-
- assert false;
- }
-
- cnt++;
-
- return true;
- }
-
- @Override public Integer reduce() {
- return cnt;
- }
- }).get());
+ int totalCnt = F.sumInt(qry.execute(new EntryReducer(j0, i0)).get());
info("Total entry count [grid=" + j + ", totalCnt=" + totalCnt + ']');
@@ -295,4 +256,63 @@ public class GridCacheReplicatedPreloadLifecycleSelfTest extends GridCachePreloa
public void testScanQuery4() throws Exception {
checkScanQuery(keys(false, 500));
}
+
+ private static class EntryReducer implements IgniteReducer<Map.Entry<Object, MyValue>, Integer> {
+ /** */
+ private final int j0;
+
+ /** */
+ private final int i0;
+
+ /** */
+ @IgniteInstanceResource
+ private Ignite grid;
+
+ /** */
+ @LoggerResource
+ private IgniteLogger log0;
+
+ /** */
+ private int cnt;
+
+ /**
+ */
+ public EntryReducer(int j0, int i0) {
+ this.j0 = j0;
+ this.i0 = i0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean collect(Map.Entry<Object, MyValue> e) {
+ if (!quiet && log0.isInfoEnabled())
+ log0.info("Collecting entry: " + e);
+
+ Object key = e.getKey();
+
+ assertNotNull(e.getValue());
+
+ try {
+ Object v1 = e.getValue();
+ Object v2 = ((IgniteKernal)grid).getCache("one").get(key);
+
+ assertNotNull("Cache c1 misses value for key [i=" + j0 + ", j=" + i0 + ", missedKey=" +
+ key + ", cache=" + ((IgniteKernal)grid).getCache("one").values() + ']', v2);
+ assertEquals(v1, v2);
+ }
+ catch (IgniteCheckedException e1) {
+ e1.printStackTrace();
+
+ assert false;
+ }
+
+ cnt++;
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Integer reduce() {
+ return cnt;
+ }
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index 4797ff1..ca31c28 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -38,6 +38,7 @@ import org.apache.ignite.cache.store.jdbc.GridCacheJdbcBlobStoreSelfTest;
import org.apache.ignite.internal.processors.cache.CacheAffinityCallSelfTest;
import org.apache.ignite.internal.processors.cache.CacheDeferredDeleteSanitySelfTest;
import org.apache.ignite.internal.processors.cache.CacheFutureExceptionSelfTest;
+import org.apache.ignite.internal.processors.cache.CachePutEventListenerErrorSelfTest;
import org.apache.ignite.internal.processors.cache.CacheNamesSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheAffinityApiSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheAffinityMapperSelfTest;
@@ -276,6 +277,8 @@ public class IgniteCacheTestSuite extends TestSuite {
suite.addTestSuite(IgniteCacheNearLockValueSelfTest.class);
+ suite.addTestSuite(CachePutEventListenerErrorSelfTest.class);
+
return suite;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ee87e1/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
index 629835b..62952b5 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
@@ -37,6 +37,7 @@ import org.apache.ignite.internal.portable.noncompact.BinaryFooterOffsetsOffheap
import org.apache.ignite.internal.portable.noncompact.BinaryMarshallerNonCompactSelfTest;
import org.apache.ignite.internal.portable.noncompact.BinaryObjectBuilderAdditionalNonCompactSelfTest;
import org.apache.ignite.internal.portable.noncompact.BinaryObjectBuilderNonCompactSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteBinaryMetadataUpdateChangingTopologySelfTest;
import org.apache.ignite.internal.processors.cache.portable.GridCacheClientNodeBinaryObjectMetadataMultinodeTest;
import org.apache.ignite.internal.processors.cache.portable.GridCacheClientNodeBinaryObjectMetadataTest;
import org.apache.ignite.internal.processors.cache.portable.GridCachePortableStoreObjectsSelfTest;
@@ -106,6 +107,7 @@ public class IgnitePortableObjectsTestSuite extends TestSuite {
suite.addTestSuite(GridCacheClientNodeBinaryObjectMetadataTest.class);
suite.addTestSuite(GridCacheClientNodeBinaryObjectMetadataMultinodeTest.class);
+ suite.addTestSuite(IgniteBinaryMetadataUpdateChangingTopologySelfTest.class);
return suite;
}
[27/50] [abbrv] ignite git commit: Disabled peer class loading in
test.
Posted by ra...@apache.org.
Disabled peer class loading in test.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9b01be3a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9b01be3a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9b01be3a
Branch: refs/heads/master
Commit: 9b01be3ae237befe94574cfe32f3375ee45ff1ec
Parents: 3080f61
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 16:49:07 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 16:49:07 2015 +0300
----------------------------------------------------------------------
.../distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9b01be3a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
index 56bc760..74cb9ef 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
@@ -93,6 +93,8 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
cfg.setClientMode(client);
+ cfg.setPeerClassLoadingEnabled(false);
+
return cfg;
}
[33/50] [abbrv] ignite git commit: Fixing tests
Posted by ra...@apache.org.
Fixing tests
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6a95f88d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6a95f88d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6a95f88d
Branch: refs/heads/master
Commit: 6a95f88d4cea59d70dd02628b23be976dcb9f6d9
Parents: 0c03b91
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Fri Nov 27 20:40:05 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Nov 27 20:40:05 2015 +0300
----------------------------------------------------------------------
.../cache/eviction/random/RandomEvictionPolicySelfTest.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6a95f88d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/random/RandomEvictionPolicySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/random/RandomEvictionPolicySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/random/RandomEvictionPolicySelfTest.java
index 9d781eb..af04cdc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/random/RandomEvictionPolicySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/random/RandomEvictionPolicySelfTest.java
@@ -92,7 +92,11 @@ public class RandomEvictionPolicySelfTest extends
info("Stats [cntr=" + i + ", total=" + runs + ']');
}
- assert g.cache(null).size() <= max;
+ int size = g.cache(null).size();
+
+ info("Cache size: " + size);
+
+ assert size <= (max * 1.2) : size; // Add 20% room for random evictions.
info(policy(0));
}
@@ -354,4 +358,4 @@ public class RandomEvictionPolicySelfTest extends
@Override protected void checkPolicies() {
// No-op.
}
-}
\ No newline at end of file
+}
[15/50] [abbrv] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.5' into ignite-1.5
Posted by ra...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/857c63e7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/857c63e7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/857c63e7
Branch: refs/heads/master
Commit: 857c63e79ef5aa34c8213d4c1ecb298866724727
Parents: 712e62b fa8e478
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 13:13:17 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 13:13:17 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/IgniteBinary.java | 9 +
.../org/apache/ignite/binary/BinaryObject.java | 8 +
.../org/apache/ignite/binary/BinaryType.java | 7 +
.../ignite/binary/BinaryTypeConfiguration.java | 21 +
.../communication/GridIoMessageFactory.java | 8 +-
.../internal/portable/BinaryEnumObjectImpl.java | 311 +++++++++++++
.../internal/portable/BinaryMetadata.java | 16 +-
.../internal/portable/BinaryObjectExImpl.java | 5 +
.../internal/portable/BinaryObjectImpl.java | 3 -
.../internal/portable/BinaryTypeImpl.java | 9 +-
.../internal/portable/BinaryWriteMode.java | 3 +
.../internal/portable/BinaryWriterExImpl.java | 19 +
.../portable/PortableClassDescriptor.java | 23 +-
.../internal/portable/PortableContext.java | 39 +-
.../ignite/internal/portable/PortableUtils.java | 147 +++++-
.../builder/BinaryObjectBuilderImpl.java | 2 +-
.../builder/PortableBuilderSerializer.java | 10 +-
.../internal/processors/cache/CacheObject.java | 3 +
.../processors/cache/CacheObjectContext.java | 19 +
.../portable/CacheObjectBinaryProcessor.java | 11 +-
.../CacheObjectBinaryProcessorImpl.java | 18 +-
.../cache/portable/IgniteBinaryImpl.java | 12 +
.../processors/cacheobject/NoOpBinary.java | 5 +
.../platform/PlatformContextImpl.java | 53 ++-
.../transactions/PlatformTransactions.java | 4 +-
.../platform/utils/PlatformUtils.java | 1 +
.../PlatformDotNetBinaryTypeConfiguration.java | 23 +
.../internal/portable/BinaryEnumsSelfTest.java | 446 +++++++++++++++++++
.../portable/BinaryMarshallerSelfTest.java | 37 +-
.../platform/PlatformComputeEchoTask.java | 4 +-
.../IgnitePortableObjectsTestSuite.java | 2 +
modules/jms11/licenses/apache-2.0.txt | 202 +++++++++
modules/kafka/README.txt | 32 ++
modules/mqtt/licenses/apache-2.0.txt | 202 +++++++++
.../impl/binary/binary_type_updater_impl.cpp | 4 +-
.../Binary/BinaryBuilderSelfTest.cs | 97 ++--
.../Binary/BinarySelfTest.cs | 48 +-
.../Cache/CacheAbstractTest.cs | 17 +-
.../Compute/ComputeApiTest.cs | 6 +
.../Config/Compute/compute-grid1.xml | 3 +-
.../Config/native-client-test-cache-store.xml | 1 +
.../Services/ServiceProxyTest.cs | 22 +-
.../Apache.Ignite.Core.csproj | 5 +-
.../Binary/BinaryTypeConfiguration.cs | 16 +-
.../dotnet/Apache.Ignite.Core/Binary/IBinary.cs | 136 ++++++
.../Apache.Ignite.Core/Binary/IBinaryObject.cs | 23 +-
.../Apache.Ignite.Core/Binary/IBinaryType.cs | 13 +
.../Apache.Ignite.Core/Binary/IIgniteBinary.cs | 120 -----
.../dotnet/Apache.Ignite.Core/IIgnite.cs | 6 +-
.../Apache.Ignite.Core/Impl/Binary/Binary.cs | 216 +++++++++
.../Impl/Binary/BinaryEnum.cs | 134 ++++++
.../Impl/Binary/BinaryFullTypeDescriptor.cs | 14 +-
.../Impl/Binary/BinaryObject.cs | 29 ++
.../Impl/Binary/BinaryObjectBuilder.cs | 44 +-
.../Impl/Binary/BinaryReader.cs | 51 ++-
.../Binary/BinarySurrogateTypeDescriptor.cs | 6 +
.../Impl/Binary/BinarySystemHandlers.cs | 34 +-
.../Impl/Binary/BinaryUtils.cs | 96 ++--
.../Impl/Binary/BinaryWriter.cs | 104 +++--
.../Impl/Binary/IBinaryTypeDescriptor.cs | 50 +--
.../Impl/Binary/IgniteBinary.cs | 192 --------
.../Impl/Binary/Marshaller.cs | 88 ++--
.../Impl/Binary/Metadata/BinaryType.cs | 184 ++++----
.../Impl/Binary/Metadata/BinaryTypeHolder.cs | 34 +-
.../Binary/Structure/BinaryStructureTracker.cs | 2 +-
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 11 +-
.../Apache.Ignite.Core/Impl/IgniteProxy.cs | 2 +-
.../Apache.Ignite.Core/Impl/PlatformTarget.cs | 11 +-
.../Impl/Transactions/TransactionsImpl.cs | 4 +-
.../examples/Config/example-cache-query.xml | 9 +-
.../dotnet/examples/Config/example-cache.xml | 9 +-
modules/zookeeper/licenses/apache-2.0.txt | 202 +++++++++
72 files changed, 2992 insertions(+), 765 deletions(-)
----------------------------------------------------------------------
[03/50] [abbrv] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.5' into ignite-1.5_
Posted by ra...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5_
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e9f22aba
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e9f22aba
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e9f22aba
Branch: refs/heads/master
Commit: e9f22aba2801636a3c8747dde143b9ceefeb669a
Parents: a8edb1e 2d62bbb
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Fri Nov 27 11:34:04 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Nov 27 11:34:04 2015 +0300
----------------------------------------------------------------------
.../ignite/spi/discovery/tcp/ServerImpl.java | 2 +-
.../internal/GridMultipleJobsSelfTest.java | 7 ++++++
.../IgniteClientReconnectCacheTest.java | 26 ++++++++++++--------
3 files changed, 24 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
[09/50] [abbrv] ignite git commit: IGNITE-1956: Added binary enums
support.
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
index 99af56d..e50279c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
@@ -30,74 +30,52 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <summary>
/// Type.
/// </summary>
- Type Type
- {
- get;
- }
+ Type Type { get; }
/// <summary>
/// Type ID.
/// </summary>
- int TypeId
- {
- get;
- }
+ int TypeId { get; }
/// <summary>
/// Type name.
/// </summary>
- string TypeName
- {
- get;
- }
+ string TypeName { get; }
/// <summary>
/// User type flag.
/// </summary>
- bool UserType
- {
- get;
- }
+ bool UserType { get; }
/// <summary>
/// Whether to cache deserialized value in IBinaryObject
/// </summary>
- bool KeepDeserialized
- {
- get;
- }
+ bool KeepDeserialized { get; }
/// <summary>
/// Name converter.
/// </summary>
- IBinaryNameMapper NameMapper
- {
- get;
- }
+ IBinaryNameMapper NameMapper { get; }
/// <summary>
/// Mapper.
/// </summary>
- IBinaryIdMapper IdMapper
- {
- get;
- }
+ IBinaryIdMapper IdMapper { get; }
/// <summary>
/// Serializer.
/// </summary>
- IBinarySerializer Serializer
- {
- get;
- }
+ IBinarySerializer Serializer { get; }
/// <summary>
/// Affinity key field name.
/// </summary>
- string AffinityKeyFieldName
- {
- get;
- }
+ string AffinityKeyFieldName { get; }
+
+ /// <summary>
+ /// Gets a value indicating whether this descriptor represents an enum type.
+ /// </summary>
+ bool IsEnum { get; }
/// <summary>
/// Write type structure.
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IgniteBinary.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IgniteBinary.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IgniteBinary.cs
deleted file mode 100644
index ecc6807..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IgniteBinary.cs
+++ /dev/null
@@ -1,192 +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.
- */
-
-namespace Apache.Ignite.Core.Impl.Binary
-{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using Apache.Ignite.Core.Binary;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Binary.IO;
- using Apache.Ignite.Core.Impl.Common;
-
- /// <summary>
- /// Binary implementation.
- /// </summary>
- internal class IgniteBinary : IIgniteBinary
- {
- /** Owning grid. */
- private readonly Marshaller _marsh;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="marsh">Marshaller.</param>
- internal IgniteBinary(Marshaller marsh)
- {
- _marsh = marsh;
- }
-
- /** <inheritDoc /> */
- public T ToBinary<T>(object obj)
- {
- if (obj is IBinaryObject)
- return (T)obj;
-
- IBinaryStream stream = new BinaryHeapStream(1024);
-
- // Serialize.
- BinaryWriter writer = _marsh.StartMarshal(stream);
-
- try
- {
- writer.Write(obj);
- }
- finally
- {
- // Save metadata.
- _marsh.FinishMarshal(writer);
- }
-
- // Deserialize.
- stream.Seek(0, SeekOrigin.Begin);
-
- return _marsh.Unmarshal<T>(stream, BinaryMode.ForceBinary);
- }
-
- /** <inheritDoc /> */
- public IBinaryObjectBuilder GetBuilder(Type type)
- {
- IgniteArgumentCheck.NotNull(type, "type");
-
- IBinaryTypeDescriptor desc = _marsh.GetDescriptor(type);
-
- if (desc == null)
- throw new IgniteException("Type is not binary (add it to BinaryConfiguration): " +
- type.FullName);
-
- return Builder0(null, BinaryFromDescriptor(desc), desc);
- }
-
- /** <inheritDoc /> */
- public IBinaryObjectBuilder GetBuilder(string typeName)
- {
- IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
-
- IBinaryTypeDescriptor desc = _marsh.GetDescriptor(typeName);
-
- return Builder0(null, BinaryFromDescriptor(desc), desc);
- }
-
- /** <inheritDoc /> */
- public IBinaryObjectBuilder GetBuilder(IBinaryObject obj)
- {
- IgniteArgumentCheck.NotNull(obj, "obj");
-
- BinaryObject obj0 = obj as BinaryObject;
-
- if (obj0 == null)
- throw new ArgumentException("Unsupported object type: " + obj.GetType());
-
- IBinaryTypeDescriptor desc = _marsh.GetDescriptor(true, obj0.TypeId);
-
- return Builder0(null, obj0, desc);
- }
-
- /** <inheritDoc /> */
- public int GetTypeId(string typeName)
- {
- IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
-
- return Marshaller.GetDescriptor(typeName).TypeId;
- }
-
- /** <inheritDoc /> */
- public ICollection<IBinaryType> GetBinaryTypes()
- {
- return Marshaller.Ignite.ClusterGroup.GetBinaryTypes();
- }
-
- /** <inheritDoc /> */
- public IBinaryType GetBinaryType(int typeId)
- {
- return Marshaller.GetBinaryType(typeId);
- }
-
- /** <inheritDoc /> */
- public IBinaryType GetBinaryType(string typeName)
- {
- IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
-
- return GetBinaryType(GetTypeId(typeName));
- }
-
- /** <inheritDoc /> */
- public IBinaryType GetBinaryType(Type type)
- {
- IgniteArgumentCheck.NotNull(type, "type");
-
- var desc = Marshaller.GetDescriptor(type);
-
- return desc == null ? null : Marshaller.GetBinaryType(desc.TypeId);
- }
-
- /// <summary>
- /// Marshaller.
- /// </summary>
- internal Marshaller Marshaller
- {
- get
- {
- return _marsh;
- }
- }
-
- /// <summary>
- /// Create empty binary object from descriptor.
- /// </summary>
- /// <param name="desc">Descriptor.</param>
- /// <returns>Empty binary object.</returns>
- private BinaryObject BinaryFromDescriptor(IBinaryTypeDescriptor desc)
- {
- var len = BinaryObjectHeader.Size;
-
- var hdr = new BinaryObjectHeader(desc.TypeId, 0, len, 0, len,
- desc.UserType ? BinaryObjectHeader.Flag.UserType : BinaryObjectHeader.Flag.None);
-
- var stream = new BinaryHeapStream(len);
-
- BinaryObjectHeader.Write(hdr, stream, 0);
-
- return new BinaryObject(_marsh, stream.InternalArray, 0, hdr);
- }
-
- /// <summary>
- /// Internal builder creation routine.
- /// </summary>
- /// <param name="parent">Parent builder.</param>
- /// <param name="obj">binary object.</param>
- /// <param name="desc">Type descriptor.</param>
- /// <returns>Builder.</returns>
- private BinaryObjectBuilder Builder0(BinaryObjectBuilder parent, BinaryObject obj,
- IBinaryTypeDescriptor desc)
- {
- return new BinaryObjectBuilder(this, parent, obj, desc);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
index 251610e..457830f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
@@ -19,7 +19,7 @@ namespace Apache.Ignite.Core.Impl.Binary
{
using System;
using System.Collections.Generic;
- using System.Globalization;
+ using System.Diagnostics;
using System.Linq;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Impl.Binary.IO;
@@ -149,14 +149,14 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="writer">Writer.</param>
/// <returns>Dictionary with metadata.</returns>
- public void FinishMarshal(IBinaryWriter writer)
+ public void FinishMarshal(BinaryWriter writer)
{
- var meta = ((BinaryWriter) writer).GetBinaryTypes();
+ var metas = writer.GetBinaryTypes();
var ignite = Ignite;
- if (ignite != null && meta != null && meta.Count > 0)
- ignite.PutBinaryTypes(meta);
+ if (ignite != null && metas != null && metas.Count > 0)
+ ignite.PutBinaryTypes(metas);
}
/// <summary>
@@ -266,7 +266,22 @@ namespace Apache.Ignite.Core.Impl.Binary
return meta;
}
- return BinaryType.EmptyMeta;
+ return BinaryType.Empty;
+ }
+
+ /// <summary>
+ /// Puts the binary type metadata to Ignite.
+ /// </summary>
+ /// <param name="desc">Descriptor.</param>
+ /// <param name="fields">Fields.</param>
+ public void PutBinaryType(IBinaryTypeDescriptor desc, IDictionary<string, int> fields = null)
+ {
+ Debug.Assert(desc != null);
+
+ GetBinaryTypeHandler(desc); // ensure that handler exists
+
+ if (Ignite != null)
+ Ignite.PutBinaryTypes(new[] {new BinaryType(desc, fields)});
}
/// <summary>
@@ -287,7 +302,7 @@ namespace Apache.Ignite.Core.Impl.Binary
IDictionary<int, BinaryTypeHolder> metas0 =
new Dictionary<int, BinaryTypeHolder>(_metas);
- holder = new BinaryTypeHolder(desc.TypeId, desc.TypeName, desc.AffinityKeyFieldName);
+ holder = new BinaryTypeHolder(desc.TypeId, desc.TypeName, desc.AffinityKeyFieldName, desc.IsEnum);
metas0[desc.TypeId] = holder;
@@ -298,7 +313,7 @@ namespace Apache.Ignite.Core.Impl.Binary
if (holder != null)
{
- ICollection<int> ids = holder.FieldIds();
+ ICollection<int> ids = holder.GetFieldIds();
bool newType = ids.Count == 0 && !holder.Saved();
@@ -312,23 +327,20 @@ namespace Apache.Ignite.Core.Impl.Binary
/// Callback invoked when metadata has been sent to the server and acknowledged by it.
/// </summary>
/// <param name="newMetas">Binary types.</param>
- public void OnBinaryTypesSent(IDictionary<int, IBinaryType> newMetas)
+ public void OnBinaryTypesSent(IEnumerable<BinaryType> newMetas)
{
- foreach (KeyValuePair<int, IBinaryType> metaEntry in newMetas)
+ foreach (var meta in newMetas)
{
- BinaryType meta = (BinaryType) metaEntry.Value;
-
- IDictionary<int, Tuple<string, int>> mergeInfo =
- new Dictionary<int, Tuple<string, int>>(meta.FieldsMap().Count);
+ var mergeInfo = new Dictionary<int, Tuple<string, int>>(meta.GetFieldsMap().Count);
- foreach (KeyValuePair<string, int> fieldMeta in meta.FieldsMap())
+ foreach (KeyValuePair<string, int> fieldMeta in meta.GetFieldsMap())
{
- int fieldId = BinaryUtils.FieldId(metaEntry.Key, fieldMeta.Key, null, null);
+ int fieldId = BinaryUtils.FieldId(meta.TypeId, fieldMeta.Key, null, null);
mergeInfo[fieldId] = new Tuple<string, int>(fieldMeta.Key, fieldMeta.Value);
}
- _metas[metaEntry.Key].Merge(mergeInfo);
+ _metas[meta.TypeId].Merge(mergeInfo);
}
}
@@ -396,7 +408,7 @@ namespace Apache.Ignite.Core.Impl.Binary
if (type != null)
{
// Type is found.
- var typeName = GetTypeName(type);
+ var typeName = BinaryUtils.GetTypeName(type);
int typeId = BinaryUtils.TypeId(typeName, nameMapper, idMapper);
@@ -408,8 +420,15 @@ namespace Apache.Ignite.Core.Impl.Binary
if (refSerializer != null)
refSerializer.Register(type, typeId, nameMapper, idMapper);
+ if (typeCfg.IsEnum != type.IsEnum)
+ throw new BinaryObjectException(
+ string.Format(
+ "Invalid IsEnum flag in binary type configuration. " +
+ "Configuration value: IsEnum={0}, actual type: IsEnum={1}",
+ typeCfg.IsEnum, type.IsEnum));
+
AddType(type, typeId, typeName, true, keepDeserialized, nameMapper, idMapper, serializer,
- typeCfg.AffinityKeyFieldName);
+ typeCfg.AffinityKeyFieldName, type.IsEnum);
}
else
{
@@ -419,7 +438,7 @@ namespace Apache.Ignite.Core.Impl.Binary
int typeId = BinaryUtils.TypeId(typeName, nameMapper, idMapper);
AddType(null, typeId, typeName, true, keepDeserialized, nameMapper, idMapper, null,
- typeCfg.AffinityKeyFieldName);
+ typeCfg.AffinityKeyFieldName, typeCfg.IsEnum);
}
}
@@ -434,7 +453,7 @@ namespace Apache.Ignite.Core.Impl.Binary
? BinarizableSerializer.Instance
: null;
}
-
+
/// <summary>
/// Add type.
/// </summary>
@@ -447,9 +466,10 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="idMapper">ID mapper.</param>
/// <param name="serializer">Serializer.</param>
/// <param name="affKeyFieldName">Affinity key field name.</param>
+ /// <param name="isEnum">Enum flag.</param>
private void AddType(Type type, int typeId, string typeName, bool userType,
bool keepDeserialized, IBinaryNameMapper nameMapper, IBinaryIdMapper idMapper,
- IBinarySerializer serializer, string affKeyFieldName)
+ IBinarySerializer serializer, string affKeyFieldName, bool isEnum)
{
long typeKey = BinaryUtils.TypeKey(userType, typeId);
@@ -470,9 +490,8 @@ namespace Apache.Ignite.Core.Impl.Binary
if (userType && _typeNameToDesc.ContainsKey(typeName))
throw new BinaryObjectException("Conflicting type name: " + typeName);
- IBinaryTypeDescriptor descriptor =
- new BinaryFullTypeDescriptor(type, typeId, typeName, userType, nameMapper, idMapper, serializer,
- keepDeserialized, affKeyFieldName);
+ var descriptor = new BinaryFullTypeDescriptor(type, typeId, typeName, userType, nameMapper, idMapper,
+ serializer, keepDeserialized, affKeyFieldName, isEnum);
if (type != null)
_typeToDesc[type] = descriptor;
@@ -492,7 +511,7 @@ namespace Apache.Ignite.Core.Impl.Binary
var serializer = new BinarySystemTypeSerializer<T>(ctor);
- AddType(type, typeId, GetTypeName(type), false, false, null, null, serializer, null);
+ AddType(type, typeId, BinaryUtils.GetTypeName(type), false, false, null, null, serializer, null, false);
}
/// <summary>
@@ -516,22 +535,5 @@ namespace Apache.Ignite.Core.Impl.Binary
AddSystemType(BinaryUtils.TypeMessageListenerHolder, w => new MessageListenerHolder(w));
AddSystemType(BinaryUtils.TypeStreamReceiverHolder, w => new StreamReceiverHolder(w));
}
-
- /// <summary>
- /// Gets the name of the type.
- /// </summary>
- /// <param name="type">The type.</param>
- /// <returns>
- /// Simple type name for non-generic types; simple type name with appended generic arguments for generic types.
- /// </returns>
- private static string GetTypeName(Type type)
- {
- if (!type.IsGenericType)
- return type.Name;
-
- var args = type.GetGenericArguments().Select(GetTypeName).Aggregate((x, y) => x + "," + y);
-
- return string.Format(CultureInfo.InvariantCulture, "{0}[{1}]", type.Name, args);
- }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
index 3e9a28d..476e651 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
@@ -27,9 +27,8 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
internal class BinaryType : IBinaryType
{
/** Empty metadata. */
- [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
- public static readonly BinaryType EmptyMeta =
- new BinaryType(BinaryUtils.TypeObject, BinaryTypeNames.TypeNameObject, null, null);
+ public static readonly BinaryType Empty =
+ new BinaryType(BinaryUtils.TypeObject, BinaryTypeNames.TypeNameObject, null, null, false);
/** Empty dictionary. */
private static readonly IDictionary<string, int> EmptyDict = new Dictionary<string, int>();
@@ -37,82 +36,74 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
/** Empty list. */
private static readonly ICollection<string> EmptyList = new List<string>().AsReadOnly();
+ /** Type name map. */
+ private static readonly string[] TypeNames = new string[byte.MaxValue];
+
/** Fields. */
private readonly IDictionary<string, int> _fields;
+ /** Enum flag. */
+ private readonly bool _isEnum;
+
+ /** Type id. */
+ private readonly int _typeId;
+
+ /** Type name. */
+ private readonly string _typeName;
+
+ /** Aff key field name. */
+ private readonly string _affinityKeyFieldName;
+
+ /// <summary>
+ /// Initializes the <see cref="BinaryType"/> class.
+ /// </summary>
+ static BinaryType()
+ {
+ TypeNames[BinaryUtils.TypeBool] = BinaryTypeNames.TypeNameBool;
+ TypeNames[BinaryUtils.TypeByte] = BinaryTypeNames.TypeNameByte;
+ TypeNames[BinaryUtils.TypeShort] = BinaryTypeNames.TypeNameShort;
+ TypeNames[BinaryUtils.TypeChar] = BinaryTypeNames.TypeNameChar;
+ TypeNames[BinaryUtils.TypeInt] = BinaryTypeNames.TypeNameInt;
+ TypeNames[BinaryUtils.TypeLong] = BinaryTypeNames.TypeNameLong;
+ TypeNames[BinaryUtils.TypeFloat] = BinaryTypeNames.TypeNameFloat;
+ TypeNames[BinaryUtils.TypeDouble] = BinaryTypeNames.TypeNameDouble;
+ TypeNames[BinaryUtils.TypeDecimal] = BinaryTypeNames.TypeNameDecimal;
+ TypeNames[BinaryUtils.TypeString] = BinaryTypeNames.TypeNameString;
+ TypeNames[BinaryUtils.TypeGuid] = BinaryTypeNames.TypeNameGuid;
+ TypeNames[BinaryUtils.TypeTimestamp] = BinaryTypeNames.TypeNameTimestamp;
+ TypeNames[BinaryUtils.TypeEnum] = BinaryTypeNames.TypeNameEnum;
+ TypeNames[BinaryUtils.TypeObject] = BinaryTypeNames.TypeNameObject;
+ TypeNames[BinaryUtils.TypeArrayBool] = BinaryTypeNames.TypeNameArrayBool;
+ TypeNames[BinaryUtils.TypeArrayByte] = BinaryTypeNames.TypeNameArrayByte;
+ TypeNames[BinaryUtils.TypeArrayShort] = BinaryTypeNames.TypeNameArrayShort;
+ TypeNames[BinaryUtils.TypeArrayChar] = BinaryTypeNames.TypeNameArrayChar;
+ TypeNames[BinaryUtils.TypeArrayInt] = BinaryTypeNames.TypeNameArrayInt;
+ TypeNames[BinaryUtils.TypeArrayLong] = BinaryTypeNames.TypeNameArrayLong;
+ TypeNames[BinaryUtils.TypeArrayFloat] = BinaryTypeNames.TypeNameArrayFloat;
+ TypeNames[BinaryUtils.TypeArrayDouble] = BinaryTypeNames.TypeNameArrayDouble;
+ TypeNames[BinaryUtils.TypeArrayDecimal] = BinaryTypeNames.TypeNameArrayDecimal;
+ TypeNames[BinaryUtils.TypeArrayString] = BinaryTypeNames.TypeNameArrayString;
+ TypeNames[BinaryUtils.TypeArrayGuid] = BinaryTypeNames.TypeNameArrayGuid;
+ TypeNames[BinaryUtils.TypeArrayTimestamp] = BinaryTypeNames.TypeNameArrayTimestamp;
+ TypeNames[BinaryUtils.TypeArrayEnum] = BinaryTypeNames.TypeNameArrayEnum;
+ TypeNames[BinaryUtils.TypeArray] = BinaryTypeNames.TypeNameArrayObject;
+ TypeNames[BinaryUtils.TypeCollection] = BinaryTypeNames.TypeNameCollection;
+ TypeNames[BinaryUtils.TypeDictionary] = BinaryTypeNames.TypeNameMap;
+ }
+
/// <summary>
/// Get type name by type ID.
/// </summary>
/// <param name="typeId">Type ID.</param>
/// <returns>Type name.</returns>
- private static string ConvertTypeName(int typeId)
+ private static string GetTypeName(int typeId)
{
- switch (typeId)
- {
- case BinaryUtils.TypeBool:
- return BinaryTypeNames.TypeNameBool;
- case BinaryUtils.TypeByte:
- return BinaryTypeNames.TypeNameByte;
- case BinaryUtils.TypeShort:
- return BinaryTypeNames.TypeNameShort;
- case BinaryUtils.TypeChar:
- return BinaryTypeNames.TypeNameChar;
- case BinaryUtils.TypeInt:
- return BinaryTypeNames.TypeNameInt;
- case BinaryUtils.TypeLong:
- return BinaryTypeNames.TypeNameLong;
- case BinaryUtils.TypeFloat:
- return BinaryTypeNames.TypeNameFloat;
- case BinaryUtils.TypeDouble:
- return BinaryTypeNames.TypeNameDouble;
- case BinaryUtils.TypeDecimal:
- return BinaryTypeNames.TypeNameDecimal;
- case BinaryUtils.TypeString:
- return BinaryTypeNames.TypeNameString;
- case BinaryUtils.TypeGuid:
- return BinaryTypeNames.TypeNameGuid;
- case BinaryUtils.TypeTimestamp:
- return BinaryTypeNames.TypeNameTimestamp;
- case BinaryUtils.TypeEnum:
- return BinaryTypeNames.TypeNameEnum;
- case BinaryUtils.TypeBinary:
- case BinaryUtils.TypeObject:
- return BinaryTypeNames.TypeNameObject;
- case BinaryUtils.TypeArrayBool:
- return BinaryTypeNames.TypeNameArrayBool;
- case BinaryUtils.TypeArrayByte:
- return BinaryTypeNames.TypeNameArrayByte;
- case BinaryUtils.TypeArrayShort:
- return BinaryTypeNames.TypeNameArrayShort;
- case BinaryUtils.TypeArrayChar:
- return BinaryTypeNames.TypeNameArrayChar;
- case BinaryUtils.TypeArrayInt:
- return BinaryTypeNames.TypeNameArrayInt;
- case BinaryUtils.TypeArrayLong:
- return BinaryTypeNames.TypeNameArrayLong;
- case BinaryUtils.TypeArrayFloat:
- return BinaryTypeNames.TypeNameArrayFloat;
- case BinaryUtils.TypeArrayDouble:
- return BinaryTypeNames.TypeNameArrayDouble;
- case BinaryUtils.TypeArrayDecimal:
- return BinaryTypeNames.TypeNameArrayDecimal;
- case BinaryUtils.TypeArrayString:
- return BinaryTypeNames.TypeNameArrayString;
- case BinaryUtils.TypeArrayGuid:
- return BinaryTypeNames.TypeNameArrayGuid;
- case BinaryUtils.TypeArrayTimestamp:
- return BinaryTypeNames.TypeNameArrayTimestamp;
- case BinaryUtils.TypeArrayEnum:
- return BinaryTypeNames.TypeNameArrayEnum;
- case BinaryUtils.TypeArray:
- return BinaryTypeNames.TypeNameArrayObject;
- case BinaryUtils.TypeCollection:
- return BinaryTypeNames.TypeNameCollection;
- case BinaryUtils.TypeDictionary:
- return BinaryTypeNames.TypeNameMap;
- default:
- throw new BinaryObjectException("Invalid type ID: " + typeId);
- }
+ var typeName = (typeId >= 0 && typeId < TypeNames.Length) ? TypeNames[typeId] : null;
+
+ if (typeName != null)
+ return typeName;
+
+ throw new BinaryObjectException("Invalid type ID: " + typeId);
}
/// <summary>
@@ -121,10 +112,22 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
/// <param name="reader">The reader.</param>
public BinaryType(IBinaryRawReader reader)
{
- TypeId = reader.ReadInt();
- TypeName = reader.ReadString();
- AffinityKeyFieldName = reader.ReadString();
+ _typeId = reader.ReadInt();
+ _typeName = reader.ReadString();
+ _affinityKeyFieldName = reader.ReadString();
_fields = reader.ReadDictionaryAsGeneric<string, int>();
+ _isEnum = reader.ReadBoolean();
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="BinaryType"/> class.
+ /// </summary>
+ /// <param name="desc">Descriptor.</param>
+ /// <param name="fields">Fields.</param>
+ public BinaryType(IBinaryTypeDescriptor desc, IDictionary<string, int> fields = null)
+ : this (desc.TypeId, desc.TypeName, fields, desc.AffinityKeyFieldName, desc.IsEnum)
+ {
+ // No-op.
}
/// <summary>
@@ -134,25 +137,33 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
/// <param name="typeName">Type name.</param>
/// <param name="fields">Fields.</param>
/// <param name="affKeyFieldName">Affinity key field name.</param>
+ /// <param name="isEnum">Enum flag.</param>
public BinaryType(int typeId, string typeName, IDictionary<string, int> fields,
- string affKeyFieldName)
+ string affKeyFieldName, bool isEnum)
{
- TypeId = typeId;
- TypeName = typeName;
- AffinityKeyFieldName = affKeyFieldName;
+ _typeId = typeId;
+ _typeName = typeName;
+ _affinityKeyFieldName = affKeyFieldName;
_fields = fields;
+ _isEnum = isEnum;
}
/// <summary>
/// Type ID.
/// </summary>
/// <returns></returns>
- public int TypeId { get; private set; }
+ public int TypeId
+ {
+ get { return _typeId; }
+ }
/// <summary>
/// Gets type name.
/// </summary>
- public string TypeName { get; private set; }
+ public string TypeName
+ {
+ get { return _typeName; }
+ }
/// <summary>
/// Gets field names for that type.
@@ -177,7 +188,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
_fields.TryGetValue(fieldName, out typeId);
- return ConvertTypeName(typeId);
+ return GetTypeName(typeId);
}
return null;
@@ -186,13 +197,22 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
/// <summary>
/// Gets optional affinity key field name.
/// </summary>
- public string AffinityKeyFieldName { get; private set; }
+ public string AffinityKeyFieldName
+ {
+ get { return _affinityKeyFieldName; }
+ }
+
+ /** <inheritdoc /> */
+ public bool IsEnum
+ {
+ get { return _isEnum; }
+ }
/// <summary>
/// Gets fields map.
/// </summary>
/// <returns>Fields map.</returns>
- public IDictionary<string, int> FieldsMap()
+ public IDictionary<string, int> GetFieldsMap()
{
return _fields ?? EmptyDict;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs
index 524cda9..53ad77e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs
@@ -19,7 +19,6 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
{
using System;
using System.Collections.Generic;
- using Apache.Ignite.Core.Binary;
/// <summary>
/// Metadata for particular type.
@@ -35,11 +34,11 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
/** Affinity key field name. */
private readonly string _affKeyFieldName;
- /** Empty metadata when nothig is know about object fields yet. */
- private readonly IBinaryType _emptyMeta;
+ /** Enum flag. */
+ private readonly bool _isEnum;
/** Collection of know field IDs. */
- private volatile ICollection<int> _ids;
+ private volatile HashSet<int> _ids;
/** Last known unmodifiable metadata which is given to the user. */
private volatile BinaryType _meta;
@@ -47,19 +46,19 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
/** Saved flag (set if type metadata was saved at least once). */
private volatile bool _saved;
+
/// <summary>
/// Constructor.
/// </summary>
/// <param name="typeId">Type ID.</param>
/// <param name="typeName">Type name.</param>
/// <param name="affKeyFieldName">Affinity key field name.</param>
- public BinaryTypeHolder(int typeId, string typeName, string affKeyFieldName)
+ public BinaryTypeHolder(int typeId, string typeName, string affKeyFieldName, bool isEnum)
{
_typeId = typeId;
_typeName = typeName;
_affKeyFieldName = affKeyFieldName;
-
- _emptyMeta = new BinaryType(typeId, typeName, null, affKeyFieldName);
+ _isEnum = isEnum;
}
/// <summary>
@@ -72,21 +71,12 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
}
/// <summary>
- /// Get current type metadata.
- /// </summary>
- /// <value>Type metadata.</value>
- public IBinaryType BinaryType
- {
- get { return _meta ?? _emptyMeta; }
- }
-
- /// <summary>
/// Currently cached field IDs.
/// </summary>
/// <returns>Cached field IDs.</returns>
- public ICollection<int> FieldIds()
+ public ICollection<int> GetFieldIds()
{
- ICollection<int> ids0 = _ids;
+ var ids0 = _ids;
if (_ids == null)
{
@@ -120,13 +110,13 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
lock (this)
{
// 1. Create copies of the old meta.
- ICollection<int> ids0 = _ids;
+ var ids0 = _ids;
BinaryType meta0 = _meta;
- ICollection<int> newIds = ids0 != null ? new HashSet<int>(ids0) : new HashSet<int>();
+ var newIds = ids0 != null ? new HashSet<int>(ids0) : new HashSet<int>();
IDictionary<string, int> newFields = meta0 != null ?
- new Dictionary<string, int>(meta0.FieldsMap()) : new Dictionary<string, int>(newMap.Count);
+ new Dictionary<string, int>(meta0.GetFieldsMap()) : new Dictionary<string, int>(newMap.Count);
// 2. Add new fields.
foreach (KeyValuePair<int, Tuple<string, int>> newEntry in newMap)
@@ -139,7 +129,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
}
// 3. Assign new meta. Order is important here: meta must be assigned before field IDs.
- _meta = new BinaryType(_typeId, _typeName, newFields, _affKeyFieldName);
+ _meta = new BinaryType(_typeId, _typeName, newFields, _affKeyFieldName, _isEnum);
_ids = newIds;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
index 37d980e..af1b050 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
@@ -111,7 +111,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Structure
var meta = metaHnd.OnObjectWriteFinished();
if (meta != null)
- writer.SaveMetadata(_desc.TypeId, _desc.TypeName, _desc.AffinityKeyFieldName, meta);
+ writer.SaveMetadata(_desc, meta);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
index ded671a..2fcada3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
@@ -31,6 +31,7 @@ namespace Apache.Ignite.Core.Impl
using Apache.Ignite.Core.DataStructures;
using Apache.Ignite.Core.Events;
using Apache.Ignite.Core.Impl.Binary;
+ using Apache.Ignite.Core.Impl.Binary.Metadata;
using Apache.Ignite.Core.Impl.Cache;
using Apache.Ignite.Core.Impl.Cluster;
using Apache.Ignite.Core.Impl.Common;
@@ -66,7 +67,7 @@ namespace Apache.Ignite.Core.Impl
private readonly ClusterGroupImpl _prj;
/** Binary. */
- private readonly IgniteBinary _igniteBinary;
+ private readonly Binary.Binary _binary;
/** Cached proxy. */
private readonly IgniteProxy _proxy;
@@ -117,7 +118,7 @@ namespace Apache.Ignite.Core.Impl
_prj = new ClusterGroupImpl(proc, UU.ProcessorProjection(proc), marsh, this, null);
- _igniteBinary = new IgniteBinary(marsh);
+ _binary = new Binary.Binary(marsh);
_proxy = new IgniteProxy(this);
@@ -394,9 +395,9 @@ namespace Apache.Ignite.Core.Impl
}
/** <inheritdoc /> */
- public IIgniteBinary GetBinary()
+ public IBinary GetBinary()
{
- return _igniteBinary;
+ return _binary;
}
/** <inheritdoc /> */
@@ -472,7 +473,7 @@ namespace Apache.Ignite.Core.Impl
/// Put metadata to Grid.
/// </summary>
/// <param name="metas">Metadata.</param>
- internal void PutBinaryTypes(IDictionary<int, IBinaryType> metas)
+ internal void PutBinaryTypes(ICollection<BinaryType> metas)
{
_prj.PutBinaryTypes(metas);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
index 113f700..36aac1a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
@@ -275,7 +275,7 @@ namespace Apache.Ignite.Core.Impl
}
/** <inheritdoc /> */
- public IIgniteBinary GetBinary()
+ public IBinary GetBinary()
{
return _ignite.GetBinary();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
index 115f30d..4a4f93b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
@@ -23,7 +23,6 @@ namespace Apache.Ignite.Core.Impl
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Threading.Tasks;
- using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Impl.Binary.IO;
using Apache.Ignite.Core.Impl.Binary.Metadata;
@@ -581,7 +580,7 @@ namespace Apache.Ignite.Core.Impl
/// Put binary types to Grid.
/// </summary>
/// <param name="types">Binary types.</param>
- internal void PutBinaryTypes(IDictionary<int, IBinaryType> types)
+ internal void PutBinaryTypes(ICollection<BinaryType> types)
{
DoOutOp(OpMeta, stream =>
{
@@ -589,15 +588,15 @@ namespace Apache.Ignite.Core.Impl
metaWriter.WriteInt(types.Count);
- foreach (var meta in types.Values)
+ foreach (var meta in types)
{
- BinaryType meta0 = (BinaryType)meta;
+ BinaryType meta0 = meta;
metaWriter.WriteInt(meta0.TypeId);
metaWriter.WriteString(meta0.TypeName);
metaWriter.WriteString(meta0.AffinityKeyFieldName);
- IDictionary<string, int> fields = meta0.FieldsMap();
+ IDictionary<string, int> fields = meta0.GetFieldsMap();
metaWriter.WriteInt(fields.Count);
@@ -606,6 +605,8 @@ namespace Apache.Ignite.Core.Impl
metaWriter.WriteString(field.Key);
metaWriter.WriteInt(field.Value);
}
+
+ metaWriter.WriteBoolean(meta.IsEnum);
}
_marsh.FinishMarshal(metaWriter);
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
index a27bffe..0bc7172 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
@@ -67,8 +67,8 @@ namespace Apache.Ignite.Core.Impl.Transactions
{
var reader = marsh.StartUnmarshal(stream).GetRawReader();
- concurrency = reader.ReadEnum<TransactionConcurrency>();
- isolation = reader.ReadEnum<TransactionIsolation>();
+ concurrency = (TransactionConcurrency) reader.ReadInt();
+ isolation = (TransactionIsolation) reader.ReadInt();
timeout = TimeSpan.FromMilliseconds(reader.ReadLong());
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/examples/Config/example-cache-query.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Config/example-cache-query.xml b/modules/platforms/dotnet/examples/Config/example-cache-query.xml
index a3b854b..5bc9399 100644
--- a/modules/platforms/dotnet/examples/Config/example-cache-query.xml
+++ b/modules/platforms/dotnet/examples/Config/example-cache-query.xml
@@ -38,7 +38,14 @@
<value>Apache.Ignite.ExamplesDll.Binary.Employee</value>
<value>Apache.Ignite.ExamplesDll.Binary.EmployeeKey</value>
<value>Apache.Ignite.ExamplesDll.Binary.Organization</value>
- <value>Apache.Ignite.ExamplesDll.Binary.OrganizationType</value>
+ </list>
+ </property>
+ <property name="typesConfiguration">
+ <list>
+ <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetBinaryTypeConfiguration">
+ <property name="typeName" value="Apache.Ignite.ExamplesDll.Binary.OrganizationType" />
+ <property name="enum" value="true" />
+ </bean>
</list>
</property>
</bean>
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/examples/Config/example-cache.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Config/example-cache.xml b/modules/platforms/dotnet/examples/Config/example-cache.xml
index 21a6a76..949f3a4 100644
--- a/modules/platforms/dotnet/examples/Config/example-cache.xml
+++ b/modules/platforms/dotnet/examples/Config/example-cache.xml
@@ -37,7 +37,14 @@
<value>Apache.Ignite.ExamplesDll.Binary.Employee</value>
<value>Apache.Ignite.ExamplesDll.Binary.EmployeeKey</value>
<value>Apache.Ignite.ExamplesDll.Binary.Organization</value>
- <value>Apache.Ignite.ExamplesDll.Binary.OrganizationType</value>
+ </list>
+ </property>
+ <property name="typesConfiguration">
+ <list>
+ <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetBinaryTypeConfiguration">
+ <property name="typeName" value="Apache.Ignite.ExamplesDll.Binary.OrganizationType" />
+ <property name="enum" value="true" />
+ </bean>
</list>
</property>
</bean>
[26/50] [abbrv] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.5' into ignite-1.5
Posted by ra...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/56aeea3d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/56aeea3d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/56aeea3d
Branch: refs/heads/master
Commit: 56aeea3d1f519229ad7ce80992a23bf367ef72c1
Parents: fc10b3e e519c2f
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Nov 27 16:48:28 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Nov 27 16:48:28 2015 +0300
----------------------------------------------------------------------
.../hibernate/CacheHibernatePersonStore.java | 4 +-
.../hibernate/CacheHibernateStoreExample.java | 2 +-
.../datagrid/store/hibernate/Person.hbm.xml | 2 +-
.../apache/ignite/examples/binary/Address.java | 72 ---------
.../apache/ignite/examples/binary/Employee.java | 93 -----------
.../ignite/examples/binary/EmployeeKey.java | 93 -----------
.../ignite/examples/binary/Organization.java | 93 -----------
.../examples/binary/OrganizationType.java | 32 ----
...ComputeClientBinaryTaskExecutionExample.java | 4 +-
.../CacheClientBinaryPutGetExample.java | 6 +-
.../datagrid/CacheClientBinaryQueryExample.java | 22 +--
.../examples/datagrid/CacheQueryExample.java | 161 ++++---------------
.../ignite/examples/datagrid/store/Person.java | 154 ------------------
.../store/auto/CacheAutoStoreExample.java | 4 +-
.../auto/CacheAutoStoreLoadDataExample.java | 4 +-
.../datagrid/store/auto/CacheConfig.java | 6 +-
.../store/dummy/CacheDummyPersonStore.java | 12 +-
.../store/dummy/CacheDummyStoreExample.java | 4 +-
.../store/jdbc/CacheJdbcPersonStore.java | 18 +--
.../store/jdbc/CacheJdbcStoreExample.java | 4 +-
.../store/spring/CacheSpringPersonStore.java | 10 +-
.../store/spring/CacheSpringStoreExample.java | 4 +-
.../ignite/examples/model/Organization.java | 55 +++++++
.../apache/ignite/examples/model/Person.java | 120 ++++++++++++++
.../ignite/examples/model/binary/Address.java | 72 +++++++++
.../ignite/examples/model/binary/Employee.java | 93 +++++++++++
.../examples/model/binary/EmployeeKey.java | 93 +++++++++++
.../examples/model/binary/Organization.java | 93 +++++++++++
.../examples/model/binary/OrganizationType.java | 32 ++++
.../examples/ScalarCacheQueryExample.scala | 66 ++------
30 files changed, 651 insertions(+), 777 deletions(-)
----------------------------------------------------------------------
[25/50] [abbrv] ignite git commit: IGNITE-2009: Fixed leak in cached
SQL queries.
Posted by ra...@apache.org.
IGNITE-2009: Fixed leak in cached SQL queries.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fc10b3e4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fc10b3e4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fc10b3e4
Branch: refs/heads/master
Commit: fc10b3e40fadd7ad792aaea63fe270c6413c5068
Parents: 3080f61
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Nov 27 16:48:01 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Nov 27 16:48:01 2015 +0300
----------------------------------------------------------------------
.../processors/query/h2/IgniteH2Indexing.java | 24 +++++++++++++-------
1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fc10b3e4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index cc452c1..1437a16 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -49,6 +49,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import javax.cache.Cache;
import javax.cache.CacheException;
@@ -255,7 +256,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
set(c);
// Reset statement cache when new connection is created.
- stmtCache.get().clear();
+ stmtCache.remove(Thread.currentThread());
}
return c;
@@ -280,12 +281,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
/** */
private volatile GridKernalContext ctx;
- /** */
- private final ThreadLocal<StatementCache> stmtCache = new ThreadLocal<StatementCache>() {
- @Override protected StatementCache initialValue() {
- return new StatementCache(PREPARED_STMT_CACHE_SIZE);
- }
- };
+ /** Statement cache. */
+ private final ConcurrentHashMap<Thread, StatementCache> stmtCache = new ConcurrentHashMap<>();
/** */
private final GridBoundedConcurrentLinkedHashMap<T3<String, String, Boolean>, TwoStepCachedQuery> twoStepCache =
@@ -313,7 +310,18 @@ public class IgniteH2Indexing implements GridQueryIndexing {
*/
private PreparedStatement prepareStatement(Connection c, String sql, boolean useStmtCache) throws SQLException {
if (useStmtCache) {
- StatementCache cache = stmtCache.get();
+ Thread curThread = Thread.currentThread();
+
+ StatementCache cache = stmtCache.get(curThread);
+
+ if (cache == null) {
+ StatementCache cache0 = new StatementCache(PREPARED_STMT_CACHE_SIZE);
+
+ cache = stmtCache.putIfAbsent(curThread, cache0);
+
+ if (cache == null)
+ cache = cache0;
+ }
PreparedStatement stmt = cache.get(sql);
[20/50] [abbrv] ignite git commit: ignite-2010
IgniteCacheCrossCacheTxFailoverTest.testCrossCachePessimisticTxFailoverOffheapSwap
test fixed
Posted by ra...@apache.org.
ignite-2010 IgniteCacheCrossCacheTxFailoverTest.testCrossCachePessimisticTxFailoverOffheapSwap test fixed
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1727df6a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1727df6a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1727df6a
Branch: refs/heads/master
Commit: 1727df6a334b3cc879ca7bc9dd76e6f52f1e027a
Parents: 9c46fa9
Author: agura <ag...@gridgain.com>
Authored: Thu Nov 26 17:36:12 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Fri Nov 27 14:44:05 2015 +0300
----------------------------------------------------------------------
.../distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1727df6a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
index e46761b..0294dea 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
@@ -37,6 +37,7 @@ import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -391,6 +392,11 @@ public class IgniteCacheCrossCacheTxFailoverTest extends GridCommonAbstractTest
ignite0.destroyCache(CACHE1);
ignite0.destroyCache(CACHE2);
+ AffinityTopologyVersion topVer = ignite0.context().cache().context().exchange().lastTopologyFuture().get();
+
+ for (Ignite ignite : G.allGrids())
+ ((IgniteKernal)ignite).context().cache().context().exchange().affinityReadyFuture(topVer).get();
+
awaitPartitionMapExchange();
}
}
[32/50] [abbrv] ignite git commit: marshaller perf suggestion fixed
Posted by ra...@apache.org.
marshaller perf suggestion fixed
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0c03b916
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0c03b916
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0c03b916
Branch: refs/heads/master
Commit: 0c03b916a4608e35993eeff276e2e12638930d52
Parents: fb5d54a
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Fri Nov 27 20:27:29 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Nov 27 20:27:29 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/internal/IgniteKernal.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0c03b916/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 305769b..68d48c9 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
@@ -53,21 +53,21 @@ import org.apache.ignite.IgniteAtomicLong;
import org.apache.ignite.IgniteAtomicReference;
import org.apache.ignite.IgniteAtomicSequence;
import org.apache.ignite.IgniteAtomicStamped;
+import org.apache.ignite.IgniteBinary;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteClientDisconnectedException;
import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteCountDownLatch;
-import org.apache.ignite.IgniteSemaphore;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.IgniteEvents;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteFileSystem;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteMessaging;
-import org.apache.ignite.IgniteBinary;
import org.apache.ignite.IgniteQueue;
import org.apache.ignite.IgniteScheduler;
+import org.apache.ignite.IgniteSemaphore;
import org.apache.ignite.IgniteServices;
import org.apache.ignite.IgniteSet;
import org.apache.ignite.IgniteSystemProperties;
@@ -96,6 +96,8 @@ import org.apache.ignite.internal.managers.failover.GridFailoverManager;
import org.apache.ignite.internal.managers.indexing.GridIndexingManager;
import org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerManager;
import org.apache.ignite.internal.managers.swapspace.GridSwapSpaceManager;
+import org.apache.ignite.internal.portable.BinaryEnumCache;
+import org.apache.ignite.internal.portable.BinaryMarshaller;
import org.apache.ignite.internal.processors.GridProcessor;
import org.apache.ignite.internal.processors.affinity.GridAffinityProcessor;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
@@ -133,7 +135,6 @@ import org.apache.ignite.internal.processors.service.GridServiceProcessor;
import org.apache.ignite.internal.processors.session.GridTaskSessionProcessor;
import org.apache.ignite.internal.processors.task.GridTaskProcessor;
import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
-import org.apache.ignite.internal.portable.BinaryEnumCache;
import org.apache.ignite.internal.util.GridTimerTask;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -158,7 +159,6 @@ import org.apache.ignite.lifecycle.LifecycleBean;
import org.apache.ignite.lifecycle.LifecycleEventType;
import org.apache.ignite.marshaller.MarshallerExclusions;
import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
-import org.apache.ignite.internal.portable.BinaryMarshaller;
import org.apache.ignite.mxbean.ClusterLocalNodeMetricsMXBean;
import org.apache.ignite.mxbean.IgniteMXBean;
import org.apache.ignite.mxbean.ThreadPoolMXBean;
@@ -1192,9 +1192,9 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
if (cfg.getIncludeEventTypes() != null && cfg.getIncludeEventTypes().length != 0)
perf.add("Disable grid events (remove 'includeEventTypes' from configuration)");
- if (OptimizedMarshaller.available() && !(cfg.getMarshaller() instanceof OptimizedMarshaller))
- perf.add("Enable optimized marshaller (set 'marshaller' to " +
- OptimizedMarshaller.class.getSimpleName() + ')');
+ if (BinaryMarshaller.available() && !(cfg.getMarshaller() instanceof BinaryMarshaller))
+ perf.add("Enable binary marshaller (set 'marshaller' to " +
+ BinaryMarshaller.class.getSimpleName() + ')');
}
/**
[10/50] [abbrv] ignite git commit: IGNITE-1956: Added binary enums
support.
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
index ea472eb..373e173 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
@@ -80,24 +80,13 @@ namespace Apache.Ignite.Core.Tests.Binary
new BinaryTypeConfiguration(typeof (BuilderCollection)),
new BinaryTypeConfiguration(typeof (BuilderCollectionItem)),
new BinaryTypeConfiguration(typeof (DecimalHolder)),
- new BinaryTypeConfiguration(TypeEmpty)
+ new BinaryTypeConfiguration(TypeEmpty),
+ new BinaryTypeConfiguration(typeof(TestEnumRegistered))
},
DefaultIdMapper = new IdMapper()
},
JvmClasspath = TestUtils.CreateTestClasspath(),
- JvmOptions = new List<string>
- {
- "-ea",
- "-Xcheck:jni",
- "-Xms4g",
- "-Xmx4g",
- "-DIGNITE_QUIET=false",
- "-Xnoagent",
- "-Djava.compiler=NONE",
- "-Xdebug",
- "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005",
- "-XX:+HeapDumpOnOutOfMemoryError"
- },
+ JvmOptions = TestUtils.TestJavaOptions(),
SpringConfigUrl = "config\\binary.xml"
};
@@ -198,7 +187,7 @@ namespace Apache.Ignite.Core.Tests.Binary
DateTime date = DateTime.Now.ToUniversalTime();
Guid guid = Guid.NewGuid();
- IIgniteBinary api = _grid.GetBinary();
+ IBinary api = _grid.GetBinary();
// 1. Primitives.
Assert.AreEqual(1, api.ToBinary<byte>((byte)1));
@@ -216,7 +205,8 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual("a", api.ToBinary<string>("a"));
Assert.AreEqual(date, api.ToBinary<DateTime>(date));
Assert.AreEqual(guid, api.ToBinary<Guid>(guid));
- Assert.AreEqual(TestEnum.One, api.ToBinary<TestEnum>(TestEnum.One));
+ Assert.AreEqual(TestEnumRegistered.One, api.ToBinary<IBinaryObject>(TestEnumRegistered.One)
+ .Deserialize<TestEnumRegistered>());
// 3. Arrays.
Assert.AreEqual(new byte[] { 1 }, api.ToBinary<byte[]>(new byte[] { 1 }));
@@ -233,7 +223,9 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(new[] { "a" }, api.ToBinary<string[]>(new[] { "a" }));
Assert.AreEqual(new[] { date }, api.ToBinary<DateTime[]>(new[] { date }));
Assert.AreEqual(new[] { guid }, api.ToBinary<Guid[]>(new[] { guid }));
- Assert.AreEqual(new[] { TestEnum.One }, api.ToBinary<TestEnum[]>(new[] { TestEnum.One }));
+ Assert.AreEqual(new[] { TestEnumRegistered.One},
+ api.ToBinary<IBinaryObject[]>(new[] { TestEnumRegistered.One})
+ .Select(x => x.Deserialize<TestEnumRegistered>()).ToArray());
// 4. Objects.
IBinaryObject binObj = api.ToBinary<IBinaryObject>(new ToBinary(1));
@@ -816,7 +808,7 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(new[] { "str" }, binObj.GetField<string[]>("fStrArr"));
Assert.AreEqual(new[] { nDate }, binObj.GetField<DateTime?[]>("fDateArr"));
Assert.AreEqual(new[] { nGuid }, binObj.GetField<Guid?[]>("fGuidArr"));
- Assert.AreEqual(new[] { TestEnum.One }, binObj.GetField<TestEnum[]>("fEnumArr"));
+ Assert.AreEqual(new[] {TestEnum.One}, binObj.GetField<TestEnum[]>("fEnumArr"));
StringDateGuidEnum obj = binObj.Deserialize<StringDateGuidEnum>();
@@ -839,7 +831,7 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(new[] { "str" }, builder.GetField<string[]>("fStrArr"));
Assert.AreEqual(new[] { nDate }, builder.GetField<DateTime?[]>("fDateArr"));
Assert.AreEqual(new[] { nGuid }, builder.GetField<Guid?[]>("fGuidArr"));
- Assert.AreEqual(new[] { TestEnum.One }, builder.GetField<TestEnum[]>("fEnumArr"));
+ Assert.AreEqual(new[] {TestEnum.One}, builder.GetField<TestEnum[]>("fEnumArr"));
// Check reassemble.
binObj = builder.Build();
@@ -851,7 +843,7 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(new[] { "str" }, binObj.GetField<string[]>("fStrArr"));
Assert.AreEqual(new[] { nDate }, binObj.GetField<DateTime?[]>("fDateArr"));
Assert.AreEqual(new[] { nGuid }, binObj.GetField<Guid?[]>("fGuidArr"));
- Assert.AreEqual(new[] { TestEnum.One }, binObj.GetField<TestEnum[]>("fEnumArr"));
+ Assert.AreEqual(new[] {TestEnum.One}, binObj.GetField<TestEnum[]>("fEnumArr"));
obj = binObj.Deserialize<StringDateGuidEnum>();
@@ -889,7 +881,7 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(new[] { "str2" }, binObj.GetField<string[]>("fStrArr"));
Assert.AreEqual(new[] { nDate }, binObj.GetField<DateTime?[]>("fDateArr"));
Assert.AreEqual(new[] { nGuid }, binObj.GetField<Guid?[]>("fGuidArr"));
- Assert.AreEqual(new[] { TestEnum.Two }, binObj.GetField<TestEnum[]>("fEnumArr"));
+ Assert.AreEqual(new[] {TestEnum.Two}, binObj.GetField<TestEnum[]>("fEnumArr"));
obj = binObj.Deserialize<StringDateGuidEnum>();
@@ -903,6 +895,24 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(new[] { TestEnum.Two }, obj.FEnumArr);
}
+ [Test]
+ public void TestEnumMeta()
+ {
+ var bin = _grid.GetBinary();
+
+ // Put to cache to populate metas
+ var binEnum = bin.ToBinary<IBinaryObject>(TestEnumRegistered.One);
+
+ Assert.AreEqual(_marsh.GetDescriptor(typeof (TestEnumRegistered)).TypeId, binEnum.GetBinaryType().TypeId);
+ Assert.AreEqual(0, binEnum.EnumValue);
+
+ var meta = binEnum.GetBinaryType();
+
+ Assert.IsTrue(meta.IsEnum);
+ Assert.AreEqual(typeof (TestEnumRegistered).Name, meta.TypeName);
+ Assert.AreEqual(0, meta.Fields.Count);
+ }
+
/// <summary>
/// Test arrays.
/// </summary>
@@ -923,7 +933,7 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(100, binObj.GetHashCode());
- var binInArr = binObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
+ var binInArr = binObj.GetField<IBinaryObject[]>("inArr").ToArray();
Assert.AreEqual(1, binInArr.Length);
Assert.AreEqual(1, binInArr[0].GetField<int>("val"));
@@ -936,11 +946,11 @@ namespace Apache.Ignite.Core.Tests.Binary
// 2. Test addition to array.
binObj = _grid.GetBinary().GetBuilder(binObj).SetHashCode(200)
- .SetField("inArr", new object[] { binInArr[0], null }).Build();
+ .SetField("inArr", new[] { binInArr[0], null }).Build();
Assert.AreEqual(200, binObj.GetHashCode());
- binInArr = binObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
+ binInArr = binObj.GetField<IBinaryObject[]>("inArr").ToArray();
Assert.AreEqual(2, binInArr.Length);
Assert.AreEqual(1, binInArr[0].GetField<int>("val"));
@@ -960,7 +970,7 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(300, binObj.GetHashCode());
- binInArr = binObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
+ binInArr = binObj.GetField<IBinaryObject[]>("inArr").ToArray();
Assert.AreEqual(2, binInArr.Length);
Assert.AreEqual(1, binInArr[0].GetField<int>("val"));
@@ -983,7 +993,7 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(100, binObj.GetHashCode());
- binInArr = binObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
+ binInArr = binObj.GetField<IBinaryObject[]>("inArr").ToArray();
Assert.AreEqual(2, binInArr.Length);
Assert.AreEqual(1, binInArr[0].GetField<int>("val"));
@@ -1003,7 +1013,7 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(200, binObj.GetHashCode());
- binInArr = binObj.GetField<object[]>("inArr").Cast<IBinaryObject>().ToArray();
+ binInArr = binObj.GetField<IBinaryObject[]>("inArr").ToArray();
Assert.AreEqual(2, binInArr.Length);
Assert.AreEqual(2, binInArr[0].GetField<int>("val"));
@@ -1031,7 +1041,7 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(100, binObj.GetHashCode());
- var binOutArr = binObj.GetField<object[]>("outArr").Cast<IBinaryObject>().ToArray();
+ var binOutArr = binObj.GetField<IBinaryObject[]>("outArr").ToArray();
Assert.AreEqual(2, binOutArr.Length);
Assert.AreEqual(1, binOutArr[0].GetField<IBinaryObject>("inner").GetField<int>("val"));
@@ -1052,7 +1062,7 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(200, binObj.GetHashCode());
- binInArr = binObj.GetField<object[]>("outArr").Cast<IBinaryObject>().ToArray();
+ binInArr = binObj.GetField<IBinaryObject[]>("outArr").ToArray();
Assert.AreEqual(2, binInArr.Length);
Assert.AreEqual(2, binOutArr[0].GetField<IBinaryObject>("inner").GetField<int>("val"));
@@ -1387,6 +1397,27 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(new[] {"val", "valArr"}, decimalMeta.Fields);
}
+
+ [Test]
+ public void TestBuildEnum()
+ {
+ var binary = _grid.GetBinary();
+
+ int val = (int) TestEnumRegistered.Two;
+
+ var binEnums = new[]
+ {
+ binary.BuildEnum(typeof (TestEnumRegistered), val),
+ binary.BuildEnum(typeof (TestEnumRegistered).Name, val)
+ };
+
+ foreach (var binEnum in binEnums)
+ {
+ Assert.IsTrue(binEnum.GetBinaryType().IsEnum);
+ Assert.AreEqual(val, binEnum.EnumValue);
+ Assert.AreEqual((TestEnumRegistered)val, binEnum.Deserialize<TestEnumRegistered>());
+ }
+ }
}
/// <summary>
@@ -1452,6 +1483,14 @@ namespace Apache.Ignite.Core.Tests.Binary
}
/// <summary>
+ /// Registered enumeration.
+ /// </summary>
+ public enum TestEnumRegistered
+ {
+ One, Two
+ }
+
+ /// <summary>
/// binary with raw data.
/// </summary>
public class WithRaw : IBinarizable
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
index f7455be..88328ec 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
@@ -25,6 +25,7 @@ namespace Apache.Ignite.Core.Tests.Binary
using System;
using System.Collections;
using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Common;
@@ -479,11 +480,18 @@ namespace Apache.Ignite.Core.Tests.Binary
* <summary>Check write of enum.</summary>
*/
[Test]
+ [SuppressMessage("ReSharper", "ExpressionIsAlwaysNull")]
public void TestWriteEnum()
{
TestEnum val = TestEnum.Val1;
Assert.AreEqual(_marsh.Unmarshal<TestEnum>(_marsh.Marshal(val)), val);
+
+ TestEnum? val2 = TestEnum.Val1;
+ Assert.AreEqual(_marsh.Unmarshal<TestEnum?>(_marsh.Marshal(val2)), val2);
+
+ val2 = null;
+ Assert.AreEqual(_marsh.Unmarshal<TestEnum?>(_marsh.Marshal(val2)), val2);
}
/// <summary>
@@ -500,7 +508,13 @@ namespace Apache.Ignite.Core.Tests.Binary
TestEnum val = TestEnum.Val1;
- Assert.AreEqual(marsh.Unmarshal<TestEnum>(marsh.Marshal(val)), val);
+ var data = marsh.Marshal(val);
+
+ Assert.AreEqual(marsh.Unmarshal<TestEnum>(data), val);
+
+ var binEnum = marsh.Unmarshal<IBinaryObject>(data, true);
+
+ Assert.AreEqual(val, (TestEnum) binEnum.EnumValue);
}
/**
@@ -668,8 +682,13 @@ namespace Apache.Ignite.Core.Tests.Binary
IBinaryObject portNewObj = marsh.Unmarshal<IBinaryObject>(data, BinaryMode.ForceBinary);
+ Assert.IsTrue(portNewObj.HasField("field1"));
+ Assert.IsTrue(portNewObj.HasField("field2"));
+ Assert.IsFalse(portNewObj.HasField("field3"));
+
Assert.AreEqual(obj.Field1, portNewObj.GetField<int>("field1"));
Assert.AreEqual(obj.Field2, portNewObj.GetField<int>("Field2"));
+ Assert.AreEqual(0, portNewObj.GetField<int>("field3"));
}
/**
@@ -881,8 +900,11 @@ namespace Apache.Ignite.Core.Tests.Binary
Marshaller marsh =
new Marshaller(new BinaryConfiguration
{
- TypeConfigurations =
- new List<BinaryTypeConfiguration> {new BinaryTypeConfiguration(typeof (EnumType))}
+ TypeConfigurations = new[]
+ {
+ new BinaryTypeConfiguration(typeof (EnumType)),
+ new BinaryTypeConfiguration(typeof (TestEnum))
+ }
});
EnumType obj = new EnumType
@@ -897,6 +919,19 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.AreEqual(obj.GetHashCode(), portObj.GetHashCode());
+ // Test enum field in binary form
+ var binEnum = portObj.GetField<IBinaryObject>("PEnum");
+ Assert.AreEqual(obj.PEnum.GetHashCode(), binEnum.GetHashCode());
+ Assert.AreEqual((int) obj.PEnum, binEnum.EnumValue);
+ Assert.AreEqual(obj.PEnum, binEnum.Deserialize<TestEnum>());
+ Assert.AreEqual(obj.PEnum, binEnum.Deserialize<object>());
+ Assert.AreEqual(typeof(TestEnum), binEnum.Deserialize<object>().GetType());
+ Assert.AreEqual(null, binEnum.GetField<object>("someField"));
+ Assert.IsFalse(binEnum.HasField("anyField"));
+
+ var binEnumArr = portObj.GetField<IBinaryObject[]>("PEnumArray");
+ Assert.IsTrue(binEnumArr.Select(x => x.Deserialize<TestEnum>()).SequenceEqual(obj.PEnumArray));
+
EnumType newObj = portObj.Deserialize<EnumType>();
Assert.AreEqual(obj.PEnum, newObj.PEnum);
@@ -1094,7 +1129,7 @@ namespace Apache.Ignite.Core.Tests.Binary
inner.RawOuter = outer;
var bytes = asbinary
- ? marsh.Marshal(new IgniteBinary(marsh).ToBinary<IBinaryObject>(outer))
+ ? marsh.Marshal(new Binary(marsh).ToBinary<IBinaryObject>(outer))
: marsh.Marshal(outer);
IBinaryObject outerObj;
@@ -2057,6 +2092,11 @@ namespace Apache.Ignite.Core.Tests.Binary
Val1, Val2, Val3 = 10
}
+ public enum TestEnum2
+ {
+ Val1, Val2, Val3 = 10
+ }
+
public class DecimalReflective
{
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
index 64124d7..ce15739 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
@@ -347,17 +347,16 @@ namespace Apache.Ignite.Core.Tests.Cache
for (int i = 0; i < GridCount(); i++)
{
var cache = Cache(i);
+ var entries = cache.Select(pair => pair.ToString() + GetKeyAffinity(cache, pair.Key)).ToArray();
- if (!cache.IsEmpty())
- {
- var entries = Enumerable.Range(0, 2000)
- .Select(x => new KeyValuePair<int, int>(x, cache.LocalPeek(x)))
- .Where(x => x.Value != 0)
- .Select(pair => pair.ToString() + GetKeyAffinity(cache, pair.Key))
- .Aggregate((acc, val) => string.Format("{0}, {1}", acc, val));
+ if (entries.Any())
+ Assert.Fail("Cache '{0}' is not empty in grid [{1}]: ({2})", CacheName(), i,
+ entries.Aggregate((acc, val) => string.Format("{0}, {1}", acc, val)));
- Assert.Fail("Cache '{0}' is not empty in grid [{1}]: ({2})", CacheName(), i, entries);
- }
+ var size = cache.GetSize();
+ Assert.AreEqual(0, size,
+ "Cache enumerator returned no entries, but cache '{0}' size is {1} in grid [{2}]",
+ CacheName(), size, i);
}
Console.WriteLine("Test finished: " + TestContext.CurrentContext.Test.Name);
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
index 1e999e3..87b7f9d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
@@ -899,6 +899,12 @@ namespace Apache.Ignite.Core.Tests.Compute
var res = _grid1.GetCompute().ExecuteJavaTask<PlatformComputeEnum>(EchoTask, EchoTypeEnumField);
+ var enumMeta = _grid1.GetBinary().GetBinaryType(typeof (PlatformComputeEnum));
+
+ Assert.IsTrue(enumMeta.IsEnum);
+ Assert.AreEqual(enumMeta.TypeName, typeof(PlatformComputeEnum).Name);
+ Assert.AreEqual(0, enumMeta.Fields.Count);
+
Assert.AreEqual(enumVal, res);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
index aa58054..3061773 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
@@ -64,7 +64,8 @@
<property name="typeName" value="org.apache.ignite.platform.PlatformComputeJavaBinarizable"/>
</bean>
<bean class="org.apache.ignite.binary.BinaryTypeConfiguration">
- <property name="typeName" value="org.apache.ignite.platform.PlatformComputeEnum"/>
+ <property name="typeName" value="org.apache.ignite.platform.PlatformComputeEnum" />
+ <property name="enum" value="true" />
</bean>
</list>
</property>
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
index b414a91..25a1d16 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
@@ -41,6 +41,7 @@
<property name="atomicityMode" value="TRANSACTIONAL"/>
<property name="writeThrough" value="true"/>
<property name="readThrough" value="true"/>
+ <property name="keepBinaryInStore" value="true"/>
<property name="cacheStoreFactory">
<bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs
index 1797337..973381c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs
@@ -48,7 +48,7 @@ namespace Apache.Ignite.Core.Tests.Services
});
/** */
- protected readonly IIgniteBinary IgniteBinary;
+ protected readonly IBinary Binary;
/** */
private readonly PlatformMemoryManager _memory = new PlatformMemoryManager(1024);
@@ -64,7 +64,7 @@ namespace Apache.Ignite.Core.Tests.Services
/// </summary>
public ServiceProxyTest()
{
- IgniteBinary = new IgniteBinary(_marsh);
+ Binary = new Binary(_marsh);
}
/// <summary>
@@ -243,7 +243,7 @@ namespace Apache.Ignite.Core.Tests.Services
/// </summary>
protected T GetProxy<T>()
{
- _svc = new TestIgniteService(IgniteBinary);
+ _svc = new TestIgniteService(Binary);
var prx = new ServiceProxy<T>(InvokeProxyMethod).GetTransparentProxy();
@@ -439,15 +439,15 @@ namespace Apache.Ignite.Core.Tests.Services
private class TestIgniteService : ITestIgniteService, ITestIgniteServiceAmbiguity
{
/** */
- private readonly IIgniteBinary _igniteBinary;
+ private readonly IBinary _binary;
/// <summary>
/// Initializes a new instance of the <see cref="TestIgniteService"/> class.
/// </summary>
- /// <param name="igniteBinary">Binary.</param>
- public TestIgniteService(IIgniteBinary igniteBinary)
+ /// <param name="binary">Binary.</param>
+ public TestIgniteService(IBinary binary)
{
- _igniteBinary = igniteBinary;
+ _binary = binary;
}
/** <inheritdoc /> */
@@ -534,13 +534,13 @@ namespace Apache.Ignite.Core.Tests.Services
/** <inheritdoc /> */
public IBinaryObject BinarizableResultMethod(int arg1, TestBinarizableClass arg2)
{
- return _igniteBinary.ToBinary<IBinaryObject>(arg2);
+ return _binary.ToBinary<IBinaryObject>(arg2);
}
/** <inheritdoc /> */
public IBinaryObject BinarizableArgAndResultMethod(int arg1, IBinaryObject arg2)
{
- return _igniteBinary.ToBinary<IBinaryObject>(arg2.Deserialize<TestBinarizableClass>());
+ return _binary.ToBinary<IBinaryObject>(arg2.Deserialize<TestBinarizableClass>());
}
/** <inheritdoc /> */
@@ -703,7 +703,7 @@ namespace Apache.Ignite.Core.Tests.Services
var prx = GetProxy();
var obj = new TestBinarizableClass { Prop = "PropValue" };
- var portObj = IgniteBinary.ToBinary<IBinaryObject>(obj);
+ var portObj = Binary.ToBinary<IBinaryObject>(obj);
var result = prx.BinarizableArgMethod(1, portObj);
@@ -731,7 +731,7 @@ namespace Apache.Ignite.Core.Tests.Services
var prx = GetProxy();
var obj = new TestBinarizableClass { Prop = "PropValue" };
- var portObj = IgniteBinary.ToBinary<IBinaryObject>(obj);
+ var portObj = Binary.ToBinary<IBinaryObject>(obj);
var result = prx.BinarizableArgAndResultMethod(1, portObj);
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index ae10159..2c7d787 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -134,6 +134,7 @@
<Compile Include="IgniteConfiguration.cs" />
<Compile Include="Ignition.cs" />
<Compile Include="IIgnite.cs" />
+ <Compile Include="Impl\Binary\BinaryEnum.cs" />
<Compile Include="Impl\Cache\CacheAffinityImpl.cs" />
<Compile Include="Impl\Cache\CacheEntry.cs" />
<Compile Include="Impl\Cache\CacheEntryFilterHolder.cs" />
@@ -266,7 +267,7 @@
<Compile Include="Impl\Binary\BinaryReader.cs" />
<Compile Include="Impl\Binary\BinaryReflectiveActions.cs" />
<Compile Include="Impl\Binary\BinaryReflectiveSerializer.cs" />
- <Compile Include="Impl\Binary\IgniteBinary.cs" />
+ <Compile Include="Impl\Binary\Binary.cs" />
<Compile Include="Impl\Binary\Structure\BinaryStructureTracker.cs" />
<Compile Include="Impl\Binary\BinarySurrogateTypeDescriptor.cs" />
<Compile Include="Impl\Binary\BinarySystemHandlers.cs" />
@@ -316,7 +317,7 @@
<Compile Include="Binary\IBinaryRawReader.cs" />
<Compile Include="Binary\IBinaryRawWriter.cs" />
<Compile Include="Binary\IBinaryReader.cs" />
- <Compile Include="Binary\IIgniteBinary.cs" />
+ <Compile Include="Binary\IBinary.cs" />
<Compile Include="Binary\IBinarySerializer.cs" />
<Compile Include="Binary\IBinaryWriter.cs" />
<Compile Include="Binary\BinaryConfiguration.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeConfiguration.cs
index 967aa52..99f8572 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryTypeConfiguration.cs
@@ -48,6 +48,7 @@ namespace Apache.Ignite.Core.Binary
public BinaryTypeConfiguration(Type type)
{
TypeName = type.AssemblyQualifiedName;
+ IsEnum = type.IsEnum;
}
/// <summary>
@@ -62,6 +63,7 @@ namespace Apache.Ignite.Core.Binary
Serializer = cfg.Serializer;
TypeName = cfg.TypeName;
KeepDeserialized = cfg.KeepDeserialized;
+ IsEnum = cfg.IsEnum;
}
/// <summary>
@@ -101,6 +103,11 @@ namespace Apache.Ignite.Core.Binary
public bool? KeepDeserialized { get; set; }
/// <summary>
+ /// Gets or sets a value indicating whether this instance describes an enum type.
+ /// </summary>
+ public bool IsEnum { get; set; }
+
+ /// <summary>
/// Returns a string that represents the current object.
/// </summary>
/// <returns>
@@ -108,9 +115,12 @@ namespace Apache.Ignite.Core.Binary
/// </returns>
public override string ToString()
{
- return typeof (BinaryTypeConfiguration).Name + " [TypeName=" + TypeName +
- ", NameMapper=" + NameMapper + ", IdMapper=" + IdMapper + ", Serializer=" + Serializer +
- ", AffinityKeyFieldName=" + AffinityKeyFieldName + ']';
+ return
+ string.Format(
+ "{0} [TypeName={1}, NameMapper={2}, IdMapper={3}, Serializer={4}, AffinityKeyFieldName={5}, " +
+ "KeepDeserialized={6}, IsEnum={7}]",
+ typeof (BinaryTypeConfiguration).Name, TypeName, NameMapper, IdMapper, Serializer,
+ AffinityKeyFieldName, KeepDeserialized, IsEnum);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinary.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinary.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinary.cs
new file mode 100644
index 0000000..a0fc17f
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinary.cs
@@ -0,0 +1,136 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Binary
+{
+ using System;
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// Defines binary objects functionality. With binary objects you are able to:
+ /// <list type="bullet">
+ /// <item>
+ /// <description>Seamlessly interoperate between Java, .NET, and C++.</description>
+ /// </item>
+ /// <item>
+ /// <description>Make any object binary with zero code change to your existing code.</description>
+ /// </item>
+ /// <item>
+ /// <description>Nest binary objects within each other.</description>
+ /// </item>
+ /// <item>
+ /// <description>Automatically handle <c>circular</c> or <c>null</c> references.</description>
+ /// </item>
+ /// <item>
+ /// <description>Automatically convert collections and maps between Java, .NET, and C++.</description>
+ /// </item>
+ /// <item>
+ /// <description>Optionally avoid deserialization of objects on the server side.</description>
+ /// </item>
+ /// <item>
+ /// <description>Avoid need to have concrete class definitions on the server side.</description>
+ /// </item>
+ /// <item>
+ /// <description>Dynamically change structure of the classes without having to restart the cluster.</description>
+ /// </item>
+ /// <item>
+ /// <description>Index into binary objects for querying purposes.</description>
+ /// </item>
+ /// </list>
+ /// </summary>
+ public interface IBinary
+ {
+ /// <summary>
+ /// Converts provided object to binary form.
+ /// <para />
+ /// Note that object's type needs to be configured in <see cref="BinaryConfiguration"/>.
+ /// </summary>
+ /// <param name="obj">Object to convert.</param>
+ /// <returns>Converted object.</returns>
+ T ToBinary<T>(object obj);
+
+ /// <summary>
+ /// Create builder for the given binary object type. Note that this
+ /// type must be specified in <see cref="BinaryConfiguration"/>.
+ /// </summary>
+ /// <param name="type"></param>
+ /// <returns>Builder.</returns>
+ IBinaryObjectBuilder GetBuilder(Type type);
+
+ /// <summary>
+ /// Create builder for the given binary object type name. Note that this
+ /// type name must be specified in <see cref="BinaryConfiguration"/>.
+ /// </summary>
+ /// <param name="typeName">Type name.</param>
+ /// <returns>Builder.</returns>
+ IBinaryObjectBuilder GetBuilder(string typeName);
+
+ /// <summary>
+ /// Create builder over existing binary object.
+ /// </summary>
+ /// <param name="obj"></param>
+ /// <returns>Builder.</returns>
+ IBinaryObjectBuilder GetBuilder(IBinaryObject obj);
+
+ /// <summary>
+ /// Gets type id for the given type name.
+ /// </summary>
+ /// <param name="typeName">Type name.</param>
+ /// <returns>Type id.</returns>
+ int GetTypeId(string typeName);
+
+ /// <summary>
+ /// Gets metadata for all known types.
+ /// </summary>
+ /// <returns>Metadata.</returns>
+ ICollection<IBinaryType> GetBinaryTypes();
+
+ /// <summary>
+ /// Gets metadata for specified type id.
+ /// </summary>
+ /// <returns>Metadata.</returns>
+ IBinaryType GetBinaryType(int typeId);
+
+ /// <summary>
+ /// Gets metadata for specified type name.
+ /// </summary>
+ /// <returns>Metadata.</returns>
+ IBinaryType GetBinaryType(string typeName);
+
+ /// <summary>
+ /// Gets metadata for specified type.
+ /// </summary>
+ /// <returns>Metadata.</returns>
+ IBinaryType GetBinaryType(Type type);
+
+ /// <summary>
+ /// Converts enum to a binary form.
+ /// </summary>
+ /// <param name="typeName">Enum type name.</param>
+ /// <param name="value">Enum int value.</param>
+ /// <returns>Binary representation of the specified enum value.</returns>
+ IBinaryObject BuildEnum(string typeName, int value);
+
+ /// <summary>
+ /// Converts enum to a binary form.
+ /// </summary>
+ /// <param name="type">Enum type.</param>
+ /// <param name="value">Enum int value.</param>
+ /// <returns>Binary representation of the specified enum value.</returns>
+ IBinaryObject BuildEnum(Type type, int value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryObject.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryObject.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryObject.cs
index bd60e28..c5aa80e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryObject.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryObject.cs
@@ -25,14 +25,6 @@ namespace Apache.Ignite.Core.Binary
public interface IBinaryObject
{
/// <summary>
- /// Gets binary object type ID.
- /// </summary>
- /// <value>
- /// Type ID.
- /// </value>
- int TypeId { get; }
-
- /// <summary>
/// Gets object metadata.
/// </summary>
/// <returns>Metadata.</returns>
@@ -50,11 +42,26 @@ namespace Apache.Ignite.Core.Binary
TF GetField<TF>(string fieldName);
/// <summary>
+ /// Determines whether the field with specified name exists in this instance.
+ /// </summary>
+ /// <param name="fieldName">Name of the field.</param>
+ /// <returns>True if there is a field with specified name; false otherwise.</returns>
+ bool HasField(string fieldName);
+
+ /// <summary>
/// Gets fully deserialized instance of binary object.
/// </summary>
/// <returns>
/// Fully deserialized instance of binary object.
/// </returns>
T Deserialize<T>();
+
+ /// <summary>
+ /// Gets the value of underlying enum in int form.
+ /// </summary>
+ /// <value>
+ /// The value of underlying enum in int form.
+ /// </value>
+ int EnumValue { get; }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryType.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryType.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryType.cs
index 7b34e07..bec863f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryType.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryType.cs
@@ -48,5 +48,18 @@ namespace Apache.Ignite.Core.Binary
/// </summary>
/// <returns>Affinity key field name or null in case it is not provided.</returns>
string AffinityKeyFieldName { get; }
+
+ /// <summary>
+ /// Gets a value indicating whether this type represents an enum.
+ /// </summary>
+ /// <value>
+ /// <c>true</c> if this instance represents an enum; otherwise, <c>false</c>.
+ /// </value>
+ bool IsEnum { get; }
+
+ /// <summary>
+ /// Gets the type identifier.
+ /// </summary>
+ int TypeId { get; }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IIgniteBinary.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IIgniteBinary.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IIgniteBinary.cs
deleted file mode 100644
index 25ea981..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IIgniteBinary.cs
+++ /dev/null
@@ -1,120 +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.
- */
-
-namespace Apache.Ignite.Core.Binary
-{
- using System;
- using System.Collections.Generic;
-
- /// <summary>
- /// Defines binary objects functionality. With binary objects you are able to:
- /// <list type="bullet">
- /// <item>
- /// <description>Seamlessly interoperate between Java, .NET, and C++.</description>
- /// </item>
- /// <item>
- /// <description>Make any object binary with zero code change to your existing code.</description>
- /// </item>
- /// <item>
- /// <description>Nest binary objects within each other.</description>
- /// </item>
- /// <item>
- /// <description>Automatically handle <c>circular</c> or <c>null</c> references.</description>
- /// </item>
- /// <item>
- /// <description>Automatically convert collections and maps between Java, .NET, and C++.</description>
- /// </item>
- /// <item>
- /// <description>Optionally avoid deserialization of objects on the server side.</description>
- /// </item>
- /// <item>
- /// <description>Avoid need to have concrete class definitions on the server side.</description>
- /// </item>
- /// <item>
- /// <description>Dynamically change structure of the classes without having to restart the cluster.</description>
- /// </item>
- /// <item>
- /// <description>Index into binary objects for querying purposes.</description>
- /// </item>
- /// </list>
- /// </summary>
- public interface IIgniteBinary
- {
- /// <summary>
- /// Converts provided object to binary form.
- /// <para />
- /// Note that object's type needs to be configured in <see cref="BinaryConfiguration"/>.
- /// </summary>
- /// <param name="obj">Object to convert.</param>
- /// <returns>Converted object.</returns>
- T ToBinary<T>(object obj);
-
- /// <summary>
- /// Create builder for the given binary object type. Note that this
- /// type must be specified in <see cref="BinaryConfiguration"/>.
- /// </summary>
- /// <param name="type"></param>
- /// <returns>Builder.</returns>
- IBinaryObjectBuilder GetBuilder(Type type);
-
- /// <summary>
- /// Create builder for the given binary object type name. Note that this
- /// type name must be specified in <see cref="BinaryConfiguration"/>.
- /// </summary>
- /// <param name="typeName">Type name.</param>
- /// <returns>Builder.</returns>
- IBinaryObjectBuilder GetBuilder(string typeName);
-
- /// <summary>
- /// Create builder over existing binary object.
- /// </summary>
- /// <param name="obj"></param>
- /// <returns>Builder.</returns>
- IBinaryObjectBuilder GetBuilder(IBinaryObject obj);
-
- /// <summary>
- /// Gets type id for the given type name.
- /// </summary>
- /// <param name="typeName">Type name.</param>
- /// <returns>Type id.</returns>
- int GetTypeId(string typeName);
-
- /// <summary>
- /// Gets metadata for all known types.
- /// </summary>
- /// <returns>Metadata.</returns>
- ICollection<IBinaryType> GetBinaryTypes();
-
- /// <summary>
- /// Gets metadata for specified type id.
- /// </summary>
- /// <returns>Metadata.</returns>
- IBinaryType GetBinaryType(int typeId);
-
- /// <summary>
- /// Gets metadata for specified type name.
- /// </summary>
- /// <returns>Metadata.</returns>
- IBinaryType GetBinaryType(string typeName);
-
- /// <summary>
- /// Gets metadata for specified type.
- /// </summary>
- /// <returns>Metadata.</returns>
- IBinaryType GetBinaryType(Type type);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
index b9d9555..08e5f6b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
@@ -111,11 +111,11 @@ namespace Apache.Ignite.Core
IDataStreamer<TK, TV> GetDataStreamer<TK, TV>(string cacheName);
/// <summary>
- /// Gets an instance of <see cref="IIgniteBinary"/> interface.
+ /// Gets an instance of <see cref="IBinary"/> interface.
/// </summary>
- /// <returns>Instance of <see cref="IIgniteBinary"/> interface</returns>
+ /// <returns>Instance of <see cref="IBinary"/> interface</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Semantics.")]
- IIgniteBinary GetBinary();
+ IBinary GetBinary();
/// <summary>
/// Gets affinity service to provide information about data partitioning and distribution.
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Binary.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Binary.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Binary.cs
new file mode 100644
index 0000000..43a4bb8
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Binary.cs
@@ -0,0 +1,216 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Impl.Binary
+{
+ using System;
+ using System.Collections.Generic;
+ using System.IO;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Impl.Binary.IO;
+ using Apache.Ignite.Core.Impl.Binary.Metadata;
+ using Apache.Ignite.Core.Impl.Common;
+
+ /// <summary>
+ /// Binary implementation.
+ /// </summary>
+ internal class Binary : IBinary
+ {
+ /** Owning grid. */
+ private readonly Marshaller _marsh;
+
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <param name="marsh">Marshaller.</param>
+ internal Binary(Marshaller marsh)
+ {
+ _marsh = marsh;
+ }
+
+ /** <inheritDoc /> */
+ public T ToBinary<T>(object obj)
+ {
+ if (obj is IBinaryObject)
+ return (T)obj;
+
+ IBinaryStream stream = new BinaryHeapStream(1024);
+
+ // Serialize.
+ BinaryWriter writer = _marsh.StartMarshal(stream);
+
+ try
+ {
+ writer.Write(obj);
+ }
+ finally
+ {
+ // Save metadata.
+ _marsh.FinishMarshal(writer);
+ }
+
+ // Deserialize.
+ stream.Seek(0, SeekOrigin.Begin);
+
+ return _marsh.Unmarshal<T>(stream, BinaryMode.ForceBinary);
+ }
+
+ /** <inheritDoc /> */
+ public IBinaryObjectBuilder GetBuilder(Type type)
+ {
+ IgniteArgumentCheck.NotNull(type, "type");
+
+ IBinaryTypeDescriptor desc = _marsh.GetDescriptor(type);
+
+ if (desc == null)
+ throw new IgniteException("Type is not binary (add it to BinaryConfiguration): " +
+ type.FullName);
+
+ return Builder0(null, BinaryFromDescriptor(desc), desc);
+ }
+
+ /** <inheritDoc /> */
+ public IBinaryObjectBuilder GetBuilder(string typeName)
+ {
+ IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
+
+ IBinaryTypeDescriptor desc = _marsh.GetDescriptor(typeName);
+
+ return Builder0(null, BinaryFromDescriptor(desc), desc);
+ }
+
+ /** <inheritDoc /> */
+ public IBinaryObjectBuilder GetBuilder(IBinaryObject obj)
+ {
+ IgniteArgumentCheck.NotNull(obj, "obj");
+
+ BinaryObject obj0 = obj as BinaryObject;
+
+ if (obj0 == null)
+ throw new ArgumentException("Unsupported object type: " + obj.GetType());
+
+ IBinaryTypeDescriptor desc = _marsh.GetDescriptor(true, obj0.TypeId);
+
+ return Builder0(null, obj0, desc);
+ }
+
+ /** <inheritDoc /> */
+ public int GetTypeId(string typeName)
+ {
+ IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
+
+ return Marshaller.GetDescriptor(typeName).TypeId;
+ }
+
+ /** <inheritDoc /> */
+ public ICollection<IBinaryType> GetBinaryTypes()
+ {
+ return Marshaller.Ignite.ClusterGroup.GetBinaryTypes();
+ }
+
+ /** <inheritDoc /> */
+ public IBinaryType GetBinaryType(int typeId)
+ {
+ return Marshaller.GetBinaryType(typeId);
+ }
+
+ /** <inheritDoc /> */
+ public IBinaryType GetBinaryType(string typeName)
+ {
+ IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
+
+ return GetBinaryType(GetTypeId(typeName));
+ }
+
+ /** <inheritDoc /> */
+ public IBinaryType GetBinaryType(Type type)
+ {
+ IgniteArgumentCheck.NotNull(type, "type");
+
+ var desc = Marshaller.GetDescriptor(type);
+
+ return desc == null ? null : Marshaller.GetBinaryType(desc.TypeId);
+ }
+
+ /** <inheritDoc /> */
+ public IBinaryObject BuildEnum(string typeName, int value)
+ {
+ IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
+
+ var desc = Marshaller.GetDescriptor(typeName);
+
+ IgniteArgumentCheck.Ensure(desc.IsEnum, "typeName", "Type should be an Enum.");
+
+ _marsh.PutBinaryType(desc);
+
+ return new BinaryEnum(GetTypeId(typeName), value, Marshaller);
+ }
+
+ /** <inheritDoc /> */
+ public IBinaryObject BuildEnum(Type type, int value)
+ {
+ IgniteArgumentCheck.NotNull(type, "type");
+ IgniteArgumentCheck.Ensure(type.IsEnum, "type", "Type should be an Enum.");
+
+ return BuildEnum(type.Name, value);
+ }
+
+ /// <summary>
+ /// Marshaller.
+ /// </summary>
+ internal Marshaller Marshaller
+ {
+ get
+ {
+ return _marsh;
+ }
+ }
+
+ /// <summary>
+ /// Create empty binary object from descriptor.
+ /// </summary>
+ /// <param name="desc">Descriptor.</param>
+ /// <returns>Empty binary object.</returns>
+ private BinaryObject BinaryFromDescriptor(IBinaryTypeDescriptor desc)
+ {
+ var len = BinaryObjectHeader.Size;
+
+ var hdr = new BinaryObjectHeader(desc.TypeId, 0, len, 0, len,
+ desc.UserType ? BinaryObjectHeader.Flag.UserType : BinaryObjectHeader.Flag.None);
+
+ var stream = new BinaryHeapStream(len);
+
+ BinaryObjectHeader.Write(hdr, stream, 0);
+
+ return new BinaryObject(_marsh, stream.InternalArray, 0, hdr);
+ }
+
+ /// <summary>
+ /// Internal builder creation routine.
+ /// </summary>
+ /// <param name="parent">Parent builder.</param>
+ /// <param name="obj">binary object.</param>
+ /// <param name="desc">Type descriptor.</param>
+ /// <returns>Builder.</returns>
+ private BinaryObjectBuilder Builder0(BinaryObjectBuilder parent, BinaryObject obj,
+ IBinaryTypeDescriptor desc)
+ {
+ return new BinaryObjectBuilder(this, parent, obj, desc);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryEnum.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryEnum.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryEnum.cs
new file mode 100644
index 0000000..97f44b0
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryEnum.cs
@@ -0,0 +1,134 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Impl.Binary
+{
+ using System;
+ using System.Diagnostics;
+ using Apache.Ignite.Core.Binary;
+
+ /// <summary>
+ /// Represents a typed enum in binary form.
+ /// </summary>
+ internal class BinaryEnum : IBinaryObject, IEquatable<BinaryEnum>
+ {
+ /** Type id. */
+ private readonly int _typeId;
+
+ /** Value. */
+ private readonly int _enumValue;
+
+ /** Marshaller. */
+ private readonly Marshaller _marsh;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="BinaryEnum" /> class.
+ /// </summary>
+ /// <param name="typeId">The type identifier.</param>
+ /// <param name="enumValue">The value.</param>
+ /// <param name="marsh">The marshaller.</param>
+ public BinaryEnum(int typeId, int enumValue, Marshaller marsh)
+ {
+ Debug.Assert(marsh != null);
+
+ _typeId = typeId;
+ _enumValue = enumValue;
+ _marsh = marsh;
+ }
+
+ /** <inheritdoc /> */
+ public int TypeId
+ {
+ get { return _typeId; }
+ }
+
+ /** <inheritdoc /> */
+ public IBinaryType GetBinaryType()
+ {
+ return _marsh.GetBinaryType(_typeId);
+ }
+
+ /** <inheritdoc /> */
+ public TF GetField<TF>(string fieldName)
+ {
+ return default(TF);
+ }
+
+ /** <inheritdoc /> */
+ public bool HasField(string fieldName)
+ {
+ return false;
+ }
+
+ /** <inheritdoc /> */
+ public T Deserialize<T>()
+ {
+ return BinaryUtils.GetEnumValue<T>(_enumValue, _typeId, _marsh);
+ }
+
+ /** <inheritdoc /> */
+ public int EnumValue
+ {
+ get { return _enumValue; }
+ }
+
+ /** <inheritdoc /> */
+ public bool Equals(BinaryEnum other)
+ {
+ if (ReferenceEquals(null, other))
+ return false;
+
+ if (ReferenceEquals(this, other))
+ return true;
+
+ return _typeId == other._typeId && _enumValue == other._enumValue;
+ }
+
+ /** <inheritdoc /> */
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj))
+ return false;
+
+ if (ReferenceEquals(this, obj))
+ return true;
+
+ if (obj.GetType() != GetType())
+ return false;
+
+ return Equals((BinaryEnum) obj);
+ }
+
+ /** <inheritdoc /> */
+ public override int GetHashCode()
+ {
+ return _enumValue.GetHashCode();
+ }
+
+ /** <inheritdoc /> */
+ public static bool operator ==(BinaryEnum left, BinaryEnum right)
+ {
+ return Equals(left, right);
+ }
+
+ /** <inheritdoc /> */
+ public static bool operator !=(BinaryEnum left, BinaryEnum right)
+ {
+ return !Equals(left, right);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
index 9649595..3d2b34d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryFullTypeDescriptor.cs
@@ -63,6 +63,9 @@ namespace Apache.Ignite.Core.Impl.Binary
/** Type schema. */
private readonly BinaryObjectSchema _schema = new BinaryObjectSchema();
+ /** Enum flag. */
+ private bool _isEnum;
+
/// <summary>
/// Constructor.
/// </summary>
@@ -75,6 +78,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="serializer">Serializer.</param>
/// <param name="keepDeserialized">Whether to cache deserialized value in IBinaryObject</param>
/// <param name="affKeyFieldName">Affinity field key name.</param>
+ /// <param name="isEnum">Enum flag.</param>
public BinaryFullTypeDescriptor(
Type type,
int typeId,
@@ -84,7 +88,8 @@ namespace Apache.Ignite.Core.Impl.Binary
IBinaryIdMapper idMapper,
IBinarySerializer serializer,
bool keepDeserialized,
- string affKeyFieldName)
+ string affKeyFieldName,
+ bool isEnum)
{
_type = type;
_typeId = typeId;
@@ -95,6 +100,7 @@ namespace Apache.Ignite.Core.Impl.Binary
_serializer = serializer;
_keepDeserialized = keepDeserialized;
_affKeyFieldName = affKeyFieldName;
+ _isEnum = isEnum;
}
/// <summary>
@@ -169,6 +175,12 @@ namespace Apache.Ignite.Core.Impl.Binary
get { return _affKeyFieldName; }
}
+ /** <inheritdoc/> */
+ public bool IsEnum
+ {
+ get { return _isEnum; }
+ }
+
/** <inheritDoc /> */
public BinaryStructure WriterTypeStructure
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
index fd60da7..90607dd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
@@ -17,14 +17,17 @@
namespace Apache.Ignite.Core.Impl.Binary
{
+ using System;
using System.Collections;
using System.Collections.Generic;
+ using System.Diagnostics;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Impl.Binary.IO;
+ using Apache.Ignite.Core.Impl.Common;
/// <summary>
/// Binary object.
@@ -61,6 +64,10 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="header">The header.</param>
public BinaryObject(Marshaller marsh, byte[] data, int offset, BinaryObjectHeader header)
{
+ Debug.Assert(marsh != null);
+ Debug.Assert(data != null);
+ Debug.Assert(offset >= 0 && offset < data.Length);
+
_marsh = marsh;
_data = data;
@@ -78,11 +85,23 @@ namespace Apache.Ignite.Core.Impl.Binary
/** <inheritdoc /> */
public T GetField<T>(string fieldName)
{
+ IgniteArgumentCheck.NotNullOrEmpty(fieldName, "fieldName");
+
int pos;
return TryGetFieldPosition(fieldName, out pos) ? GetField<T>(pos, null) : default(T);
}
+ /** <inheritdoc /> */
+ public bool HasField(string fieldName)
+ {
+ IgniteArgumentCheck.NotNullOrEmpty(fieldName, "fieldName");
+
+ int pos;
+
+ return TryGetFieldPosition(fieldName, out pos);
+ }
+
/// <summary>
/// Gets field value on the given object.
/// </summary>
@@ -104,6 +123,16 @@ namespace Apache.Ignite.Core.Impl.Binary
return Deserialize<T>(BinaryMode.Deserialize);
}
+ /** <inheritdoc /> */
+ public int EnumValue
+ {
+ get
+ {
+ throw new NotSupportedException("IBinaryObject.Value is only supported for enums. " +
+ "Check IBinaryObject.IsEnum property before accessing Value.");
+ }
+ }
+
/// <summary>
/// Internal deserialization routine.
/// </summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
index 97cc381..7ef6259 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
@@ -37,7 +37,7 @@ namespace Apache.Ignite.Core.Impl.Binary
new Dictionary<int, BinaryBuilderField>();
/** Binary. */
- private readonly IgniteBinary _igniteBinary;
+ private readonly Binary _binary;
/** */
private readonly BinaryObjectBuilder _parent;
@@ -79,18 +79,18 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <summary>
/// Constructor.
/// </summary>
- /// <param name="igniteBinary">Binary.</param>
+ /// <param name="binary">Binary.</param>
/// <param name="parent">Parent builder.</param>
/// <param name="obj">Initial binary object.</param>
/// <param name="desc">Type descriptor.</param>
- public BinaryObjectBuilder(IgniteBinary igniteBinary, BinaryObjectBuilder parent,
+ public BinaryObjectBuilder(Binary binary, BinaryObjectBuilder parent,
BinaryObject obj, IBinaryTypeDescriptor desc)
{
- Debug.Assert(igniteBinary != null);
+ Debug.Assert(binary != null);
Debug.Assert(obj != null);
Debug.Assert(desc != null);
- _igniteBinary = igniteBinary;
+ _binary = binary;
_parent = parent ?? this;
_obj = obj;
_desc = desc;
@@ -361,7 +361,7 @@ namespace Apache.Ignite.Core.Impl.Binary
BinaryHeapStream outStream = new BinaryHeapStream(estimatedCapacity);
- BinaryWriter writer = _igniteBinary.Marshaller.StartMarshal(outStream);
+ BinaryWriter writer = _binary.Marshaller.StartMarshal(outStream);
writer.SetBuilder(this);
@@ -374,10 +374,10 @@ namespace Apache.Ignite.Core.Impl.Binary
writer.Write(this);
// Process metadata.
- _igniteBinary.Marshaller.FinishMarshal(writer);
+ _binary.Marshaller.FinishMarshal(writer);
// Create binary object once metadata is processed.
- return new BinaryObject(_igniteBinary.Marshaller, outStream.InternalArray, 0,
+ return new BinaryObject(_binary.Marshaller, outStream.InternalArray, 0,
BinaryObjectHeader.Read(outStream, 0));
}
finally
@@ -394,9 +394,9 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <returns>Child builder.</returns>
public BinaryObjectBuilder Child(BinaryObject obj)
{
- var desc = _igniteBinary.Marshaller.GetDescriptor(true, obj.TypeId);
+ var desc = _binary.Marshaller.GetDescriptor(true, obj.TypeId);
- return new BinaryObjectBuilder(_igniteBinary, null, obj, desc);
+ return new BinaryObjectBuilder(_binary, null, obj, desc);
}
/// <summary>
@@ -436,7 +436,7 @@ namespace Apache.Ignite.Core.Impl.Binary
var hdr = _obj.Data[pos];
- var field = new BinaryBuilderField(typeof(T), val, hdr, GetWriteAction(hdr));
+ var field = new BinaryBuilderField(typeof(T), val, hdr, GetWriteAction(hdr, pos));
_parent._cache[pos] = field;
@@ -447,8 +447,9 @@ namespace Apache.Ignite.Core.Impl.Binary
/// Gets the write action by header.
/// </summary>
/// <param name="header">The header.</param>
+ /// <param name="pos">Position.</param>
/// <returns>Write action.</returns>
- private static Action<BinaryWriter, object> GetWriteAction(byte header)
+ private Action<BinaryWriter, object> GetWriteAction(byte header, int pos)
{
// We need special actions for all cases where SetField(X) produces different result from SetSpecialField(X)
// Arrays, Collections, Dates
@@ -466,9 +467,20 @@ namespace Apache.Ignite.Core.Impl.Binary
case BinaryUtils.TypeArrayTimestamp:
return WriteTimestampArrayAction;
- }
- return null;
+ case BinaryUtils.TypeArrayEnum:
+ using (var stream = new BinaryHeapStream(_obj.Data))
+ {
+ stream.Seek(pos, SeekOrigin.Begin + 1);
+
+ var elementTypeId = stream.ReadInt();
+
+ return (w, o) => w.WriteEnumArrayInternal((Array) o, elementTypeId);
+ }
+
+ default:
+ return null;
+ }
}
/// <summary>
@@ -510,7 +522,7 @@ namespace Apache.Ignite.Core.Impl.Binary
try
{
// Prepare fields.
- IBinaryTypeHandler metaHnd = _igniteBinary.Marshaller.GetBinaryTypeHandler(desc);
+ IBinaryTypeHandler metaHnd = _binary.Marshaller.GetBinaryTypeHandler(desc);
IDictionary<int, BinaryBuilderField> vals0;
@@ -546,7 +558,7 @@ namespace Apache.Ignite.Core.Impl.Binary
IDictionary<string, int> meta = metaHnd.OnObjectWriteFinished();
if (meta != null)
- _parent._ctx.Writer.SaveMetadata(desc.TypeId, desc.TypeName, desc.AffinityKeyFieldName, meta);
+ _parent._ctx.Writer.SaveMetadata(desc, meta);
}
}
finally
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
index 9aeb908..7b887a9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
@@ -399,13 +399,34 @@ namespace Apache.Ignite.Core.Impl.Binary
/** <inheritdoc /> */
public T ReadEnum<T>(string fieldName)
{
- return ReadField(fieldName, BinaryUtils.ReadEnum<T>, BinaryUtils.TypeEnum);
+ return SeekField(fieldName) ? ReadEnum<T>() : default(T);
}
/** <inheritdoc /> */
public T ReadEnum<T>()
{
- return Read(BinaryUtils.ReadEnum<T>, BinaryUtils.TypeEnum);
+ var hdr = ReadByte();
+
+ switch (hdr)
+ {
+ case BinaryUtils.HdrNull:
+ return default(T);
+
+ case BinaryUtils.TypeEnum:
+ // Never read enums in binary mode when reading a field (we do not support half-binary objects)
+ return ReadEnum0<T>(this, false);
+
+ case BinaryUtils.HdrFull:
+ // Unregistered enum written as serializable
+ Stream.Seek(-1, SeekOrigin.Current);
+
+ return ReadObject<T>();
+
+ default:
+ throw new BinaryObjectException(
+ string.Format("Invalid header on enum deserialization. Expected: {0} or {1} but was: {2}",
+ BinaryUtils.TypeEnum, BinaryUtils.HdrFull, hdr));
+ }
}
/** <inheritdoc /> */
@@ -560,15 +581,16 @@ namespace Apache.Ignite.Core.Impl.Binary
res = ReadBinaryObject<T>(doDetach);
return true;
- }
- if (BinaryUtils.IsPredefinedType(hdr))
- {
- res = BinarySystemHandlers.ReadSystemType<T>(hdr, this);
+ case BinaryUtils.TypeEnum:
+ res = ReadEnum0<T>(this, _mode != BinaryMode.Deserialize);
- return true;
+ return true;
}
+ if (BinarySystemHandlers.TryReadSystemType(hdr, this, out res))
+ return true;
+
throw new BinaryObjectException("Invalid header on deserialization [pos=" + pos + ", hdr=" + hdr + ']');
}
@@ -961,5 +983,20 @@ namespace Apache.Ignite.Core.Impl.Binary
{
return IsNotNullHeader(expHdr) ? readFunc(Stream) : default(T);
}
+
+ /// <summary>
+ /// Reads the enum.
+ /// </summary>
+ private static T ReadEnum0<T>(BinaryReader reader, bool keepBinary)
+ {
+ var enumType = reader.ReadInt();
+
+ var enumValue = reader.ReadInt();
+
+ if (!keepBinary)
+ return BinaryUtils.GetEnumValue<T>(enumValue, enumType, reader.Marshaller);
+
+ return TypeCaster<T>.Cast(new BinaryEnum(enumType, enumValue, reader.Marshaller));
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
index 247b40d..04028b5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
@@ -124,6 +124,12 @@ namespace Apache.Ignite.Core.Impl.Binary
get { return null; }
}
+ /** <inheritdoc/> */
+ public bool IsEnum
+ {
+ get { return false; }
+ }
+
/** <inheritDoc /> */
public BinaryStructure WriterTypeStructure
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
index b49c29d..0af1e82 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
@@ -22,6 +22,7 @@ namespace Apache.Ignite.Core.Impl.Binary
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
+ using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Impl.Binary.IO;
using Apache.Ignite.Core.Impl.Common;
@@ -166,7 +167,6 @@ namespace Apache.Ignite.Core.Impl.Binary
ReadHandlers[BinaryUtils.TypeMapEntry] = new BinarySystemReader(ReadMapEntry);
// 16. Enum.
- ReadHandlers[BinaryUtils.TypeEnum] = new BinarySystemReader<int>(BinaryUtils.ReadEnum<int>);
ReadHandlers[BinaryUtils.TypeArrayEnum] = new BinarySystemReader(ReadEnumArray);
}
@@ -212,6 +212,8 @@ namespace Apache.Ignite.Core.Impl.Binary
return WriteGuid;
if (type == typeof (BinaryObject))
return WriteBinary;
+ if (type == typeof (BinaryEnum))
+ return WriteBinaryEnum;
if (type == typeof (ArrayList))
return WriteArrayList;
if (type == typeof(Hashtable))
@@ -257,11 +259,11 @@ namespace Apache.Ignite.Core.Impl.Binary
if (elemType == typeof(Guid?))
return WriteGuidArray;
// Enums.
- if (elemType.IsEnum)
+ if (elemType.IsEnum || elemType == typeof(BinaryEnum))
return WriteEnumArray;
// Object array.
- if (elemType == typeof (object))
+ if (elemType == typeof (object) || elemType == typeof(IBinaryObject) || elemType == typeof(BinaryObject))
return WriteArray;
}
@@ -329,13 +331,18 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <summary>
/// Reads an object of predefined type.
/// </summary>
- public static T ReadSystemType<T>(byte typeId, BinaryReader ctx)
+ public static bool TryReadSystemType<T>(byte typeId, BinaryReader ctx, out T res)
{
var handler = ReadHandlers[typeId];
- Debug.Assert(handler != null, "Cannot find predefined read handler: " + typeId);
-
- return handler.Read<T>(ctx);
+ if (handler == null)
+ {
+ res = default(T);
+ return false;
+ }
+
+ res = handler.Read<T>(ctx);
+ return true;
}
/// <summary>
@@ -629,9 +636,20 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
private static void WriteEnum(BinaryWriter ctx, object obj)
{
+ ctx.WriteEnum(obj);
+ }
+
+ /// <summary>
+ /// Write enum.
+ /// </summary>
+ private static void WriteBinaryEnum(BinaryWriter ctx, object obj)
+ {
+ var binEnum = (BinaryEnum) obj;
+
ctx.Stream.WriteByte(BinaryUtils.TypeEnum);
- BinaryUtils.WriteEnum(ctx, obj);
+ ctx.WriteInt(binEnum.TypeId);
+ ctx.WriteInt(binEnum.EnumValue);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
index 1aed03f..1917f01 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
@@ -23,7 +23,9 @@ namespace Apache.Ignite.Core.Impl.Binary
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
+ using System.Globalization;
using System.IO;
+ using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
@@ -1318,25 +1320,29 @@ namespace Apache.Ignite.Core.Impl.Binary
}
throw new BinaryObjectException("Only Int32 underlying type is supported for enums: " +
- enumType.Name);
+ enumType.Name);
}
/// <summary>
- /// Read enum.
+ /// Gets the enum value by type id and int representation.
/// </summary>
- /// <param name="stream">Stream.</param>
- /// <returns>Enumeration.</returns>
- public static T ReadEnum<T>(IBinaryStream stream)
+ /// <typeparam name="T">Result type.</typeparam>
+ /// <param name="value">The value.</param>
+ /// <param name="typeId">The type identifier.</param>
+ /// <param name="marsh">The marshaller.</param>
+ /// <returns>value in form of enum, if typeId is known; value in for of int, if typeId is -1.</returns>
+ public static T GetEnumValue<T>(int value, int typeId, Marshaller marsh)
{
- if (!typeof(T).IsEnum || Enum.GetUnderlyingType(typeof(T)) == TypInt)
- {
- stream.ReadInt();
+ if (typeId == ObjTypeId)
+ return TypeCaster<T>.Cast(value);
- return TypeCaster<T>.Cast(stream.ReadInt());
- }
+ // All enums are user types
+ var desc = marsh.GetDescriptor(true, typeId);
- throw new BinaryObjectException("Only Int32 underlying type is supported for enums: " +
- typeof (T).Name);
+ if (desc == null || desc.Type == null)
+ throw new BinaryObjectException("Unknown enum type id: " + typeId);
+
+ return (T)Enum.ToObject(desc.Type, value);
}
/**
@@ -1387,52 +1393,6 @@ namespace Apache.Ignite.Core.Impl.Binary
}
/**
- * <summary>Check whether this is predefined type.</summary>
- * <param name="hdr">Header.</param>
- * <returns>True is this is one of predefined types with special semantics.</returns>
- */
- public static bool IsPredefinedType(byte hdr)
- {
- switch (hdr)
- {
- case TypeByte:
- case TypeShort:
- case TypeInt:
- case TypeLong:
- case TypeFloat:
- case TypeDouble:
- case TypeChar:
- case TypeBool:
- case TypeDecimal:
- case TypeString:
- case TypeGuid:
- case TypeTimestamp:
- case TypeEnum:
- case TypeArrayByte:
- case TypeArrayShort:
- case TypeArrayInt:
- case TypeArrayLong:
- case TypeArrayFloat:
- case TypeArrayDouble:
- case TypeArrayChar:
- case TypeArrayBool:
- case TypeArrayDecimal:
- case TypeArrayString:
- case TypeArrayGuid:
- case TypeArrayTimestamp:
- case TypeArrayEnum:
- case TypeArray:
- case TypeCollection:
- case TypeDictionary:
- case TypeMapEntry:
- case TypeBinary:
- return true;
- default:
- return false;
- }
- }
-
- /**
* <summary>Convert type name.</summary>
* <param name="typeName">Type name.</param>
* <param name="converter">Converter.</param>
@@ -1534,6 +1494,23 @@ namespace Apache.Ignite.Core.Impl.Binary
return id;
}
+ /// <summary>
+ /// Gets the name of the type.
+ /// </summary>
+ /// <param name="type">The type.</param>
+ /// <returns>
+ /// Simple type name for non-generic types; simple type name with appended generic arguments for generic types.
+ /// </returns>
+ public static string GetTypeName(Type type)
+ {
+ if (!type.IsGenericType)
+ return type.Name;
+
+ var args = type.GetGenericArguments().Select(GetTypeName).Aggregate((x, y) => x + "," + y);
+
+ return string.Format(CultureInfo.InvariantCulture, "{0}[{1}]", type.Name, args);
+ }
+
/**
* <summary>Resolve field ID.</summary>
* <param name="typeId">Type ID.</param>
@@ -1732,7 +1709,8 @@ namespace Apache.Ignite.Core.Impl.Binary
IdMapper = CreateInstance<IBinaryIdMapper>(reader),
Serializer = CreateInstance<IBinarySerializer>(reader),
AffinityKeyFieldName = reader.ReadString(),
- KeepDeserialized = reader.ReadObject<bool?>()
+ KeepDeserialized = reader.ReadObject<bool?>(),
+ IsEnum = reader.ReadBoolean()
});
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
index c00dad6..189cd50 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
@@ -20,12 +20,12 @@ namespace Apache.Ignite.Core.Impl.Binary
using System;
using System.Collections;
using System.Collections.Generic;
+ using System.Diagnostics;
using System.IO;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Impl.Binary.IO;
using Apache.Ignite.Core.Impl.Binary.Metadata;
using Apache.Ignite.Core.Impl.Binary.Structure;
- using Apache.Ignite.Core.Impl.Common;
/// <summary>
/// Binary writer implementation.
@@ -45,7 +45,7 @@ namespace Apache.Ignite.Core.Impl.Binary
private BinaryHandleDictionary<object, long> _hnds;
/** Metadatas collected during this write session. */
- private IDictionary<int, IBinaryType> _metas;
+ private IDictionary<int, BinaryType> _metas;
/** Current type ID. */
private int _curTypeId;
@@ -803,8 +803,28 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Enum value.</param>
public void WriteEnum<T>(T val)
{
- _stream.WriteByte(BinaryUtils.TypeEnum);
- BinaryUtils.WriteEnum(this, val);
+ if (val == null)
+ WriteNullField();
+ else
+ {
+ var desc = _marsh.GetDescriptor(val.GetType());
+
+ if (desc != null)
+ {
+ var metaHnd = _marsh.GetBinaryTypeHandler(desc);
+
+ _stream.WriteByte(BinaryUtils.TypeEnum);
+
+ BinaryUtils.WriteEnum(this, val);
+
+ SaveMetadata(desc, metaHnd.OnObjectWriteFinished());
+ }
+ else
+ {
+ // Unregistered enum, write as serializable
+ Write(new SerializableObjectHolder(val));
+ }
+ }
}
/// <summary>
@@ -817,10 +837,7 @@ namespace Apache.Ignite.Core.Impl.Binary
{
WriteFieldId(fieldName, BinaryUtils.TypeArrayEnum);
- if (val == null)
- WriteNullField();
- else
- WriteEnumArray0(val);
+ WriteEnumArray(val);
}
/// <summary>
@@ -830,24 +847,26 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Enum array.</param>
public void WriteEnumArray<T>(T[] val)
{
- if (val == null)
- WriteNullRawField();
- else
- WriteEnumArray0(val);
+ WriteEnumArrayInternal(val, null);
}
/// <summary>
/// Writes the enum array.
/// </summary>
/// <param name="val">The value.</param>
- private void WriteEnumArray0<T>(T[] val)
+ /// <param name="elementTypeId">The element type id.</param>
+ public void WriteEnumArrayInternal(Array val, int? elementTypeId)
{
- _stream.WriteByte(BinaryUtils.TypeArrayEnum);
+ if (val == null)
+ WriteNullField();
+ else
+ {
+ _stream.WriteByte(BinaryUtils.TypeArrayEnum);
- // typeof(T) can yield wrong results (string[] is object[], for example)
- var elementType = val.GetType().GetElementType();
+ var elTypeId = elementTypeId ?? BinaryUtils.GetEnumTypeId(val.GetType().GetElementType(), Marshaller);
- BinaryUtils.WriteArray(val, this, BinaryUtils.GetEnumTypeId(elementType, Marshaller));
+ BinaryUtils.WriteArray(val, this, elTypeId);
+ }
}
/// <summary>
@@ -1051,12 +1070,20 @@ namespace Apache.Ignite.Core.Impl.Binary
return;
}
+ // Handle enums.
+ if (type.IsEnum)
+ {
+ WriteEnum(obj);
+
+ return;
+ }
+
// Handle special case for builder.
if (WriteBuilderSpecials(obj))
return;
// Suppose that we faced normal object and perform descriptor lookup.
- IBinaryTypeDescriptor desc = type.IsEnum ? null : _marsh.GetDescriptor(type);
+ IBinaryTypeDescriptor desc = _marsh.GetDescriptor(type);
if (desc != null)
{
@@ -1356,9 +1383,9 @@ namespace Apache.Ignite.Core.Impl.Binary
/// Gets collected metadatas.
/// </summary>
/// <returns>Collected metadatas (if any).</returns>
- internal IDictionary<int, IBinaryType> GetBinaryTypes()
+ internal ICollection<BinaryType> GetBinaryTypes()
{
- return _metas;
+ return _metas == null ? null : _metas.Values;
}
/// <summary>
@@ -1399,37 +1426,38 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <summary>
/// Saves metadata for this session.
/// </summary>
- /// <param name="typeId">Type ID.</param>
- /// <param name="typeName">Type name.</param>
- /// <param name="affKeyFieldName">Affinity key field name.</param>
+ /// <param name="desc">The descriptor.</param>
/// <param name="fields">Fields metadata.</param>
- internal void SaveMetadata(int typeId, string typeName, string affKeyFieldName, IDictionary<string, int> fields)
+ internal void SaveMetadata(IBinaryTypeDescriptor desc, IDictionary<string, int> fields)
{
+ Debug.Assert(desc != null);
+
if (_metas == null)
{
- BinaryType meta =
- new BinaryType(typeId, typeName, fields, affKeyFieldName);
-
- _metas = new Dictionary<int, IBinaryType>(1);
-
- _metas[typeId] = meta;
+ _metas = new Dictionary<int, BinaryType>(1)
+ {
+ {desc.TypeId, new BinaryType(desc, fields)}
+ };
}
else
{
- IBinaryType meta;
+ BinaryType meta;
- if (_metas.TryGetValue(typeId, out meta))
+ if (_metas.TryGetValue(desc.TypeId, out meta))
{
- IDictionary<string, int> existingFields = ((BinaryType)meta).FieldsMap();
-
- foreach (KeyValuePair<string, int> field in fields)
+ if (fields != null)
{
- if (!existingFields.ContainsKey(field.Key))
- existingFields[field.Key] = field.Value;
+ IDictionary<string, int> existingFields = meta.GetFieldsMap();
+
+ foreach (KeyValuePair<string, int> field in fields)
+ {
+ if (!existingFields.ContainsKey(field.Key))
+ existingFields[field.Key] = field.Value;
+ }
}
}
else
- _metas[typeId] = new BinaryType(typeId, typeName, fields, affKeyFieldName);
+ _metas[desc.TypeId] = new BinaryType(desc, fields);
}
}
}
[46/50] [abbrv] ignite git commit: Package-info files.
Posted by ra...@apache.org.
Package-info files.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dc14cccd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dc14cccd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dc14cccd
Branch: refs/heads/master
Commit: dc14cccd9b66b44ecdd426234895eb19006ed293
Parents: 346733f
Author: Anton Vinogradov <av...@apache.org>
Authored: Mon Nov 30 14:32:29 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Mon Nov 30 14:32:29 2015 +0300
----------------------------------------------------------------------
.../ignite/cache/store/spring/package-info.java | 21 ++++++++++++++++++++
.../discovery/tcp/ipfinder/zk/package-info.java | 21 ++++++++++++++++++++
2 files changed, 42 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/dc14cccd/modules/spring/src/main/java/org/apache/ignite/cache/store/spring/package-info.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/main/java/org/apache/ignite/cache/store/spring/package-info.java b/modules/spring/src/main/java/org/apache/ignite/cache/store/spring/package-info.java
new file mode 100644
index 0000000..2ccce9e
--- /dev/null
+++ b/modules/spring/src/main/java/org/apache/ignite/cache/store/spring/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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 cache store session listener based on Spring transaction management.
+ */
+package org.apache.ignite.cache.store.spring;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/dc14cccd/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/package-info.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/package-info.java b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/package-info.java
new file mode 100644
index 0000000..7263710
--- /dev/null
+++ b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/zk/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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 TCP Discovery IP Finder uses Apache ZooKeeper (ZK) to locate peer nodes.
+ */
+package org.apache.ignite.spi.discovery.tcp.ipfinder.zk;
\ No newline at end of file
[28/50] [abbrv] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.5' into ignite-1.5
Posted by ra...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6312737a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6312737a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6312737a
Branch: refs/heads/master
Commit: 6312737a72b95efb417019ea13f9a811b9f3adf4
Parents: 9b01be3 56aeea3
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 16:54:42 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 16:54:42 2015 +0300
----------------------------------------------------------------------
.../hibernate/CacheHibernatePersonStore.java | 4 +-
.../hibernate/CacheHibernateStoreExample.java | 2 +-
.../datagrid/store/hibernate/Person.hbm.xml | 2 +-
.../apache/ignite/examples/binary/Address.java | 72 ---------
.../apache/ignite/examples/binary/Employee.java | 93 -----------
.../ignite/examples/binary/EmployeeKey.java | 93 -----------
.../ignite/examples/binary/Organization.java | 93 -----------
.../examples/binary/OrganizationType.java | 32 ----
...ComputeClientBinaryTaskExecutionExample.java | 4 +-
.../CacheClientBinaryPutGetExample.java | 6 +-
.../datagrid/CacheClientBinaryQueryExample.java | 22 +--
.../examples/datagrid/CacheQueryExample.java | 161 ++++---------------
.../ignite/examples/datagrid/store/Person.java | 154 ------------------
.../store/auto/CacheAutoStoreExample.java | 4 +-
.../auto/CacheAutoStoreLoadDataExample.java | 4 +-
.../datagrid/store/auto/CacheConfig.java | 6 +-
.../store/dummy/CacheDummyPersonStore.java | 12 +-
.../store/dummy/CacheDummyStoreExample.java | 4 +-
.../store/jdbc/CacheJdbcPersonStore.java | 18 +--
.../store/jdbc/CacheJdbcStoreExample.java | 4 +-
.../store/spring/CacheSpringPersonStore.java | 10 +-
.../store/spring/CacheSpringStoreExample.java | 4 +-
.../ignite/examples/model/Organization.java | 55 +++++++
.../apache/ignite/examples/model/Person.java | 120 ++++++++++++++
.../ignite/examples/model/binary/Address.java | 72 +++++++++
.../ignite/examples/model/binary/Employee.java | 93 +++++++++++
.../examples/model/binary/EmployeeKey.java | 93 +++++++++++
.../examples/model/binary/Organization.java | 93 +++++++++++
.../examples/model/binary/OrganizationType.java | 32 ++++
.../examples/ScalarCacheQueryExample.scala | 66 ++------
.../processors/query/h2/IgniteH2Indexing.java | 24 ++-
31 files changed, 667 insertions(+), 785 deletions(-)
----------------------------------------------------------------------
[19/50] [abbrv] ignite git commit: Fixed scalar examples
Posted by ra...@apache.org.
Fixed scalar examples
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9c46fa96
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9c46fa96
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9c46fa96
Branch: refs/heads/master
Commit: 9c46fa961bb88524fcd6c8ccb85c28f8688758b8
Parents: 91f3f87
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Fri Nov 27 14:12:43 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Nov 27 14:12:43 2015 +0300
----------------------------------------------------------------------
.../internal/portable/BinaryReaderExImpl.java | 2 +-
.../ignite/internal/portable/PortableUtils.java | 6 +--
.../processors/cache/CacheInvokeResult.java | 14 ++++++
.../dht/atomic/GridDhtAtomicCache.java | 50 ++++++++++++++++++--
.../cache/GridCacheAbstractFullApiSelfTest.java | 2 +-
5 files changed, 66 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9c46fa96/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
index 872d7a3..3cc2fbe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
@@ -1616,7 +1616,7 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Bina
break;
case OPTM_MARSH:
- obj = PortableUtils.doReadOptimized(in, ctx);
+ obj = PortableUtils.doReadOptimized(in, ctx, ldr);
break;
http://git-wip-us.apache.org/repos/asf/ignite/blob/9c46fa96/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
index e543c41..1a8f156 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
@@ -1498,13 +1498,13 @@ public class PortableUtils {
*
* @return Result.
*/
- public static Object doReadOptimized(PortableInputStream in, PortableContext ctx) {
+ public static Object doReadOptimized(PortableInputStream in, PortableContext ctx, @Nullable ClassLoader clsLdr) {
int len = in.readInt();
ByteArrayInputStream input = new ByteArrayInputStream(in.array(), in.position(), len);
try {
- return ctx.optimizedMarsh().unmarshal(input, null);
+ return ctx.optimizedMarsh().unmarshal(input, clsLdr);
}
catch (IgniteCheckedException e) {
throw new BinaryObjectException("Failed to unmarshal object with optimized marshaller", e);
@@ -1706,7 +1706,7 @@ public class PortableUtils {
return doReadClass(in, ctx, ldr);
case OPTM_MARSH:
- return doReadOptimized(in, ctx);
+ return doReadOptimized(in, ctx, ldr);
default:
throw new BinaryObjectException("Invalid flag value: " + flag);
http://git-wip-us.apache.org/repos/asf/ignite/blob/9c46fa96/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
index 8d6d905..48dabb9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
@@ -64,6 +64,20 @@ public class CacheInvokeResult<T> implements EntryProcessorResult<T>, Externaliz
}
/**
+ * @return Result.
+ */
+ public T result() {
+ return res;
+ }
+
+ /**
+ * Entry processor error;
+ */
+ public Exception error() {
+ return err;
+ }
+
+ /**
* Static constructor.
*
* @param err Exception thrown by {@link EntryProcessor#process(MutableEntry, Object...)}.
http://git-wip-us.apache.org/repos/asf/ignite/blob/9c46fa96/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index cd76a56..028f477 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -724,7 +724,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
/** {@inheritDoc} */
@Override public <T> EntryProcessorResult<T> invoke(K key, EntryProcessor<K, V, T> entryProcessor, Object... args)
throws IgniteCheckedException {
- EntryProcessorResult<T> res = invokeAsync(key, entryProcessor, args).get();
+ IgniteInternalFuture<EntryProcessorResult<T>> invokeFut = invokeAsync(key, entryProcessor, args);
+
+ EntryProcessorResult<T> res = invokeFut.get();
return res != null ? res : new CacheInvokeResult<T>();
}
@@ -750,6 +752,10 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
Map<? extends K, EntryProcessor> invokeMap =
Collections.singletonMap(key, (EntryProcessor)entryProcessor);
+ CacheOperationContext opCtx = ctx.operationContextPerCall();
+
+ final boolean keepBinary = opCtx != null && opCtx.isKeepBinary();
+
IgniteInternalFuture<Map<K, EntryProcessorResult<T>>> fut = updateAllAsync0(null,
invokeMap,
args,
@@ -768,7 +774,17 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
if (resMap != null) {
assert resMap.isEmpty() || resMap.size() == 1 : resMap.size();
- return resMap.isEmpty() ? null : resMap.values().iterator().next();
+ EntryProcessorResult<T> res = resMap.isEmpty() ? null : resMap.values().iterator().next();
+
+ if (res instanceof CacheInvokeResult) {
+ CacheInvokeResult invokeRes = (CacheInvokeResult)res;
+
+ if (invokeRes.result() != null)
+ res = CacheInvokeResult.fromResult((T)ctx.unwrapPortableIfNeeded(invokeRes.result(),
+ keepBinary));
+ }
+
+ return res;
}
return null;
@@ -792,7 +808,11 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
}
});
- return updateAllAsync0(null,
+ CacheOperationContext opCtx = ctx.operationContextPerCall();
+
+ final boolean keepBinary = opCtx != null && opCtx.isKeepBinary();
+
+ IgniteInternalFuture<Map<K, EntryProcessorResult<T>>> resFut = updateAllAsync0(null,
invokeMap,
args,
null,
@@ -801,6 +821,30 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
false,
null,
true);
+
+ return resFut.chain(new CX1<IgniteInternalFuture<Map<K, EntryProcessorResult<T>>>, Map<K, EntryProcessorResult<T>>>() {
+ @Override public Map<K, EntryProcessorResult<T>> applyx(IgniteInternalFuture<Map<K, EntryProcessorResult<T>>> fut) throws IgniteCheckedException {
+ Map<K, EntryProcessorResult<T>> resMap = fut.get();
+
+ if (resMap != null) {
+ return F.viewReadOnly(resMap, new C1<EntryProcessorResult<T>, EntryProcessorResult<T>>() {
+ @Override public EntryProcessorResult<T> apply(EntryProcessorResult<T> res) {
+ if (res instanceof CacheInvokeResult) {
+ CacheInvokeResult invokeRes = (CacheInvokeResult)res;
+
+ if (invokeRes.result() != null)
+ res = CacheInvokeResult.fromResult((T)ctx.unwrapPortableIfNeeded(invokeRes.result(),
+ keepBinary));
+ }
+
+ return res;
+ }
+ });
+ }
+
+ return null;
+ }
+ });
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/9c46fa96/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index c10f81a..084fe83 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -2408,7 +2408,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assert oldVal != null && F.eq(val1, oldVal);
- assert cache.remove("key1", val1);
+ assert cache.remove("key1");
assert cache.get("key1") == null;
[05/50] [abbrv] ignite git commit: IGNITE-529: Fixed README
Posted by ra...@apache.org.
IGNITE-529: Fixed README
Signed-off-by: Anton Vinogradov <av...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/60d9ddc0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/60d9ddc0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/60d9ddc0
Branch: refs/heads/master
Commit: 60d9ddc091d17fa2b246b0525b54d772345c3d11
Parents: e9f22ab
Author: shtykh_roman <rs...@yahoo.com>
Authored: Thu Nov 26 11:40:48 2015 +0900
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Nov 27 12:28:50 2015 +0300
----------------------------------------------------------------------
modules/flume/README.txt | 44 ++++++++++---------------------------------
1 file changed, 10 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/60d9ddc0/modules/flume/README.txt
----------------------------------------------------------------------
diff --git a/modules/flume/README.txt b/modules/flume/README.txt
index 5b574e3..bf7e0ff 100644
--- a/modules/flume/README.txt
+++ b/modules/flume/README.txt
@@ -1,42 +1,18 @@
-Apache Ignite Flume Streamer Module
-------------------------
+Apache Ignite Flume Sink Module
+-------------------------------
-Apache Ignite Flume Streamer module provides streaming from Flume to Ignite cache.
-
-To enable Flume Streamer module when starting a standalone node, move 'optional/ignite-Flume' folder to
-'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will
-be added to classpath in this case.
-
-Importing Ignite Flume Streamer Module In Maven Project
--------------------------------------
-
-If you are using Maven to manage dependencies of your project, you can add JCL module
-dependency like this (replace '${ignite.version}' with actual Ignite version you are
-interested in):
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
- http://maven.apache.org/xsd/maven-4.0.0.xsd">
- ...
- <dependencies>
- ...
- <dependency>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-Flume</artifactId>
- <version>${ignite.version}</version>
- </dependency>
- ...
- </dependencies>
- ...
-</project>
+IgniteSink is a Flume sink that extracts Events from an associated Flume channel and injects into an Ignite cache.
+Flume 1.6.0 is supported.
+IgniteSink, which can be found in 'optional/ignite-flume', and its dependencies have to be included in the agent's classpath,
+as described in the following subsection, before starting the Flume agent.
## Setting up and running
1. Create a transformer by implementing EventTransformer interface.
-2. Build it and copy to ${FLUME_HOME}/plugins.d/ignite-sink/lib.
-3. Copy other Ignite-related jar files to ${FLUME_HOME}/plugins.d/ignite-sink/libext to have them as shown below.
+2. Create 'ignite' directory inside plugins.d directory which is located in ${FLUME_HOME}. If the plugins.d directory is not there, create it.
+3. Build it and copy to ${FLUME_HOME}/plugins.d/ignite-sink/lib.
+4. Copy other Ignite-related jar files from Apache Ignite distribution to ${FLUME_HOME}/plugins.d/ignite-sink/libext to have them as shown below.
```
plugins.d/
@@ -46,7 +22,7 @@ plugins.d/
`-- libext
|-- cache-api-1.0.0.jar
|-- ignite-core-x.x.x.jar
- |-- ignite-flume-x.x.x.jar
+ |-- ignite-flume-x.x.x.jar <-- IgniteSink
|-- ignite-spring-x.x.x.jar
|-- spring-aop-4.1.0.RELEASE.jar
|-- spring-beans-4.1.0.RELEASE.jar
[34/50] [abbrv] ignite git commit: Fixed
GridSessionCheckpointSelfTest.
Posted by ra...@apache.org.
Fixed GridSessionCheckpointSelfTest.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a2cdc73a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a2cdc73a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a2cdc73a
Branch: refs/heads/master
Commit: a2cdc73afd54e02c86ede0d6e81ed280d4b0aff0
Parents: 6a95f88
Author: Tikhonov Nikolay <ti...@gmail.com>
Authored: Fri Nov 27 20:07:59 2015 +0300
Committer: Tikhonov Nikolay <ti...@gmail.com>
Committed: Fri Nov 27 22:33:02 2015 +0300
----------------------------------------------------------------------
.../ignite/testframework/junits/IgniteTestResources.java | 11 +++++++++++
1 file changed, 11 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a2cdc73a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java
index 406318f..970002d 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteTestResources.java
@@ -26,7 +26,12 @@ import java.util.concurrent.ThreadPoolExecutor;
import javax.management.MBeanServer;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.portable.BinaryCachingMetadataHandler;
+import org.apache.ignite.internal.portable.BinaryMarshaller;
+import org.apache.ignite.internal.portable.PortableContext;
import org.apache.ignite.internal.processors.resource.GridResourceProcessor;
+import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.marshaller.MarshallerContextTestImpl;
@@ -258,6 +263,12 @@ public class IgniteTestResources {
marsh.setContext(new MarshallerContextTestImpl());
+ if (marsh instanceof BinaryMarshaller) {
+ PortableContext ctx = new PortableContext(BinaryCachingMetadataHandler.create(), new IgniteConfiguration());
+
+ IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setPortableContext", ctx, new IgniteConfiguration());
+ }
+
return marsh;
}
}
\ No newline at end of file
[18/50] [abbrv] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.5' into ignite-1.5
Posted by ra...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/91f3f875
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/91f3f875
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/91f3f875
Branch: refs/heads/master
Commit: 91f3f87524acb278726e6d6f1e27d4cfdc56a15a
Parents: 2806393 857c63e
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Nov 27 13:21:59 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Nov 27 13:21:59 2015 +0300
----------------------------------------------------------------------
...gniteAtomicLongChangingTopologySelfTest.java | 8 +-
modules/jms11/licenses/apache-2.0.txt | 202 +++++++++++++++++++
modules/kafka/README.txt | 32 +++
modules/mqtt/licenses/apache-2.0.txt | 202 +++++++++++++++++++
modules/zookeeper/licenses/apache-2.0.txt | 202 +++++++++++++++++++
5 files changed, 645 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[06/50] [abbrv] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.5' into ignite-1.5
Posted by ra...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/30c9b8db
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/30c9b8db
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/30c9b8db
Branch: refs/heads/master
Commit: 30c9b8dbdff3f635525c4d8a3d6442ef2e87b754
Parents: 60d9ddc bde1d1d
Author: Anton Vinogradov <av...@apache.org>
Authored: Fri Nov 27 12:29:42 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Nov 27 12:29:42 2015 +0300
----------------------------------------------------------------------
modules/yarn/pom.xml | 6 +++---
.../ignite/yarn/IgniteApplicationMasterSelfTest.java | 11 +++++++++--
2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
[22/50] [abbrv] ignite git commit: Add README.txt for jms11,
mqtt and zookeeper modules.
Posted by ra...@apache.org.
Add README.txt for jms11, mqtt and zookeeper modules.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/722fe14a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/722fe14a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/722fe14a
Branch: refs/heads/master
Commit: 722fe14a6814a9cdbfea1cbfe53598ba5ed8ea8f
Parents: 95ab231
Author: Raul Kripalani <ra...@apache.org>
Authored: Fri Nov 27 11:54:32 2015 +0000
Committer: Raul Kripalani <ra...@apache.org>
Committed: Fri Nov 27 11:54:32 2015 +0000
----------------------------------------------------------------------
modules/jms11/README.txt | 29 +++++++++++++++++++++++++++++
modules/mqtt/README.txt | 29 +++++++++++++++++++++++++++++
modules/zookeeper/README.txt | 29 +++++++++++++++++++++++++++++
3 files changed, 87 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/722fe14a/modules/jms11/README.txt
----------------------------------------------------------------------
diff --git a/modules/jms11/README.txt b/modules/jms11/README.txt
new file mode 100644
index 0000000..3f0d213
--- /dev/null
+++ b/modules/jms11/README.txt
@@ -0,0 +1,29 @@
+Apache Ignite JMS 1.1 Module
+----------------------------
+
+Apache Ignite JMS 1.1 module provides a streamer to consume JMS queue and topic messages into
+Apache Ignite caches.
+
+Importing Apache Ignite JMS 1.1 Module In Maven Project
+--------------------------------------------------------
+
+If you are using Maven to manage dependencies of your project, you can add the JMS 1.1 module
+dependency like this (replace '${ignite.version}' with actual Ignite version you are
+interested in):
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ ...
+ <dependencies>
+ ...
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-jms11</artifactId>
+ <version>${ignite.version}</version>
+ </dependency>
+ ...
+ </dependencies>
+ ...
+</project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/722fe14a/modules/mqtt/README.txt
----------------------------------------------------------------------
diff --git a/modules/mqtt/README.txt b/modules/mqtt/README.txt
new file mode 100644
index 0000000..62a1589
--- /dev/null
+++ b/modules/mqtt/README.txt
@@ -0,0 +1,29 @@
+Apache Ignite MQTT Module
+-------------------------
+
+Apache Ignite MQTT module provides a streamer to consume MQTT topic messages into
+Apache Ignite caches.
+
+Importing Apache Ignite MQTT Module In Maven Project
+----------------------------------------------------
+
+If you are using Maven to manage dependencies of your project, you can add the MQTT module
+dependency like this (replace '${ignite.version}' with actual Ignite version you are
+interested in):
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ ...
+ <dependencies>
+ ...
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-mqtt</artifactId>
+ <version>${ignite.version}</version>
+ </dependency>
+ ...
+ </dependencies>
+ ...
+</project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/722fe14a/modules/zookeeper/README.txt
----------------------------------------------------------------------
diff --git a/modules/zookeeper/README.txt b/modules/zookeeper/README.txt
new file mode 100644
index 0000000..6d400ad
--- /dev/null
+++ b/modules/zookeeper/README.txt
@@ -0,0 +1,29 @@
+Apache Ignite ZooKeeper Module
+------------------------------
+
+Apache Ignite ZooKeeper module provides a TCP Discovery IP Finder that uses a ZooKeeper
+directory to locate other Ignite nodes to connect to.
+
+Importing Apache Ignite ZooKeeper Module In Maven Project
+---------------------------------------------------------
+
+If you are using Maven to manage dependencies of your project, you can add the ZooKeeper
+module dependency like this (replace '${ignite.version}' with actual Ignite version you
+are interested in):
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ ...
+ <dependencies>
+ ...
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-zookeeper</artifactId>
+ <version>${ignite.version}</version>
+ </dependency>
+ ...
+ </dependencies>
+ ...
+</project>
[30/50] [abbrv] ignite git commit: Fixing binary objects tests.
Posted by ra...@apache.org.
Fixing binary objects tests.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/292de51c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/292de51c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/292de51c
Branch: refs/heads/master
Commit: 292de51c75dfd696459ef6569ee49beb8e7b10ec
Parents: f3cb64e
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Fri Nov 27 18:34:56 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Nov 27 18:34:56 2015 +0300
----------------------------------------------------------------------
.../ignite/cache/CacheKeyConfiguration.java | 19 ++
.../internal/portable/BinaryObjectExImpl.java | 5 +-
.../portable/PortableClassDescriptor.java | 3 +-
.../processors/cache/CacheLazyEntry.java | 2 +-
.../processors/cache/GridCacheAdapter.java | 2 +-
.../processors/cache/GridCacheContext.java | 12 +-
.../dht/atomic/GridDhtAtomicCache.java | 4 +-
.../distributed/near/GridNearGetFuture.java | 4 +-
.../GridCacheInternalKeyImpl.java | 2 +-
.../portable/BinaryMarshallerSelfTest.java | 64 ++++++
...niteCacheCopyOnReadDisabledAbstractTest.java | 2 +
.../dht/GridCacheDhtInternalEntrySelfTest.java | 203 -------------------
.../near/GridCacheNearTxForceKeyTest.java | 2 +-
...achePartitionedPreloadLifecycleSelfTest.java | 71 ++++---
.../testsuites/IgniteCacheTestSuite2.java | 2 -
15 files changed, 147 insertions(+), 250 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java
index 767b44c..f117847 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheKeyConfiguration.java
@@ -18,6 +18,8 @@
package org.apache.ignite.cache;
import java.io.Serializable;
+import java.lang.reflect.Field;
+import org.apache.ignite.cache.affinity.AffinityKeyMapped;
import org.apache.ignite.internal.util.typedef.internal.S;
/**
@@ -41,6 +43,23 @@ public class CacheKeyConfiguration implements Serializable {
}
/**
+ * @param keyCls Key class.
+ */
+ public CacheKeyConfiguration(Class keyCls) {
+ typeName = keyCls.getName();
+
+ for (; keyCls != Object.class && keyCls != null; keyCls = keyCls.getSuperclass()) {
+ for (Field f : keyCls.getDeclaredFields()) {
+ if (f.getAnnotation(AffinityKeyMapped.class) != null) {
+ affKeyFieldName = f.getName();
+
+ return;
+ }
+ }
+ }
+ }
+
+ /**
* Creates cache key configuration with given type name and affinity field name.
*
* @param typeName Type name.
http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java
index 2ea71ec..a32329a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java
@@ -164,6 +164,7 @@ public abstract class BinaryObjectExImpl implements BinaryObjectEx {
*/
private String toString(BinaryReaderHandles ctx, IdentityHashMap<BinaryObject, Integer> handles) {
int idHash = System.identityHashCode(this);
+ int hash = hashCode();
BinaryType meta;
@@ -175,14 +176,14 @@ public abstract class BinaryObjectExImpl implements BinaryObjectEx {
}
if (meta == null)
- return BinaryObject.class.getSimpleName() + " [hash=" + idHash + ", typeId=" + typeId() + ']';
+ return BinaryObject.class.getSimpleName() + " [idHash=" + idHash + ", hash=" + hash + ", typeId=" + typeId() + ']';
handles.put(this, idHash);
SB buf = new SB(meta.typeName());
if (meta.fieldNames() != null) {
- buf.a(" [hash=").a(idHash);
+ buf.a(" [idHash=").a(idHash).a(", hash=").a(hash);
for (String name : meta.fieldNames()) {
Object val = field(ctx, name);
http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
index dba15f5..984f7c9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
@@ -249,7 +249,8 @@ public class PortableClassDescriptor {
String name = f.getName();
if (!names.add(name))
- throw new BinaryObjectException("Duplicate field name: " + name);
+ throw new BinaryObjectException("Duplicate field name [fieldName=" + name +
+ ", cls=" + cls.getName() + ']');
int fieldId = idMapper.fieldId(typeId, name);
http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java
index 47ad30c..2b9efa3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLazyEntry.java
@@ -103,7 +103,7 @@ public class CacheLazyEntry<K, V> implements Cache.Entry<K, V> {
/** {@inheritDoc} */
@Override public V getValue() {
if (val == null)
- val = (V)cctx.unwrapPortableIfNeeded(valObj, keepPortable);
+ val = (V)cctx.unwrapPortableIfNeeded(valObj, keepPortable, false);
return val;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 00f65f9..b5b8690 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -799,7 +799,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
else
cacheVal = localCachePeek0(cacheKey, modes.heap, modes.offheap, modes.swap, plc);
- Object val = ctx.unwrapPortableIfNeeded(cacheVal, ctx.keepPortable());
+ Object val = ctx.unwrapPortableIfNeeded(cacheVal, ctx.keepPortable(), false);
return (V)val;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/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 73d966a..6e5f958 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
@@ -1743,12 +1743,22 @@ public class GridCacheContext<K, V> implements Externalizable {
* @param keepPortable Keep portable flag.
* @return Unwrapped object.
*/
- @SuppressWarnings("IfMayBeConditional")
public Object unwrapPortableIfNeeded(Object o, boolean keepPortable) {
return cacheObjCtx.unwrapPortableIfNeeded(o, keepPortable);
}
/**
+ * Unwraps object for binary.
+ *
+ * @param o Object to unwrap.
+ * @param keepPortable Keep portable flag.
+ * @return Unwrapped object.
+ */
+ public Object unwrapPortableIfNeeded(Object o, boolean keepPortable, boolean cpy) {
+ return cacheObjCtx.unwrapPortableIfNeeded(o, keepPortable, cpy);
+ }
+
+ /**
* @return Cache object context.
*/
public CacheObjectContext cacheObjectContext() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 028f477..8fe1b3a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -781,7 +781,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
if (invokeRes.result() != null)
res = CacheInvokeResult.fromResult((T)ctx.unwrapPortableIfNeeded(invokeRes.result(),
- keepBinary));
+ keepBinary, false));
}
return res;
@@ -834,7 +834,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
if (invokeRes.result() != null)
res = CacheInvokeResult.fromResult((T)ctx.unwrapPortableIfNeeded(invokeRes.result(),
- keepBinary));
+ keepBinary, false));
}
return res;
http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/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 2ea31d5..3f61b2f 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
@@ -542,9 +542,9 @@ public final class GridNearGetFuture<K, V> extends CacheDistributedGetFutureAdap
add(new GridFinishedFuture<>(Collections.singletonMap(key0, val0)));
}
else {
- K key0 = (K)cctx.unwrapPortableIfNeeded(key, !deserializePortable);
+ K key0 = (K)cctx.unwrapPortableIfNeeded(key, !deserializePortable, false);
V val0 = !skipVals ?
- (V)cctx.unwrapPortableIfNeeded(v, !deserializePortable) :
+ (V)cctx.unwrapPortableIfNeeded(v, !deserializePortable, false) :
(V)Boolean.TRUE;
add(new GridFinishedFuture<>(Collections.singletonMap(key0, val0)));
http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java
index ff07754..6031f5e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java
@@ -34,6 +34,7 @@ public class GridCacheInternalKeyImpl implements GridCacheInternalKey, Externali
private static final long serialVersionUID = 0L;
/** Name of cache data structure. */
+ @AffinityKeyMapped
private String name;
/**
@@ -55,7 +56,6 @@ public class GridCacheInternalKeyImpl implements GridCacheInternalKey, Externali
}
/** {@inheritDoc} */
- @AffinityKeyMapped
@Override public String name() {
return name;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
index 9f7822c..ad0dcf2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
@@ -17,6 +17,10 @@
package org.apache.ignite.internal.portable;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import junit.framework.Assert;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.binary.BinaryIdMapper;
@@ -364,6 +368,23 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
/**
* @throws Exception If failed.
*/
+ public void testExternalizableHashCode() throws Exception {
+ SimpleExternalizable sim1 = new SimpleExternalizable("Simple");
+ SimpleExternalizable sim2 = new SimpleExternalizable("Simple");
+
+ BinaryMarshaller marsh = binaryMarshaller();
+
+ BinaryObjectImpl sim1Binary = marshal(sim1, marsh);
+ BinaryObjectImpl sim2Binary = marshal(sim2, marsh);
+
+ assertEquals(sim1.hashCode(), sim2.hashCode());
+ assertEquals(sim1.hashCode(), sim1Binary.hashCode());
+ assertEquals(sim2.hashCode(), sim2Binary.hashCode());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testMapEntry() throws Exception {
Map.Entry<Integer, String> e = new GridMapEntry<>(1, "str1");
@@ -3621,6 +3642,49 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
/**
*
*/
+ public static class SimpleExternalizable implements Externalizable {
+ /** */
+ private String field;
+
+ /**
+ * @param field Field.
+ */
+ public SimpleExternalizable(String field) {
+ this.field = field;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ U.writeString(out, field);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ field = U.readString(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ SimpleExternalizable that = (SimpleExternalizable)o;
+
+ return field.equals(that.field);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return field.hashCode();
+ }
+ }
+
+ /**
+ *
+ */
private static class ParentPortable {
/** */
public String s;
http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java
index 1c08c0e..a3b362b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java
@@ -57,6 +57,8 @@ public abstract class IgniteCacheCopyOnReadDisabledAbstractTest extends GridCach
TestValue val0 = cache.get(key);
+ assertSame(val0, cache.get(key));
+
assertNotSame(val, val0); // Original user value is always copied.
assertSame(val0, cache.localPeek(key));
http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtInternalEntrySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtInternalEntrySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtInternalEntrySelfTest.java
deleted file mode 100644
index 0f4fe5d..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtInternalEntrySelfTest.java
+++ /dev/null
@@ -1,203 +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.distributed.dht;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import org.apache.ignite.cache.CachePeekMode;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.cache.affinity.Affinity;
-import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheAlwaysEvictionPolicy;
-import org.apache.ignite.internal.processors.datastructures.GridCacheInternalKeyImpl;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
-
-/**
- * Tests for internal DHT entry.
- */
-public class GridCacheDhtInternalEntrySelfTest extends GridCommonAbstractTest {
- /** IP finder. */
- private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
- /** Grid count. */
- private static final int GRID_CNT = 2;
-
- /** Atomic long name. */
- private static final String ATOMIC_LONG_NAME = "test.atomic.long";
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- TcpDiscoverySpi spi = new TcpDiscoverySpi();
-
- spi.setIpFinder(IP_FINDER);
-
- cfg.setDiscoverySpi(spi);
-
- CacheConfiguration cacheCfg = defaultCacheConfiguration();
-
- cacheCfg.setCacheMode(PARTITIONED);
- cacheCfg.setRebalanceMode(SYNC);
- cacheCfg.setAffinity(new RendezvousAffinityFunction(false, 2));
- cacheCfg.setBackups(0);
- cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
-
- NearCacheConfiguration nearCfg = new NearCacheConfiguration();
- nearCfg.setNearEvictionPolicy(new GridCacheAlwaysEvictionPolicy());
- cacheCfg.setNearConfiguration(nearCfg);
-
- cacheCfg.setAtomicityMode(TRANSACTIONAL);
-
- cfg.setCacheConfiguration(cacheCfg);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGridsMultiThreaded(GRID_CNT);
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- stopAllGrids();
- }
-
- /** @throws Exception If failed. */
- public void testInternalKeyReaders() throws Exception {
- IgniteBiTuple<ClusterNode, ClusterNode> nodes = getNodes(ATOMIC_LONG_NAME);
-
- ClusterNode primary = nodes.get1();
- ClusterNode other = nodes.get2();
-
- // Create on non-primary node.
- grid(other).cache(null).put(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), 1);
-
- check(primary, other, true);
-
- // Update on primary.
- grid(primary).cache(null).put(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), 2);
-
- // Check on non-primary.
- assertEquals(2, grid(other).cache(null).get(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME)));
-
- check(primary, other, true);
-
- // Remove.
- assert grid(other).cache(null).remove(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME));
-
- check(primary, other, false);
- }
-
- /**
- * @param primary Primary node.
- * @param other Non-primary node.
- * @param exists Whether entry is expected to exist.
- * @throws Exception In case of error.
- */
- private void check(ClusterNode primary, ClusterNode other, boolean exists) throws Exception {
- if (exists) {
- // Check primary node has entry in DHT cache.
- assert peekNear(primary) == null;
- assert peekDht(primary) != null;
-
- // Check non-primary node has entry in near cache.
- assert peekNear(other) != null;
- assert peekDht(other) == null;
-
- // Check primary node has reader for non-primary node.
- assert peekDhtEntry(primary).readers().contains(other.id());
- }
- else {
- assert peekGlobal(primary) == null;
- assert peekGlobal(other) == null;
- }
- }
-
- /**
- * @param node Node.
- * @return Atomic long value.
- */
- private Object peekGlobal(ClusterNode node) {
- return grid(node).cache(null).localPeek(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), CachePeekMode.ONHEAP);
- }
-
- /**
- * @param node Node.
- * @return Atomic long value.
- */
- private Object peekNear(ClusterNode node) {
- return grid(node).cache(null).localPeek(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), CachePeekMode.NEAR);
- }
-
- /**
- * @param node Node.
- * @return Atomic long value.
- */
- private Object peekDht(ClusterNode node) {
- return grid(node).cache(null).localPeek(new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME), CachePeekMode.BACKUP,
- CachePeekMode.PRIMARY);
- }
-
- /**
- * @param node Node.
- * @return DHT entry.
- */
- private GridDhtCacheEntry peekDhtEntry(ClusterNode node) {
- return (GridDhtCacheEntry)dht(grid(node).cache(null)).peekEx(
- new GridCacheInternalKeyImpl(ATOMIC_LONG_NAME));
- }
-
- /**
- * @param key Key.
- * @return Pair {primary node, some other node}.
- */
- private IgniteBiTuple<ClusterNode, ClusterNode> getNodes(String key) {
- Affinity<Object> aff = grid(0).affinity(null);
-
- ClusterNode primary = aff.mapKeyToNode(key);
-
- assert primary != null;
-
- Collection<ClusterNode> nodes = new ArrayList<>(grid(0).cluster().nodes());
-
- nodes.remove(primary);
-
- ClusterNode other = F.first(nodes);
-
- assert other != null;
-
- assert !F.eqNodes(primary, other);
-
- return F.t(primary, other);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java
index 348597e..84886d3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java
@@ -70,7 +70,7 @@ public class GridCacheNearTxForceKeyTest extends GridCommonAbstractTest {
Ignite ignite1 = startGrid(1);
- final Integer key = 2;
+ final Integer key = primaryKey(ignite1.cache(null));
assertNull(cache.getAndPut(key, key));
http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
index ca4f24e..e434b49 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java
@@ -182,39 +182,7 @@ public class GridCachePartitionedPreloadLifecycleSelfTest extends GridCachePrelo
CacheQuery<Map.Entry<Object, MyValue>> qry = c2.context().queries().createScanQuery(null, null, false);
- int totalCnt = F.sumInt(qry.execute(new IgniteReducer<Map.Entry<Object, MyValue>, Integer>() {
- @IgniteInstanceResource
- private Ignite grid;
-
- private int cnt;
-
- @Override public boolean collect(Map.Entry<Object, MyValue> e) {
- Object key = e.getKey();
-
- assertNotNull(e.getValue());
-
- try {
- Object v1 = e.getValue();
- Object v2 = grid.cache("one").get(key);
-
- assertNotNull(v2);
- assertEquals(v1, v2);
- }
- catch (CacheException e1) {
- e1.printStackTrace();
-
- assert false;
- }
-
- cnt++;
-
- return true;
- }
-
- @Override public Integer reduce() {
- return cnt;
- }
- }).get());
+ int totalCnt = F.sumInt(qry.execute(new EntryIntegerIgniteReducer()).get());
info("Total entry count [grid=" + j + ", totalCnt=" + totalCnt + ']');
@@ -278,4 +246,41 @@ public class GridCachePartitionedPreloadLifecycleSelfTest extends GridCachePrelo
public void testScanQuery4() throws Exception {
checkScanQuery(keys(false, 500));
}
+
+ /**
+ *
+ */
+ private static class EntryIntegerIgniteReducer implements IgniteReducer<Map.Entry<Object, MyValue>, Integer> {
+ @IgniteInstanceResource
+ private Ignite grid;
+
+ private int cnt;
+
+ @Override public boolean collect(Map.Entry<Object, MyValue> e) {
+ Object key = e.getKey();
+
+ assertNotNull(e.getValue());
+
+ try {
+ Object v1 = e.getValue();
+ Object v2 = grid.cache("one").get(key);
+
+ assertNotNull(v2);
+ assertEquals(v1, v2);
+ }
+ catch (CacheException e1) {
+ e1.printStackTrace();
+
+ assert false;
+ }
+
+ cnt++;
+
+ return true;
+ }
+
+ @Override public Integer reduce() {
+ return cnt;
+ }
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/292de51c/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
index 5138dac..74b688f 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
@@ -53,7 +53,6 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtE
import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtEvictionSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtEvictionsDisabledSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtExpiredEntriesPreloadSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtInternalEntrySelfTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtMappingSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtPreloadBigDataSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtPreloadDelayedSelfTest;
@@ -188,7 +187,6 @@ public class IgniteCacheTestSuite2 extends TestSuite {
suite.addTest(new TestSuite(GridCachePartitionedTxTimeoutSelfTest.class));
suite.addTest(new TestSuite(GridCacheFinishPartitionsSelfTest.class));
suite.addTest(new TestSuite(GridCacheDhtEntrySelfTest.class));
- suite.addTest(new TestSuite(GridCacheDhtInternalEntrySelfTest.class));
suite.addTest(new TestSuite(GridCacheDhtMappingSelfTest.class));
suite.addTest(new TestSuite(GridCachePartitionedTxMultiThreadedSelfTest.class));
suite.addTest(new TestSuite(GridCachePartitionedNearDisabledTxMultiThreadedSelfTest.class));
[47/50] [abbrv] ignite git commit: ignite-1924
Posted by ra...@apache.org.
ignite-1924
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/eeb584d0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/eeb584d0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/eeb584d0
Branch: refs/heads/master
Commit: eeb584d070f72ab5457135ad15217316d75bba6a
Parents: dc14ccc
Author: Anton Vinogradov <av...@apache.org>
Authored: Mon Nov 30 14:49:29 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Mon Nov 30 14:49:29 2015 +0300
----------------------------------------------------------------------
.../spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/eeb584d0/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java
index fe84c67..12bd020 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteCacheSslStartStopSelfTest.java
@@ -27,12 +27,12 @@ import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
/**
*
*/
-//Can fail as described at https://issues.apache.org/jira/browse/IGNITE-1924
public class IgniteCacheSslStartStopSelfTest extends IgniteCachePutRetryAbstractSelfTest {
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
+ fail("https://issues.apache.org/jira/browse/IGNITE-1924");
cfg.setSslContextFactory(GridTestUtils.sslFactory());
return cfg;
[17/50] [abbrv] ignite git commit: IGNITE-2017: Added top-level
platforms readme.
Posted by ra...@apache.org.
IGNITE-2017: Added top-level platforms readme.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/28063931
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/28063931
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/28063931
Branch: refs/heads/master
Commit: 280639319757723bf9f273546b7c0d2b79575d40
Parents: e1db30a
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Nov 27 13:21:40 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Nov 27 13:21:40 2015 +0300
----------------------------------------------------------------------
assembly/release-fabric-base.xml | 9 +++++++++
modules/platforms/README.txt | 6 ++++++
2 files changed, 15 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/28063931/assembly/release-fabric-base.xml
----------------------------------------------------------------------
diff --git a/assembly/release-fabric-base.xml b/assembly/release-fabric-base.xml
index d3e75ba..65903ee 100644
--- a/assembly/release-fabric-base.xml
+++ b/assembly/release-fabric-base.xml
@@ -69,6 +69,15 @@
</files>
<fileSets>
+ <!-- Move platforms readme. -->
+ <fileSet>
+ <directory>modules/platforms</directory>
+ <outputDirectory>/platforms</outputDirectory>
+ <includes>
+ <include>README.txt</include>
+ </includes>
+ </fileSet>
+
<!-- Move .Net readme. -->
<fileSet>
<directory>modules/platforms/dotnet</directory>
http://git-wip-us.apache.org/repos/asf/ignite/blob/28063931/modules/platforms/README.txt
----------------------------------------------------------------------
diff --git a/modules/platforms/README.txt b/modules/platforms/README.txt
new file mode 100644
index 0000000..6268a88
--- /dev/null
+++ b/modules/platforms/README.txt
@@ -0,0 +1,6 @@
+Apache Ignite Platforms
+==================================
+
+Contains integrations with other platforms, most notably:
+ * Apache Ignite.NET
+ * Apache Ignite C++
\ No newline at end of file
[02/50] [abbrv] ignite git commit: fixing cache iteration small
refactoring
Posted by ra...@apache.org.
fixing cache iteration
small refactoring
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a8edb1ed
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a8edb1ed
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a8edb1ed
Branch: refs/heads/master
Commit: a8edb1ed042b62fc160b497d2f4febb28abc686d
Parents: de08cd5
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Fri Nov 27 11:33:51 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Nov 27 11:33:51 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheAdapter.java | 67 +++++---------------
.../cache/GridCacheConcurrentMap.java | 52 +++++----------
.../distributed/dht/GridNoStorageCacheMap.java | 4 +-
.../distributed/near/GridNearCacheAdapter.java | 4 +-
.../cache/GridCacheConcurrentMapSelfTest.java | 2 +-
5 files changed, 37 insertions(+), 92 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a8edb1ed/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index c7467b2..00f65f9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -296,7 +296,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
*/
@SuppressWarnings("OverriddenMethodCallDuringObjectConstruction")
protected GridCacheAdapter(GridCacheContext<K, V> ctx, int startSize) {
- this(ctx, new GridCacheConcurrentMap(ctx, startSize, 0.75F, null));
+ this(ctx, new GridCacheConcurrentMap(ctx, startSize, null));
}
/**
@@ -925,60 +925,25 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
*/
@Nullable private GridCacheEntryEx entry0(KeyCacheObject key, AffinityTopologyVersion topVer, boolean create,
boolean touch) {
- GridCacheMapEntry cur = map.getEntry(key);
+ GridTriple<GridCacheMapEntry> t = map.putEntryIfObsoleteOrAbsent(topVer, key, null, create);
- if (cur == null || cur.obsolete()) {
- GridTriple<GridCacheMapEntry> t = map.putEntryIfObsoleteOrAbsent(
- topVer,
- key,
- null,
- create);
+ GridCacheEntryEx cur = t.get1();
+ GridCacheEntryEx created = t.get2();
+ GridCacheEntryEx doomed = t.get3();
- cur = t.get1();
+ if (doomed != null && ctx.events().isRecordable(EVT_CACHE_ENTRY_DESTROYED))
+ // Event notification.
+ ctx.events().addEvent(doomed.partition(), doomed.key(), locNodeId, (IgniteUuid)null, null,
+ EVT_CACHE_ENTRY_DESTROYED, null, false, null, false, null, null, null, true);
- GridCacheEntryEx created = t.get2();
- GridCacheEntryEx doomed = t.get3();
+ if (created != null) {
+ // Event notification.
+ if (ctx.events().isRecordable(EVT_CACHE_ENTRY_CREATED))
+ ctx.events().addEvent(created.partition(), created.key(), locNodeId, (IgniteUuid)null, null,
+ EVT_CACHE_ENTRY_CREATED, null, false, null, false, null, null, null, true);
- if (doomed != null && ctx.events().isRecordable(EVT_CACHE_ENTRY_DESTROYED))
- // Event notification.
- ctx.events().addEvent(doomed.partition(),
- doomed.key(),
- locNodeId,
- (IgniteUuid)null,
- null,
- EVT_CACHE_ENTRY_DESTROYED,
- null,
- false,
- null,
- false,
- null,
- null,
- null,
- true);
-
- if (created != null) {
- // Event notification.
- if (ctx.events().isRecordable(EVT_CACHE_ENTRY_CREATED))
- ctx.events().addEvent(created.partition(),
- created.key(),
- locNodeId,
- (IgniteUuid)null,
- null,
- EVT_CACHE_ENTRY_CREATED,
- null,
- false,
- null,
- false,
- null,
- null,
- null,
- true);
-
- if (touch)
- ctx.evicts().touch(
- cur,
- topVer);
- }
+ if (touch)
+ ctx.evicts().touch(cur, topVer);
}
return cur;
http://git-wip-us.apache.org/repos/asf/ignite/blob/a8edb1ed/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
index 8293044..1c64387 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
@@ -237,6 +237,7 @@ public class GridCacheConcurrentMap {
* @param ctx Cache context.
* @param initCap the initial capacity. The implementation
* performs internal sizing to accommodate this many elements.
+ * @param factory Entry factory.
* @param loadFactor the load factor threshold, used to control resizing.
* Resizing may be performed when the average number of elements per
* bin exceeds this threshold.
@@ -248,8 +249,13 @@ public class GridCacheConcurrentMap {
* non-positive.
*/
@SuppressWarnings({"unchecked"})
- protected GridCacheConcurrentMap(GridCacheContext ctx, int initCap, float loadFactor,
- int concurrencyLevel) {
+ protected GridCacheConcurrentMap(
+ GridCacheContext ctx,
+ int initCap,
+ GridCacheMapEntryFactory factory,
+ float loadFactor,
+ int concurrencyLevel
+ ) {
this.ctx = ctx;
if (!(loadFactor > 0) || initCap < 0 || concurrencyLevel <= 0)
@@ -289,6 +295,8 @@ public class GridCacheConcurrentMap {
for (int i = 0; i < segs.length; ++i)
segs[i] = new Segment(cap, loadFactor);
+
+ this.factory = factory;
}
/**
@@ -298,20 +306,16 @@ public class GridCacheConcurrentMap {
* @param ctx Cache context.
* @param initCap The implementation performs internal
* sizing to accommodate this many elements.
- * @param loadFactor the load factor threshold, used to control resizing.
- * Resizing may be performed when the average number of elements per
- * bin exceeds this threshold.
* @param factory Entries factory.
* @throws IllegalArgumentException if the initial capacity of
* elements is negative or the load factor is non-positive.
*/
- public GridCacheConcurrentMap(GridCacheContext ctx,
+ public GridCacheConcurrentMap(
+ GridCacheContext ctx,
int initCap,
- float loadFactor,
- @Nullable GridCacheMapEntryFactory factory) {
- this(ctx, initCap, loadFactor, DFLT_CONCUR_LEVEL);
-
- this.factory = factory;
+ @Nullable GridCacheMapEntryFactory factory
+ ) {
+ this(ctx, initCap, factory, DFLT_LOAD_FACTOR, DFLT_CONCUR_LEVEL);
}
/**
@@ -1425,13 +1429,6 @@ public class GridCacheConcurrentMap {
}
/**
- * @return Number of reads.
- */
- long reads() {
- return reads.sum();
- }
-
- /**
* @return Header ID.
*/
int id() {
@@ -1439,21 +1436,6 @@ public class GridCacheConcurrentMap {
}
/**
- * @return {@code True} if {@code ID} is even.
- */
- boolean even() {
- return id % 2 == 0;
- }
-
- /**
- * @return {@code True} if {@code ID} is odd.
- */
- @SuppressWarnings("BadOddness")
- boolean odd() {
- return id % 2 == 1;
- }
-
- /**
* @return Table.
*/
GridCacheMapEntry[] table() {
@@ -2108,9 +2090,7 @@ public class GridCacheConcurrentMap {
it.next();
// Cached value.
- V val = it.currentValue();
-
- return val;
+ return it.currentValue();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/a8edb1ed/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
index ef6612b..c6b969d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNoStorageCacheMap.java
@@ -41,7 +41,7 @@ public class GridNoStorageCacheMap extends GridCacheConcurrentMap {
* @param ctx Cache context.
*/
public GridNoStorageCacheMap(GridCacheContext ctx) {
- super(ctx, 0, 0.75f, 1);
+ super(ctx, 0, null, 0.75f, 1);
}
/** {@inheritDoc} */
@@ -119,4 +119,4 @@ public class GridNoStorageCacheMap extends GridCacheConcurrentMap {
@Override public String toString() {
return S.toString(GridNoStorageCacheMap.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a8edb1ed/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index b471486..c92e4e8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -123,9 +123,9 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
/** {@inheritDoc} */
@Override public void onReconnected() {
- map = new GridCacheConcurrentMap(ctx,
+ map = new GridCacheConcurrentMap(
+ ctx,
ctx.config().getNearConfiguration().getNearStartSize(),
- 0.75F,
map.getEntryFactory());
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a8edb1ed/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
index 3381a34..1f494c0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
@@ -362,4 +362,4 @@ public class GridCacheConcurrentMapSelfTest extends GridCommonAbstractTest {
assertEquals(0, local().map.iteratorMapSize());
}
}
-}
\ No newline at end of file
+}
[37/50] [abbrv] ignite git commit: Use TcpDiscoveryVmIpFinder.
Posted by ra...@apache.org.
Use TcpDiscoveryVmIpFinder.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ee5d9fd8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ee5d9fd8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ee5d9fd8
Branch: refs/heads/master
Commit: ee5d9fd8beb3d6bf29ee2e932d4c1fe374e6dffc
Parents: 8a822d8
Author: sboikov <sb...@gridgain.com>
Authored: Sat Nov 28 15:01:57 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Sat Nov 28 15:01:57 2015 +0300
----------------------------------------------------------------------
.../GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java | 8 ++++++++
1 file changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee5d9fd8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java
index f1e427b..321194f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java
@@ -40,6 +40,9 @@ import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.binary.BinaryReader;
import org.apache.ignite.binary.BinaryTypeConfiguration;
import org.apache.ignite.binary.BinaryWriter;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jsr166.LongAdder8;
@@ -50,6 +53,9 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC
*/
public abstract class GridCacheBinaryObjectsAbstractMultiThreadedSelfTest extends GridCommonAbstractTest {
/** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
private static final int THREAD_CNT = 64;
/** */
@@ -59,6 +65,8 @@ public abstract class GridCacheBinaryObjectsAbstractMultiThreadedSelfTest extend
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
+
CacheConfiguration cacheCfg = new CacheConfiguration();
cacheCfg.setCacheMode(cacheMode());
[36/50] [abbrv] ignite git commit: Fixing binary objects tests.
Posted by ra...@apache.org.
Fixing binary objects tests.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/87cbc194
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/87cbc194
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/87cbc194
Branch: refs/heads/master
Commit: 87cbc1945343b2d0e4667362dba0514c831ca2b5
Parents: 8a822d8
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Sat Nov 28 14:07:29 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Sat Nov 28 14:07:29 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/examples/model/Organization.java | 7 +++++++
.../main/java/org/apache/ignite/examples/model/Person.java | 7 +++++++
.../main/java/org/apache/ignite/internal/IgniteKernal.java | 5 ++---
.../org/apache/ignite/internal/portable/BinaryMarshaller.java | 2 --
.../cache/IgniteCacheAbstractFieldsQuerySelfTest.java | 4 ++--
.../cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java | 5 -----
6 files changed, 18 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/87cbc194/examples/src/main/java/org/apache/ignite/examples/model/Organization.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/Organization.java b/examples/src/main/java/org/apache/ignite/examples/model/Organization.java
index 3881719..3dcaa44 100644
--- a/examples/src/main/java/org/apache/ignite/examples/model/Organization.java
+++ b/examples/src/main/java/org/apache/ignite/examples/model/Organization.java
@@ -38,6 +38,13 @@ public class Organization implements Serializable {
public String name;
/**
+ * Default empty constructor.
+ */
+ public Organization() {
+ // No-op.
+ }
+
+ /**
* Create organization.
*
* @param name Organization name.
http://git-wip-us.apache.org/repos/asf/ignite/blob/87cbc194/examples/src/main/java/org/apache/ignite/examples/model/Person.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/Person.java b/examples/src/main/java/org/apache/ignite/examples/model/Person.java
index 616cf6a..5ccda51 100644
--- a/examples/src/main/java/org/apache/ignite/examples/model/Person.java
+++ b/examples/src/main/java/org/apache/ignite/examples/model/Person.java
@@ -59,6 +59,13 @@ public class Person implements Serializable {
private transient AffinityKey<Long> key;
/**
+ * Default empty constructor.
+ */
+ public Person() {
+ // No-op.
+ }
+
+ /**
* Constructs person record.
*
* @param org Organization.
http://git-wip-us.apache.org/repos/asf/ignite/blob/87cbc194/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 68d48c9..05b1997 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
@@ -1192,9 +1192,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
if (cfg.getIncludeEventTypes() != null && cfg.getIncludeEventTypes().length != 0)
perf.add("Disable grid events (remove 'includeEventTypes' from configuration)");
- if (BinaryMarshaller.available() && !(cfg.getMarshaller() instanceof BinaryMarshaller))
- perf.add("Enable binary marshaller (set 'marshaller' to " +
- BinaryMarshaller.class.getSimpleName() + ')');
+ if (BinaryMarshaller.available() && (cfg.getMarshaller() != null || !(cfg.getMarshaller() instanceof BinaryMarshaller)))
+ perf.add("Use default binary marshaller (do not set 'marshaller' explicitly)");
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/87cbc194/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMarshaller.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMarshaller.java
index 759d802..bfaae74 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMarshaller.java
@@ -33,8 +33,6 @@ import sun.misc.Unsafe;
/**
* Implementation of {@link org.apache.ignite.marshaller.Marshaller} that lets to serialize and deserialize all objects
* in the binary format.
- * <p>
- * {@code PortableMarshaller} is tested only on Java HotSpot VM on other VMs it could yield unexpected results.
*/
public class BinaryMarshaller extends AbstractMarshaller {
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/87cbc194/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
index 1d21bdd..832f076 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
@@ -270,7 +270,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
fields = meta.fields("Organization");
assert fields != null;
- assert fields.size() == 4;
+ assertEquals("Fields: " + fields, 5, fields.size());
assert String.class.getName().equals(fields.get("_KEY"));
assert Organization.class.getName().equals(fields.get("_VAL"));
assert int.class.getName().equals(fields.get("ID"));
@@ -545,7 +545,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
int cnt = 0;
for (List<?> row : res) {
- assert row.size() == 9;
+ assertEquals(10, row.size());
if (cnt == 0) {
assert new AffinityKey<>("p1", "o1").equals(row.get(0));
http://git-wip-us.apache.org/repos/asf/ignite/blob/87cbc194/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java
index 6f8ca2d..411e363 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache;
import java.io.IOException;
import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import javax.cache.CacheException;
import org.apache.ignite.cache.query.ScanQuery;
import org.apache.ignite.cache.query.SqlQuery;
@@ -76,10 +75,6 @@ public class IgniteCacheP2pUnmarshallingQueryErrorTest extends IgniteCacheP2pUnm
private void readObject(ObjectInputStream is) throws IOException {
throw new IOException();
}
-
- private void writeObject(ObjectOutputStream os) throws IOException {
- throw new IOException();
- }
})).getAll();
assertTrue("Request unmarshalling failed, but error response was not sent.", portableMarshaller());
[35/50] [abbrv] ignite git commit: Fixed
GridCacheBinaryObjects*Test's.
Posted by ra...@apache.org.
Fixed GridCacheBinaryObjects*Test's.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8a822d81
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8a822d81
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8a822d81
Branch: refs/heads/master
Commit: 8a822d81adf3a903b84daf17a11e642309576528
Parents: a2cdc73
Author: Tikhonov Nikolay <ti...@gmail.com>
Authored: Fri Nov 27 22:30:06 2015 +0300
Committer: Tikhonov Nikolay <ti...@gmail.com>
Committed: Fri Nov 27 22:51:04 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/cache/CacheObjectContext.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8a822d81/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
index b99c99f..fe650f3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
@@ -220,6 +220,8 @@ import org.apache.ignite.internal.util.typedef.F;
private Collection<Object> unwrapPortables(ArrayList<Object> col, boolean keepPortable, boolean cpy) {
int size = col.size();
+ col = new ArrayList<>(col);
+
for (int i = 0; i < size; i++) {
Object o = col.get(i);
[42/50] [abbrv] ignite git commit: Fixed communication subsystem stop
notification.
Posted by ra...@apache.org.
Fixed communication subsystem stop notification.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/59f37266
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/59f37266
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/59f37266
Branch: refs/heads/master
Commit: 59f3726696ec47b52f68103aa8250d9f2015b49b
Parents: 3a6a463
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Sat Nov 28 18:46:51 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Sat Nov 28 18:46:51 2015 +0300
----------------------------------------------------------------------
.../managers/communication/GridIoManager.java | 88 +-------------------
.../distributed/dht/GridDhtTxPrepareFuture.java | 4 +-
.../cache/transactions/IgniteTxHandler.java | 4 +-
.../communication/tcp/TcpCommunicationSpi.java | 17 ++--
.../ignite/testframework/GridTestUtils.java | 61 +++++++++++++-
5 files changed, 76 insertions(+), 98 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/59f37266/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
index ea82d7f..a8557cc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
@@ -46,8 +46,6 @@ import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.GridTopic;
import org.apache.ignite.internal.IgniteComponentType;
import org.apache.ignite.internal.IgniteDeploymentCheckedException;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.IgnitionEx;
import org.apache.ignite.internal.direct.DirectMessageReader;
import org.apache.ignite.internal.direct.DirectMessageWriter;
import org.apache.ignite.internal.managers.GridManagerAdapter;
@@ -103,9 +101,6 @@ import static org.jsr166.ConcurrentLinkedHashMap.QueuePolicy.PER_SEGMENT_Q_OPTIM
* Grid communication manager.
*/
public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializable>> {
- /** */
- public static volatile boolean TURBO_DEBUG_MODE;
-
/** Empty array of message factories. */
public static final MessageFactory[] EMPTY = {};
@@ -775,7 +770,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
private void processRegularMessage(
final UUID nodeId,
final GridIoMessage msg,
- byte plc,
+ final byte plc,
final IgniteRunnable msgC
) throws IgniteCheckedException {
Runnable c = new Runnable() {
@@ -956,7 +951,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
if (msgC == null) {
// Message from local node can be processed in sync manner.
- assert locNodeId.equals(nodeId) || TURBO_DEBUG_MODE;
+ assert locNodeId.equals(nodeId);
unwindMessageSet(set, lsnr);
@@ -1089,85 +1084,6 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
}
/**
- * This method can be used for debugging tricky concurrency issues
- * with multi-nodes in single JVM.
- * <p>
- * This method eliminates network between nodes started in single JVM
- * when {@link #TURBO_DEBUG_MODE} is set to {@code true}.
- * <p>
- * How to use it:
- * <ol>
- * <li>Replace {@link #send(ClusterNode, Object, int, Message, byte, boolean, long, boolean, IgniteInClosure)}
- * with this method.</li>
- * <li>Start all grids for your test, then set {@link #TURBO_DEBUG_MODE} to {@code true}.</li>
- * <li>Perform test operations on the topology. No network will be there.</li>
- * <li>DO NOT turn on turbo debug before all grids started. This will cause deadlocks.</li>
- * </ol>
- *
- * @param node Destination node.
- * @param topic Topic to send the message to.
- * @param topicOrd GridTopic enumeration ordinal.
- * @param msg Message to send.
- * @param plc Type of processing.
- * @param ordered Ordered flag.
- * @param timeout Timeout.
- * @param skipOnTimeout Whether message can be skipped on timeout.
- * @throws IgniteCheckedException Thrown in case of any errors.
- */
- private void sendTurboDebug(
- ClusterNode node,
- Object topic,
- int topicOrd,
- Message msg,
- byte plc,
- boolean ordered,
- long timeout,
- boolean skipOnTimeout
- ) throws IgniteCheckedException {
- assert node != null;
- assert topic != null;
- assert msg != null;
-
- GridIoMessage ioMsg = new GridIoMessage(plc, topic, topicOrd, msg, ordered, timeout, skipOnTimeout);
-
- IgniteKernal rmt;
-
- if (locNodeId.equals(node.id())) {
- assert plc != P2P_POOL;
-
- CommunicationListener commLsnr = this.commLsnr;
-
- if (commLsnr == null)
- throw new IgniteCheckedException("Trying to send message when grid is not fully started.");
-
- if (ordered)
- processOrderedMessage(locNodeId, ioMsg, plc, null);
- else
- processRegularMessage0(ioMsg, locNodeId);
- }
- else if (TURBO_DEBUG_MODE && (rmt = IgnitionEx.gridxx(locNodeId)) != null) {
- if (ioMsg.isOrdered())
- rmt.context().io().processOrderedMessage(locNodeId, ioMsg, ioMsg.policy(), null);
- else
- rmt.context().io().processRegularMessage0(ioMsg, locNodeId);
- }
- else {
- if (topicOrd < 0)
- ioMsg.topicBytes(marsh.marshal(topic));
-
- try {
- getSpi().sendMessage(node, ioMsg);
- }
- catch (IgniteSpiException e) {
- throw new IgniteCheckedException("Failed to send message (node may have left the grid or " +
- "TCP connection cannot be established due to firewall issues) " +
- "[node=" + node + ", topic=" + topic +
- ", msg=" + msg + ", policy=" + plc + ']', e);
- }
- }
- }
-
- /**
* @param nodeId Id of destination node.
* @param topic Topic to send the message to.
* @param msg Message to send.
http://git-wip-us.apache.org/repos/asf/ignite/blob/59f37266/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 34addfa..9f1f8a1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -81,8 +81,6 @@ import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.events.EventType.EVT_CACHE_REBALANCE_OBJECT_LOADED;
-import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYSTEM_POOL;
-import static org.apache.ignite.internal.managers.communication.GridIoPolicy.UTILITY_CACHE_POOL;
import static org.apache.ignite.internal.processors.cache.GridCacheOperation.CREATE;
import static org.apache.ignite.internal.processors.cache.GridCacheOperation.DELETE;
import static org.apache.ignite.internal.processors.cache.GridCacheOperation.NOOP;
@@ -1208,7 +1206,7 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
assert req.transactionNodes() != null;
try {
- cctx.io().send(nearMapping.node(), req, tx.system() ? UTILITY_CACHE_POOL : SYSTEM_POOL);
+ cctx.io().send(nearMapping.node(), req, tx.ioPolicy());
}
catch (ClusterTopologyCheckedException e) {
fut.onNodeLeft(e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/59f37266/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index 61a9bed..91ebfd3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -842,7 +842,7 @@ public class IgniteTxHandler {
try {
// Reply back to sender.
- ctx.io().send(nodeId, res, req.system() ? UTILITY_CACHE_POOL : SYSTEM_POOL);
+ ctx.io().send(nodeId, res, req.policy());
}
catch (IgniteCheckedException e) {
if (e instanceof ClusterTopologyCheckedException) {
@@ -1060,7 +1060,7 @@ public class IgniteTxHandler {
}
try {
- ctx.io().send(nodeId, res, req.system() ? UTILITY_CACHE_POOL : SYSTEM_POOL);
+ ctx.io().send(nodeId, res, req.policy());
}
catch (Throwable e) {
// Double-check.
http://git-wip-us.apache.org/repos/asf/ignite/blob/59f37266/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 68e2f43..b2f0f65 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -838,6 +838,9 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
/** Context initialization latch. */
private final CountDownLatch ctxInitLatch = new CountDownLatch(1);
+ /** Stopping flag (set to {@code true} when SPI gets stopping signal). */
+ private volatile boolean stopping;
+
/** metrics listener. */
private final GridNioMetricsListener metricsLsnr = new GridNioMetricsListener() {
@Override public void onBytesSent(int bytesCnt) {
@@ -1794,6 +1797,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
/** {@inheritDoc} */
@Override protected void onContextDestroyed0() {
+ stopping = true;
+
if (ctxInitLatch.getCount() > 0)
// Safety.
ctxInitLatch.countDown();
@@ -1976,7 +1981,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
GridCommunicationClient client = clients.get(nodeId);
if (client == null) {
- if (isNodeStopping())
+ if (stopping)
throw new IgniteSpiException("Node is stopping.");
// Do not allow concurrent connects.
@@ -2311,8 +2316,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
U.closeQuiet(ch);
- throw new ClusterTopologyCheckedException("Failed to send message, " +
- "node left cluster: " + node);
+ throw new ClusterTopologyCheckedException("Failed to send message " +
+ "(node left topology): " + node);
}
long rcvCnt = -1;
@@ -2784,18 +2789,18 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
* @return Node ID message.
*/
private NodeIdMessage nodeIdMessage() {
- ClusterNode localNode = getLocalNode();
+ ClusterNode locNode = getLocalNode();
UUID id;
- if (localNode == null) {
+ if (locNode == null) {
U.warn(log, "Local node is not started or fully initialized [isStopping=" +
getSpiContext().isStopping() + ']');
id = new UUID(0, 0);
}
else
- id = localNode.id();
+ id = locNode.id();
return new NodeIdMessage(id);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/59f37266/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
index d1c3d9f..7116227 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
@@ -42,10 +42,15 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.Queue;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
+import java.util.UUID;
import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.cache.CacheException;
import javax.cache.configuration.Factory;
@@ -81,6 +86,7 @@ import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.lang.GridAbsClosure;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.internal.util.lang.IgnitePair;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.T2;
@@ -88,6 +94,7 @@ import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.spi.swapspace.inmemory.GridTestSwapSpaceSpi;
import org.apache.ignite.ssl.SslContextFactory;
import org.apache.ignite.testframework.config.GridTestProperties;
@@ -147,6 +154,9 @@ public final class GridTestUtils {
/** */
private static final GridBusyLock busyLock = new GridBusyLock();
+ /** */
+ public static final ConcurrentMap<IgnitePair<UUID>, IgnitePair<Queue<Message>>> msgMap = new ConcurrentHashMap<>();
+
/**
* Ensure singleton.
*/
@@ -155,6 +165,55 @@ public final class GridTestUtils {
}
/**
+ * @param from From node ID.
+ * @param to To node ID.
+ * @param msg Message.
+ * @param sent Sent or received.
+ */
+ public static void addMessage(UUID from, UUID to, Message msg, boolean sent) {
+ IgnitePair<UUID> key = F.pair(from, to);
+
+ IgnitePair<Queue<Message>> val = msgMap.get(key);
+
+ if (val == null) {
+ IgnitePair<Queue<Message>> old = msgMap.putIfAbsent(key,
+ val = F.<Queue<Message>>pair(new ConcurrentLinkedQueue<Message>(), new ConcurrentLinkedQueue<Message>()));
+
+ if (old != null)
+ val = old;
+ }
+
+ (sent ? val.get1() : val.get2()).add(msg);
+ }
+
+ /**
+ * Dumps all messages tracked with {@link #addMessage(UUID, UUID, Message, boolean)} to std out.
+ */
+ public static void dumpMessages() {
+ for (Map.Entry<IgnitePair<UUID>, IgnitePair<Queue<Message>>> entry : msgMap.entrySet()) {
+ U.debug("\n" + entry.getKey().get1() + " [sent to] " + entry.getKey().get2());
+
+ for (Message message : entry.getValue().get1())
+ U.debug("\t" + message);
+
+ U.debug(entry.getKey().get2() + " [received from] " + entry.getKey().get1());
+
+ for (Message message : entry.getValue().get2())
+ U.debug("\t" + message);
+ }
+ }
+
+// static {
+// new Thread(new Runnable() {
+// @Override public void run() {
+// JOptionPane.showMessageDialog(null, "Close this to dump messages.");
+//
+// dumpMessages();
+// }
+// }).start();
+// }
+
+ /**
* Checks whether callable throws expected exception or not.
*
* @param log Logger (optional).
@@ -1728,4 +1787,4 @@ public final class GridTestUtils {
/** Evict to offheap with eviction policy + evict from offheap to swap when max offheap memory limit is reached. */
OFFHEAP_EVICT_SWAP,
}
-}
\ No newline at end of file
+}
[24/50] [abbrv] ignite git commit: IGNITE-2018 Refactored examples to
use common model classes.
Posted by ra...@apache.org.
IGNITE-2018 Refactored examples to use common model classes.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e519c2f5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e519c2f5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e519c2f5
Branch: refs/heads/master
Commit: e519c2f5b1e05f886c861eb2bd05aec7cffa5bbc
Parents: 3080f61
Author: AKuznetsov <ak...@gridgain.com>
Authored: Fri Nov 27 20:30:46 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Fri Nov 27 20:30:46 2015 +0700
----------------------------------------------------------------------
.../hibernate/CacheHibernatePersonStore.java | 4 +-
.../hibernate/CacheHibernateStoreExample.java | 2 +-
.../datagrid/store/hibernate/Person.hbm.xml | 2 +-
.../apache/ignite/examples/binary/Address.java | 72 ---------
.../apache/ignite/examples/binary/Employee.java | 93 -----------
.../ignite/examples/binary/EmployeeKey.java | 93 -----------
.../ignite/examples/binary/Organization.java | 93 -----------
.../examples/binary/OrganizationType.java | 32 ----
...ComputeClientBinaryTaskExecutionExample.java | 4 +-
.../CacheClientBinaryPutGetExample.java | 6 +-
.../datagrid/CacheClientBinaryQueryExample.java | 22 +--
.../examples/datagrid/CacheQueryExample.java | 161 ++++---------------
.../ignite/examples/datagrid/store/Person.java | 154 ------------------
.../store/auto/CacheAutoStoreExample.java | 4 +-
.../auto/CacheAutoStoreLoadDataExample.java | 4 +-
.../datagrid/store/auto/CacheConfig.java | 6 +-
.../store/dummy/CacheDummyPersonStore.java | 12 +-
.../store/dummy/CacheDummyStoreExample.java | 4 +-
.../store/jdbc/CacheJdbcPersonStore.java | 18 +--
.../store/jdbc/CacheJdbcStoreExample.java | 4 +-
.../store/spring/CacheSpringPersonStore.java | 10 +-
.../store/spring/CacheSpringStoreExample.java | 4 +-
.../ignite/examples/model/Organization.java | 55 +++++++
.../apache/ignite/examples/model/Person.java | 120 ++++++++++++++
.../ignite/examples/model/binary/Address.java | 72 +++++++++
.../ignite/examples/model/binary/Employee.java | 93 +++++++++++
.../examples/model/binary/EmployeeKey.java | 93 +++++++++++
.../examples/model/binary/Organization.java | 93 +++++++++++
.../examples/model/binary/OrganizationType.java | 32 ++++
.../examples/ScalarCacheQueryExample.scala | 66 ++------
30 files changed, 651 insertions(+), 777 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
index d040b88..ade5d18 100644
--- a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
+++ b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
@@ -24,7 +24,7 @@ import javax.cache.integration.CacheWriterException;
import org.apache.ignite.cache.store.CacheStore;
import org.apache.ignite.cache.store.CacheStoreAdapter;
import org.apache.ignite.cache.store.CacheStoreSession;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.resources.CacheStoreSessionResource;
import org.hibernate.HibernateException;
@@ -107,7 +107,7 @@ public class CacheHibernatePersonStore extends CacheStoreAdapter<Long, Person> {
for (Object obj : list) {
Person person = (Person)obj;
- clo.apply(person.getId(), person);
+ clo.apply(person.id, person);
cnt++;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
index f993d81..71c4f68 100644
--- a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
+++ b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
@@ -29,7 +29,7 @@ import org.apache.ignite.cache.store.hibernate.CacheHibernateStoreSessionListene
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.examples.ExampleNodeStartup;
import org.apache.ignite.examples.ExamplesUtils;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
import org.apache.ignite.transactions.Transaction;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
----------------------------------------------------------------------
diff --git a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
index 035ab98..1314b71 100644
--- a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
+++ b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/store/hibernate/Person.hbm.xml
@@ -23,7 +23,7 @@
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-access="field">
- <class name="org.apache.ignite.examples.datagrid.store.Person" table="PERSONS">
+ <class name="org.apache.ignite.examples.model.Person" table="PERSONS">
<!-- ID. -->
<id name="id"/>
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/binary/Address.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/Address.java b/examples/src/main/java/org/apache/ignite/examples/binary/Address.java
deleted file mode 100644
index 76d8774..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/binary/Address.java
+++ /dev/null
@@ -1,72 +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.binary;
-
-import org.apache.ignite.binary.BinaryObjectException;
-import org.apache.ignite.binary.Binarylizable;
-import org.apache.ignite.binary.BinaryReader;
-import org.apache.ignite.binary.BinaryWriter;
-
-/**
- * Employee address.
- * <p>
- * This class implements {@link org.apache.ignite.binary.Binarylizable} only for example purposes,
- * in order to show how to customize serialization and deserialization of
- * binary objects.
- */
-public class Address implements Binarylizable {
- /** Street. */
- private String street;
-
- /** ZIP code. */
- private int zip;
-
- /**
- * Required for binary deserialization.
- */
- public Address() {
- // No-op.
- }
-
- /**
- * @param street Street.
- * @param zip ZIP code.
- */
- public Address(String street, int zip) {
- this.street = street;
- this.zip = zip;
- }
-
- /** {@inheritDoc} */
- @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
- writer.writeString("street", street);
- writer.writeInt("zip", zip);
- }
-
- /** {@inheritDoc} */
- @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
- street = reader.readString("street");
- zip = reader.readInt("zip");
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Address [street=" + street +
- ", zip=" + zip + ']';
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/binary/Employee.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/Employee.java b/examples/src/main/java/org/apache/ignite/examples/binary/Employee.java
deleted file mode 100644
index 744b44f..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/binary/Employee.java
+++ /dev/null
@@ -1,93 +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.binary;
-
-import java.util.Collection;
-
-/**
- * This class represents employee object.
- */
-public class Employee {
- /** Name. */
- private String name;
-
- /** Salary. */
- private long salary;
-
- /** Address. */
- private Address address;
-
- /** Departments. */
- private Collection<String> departments;
-
- /**
- * Required for binary deserialization.
- */
- public Employee() {
- // No-op.
- }
-
- /**
- * @param name Name.
- * @param salary Salary.
- * @param address Address.
- * @param departments Departments.
- */
- public Employee(String name, long salary, Address address, Collection<String> departments) {
- this.name = name;
- this.salary = salary;
- this.address = address;
- this.departments = departments;
- }
-
- /**
- * @return Name.
- */
- public String name() {
- return name;
- }
-
- /**
- * @return Salary.
- */
- public long salary() {
- return salary;
- }
-
- /**
- * @return Address.
- */
- public Address address() {
- return address;
- }
-
- /**
- * @return Departments.
- */
- public Collection<String> departments() {
- return departments;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Employee [name=" + name +
- ", salary=" + salary +
- ", address=" + address +
- ", departments=" + departments + ']';
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/binary/EmployeeKey.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/EmployeeKey.java b/examples/src/main/java/org/apache/ignite/examples/binary/EmployeeKey.java
deleted file mode 100644
index 7614f2c..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/binary/EmployeeKey.java
+++ /dev/null
@@ -1,93 +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.binary;
-
-import org.apache.ignite.cache.affinity.AffinityKeyMapped;
-
-/**
- * This class represents key for employee object.
- * <p>
- * Used in query example to collocate employees
- * with their organizations.
- */
-public class EmployeeKey {
- /** ID. */
- private int id;
-
- /** Organization ID. */
- @AffinityKeyMapped
- private int organizationId;
-
- /**
- * Required for binary deserialization.
- */
- public EmployeeKey() {
- // No-op.
- }
-
- /**
- * @param id ID.
- * @param organizationId Organization ID.
- */
- public EmployeeKey(int id, int organizationId) {
- this.id = id;
- this.organizationId = organizationId;
- }
-
- /**
- * @return ID.
- */
- public int id() {
- return id;
- }
-
- /**
- * @return Organization ID.
- */
- public int organizationId() {
- return organizationId;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (o == null || getClass() != o.getClass())
- return false;
-
- EmployeeKey key = (EmployeeKey)o;
-
- return id == key.id && organizationId == key.organizationId;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- int res = id;
-
- res = 31 * res + organizationId;
-
- return res;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "EmployeeKey [id=" + id +
- ", organizationId=" + organizationId + ']';
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/binary/Organization.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/Organization.java b/examples/src/main/java/org/apache/ignite/examples/binary/Organization.java
deleted file mode 100644
index b42bb27..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/binary/Organization.java
+++ /dev/null
@@ -1,93 +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.binary;
-
-import java.sql.Timestamp;
-
-/**
- * This class represents organization object.
- */
-public class Organization {
- /** Name. */
- private String name;
-
- /** Address. */
- private Address address;
-
- /** Type. */
- private OrganizationType type;
-
- /** Last update time. */
- private Timestamp lastUpdated;
-
- /**
- * Required for binary deserialization.
- */
- public Organization() {
- // No-op.
- }
-
- /**
- * @param name Name.
- * @param address Address.
- * @param type Type.
- * @param lastUpdated Last update time.
- */
- public Organization(String name, Address address, OrganizationType type, Timestamp lastUpdated) {
- this.name = name;
- this.address = address;
- this.type = type;
- this.lastUpdated = lastUpdated;
- }
-
- /**
- * @return Name.
- */
- public String name() {
- return name;
- }
-
- /**
- * @return Address.
- */
- public Address address() {
- return address;
- }
-
- /**
- * @return Type.
- */
- public OrganizationType type() {
- return type;
- }
-
- /**
- * @return Last update time.
- */
- public Timestamp lastUpdated() {
- return lastUpdated;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Organization [name=" + name +
- ", address=" + address +
- ", type=" + type +
- ", lastUpdated=" + lastUpdated + ']';
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/binary/OrganizationType.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/OrganizationType.java b/examples/src/main/java/org/apache/ignite/examples/binary/OrganizationType.java
deleted file mode 100644
index 6548210..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/binary/OrganizationType.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.examples.binary;
-
-/**
- * Organization type enum.
- */
-public enum OrganizationType {
- /** Non-profit organization. */
- NON_PROFIT,
-
- /** Private organization. */
- PRIVATE,
-
- /** Government organization. */
- GOVERNMENT
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/binary/computegrid/ComputeClientBinaryTaskExecutionExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/computegrid/ComputeClientBinaryTaskExecutionExample.java b/examples/src/main/java/org/apache/ignite/examples/binary/computegrid/ComputeClientBinaryTaskExecutionExample.java
index ba1c968..49f254a 100644
--- a/examples/src/main/java/org/apache/ignite/examples/binary/computegrid/ComputeClientBinaryTaskExecutionExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/binary/computegrid/ComputeClientBinaryTaskExecutionExample.java
@@ -22,8 +22,8 @@ import java.util.Arrays;
import java.util.Collection;
import org.apache.ignite.Ignite;
import org.apache.ignite.Ignition;
-import org.apache.ignite.examples.binary.Address;
-import org.apache.ignite.examples.binary.Employee;
+import org.apache.ignite.examples.model.binary.Address;
+import org.apache.ignite.examples.model.binary.Employee;
import org.apache.ignite.binary.BinaryObject;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java
index e49c16a..c416501 100644
--- a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryPutGetExample.java
@@ -28,9 +28,9 @@ import org.apache.ignite.Ignition;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.binary.Address;
-import org.apache.ignite.examples.binary.Organization;
-import org.apache.ignite.examples.binary.OrganizationType;
+import org.apache.ignite.examples.model.binary.Address;
+import org.apache.ignite.examples.model.binary.Organization;
+import org.apache.ignite.examples.model.binary.OrganizationType;
import org.apache.ignite.binary.BinaryObject;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
index ed01eb9..34452e4 100644
--- a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
@@ -34,11 +34,11 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.cache.query.TextQuery;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.binary.Address;
-import org.apache.ignite.examples.binary.Employee;
-import org.apache.ignite.examples.binary.EmployeeKey;
-import org.apache.ignite.examples.binary.Organization;
-import org.apache.ignite.examples.binary.OrganizationType;
+import org.apache.ignite.examples.model.binary.Address;
+import org.apache.ignite.examples.model.binary.Employee;
+import org.apache.ignite.examples.model.binary.EmployeeKey;
+import org.apache.ignite.examples.model.binary.Organization;
+import org.apache.ignite.examples.model.binary.OrganizationType;
import org.apache.ignite.binary.BinaryObject;
/**
@@ -204,14 +204,14 @@ public class CacheClientBinaryQueryExample {
* @param cache Ignite cache.
*/
private static void sqlJoinQuery(IgniteCache<BinaryObject, BinaryObject> cache) {
- SqlQuery<BinaryObject, BinaryObject> query = new SqlQuery<>(Employee.class,
+ SqlQuery<BinaryObject, BinaryObject> qry = new SqlQuery<>(Employee.class,
"from Employee, \"" + ORGANIZATION_CACHE_NAME + "\".Organization as org " +
"where Employee.organizationId = org._key and org.name = ?");
String organizationName = "GridGain";
QueryCursor<Cache.Entry<BinaryObject, BinaryObject>> employees =
- cache.query(query.setArgs(organizationName));
+ cache.query(qry.setArgs(organizationName));
System.out.println();
System.out.println(">>> Employees working for " + organizationName + ':');
@@ -226,9 +226,9 @@ public class CacheClientBinaryQueryExample {
* @param cache Ignite cache.
*/
private static void sqlFieldsQuery(IgniteCache<BinaryObject, BinaryObject> cache) {
- SqlFieldsQuery query = new SqlFieldsQuery("select name, salary from Employee");
+ SqlFieldsQuery qry = new SqlFieldsQuery("select name, salary from Employee");
- QueryCursor<List<?>> employees = cache.query(query);
+ QueryCursor<List<?>> employees = cache.query(qry);
System.out.println();
System.out.println(">>> Employee names and their salaries:");
@@ -243,9 +243,9 @@ public class CacheClientBinaryQueryExample {
* @param cache Ignite cache.
*/
private static void textQuery(IgniteCache<BinaryObject, BinaryObject> cache) {
- TextQuery<BinaryObject, BinaryObject> query = new TextQuery<>(Employee.class, "TX");
+ TextQuery<BinaryObject, BinaryObject> qry = new TextQuery<>(Employee.class, "TX");
- QueryCursor<Cache.Entry<BinaryObject, BinaryObject>> employees = cache.query(query);
+ QueryCursor<Cache.Entry<BinaryObject, BinaryObject>> employees = cache.query(qry);
System.out.println();
System.out.println(">>> Employees living in Texas:");
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
index 8fba3f6..a593562 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
@@ -17,9 +17,7 @@
package org.apache.ignite.examples.datagrid;
-import java.io.Serializable;
import java.util.List;
-import java.util.UUID;
import javax.cache.Cache;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
@@ -31,10 +29,10 @@ import org.apache.ignite.cache.query.ScanQuery;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.cache.query.TextQuery;
-import org.apache.ignite.cache.query.annotations.QuerySqlField;
-import org.apache.ignite.cache.query.annotations.QueryTextField;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.examples.model.Organization;
+import org.apache.ignite.examples.model.Person;
import org.apache.ignite.lang.IgniteBiPredicate;
/**
@@ -80,19 +78,19 @@ public class CacheQueryExample {
System.out.println();
System.out.println(">>> Cache query example started.");
- CacheConfiguration<UUID, Organization> orgCacheCfg = new CacheConfiguration<>(ORG_CACHE);
+ CacheConfiguration<Long, Organization> orgCacheCfg = new CacheConfiguration<>(ORG_CACHE);
orgCacheCfg.setCacheMode(CacheMode.PARTITIONED); // Default.
- orgCacheCfg.setIndexedTypes(UUID.class, Organization.class);
+ orgCacheCfg.setIndexedTypes(Long.class, Organization.class);
- CacheConfiguration<AffinityKey<UUID>, Person> personCacheCfg = new CacheConfiguration<>(PERSON_CACHE);
+ CacheConfiguration<AffinityKey<Long>, Person> personCacheCfg = new CacheConfiguration<>(PERSON_CACHE);
personCacheCfg.setCacheMode(CacheMode.PARTITIONED); // Default.
personCacheCfg.setIndexedTypes(AffinityKey.class, Person.class);
try (
- IgniteCache<UUID, Organization> orgCache = ignite.getOrCreateCache(orgCacheCfg);
- IgniteCache<AffinityKey<UUID>, Person> personCache = ignite.getOrCreateCache(personCacheCfg)
+ IgniteCache<Long, Organization> orgCache = ignite.getOrCreateCache(orgCacheCfg);
+ IgniteCache<AffinityKey<Long>, Person> personCache = ignite.getOrCreateCache(personCacheCfg)
) {
// Populate cache.
initialize();
@@ -128,11 +126,11 @@ public class CacheQueryExample {
* Example for scan query based on a predicate.
*/
private static void scanQuery() {
- IgniteCache<AffinityKey<UUID>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
+ IgniteCache<AffinityKey<Long>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
- ScanQuery<AffinityKey<UUID>, Person> scan = new ScanQuery<>(
- new IgniteBiPredicate<AffinityKey<UUID>, Person>() {
- @Override public boolean apply(AffinityKey<UUID> key, Person person) {
+ ScanQuery<AffinityKey<Long>, Person> scan = new ScanQuery<>(
+ new IgniteBiPredicate<AffinityKey<Long>, Person>() {
+ @Override public boolean apply(AffinityKey<Long> key, Person person) {
return person.salary <= 1000;
}
}
@@ -146,18 +144,18 @@ public class CacheQueryExample {
* Example for SQL queries based on salary ranges.
*/
private static void sqlQuery() {
- IgniteCache<AffinityKey<UUID>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
+ IgniteCache<AffinityKey<Long>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
// SQL clause which selects salaries based on range.
String sql = "salary > ? and salary <= ?";
// Execute queries for salary ranges.
print("People with salaries between 0 and 1000 (queried with SQL query): ",
- cache.query(new SqlQuery<AffinityKey<UUID>, Person>(Person.class, sql).
+ cache.query(new SqlQuery<AffinityKey<Long>, Person>(Person.class, sql).
setArgs(0, 1000)).getAll());
print("People with salaries between 1000 and 2000 (queried with SQL query): ",
- cache.query(new SqlQuery<AffinityKey<UUID>, Person>(Person.class, sql).
+ cache.query(new SqlQuery<AffinityKey<Long>, Person>(Person.class, sql).
setArgs(1000, 2000)).getAll());
}
@@ -165,7 +163,7 @@ public class CacheQueryExample {
* Example for SQL queries based on all employees working for a specific organization.
*/
private static void sqlQueryWithJoin() {
- IgniteCache<AffinityKey<UUID>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
+ IgniteCache<AffinityKey<Long>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
// SQL clause query which joins on 2 types to select people for a specific organization.
String joinSql =
@@ -175,11 +173,11 @@ public class CacheQueryExample {
// Execute queries for find employees for different organizations.
print("Following people are 'ApacheIgnite' employees: ",
- cache.query(new SqlQuery<AffinityKey<UUID>, Person>(Person.class, joinSql).
+ cache.query(new SqlQuery<AffinityKey<Long>, Person>(Person.class, joinSql).
setArgs("ApacheIgnite")).getAll());
print("Following people are 'Other' employees: ",
- cache.query(new SqlQuery<AffinityKey<UUID>, Person>(Person.class, joinSql).
+ cache.query(new SqlQuery<AffinityKey<Long>, Person>(Person.class, joinSql).
setArgs("Other")).getAll());
}
@@ -187,15 +185,15 @@ public class CacheQueryExample {
* Example for TEXT queries using LUCENE-based indexing of people's resumes.
*/
private static void textQuery() {
- IgniteCache<AffinityKey<UUID>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
+ IgniteCache<AffinityKey<Long>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
// Query for all people with "Master Degree" in their resumes.
- QueryCursor<Cache.Entry<AffinityKey<UUID>, Person>> masters =
- cache.query(new TextQuery<AffinityKey<UUID>, Person>(Person.class, "Master"));
+ QueryCursor<Cache.Entry<AffinityKey<Long>, Person>> masters =
+ cache.query(new TextQuery<AffinityKey<Long>, Person>(Person.class, "Master"));
// Query for all people with "Bachelor Degree" in their resumes.
- QueryCursor<Cache.Entry<AffinityKey<UUID>, Person>> bachelors =
- cache.query(new TextQuery<AffinityKey<UUID>, Person>(Person.class, "Bachelor"));
+ QueryCursor<Cache.Entry<AffinityKey<Long>, Person>> bachelors =
+ cache.query(new TextQuery<AffinityKey<Long>, Person>(Person.class, "Bachelor"));
print("Following people have 'Master Degree' in their resumes: ", masters.getAll());
print("Following people have 'Bachelor Degree' in their resumes: ", bachelors.getAll());
@@ -205,7 +203,7 @@ public class CacheQueryExample {
* Example for SQL queries to calculate average salary for a specific organization.
*/
private static void sqlQueryWithAggregation() {
- IgniteCache<AffinityKey<UUID>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
+ IgniteCache<AffinityKey<Long>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
// Calculate average of salary of all persons in ApacheIgnite.
// Note that we also join on Organization cache as well.
@@ -226,7 +224,7 @@ public class CacheQueryExample {
* fields instead of whole key-value pairs.
*/
private static void sqlFieldsQuery() {
- IgniteCache<AffinityKey<UUID>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
+ IgniteCache<AffinityKey<Long>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
// Execute query to get names of all employees.
QueryCursor<List<?>> cursor = cache.query(new SqlFieldsQuery(
@@ -244,7 +242,7 @@ public class CacheQueryExample {
* fields instead of whole key-value pairs.
*/
private static void sqlFieldsQueryWithJoin() {
- IgniteCache<AffinityKey<UUID>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
+ IgniteCache<AffinityKey<Long>, Person> cache = Ignition.ignite().cache(PERSON_CACHE);
// Execute query to get names of all employees.
String sql =
@@ -265,7 +263,7 @@ public class CacheQueryExample {
* Populate cache with test data.
*/
private static void initialize() {
- IgniteCache<UUID, Organization> orgCache = Ignition.ignite().cache(ORG_CACHE);
+ IgniteCache<Long, Organization> orgCache = Ignition.ignite().cache(ORG_CACHE);
// Organizations.
Organization org1 = new Organization("ApacheIgnite");
@@ -274,7 +272,7 @@ public class CacheQueryExample {
orgCache.put(org1.id, org1);
orgCache.put(org2.id, org2);
- IgniteCache<AffinityKey<UUID>, Person> personCache = Ignition.ignite().cache(PERSON_CACHE);
+ IgniteCache<AffinityKey<Long>, Person> personCache = Ignition.ignite().cache(PERSON_CACHE);
// People.
Person p1 = new Person(org1, "John", "Doe", 2000, "John Doe has Master Degree.");
@@ -320,109 +318,4 @@ public class CacheQueryExample {
for (Object next : col)
System.out.println(">>> " + next);
}
-
- /**
- * Person class.
- */
- private static class Person implements Serializable {
- /** Person ID (indexed). */
- @QuerySqlField(index = true)
- private UUID id;
-
- /** Organization ID (indexed). */
- @QuerySqlField(index = true)
- private UUID orgId;
-
- /** First name (not-indexed). */
- @QuerySqlField
- private String firstName;
-
- /** Last name (not indexed). */
- @QuerySqlField
- private String lastName;
-
- /** Resume text (create LUCENE-based TEXT index for this field). */
- @QueryTextField
- private String resume;
-
- /** Salary (indexed). */
- @QuerySqlField(index = true)
- private double salary;
-
- /** Custom cache key to guarantee that person is always collocated with its organization. */
- private transient AffinityKey<UUID> key;
-
- /**
- * Constructs person record.
- *
- * @param org Organization.
- * @param firstName First name.
- * @param lastName Last name.
- * @param salary Salary.
- * @param resume Resume text.
- */
- Person(Organization org, String firstName, String lastName, double salary, String resume) {
- // Generate unique ID for this person.
- id = UUID.randomUUID();
-
- orgId = org.id;
-
- this.firstName = firstName;
- this.lastName = lastName;
- this.resume = resume;
- this.salary = salary;
- }
-
- /**
- * Gets cache affinity key. Since in some examples person needs to be collocated with organization, we create
- * custom affinity key to guarantee this collocation.
- *
- * @return Custom affinity key to guarantee that person is always collocated with organization.
- */
- public AffinityKey<UUID> key() {
- if (key == null)
- key = new AffinityKey<>(id, orgId);
-
- return key;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Person [firstName=" + firstName +
- ", lastName=" + lastName +
- ", id=" + id +
- ", orgId=" + orgId +
- ", resume=" + resume +
- ", salary=" + salary + ']';
- }
- }
-
- /**
- * Organization class.
- */
- private static class Organization implements Serializable {
- /** Organization ID (indexed). */
- @QuerySqlField(index = true)
- private UUID id;
-
- /** Organization name (indexed). */
- @QuerySqlField(index = true)
- private String name;
-
- /**
- * Create organization.
- *
- * @param name Organization name.
- */
- Organization(String name) {
- id = UUID.randomUUID();
-
- this.name = name;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Organization [id=" + id + ", name=" + name + ']';
- }
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/Person.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/Person.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/Person.java
deleted file mode 100644
index b54010f..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/Person.java
+++ /dev/null
@@ -1,154 +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.datagrid.store;
-
-import java.io.Serializable;
-
-/**
- * Person definition.
- *
- * Code generated by Apache Ignite Schema Import utility: 02/24/2015.
- */
-public class Person implements Serializable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Value for id. */
- private long id;
-
- /** Value for first name. */
- private String firstName;
-
- /** Value for last name. */
- private String lastName;
-
- /**
- * Empty constructor.
- */
- public Person() {
- // No-op.
- }
-
- /**
- * Full constructor.
- */
- public Person(
- long id,
- String firstName,
- String lastName
- ) {
- this.id = id;
- this.firstName = firstName;
- this.lastName = lastName;
- }
-
- /**
- * Gets id.
- *
- * @return Value for id.
- */
- public long getId() {
- return id;
- }
-
- /**
- * Sets id.
- *
- * @param id New value for id.
- */
- public void setId(long id) {
- this.id = id;
- }
-
- /**
- * Gets first name.
- *
- * @return Value for first name.
- */
- public String getFirstName() {
- return firstName;
- }
-
- /**
- * Sets first name.
- *
- * @param firstName New value for first name.
- */
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- /**
- * Gets last name.
- *
- * @return Value for last name.
- */
- public String getLastName() {
- return lastName;
- }
-
- /**
- * Sets last name.
- *
- * @param lastName New value for last name.
- */
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (!(o instanceof Person))
- return false;
-
- Person that = (Person)o;
-
- if (id != that.id)
- return false;
-
- if (firstName != null ? !firstName.equals(that.firstName) : that.firstName != null)
- return false;
-
- if (lastName != null ? !lastName.equals(that.lastName) : that.lastName != null)
- return false;
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- int res = (int)(id ^ (id >>> 32));
-
- res = 31 * res + (firstName != null ? firstName.hashCode() : 0);
-
- res = 31 * res + (lastName != null ? lastName.hashCode() : 0);
-
- return res;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Person [id=" + id +
- ", firstName=" + firstName +
- ", lastName=" + lastName +
- "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
index f8cd4dd..37a31d7 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreExample.java
@@ -24,7 +24,7 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.Ignition;
import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore;
import org.apache.ignite.examples.ExampleNodeStartup;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
import org.apache.ignite.transactions.Transaction;
/**
@@ -85,4 +85,4 @@ public class CacheAutoStoreExample {
}
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreLoadDataExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreLoadDataExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreLoadDataExample.java
index f0f9feb..63a8c6f 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreLoadDataExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheAutoStoreLoadDataExample.java
@@ -25,7 +25,7 @@ import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.examples.ExampleNodeStartup;
import org.apache.ignite.examples.ExamplesUtils;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
/**
* Demonstrates how to load data from database.
@@ -82,4 +82,4 @@ public class CacheAutoStoreLoadDataExample {
}
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheConfig.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheConfig.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheConfig.java
index 1eb7cd2..3b38aeb 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheConfig.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/auto/CacheConfig.java
@@ -26,7 +26,7 @@ import org.apache.ignite.cache.CacheTypeMetadata;
import org.apache.ignite.cache.store.CacheStore;
import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
import org.h2.jdbcx.JdbcConnectionPool;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -59,7 +59,7 @@ public class CacheConfig {
meta.setDatabaseTable("PERSON");
meta.setKeyType("java.lang.Long");
- meta.setValueType("org.apache.ignite.examples.datagrid.store.Person");
+ meta.setValueType("org.apache.ignite.examples.model.Person");
meta.setKeyFields(Collections.singletonList(new CacheTypeFieldMetadata("ID", Types.BIGINT, "id", Long.class)));
@@ -78,4 +78,4 @@ public class CacheConfig {
return cfg;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java
index f85e92b..6c0fecb 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyPersonStore.java
@@ -22,7 +22,7 @@ import java.util.concurrent.ConcurrentHashMap;
import org.apache.ignite.Ignite;
import org.apache.ignite.cache.store.CacheStoreAdapter;
import org.apache.ignite.cache.store.CacheStoreSession;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.resources.CacheNameResource;
import org.apache.ignite.resources.CacheStoreSessionResource;
@@ -85,7 +85,7 @@ public class CacheDummyPersonStore extends CacheStoreAdapter<Long, Person> {
System.out.println(">>> Store loadCache for entry count: " + cnt);
- for (int i = 0; i < cnt; i++) {
+ for (long i = 0; i < cnt; i++) {
// Generate dummy person on the fly.
Person p = new Person(i, "first-" + i, "last-" + 1);
@@ -93,13 +93,13 @@ public class CacheDummyPersonStore extends CacheStoreAdapter<Long, Person> {
// but we check if local node is primary or backup anyway just to demonstrate that we can.
// Ideally, partition ID of a key would be stored in the database and only keys
// for partitions that belong on this node would be loaded from database.
- if (ignite.affinity(cacheName).isPrimaryOrBackup(ignite.cluster().localNode(), p.getId())) {
+ if (ignite.affinity(cacheName).isPrimaryOrBackup(ignite.cluster().localNode(), p.id)) {
// Update dummy database.
// In real life data would be loaded from database.
- dummyDB.put(p.getId(), p);
+ dummyDB.put(p.id, p);
// Pass data to cache.
- clo.apply(p.getId(), p);
+ clo.apply(p.id, p);
}
}
}
@@ -110,4 +110,4 @@ public class CacheDummyPersonStore extends CacheStoreAdapter<Long, Person> {
@Nullable private Transaction transaction() {
return ses != null ? ses.transaction() : null;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java
index 20e6b8f..a631df3 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/dummy/CacheDummyStoreExample.java
@@ -26,7 +26,7 @@ import org.apache.ignite.Ignition;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.examples.ExampleNodeStartup;
import org.apache.ignite.examples.ExamplesUtils;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
import org.apache.ignite.transactions.Transaction;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -130,4 +130,4 @@ public class CacheDummyStoreExample {
System.out.println("Read value after commit: " + cache.get(id));
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
index e0ea13a..6ba181e 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
@@ -29,7 +29,7 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.store.CacheStore;
import org.apache.ignite.cache.store.CacheStoreAdapter;
import org.apache.ignite.cache.store.CacheStoreSession;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.resources.CacheStoreSessionResource;
import org.h2.jdbcx.JdbcConnectionPool;
@@ -107,9 +107,9 @@ public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> {
// Some databases would allow these to be done in one 'upsert' operation.
try (PreparedStatement st = conn.prepareStatement(
"update PERSONS set firstName = ?, lastName = ? where id = ?")) {
- st.setString(1, val.getFirstName());
- st.setString(2, val.getLastName());
- st.setLong(3, val.getId());
+ st.setString(1, val.firstName);
+ st.setString(2, val.lastName);
+ st.setLong(3, val.id);
updated = st.executeUpdate();
}
@@ -118,9 +118,9 @@ public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> {
if (updated == 0) {
try (PreparedStatement st = conn.prepareStatement(
"insert into PERSONS (id, firstName, lastName) values (?, ?, ?)")) {
- st.setLong(1, val.getId());
- st.setString(2, val.getFirstName());
- st.setString(3, val.getLastName());
+ st.setLong(1, val.id);
+ st.setString(2, val.firstName);
+ st.setString(3, val.lastName);
st.executeUpdate();
}
@@ -166,7 +166,7 @@ public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> {
while (rs.next()) {
Person person = new Person(rs.getLong(1), rs.getString(2), rs.getString(3));
- clo.apply(person.getId(), person);
+ clo.apply(person.id, person);
cnt++;
}
@@ -177,4 +177,4 @@ public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> {
throw new CacheLoaderException("Failed to load values from cache store.", e);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
index 9d3014f..55ad5df 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
@@ -29,7 +29,7 @@ import org.apache.ignite.cache.store.jdbc.CacheJdbcStoreSessionListener;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.examples.ExampleNodeStartup;
import org.apache.ignite.examples.ExamplesUtils;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
import org.apache.ignite.transactions.Transaction;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -144,4 +144,4 @@ public class CacheJdbcStoreExample {
System.out.println("Read value after commit: " + cache.get(id));
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringPersonStore.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringPersonStore.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringPersonStore.java
index 7a0ea33..0029890 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringPersonStore.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringPersonStore.java
@@ -26,7 +26,7 @@ import javax.sql.DataSource;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.store.CacheStore;
import org.apache.ignite.cache.store.CacheStoreAdapter;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
@@ -92,11 +92,11 @@ public class CacheSpringPersonStore extends CacheStoreAdapter<Long, Person> {
System.out.println(">>> Store write [key=" + key + ", val=" + val + ']');
int updated = jdbcTemplate.update("update PERSONS set firstName = ?, lastName = ? where id = ?",
- val.getFirstName(), val.getLastName(), val.getId());
+ val.firstName, val.lastName, val.id);
if (updated == 0) {
jdbcTemplate.update("insert into PERSONS (id, firstName, lastName) values (?, ?, ?)",
- val.getId(), val.getFirstName(), val.getLastName());
+ val.id, val.firstName, val.lastName);
}
}
@@ -120,7 +120,7 @@ public class CacheSpringPersonStore extends CacheStoreAdapter<Long, Person> {
@Override public void processRow(ResultSet rs) throws SQLException {
Person person = new Person(rs.getLong(1), rs.getString(2), rs.getString(3));
- clo.apply(person.getId(), person);
+ clo.apply(person.id, person);
cnt.incrementAndGet();
}
@@ -128,4 +128,4 @@ public class CacheSpringPersonStore extends CacheStoreAdapter<Long, Person> {
System.out.println(">>> Loaded " + cnt + " values into cache.");
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringStoreExample.java
index 16437da..273ea1c 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringStoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringStoreExample.java
@@ -29,7 +29,7 @@ import org.apache.ignite.cache.store.jdbc.CacheJdbcStoreSessionListener;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.examples.ExampleNodeStartup;
import org.apache.ignite.examples.ExamplesUtils;
-import org.apache.ignite.examples.datagrid.store.Person;
+import org.apache.ignite.examples.model.Person;
import org.apache.ignite.transactions.Transaction;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -144,4 +144,4 @@ public class CacheSpringStoreExample {
System.out.println("Read value after commit: " + cache.get(id));
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/model/Organization.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/Organization.java b/examples/src/main/java/org/apache/ignite/examples/model/Organization.java
new file mode 100644
index 0000000..3881719
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/Organization.java
@@ -0,0 +1,55 @@
+/*
+ * 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.model;
+
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+
+import java.io.Serializable;
+import java.util.Random;
+
+/**
+ * Organization class.
+ */
+public class Organization implements Serializable {
+ /** */
+ private static final Random RND = new Random();
+
+ /** Organization ID (indexed). */
+ @QuerySqlField(index = true)
+ public Long id;
+
+ /** Organization name (indexed). */
+ @QuerySqlField(index = true)
+ public String name;
+
+ /**
+ * Create organization.
+ *
+ * @param name Organization name.
+ */
+ public Organization(String name) {
+ id = RND.nextLong();
+
+ this.name = name;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "Organization [id=" + id + ", name=" + name + ']';
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/model/Person.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/Person.java b/examples/src/main/java/org/apache/ignite/examples/model/Person.java
new file mode 100644
index 0000000..616cf6a
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/Person.java
@@ -0,0 +1,120 @@
+/*
+ * 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.model;
+
+import org.apache.ignite.cache.affinity.AffinityKey;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.cache.query.annotations.QueryTextField;
+
+import java.io.Serializable;
+import java.util.Random;
+
+/**
+ * Person class.
+ */
+public class Person implements Serializable {
+ /** */
+ private static final Random RND = new Random();
+
+ /** Person ID (indexed). */
+ @QuerySqlField(index = true)
+ public Long id;
+
+ /** Organization ID (indexed). */
+ @QuerySqlField(index = true)
+ public Long orgId;
+
+ /** First name (not-indexed). */
+ @QuerySqlField
+ public String firstName;
+
+ /** Last name (not indexed). */
+ @QuerySqlField
+ public String lastName;
+
+ /** Resume text (create LUCENE-based TEXT index for this field). */
+ @QueryTextField
+ public String resume;
+
+ /** Salary (indexed). */
+ @QuerySqlField(index = true)
+ public double salary;
+
+ /** Custom cache key to guarantee that person is always collocated with its organization. */
+ private transient AffinityKey<Long> key;
+
+ /**
+ * Constructs person record.
+ *
+ * @param org Organization.
+ * @param firstName First name.
+ * @param lastName Last name.
+ * @param salary Salary.
+ * @param resume Resume text.
+ */
+ public Person(Organization org, String firstName, String lastName, double salary, String resume) {
+ // Generate unique ID for this person.
+ id = RND.nextLong();
+
+ orgId = org.id;
+
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.resume = resume;
+ this.salary = salary;
+ }
+
+ /**
+ * Constructs person record.
+ *
+ * @param id Person ID.
+ * @param firstName First name.
+ * @param lastName Last name.
+ */
+ public Person(Long id, String firstName, String lastName) {
+ this.id = id;
+
+ this.firstName = firstName;
+ this.lastName = lastName;
+ }
+
+ /**
+ * Gets cache affinity key. Since in some examples person needs to be collocated with organization, we create
+ * custom affinity key to guarantee this collocation.
+ *
+ * @return Custom affinity key to guarantee that person is always collocated with organization.
+ */
+ public AffinityKey<Long> key() {
+ if (key == null)
+ key = new AffinityKey<>(id, orgId);
+
+ return key;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public String toString() {
+ return "Person [firstName=" + firstName +
+ ", lastName=" + lastName +
+ ", id=" + id +
+ ", orgId=" + orgId +
+ ", resume=" + resume +
+ ", salary=" + salary + ']';
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/model/binary/Address.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/binary/Address.java b/examples/src/main/java/org/apache/ignite/examples/model/binary/Address.java
new file mode 100644
index 0000000..2d17cb8
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/binary/Address.java
@@ -0,0 +1,72 @@
+/*
+ * 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.model.binary;
+
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.Binarylizable;
+import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.binary.BinaryWriter;
+
+/**
+ * Employee address.
+ * <p>
+ * This class implements {@link org.apache.ignite.binary.Binarylizable} only for example purposes,
+ * in order to show how to customize serialization and deserialization of
+ * binary objects.
+ */
+public class Address implements Binarylizable {
+ /** Street. */
+ private String street;
+
+ /** ZIP code. */
+ private int zip;
+
+ /**
+ * Required for binary deserialization.
+ */
+ public Address() {
+ // No-op.
+ }
+
+ /**
+ * @param street Street.
+ * @param zip ZIP code.
+ */
+ public Address(String street, int zip) {
+ this.street = street;
+ this.zip = zip;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
+ writer.writeString("street", street);
+ writer.writeInt("zip", zip);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
+ street = reader.readString("street");
+ zip = reader.readInt("zip");
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "Address [street=" + street +
+ ", zip=" + zip + ']';
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/model/binary/Employee.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/binary/Employee.java b/examples/src/main/java/org/apache/ignite/examples/model/binary/Employee.java
new file mode 100644
index 0000000..ad82065
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/binary/Employee.java
@@ -0,0 +1,93 @@
+/*
+ * 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.model.binary;
+
+import java.util.Collection;
+
+/**
+ * This class represents employee object.
+ */
+public class Employee {
+ /** Name. */
+ private String name;
+
+ /** Salary. */
+ private long salary;
+
+ /** Address. */
+ private Address addr;
+
+ /** Departments. */
+ private Collection<String> departments;
+
+ /**
+ * Required for binary deserialization.
+ */
+ public Employee() {
+ // No-op.
+ }
+
+ /**
+ * @param name Name.
+ * @param salary Salary.
+ * @param addr Address.
+ * @param departments Departments.
+ */
+ public Employee(String name, long salary, Address addr, Collection<String> departments) {
+ this.name = name;
+ this.salary = salary;
+ this.addr = addr;
+ this.departments = departments;
+ }
+
+ /**
+ * @return Name.
+ */
+ public String name() {
+ return name;
+ }
+
+ /**
+ * @return Salary.
+ */
+ public long salary() {
+ return salary;
+ }
+
+ /**
+ * @return Address.
+ */
+ public Address address() {
+ return addr;
+ }
+
+ /**
+ * @return Departments.
+ */
+ public Collection<String> departments() {
+ return departments;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "Employee [name=" + name +
+ ", salary=" + salary +
+ ", address=" + addr +
+ ", departments=" + departments + ']';
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/model/binary/EmployeeKey.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/binary/EmployeeKey.java b/examples/src/main/java/org/apache/ignite/examples/model/binary/EmployeeKey.java
new file mode 100644
index 0000000..20367ac
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/binary/EmployeeKey.java
@@ -0,0 +1,93 @@
+/*
+ * 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.model.binary;
+
+import org.apache.ignite.cache.affinity.AffinityKeyMapped;
+
+/**
+ * This class represents key for employee object.
+ * <p>
+ * Used in query example to collocate employees
+ * with their organizations.
+ */
+public class EmployeeKey {
+ /** ID. */
+ private int id;
+
+ /** Organization ID. */
+ @AffinityKeyMapped
+ private int organizationId;
+
+ /**
+ * Required for binary deserialization.
+ */
+ public EmployeeKey() {
+ // No-op.
+ }
+
+ /**
+ * @param id ID.
+ * @param organizationId Organization ID.
+ */
+ public EmployeeKey(int id, int organizationId) {
+ this.id = id;
+ this.organizationId = organizationId;
+ }
+
+ /**
+ * @return ID.
+ */
+ public int id() {
+ return id;
+ }
+
+ /**
+ * @return Organization ID.
+ */
+ public int organizationId() {
+ return organizationId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ EmployeeKey key = (EmployeeKey)o;
+
+ return id == key.id && organizationId == key.organizationId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ int res = id;
+
+ res = 31 * res + organizationId;
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "EmployeeKey [id=" + id +
+ ", organizationId=" + organizationId + ']';
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/model/binary/Organization.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/binary/Organization.java b/examples/src/main/java/org/apache/ignite/examples/model/binary/Organization.java
new file mode 100644
index 0000000..6b7aca4
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/binary/Organization.java
@@ -0,0 +1,93 @@
+/*
+ * 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.model.binary;
+
+import java.sql.Timestamp;
+
+/**
+ * This class represents organization object.
+ */
+public class Organization {
+ /** Name. */
+ private String name;
+
+ /** Address. */
+ private Address addr;
+
+ /** Type. */
+ private OrganizationType type;
+
+ /** Last update time. */
+ private Timestamp lastUpdated;
+
+ /**
+ * Required for binary deserialization.
+ */
+ public Organization() {
+ // No-op.
+ }
+
+ /**
+ * @param name Name.
+ * @param addr Address.
+ * @param type Type.
+ * @param lastUpdated Last update time.
+ */
+ public Organization(String name, Address addr, OrganizationType type, Timestamp lastUpdated) {
+ this.name = name;
+ this.addr = addr;
+ this.type = type;
+ this.lastUpdated = lastUpdated;
+ }
+
+ /**
+ * @return Name.
+ */
+ public String name() {
+ return name;
+ }
+
+ /**
+ * @return Address.
+ */
+ public Address address() {
+ return addr;
+ }
+
+ /**
+ * @return Type.
+ */
+ public OrganizationType type() {
+ return type;
+ }
+
+ /**
+ * @return Last update time.
+ */
+ public Timestamp lastUpdated() {
+ return lastUpdated;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "Organization [name=" + name +
+ ", address=" + addr +
+ ", type=" + type +
+ ", lastUpdated=" + lastUpdated + ']';
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/examples/src/main/java/org/apache/ignite/examples/model/binary/OrganizationType.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/model/binary/OrganizationType.java b/examples/src/main/java/org/apache/ignite/examples/model/binary/OrganizationType.java
new file mode 100644
index 0000000..69804c0
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/model/binary/OrganizationType.java
@@ -0,0 +1,32 @@
+/*
+ * 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.model.binary;
+
+/**
+ * Organization type enum.
+ */
+public enum OrganizationType {
+ /** Non-profit organization. */
+ NON_PROFIT,
+
+ /** Private organization. */
+ PRIVATE,
+
+ /** Government organization. */
+ GOVERNMENT
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e519c2f5/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 1a42947..6d6c8c3 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
@@ -17,11 +17,13 @@
package org.apache.ignite.scalar.examples
+import java.lang.{Long => JLong}
import java.util._
import org.apache.ignite.cache.CacheMode._
import org.apache.ignite.cache.affinity.AffinityKey
import org.apache.ignite.configuration.CacheConfiguration
+import org.apache.ignite.examples.model.{Person, Organization}
import org.apache.ignite.scalar.scalar
import org.apache.ignite.scalar.scalar._
import org.apache.ignite.{Ignite, IgniteCache}
@@ -48,7 +50,7 @@ object ScalarCacheQueryExample {
*/
def main(args: Array[String]) {
scalar(CONFIG) {
- val cache = createCache$(NAME, indexedTypes = Seq(classOf[UUID], classOf[Organization],
+ val cache = createCache$(NAME, indexedTypes = Seq(classOf[JLong], classOf[Organization],
classOf[AffinityKey[_]], classOf[Person]))
try {
@@ -70,12 +72,12 @@ object ScalarCacheQueryExample {
initialize()
// Cache instance shortcut.
- val cache = mkCache[AffinityKey[UUID], Person]
+ val cache = mkCache[AffinityKey[JLong], Person]
// Using distributed queries for partitioned cache and local queries for replicated cache.
// Since in replicated caches data is available on all nodes, including local one,
// it is enough to just query the local node.
- val prj = if (cache.getConfiguration(classOf[CacheConfiguration[AffinityKey[UUID], Person]]).getCacheMode == PARTITIONED)
+ val prj = if (cache.getConfiguration(classOf[CacheConfiguration[AffinityKey[JLong], Person]]).getCacheMode == PARTITIONED)
ignite.cluster().forRemotes()
else
ignite.cluster().forLocal()
@@ -104,23 +106,23 @@ object ScalarCacheQueryExample {
cache$(NAME).get.clear()
// Organization cache projection.
- val orgCache = mkCache[UUID, Organization]
+ val orgCache = mkCache[JLong, Organization]
// Organizations.
- val org1 = Organization("Ignite")
- val org2 = Organization("Other")
+ val org1 = new Organization("Ignite")
+ val org2 = new Organization("Other")
orgCache += (org1.id -> org1)
orgCache += (org2.id -> org2)
// Person cache projection.
- val prnCache = mkCache[AffinityKey[UUID], Person]
+ val prnCache = mkCache[AffinityKey[JLong], Person]
// People.
- val p1 = Person(org1, "John", "Doe", 2000, "John Doe has Master Degree.")
- val p2 = Person(org1, "Jane", "Doe", 1000, "Jane Doe has Bachelor Degree.")
- val p3 = Person(org2, "John", "Smith", 1500, "John Smith has Bachelor Degree.")
- val p4 = Person(org2, "Jane", "Smith", 2500, "Jane Smith has Master Degree.")
+ val p1 = new Person(org1, "John", "Doe", 2000, "John Doe has Master Degree.")
+ val p2 = new Person(org1, "Jane", "Doe", 1000, "Jane Doe has Bachelor Degree.")
+ val p3 = new Person(org2, "John", "Smith", 1500, "John Smith has Bachelor Degree.")
+ val p4 = new Person(org2, "Jane", "Smith", 2500, "Jane Smith has Master Degree.")
// Note that in this example we use custom affinity key for Person objects
// to ensure that all persons are collocated with their organizations.
@@ -148,45 +150,3 @@ object ScalarCacheQueryExample {
}
}
}
-
-/**
- * Organization class.
- */
-private case class Organization(
- @ScalarCacheQuerySqlField
- name: String
-) {
- /** Organization ID. */
- @ScalarCacheQuerySqlField
- val id = UUID.randomUUID
-}
-
-/**
- * Person class.
- */
-private case class Person(
- org: Organization,
- firstName: String,
- lastName: String,
- @ScalarCacheQuerySqlField
- salary: Double,
- @ScalarCacheQueryTextField
- resume: String
-) {
- /** Person ID. */
- val id = UUID.randomUUID
-
- /** Organization ID. */
- @ScalarCacheQuerySqlField
- val orgId = org.id
-
- /** Affinity key for this person. */
- val key = new AffinityKey[UUID](id, org.id)
-
- /**
- * `toString` implementation.
- */
- override def toString: String = {
- firstName + " " + lastName + " [salary: " + salary + ", resume: " + resume + "]"
- }
-}
[04/50] [abbrv] ignite git commit: IGNITE-1195 Fixed hadoop build.
Posted by ra...@apache.org.
IGNITE-1195 Fixed hadoop build.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bde1d1db
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bde1d1db
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bde1d1db
Branch: refs/heads/master
Commit: bde1d1db3592f74e9e46ca6af57b55adc8b96c1f
Parents: e9f22ab
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Fri Nov 27 12:18:16 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Nov 27 12:18:16 2015 +0300
----------------------------------------------------------------------
modules/yarn/pom.xml | 6 +++---
.../ignite/yarn/IgniteApplicationMasterSelfTest.java | 11 +++++++++--
2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bde1d1db/modules/yarn/pom.xml
----------------------------------------------------------------------
diff --git a/modules/yarn/pom.xml b/modules/yarn/pom.xml
index 2b758dc..d1f6390 100644
--- a/modules/yarn/pom.xml
+++ b/modules/yarn/pom.xml
@@ -35,20 +35,20 @@
<url>http://ignite.apache.org</url>
<properties>
- <hadoop.version>2.7.0</hadoop.version>
+ <hadoop-yarn.version>2.7.0</hadoop-yarn.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-client</artifactId>
- <version>${hadoop.version}</version>
+ <version>${hadoop-yarn.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
- <version>${hadoop.version}</version>
+ <version>${hadoop-yarn.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/ignite/blob/bde1d1db/modules/yarn/src/test/java/org/apache/ignite/yarn/IgniteApplicationMasterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/yarn/src/test/java/org/apache/ignite/yarn/IgniteApplicationMasterSelfTest.java b/modules/yarn/src/test/java/org/apache/ignite/yarn/IgniteApplicationMasterSelfTest.java
index 2173701..97f6a12 100644
--- a/modules/yarn/src/test/java/org/apache/ignite/yarn/IgniteApplicationMasterSelfTest.java
+++ b/modules/yarn/src/test/java/org/apache/ignite/yarn/IgniteApplicationMasterSelfTest.java
@@ -382,8 +382,15 @@ public class IgniteApplicationMasterSelfTest extends TestCase {
return 0;
}
- /** {@inheritDoc} */
- @Override public void updateBlacklist(List blacklistAdditions, List blacklistRemovals) {
+ /**
+ * Update application's blacklist with addition or removal resources.
+ *
+ * @param blacklistAdditions list of resources which should be added to the
+ * application blacklist
+ * @param blacklistRemovals list of resources which should be removed from the
+ * application blacklist
+ */
+ public void updateBlacklist(List blacklistAdditions, List blacklistRemovals) {
// No-op.
}
}
[29/50] [abbrv] ignite git commit: ignite-2020
GridProjectionLocalJobMultipleArgumentsSelfTest fixed
Posted by ra...@apache.org.
ignite-2020 GridProjectionLocalJobMultipleArgumentsSelfTest fixed
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f3cb64e3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f3cb64e3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f3cb64e3
Branch: refs/heads/master
Commit: f3cb64e375ff97a35b25ec0687b7d599f212afbd
Parents: 6312737
Author: agura <ag...@gridgain.com>
Authored: Fri Nov 27 17:26:20 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Fri Nov 27 17:39:46 2015 +0300
----------------------------------------------------------------------
.../GridProjectionLocalJobMultipleArgumentsSelfTest.java | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f3cb64e3/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
index 58ff1fb..356e002 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
@@ -43,7 +43,7 @@ public class GridProjectionLocalJobMultipleArgumentsSelfTest extends GridCommonA
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
/** */
- private static Collection<Integer> ids;
+ private static Collection<Object> ids;
/** */
private static AtomicInteger res;
@@ -90,7 +90,7 @@ public class GridProjectionLocalJobMultipleArgumentsSelfTest extends GridCommonA
for (int i : F.asList(1, 2, 3)) {
res.add(grid().compute().affinityCall(null, i, new IgniteCallable<Integer>() {
@Override public Integer call() {
- ids.add(System.identityHashCode(this));
+ ids.add(this);
return 10;
}
@@ -108,7 +108,7 @@ public class GridProjectionLocalJobMultipleArgumentsSelfTest extends GridCommonA
for (int i : F.asList(1, 2, 3)) {
grid().compute().affinityRun(null, i, new IgniteRunnable() {
@Override public void run() {
- ids.add(System.identityHashCode(this));
+ ids.add(this);
res.addAndGet(10);
}
@@ -125,8 +125,7 @@ public class GridProjectionLocalJobMultipleArgumentsSelfTest extends GridCommonA
public void testCall() throws Exception {
Collection<Integer> res = grid().compute().apply(new C1<Integer, Integer>() {
@Override public Integer apply(Integer arg) {
-
- ids.add(System.identityHashCode(this));
+ ids.add(this);
return 10 + arg;
}
@@ -144,7 +143,7 @@ public class GridProjectionLocalJobMultipleArgumentsSelfTest extends GridCommonA
Collection<Integer> res = grid().compute().apply(new C1<Integer, Integer>() {
@Override public Integer apply(Integer arg) {
- ids.add(System.identityHashCode(this));
+ ids.add(this);
return 10 + arg;
}
[38/50] [abbrv] ignite git commit: Skip metadata check in builder if
write null value.
Posted by ra...@apache.org.
Skip metadata check in builder if write null value.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a5d99931
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a5d99931
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a5d99931
Branch: refs/heads/master
Commit: a5d9993199a51d2d6d6203b7f725b11182c4d632
Parents: ee5d9fd
Author: sboikov <sb...@gridgain.com>
Authored: Sat Nov 28 16:00:50 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Sat Nov 28 16:00:50 2015 +0300
----------------------------------------------------------------------
.../portable/builder/BinaryObjectBuilderImpl.java | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a5d99931/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
index 5c2c713..cadc781 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
@@ -311,10 +311,16 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
String oldFldTypeName = meta == null ? null : meta.fieldTypeName(name);
+ boolean nullObjField = false;
+
int newFldTypeId;
- if (val instanceof PortableValueWithType)
- newFldTypeId = ((PortableValueWithType) val).typeId();
+ if (val instanceof PortableValueWithType) {
+ newFldTypeId = ((PortableValueWithType)val).typeId();
+
+ if (newFldTypeId == GridPortableMarshaller.OBJ && ((PortableValueWithType)val).value() == null)
+ nullObjField = true;
+ }
else
newFldTypeId = PortableUtils.typeByClass(val.getClass());
@@ -327,7 +333,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
fieldsMeta.put(name, PortableUtils.fieldTypeId(newFldTypeName));
}
- else {
+ else if (!nullObjField) {
String objTypeName = PortableUtils.fieldTypeName(GridPortableMarshaller.OBJ);
if (!objTypeName.equals(oldFldTypeName) && !oldFldTypeName.equals(newFldTypeName)) {
[39/50] [abbrv] ignite git commit: Merge branch 'ignite-1.5' of
https://git-wip-us.apache.org/repos/asf/ignite into ignite-1.5
Posted by ra...@apache.org.
Merge branch 'ignite-1.5' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-1.5
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ba28eaf3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ba28eaf3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ba28eaf3
Branch: refs/heads/master
Commit: ba28eaf3808a412036043e419ffeab040afe1486
Parents: 87cbc19 a5d9993
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Sat Nov 28 18:39:59 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Sat Nov 28 18:39:59 2015 +0300
----------------------------------------------------------------------
.../portable/builder/BinaryObjectBuilderImpl.java | 12 +++++++++---
...CacheBinaryObjectsAbstractMultiThreadedSelfTest.java | 8 ++++++++
2 files changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
[23/50] [abbrv] ignite git commit: Fixed IgniteTxRemoteState to
properly process invalid partitions.
Posted by ra...@apache.org.
Fixed IgniteTxRemoteState to properly process invalid partitions.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3080f61a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3080f61a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3080f61a
Branch: refs/heads/master
Commit: 3080f61ae9ca1481d65f18f7a84f8bbc9d682f79
Parents: 722fe14
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 15:24:32 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 15:24:32 2015 +0300
----------------------------------------------------------------------
.../cache/distributed/dht/GridDhtTxRemote.java | 15 +-----------
.../IgniteTxRemoteSingleStateImpl.java | 16 ++++++-------
.../cache/transactions/IgniteTxRemoteState.java | 5 ++++
.../transactions/IgniteTxRemoteStateImpl.java | 24 ++++++++++++++++++++
4 files changed, 37 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3080f61a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java
index e0929ad..85a5759 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java
@@ -279,20 +279,7 @@ public class GridDhtTxRemote extends GridDistributedTxRemoteAdapter {
@Override public void addInvalidPartition(GridCacheContext cacheCtx, int part) {
super.addInvalidPartition(cacheCtx, part);
- Map<IgniteTxKey, IgniteTxEntry> writeMap = txState.writeMap();
-
- for (Iterator<IgniteTxEntry> it = writeMap.values().iterator(); it.hasNext();) {
- IgniteTxEntry e = it.next();
-
- GridCacheEntryEx cached = e.cached();
-
- if (cached != null) {
- if (cached.partition() == part)
- it.remove();
- }
- else if (cacheCtx.affinity().partition(e.key()) == part)
- it.remove();
- }
+ txState.invalidPartition(part);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/3080f61a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteSingleStateImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteSingleStateImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteSingleStateImpl.java
index 90af517..a68006b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteSingleStateImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteSingleStateImpl.java
@@ -65,15 +65,7 @@ public class IgniteTxRemoteSingleStateImpl extends IgniteTxRemoteStateAdapter {
/** {@inheritDoc} */
@Override public Set<IgniteTxKey> writeSet() {
- if (entry != null) {
- HashSet<IgniteTxKey> set = new HashSet<>(3, 0.75f);
-
- set.add(entry.txKey());
-
- return set;
- }
- else
- return Collections.<IgniteTxKey>emptySet();
+ return entry != null ? Collections.singleton(entry.txKey()) : Collections.<IgniteTxKey>emptySet();
}
/** {@inheritDoc} */
@@ -113,6 +105,12 @@ public class IgniteTxRemoteSingleStateImpl extends IgniteTxRemoteStateAdapter {
}
/** {@inheritDoc} */
+ @Override public void invalidPartition(int part) {
+ if (entry != null && entry.context().affinity().partition(entry.key()) == part)
+ entry = null;
+ }
+
+ /** {@inheritDoc} */
public String toString() {
return S.toString(IgniteTxRemoteSingleStateImpl.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3080f61a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteState.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteState.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteState.java
index b8290a1..77fc97e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteState.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteState.java
@@ -31,4 +31,9 @@ public interface IgniteTxRemoteState extends IgniteTxState {
* @param key Entry key.
*/
public void clearEntry(IgniteTxKey key);
+
+ /**
+ * @param part Partition number.
+ */
+ public void invalidPartition(int part);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3080f61a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateImpl.java
index 32bc646..3335b44 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateImpl.java
@@ -18,8 +18,12 @@
package org.apache.ignite.internal.processors.cache.transactions;
import java.util.Collection;
+import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -118,6 +122,26 @@ public class IgniteTxRemoteStateImpl extends IgniteTxRemoteStateAdapter {
}
/** {@inheritDoc} */
+ @Override public void invalidPartition(int part) {
+ if (writeMap != null) {
+ for (Iterator<IgniteTxEntry> it = writeMap.values().iterator(); it.hasNext();) {
+ IgniteTxEntry e = it.next();
+
+ GridCacheContext cacheCtx = e.context();
+
+ GridCacheEntryEx cached = e.cached();
+
+ if (cached != null) {
+ if (cached.partition() == part)
+ it.remove();
+ }
+ else if (cacheCtx.affinity().partition(e.key()) == part)
+ it.remove();
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
public String toString() {
return S.toString(IgniteTxRemoteStateImpl.class, this);
}
[11/50] [abbrv] ignite git commit: IGNITE-1956: Added binary enums
support.
Posted by ra...@apache.org.
IGNITE-1956: Added binary enums support.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/663e78dc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/663e78dc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/663e78dc
Branch: refs/heads/master
Commit: 663e78dc65dcf6d8369f13ef8bf6c4aeacb6299d
Parents: 30c9b8d
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Nov 27 12:37:27 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Nov 27 12:37:27 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/IgniteBinary.java | 9 +
.../org/apache/ignite/binary/BinaryObject.java | 8 +
.../org/apache/ignite/binary/BinaryType.java | 7 +
.../ignite/binary/BinaryTypeConfiguration.java | 21 +
.../communication/GridIoMessageFactory.java | 8 +-
.../internal/portable/BinaryEnumObjectImpl.java | 311 +++++++++++++
.../internal/portable/BinaryMetadata.java | 16 +-
.../internal/portable/BinaryObjectExImpl.java | 5 +
.../internal/portable/BinaryObjectImpl.java | 3 -
.../internal/portable/BinaryTypeImpl.java | 9 +-
.../internal/portable/BinaryWriteMode.java | 3 +
.../internal/portable/BinaryWriterExImpl.java | 19 +
.../portable/PortableClassDescriptor.java | 23 +-
.../internal/portable/PortableContext.java | 39 +-
.../ignite/internal/portable/PortableUtils.java | 147 +++++-
.../builder/BinaryObjectBuilderImpl.java | 2 +-
.../builder/PortableBuilderSerializer.java | 10 +-
.../internal/processors/cache/CacheObject.java | 3 +
.../processors/cache/CacheObjectContext.java | 19 +
.../portable/CacheObjectBinaryProcessor.java | 11 +-
.../CacheObjectBinaryProcessorImpl.java | 18 +-
.../cache/portable/IgniteBinaryImpl.java | 12 +
.../processors/cacheobject/NoOpBinary.java | 5 +
.../platform/PlatformContextImpl.java | 53 ++-
.../transactions/PlatformTransactions.java | 4 +-
.../platform/utils/PlatformUtils.java | 1 +
.../PlatformDotNetBinaryTypeConfiguration.java | 23 +
.../internal/portable/BinaryEnumsSelfTest.java | 446 +++++++++++++++++++
.../portable/BinaryMarshallerSelfTest.java | 37 +-
.../platform/PlatformComputeEchoTask.java | 4 +-
.../IgnitePortableObjectsTestSuite.java | 2 +
.../impl/binary/binary_type_updater_impl.cpp | 4 +-
.../Binary/BinaryBuilderSelfTest.cs | 97 ++--
.../Binary/BinarySelfTest.cs | 48 +-
.../Cache/CacheAbstractTest.cs | 17 +-
.../Compute/ComputeApiTest.cs | 6 +
.../Config/Compute/compute-grid1.xml | 3 +-
.../Config/native-client-test-cache-store.xml | 1 +
.../Services/ServiceProxyTest.cs | 22 +-
.../Apache.Ignite.Core.csproj | 5 +-
.../Binary/BinaryTypeConfiguration.cs | 16 +-
.../dotnet/Apache.Ignite.Core/Binary/IBinary.cs | 136 ++++++
.../Apache.Ignite.Core/Binary/IBinaryObject.cs | 23 +-
.../Apache.Ignite.Core/Binary/IBinaryType.cs | 13 +
.../Apache.Ignite.Core/Binary/IIgniteBinary.cs | 120 -----
.../dotnet/Apache.Ignite.Core/IIgnite.cs | 6 +-
.../Apache.Ignite.Core/Impl/Binary/Binary.cs | 216 +++++++++
.../Impl/Binary/BinaryEnum.cs | 134 ++++++
.../Impl/Binary/BinaryFullTypeDescriptor.cs | 14 +-
.../Impl/Binary/BinaryObject.cs | 29 ++
.../Impl/Binary/BinaryObjectBuilder.cs | 44 +-
.../Impl/Binary/BinaryReader.cs | 51 ++-
.../Binary/BinarySurrogateTypeDescriptor.cs | 6 +
.../Impl/Binary/BinarySystemHandlers.cs | 34 +-
.../Impl/Binary/BinaryUtils.cs | 96 ++--
.../Impl/Binary/BinaryWriter.cs | 104 +++--
.../Impl/Binary/IBinaryTypeDescriptor.cs | 50 +--
.../Impl/Binary/IgniteBinary.cs | 192 --------
.../Impl/Binary/Marshaller.cs | 88 ++--
.../Impl/Binary/Metadata/BinaryType.cs | 184 ++++----
.../Impl/Binary/Metadata/BinaryTypeHolder.cs | 34 +-
.../Binary/Structure/BinaryStructureTracker.cs | 2 +-
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 11 +-
.../Apache.Ignite.Core/Impl/IgniteProxy.cs | 2 +-
.../Apache.Ignite.Core/Impl/PlatformTarget.cs | 11 +-
.../Impl/Transactions/TransactionsImpl.cs | 4 +-
.../examples/Config/example-cache-query.xml | 9 +-
.../dotnet/examples/Config/example-cache.xml | 9 +-
68 files changed, 2354 insertions(+), 765 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java b/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java
index 30db9d9..a1c656b 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java
@@ -351,4 +351,13 @@ public interface IgniteBinary {
* @throws org.apache.ignite.binary.BinaryObjectException In case of error.
*/
public Collection<BinaryType> types() throws BinaryObjectException;
+
+ /**
+ * Create enum object.
+ *
+ * @param typeName Type name.
+ * @param ord Ordinal.
+ * @return Enum object.
+ */
+ public BinaryObject buildEnum(String typeName, int ord);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/binary/BinaryObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/binary/BinaryObject.java b/modules/core/src/main/java/org/apache/ignite/binary/BinaryObject.java
index 249daab..f4afd8d 100644
--- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryObject.java
+++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryObject.java
@@ -139,4 +139,12 @@ public interface BinaryObject extends Serializable, Cloneable {
* @return Copy of this binary object.
*/
public BinaryObject clone() throws CloneNotSupportedException;
+
+ /**
+ * Get ordinal for this enum object. Use {@link BinaryType#isEnum()} to check if object is of enum type.
+ *
+ * @return Ordinal.
+ * @throws BinaryObjectException If object is not enum.
+ */
+ public int enumOrdinal() throws BinaryObjectException;
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/binary/BinaryType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/binary/BinaryType.java b/modules/core/src/main/java/org/apache/ignite/binary/BinaryType.java
index debd7e5..f184a8c 100644
--- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryType.java
+++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryType.java
@@ -72,4 +72,11 @@ public interface BinaryType {
* @return Affinity key field name.
*/
public String affinityKeyFieldName();
+
+ /**
+ * Check whether type represents enum or not.
+ *
+ * @return {@code True} if type is enum.
+ */
+ public boolean isEnum();
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/binary/BinaryTypeConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/binary/BinaryTypeConfiguration.java b/modules/core/src/main/java/org/apache/ignite/binary/BinaryTypeConfiguration.java
index d216866..a694eaf 100644
--- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryTypeConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryTypeConfiguration.java
@@ -38,6 +38,9 @@ public class BinaryTypeConfiguration {
/** Serializer. */
private BinarySerializer serializer;
+ /** Enum flag. */
+ private boolean isEnum;
+
/**
*/
public BinaryTypeConfiguration() {
@@ -105,6 +108,24 @@ public class BinaryTypeConfiguration {
this.serializer = serializer;
}
+ /**
+ * Gets whether this is enum type.
+ *
+ * @return {@code True} if enum.
+ */
+ public boolean isEnum() {
+ return isEnum;
+ }
+
+ /**
+ * Sets whether this is enum type.
+ *
+ * @param isEnum {@code True} if enum.
+ */
+ public void setEnum(boolean isEnum) {
+ this.isEnum = isEnum;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(BinaryTypeConfiguration.class, this, super.toString());
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 02bd5ec..c9b8e27 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -31,6 +31,7 @@ import org.apache.ignite.internal.managers.deployment.GridDeploymentInfoBean;
import org.apache.ignite.internal.managers.deployment.GridDeploymentRequest;
import org.apache.ignite.internal.managers.deployment.GridDeploymentResponse;
import org.apache.ignite.internal.managers.eventstorage.GridEventStorageMessage;
+import org.apache.ignite.internal.portable.BinaryEnumObjectImpl;
import org.apache.ignite.internal.portable.BinaryObjectImpl;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheEntryInfoCollection;
@@ -714,7 +715,12 @@ public class GridIoMessageFactory implements MessageFactory {
break;
- // [-3..118] - this
+ case 119:
+ msg = new BinaryEnumObjectImpl();
+
+ break;
+
+ // [-3..119] - this
// [120..123] - DR
// [-4..-22] - SQL
default:
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryEnumObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryEnumObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryEnumObjectImpl.java
new file mode 100644
index 0000000..e13c076
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryEnumObjectImpl.java
@@ -0,0 +1,311 @@
+/*
+ * 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.portable;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryType;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.internal.processors.cache.portable.CacheObjectBinaryProcessorImpl;
+import org.apache.ignite.internal.util.typedef.internal.SB;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.nio.ByteBuffer;
+
+/**
+ * Binary enum object.
+ */
+public class BinaryEnumObjectImpl implements BinaryObjectEx, Externalizable, CacheObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Context. */
+ @GridDirectTransient
+ private PortableContext ctx;
+
+ /** Type ID. */
+ private int typeId;
+
+ /** Raw data. */
+ private String clsName;
+
+ /** Ordinal. */
+ private int ord;
+
+ /**
+ * {@link Externalizable} support.
+ */
+ public BinaryEnumObjectImpl() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param ctx Context.
+ * @param typeId Type ID.
+ * @param clsName Class name.
+ * @param ord Ordinal.
+ */
+ public BinaryEnumObjectImpl(PortableContext ctx, int typeId, @Nullable String clsName, int ord) {
+ assert ctx != null;
+
+ this.ctx = ctx;
+ this.typeId = typeId;
+ this.clsName = clsName;
+ this.ord = ord;
+ }
+
+ /**
+ * @return Class name.
+ */
+ @Nullable public String className() {
+ return clsName;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int typeId() {
+ return typeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public BinaryType type() throws BinaryObjectException {
+ return ctx.metadata(typeId());
+ }
+
+ /** {@inheritDoc} */
+ @Override public <F> F field(String fieldName) throws BinaryObjectException {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean hasField(String fieldName) {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public <T> T deserialize() throws BinaryObjectException {
+ Class cls = PortableUtils.resolveClass(ctx, typeId, clsName, null);
+
+ return BinaryEnumCache.get(cls, ord);
+ }
+
+ /** {@inheritDoc} */
+ @Override public BinaryObject clone() throws CloneNotSupportedException {
+ return (BinaryObject)super.clone();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int enumOrdinal() throws BinaryObjectException {
+ return ord;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return 31 * typeId + ord;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object obj) {
+ if (obj != null && (obj instanceof BinaryEnumObjectImpl)) {
+ BinaryEnumObjectImpl other = (BinaryEnumObjectImpl)obj;
+
+ return typeId == other.typeId && ord == other.ord;
+ }
+
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ // 1. Try deserializing the object.
+ try {
+ Object val = deserialize();
+
+ return new SB().a(val).toString();
+ }
+ catch (Exception e) {
+ // No-op.
+ }
+
+ // 2. Try getting meta.
+ BinaryType type;
+
+ try {
+ type = type();
+ }
+ catch (Exception e) {
+ type = null;
+ }
+
+ if (type != null) {
+ return type.typeName() + "[ordinal=" + ord + ']';
+ }
+ else {
+ if (typeId == GridPortableMarshaller.UNREGISTERED_TYPE_ID)
+ return "BinaryEnum[clsName=" + clsName + ", ordinal=" + ord + ']';
+ else
+ return "BinaryEnum[typeId=" + typeId + ", ordinal=" + ord + ']';
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(ctx);
+
+ out.writeInt(typeId);
+ out.writeObject(clsName);
+ out.writeInt(ord);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ ctx = (PortableContext)in.readObject();
+
+ typeId = in.readInt();
+ clsName = (String)in.readObject();
+ ord = in.readInt();
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public <T> T value(CacheObjectContext ctx, boolean cpy) {
+ return deserialize();
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte[] valueBytes(CacheObjectContext cacheCtx) throws IgniteCheckedException {
+ return ctx.marshaller().marshal(this);
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte cacheObjectType() {
+ return TYPE_BINARY;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isPlatformType() {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public CacheObject prepareForCache(CacheObjectContext ctx) {
+ return this;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(CacheObjectContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+ this.ctx = ((CacheObjectBinaryProcessorImpl)ctx.processor()).portableContext();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void prepareMarshal(CacheObjectContext ctx) throws IgniteCheckedException {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 119;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 3;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 0:
+ if (!writer.writeString("clsName", clsName))
+ return false;
+
+ writer.incrementState();
+
+ case 1:
+ if (!writer.writeInt("ord", ord))
+ return false;
+
+ writer.incrementState();
+
+ case 2:
+ if (!writer.writeInt("typeId", typeId))
+ return false;
+
+ writer.incrementState();
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ switch (reader.state()) {
+ case 0:
+ clsName = reader.readString("clsName");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 1:
+ ord = reader.readInt("ord");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 2:
+ typeId = reader.readInt("typeId");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ }
+
+ return reader.afterMessageRead(BinaryEnumObjectImpl.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadata.java
index a464d6e..8ba2e23 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadata.java
@@ -52,6 +52,9 @@ public class BinaryMetadata implements Externalizable {
/** Schemas associated with type. */
private Collection<PortableSchema> schemas;
+ /** Whether this is enum type. */
+ private boolean isEnum;
+
/**
* For {@link Externalizable}.
*/
@@ -67,9 +70,10 @@ public class BinaryMetadata implements Externalizable {
* @param fields Fields map.
* @param affKeyFieldName Affinity key field name.
* @param schemas Schemas.
+ * @param isEnum Enum flag.
*/
public BinaryMetadata(int typeId, String typeName, @Nullable Map<String, Integer> fields,
- @Nullable String affKeyFieldName, @Nullable Collection<PortableSchema> schemas) {
+ @Nullable String affKeyFieldName, @Nullable Collection<PortableSchema> schemas, boolean isEnum) {
assert typeName != null;
this.typeId = typeId;
@@ -77,6 +81,7 @@ public class BinaryMetadata implements Externalizable {
this.fields = fields;
this.affKeyFieldName = affKeyFieldName;
this.schemas = schemas;
+ this.isEnum = isEnum;
}
/**
@@ -132,6 +137,13 @@ public class BinaryMetadata implements Externalizable {
}
/**
+ * @return {@code True} if this is enum type.
+ */
+ public boolean isEnum() {
+ return isEnum;
+ }
+
+ /**
* Wrap metadata into binary type.
*
* @param ctx Portable context.
@@ -148,6 +160,7 @@ public class BinaryMetadata implements Externalizable {
U.writeMap(out, fields);
U.writeString(out, affKeyFieldName);
U.writeCollection(out, schemas);
+ out.writeBoolean(isEnum);
}
/** {@inheritDoc} */
@@ -157,6 +170,7 @@ public class BinaryMetadata implements Externalizable {
fields = U.readMap(in);
affKeyFieldName = U.readString(in);
schemas = U.readCollection(in);
+ isEnum = in.readBoolean();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java
index 7497bd3..2ea71ec 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectExImpl.java
@@ -66,6 +66,11 @@ public abstract class BinaryObjectExImpl implements BinaryObjectEx {
*/
@Nullable public abstract <F> F field(int fieldId) throws BinaryObjectException;
+ /** {@inheritDoc} */
+ @Override public int enumOrdinal() throws BinaryObjectException {
+ throw new BinaryObjectException("Object is not enum.");
+ }
+
/**
* Get field by offset.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
index f683ed9..87a03dc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
@@ -66,9 +66,6 @@ import static org.apache.ignite.internal.portable.GridPortableMarshaller.UUID;
@IgniteCodeGeneratingFail // Fields arr and start should not be generated by MessageCodeGenerator.
public final class BinaryObjectImpl extends BinaryObjectExImpl implements Externalizable, KeyCacheObject {
/** */
- public static final byte TYPE_BINARY = 100;
-
- /** */
private static final long serialVersionUID = 0L;
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
index c3fee7e..9512cdb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
@@ -72,9 +72,12 @@ public class BinaryTypeImpl implements BinaryType {
return meta.affinityKeyFieldName();
}
- /**
- * @return Portable context.
- */
+ /** {@inheritDoc} */
+ @Override public boolean isEnum() {
+ return meta.isEnum();
+ }
+
+ /** {@inheritDoc} */
public PortableContext context() {
return ctx;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriteMode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriteMode.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriteMode.java
index a26b741..bd73ad0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriteMode.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriteMode.java
@@ -141,6 +141,9 @@ public enum BinaryWriteMode {
/** */
ENUM(GridPortableMarshaller.ENUM),
+ /** Portable enum. */
+ PORTABLE_ENUM(GridPortableMarshaller.ENUM),
+
/** */
ENUM_ARR(GridPortableMarshaller.ENUM_ARR),
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
index ec47f57..9d1d037 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
@@ -803,6 +803,25 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
}
/**
+ * @param val Value.
+ */
+ void doWritePortableEnum(BinaryEnumObjectImpl val) {
+ assert val != null;
+
+ int typeId = val.typeId();
+
+ out.unsafeEnsure(1 + 4);
+
+ out.unsafeWriteByte(ENUM);
+ out.unsafeWriteInt(typeId);
+
+ if (typeId == UNREGISTERED_TYPE_ID)
+ doWriteString(val.className());
+
+ out.writeInt(val.enumOrdinal());
+ }
+
+ /**
* @param val Array.
*/
void doWriteEnumArray(@Nullable Object[] val) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
index fa6ea3a..dba15f5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
@@ -161,8 +161,12 @@ public class PortableClassDescriptor {
if (excluded)
mode = BinaryWriteMode.EXCLUSION;
- else
- mode = serializer != null ? BinaryWriteMode.PORTABLE : PortableUtils.mode(cls);
+ else {
+ if (cls == BinaryEnumObjectImpl.class)
+ mode = BinaryWriteMode.PORTABLE_ENUM;
+ else
+ mode = serializer != null ? BinaryWriteMode.PORTABLE : PortableUtils.mode(cls);
+ }
switch (mode) {
case P_BYTE:
@@ -205,6 +209,7 @@ public class PortableClassDescriptor {
case MAP_ENTRY:
case PORTABLE_OBJ:
case ENUM:
+ case PORTABLE_ENUM:
case ENUM_ARR:
case CLASS:
case EXCLUSION:
@@ -286,6 +291,13 @@ public class PortableClassDescriptor {
}
/**
+ * @return {@code True} if enum.
+ */
+ boolean isEnum() {
+ return mode == BinaryWriteMode.ENUM;
+ }
+
+ /**
* @return Described class.
*/
Class<?> describedClass() {
@@ -534,6 +546,11 @@ public class PortableClassDescriptor {
break;
+ case PORTABLE_ENUM:
+ writer.doWritePortableEnum((BinaryEnumObjectImpl)obj);
+
+ break;
+
case ENUM_ARR:
writer.doWriteEnumArray((Object[])obj);
@@ -576,7 +593,7 @@ public class PortableClassDescriptor {
PortableSchema newSchema = collector.schema();
BinaryMetadata meta = new BinaryMetadata(typeId, typeName, collector.meta(),
- affKeyFieldName, Collections.singleton(newSchema));
+ affKeyFieldName, Collections.singleton(newSchema), false);
ctx.updateMetadata(typeId, meta);
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
index ab96ed1..ae0d940 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
@@ -117,6 +117,9 @@ public class PortableContext implements Externalizable {
/** */
private BinaryMetadataHandler metaHnd;
+ /** Actual marshaller. */
+ private BinaryMarshaller marsh;
+
/** */
private MarshallerContext marshCtx;
@@ -222,6 +225,13 @@ public class PortableContext implements Externalizable {
}
/**
+ * @return Marshaller.
+ */
+ public BinaryMarshaller marshaller() {
+ return marsh;
+ }
+
+ /**
* @param marsh Portable marshaller.
* @throws org.apache.ignite.binary.BinaryObjectException In case of error.
*/
@@ -229,6 +239,8 @@ public class PortableContext implements Externalizable {
if (marsh == null)
return;
+ this.marsh = marsh;
+
marshCtx = marsh.getContext();
BinaryConfiguration binaryCfg = cfg.getBinaryConfiguration();
@@ -293,16 +305,16 @@ public class PortableContext implements Externalizable {
for (String clsName0 : classesInPackage(pkgName))
descs.add(clsName0, idMapper, serializer, affFields.get(clsName0),
- true);
+ typeCfg.isEnum(), true);
}
else
descs.add(clsName, idMapper, serializer, affFields.get(clsName),
- false);
+ typeCfg.isEnum(), false);
}
}
for (TypeDescriptor desc : descs.descriptors()) {
- registerUserType(desc.clsName, desc.idMapper, desc.serializer, desc.affKeyFieldName);
+ registerUserType(desc.clsName, desc.idMapper, desc.serializer, desc.affKeyFieldName, desc.isEnum);
}
BinaryInternalIdMapper dfltMapper = BinaryInternalIdMapper.create(globalIdMapper);
@@ -535,7 +547,8 @@ public class PortableContext implements Externalizable {
Collection<PortableSchema> schemas = desc.schema() != null ? Collections.singleton(desc.schema()) : null;
- metaHnd.addMeta(typeId, new BinaryMetadata(typeId, typeName, desc.fieldsMeta(), affFieldName, schemas).wrap(this));
+ metaHnd.addMeta(typeId,
+ new BinaryMetadata(typeId, typeName, desc.fieldsMeta(), affFieldName, schemas, desc.isEnum()).wrap(this));
// perform put() instead of putIfAbsent() because "registered" flag might have been changed or class loader
// might have reloaded described class.
@@ -628,7 +641,7 @@ public class PortableContext implements Externalizable {
* @return Affinity field name or {@code null} if field name was not found.
*/
private String affinityFieldName(Class cls) {
- for (; cls != Object.class; cls = cls.getSuperclass()) {
+ for (; cls != Object.class && cls != null; cls = cls.getSuperclass()) {
for (Field f : cls.getDeclaredFields()) {
if (f.getAnnotation(AffinityKeyMapped.class) != null)
return f.getName();
@@ -701,13 +714,15 @@ public class PortableContext implements Externalizable {
* @param idMapper ID mapper.
* @param serializer Serializer.
* @param affKeyFieldName Affinity key field name.
+ * @param isEnum If enum.
* @throws org.apache.ignite.binary.BinaryObjectException In case of error.
*/
@SuppressWarnings("ErrorNotRethrown")
public void registerUserType(String clsName,
BinaryIdMapper idMapper,
@Nullable BinarySerializer serializer,
- @Nullable String affKeyFieldName)
+ @Nullable String affKeyFieldName,
+ boolean isEnum)
throws BinaryObjectException {
assert idMapper != null;
@@ -765,7 +780,7 @@ public class PortableContext implements Externalizable {
descByCls.put(cls, desc);
}
- metaHnd.addMeta(id, new BinaryMetadata(id, typeName, fieldsMeta, affKeyFieldName, schemas).wrap(this));
+ metaHnd.addMeta(id, new BinaryMetadata(id, typeName, fieldsMeta, affKeyFieldName, schemas, isEnum).wrap(this));
}
/**
@@ -940,6 +955,7 @@ public class PortableContext implements Externalizable {
* @param idMapper ID mapper.
* @param serializer Serializer.
* @param affKeyFieldName Affinity key field name.
+ * @param isEnum Enum flag.
* @param canOverride Whether this descriptor can be override.
* @throws org.apache.ignite.binary.BinaryObjectException If failed.
*/
@@ -947,12 +963,14 @@ public class PortableContext implements Externalizable {
BinaryIdMapper idMapper,
BinarySerializer serializer,
String affKeyFieldName,
+ boolean isEnum,
boolean canOverride)
throws BinaryObjectException {
TypeDescriptor desc = new TypeDescriptor(clsName,
idMapper,
serializer,
affKeyFieldName,
+ isEnum,
canOverride);
TypeDescriptor oldDesc = descs.get(clsName);
@@ -989,6 +1007,9 @@ public class PortableContext implements Externalizable {
/** Affinity key field name. */
private String affKeyFieldName;
+ /** Enum flag. */
+ private boolean isEnum;
+
/** Whether this descriptor can be override. */
private boolean canOverride;
@@ -999,14 +1020,16 @@ public class PortableContext implements Externalizable {
* @param idMapper ID mapper.
* @param serializer Serializer.
* @param affKeyFieldName Affinity key field name.
+ * @param isEnum Enum type.
* @param canOverride Whether this descriptor can be override.
*/
private TypeDescriptor(String clsName, BinaryIdMapper idMapper, BinarySerializer serializer,
- String affKeyFieldName, boolean canOverride) {
+ String affKeyFieldName, boolean isEnum, boolean canOverride) {
this.clsName = clsName;
this.idMapper = idMapper;
this.serializer = serializer;
this.affKeyFieldName = affKeyFieldName;
+ this.isEnum = isEnum;
this.canOverride = canOverride;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
index a83405d..e543c41 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
@@ -877,6 +877,16 @@ public class PortableUtils {
);
}
+ // Check enum flag.
+ if (oldMeta.isEnum() != newMeta.isEnum()) {
+ if (oldMeta.isEnum())
+ throw new BinaryObjectException("Binary type already registered as enum: " +
+ newMeta.typeName());
+ else
+ throw new BinaryObjectException("Binary type already registered as non-enum: " +
+ newMeta.typeName());
+ }
+
// Check and merge fields.
boolean changed = false;
@@ -908,7 +918,7 @@ public class PortableUtils {
// Return either old meta if no changes detected, or new merged meta.
return changed ? new BinaryMetadata(oldMeta.typeId(), oldMeta.typeName(), mergedFields,
- oldMeta.affinityKeyFieldName(), mergedSchemas) : oldMeta;
+ oldMeta.affinityKeyFieldName(), mergedSchemas, oldMeta.isEnum()) : oldMeta;
}
}
@@ -1314,6 +1324,37 @@ public class PortableUtils {
}
/**
+ * Read plain type.
+ *
+ * @param in Input stream.
+ * @return Plain type.
+ */
+ private static EnumType doReadEnumType(PortableInputStream in) {
+ int typeId = in.readInt();
+
+ if (typeId != UNREGISTERED_TYPE_ID)
+ return new EnumType(typeId, null);
+ else {
+ String clsName = doReadClassName(in);
+
+ return new EnumType(UNREGISTERED_TYPE_ID, clsName);
+ }
+ }
+
+ /**
+ * @param in Input stream.
+ * @return Class name.
+ */
+ private static String doReadClassName(PortableInputStream in) {
+ byte flag = in.readByte();
+
+ if (flag != STRING)
+ throw new BinaryObjectException("Failed to read class name [position=" + (in.position() - 1) + ']');
+
+ return doReadString(in);
+ }
+
+ /**
* @param typeId Type id.
* @return Value.
*/
@@ -1327,13 +1368,41 @@ public class PortableUtils {
if (typeId != UNREGISTERED_TYPE_ID)
cls = ctx.descriptorForTypeId(true, typeId, ldr).describedClass();
else {
- byte flag = in.readByte();
+ String clsName = doReadClassName(in);
+
+ try {
+ cls = U.forName(clsName, ldr);
+ }
+ catch (ClassNotFoundException e) {
+ throw new BinaryInvalidTypeException("Failed to load the class: " + clsName, e);
+ }
- if (flag != STRING)
- throw new BinaryObjectException("No class definition for typeId: " + typeId);
+ // forces registering of class by type id, at least locally
+ ctx.descriptorForClass(cls);
+ }
+
+ return cls;
+ }
+
+ /**
+ * Resolve the class.
+ *
+ * @param ctx Portable context.
+ * @param typeId Type ID.
+ * @param clsName Class name.
+ * @param ldr Class loaded.
+ * @return Resovled class.
+ */
+ public static Class resolveClass(PortableContext ctx, int typeId, @Nullable String clsName,
+ @Nullable ClassLoader ldr) {
+ Class cls;
- String clsName = doReadString(in);
+ if (typeId == OBJECT_TYPE_ID)
+ return Object.class;
+ if (typeId != UNREGISTERED_TYPE_ID)
+ cls = ctx.descriptorForTypeId(true, typeId, ldr).describedClass();
+ else {
try {
cls = U.forName(clsName, ldr);
}
@@ -1349,6 +1418,43 @@ public class PortableUtils {
}
/**
+ * Read portable enum.
+ *
+ * @param in Input stream.
+ * @param ctx Portable context.
+ * @param type Plain type.
+ * @return Enum.
+ */
+ private static BinaryEnumObjectImpl doReadPortableEnum(PortableInputStream in, PortableContext ctx,
+ EnumType type) {
+ return new BinaryEnumObjectImpl(ctx, type.typeId, type.clsName, in.readInt());
+ }
+
+ /**
+ * Read portable enum array.
+ *
+ * @param in Input stream.
+ * @param ctx Portable context.
+ * @return Enum array.
+ */
+ private static Object[] doReadPortableEnumArray(PortableInputStream in, PortableContext ctx) {
+ int len = in.readInt();
+
+ Object[] arr = (Object[]) Array.newInstance(BinaryObject.class, len);
+
+ for (int i = 0; i < len; i++) {
+ byte flag = in.readByte();
+
+ if (flag == NULL)
+ arr[i] = null;
+ else
+ arr[i] = doReadPortableEnum(in, ctx, doReadEnumType(in));
+ }
+
+ return arr;
+ }
+
+ /**
* Having target class in place we simply read ordinal and create final representation.
*
* @param cls Enum class.
@@ -1589,10 +1695,12 @@ public class PortableUtils {
return doReadPortableObject(in, ctx);
case ENUM:
- return doReadEnum(in, doReadClass(in, ctx, ldr));
+ return doReadPortableEnum(in, ctx, doReadEnumType(in));
case ENUM_ARR:
- return doReadEnumArray(in, ctx, ldr, doReadClass(in, ctx, ldr));
+ doReadEnumType(in); // Simply skip this part as we do not need it.
+
+ return doReadPortableEnumArray(in, ctx);
case CLASS:
return doReadClass(in, ctx, ldr);
@@ -1843,4 +1951,29 @@ public class PortableUtils {
public static int positionForHandle(PortableInputStream in) {
return in.position() - 1;
}
+
+ /**
+ * Enum type.
+ */
+ private static class EnumType {
+ /** Type ID. */
+ private final int typeId;
+
+ /** Class name. */
+ private final String clsName;
+
+ /**
+ * Constructor.
+ *
+ * @param typeId Type ID.
+ * @param clsName Class name.
+ */
+ public EnumType(int typeId, @Nullable String clsName) {
+ assert typeId != UNREGISTERED_TYPE_ID && clsName == null ||
+ typeId == UNREGISTERED_TYPE_ID && clsName != null;
+
+ this.typeId = typeId;
+ this.clsName = clsName;
+ }
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
index d330c72..5c2c713 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
@@ -377,7 +377,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
PortableSchema curSchema = writer.currentSchema();
ctx.updateMetadata(typeId, new BinaryMetadata(typeId, typeName, fieldsMeta,
- ctx.affinityKeyFieldName(typeId), Collections.singleton(curSchema)));
+ ctx.affinityKeyFieldName(typeId), Collections.singleton(curSchema), false));
schemaReg.addSchema(curSchema.schemaId(), curSchema);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
index ee7bd65..52f84c6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
@@ -18,8 +18,10 @@
package org.apache.ignite.internal.portable.builder;
import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.internal.portable.BinaryMetadata;
import org.apache.ignite.internal.portable.GridPortableMarshaller;
import org.apache.ignite.internal.portable.BinaryObjectExImpl;
+import org.apache.ignite.internal.portable.PortableContext;
import org.apache.ignite.internal.portable.PortableUtils;
import org.apache.ignite.internal.portable.BinaryWriterExImpl;
import org.apache.ignite.internal.util.*;
@@ -97,8 +99,14 @@ class PortableBuilderSerializer {
}
if (val.getClass().isEnum()) {
+ String typeName = PortableContext.typeName(val.getClass().getName());
+ int typeId = writer.context().typeId(typeName);
+
+ BinaryMetadata meta = new BinaryMetadata(typeId, typeName, null, null, null, true);
+ writer.context().updateMetadata(typeId, meta);
+
writer.writeByte(GridPortableMarshaller.ENUM);
- writer.writeInt(writer.context().typeId(val.getClass().getName()));
+ writer.writeInt(typeId);
writer.writeInt(((Enum)val).ordinal());
return;
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObject.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObject.java
index 81129bd..2385335 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObject.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObject.java
@@ -31,6 +31,9 @@ public interface CacheObject extends Message {
/** */
public static final byte TYPE_BYTE_ARR = 2;
+ /** */
+ public static final byte TYPE_BINARY = 100;
+
/**
* @param ctx Context.
* @param cpy If {@code true} need to copy value.
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
index b4ac5f4..b99c99f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
@@ -176,6 +176,23 @@ import org.apache.ignite.internal.util.typedef.F;
}
/**
+ * Unwrap array of portables if needed.
+ *
+ * @param arr Array.
+ * @param keepPortable Keep portable flag.
+ * @param cpy Copy.
+ * @return Result.
+ */
+ public Object[] unwrapPortablesInArrayIfNeeded(Object[] arr, boolean keepPortable, boolean cpy) {
+ Object[] res = new Object[arr.length];
+
+ for (int i = 0; i < arr.length; i++)
+ res[i] = unwrapPortable(arr[i], keepPortable, cpy);
+
+ return res;
+ }
+
+ /**
* Unwraps map.
*
* @param map Map to unwrap.
@@ -252,6 +269,8 @@ import org.apache.ignite.internal.util.typedef.F;
return unwrapPortablesIfNeeded((Collection<Object>)o, keepPortable, cpy);
else if (o instanceof Map)
return unwrapPortablesIfNeeded((Map<Object, Object>)o, keepPortable, cpy);
+ else if (o instanceof Object[])
+ return unwrapPortablesInArrayIfNeeded((Object[])o, keepPortable, cpy);
else if (o instanceof CacheObject) {
CacheObject co = (CacheObject)o;
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessor.java
index e4db77c..7ef4b91 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessor.java
@@ -57,10 +57,11 @@ public interface CacheObjectBinaryProcessor extends IgniteCacheObjectProcessor {
* @param typeName Type name.
* @param affKeyFieldName Affinity key field name.
* @param fieldTypeIds Fields map.
+ * @param isEnum Enum flag.
* @throws IgniteException In case of error.
*/
public void updateMetadata(int typeId, String typeName, @Nullable String affKeyFieldName,
- Map<String, Integer> fieldTypeIds) throws IgniteException;
+ Map<String, Integer> fieldTypeIds, boolean isEnum) throws IgniteException;
/**
* @param typeId Type ID.
@@ -83,6 +84,14 @@ public interface CacheObjectBinaryProcessor extends IgniteCacheObjectProcessor {
public Collection<BinaryType> metadata() throws IgniteException;
/**
+ * @param typeName Type name.
+ * @param ord ordinal.
+ * @return Enum object.
+ * @throws IgniteException If failed.
+ */
+ public BinaryObject buildEnum(String typeName, int ord) throws IgniteException;
+
+ /**
* @return Portables interface.
* @throws IgniteException If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
index eef39be..5b70f2a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
@@ -30,6 +30,7 @@ import org.apache.ignite.cluster.ClusterTopologyException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.portable.BinaryEnumObjectImpl;
import org.apache.ignite.internal.portable.BinaryMetadata;
import org.apache.ignite.internal.portable.BinaryMetadataHandler;
import org.apache.ignite.internal.portable.BinaryObjectEx;
@@ -467,8 +468,10 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
/** {@inheritDoc} */
@Override public void updateMetadata(int typeId, String typeName, @Nullable String affKeyFieldName,
- Map<String, Integer> fieldTypeIds) throws BinaryObjectException {
- portableCtx.updateMetadata(typeId, new BinaryMetadata(typeId, typeName, fieldTypeIds, affKeyFieldName, null));
+ Map<String, Integer> fieldTypeIds, boolean isEnum) throws BinaryObjectException {
+ BinaryMetadata meta = new BinaryMetadata(typeId, typeName, fieldTypeIds, affKeyFieldName, null, isEnum);
+
+ portableCtx.updateMetadata(typeId, meta);
}
/** {@inheritDoc} */
@@ -555,6 +558,17 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
}
/** {@inheritDoc} */
+ @Override public BinaryObject buildEnum(String typeName, int ord) throws IgniteException {
+ typeName = PortableContext.typeName(typeName);
+
+ int typeId = portableCtx.typeId(typeName);
+
+ updateMetadata(typeId, typeName, null, null, true);
+
+ return new BinaryEnumObjectImpl(portableCtx, typeId, null, ord);
+ }
+
+ /** {@inheritDoc} */
@Override public IgniteBinary binary() throws IgniteException {
return portables;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgniteBinaryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgniteBinaryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgniteBinaryImpl.java
index 41aa68c..7008502 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgniteBinaryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgniteBinaryImpl.java
@@ -143,6 +143,18 @@ public class IgniteBinaryImpl implements IgniteBinary {
}
}
+ /** {@inheritDoc} */
+ @Override public BinaryObject buildEnum(String typeName, int ord) {
+ guard();
+
+ try {
+ return proc.buildEnum(typeName, ord);
+ }
+ finally {
+ unguard();
+ }
+ }
+
/**
* @return Portable processor.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/NoOpBinary.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/NoOpBinary.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/NoOpBinary.java
index 252baed..80e7b39 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/NoOpBinary.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/NoOpBinary.java
@@ -69,6 +69,11 @@ public class NoOpBinary implements IgniteBinary {
}
/** {@inheritDoc} */
+ @Override public BinaryObject buildEnum(String typeName, int ord) {
+ throw unsupported();
+ }
+
+ /** {@inheritDoc} */
private BinaryObjectException unsupported() {
return new BinaryObjectException("Binary marshaller is not configured.");
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
index 7db752a..71f42e2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
@@ -69,7 +69,6 @@ import org.apache.ignite.internal.processors.platform.utils.PlatformReaderBiClos
import org.apache.ignite.internal.processors.platform.utils.PlatformReaderClosure;
import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.T4;
import org.apache.ignite.lang.IgniteBiTuple;
import org.jetbrains.annotations.Nullable;
@@ -341,9 +340,9 @@ public class PlatformContextImpl implements PlatformContext {
/** {@inheritDoc} */
@SuppressWarnings("ConstantConditions")
@Override public void processMetadata(BinaryRawReaderEx reader) {
- Collection<T4<Integer, String, String, Map<String, Integer>>> metas = PlatformUtils.readCollection(reader,
- new PlatformReaderClosure<T4<Integer, String, String, Map<String, Integer>>>() {
- @Override public T4<Integer, String, String, Map<String, Integer>> read(BinaryRawReaderEx reader) {
+ Collection<Metadata> metas = PlatformUtils.readCollection(reader,
+ new PlatformReaderClosure<Metadata>() {
+ @Override public Metadata read(BinaryRawReaderEx reader) {
int typeId = reader.readInt();
String typeName = reader.readString();
String affKey = reader.readString();
@@ -355,13 +354,15 @@ public class PlatformContextImpl implements PlatformContext {
}
});
- return new T4<>(typeId, typeName, affKey, fields);
+ boolean isEnum = reader.readBoolean();
+
+ return new Metadata(typeId, typeName, affKey, fields, isEnum);
}
}
);
- for (T4<Integer, String, String, Map<String, Integer>> meta : metas)
- cacheObjProc.updateMetadata(meta.get1(), meta.get2(), meta.get3(), meta.get4());
+ for (Metadata meta : metas)
+ cacheObjProc.updateMetadata(meta.typeId, meta.typeName, meta.affKey, meta.fields, meta.isEnum);
}
/** {@inheritDoc} */
@@ -398,6 +399,7 @@ public class PlatformContextImpl implements PlatformContext {
writer.writeString(meta.typeName());
writer.writeString(meta.affinityKeyFieldName());
writer.writeMap(fields);
+ writer.writeBoolean(meta.isEnum());
}
}
@@ -615,4 +617,41 @@ public class PlatformContextImpl implements PlatformContext {
@Override public PlatformClusterNodeFilter createClusterNodeFilter(Object filter) {
return new PlatformClusterNodeFilterImpl(filter, this);
}
+
+ /**
+ * Metadata holder.
+ */
+ private static class Metadata {
+ /** Type ID. */
+ private final int typeId;
+
+ /** Type name. */
+ private final String typeName;
+
+ /** Affinity key. */
+ private final String affKey;
+
+ /** Fields map. */
+ private final Map<String, Integer> fields;
+
+ /** Enum flag. */
+ private final boolean isEnum;
+
+ /**
+ * Constructor.
+ *
+ * @param typeId Type ID.
+ * @param typeName Type name.
+ * @param affKey Affinity key.
+ * @param fields Fields.
+ * @param isEnum Enum flag.
+ */
+ public Metadata(int typeId, String typeName, String affKey, Map<String, Integer> fields, boolean isEnum) {
+ this.typeId = typeId;
+ this.typeName = typeName;
+ this.affKey = affKey;
+ this.fields = fields;
+ this.isEnum = isEnum;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java
index 5f5f5c3..d97e071 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java
@@ -236,8 +236,8 @@ public class PlatformTransactions extends PlatformAbstractTarget {
case OP_CACHE_CONFIG_PARAMETERS:
TransactionConfiguration txCfg = platformCtx.kernalContext().config().getTransactionConfiguration();
- writer.writeEnum(txCfg.getDefaultTxConcurrency());
- writer.writeEnum(txCfg.getDefaultTxIsolation());
+ writer.writeInt(txCfg.getDefaultTxConcurrency().ordinal());
+ writer.writeInt(txCfg.getDefaultTxIsolation().ordinal());
writer.writeLong(txCfg.getDefaultTxTimeout());
break;
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java
index 14c040c..6572764 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java
@@ -787,6 +787,7 @@ public class PlatformUtils {
writer.writeString(typ.getSerializer());
writer.writeString(typ.getAffinityKeyFieldName());
writer.writeObject(typ.getKeepDeserialized());
+ writer.writeBoolean(typ.isEnum());
}
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryTypeConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryTypeConfiguration.java b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryTypeConfiguration.java
index df28aef..cae5760 100644
--- a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryTypeConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetBinaryTypeConfiguration.java
@@ -42,6 +42,9 @@ public class PlatformDotNetBinaryTypeConfiguration {
/** Whether to cache deserialized value. */
private Boolean keepDeserialized;
+ /** Enum flag. */
+ private boolean isEnum;
+
/**
* Default constructor.
*/
@@ -60,6 +63,7 @@ public class PlatformDotNetBinaryTypeConfiguration {
serializer = cfg.getSerializer();
affinityKeyFieldName = cfg.getAffinityKeyFieldName();
keepDeserialized = cfg.isKeepDeserialized();
+ isEnum = cfg.isEnum();
}
/**
@@ -164,6 +168,25 @@ public class PlatformDotNetBinaryTypeConfiguration {
this.keepDeserialized = keepDeserialized;
}
+ /**
+ * Gets whether this is enum type.
+ *
+ * @return {@code True} if enum.
+ */
+ public boolean isEnum() {
+ return isEnum;
+ }
+
+ /**
+ * Sets whether this is enum type.
+ *
+ * @param isEnum {@code True} if enum.
+ */
+ public void setEnum(boolean isEnum) {
+ this.isEnum = isEnum;
+ }
+
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(PlatformDotNetBinaryTypeConfiguration.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryEnumsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryEnumsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryEnumsSelfTest.java
new file mode 100644
index 0000000..3bc3922
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryEnumsSelfTest.java
@@ -0,0 +1,446 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.binary.BinaryTypeConfiguration;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.BinaryConfiguration;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+/**
+ * Contains tests for binary enums.
+ */
+@SuppressWarnings("unchecked")
+public class BinaryEnumsSelfTest extends GridCommonAbstractTest {
+ /** Cache name. */
+ private static String CACHE_NAME = "cache";
+
+ /** Whether to register types or not. */
+ private boolean register;
+
+ /** Node 1. */
+ private Ignite node1;
+
+ /** Node 2. */
+ private Ignite node2;
+
+ /** Cache 1. */
+ private IgniteCache cache1;
+
+ /** Cache 2. */
+ private IgniteCache cache2;
+
+ /** Binary cache 1. */
+ private IgniteCache cacheBinary1;
+
+ /** Binary cache 2. */
+ private IgniteCache cacheBinary2;
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ register = false;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ if (register) {
+ BinaryConfiguration bCfg = new BinaryConfiguration();
+
+ BinaryTypeConfiguration enumCfg = new BinaryTypeConfiguration(EnumType.class.getName());
+ enumCfg.setEnum(true);
+
+ bCfg.setTypeConfigurations(Arrays.asList(enumCfg, new BinaryTypeConfiguration(EnumHolder.class.getName())));
+
+ cfg.setBinaryConfiguration(bCfg);
+ }
+
+ cfg.setMarshaller(new BinaryMarshaller());
+
+ CacheConfiguration ccfg = new CacheConfiguration();
+ ccfg.setName(CACHE_NAME);
+ ccfg.setCacheMode(CacheMode.PARTITIONED);
+
+ cfg.setCacheConfiguration(ccfg);
+
+ return cfg;
+ }
+
+ /**
+ * Start up routine.
+ *
+ * @throws Exception If failed.
+ */
+ private void startUp(boolean register) throws Exception {
+ this.register = register;
+
+ node1 = startGrid(0);
+ cache1 = node1.cache(CACHE_NAME);
+ cacheBinary1 = cache1.withKeepBinary();
+
+ node2 = startGrid(1);
+ cache2 = node2.cache(CACHE_NAME);
+ cacheBinary2 = cache2.withKeepBinary();
+ }
+
+ /**
+ * Test operations on simple type which is registered in advance.
+ *
+ * @throws Exception If failed.
+ */
+ public void testSimpleRegistered() throws Exception {
+ checkSimple(true);
+ }
+
+ /**
+ * Test operations on simple type which is not registered in advance.
+ *
+ * @throws Exception If failed.
+ */
+ public void testSimpleNotRegistered() throws Exception {
+ checkSimple(false);
+ }
+
+ /**
+ * Test operations when enum is nested into an object (registered).
+ *
+ * @throws Exception If failed.
+ */
+ public void testNestedRegistered() throws Exception {
+ checkNested(true);
+ }
+
+ /**
+ * Test operations when enum is nested into an object (not registered).
+ *
+ * @throws Exception If failed.
+ */
+ public void testNestedNotRegistered() throws Exception {
+ checkNested(false);
+ }
+
+ /**
+ * Test builder operations on simple type which is registered in advance.
+ *
+ * @throws Exception If failed.
+ */
+ public void testSimpleBuilderRegistered() throws Exception {
+ checkSimpleBuilder(true);
+ }
+
+ /**
+ * Test builder operations on simple type which is not registered in advance.
+ *
+ * @throws Exception If failed.
+ */
+ public void testSimpleBuilderNotRegistered() throws Exception {
+ checkSimpleBuilder(false);
+ }
+
+ /**
+ * Test builder operations when enum is nested into an object (registered).
+ *
+ * @throws Exception If failed.
+ */
+ public void testNestedBuilderRegistered() throws Exception {
+ checkNestedBuilder(true);
+ }
+
+ /**
+ * Test builder operations when enum is nested into an object (not registered).
+ *
+ * @throws Exception If failed.
+ */
+ public void testNestedBuilderNotRegistered() throws Exception {
+ checkNestedBuilder(false);
+ }
+
+ /**
+ * Check simple serialization - deserialization.
+ *
+ * @param registered If type should be registered in advance.
+ * @throws Exception If failed.
+ */
+ public void checkSimple(boolean registered) throws Exception {
+ startUp(registered);
+
+ cache1.put(1, EnumType.ONE);
+
+ validateSimple(1, EnumType.ONE, registered);
+ }
+
+ /**
+ * Check nested serialization - deserialization.
+ *
+ * @param registered If type should be registered in advance.
+ * @throws Exception If failed.
+ */
+ private void checkNested(boolean registered) throws Exception {
+ startUp(registered);
+
+ cache1.put(1, new EnumHolder(EnumType.ONE));
+
+ validateNested(1, EnumType.ONE, registered);
+ }
+
+ /**
+ * Check nested builder serialization - deserialization.
+ *
+ * @param registered If type should be registered in advance.
+ * @throws Exception If failed.
+ */
+ private void checkNestedBuilder(boolean registered) throws Exception {
+ startUp(registered);
+
+ BinaryObject obj = node1.binary().builder("EnumHolder").setField("val", EnumType.ONE).build();
+
+ assert node1.binary().type("EnumHolder") != null;
+ assert node1.binary().type("EnumType") != null;
+
+ cacheBinary1.put(1, obj);
+
+ validateNested(1, EnumType.ONE, registered);
+
+ obj = (BinaryObject)cacheBinary1.get(1);
+ obj = node1.binary().builder(obj).setField("val", EnumType.TWO).build();
+
+ cacheBinary1.put(1, obj);
+
+ validateNested(1, EnumType.TWO, registered);
+ }
+
+ /**
+ * Validate nested object.
+ *
+ * @param key Key.
+ * @param val Value.
+ * @param registered Registered flag.
+ * @throws Exception If failed.
+ */
+ private void validateNested(int key, EnumType val, boolean registered) throws Exception {
+ if (registered) {
+ EnumHolder res1 = (EnumHolder) cache1.get(key);
+ EnumHolder res2 = (EnumHolder) cache2.get(key);
+
+ assertEquals(val, res1.val);
+ assertEquals(val, res2.val);
+ }
+
+ BinaryObject resBinary1 = (BinaryObject)cacheBinary1.get(key);
+ BinaryObject resBinary2 = (BinaryObject)cacheBinary2.get(key);
+
+ validate((BinaryObject)resBinary1.field("val"), val);
+ validate((BinaryObject)resBinary2.field("val"), val);
+ }
+
+ /**
+ * Check simple serialization - deserialization using builder.
+ *
+ * @param registered If type should be registered in advance.
+ * @throws Exception If failed.
+ */
+ public void checkSimpleBuilder(boolean registered) throws Exception {
+ startUp(registered);
+
+ BinaryObject binary = node1.binary().buildEnum(EnumType.class.getSimpleName(), EnumType.ONE.ordinal());
+
+ cacheBinary1.put(1, binary);
+
+ validateSimple(1, EnumType.ONE, registered);
+ }
+
+ /**
+ * Test enum array (registered).
+ *
+ * @throws Exception If failed.
+ */
+ public void testSimpleArrayRegistered() throws Exception {
+ checkSimpleArray(true);
+ }
+
+ /**
+ * Test enum array (not registered).
+ *
+ * @throws Exception If failed.
+ */
+ public void testSimpleArrayNotRegistered() throws Exception {
+ checkSimpleArray(false);
+ }
+
+ /**
+ * Test enum array created using builder (registered).
+ *
+ * @throws Exception If failed.
+ */
+ public void testSimpleBuilderArrayRegistered() throws Exception {
+ checkSimpleBuilderArray(true);
+ }
+
+ /**
+ * Test enum array created using builder (not registered).
+ *
+ * @throws Exception If failed.
+ */
+ public void testSimpleBuilderArrayNotRegistered() throws Exception {
+ checkSimpleBuilderArray(false);
+ }
+
+ /**
+ * Check arrays with builder.
+ *
+ * @param registered Registered flag.
+ * @throws Exception If failed.
+ */
+ public void checkSimpleArray(boolean registered) throws Exception {
+ startUp(registered);
+
+ cache1.put(1, new EnumType[] { EnumType.ONE, EnumType.TWO });
+
+ validateSimpleArray(registered);
+ }
+
+ /**
+ * Check arrays with builder.
+ *
+ * @param registered Registered flag.
+ * @throws Exception If failed.
+ */
+ public void checkSimpleBuilderArray(boolean registered) throws Exception {
+ startUp(registered);
+
+ BinaryObject binaryOne = node1.binary().buildEnum(EnumType.class.getSimpleName(), EnumType.ONE.ordinal());
+ BinaryObject binaryTwo = node1.binary().buildEnum(EnumType.class.getSimpleName(), EnumType.TWO.ordinal());
+
+ cacheBinary1.put(1, new BinaryObject[] { binaryOne, binaryTwo });
+
+ validateSimpleArray(registered);
+ }
+
+ /**
+ * Validate simple array.
+ *
+ * @param registered Registered flag.
+ */
+ private void validateSimpleArray(boolean registered) {
+ if (registered) {
+ Object[] arr1 = (Object[])cache1.get(1);
+ Object[] arr2 = (Object[])cache2.get(1);
+
+ assertEquals(2, arr1.length);
+ assertEquals(2, arr2.length);
+
+ assertEquals(EnumType.ONE, arr1[0]);
+ assertEquals(EnumType.TWO, arr1[1]);
+
+ assertEquals(EnumType.ONE, arr2[0]);
+ assertEquals(EnumType.TWO, arr2[1]);
+ }
+
+ Object[] arrBinary1 = (Object[])cacheBinary1.get(1);
+ Object[] arrBinary2 = (Object[])cacheBinary2.get(1);
+
+ assertEquals(2, arrBinary1.length);
+ assertEquals(2, arrBinary2.length);
+
+ validate((BinaryObject) arrBinary1[0], EnumType.ONE);
+ validate((BinaryObject) arrBinary1[1], EnumType.TWO);
+
+ validate((BinaryObject) arrBinary2[0], EnumType.ONE);
+ validate((BinaryObject) arrBinary2[1], EnumType.TWO);
+ }
+
+ /**
+ * Internal check routine for simple scenario.
+ *
+ * @param key Key.
+ * @param val Value.
+ * @param registered Registered flag.
+ * @throws Exception If failed.
+ */
+ private void validateSimple(int key, EnumType val, boolean registered) throws Exception {
+ if (registered) {
+ assertEquals(val, cache1.get(key));
+ assertEquals(val, cache2.get(key));
+ }
+
+ validate((BinaryObject) cacheBinary1.get(key), val);
+ validate((BinaryObject) cacheBinary2.get(key), val);
+ }
+
+ /**
+ * Validate single value.
+ *
+ * @param obj Binary value.
+ * @param val Expected value.
+ */
+ private void validate(BinaryObject obj, EnumType val) {
+ assertTrue(obj.type().isEnum());
+
+ assertEquals(node1.binary().typeId(EnumType.class.getName()), obj.type().typeId());
+ assertEquals(node2.binary().typeId(EnumType.class.getName()), obj.type().typeId());
+
+ assertEquals(val.ordinal(), obj.enumOrdinal());
+ }
+
+ /**
+ * Enumeration holder.
+ */
+ public static class EnumHolder implements Serializable {
+ /** Value. */
+ public EnumType val;
+
+ /**
+ * Default constructor.
+ */
+ @SuppressWarnings("UnusedDeclaration")
+ public EnumHolder() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param val Value.
+ */
+ public EnumHolder(EnumType val) {
+ this.val = val;
+ }
+ }
+
+ /**
+ * Enumeration for tests.
+ */
+ public static enum EnumType {
+ ONE,
+ TWO
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
index 655582e..9f7822c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
@@ -487,8 +487,8 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
assertArrayEquals(obj.objArr, (Object[])po.field("objArr"));
assertEquals(obj.col, po.field("col"));
assertEquals(obj.map, po.field("map"));
- assertEquals(new Integer(obj.enumVal.ordinal()), new Integer(((Enum<?>)po.field("enumVal")).ordinal()));
- assertArrayEquals(ordinals(obj.enumArr), ordinals((Enum<?>[])po.field("enumArr")));
+ assertEquals(new Integer(obj.enumVal.ordinal()), new Integer(((BinaryObject)po.field("enumVal")).enumOrdinal()));
+ assertArrayEquals(ordinals(obj.enumArr), ordinals((BinaryObject[])po.field("enumArr")));
assertNull(po.field("unknown"));
BinaryObject innerPo = po.field("inner");
@@ -523,8 +523,8 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
assertEquals(obj.inner.col, innerPo.field("col"));
assertEquals(obj.inner.map, innerPo.field("map"));
assertEquals(new Integer(obj.inner.enumVal.ordinal()),
- new Integer(((Enum<?>)innerPo.field("enumVal")).ordinal()));
- assertArrayEquals(ordinals(obj.inner.enumArr), ordinals((Enum<?>[])innerPo.field("enumArr")));
+ new Integer(((BinaryObject)innerPo.field("enumVal")).enumOrdinal()));
+ assertArrayEquals(ordinals(obj.inner.enumArr), ordinals((BinaryObject[])innerPo.field("enumArr")));
assertNull(innerPo.field("inner"));
assertNull(innerPo.field("unknown"));
}
@@ -572,8 +572,8 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
assertArrayEquals(obj.objArr, (Object[])po.field("_objArr"));
assertEquals(obj.col, po.field("_col"));
assertEquals(obj.map, po.field("_map"));
- assertEquals(new Integer(obj.enumVal.ordinal()), new Integer(((Enum<?>)po.field("_enumVal")).ordinal()));
- assertArrayEquals(ordinals(obj.enumArr), ordinals((Enum<?>[])po.field("_enumArr")));
+ assertEquals(new Integer(obj.enumVal.ordinal()), new Integer(((BinaryObject)po.field("_enumVal")).enumOrdinal()));
+ assertArrayEquals(ordinals(obj.enumArr), ordinals((BinaryObject[])po.field("_enumArr")));
assertNull(po.field("unknown"));
BinaryObject simplePo = po.field("_simple");
@@ -608,8 +608,8 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
assertEquals(obj.simple.col, simplePo.field("col"));
assertEquals(obj.simple.map, simplePo.field("map"));
assertEquals(new Integer(obj.simple.enumVal.ordinal()),
- new Integer(((Enum<?>)simplePo.field("enumVal")).ordinal()));
- assertArrayEquals(ordinals(obj.simple.enumArr), ordinals((Enum<?>[])simplePo.field("enumArr")));
+ new Integer(((BinaryObject)simplePo.field("enumVal")).enumOrdinal()));
+ assertArrayEquals(ordinals(obj.simple.enumArr), ordinals((BinaryObject[])simplePo.field("enumArr")));
assertNull(simplePo.field("simple"));
assertNull(simplePo.field("portable"));
assertNull(simplePo.field("unknown"));
@@ -645,8 +645,8 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
assertEquals(obj.portable.col, portablePo.field("_col"));
assertEquals(obj.portable.map, portablePo.field("_map"));
assertEquals(new Integer(obj.portable.enumVal.ordinal()),
- new Integer(((Enum<?>)portablePo.field("_enumVal")).ordinal()));
- assertArrayEquals(ordinals(obj.portable.enumArr), ordinals((Enum<?>[])portablePo.field("_enumArr")));
+ new Integer(((BinaryObject)portablePo.field("_enumVal")).enumOrdinal()));
+ assertArrayEquals(ordinals(obj.portable.enumArr), ordinals((BinaryObject[])portablePo.field("_enumArr")));
assertNull(portablePo.field("_simple"));
assertNull(portablePo.field("_portable"));
assertNull(portablePo.field("unknown"));
@@ -684,8 +684,8 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
assertArrayEquals(obj.objArr, (Object[])po.field("objArr"));
assertEquals(obj.col, po.field("col"));
assertEquals(obj.map, po.field("map"));
- assertEquals(new Integer(obj.enumVal.ordinal()), new Integer(((Enum<?>)po.field("enumVal")).ordinal()));
- assertArrayEquals(ordinals(obj.enumArr), ordinals((Enum<?>[])po.field("enumArr")));
+ assertEquals(new Integer(obj.enumVal.ordinal()), new Integer(((BinaryObject)po.field("enumVal")).enumOrdinal()));
+ assertArrayEquals(ordinals(obj.enumArr), ordinals((BinaryObject[])po.field("enumArr")));
assertNull(po.field("unknown"));
assertEquals(obj, po.deserialize());
@@ -2203,6 +2203,19 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
}
/**
+ * @param enumArr Enum array.
+ * @return Ordinals.
+ */
+ private <T extends Enum<?>> Integer[] ordinals(BinaryObject[] enumArr) {
+ Integer[] ords = new Integer[enumArr.length];
+
+ for (int i = 0; i < enumArr.length; i++)
+ ords[i] = enumArr[i].enumOrdinal();
+
+ return ords;
+ }
+
+ /**
* @param po Portable object.
* @param off Offset.
* @return Value.
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
index c464945..a284883 100644
--- a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
+++ b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
@@ -194,9 +194,9 @@ public class PlatformComputeEchoTask extends ComputeTaskAdapter<Integer, Object>
case TYPE_ENUM_FIELD:
IgniteCache<Integer, BinaryObject> cache = ignite.cache(null).withKeepBinary();
BinaryObject obj = cache.get(TYPE_ENUM_FIELD);
- PlatformComputeEnum val = obj.field("interopEnum");
+ BinaryObject val = obj.field("interopEnum");
- return val;
+ return val.deserialize();
default:
throw new IgniteException("Unknown type: " + type);
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
index 16eeb2b..629835b 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
@@ -18,6 +18,7 @@
package org.apache.ignite.testsuites;
import junit.framework.TestSuite;
+import org.apache.ignite.internal.portable.BinaryEnumsSelfTest;
import org.apache.ignite.internal.portable.GridPortableAffinityKeySelfTest;
import org.apache.ignite.internal.portable.BinaryObjectBuilderAdditionalSelfTest;
import org.apache.ignite.internal.portable.BinaryObjectBuilderSelfTest;
@@ -72,6 +73,7 @@ public class IgnitePortableObjectsTestSuite extends TestSuite {
suite.addTestSuite(BinaryFieldsOffheapSelfTest.class);
suite.addTestSuite(BinaryFooterOffsetsHeapSelfTest.class);
suite.addTestSuite(BinaryFooterOffsetsOffheapSelfTest.class);
+ suite.addTestSuite(BinaryEnumsSelfTest.class);
suite.addTestSuite(GridPortableMetaDataSelfTest.class);
suite.addTestSuite(GridPortableAffinityKeySelfTest.class);
suite.addTestSuite(GridPortableWildcardsSelfTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/663e78dc/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp b/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp
index 2e86ccd..6c3bf7f 100644
--- a/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp
+++ b/modules/platforms/cpp/core/src/impl/binary/binary_type_updater_impl.cpp
@@ -32,7 +32,7 @@ namespace ignite
{
namespace binary
{
- /** Operation: Clear. */
+ /** Operation: metadata update. */
const int32_t OP_METADATA = -1;
BinaryTypeUpdaterImpl::BinaryTypeUpdaterImpl(SharedPointer<IgniteEnvironment> env,
@@ -78,6 +78,8 @@ namespace ignite
else
rawWriter.WriteInt32(0);
+ rawWriter.WriteBool(false); // Enums are not supported for now.
+
out.Synchronize();
long long res = env.Get()->Context()->TargetInStreamOutLong(javaRef, OP_METADATA, mem.Get()->PointerLong(), &jniErr);
[48/50] [abbrv] ignite git commit: ignite-530
Posted by ra...@apache.org.
ignite-530
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c5304a94
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c5304a94
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c5304a94
Branch: refs/heads/master
Commit: c5304a94eb0676839acb0302efb1159430ee8cd9
Parents: eeb584d
Author: Anton Vinogradov <av...@apache.org>
Authored: Mon Nov 30 15:12:07 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Mon Nov 30 15:12:07 2015 +0300
----------------------------------------------------------------------
.../twitter/IgniteTwitterStreamerTestSuite.java | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c5304a94/modules/twitter/src/test/java/org/apache/ignite/stream/twitter/IgniteTwitterStreamerTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/twitter/src/test/java/org/apache/ignite/stream/twitter/IgniteTwitterStreamerTestSuite.java b/modules/twitter/src/test/java/org/apache/ignite/stream/twitter/IgniteTwitterStreamerTestSuite.java
index b458bed..e07aaec 100644
--- a/modules/twitter/src/test/java/org/apache/ignite/stream/twitter/IgniteTwitterStreamerTestSuite.java
+++ b/modules/twitter/src/test/java/org/apache/ignite/stream/twitter/IgniteTwitterStreamerTestSuite.java
@@ -17,16 +17,21 @@
package org.apache.ignite.stream.twitter;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
+import junit.framework.TestSuite;
/**
* Twitter streamer tests.
*/
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- IgniteTwitterStreamerTest.class
-})
-public class IgniteTwitterStreamerTestSuite {
+public class IgniteTwitterStreamerTestSuite extends TestSuite {
+ /**
+ * @return Twitter streamer tests suite.
+ * @throws Exception If failed.
+ */
+ public static TestSuite suite() throws Exception {
+ TestSuite suite = new TestSuite("Twitter streamed Test Suite");
+ suite.addTestSuite(IgniteTwitterStreamerTest.class);
+
+ return suite;
+ }
}
[43/50] [abbrv] ignite git commit: IGNITE-2024 Added support for
fields and non-JavaBeans getters/setters.
Posted by ra...@apache.org.
IGNITE-2024 Added support for fields and non-JavaBeans getters/setters.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/923fea86
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/923fea86
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/923fea86
Branch: refs/heads/master
Commit: 923fea8659eac46f351b8d64f710a351f6bbf3ff
Parents: 59f3726
Author: AKuznetsov <ak...@gridgain.com>
Authored: Sun Nov 29 20:44:51 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Sun Nov 29 20:44:51 2015 +0700
----------------------------------------------------------------------
.../cache/store/jdbc/CacheJdbcPojoStore.java | 188 +++++++++++++------
1 file changed, 133 insertions(+), 55 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/923fea86/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
index b837e5c..abc4b2e 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java
@@ -18,6 +18,8 @@
package org.apache.ignite.cache.store.jdbc;
import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -44,7 +46,7 @@ import org.jetbrains.annotations.Nullable;
*/
public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
/** POJO methods cache. */
- private volatile Map<String, Map<String, PojoMethodsCache>> pojosMthds = Collections.emptyMap();
+ private volatile Map<String, Map<String, PojoPropertiesCache>> pojosProps = Collections.emptyMap();
/**
* Get field value from object for use as query parameter.
@@ -81,23 +83,23 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
@Nullable private Object extractPojoParameter(@Nullable String cacheName, String typeName, String fldName,
Object obj) throws CacheException {
try {
- Map<String, PojoMethodsCache> cacheMethods = pojosMthds.get(cacheName);
+ Map<String, PojoPropertiesCache> cacheProps = pojosProps.get(cacheName);
- if (cacheMethods == null)
+ if (cacheProps == null)
throw new CacheException("Failed to find POJO type metadata for cache: " + U.maskName(cacheName));
- PojoMethodsCache mc = cacheMethods.get(typeName);
+ PojoPropertiesCache ppc = cacheProps.get(typeName);
- if (mc == null)
+ if (ppc == null)
throw new CacheException("Failed to find POJO type metadata for type: " + typeName);
- Method getter = mc.getters.get(fldName);
+ ClassProperty prop = ppc.props.get(fldName);
- if (getter == null)
- throw new CacheLoaderException("Failed to find getter in POJO class [class=" + typeName +
+ if (prop == null)
+ throw new CacheLoaderException("Failed to find property in POJO class [class=" + typeName +
", prop=" + fldName + "]");
- return getter.invoke(obj);
+ return prop.get(obj);
}
catch (Exception e) {
throw new CacheException("Failed to read object of class: " + typeName, e);
@@ -171,26 +173,26 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
JdbcTypeField[] flds, Map<String, Integer> loadColIdxs, ResultSet rs)
throws CacheLoaderException {
- Map<String, PojoMethodsCache> cacheMethods = pojosMthds.get(cacheName);
+ Map<String, PojoPropertiesCache> cacheProps = pojosProps.get(cacheName);
- if (cacheMethods == null)
+ if (cacheProps == null)
throw new CacheLoaderException("Failed to find POJO types metadata for cache: " + U.maskName(cacheName));
- PojoMethodsCache mc = cacheMethods.get(typeName);
+ PojoPropertiesCache ppc = cacheProps.get(typeName);
- if (mc == null)
+ if (ppc == null)
throw new CacheLoaderException("Failed to find POJO type metadata for type: " + typeName);
try {
- Object obj = mc.ctor.newInstance();
+ Object obj = ppc.ctor.newInstance();
for (JdbcTypeField fld : flds) {
String fldJavaName = fld.getJavaFieldName();
- Method setter = mc.setters.get(fldJavaName);
+ ClassProperty prop = ppc.props.get(fldJavaName);
- if (setter == null)
- throw new IllegalStateException("Failed to find setter in POJO class [type=" + typeName +
+ if (prop == null)
+ throw new IllegalStateException("Failed to find property in POJO class [type=" + typeName +
", prop=" + fldJavaName + "]");
String fldDbName = fld.getDatabaseFieldName();
@@ -201,7 +203,7 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
Object colVal = getColumnValue(rs, colIdx, fld.getJavaFieldType());
try {
- setter.invoke(obj, colVal);
+ prop.set(obj, colVal);
}
catch (Exception e) {
throw new CacheLoaderException("Failed to set property in POJO class [type=" + typeName +
@@ -298,7 +300,7 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
*/
@Override protected void prepareBuilders(@Nullable String cacheName, Collection<JdbcType> types)
throws CacheException {
- Map<String, PojoMethodsCache> pojoMethods = U.newHashMap(types.size() * 2);
+ Map<String, PojoPropertiesCache> pojoProps = U.newHashMap(types.size() * 2);
for (JdbcType type : types) {
String keyTypeName = type.getKeyType();
@@ -306,11 +308,11 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
TypeKind keyKind = kindForName(keyTypeName);
if (keyKind == TypeKind.POJO) {
- if (pojoMethods.containsKey(keyTypeName))
+ if (pojoProps.containsKey(keyTypeName))
throw new CacheException("Found duplicate key type [cache=" + U.maskName(cacheName) +
", keyType=" + keyTypeName + "]");
- pojoMethods.put(keyTypeName, new PojoMethodsCache(keyTypeName, type.getKeyFields()));
+ pojoProps.put(keyTypeName, new PojoPropertiesCache(keyTypeName, type.getKeyFields()));
}
String valTypeName = type.getValueType();
@@ -318,42 +320,99 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
TypeKind valKind = kindForName(valTypeName);
if (valKind == TypeKind.POJO)
- pojoMethods.put(valTypeName, new PojoMethodsCache(valTypeName, type.getValueFields()));
+ pojoProps.put(valTypeName, new PojoPropertiesCache(valTypeName, type.getValueFields()));
+ }
+
+ if (!pojoProps.isEmpty()) {
+ Map<String, Map<String, PojoPropertiesCache>> newPojosProps = new HashMap<>(pojosProps);
+
+ newPojosProps.put(cacheName, pojoProps);
+
+ pojosProps = newPojosProps;
+ }
+ }
+
+ /**
+ * Description of type property.
+ */
+ private static class ClassProperty {
+ /** */
+ private final Method getter;
+ /** */
+ private final Method setter;
+ /** */
+ private final Field field;
+
+ /**
+ * Property descriptor constructor.
+ *
+ * @param getter Property getter.
+ * @param setter Property setter.
+ * @param field Property field.
+ */
+ private ClassProperty(Method getter, Method setter, Field field) {
+ this.getter = getter;
+ this.setter = setter;
+ this.field = field;
}
- if (!pojoMethods.isEmpty()) {
- Map<String, Map<String, PojoMethodsCache>> newPojosMethods = new HashMap<>(pojosMthds);
+ /**
+ * Get property value.
+ *
+ * @param obj Object to get property value from.
+ * @return Property value.
+ * @throws IllegalAccessException
+ * @throws InvocationTargetException
+ */
+ private Object get(Object obj) throws IllegalAccessException, InvocationTargetException {
+ if (getter != null)
+ return getter.invoke(obj);
- newPojosMethods.put(cacheName, pojoMethods);
+ if (field != null)
+ return field.get(obj);
- pojosMthds = newPojosMethods;
+ throw new IllegalAccessException("Failed to get value from property. Getter and field was not initialized.");
+ }
+
+ /**
+ * Set property value.
+ *
+ * @param obj Object to set property value to.
+ * @param val New property value to set.
+ * @throws IllegalAccessException
+ * @throws InvocationTargetException
+ */
+ private void set(Object obj, Object val) throws IllegalAccessException, InvocationTargetException {
+ if (setter != null)
+ setter.invoke(obj, val);
+ else if (field != null)
+ field.set(obj, val);
+ else
+ throw new IllegalAccessException("Failed to set new value from property. Setter and field was not initialized.");
}
}
/**
* POJO methods cache.
*/
- private static class PojoMethodsCache {
+ private static class PojoPropertiesCache {
/** POJO class. */
private final Class<?> cls;
/** Constructor for POJO object. */
private Constructor ctor;
- /** Cached setters for POJO object. */
- private Map<String, Method> getters;
-
- /** Cached getters for POJO object. */
- private Map<String, Method> setters;
+ /** Cached properties for POJO object. */
+ private Map<String, ClassProperty> props;
/**
* POJO methods cache.
*
* @param clsName Class name.
- * @param fields Fields.
+ * @param jdbcFlds Type fields.
* @throws CacheException If failed to construct type cache.
*/
- private PojoMethodsCache(String clsName, JdbcTypeField[] fields) throws CacheException {
+ private PojoPropertiesCache(String clsName, JdbcTypeField[] jdbcFlds) throws CacheException {
try {
cls = Class.forName(clsName);
@@ -369,33 +428,35 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
throw new CacheException("Failed to find default constructor for class: " + clsName, e);
}
- setters = U.newHashMap(fields.length);
+ props = U.newHashMap(jdbcFlds.length);
- getters = U.newHashMap(fields.length);
+ for (JdbcTypeField jdbcFld : jdbcFlds) {
+ String fldName = jdbcFld.getJavaFieldName();
+ String mthName = capitalFirst(fldName);
- for (JdbcTypeField field : fields) {
- String prop = capitalFirst(field.getJavaFieldName());
+ Method getter = methodByName(cls, "get" + mthName);
- try {
- getters.put(field.getJavaFieldName(), cls.getMethod("get" + prop));
- }
- catch (NoSuchMethodException ignored) {
+ if (getter == null)
+ getter = methodByName(cls, "is" + mthName);
+
+ if (getter == null)
+ getter = methodByName(cls, fldName);
+
+ Method setter = methodByName(cls, "set" + mthName, jdbcFld.getJavaFieldType());
+
+ if (setter == null)
+ setter = methodByName(cls, fldName, jdbcFld.getJavaFieldType());
+
+ if (getter != null && setter != null)
+ props.put(fldName, new ClassProperty(getter, setter, null));
+ else
try {
- getters.put(field.getJavaFieldName(), cls.getMethod("is" + prop));
+ props.put(fldName, new ClassProperty(null, null, cls.getDeclaredField(fldName)));
}
- catch (NoSuchMethodException e) {
- throw new CacheException("Failed to find getter in POJO class [class=" + clsName +
- ", prop=" + field.getJavaFieldName() + "]", e);
+ catch (NoSuchFieldException ignored) {
+ throw new CacheException("Failed to find property in POJO class [class=" + clsName +
+ ", prop=" + fldName + "]");
}
- }
-
- try {
- setters.put(field.getJavaFieldName(), cls.getMethod("set" + prop, field.getJavaFieldType()));
- }
- catch (NoSuchMethodException e) {
- throw new CacheException("Failed to find setter in POJO class [class=" + clsName +
- ", prop=" + field.getJavaFieldName() + "]", e);
- }
}
}
@@ -409,5 +470,22 @@ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> {
return str == null ? null :
str.isEmpty() ? "" : Character.toUpperCase(str.charAt(0)) + str.substring(1);
}
+
+ /**
+ * Get method by name.
+ *
+ * @param cls Class to take method from.
+ * @param name Method name.
+ * @param paramTypes Method parameters types.
+ * @return Method or {@code null} if method not found.
+ */
+ private Method methodByName(Class<?> cls, String name, Class<?>... paramTypes) {
+ try {
+ return cls.getMethod(name, paramTypes);
+ }
+ catch (NoSuchMethodException ignored) {
+ return null;
+ }
+ }
}
}
[08/50] [abbrv] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.5' into ignite-1.5
Posted by ra...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c2d4d1d2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c2d4d1d2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c2d4d1d2
Branch: refs/heads/master
Commit: c2d4d1d2e180b0c22bf289166bb9b4ca902e257a
Parents: 41fe469 30c9b8d
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 12:33:33 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 12:33:33 2015 +0300
----------------------------------------------------------------------
modules/flume/README.txt | 44 +++++---------------
modules/yarn/pom.xml | 6 +--
.../yarn/IgniteApplicationMasterSelfTest.java | 11 ++++-
3 files changed, 22 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
[14/50] [abbrv] ignite git commit: ignite-1732 Fixed test to catch
IgniteClientDisconnectedException.
Posted by ra...@apache.org.
ignite-1732 Fixed test to catch IgniteClientDisconnectedException.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/712e62bd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/712e62bd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/712e62bd
Branch: refs/heads/master
Commit: 712e62bd241cecac969d022461fc048453b3db6b
Parents: c2d4d1d
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 27 13:12:55 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 27 13:12:55 2015 +0300
----------------------------------------------------------------------
.../dht/IgniteAtomicLongChangingTopologySelfTest.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/712e62bd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
index a8d5801..56bc760 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
@@ -31,6 +31,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReferenceArray;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteAtomicLong;
+import org.apache.ignite.IgniteClientDisconnectedException;
import org.apache.ignite.IgniteQueue;
import org.apache.ignite.IgniteSet;
import org.apache.ignite.configuration.AtomicConfiguration;
@@ -214,7 +215,12 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
while (System.currentTimeMillis() < stop) {
log.info("Iteration: " + iter++);
- c.apply(ignite);
+ try {
+ c.apply(ignite);
+ }
+ catch (IgniteClientDisconnectedException e) {
+ e.reconnectFuture().get();
+ }
}
finished.set(true);
[16/50] [abbrv] ignite git commit: BinaryTypeImpl: Minor JavaDoc fix.
Posted by ra...@apache.org.
BinaryTypeImpl: Minor JavaDoc fix.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e1db30a9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e1db30a9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e1db30a9
Branch: refs/heads/master
Commit: e1db30a986aaecb823ed49505e55b376d2d08d2a
Parents: e4f6224
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Nov 27 13:20:53 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Nov 27 13:20:53 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/internal/portable/BinaryTypeImpl.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e1db30a9/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
index 9512cdb..f471af2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
@@ -77,7 +77,9 @@ public class BinaryTypeImpl implements BinaryType {
return meta.isEnum();
}
- /** {@inheritDoc} */
+ /**
+ * @return Context.
+ */
public PortableContext context() {
return ctx;
}
[13/50] [abbrv] ignite git commit: Missed README & licenses
Posted by ra...@apache.org.
Missed README & licenses
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fa8e478d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fa8e478d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fa8e478d
Branch: refs/heads/master
Commit: fa8e478d930b9ecb2c1534874f9993c1ae45c103
Parents: e4f6224
Author: Anton Vinogradov <av...@apache.org>
Authored: Fri Nov 27 13:10:27 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Nov 27 13:10:27 2015 +0300
----------------------------------------------------------------------
modules/jms11/licenses/apache-2.0.txt | 202 +++++++++++++++++++++++++
modules/kafka/README.txt | 32 ++++
modules/mqtt/licenses/apache-2.0.txt | 202 +++++++++++++++++++++++++
modules/zookeeper/licenses/apache-2.0.txt | 202 +++++++++++++++++++++++++
4 files changed, 638 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fa8e478d/modules/jms11/licenses/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/modules/jms11/licenses/apache-2.0.txt b/modules/jms11/licenses/apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/jms11/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.
http://git-wip-us.apache.org/repos/asf/ignite/blob/fa8e478d/modules/kafka/README.txt
----------------------------------------------------------------------
diff --git a/modules/kafka/README.txt b/modules/kafka/README.txt
new file mode 100644
index 0000000..1eaf861
--- /dev/null
+++ b/modules/kafka/README.txt
@@ -0,0 +1,32 @@
+Apache Ignite Kafka Streamer Module
+------------------------
+
+Apache Ignite Kafka Streamer module provides streaming from Kafka to Ignite cache.
+
+To enable Kafka Streamer module when starting a standalone node, move 'optional/ignite-Kafka' folder to
+'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will
+be added to classpath in this case.
+
+Importing Ignite Kafka Streamer Module In Maven Project
+-------------------------------------
+
+If you are using Maven to manage dependencies of your project, you can add JCL module
+dependency like this (replace '${ignite.version}' with actual Ignite version you are
+interested in):
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ ...
+ <dependencies>
+ ...
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-kafka</artifactId>
+ <version>${ignite.version}</version>
+ </dependency>
+ ...
+ </dependencies>
+ ...
+</project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/fa8e478d/modules/mqtt/licenses/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/modules/mqtt/licenses/apache-2.0.txt b/modules/mqtt/licenses/apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/mqtt/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.
http://git-wip-us.apache.org/repos/asf/ignite/blob/fa8e478d/modules/zookeeper/licenses/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/modules/zookeeper/licenses/apache-2.0.txt b/modules/zookeeper/licenses/apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/zookeeper/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.
[50/50] [abbrv] ignite git commit: Merge branch 'ignite-1.5'
Posted by ra...@apache.org.
Merge branch 'ignite-1.5'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/03ceffa3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/03ceffa3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/03ceffa3
Branch: refs/heads/master
Commit: 03ceffa36fa39b432bb95c92284b8a57af787bbd
Parents: 14e1628 0fcc1d1
Author: Raul Kripalani <ra...@apache.org>
Authored: Mon Nov 30 13:33:15 2015 +0000
Committer: Raul Kripalani <ra...@apache.org>
Committed: Mon Nov 30 13:33:15 2015 +0000
----------------------------------------------------------------------
DEVNOTES.txt | 2 +-
RELEASE_NOTES.txt | 17 +
assembly/release-fabric-base.xml | 9 +
.../config/binary/example-ignite-binary.xml | 44 --
examples/config/example-ignite.xml | 10 +-
examples/pom.xml | 2 +-
.../hibernate/CacheHibernatePersonStore.java | 4 +-
.../hibernate/CacheHibernateStoreExample.java | 2 +-
.../datagrid/store/hibernate/Person.hbm.xml | 2 +-
.../apache/ignite/examples/binary/Address.java | 72 ---
.../apache/ignite/examples/binary/Employee.java | 93 ----
.../ignite/examples/binary/EmployeeKey.java | 90 ----
.../binary/ExampleBinaryNodeStartup.java | 36 --
.../ignite/examples/binary/Organization.java | 93 ----
.../examples/binary/OrganizationType.java | 32 --
...ComputeClientBinaryTaskExecutionExample.java | 10 +-
.../CacheClientBinaryPutGetExample.java | 12 +-
.../datagrid/CacheClientBinaryQueryExample.java | 28 +-
.../ComputeFibonacciContinuationExample.java | 15 +-
.../computegrid/ComputeTaskMapExample.java | 6 +-
.../computegrid/ComputeTaskSplitExample.java | 4 +-
.../examples/datagrid/CacheQueryExample.java | 161 ++-----
.../ignite/examples/datagrid/store/Person.java | 154 -------
.../store/auto/CacheAutoStoreExample.java | 4 +-
.../auto/CacheAutoStoreLoadDataExample.java | 4 +-
.../datagrid/store/auto/CacheConfig.java | 6 +-
.../store/dummy/CacheDummyPersonStore.java | 12 +-
.../store/dummy/CacheDummyStoreExample.java | 4 +-
.../store/jdbc/CacheJdbcPersonStore.java | 18 +-
.../store/jdbc/CacheJdbcStoreExample.java | 4 +-
.../store/spring/CacheSpringPersonStore.java | 10 +-
.../store/spring/CacheSpringStoreExample.java | 4 +-
.../examples/messaging/MessagingExample.java | 18 +-
.../examples/misc/springbean/spring-bean.xml | 7 -
.../ignite/examples/model/Organization.java | 62 +++
.../apache/ignite/examples/model/Person.java | 127 ++++++
.../ignite/examples/model/binary/Address.java | 72 +++
.../ignite/examples/model/binary/Employee.java | 93 ++++
.../examples/model/binary/EmployeeKey.java | 93 ++++
.../examples/model/binary/Organization.java | 93 ++++
.../examples/model/binary/OrganizationType.java | 32 ++
.../scalar/examples/ScalarCacheExample.scala | 19 +-
.../examples/ScalarCacheQueryExample.scala | 66 +--
.../testsuites/IgniteExamplesSelfTestSuite.java | 4 +-
.../ignite/stream/camel/package-info.java | 21 +
.../ignite/stream/camel/package-info.java | 21 +
.../client/router/RouterFactorySelfTest.java | 2 +
.../ignite/codegen/MessageCodeGenerator.java | 1 +
.../java/org/apache/ignite/IgniteBinary.java | 30 +-
.../java/org/apache/ignite/IgniteCache.java | 26 +-
.../apache/ignite/binary/BinaryIdMapper.java | 3 +-
.../org/apache/ignite/binary/BinaryObject.java | 17 +-
.../apache/ignite/binary/BinarySerializer.java | 2 +-
.../org/apache/ignite/binary/BinaryType.java | 16 +-
.../ignite/binary/BinaryTypeConfiguration.java | 21 +
.../apache/ignite/cache/CacheInterceptor.java | 2 +-
.../ignite/cache/CacheKeyConfiguration.java | 19 +
.../apache/ignite/cache/CacheTypeMetadata.java | 2 +
.../rendezvous/RendezvousAffinityFunction.java | 2 +-
.../store/jdbc/CacheAbstractJdbcStore.java | 2 +-
.../cache/store/jdbc/CacheJdbcPojoStore.java | 191 +++++---
.../configuration/CacheConfiguration.java | 36 +-
.../internal/GridEventConsumeHandler.java | 5 +
.../internal/GridMessageListenHandler.java | 5 +
.../apache/ignite/internal/IgniteKernal.java | 13 +-
.../org/apache/ignite/internal/IgnitionEx.java | 15 +-
.../ignite/internal/NodeStoppingException.java | 35 ++
.../managers/communication/GridIoManager.java | 88 +---
.../communication/GridIoMessageFactory.java | 8 +-
.../discovery/GridDiscoveryManager.java | 19 +-
.../internal/portable/BinaryEnumObjectImpl.java | 311 +++++++++++++
.../internal/portable/BinaryFieldImpl.java | 6 +-
.../internal/portable/BinaryMarshaller.java | 142 ++++++
.../internal/portable/BinaryMetadata.java | 16 +-
.../internal/portable/BinaryObjectEx.java | 225 +---------
.../internal/portable/BinaryObjectExImpl.java | 251 +++++++++++
.../internal/portable/BinaryObjectImpl.java | 15 +-
.../portable/BinaryObjectOffheapImpl.java | 2 +-
.../internal/portable/BinaryReaderExImpl.java | 26 +-
.../internal/portable/BinaryTypeImpl.java | 12 +
.../internal/portable/BinaryWriteMode.java | 3 +
.../internal/portable/BinaryWriterExImpl.java | 29 +-
.../portable/GridPortableMarshaller.java | 3 +
.../portable/PortableClassDescriptor.java | 28 +-
.../internal/portable/PortableContext.java | 107 ++++-
.../ignite/internal/portable/PortableUtils.java | 166 ++++++-
.../builder/BinaryObjectBuilderImpl.java | 25 +-
.../portable/builder/PortableBuilderEnum.java | 2 +-
.../builder/PortableBuilderSerializer.java | 14 +-
.../builder/PortableEnumArrayLazyValue.java | 2 +-
.../builder/PortableObjectArrayLazyValue.java | 2 +-
.../CacheDefaultBinaryAffinityKeyMapper.java | 51 +++
.../processors/cache/CacheInvokeResult.java | 14 +
.../processors/cache/CacheLazyEntry.java | 2 +-
.../processors/cache/CacheLockImpl.java | 18 +-
.../internal/processors/cache/CacheObject.java | 3 +
.../processors/cache/CacheObjectContext.java | 49 +-
.../processors/cache/GridCacheAdapter.java | 160 ++++++-
.../cache/GridCacheConcurrentMap.java | 68 +--
.../processors/cache/GridCacheContext.java | 12 +-
.../cache/GridCacheDeploymentManager.java | 6 +-
.../processors/cache/GridCacheEventManager.java | 42 +-
.../processors/cache/GridCacheIoManager.java | 8 +-
.../processors/cache/GridCacheMapEntry.java | 4 +-
.../processors/cache/GridCacheMessage.java | 3 +-
.../processors/cache/GridCacheMvccManager.java | 3 +-
.../processors/cache/GridCacheProcessor.java | 4 +-
.../processors/cache/GridCacheProxyImpl.java | 61 +++
.../processors/cache/IgniteCacheProxy.java | 56 ++-
.../processors/cache/IgniteInternalCache.java | 47 +-
.../cache/affinity/GridCacheAffinityImpl.java | 3 +-
.../CacheDataStructuresManager.java | 45 +-
.../distributed/dht/GridDhtCacheAdapter.java | 22 +-
.../cache/distributed/dht/GridDhtGetFuture.java | 28 +-
.../distributed/dht/GridDhtLockFuture.java | 20 +-
.../distributed/dht/GridDhtTxFinishFuture.java | 13 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 2 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 43 +-
.../cache/distributed/dht/GridDhtTxRemote.java | 15 +-
.../distributed/dht/GridNoStorageCacheMap.java | 4 +-
.../dht/GridPartitionedSingleGetFuture.java | 18 +-
.../dht/atomic/GridDhtAtomicCache.java | 55 ++-
.../dht/atomic/GridDhtAtomicUpdateRequest.java | 6 +-
.../dht/atomic/GridNearAtomicUpdateFuture.java | 3 +-
.../colocated/GridDhtColocatedLockFuture.java | 25 +-
.../distributed/near/GridNearCacheAdapter.java | 14 +-
.../distributed/near/GridNearGetFuture.java | 4 +-
.../distributed/near/GridNearGetRequest.java | 3 +-
.../distributed/near/GridNearLockFuture.java | 24 +-
...arOptimisticSerializableTxPrepareFuture.java | 104 ++---
.../near/GridNearOptimisticTxPrepareFuture.java | 191 ++++----
...ridNearOptimisticTxPrepareFutureAdapter.java | 70 +++
.../near/GridNearSingleGetRequest.java | 12 +-
.../near/GridNearSingleGetResponse.java | 13 +-
.../near/GridNearTxFinishFuture.java | 14 +-
.../cache/local/GridLocalCacheEntry.java | 6 +
.../portable/CacheObjectBinaryProcessor.java | 11 +-
.../CacheObjectBinaryProcessorImpl.java | 51 ++-
.../portable/CacheObjectPortableContext.java | 3 +-
.../cache/portable/IgniteBinaryImpl.java | 21 +-
.../cache/query/GridCacheSqlQuery.java | 42 ++
.../cache/query/GridCacheTwoStepQuery.java | 35 +-
.../continuous/CacheContinuousQueryEntry.java | 50 ++-
.../continuous/CacheContinuousQueryEvent.java | 6 +-
.../continuous/CacheContinuousQueryHandler.java | 32 +-
.../CacheContinuousQueryListener.java | 5 +
.../continuous/CacheContinuousQueryManager.java | 57 ++-
.../cache/store/CacheOsStoreManager.java | 2 +-
.../cache/transactions/IgniteTxHandler.java | 10 +-
.../transactions/IgniteTxLocalAdapter.java | 31 +-
.../cache/transactions/IgniteTxManager.java | 22 +-
.../IgniteTxRemoteSingleStateImpl.java | 16 +-
.../cache/transactions/IgniteTxRemoteState.java | 5 +
.../transactions/IgniteTxRemoteStateImpl.java | 24 +
.../processors/cacheobject/NoOpBinary.java | 13 +-
.../continuous/GridContinuousHandler.java | 5 +
.../continuous/GridContinuousProcessor.java | 10 +-
.../StartRoutineDiscoveryMessage.java | 13 +-
.../datastructures/DataStructuresProcessor.java | 20 +-
.../datastructures/GridCacheAtomicLongImpl.java | 6 +-
.../GridCacheInternalKeyImpl.java | 2 +-
.../platform/PlatformContextImpl.java | 55 ++-
.../cpp/PlatformCppConfigurationClosure.java | 2 +-
.../PlatformDotNetConfigurationClosure.java | 2 +-
.../transactions/PlatformTransactions.java | 4 +-
.../platform/utils/PlatformUtils.java | 1 +
.../processors/query/GridQueryProcessor.java | 76 ++--
.../processors/query/GridQueryProperty.java | 45 ++
.../query/GridQueryTypeDescriptor.java | 6 +
.../util/future/GridCompoundFuture.java | 9 +-
.../internal/util/future/GridFutureAdapter.java | 2 +-
.../visor/cache/VisorCacheConfiguration.java | 4 +-
.../cache/VisorCacheTypeFieldMetadata.java | 30 +-
.../visor/cache/VisorCacheTypeMetadata.java | 133 +++++-
.../marshaller/portable/BinaryMarshaller.java | 146 ------
.../PlatformDotNetBinaryTypeConfiguration.java | 23 +
.../ignite/resources/MBeanServerResource.java | 69 ---
.../sharedfs/SharedFsCheckpointSpi.java | 14 +-
.../communication/tcp/TcpCommunicationSpi.java | 17 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 2 +-
.../META-INF/classnames-jdk.properties | 2 +
...heJdbcPojoStoreBinaryMarshallerSelfTest.java | 85 ++++
...JdbcPojoStorePortableMarshallerSelfTest.java | 85 ----
.../internal/GridMultipleJobsSelfTest.java | 7 +
...ectionLocalJobMultipleArgumentsSelfTest.java | 11 +-
.../IgniteClientReconnectCacheTest.java | 33 +-
.../internal/portable/BinaryEnumsSelfTest.java | 446 +++++++++++++++++++
.../portable/BinaryFieldsAbstractSelfTest.java | 13 +-
.../portable/BinaryFieldsHeapSelfTest.java | 4 +-
.../portable/BinaryFieldsOffheapSelfTest.java | 3 +-
.../BinaryFooterOffsetsAbstractSelfTest.java | 5 +-
.../BinaryFooterOffsetsHeapSelfTest.java | 4 +-
.../BinaryFooterOffsetsOffheapSelfTest.java | 3 +-
.../portable/BinaryMarshallerSelfTest.java | 126 ++++--
.../BinaryObjectBuilderAdditionalSelfTest.java | 7 +-
.../portable/BinaryObjectBuilderSelfTest.java | 102 +++--
.../GridPortableAffinityKeySelfTest.java | 13 +-
...idPortableMarshallerCtxDisabledSelfTest.java | 1 -
.../portable/GridPortableMetaDataSelfTest.java | 11 +-
.../portable/GridPortableWildcardsSelfTest.java | 1 -
.../CachePutEventListenerErrorSelfTest.java | 180 ++++++++
.../cache/CacheStopAndDestroySelfTest.java | 8 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 139 +++++-
.../cache/GridCacheConcurrentMapSelfTest.java | 2 +-
.../GridCacheOnCopyFlagAbstractSelfTest.java | 14 +-
.../processors/cache/GridCacheStopSelfTest.java | 143 +++++-
...niteCacheCopyOnReadDisabledAbstractTest.java | 2 +
...IgniteCacheAbstractExecutionContextTest.java | 2 +-
...eAbstractDataStructuresFailoverSelfTest.java | 3 +
.../IgniteCollectionAbstractTest.java | 3 +
...yMetadataUpdateChangingTopologySelfTest.java | 245 ++++++++++
.../IgniteCacheSizeFailoverTest.java | 7 +
.../dht/GridCacheDhtInternalEntrySelfTest.java | 203 ---------
...gniteAtomicLongChangingTopologySelfTest.java | 40 +-
.../IgniteCacheCrossCacheTxFailoverTest.java | 6 +
.../IgniteCachePutRetryAbstractSelfTest.java | 4 +
.../near/GridCacheNearTxForceKeyTest.java | 2 +-
...achePartitionedPreloadLifecycleSelfTest.java | 71 +--
.../replicated/GridReplicatedTxPreloadTest.java | 6 +
...CacheReplicatedPreloadLifecycleSelfTest.java | 100 +++--
.../GridCacheEvictionLockUnlockSelfTest.java | 2 +-
.../random/RandomEvictionPolicySelfTest.java | 8 +-
...naryObjectsAbstractDataStreamerSelfTest.java | 2 +-
...aryObjectsAbstractMultiThreadedSelfTest.java | 10 +-
.../GridCacheBinaryObjectsAbstractSelfTest.java | 2 +-
...ntNodeBinaryObjectMetadataMultinodeTest.java | 10 +-
...CacheClientNodeBinaryObjectMetadataTest.java | 6 +-
.../GridCachePortableStoreAbstractSelfTest.java | 2 +-
...ridPortableCacheEntryMemorySizeSelfTest.java | 2 +-
...leDuplicateIndexObjectsAbstractSelfTest.java | 2 +-
.../DataStreamProcessorPortableSelfTest.java | 2 +-
.../GridDataStreamerImplSelfTest.java | 2 +-
...ridCacheAffinityRoutingPortableSelfTest.java | 2 +-
.../GridCacheMemoryModePortableSelfTest.java | 2 +-
...acheOffHeapTieredAtomicPortableSelfTest.java | 2 +-
...eapTieredEvictionAtomicPortableSelfTest.java | 2 +-
...heOffHeapTieredEvictionPortableSelfTest.java | 2 +-
.../GridCacheOffHeapTieredPortableSelfTest.java | 2 +-
...sNearPartitionedByteArrayValuesSelfTest.java | 2 +-
...sPartitionedOnlyByteArrayValuesSelfTest.java | 2 +-
.../PlatformComputeBinarizableArgTask.java | 8 +-
.../platform/PlatformComputeEchoTask.java | 4 +-
.../session/GridSessionCheckpointSelfTest.java | 16 +
.../tcp/IgniteCacheSslStartStopSelfTest.java | 1 +
.../ignite/testframework/GridTestUtils.java | 61 ++-
.../ignite/testframework/junits/IgniteMock.java | 39 +-
.../junits/IgniteTestResources.java | 11 +
.../multijvm/IgniteCacheProcessProxy.java | 38 ++
...ObjectsCacheDataStructuresSelfTestSuite.java | 33 ++
...BinaryObjectsCacheExpiryPolicyTestSuite.java | 34 ++
...gniteBinaryObjectsCacheRestartTestSuite.java | 33 ++
.../IgniteBinaryObjectsCacheTestSuite2.java | 33 ++
.../IgniteBinaryObjectsCacheTestSuite3.java | 33 ++
.../IgniteBinaryObjectsCacheTestSuite4.java | 33 ++
...IgniteBinaryObjectsComputeGridTestSuite.java | 33 ++
.../IgniteCacheFailoverTestSuite3.java | 6 -
.../IgniteCacheFailoverTestSuiteSsl.java | 41 ++
.../ignite/testsuites/IgniteCacheTestSuite.java | 7 +-
.../testsuites/IgniteCacheTestSuite2.java | 2 -
.../IgnitePortableCacheFullApiTestSuite.java | 2 +-
.../IgnitePortableCacheTestSuite.java | 2 +-
.../IgnitePortableObjectsTestSuite.java | 4 +
modules/flume/README.txt | 44 +-
.../ignite/stream/flume/package-info.java | 21 +
.../ignite/stream/flume/package-info.java | 21 +
.../query/h2/GridH2ResultSetIterator.java | 19 +-
.../processors/query/h2/IgniteH2Indexing.java | 235 ++++++++--
.../query/h2/opt/GridH2RowDescriptor.java | 5 +
.../processors/query/h2/opt/GridH2Table.java | 69 ++-
.../query/h2/opt/GridH2TreeIndex.java | 98 ++--
.../query/h2/sql/GridSqlQuerySplitter.java | 73 ++-
.../processors/query/h2/sql/GridSqlSelect.java | 27 ++
.../query/h2/twostep/GridMapQueryExecutor.java | 17 +-
.../query/h2/twostep/GridMergeIndex.java | 7 +
.../h2/twostep/GridMergeIndexUnsorted.java | 14 +
.../h2/twostep/GridReduceQueryExecutor.java | 117 +++--
.../IgniteCacheAbstractFieldsQuerySelfTest.java | 29 +-
.../cache/IgniteCacheAbstractQuerySelfTest.java | 71 +--
.../cache/IgniteCacheNoClassQuerySelfTest.java | 122 +++++
...niteCacheP2pUnmarshallingQueryErrorTest.java | 2 -
...PartitionedSnapshotEnabledQuerySelfTest.java | 28 ++
.../h2/GridIndexingSpiAbstractSelfTest.java | 19 +
.../IgniteCacheQuerySelfTestSuite.java | 4 +
.../IgnitePortableCacheQueryTestSuite.java | 2 +-
modules/jms11/README.txt | 29 ++
modules/jms11/licenses/apache-2.0.txt | 202 +++++++++
.../ignite/stream/jms11/package-info.java | 21 +
.../ignite/stream/jms11/package-info.java | 21 +
modules/kafka/README.txt | 32 ++
.../ignite/stream/kafka/package-info.java | 21 +
.../ignite/stream/kafka/package-info.java | 21 +
modules/mqtt/README.txt | 29 ++
modules/mqtt/licenses/apache-2.0.txt | 202 +++++++++
.../apache/ignite/stream/mqtt/package-info.java | 21 +
.../apache/ignite/stream/mqtt/package-info.java | 21 +
modules/platforms/README.txt | 6 +
.../impl/binary/binary_type_updater_impl.cpp | 4 +-
.../examples/project/vs/ignite-examples.vcxproj | 6 +-
.../Binary/BinaryBuilderSelfTest.cs | 97 ++--
.../Binary/BinarySelfTest.cs | 48 +-
.../Cache/CacheAbstractTest.cs | 17 +-
.../Compute/ComputeApiTest.cs | 6 +
.../Config/Compute/compute-grid1.xml | 8 +-
.../Config/marshaller-explicit.xml | 2 +-
.../Config/native-client-test-cache-store.xml | 1 +
.../Examples/ExamplesTest.cs | 5 +-
.../Services/ServiceProxyTest.cs | 22 +-
.../Apache.Ignite.Core.csproj | 5 +-
.../Binary/BinaryTypeConfiguration.cs | 16 +-
.../dotnet/Apache.Ignite.Core/Binary/IBinary.cs | 136 ++++++
.../Apache.Ignite.Core/Binary/IBinaryObject.cs | 23 +-
.../Apache.Ignite.Core/Binary/IBinaryType.cs | 13 +
.../Apache.Ignite.Core/Binary/IIgniteBinary.cs | 120 -----
.../dotnet/Apache.Ignite.Core/IIgnite.cs | 6 +-
.../Apache.Ignite.Core/Impl/Binary/Binary.cs | 216 +++++++++
.../Impl/Binary/BinaryEnum.cs | 134 ++++++
.../Impl/Binary/BinaryFullTypeDescriptor.cs | 14 +-
.../Impl/Binary/BinaryObject.cs | 29 ++
.../Impl/Binary/BinaryObjectBuilder.cs | 44 +-
.../Impl/Binary/BinaryReader.cs | 51 ++-
.../Binary/BinarySurrogateTypeDescriptor.cs | 6 +
.../Impl/Binary/BinarySystemHandlers.cs | 34 +-
.../Impl/Binary/BinaryUtils.cs | 96 ++--
.../Impl/Binary/BinaryWriter.cs | 104 +++--
.../Impl/Binary/IBinaryTypeDescriptor.cs | 50 +--
.../Impl/Binary/IgniteBinary.cs | 192 --------
.../Impl/Binary/Marshaller.cs | 88 ++--
.../Impl/Binary/Metadata/BinaryType.cs | 184 ++++----
.../Impl/Binary/Metadata/BinaryTypeHolder.cs | 34 +-
.../Binary/Structure/BinaryStructureTracker.cs | 2 +-
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 11 +-
.../Apache.Ignite.Core/Impl/IgniteProxy.cs | 2 +-
.../Apache.Ignite.Core/Impl/PlatformTarget.cs | 11 +-
.../Impl/Transactions/TransactionsImpl.cs | 4 +-
.../Messaging/MessagingExample.cs | 9 +-
.../Services/ServicesExample.cs | 4 +
.../examples/Config/example-cache-query.xml | 9 +-
.../dotnet/examples/Config/example-cache.xml | 9 +-
modules/scalar/pom.xml | 4 +-
.../test/resources/spring-ping-pong-partner.xml | 18 -
modules/spark/pom.xml | 4 +-
.../ignite/cache/store/spring/package-info.java | 21 +
.../ignite/stream/twitter/package-info.java | 21 +
.../twitter/IgniteTwitterStreamerTestSuite.java | 19 +-
.../ignite/stream/twitter/package-info.java | 21 +
modules/visor-console/pom.xml | 2 +-
.../ignite-int-max-values-offheap-config.xml | 89 ++++
.../ignite-int-max-values-onheap-config.xml | 84 ++++
.../ignite-int-max-values-swap-config.xml | 93 ++++
.../test-max-int-values-offheap.properties | 70 +++
.../test-max-int-values-onheap.properties | 70 +++
.../config/test-max-int-values-swap.properties | 69 +++
.../yardstick/cache/IntMaxValueEntriesTest.java | 135 ++++++
modules/yarn/pom.xml | 6 +-
.../yarn/IgniteApplicationMasterSelfTest.java | 11 +-
modules/zookeeper/README.txt | 29 ++
modules/zookeeper/licenses/apache-2.0.txt | 202 +++++++++
.../discovery/tcp/ipfinder/zk/package-info.java | 21 +
parent/pom.xml | 2 +-
359 files changed, 9640 insertions(+), 3714 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/03ceffa3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/03ceffa3/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java
----------------------------------------------------------------------
[21/50] [abbrv] ignite git commit: ignite-2013
GridCacheEvictionLockUnlockSelfTest.testPartitioned test fixed
Posted by ra...@apache.org.
ignite-2013 GridCacheEvictionLockUnlockSelfTest.testPartitioned test fixed
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/95ab2310
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/95ab2310
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/95ab2310
Branch: refs/heads/master
Commit: 95ab2310d2db49baadceefe3e667a3e1c930c926
Parents: 1727df6
Author: agura <ag...@gridgain.com>
Authored: Thu Nov 26 21:54:34 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Fri Nov 27 14:45:19 2015 +0300
----------------------------------------------------------------------
.../cache/eviction/GridCacheEvictionLockUnlockSelfTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/95ab2310/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java
index 11faca3..75f5c8f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java
@@ -142,7 +142,7 @@ public class GridCacheEvictionLockUnlockSelfTest extends GridCommonAbstractTest
assertEquals(gridCnt, touchCnt.get());
for (int j = 0; j < gridCnt; j++)
- assertFalse(jcache(j).containsKey("key"));
+ assertEquals(0, jcache(j).size());
}
}
finally {
[31/50] [abbrv] ignite git commit: typo fix
Posted by ra...@apache.org.
typo fix
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fb5d54a6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fb5d54a6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fb5d54a6
Branch: refs/heads/master
Commit: fb5d54a6b7b737b9dbf93651a478ed3d7a21e340
Parents: 292de51
Author: Anton Vinogradov <av...@apache.org>
Authored: Fri Nov 27 19:51:11 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Nov 27 19:51:11 2015 +0300
----------------------------------------------------------------------
RELEASE_NOTES.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb5d54a6/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 42258f7..4985edb 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -10,7 +10,7 @@ Apache Ignite In-Memory Data Fabric 1.5
* Added IgniteSemaphore data structure.
* Added MQTT Streamer.
* Fixed failover for continuous queries.
-* Fixed compilation and runtime errors under OpnJDK and IBM JDK.
+* Fixed compilation and runtime errors under OpenJDK and IBM JDK.
* Fixed Integer.size limitation for cache.
* Fixed and improved cache types configuration.
* Fixed cache rebalancing.
[44/50] [abbrv] ignite git commit: Fixed performance suggestions.
Posted by ra...@apache.org.
Fixed performance suggestions.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0b61333a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0b61333a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0b61333a
Branch: refs/heads/master
Commit: 0b61333a34be7fac8309ce050aa383f757f6187e
Parents: 923fea8
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Sun Nov 29 17:11:08 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Sun Nov 29 17:11:08 2015 +0300
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/internal/IgniteKernal.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b61333a/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 05b1997..87ccf93 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
@@ -1192,7 +1192,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
if (cfg.getIncludeEventTypes() != null && cfg.getIncludeEventTypes().length != 0)
perf.add("Disable grid events (remove 'includeEventTypes' from configuration)");
- if (BinaryMarshaller.available() && (cfg.getMarshaller() != null || !(cfg.getMarshaller() instanceof BinaryMarshaller)))
+ if (BinaryMarshaller.available() && (cfg.getMarshaller() != null && !(cfg.getMarshaller() instanceof BinaryMarshaller)))
perf.add("Use default binary marshaller (do not set 'marshaller' explicitly)");
}
[49/50] [abbrv] ignite git commit: ignite-1.5 Handle
marshal/unmarshal prevVals in GridDhtAtomicUpdateRequest.
Posted by ra...@apache.org.
ignite-1.5 Handle marshal/unmarshal prevVals in GridDhtAtomicUpdateRequest.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0fcc1d18
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0fcc1d18
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0fcc1d18
Branch: refs/heads/master
Commit: 0fcc1d18f7d403588e2f018458b1d16c81ed131c
Parents: c5304a9
Author: sboikov <sb...@gridgain.com>
Authored: Mon Nov 30 15:15:06 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Nov 30 15:15:06 2015 +0300
----------------------------------------------------------------------
.../cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0fcc1d18/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
index b3155a7..4f15fa1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
@@ -647,6 +647,8 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
prepareMarshalCacheObjects(nearVals, cctx);
+ prepareMarshalCacheObjects(prevVals, cctx);
+
if (forceTransformBackups) {
// force addition of deployment info for entry processors if P2P is enabled globally.
if (!addDepInfo && ctx.deploymentEnabled())
@@ -674,6 +676,8 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
finishUnmarshalCacheObjects(nearVals, cctx, ldr);
+ finishUnmarshalCacheObjects(prevVals, cctx, ldr);
+
if (forceTransformBackups) {
entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
[12/50] [abbrv] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.5' into ignite-1.5
Posted by ra...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.5' into ignite-1.5
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e4f6224f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e4f6224f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e4f6224f
Branch: refs/heads/master
Commit: e4f6224fabc0561f6ff8de33a8a7721bca3370bc
Parents: 663e78d c2d4d1d
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Nov 27 12:37:50 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Nov 27 12:37:50 2015 +0300
----------------------------------------------------------------------
.../CacheDataStructuresManager.java | 45 ++++++++++++--------
.../datastructures/DataStructuresProcessor.java | 20 +--------
...gniteAtomicLongChangingTopologySelfTest.java | 30 ++++++++++---
3 files changed, 53 insertions(+), 42 deletions(-)
----------------------------------------------------------------------