Merge branch 'gridgain-7.6.2'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5b0dbcae Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5b0dbcae Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5b0dbcae Branch: refs/heads/ignite-1232-1 Commit: 5b0dbcae00a5237862e73b73f203e1c35710e834 Parents: 869db21 Author: Pavel Tupitsyn <[email protected]> Authored: Wed Jul 20 11:49:36 2016 +0300 Committer: Pavel Tupitsyn <[email protected]> Committed: Wed Jul 20 11:49:36 2016 +0300 ---------------------------------------------------------------------- assembly/LICENSE_FABRIC | 7 +- assembly/LICENSE_HADOOP | 7 +- examples/pom-standalone-lgpl.xml | 6 +- examples/pom-standalone.xml | 6 +- examples/pom.xml | 6 +- examples/schema-import/pom-standalone.xml | 6 +- examples/schema-import/pom.xml | 6 +- modules/cassandra/pom.xml | 2 +- modules/core/pom.xml | 6 +- .../ignite/cache/query/ContinuousQuery.java | 47 +++++-- .../processors/cache/IgniteCacheProxy.java | 3 +- .../continuous/CacheContinuousQueryManager.java | 9 +- .../PlatformAffinityFunctionTarget.java | 8 +- .../cache/affinity/PlatformAffinityUtils.java | 5 + ...ridCacheContinuousQueryAbstractSelfTest.java | 47 +++++++ modules/flume/README.txt | 2 +- modules/kafka/README.txt | 4 +- .../platforms/cpp/jni/include/ignite/jni/java.h | 8 +- .../Apache.Ignite.Core.Tests.csproj | 3 + .../Affinity/AffinityFunctionSpringTest.cs | 104 +++++++------- .../Cache/CacheConfigurationTest.cs | 1 + .../Cache/Affinity/affinity-function2.xml | 49 +++++++ .../Apache.Ignite.Core.Tests/DeploymentTest.cs | 2 +- .../Apache.Ignite.Core.Tests/TestRunner.cs | 2 +- .../Apache.Ignite.Core.csproj | 13 +- .../Cache/Affinity/Fair/FairAffinityFunction.cs | 1 + .../Cache/Affinity/Fair/Package-Info.cs | 26 ++++ .../Cache/Affinity/Package-Info.cs | 26 ++++ .../Cache/Affinity/Rendezvous/Package-Info.cs | 26 ++++ .../Rendezvous/RendezvousAffinityFunction.cs | 1 + .../Cache/Configuration/Package-Info.cs | 26 ++++ .../Cache/Eviction/Package-Info.cs | 26 ++++ .../Communication/Package-Info.cs | 26 ++++ .../Communication/Tcp/Package-Info.cs | 26 ++++ .../dotnet/Apache.Ignite.Core/Ignition.cs | 2 +- .../Impl/Binary/BinaryReaderExtensions.cs | 2 +- .../Impl/Cache/Affinity/AffinityFunctionBase.cs | 140 +++++++++++++++++++ .../Apache.Ignite.Core/Impl/IgniteUtils.cs | 2 +- .../Impl/Unmanaged/UnmanagedCallbacks.cs | 2 +- parent/pom.xml | 1 + 40 files changed, 585 insertions(+), 107 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/assembly/LICENSE_FABRIC ---------------------------------------------------------------------- diff --git a/assembly/LICENSE_FABRIC b/assembly/LICENSE_FABRIC index 8cb5730..b9c75b2 100644 --- a/assembly/LICENSE_FABRIC +++ b/assembly/LICENSE_FABRIC @@ -1,4 +1,3 @@ - Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -227,6 +226,12 @@ For details, see CC0 1.0 Universal (1.0), Public Domain Dedication, http://creativecommons.org/publicdomain/zero/1.0/ ============================================================================== +For JSR107 API and SPI (https://github.com/jsr107/jsr107spec) javax.cache:cache-api:jar:1.0.0 +============================================================================== +This product bundles JSR107 API and SPI which is available under a: +JSR-000107 JCACHE 2.9 Public Review - Updated Specification License. For details, see https://raw.github.com/jsr107/jsr107spec/master/LICENSE.txt. + +============================================================================== For JSch (http://www.jcraft.com/jsch/) com.jcraft:jsch:jar:0.1.50 ============================================================================== This product bundles JSch which is available under a: http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/assembly/LICENSE_HADOOP ---------------------------------------------------------------------- diff --git a/assembly/LICENSE_HADOOP b/assembly/LICENSE_HADOOP index 0d05d52..0256b20 100644 --- a/assembly/LICENSE_HADOOP +++ b/assembly/LICENSE_HADOOP @@ -1,4 +1,3 @@ - Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -227,6 +226,12 @@ For details, see CC0 1.0 Universal (1.0), Public Domain Dedication, http://creativecommons.org/publicdomain/zero/1.0/ ============================================================================== +For JSR107 API and SPI (https://github.com/jsr107/jsr107spec) javax.cache:cache-api:jar:1.0.0 +============================================================================== +This product bundles JSR107 API and SPI which is available under a: +JSR-000107 JCACHE 2.9 Public Review - Updated Specification License. For details, see https://raw.github.com/jsr107/jsr107spec/master/LICENSE.txt. + +============================================================================== For JSch (http://www.jcraft.com/jsch/) com.jcraft:jsch:jar:0.1.50 ============================================================================== This product bundles JSch which is available under a: http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/examples/pom-standalone-lgpl.xml ---------------------------------------------------------------------- diff --git a/examples/pom-standalone-lgpl.xml b/examples/pom-standalone-lgpl.xml index 951fab6..7e7ccc2 100644 --- a/examples/pom-standalone-lgpl.xml +++ b/examples/pom-standalone-lgpl.xml @@ -41,9 +41,9 @@ <dependencies> <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-jcache_1.0_spec</artifactId> - <version>1.0-alpha-1</version> + <groupId>javax.cache</groupId> + <artifactId>cache-api</artifactId> + <version>1.0.0</version> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/examples/pom-standalone.xml ---------------------------------------------------------------------- diff --git a/examples/pom-standalone.xml b/examples/pom-standalone.xml index 20399ee..6247ced 100644 --- a/examples/pom-standalone.xml +++ b/examples/pom-standalone.xml @@ -41,9 +41,9 @@ <dependencies> <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-jcache_1.0_spec</artifactId> - <version>1.0-alpha-1</version> + <groupId>javax.cache</groupId> + <artifactId>cache-api</artifactId> + <version>1.0.0</version> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/examples/pom.xml ---------------------------------------------------------------------- diff --git a/examples/pom.xml b/examples/pom.xml index cba056d..979a46f 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -32,9 +32,9 @@ <dependencies> <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-jcache_1.0_spec</artifactId> - <version>1.0-alpha-1</version> + <groupId>javax.cache</groupId> + <artifactId>cache-api</artifactId> + <version>${javax.cache.version}</version> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/examples/schema-import/pom-standalone.xml ---------------------------------------------------------------------- diff --git a/examples/schema-import/pom-standalone.xml b/examples/schema-import/pom-standalone.xml index 43b76d8..e443728 100644 --- a/examples/schema-import/pom-standalone.xml +++ b/examples/schema-import/pom-standalone.xml @@ -36,9 +36,9 @@ <dependencies> <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-jcache_1.0_spec</artifactId> - <version>1.0-alpha-1</version> + <groupId>javax.cache</groupId> + <artifactId>cache-api</artifactId> + <version>1.0.0</version> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/examples/schema-import/pom.xml ---------------------------------------------------------------------- diff --git a/examples/schema-import/pom.xml b/examples/schema-import/pom.xml index f5ccac0..b6e36ef 100644 --- a/examples/schema-import/pom.xml +++ b/examples/schema-import/pom.xml @@ -39,9 +39,9 @@ <dependencies> <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-jcache_1.0_spec</artifactId> - <version>1.0-alpha-1</version> + <groupId>javax.cache</groupId> + <artifactId>cache-api</artifactId> + <version>${javax.cache.version}</version> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/cassandra/pom.xml ---------------------------------------------------------------------- diff --git a/modules/cassandra/pom.xml b/modules/cassandra/pom.xml index c9ff87d..dc8b08c 100644 --- a/modules/cassandra/pom.xml +++ b/modules/cassandra/pom.xml @@ -236,7 +236,7 @@ org.apache.ignite,org.springframework,org.gridgain </excludeGroupIds> <excludeArtifactIds> - commons-logging,slf4j-api,geronimo-jcache_1.0_spec,slf4j-api,aopalliance + commons-logging,slf4j-api,cache-api,slf4j-api,aopalliance </excludeArtifactIds> <includeScope>runtime</includeScope> </configuration> http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/core/pom.xml ---------------------------------------------------------------------- diff --git a/modules/core/pom.xml b/modules/core/pom.xml index 7529b0b..5e32caf 100644 --- a/modules/core/pom.xml +++ b/modules/core/pom.xml @@ -63,9 +63,9 @@ <dependencies> <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-jcache_1.0_spec</artifactId> - <version>1.0-alpha-1</version> + <groupId>javax.cache</groupId> + <artifactId>cache-api</artifactId> + <version>${javax.cache.version}</version> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/core/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java b/modules/core/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java index bbfe8cc..49d471e 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/query/ContinuousQuery.java @@ -21,6 +21,7 @@ import javax.cache.Cache; import javax.cache.configuration.Factory; import javax.cache.event.CacheEntryEventFilter; import javax.cache.event.CacheEntryUpdatedListener; +import javax.cache.event.EventType; import org.apache.ignite.IgniteCache; import org.apache.ignite.cache.CacheEntryEventSerializableFilter; import org.apache.ignite.configuration.IgniteConfiguration; @@ -142,6 +143,9 @@ public final class ContinuousQuery<K, V> extends Query<Cache.Entry<K, V>> { /** Automatic unsubscription flag. */ private boolean autoUnsubscribe = DFLT_AUTO_UNSUBSCRIBE; + /** Whether to notify about {@link EventType#EXPIRED} events. */ + private boolean includeExpired; + /** * Creates new continuous query. */ @@ -324,6 +328,38 @@ public final class ContinuousQuery<K, V> extends Query<Cache.Entry<K, V>> { return this; } + /** + * Gets automatic unsubscription flag value. + * + * @return Automatic unsubscription flag. + */ + public boolean isAutoUnsubscribe() { + return autoUnsubscribe; + } + + /** + * Sets the flag value defining whether to notify about {@link EventType#EXPIRED} events. + * If {@code true}, then the remote listener will get notifications about entries + * expired in cache. Otherwise, only {@link EventType#CREATED}, {@link EventType#UPDATED} + * and {@link EventType#REMOVED} events will be fired in the remote listener. + * <p> + * This flag is {@code false} by default, so {@link EventType#EXPIRED} events are disabled. + * + * @param includeExpired Whether to notify about {@link EventType#EXPIRED} events. + */ + public void setIncludeExpired(boolean includeExpired) { + this.includeExpired = includeExpired; + } + + /** + * Gets the flag value defining whether to notify about {@link EventType#EXPIRED} events. + * + * @return Whether to notify about {@link EventType#EXPIRED} events. + */ + public boolean isIncludeExpired() { + return includeExpired; + } + /** {@inheritDoc} */ @Override public ContinuousQuery<K, V> setPageSize(int pageSize) { return (ContinuousQuery<K, V>)super.setPageSize(pageSize); @@ -333,13 +369,4 @@ public final class ContinuousQuery<K, V> extends Query<Cache.Entry<K, V>> { @Override public ContinuousQuery<K, V> setLocal(boolean loc) { return (ContinuousQuery<K, V>)super.setLocal(loc); } - - /** - * Gets automatic unsubscription flag value. - * - * @return Automatic unsubscription flag. - */ - public boolean isAutoUnsubscribe() { - return autoUnsubscribe; - } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java index fe4f79c..0d7bc6a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java @@ -616,7 +616,8 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V qry.getTimeInterval(), qry.isAutoUnsubscribe(), loc, - keepBinary); + keepBinary, + qry.isIncludeExpired()); final QueryCursor<Cache.Entry<K, V>> cur = qry.getInitialQuery() != null ? query(qry.getInitialQuery()) : null; http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java index 195f3ae..a8e5a6b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java @@ -421,7 +421,8 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter { long timeInterval, boolean autoUnsubscribe, boolean loc, - final boolean keepBinary) throws IgniteCheckedException + final boolean keepBinary, + final boolean includeExpired) throws IgniteCheckedException { IgniteClosure<Boolean, CacheContinuousQueryHandler> clsr; @@ -438,7 +439,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter { rmtFilterFactory, true, false, - true, + !includeExpired, false, null); else { @@ -456,7 +457,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter { (CacheEntryEventSerializableFilter)fltr, true, false, - true, + !includeExpired, false); } @@ -473,7 +474,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter { rmtFilter, true, false, - true, + !includeExpired, false); } }; http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunctionTarget.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunctionTarget.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunctionTarget.java index d83dd08..8a07b33 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunctionTarget.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunctionTarget.java @@ -64,7 +64,8 @@ public class PlatformAffinityFunctionTarget extends PlatformAbstractTarget { try { platformCtx.kernalContext().resource().injectGeneric(baseFunc); - } catch (IgniteCheckedException e) { + } + catch (IgniteCheckedException e) { throw U.convertException(e); } } @@ -75,6 +76,7 @@ public class PlatformAffinityFunctionTarget extends PlatformAbstractTarget { return baseFunc.partition(reader.readObjectDetached()); else if (type == OP_REMOVE_NODE) { baseFunc.removeNode(reader.readUuid()); + return 0; } @@ -88,7 +90,7 @@ public class PlatformAffinityFunctionTarget extends PlatformAbstractTarget { if (affCtx == null) throw new IgniteException("Thread-local AffinityFunctionContext is null. " + - "This may indicate an unsupported call to the base AffinityFunction"); + "This may indicate an unsupported call to the base AffinityFunction."); final List<List<ClusterNode>> partitions = baseFunc.assignPartitions(affCtx); @@ -100,8 +102,6 @@ public class PlatformAffinityFunctionTarget extends PlatformAbstractTarget { super.processOutStream(type, writer); } - - /** * Sets the context for current operation. * http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityUtils.java index 6d14cab..bff6cd2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityUtils.java @@ -47,9 +47,11 @@ public class PlatformAffinityUtils { assert ctx != null; ctx.writeNodes(writer, affCtx.currentTopologySnapshot()); + writer.writeInt(affCtx.backups()); writer.writeLong(affCtx.currentTopologyVersion().topologyVersion()); writer.writeInt(affCtx.currentTopologyVersion().minorTopologyVersion()); + ctx.writeEvent(writer, affCtx.discoveryEvent()); // Write previous assignment @@ -95,11 +97,14 @@ public class PlatformAffinityUtils { assert ctx != null; int partCnt = reader.readInt(); + List<List<ClusterNode>> res = new ArrayList<>(partCnt); + IgniteClusterEx cluster = ctx.kernalContext().grid().cluster(); for (int i = 0; i < partCnt; i++) { int partSize = reader.readInt(); + List<ClusterNode> part = new ArrayList<>(partSize); for (int j = 0; j < partSize; j++) http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java index f372e0d..d5dc557 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java @@ -34,6 +34,9 @@ import javax.cache.Cache; import javax.cache.configuration.Factory; import javax.cache.event.CacheEntryEvent; import javax.cache.event.CacheEntryUpdatedListener; +import javax.cache.event.EventType; +import javax.cache.expiry.CreatedExpiryPolicy; +import javax.cache.expiry.Duration; import javax.cache.integration.CacheWriterException; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; @@ -1093,6 +1096,50 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo } /** + * @throws Exception If failed. + */ + public void testExpired() throws Exception { + IgniteCache<Object, Object> cache = grid(0).cache(null). + withExpiryPolicy(new CreatedExpiryPolicy(new Duration(MILLISECONDS, 1000))); + + final Map<Object, Object> map = new ConcurrentHashMap8<>(); + final CountDownLatch latch = new CountDownLatch(2); + + ContinuousQuery<Object, Object> qry = new ContinuousQuery<>(); + + qry.setIncludeExpired(true); + + qry.setLocalListener(new CacheEntryUpdatedListener<Object, Object>() { + @Override public void onUpdated(Iterable<CacheEntryEvent<?, ?>> evts) { + for (CacheEntryEvent<?, ?> e : evts) { + if (e.getEventType() == EventType.EXPIRED) { + assertNull(e.getValue()); + + map.put(e.getKey(), e.getOldValue()); + + latch.countDown(); + } + } + } + }); + + try (QueryCursor<Cache.Entry<Object, Object>> ignored = cache.query(qry)) { + cache.put(1, 1); + cache.put(2, 2); + + // Wait for expiration. + Thread.sleep(2000); + + assert latch.await(LATCH_TIMEOUT, MILLISECONDS); + + assertEquals(2, map.size()); + + assertEquals(1, (int)map.get(1)); + assertEquals(2, (int)map.get(2)); + } + } + + /** * */ private static class StoreFactory implements Factory<CacheStore> { http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/flume/README.txt ---------------------------------------------------------------------- diff --git a/modules/flume/README.txt b/modules/flume/README.txt index 97d8cac..bf7e0ff 100644 --- a/modules/flume/README.txt +++ b/modules/flume/README.txt @@ -20,7 +20,7 @@ plugins.d/ |-- lib | `-- ignite-flume-transformer-x.x.x.jar <-- your jar `-- libext - |-- geronimo-jcache_1.0_spec-1.0-alpha-1.jar + |-- cache-api-1.0.0.jar |-- ignite-core-x.x.x.jar |-- ignite-flume-x.x.x.jar <-- IgniteSink |-- ignite-spring-x.x.x.jar http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/kafka/README.txt ---------------------------------------------------------------------- diff --git a/modules/kafka/README.txt b/modules/kafka/README.txt index 80103a6..259a4f6 100644 --- a/modules/kafka/README.txt +++ b/modules/kafka/README.txt @@ -47,7 +47,7 @@ as described in the following subsection. - ignite-kafka-connect-x.x.x-SNAPSHOT.jar - ignite-core-x.x.x-SNAPSHOT.jar - ignite-spring-x.x.x-SNAPSHOT.jar -- geronimo-jcache_1.0_spec-1.0-alpha-1.jar +- cache-api-1.0.0.jar - spring-aop-4.1.0.RELEASE.jar - spring-beans-4.1.0.RELEASE.jar - spring-context-4.1.0.RELEASE.jar @@ -140,7 +140,7 @@ as described in the following subsection. 1. Put the following jar files on Kafka's classpath - ignite-kafka-connect-x.x.x-SNAPSHOT.jar - ignite-core-x.x.x-SNAPSHOT.jar -- geronimo-jcache_1.0_spec-1.0-alpha-1.jar +- cache-api-1.0.0.jar - ignite-spring-x.x.x-SNAPSHOT.jar - spring-aop-4.1.0.RELEASE.jar - spring-beans-4.1.0.RELEASE.jar http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/cpp/jni/include/ignite/jni/java.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/jni/include/ignite/jni/java.h b/modules/platforms/cpp/jni/include/ignite/jni/java.h index 41d7caa..e862f93 100644 --- a/modules/platforms/cpp/jni/include/ignite/jni/java.h +++ b/modules/platforms/cpp/jni/include/ignite/jni/java.h @@ -105,7 +105,7 @@ namespace ignite typedef void(JNICALL *AffinityFunctionAssignPartitionsHandler)(void* target, long long ptr, long long inMemPtr, long long outMemPtr); typedef void(JNICALL *AffinityFunctionRemoveNodeHandler)(void* target, long long ptr, long long memPtr); typedef void(JNICALL *AffinityFunctionDestroyHandler)(void* target, long long ptr); - + typedef void(JNICALL *ConsoleWriteHandler)(const char* chars, int charsLen, unsigned char isErr); /** @@ -185,7 +185,7 @@ namespace ignite OnClientDisconnectedHandler onClientDisconnected; OnClientReconnectedHandler onClientReconnected; - + AffinityFunctionInitHandler affinityFunctionInit; AffinityFunctionPartitionHandler affinityFunctionPartition; AffinityFunctionAssignPartitionsHandler affinityFunctionAssignPartitions; @@ -550,7 +550,7 @@ namespace ignite jobject ProcessorAtomicReference(jobject obj, char* name, long long memPtr, bool create); void ProcessorGetIgniteConfiguration(jobject obj, long long memPtr); void ProcessorGetCacheNames(jobject obj, long long memPtr); - + long long TargetInStreamOutLong(jobject obj, int type, long long memPtr, JniErrorInfo* errInfo = NULL); void TargetInStreamOutStream(jobject obj, int opType, long long inMemPtr, long long outMemPtr, JniErrorInfo* errInfo = NULL); jobject TargetInStreamOutObject(jobject obj, int type, long long memPtr, JniErrorInfo* errInfo = NULL); @@ -761,7 +761,7 @@ namespace ignite JNIEXPORT void JNICALL JniAffinityFunctionAssignPartitions(JNIEnv *env, jclass cls, jlong envPtr, jlong ptr, jlong inMemPtr, jlong outMemPtr); JNIEXPORT void JNICALL JniAffinityFunctionRemoveNode(JNIEnv *env, jclass cls, jlong envPtr, jlong ptr, jlong memPtr); JNIEXPORT void JNICALL JniAffinityFunctionDestroy(JNIEnv *env, jclass cls, jlong envPtr, jlong ptr); - + JNIEXPORT void JNICALL JniConsoleWrite(JNIEnv *env, jclass cls, jstring str, jboolean isErr); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj index d0d1934..5c10612 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj @@ -210,6 +210,9 @@ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <SubType>Designer</SubType> </Content> + <Content Include="Config\Cache\Affinity\affinity-function2.xml"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> <Content Include="Config\Cache\Affinity\affinity-function.xml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionSpringTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionSpringTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionSpringTest.cs index a1e2ad8..8d118be 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionSpringTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionSpringTest.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -34,40 +34,26 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity /// </summary> public class AffinityFunctionSpringTest : IgniteTestBase { - /** */ - private IIgnite _ignite; - /// <summary> /// Initializes a new instance of the <see cref="AffinityFunctionSpringTest"/> class. /// </summary> - public AffinityFunctionSpringTest() : base(6, "config\\cache\\affinity\\affinity-function.xml") + public AffinityFunctionSpringTest() : base(6, + "config\\cache\\affinity\\affinity-function.xml", + "config\\cache\\affinity\\affinity-function2.xml") { // No-op. } - /** <inheritdoc /> */ - public override void TestSetUp() - { - base.TestSetUp(); - - // Start another node without spring config - if (Ignition.TryGetIgnite("grid2") == null) - { - var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration()) {GridName = "grid2"}; - _ignite = Ignition.Start(cfg); - } - } - /// <summary> /// Tests the static cache. /// </summary> [Test] public void TestStaticCache() { - ValidateAffinityFunction(Grid.GetCache<int, int>("cache1")); - ValidateAffinityFunction(_ignite.GetCache<int, int>("cache1")); - ValidateAffinityFunction(Grid.GetCache<int, int>("cache2")); - ValidateAffinityFunction(_ignite.GetCache<int, int>("cache2")); + ValidateAffinityFunction(Grid.GetCache<long, int>("cache1")); + ValidateAffinityFunction(Grid2.GetCache<long, int>("cache1")); + ValidateAffinityFunction(Grid.GetCache<long, int>("cache2")); + ValidateAffinityFunction(Grid2.GetCache<long, int>("cache2")); } /// <summary> @@ -76,51 +62,46 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity [Test] public void TestDynamicCache() { - ValidateAffinityFunction(Grid.CreateCache<int, int>("dyn-cache-1")); - ValidateAffinityFunction(_ignite.GetCache<int, int>("dyn-cache-1")); + ValidateAffinityFunction(Grid.CreateCache<long, int>("dyn-cache-1")); + ValidateAffinityFunction(Grid2.GetCache<long, int>("dyn-cache-1")); - ValidateAffinityFunction(_ignite.CreateCache<int, int>("dyn-cache-2")); - ValidateAffinityFunction(Grid.GetCache<int, int>("dyn-cache-2")); + ValidateAffinityFunction(Grid2.CreateCache<long, int>("dyn-cache-2")); + ValidateAffinityFunction(Grid.GetCache<long, int>("dyn-cache-2")); - ValidateAffinityFunction(Grid.CreateCache<int, int>("dyn-cache2-1")); - ValidateAffinityFunction(_ignite.GetCache<int, int>("dyn-cache2-1")); + ValidateAffinityFunction(Grid.CreateCache<long, int>("dyn-cache2-1")); + ValidateAffinityFunction(Grid2.GetCache<long, int>("dyn-cache2-1")); - ValidateAffinityFunction(_ignite.CreateCache<int, int>("dyn-cache2-2")); - ValidateAffinityFunction(Grid.GetCache<int, int>("dyn-cache2-2")); + ValidateAffinityFunction(Grid2.CreateCache<long, int>("dyn-cache2-2")); + ValidateAffinityFunction(Grid.GetCache<long, int>("dyn-cache2-2")); } /// <summary> /// Validates the affinity function. /// </summary> /// <param name="cache">The cache.</param> - private static void ValidateAffinityFunction(ICache<int, int> cache) + private static void ValidateAffinityFunction(ICache<long, int> cache) { var aff = cache.Ignite.GetAffinity(cache.Name); - Assert.AreEqual(5, aff.Partitions); - Assert.AreEqual(4, aff.GetPartition(2)); - Assert.AreEqual(3, aff.GetPartition(4)); - var func = (ITestFunc) cache.GetConfiguration().AffinityFunction; - Assert.AreEqual(5, func.Partitions); - Assert.AreEqual(1, func.Property1); - Assert.AreEqual("1", func.Property2); - } + Assert.AreEqual(5, aff.Partitions); - private interface ITestFunc : IAffinityFunction - { - int Property1 { get; set; } + // Predefined map + Assert.AreEqual(2, aff.GetPartition(1L)); + Assert.AreEqual(1, aff.GetPartition(2L)); - string Property2 { get; set; } + // Other keys + Assert.AreEqual(1, aff.GetPartition(13L)); + Assert.AreEqual(3, aff.GetPartition(4L)); } - private class TestFunc : ITestFunc // [Serializable] is not necessary + private class TestFunc : IAffinityFunction // [Serializable] is not necessary { [InstanceResource] private readonly IIgnite _ignite = null; - public int Property1 { get; set; } + private int Property1 { get; set; } - public string Property2 { get; set; } + private string Property2 { get; set; } public int Partitions { @@ -133,9 +114,16 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity Assert.AreEqual(1, Property1); Assert.AreEqual("1", Property2); - return (int) key * 2 % 5; + var longKey = (long)key; + int res; + + if (TestFairFunc.PredefinedParts.TryGetValue(longKey, out res)) + return res; + + return (int)(longKey * 2 % 5); } + // ReSharper disable once UnusedParameter.Local public void RemoveNode(Guid nodeId) { // No-op. @@ -147,14 +135,20 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity } } - private class TestFairFunc : FairAffinityFunction, ITestFunc // [Serializable] is not necessary + private class TestFairFunc : FairAffinityFunction // [Serializable] is not necessary { + public static readonly Dictionary<long, int> PredefinedParts = new Dictionary<long, int> + { + {1, 2}, + {2, 1} + }; + [InstanceResource] private readonly IIgnite _ignite = null; - public int Property1 { get; set; } + private int Property1 { get; set; } - public string Property2 { get; set; } + private string Property2 { get; set; } public override int GetPartition(object key) { @@ -162,11 +156,19 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity Assert.AreEqual(1, Property1); Assert.AreEqual("1", Property2); + Assert.IsInstanceOf<long>(key); + var basePart = base.GetPartition(key); Assert.Greater(basePart, -1); Assert.Less(basePart, Partitions); - return (int) key * 2 % 5; + var longKey = (long) key; + int res; + + if (PredefinedParts.TryGetValue(longKey, out res)) + return res; + + return (int) (longKey * 2 % 5); } public override IEnumerable<IEnumerable<IClusterNode>> AssignPartitions(AffinityFunctionContext context) http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs index da68ca2..7bd1ba5 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs @@ -28,6 +28,7 @@ namespace Apache.Ignite.Core.Tests.Cache using Apache.Ignite.Core.Cache.Eviction; using Apache.Ignite.Core.Cache.Store; using Apache.Ignite.Core.Common; + using Apache.Ignite.Core.Impl.Cache.Affinity; using NUnit.Framework; /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Cache/Affinity/affinity-function2.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Cache/Affinity/affinity-function2.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Cache/Affinity/affinity-function2.xml new file mode 100644 index 0000000..cab34b5 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Cache/Affinity/affinity-function2.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:util="http://www.springframework.org/schema/util" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/util + http://www.springframework.org/schema/util/spring-util.xsd"> + <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> + <property name="localHost" value="127.0.0.1"/> + <property name="connectorConfiguration"><null/></property> + <property name="gridName" value="grid2" /> + + <property name="discoverySpi"> + <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> + <property name="ipFinder"> + <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> + <property name="addresses"> + <list> + <!-- In distributed environment, replace with actual host IP address. --> + <value>127.0.0.1:47500</value> + </list> + </property> + </bean> + </property> + <property name="socketTimeout" value="300" /> + </bean> + </property> + </bean> +</beans> http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs index e890dc8..ab5a1a6 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs @@ -45,7 +45,7 @@ namespace Apache.Ignite.Core.Tests // Copy jars var home = IgniteHome.Resolve(null); - var jarNames = new[] {@"\ignite-core-", @"\geronimo-jcache_1.0_spec-1.0-alpha-1.jar", @"\modules\spring\" }; + var jarNames = new[] {@"\ignite-core-", @"\cache-api-1.0.0.jar", @"\modules\spring\" }; var jars = Directory.GetFiles(home, "*.jar", SearchOption.AllDirectories) .Where(jarPath => jarNames.Any(jarPath.Contains)).ToArray(); http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs index 5403ebe..facc598 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/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 fac94a8..b0adf61 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj @@ -84,16 +84,18 @@ </ItemGroup> <ItemGroup> <Compile Include="Binary\BinaryReflectiveSerializer.cs" /> - <Compile Include="Cache\Affinity\AffinityTopologyVersion.cs" /> - <Compile Include="Cache\Affinity\AffinityFunctionContext.cs" /> <Compile Include="Impl\Binary\BinaryReflectiveSerializerInternal.cs" /> <Compile Include="Impl\Binary\IBinarySerializerInternal.cs" /> <Compile Include="Binary\Package-Info.cs" /> - <Compile Include="Cache\Affinity\AffinityFunctionBase.cs" /> <Compile Include="Cache\Affinity\AffinityKey.cs" /> <Compile Include="Cache\Affinity\AffinityKeyMappedAttribute.cs" /> + <Compile Include="Cache\Affinity\AffinityFunctionContext.cs" /> + <Compile Include="Cache\Affinity\AffinityTopologyVersion.cs" /> <Compile Include="Cache\Affinity\Fair\FairAffinityFunction.cs" /> + <Compile Include="Cache\Affinity\Fair\Package-Info.cs" /> <Compile Include="Cache\Affinity\IAffinityFunction.cs" /> + <Compile Include="Cache\Affinity\Package-Info.cs" /> + <Compile Include="Cache\Affinity\Rendezvous\Package-Info.cs" /> <Compile Include="Cache\Affinity\Rendezvous\RendezvousAffinityFunction.cs" /> <Compile Include="Cache\CacheAtomicUpdateTimeoutException.cs" /> <Compile Include="Cache\CacheEntryProcessorException.cs" /> @@ -101,7 +103,11 @@ <Compile Include="Cache\CachePartialUpdateException.cs" /> <Compile Include="Cache\CachePeekMode.cs" /> <Compile Include="Cache\Configuration\NearCacheConfiguration.cs" /> + <Compile Include="Cache\Configuration\Package-Info.cs" /> + <Compile Include="Cache\Eviction\Package-Info.cs" /> <Compile Include="Communication\ICommunicationSpi.cs" /> + <Compile Include="Communication\Package-Info.cs" /> + <Compile Include="Communication\Tcp\Package-Info.cs" /> <Compile Include="Communication\Tcp\TcpCommunicationSpi.cs" /> <Compile Include="DataStructures\Configuration\AtomicConfiguration.cs" /> <Compile Include="Cache\Configuration\QueryAlias.cs" /> @@ -163,6 +169,7 @@ <Compile Include="Impl\Binary\DateTimeSerializer.cs" /> <Compile Include="Impl\Binary\SerializableSerializer.cs" /> <Compile Include="Impl\Binary\BinaryWriterExtensions.cs" /> + <Compile Include="Impl\Cache\Affinity\AffinityFunctionBase.cs" /> <Compile Include="Impl\Binary\UserSerializerProxy.cs" /> <Compile Include="Impl\Cache\Affinity\AffinityFunctionSerializer.cs" /> <Compile Include="Impl\Cache\Affinity\PlatformAffinityFunction.cs" /> http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs index 4a3885f..f06937d 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs @@ -18,6 +18,7 @@ namespace Apache.Ignite.Core.Cache.Affinity.Fair { using System; + using Apache.Ignite.Core.Impl.Cache.Affinity; /// <summary> /// Fair affinity function which tries to ensure that all nodes get equal number of partitions with http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/Package-Info.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/Package-Info.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/Package-Info.cs new file mode 100644 index 0000000..29a21bd --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/Package-Info.cs @@ -0,0 +1,26 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#pragma warning disable 1587 // invalid XML comment + +/// <summary> +/// Fair affinity API. +/// </summary> +namespace Apache.Ignite.Core.Cache.Affinity.Fair +{ + // No-op. +} http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Package-Info.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Package-Info.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Package-Info.cs new file mode 100644 index 0000000..dfbdf08 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Package-Info.cs @@ -0,0 +1,26 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#pragma warning disable 1587 // invalid XML comment + +/// <summary> +/// Cache affinity API. +/// </summary> +namespace Apache.Ignite.Core.Cache.Affinity +{ + // No-op. +} http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/Package-Info.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/Package-Info.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/Package-Info.cs new file mode 100644 index 0000000..4b7f9af --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/Package-Info.cs @@ -0,0 +1,26 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#pragma warning disable 1587 // invalid XML comment + +/// <summary> +/// Rendezvous affinity API. +/// </summary> +namespace Apache.Ignite.Core.Cache.Affinity.Rendezvous +{ + // No-op. +} http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs index 98ec364..928324c 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs @@ -18,6 +18,7 @@ namespace Apache.Ignite.Core.Cache.Affinity.Rendezvous { using System; + using Apache.Ignite.Core.Impl.Cache.Affinity; /// <summary> /// Affinity function for partitioned cache based on Highest Random Weight algorithm. http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/Package-Info.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/Package-Info.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/Package-Info.cs new file mode 100644 index 0000000..fb8ed61 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/Package-Info.cs @@ -0,0 +1,26 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#pragma warning disable 1587 // invalid XML comment + +/// <summary> +/// Ignite Configuration API. +/// </summary> +namespace Apache.Ignite.Core.Cache.Configuration +{ + // No-op. +} http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Eviction/Package-Info.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Eviction/Package-Info.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Eviction/Package-Info.cs new file mode 100644 index 0000000..13f56a8 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Eviction/Package-Info.cs @@ -0,0 +1,26 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#pragma warning disable 1587 // invalid XML comment + +/// <summary> +/// Eviction API. +/// </summary> +namespace Apache.Ignite.Core.Cache.Eviction +{ + // No-op. +} http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core/Communication/Package-Info.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Communication/Package-Info.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Communication/Package-Info.cs new file mode 100644 index 0000000..b504809 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Communication/Package-Info.cs @@ -0,0 +1,26 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#pragma warning disable 1587 // invalid XML comment + +/// <summary> +/// Communication API. +/// </summary> +namespace Apache.Ignite.Core.Communication +{ + // No-op. +} http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core/Communication/Tcp/Package-Info.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Communication/Tcp/Package-Info.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Communication/Tcp/Package-Info.cs new file mode 100644 index 0000000..b33e01f --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Communication/Tcp/Package-Info.cs @@ -0,0 +1,26 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#pragma warning disable 1587 // invalid XML comment + +/// <summary> +/// TCP communication API. +/// </summary> +namespace Apache.Ignite.Core.Communication.Tcp +{ + // No-op. +} http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs index c7e7eff..7fbd100 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs @@ -312,7 +312,7 @@ namespace Apache.Ignite.Core /// <param name="reader">Reader.</param> /// <param name="outStream">Output stream.</param> /// <param name="handleRegistry">Handle registry.</param> - private static void PrepareLifecycleBeans(IBinaryRawReader reader, IBinaryStream outStream, + private static void PrepareLifecycleBeans(IBinaryRawReader reader, IBinaryStream outStream, HandleRegistry handleRegistry) { IList<LifecycleBeanHolder> beans = new List<LifecycleBeanHolder> http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReaderExtensions.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReaderExtensions.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReaderExtensions.cs index 7f949d0..7556c41 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReaderExtensions.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReaderExtensions.cs @@ -76,7 +76,7 @@ namespace Apache.Ignite.Core.Impl.Binary { return reader.ReadBoolean() ? reader.ReadLongAsTimespan() : (TimeSpan?) null; } - + /// <summary> /// Reads the nullable int. /// </summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionBase.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionBase.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionBase.cs new file mode 100644 index 0000000..8536e4c --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionBase.cs @@ -0,0 +1,140 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.Core.Impl.Cache.Affinity +{ + using System; + using System.Collections.Generic; + using System.ComponentModel; + using Apache.Ignite.Core.Cache.Affinity; + using Apache.Ignite.Core.Cluster; + using Apache.Ignite.Core.Common; + + /// <summary> + /// Base class for predefined affinity functions. + /// </summary> + [Serializable] + public abstract class AffinityFunctionBase : IAffinityFunction + { + /// <summary> The default value for <see cref="Partitions"/> property. </summary> + public const int DefaultPartitions = 1024; + + /** */ + private int _partitions = DefaultPartitions; + + /** */ + private IAffinityFunction _baseFunction; + + + /// <summary> + /// Gets or sets the total number of partitions. + /// </summary> + [DefaultValue(DefaultPartitions)] + public virtual int Partitions + { + get { return _partitions; } + set { _partitions = value; } + } + + /// <summary> + /// Gets partition number for a given key starting from 0. Partitioned caches + /// should make sure that keys are about evenly distributed across all partitions + /// from 0 to <see cref="Partitions" /> for best performance. + /// <para /> + /// Note that for fully replicated caches it is possible to segment key sets among different + /// grid node groups. In that case each node group should return a unique partition + /// number. However, unlike partitioned cache, mappings of keys to nodes in + /// replicated caches are constant and a node cannot migrate from one partition + /// to another. + /// </summary> + /// <param name="key">Key to get partition for.</param> + /// <returns> + /// Partition number for a given key. + /// </returns> + public virtual int GetPartition(object key) + { + ThrowIfUninitialized(); + + return _baseFunction.GetPartition(key); + } + + /// <summary> + /// Removes node from affinity. This method is called when it is safe to remove + /// disconnected node from affinity mapping. + /// </summary> + /// <param name="nodeId">The node identifier.</param> + public virtual void RemoveNode(Guid nodeId) + { + ThrowIfUninitialized(); + + _baseFunction.RemoveNode(nodeId); + } + + /// <summary> + /// Gets affinity nodes for a partition. In case of replicated cache, all returned + /// nodes are updated in the same manner. In case of partitioned cache, the returned + /// list should contain only the primary and back up nodes with primary node being + /// always first. + /// <pare /> + /// Note that partitioned affinity must obey the following contract: given that node + /// <code>N</code> is primary for some key <code>K</code>, if any other node(s) leave + /// grid and no node joins grid, node <code>N</code> will remain primary for key <code>K</code>. + /// </summary> + /// <param name="context">The affinity function context.</param> + /// <returns> + /// A collection of partitions, where each partition is a collection of nodes, + /// where first node is a primary node, and other nodes are backup nodes. + /// </returns> + public virtual IEnumerable<IEnumerable<IClusterNode>> AssignPartitions(AffinityFunctionContext context) + { + ThrowIfUninitialized(); + + return _baseFunction.AssignPartitions(context); + } + + /// <summary> + /// Gets or sets a value indicating whether to exclude same-host-neighbors from being backups of each other. + /// </summary> + public virtual bool ExcludeNeighbors { get; set; } + + /// <summary> + /// Initializes a new instance of the <see cref="AffinityFunctionBase"/> class. + /// </summary> + internal AffinityFunctionBase() + { + // No-op. + } + + /// <summary> + /// Sets the base function. + /// </summary> + /// <param name="baseFunc">The base function.</param> + internal void SetBaseFunction(IAffinityFunction baseFunc) + { + _baseFunction = baseFunc; + } + + /// <summary> + /// Gets the direct usage error. + /// </summary> + private void ThrowIfUninitialized() + { + if (_baseFunction == null) + throw new IgniteException(GetType() + " has not yet been initialized."); + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs index fdadb1c..048c8ac 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs @@ -199,7 +199,7 @@ namespace Apache.Ignite.Core.Impl if (errCode == 0) return; - messages.Add(string.Format(CultureInfo.InvariantCulture, "[option={0}, path={1}, error={2}]", + messages.Add(string.Format(CultureInfo.InvariantCulture, "[option={0}, path={1}, error={2}]", dllPath.Key, dllPath.Value, FormatWin32Error(errCode))); if (dllPath.Value == configJvmDllPath) http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs index 4cbdf8f..9719bba 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. http://git-wip-us.apache.org/repos/asf/ignite/blob/5b0dbcae/parent/pom.xml ---------------------------------------------------------------------- diff --git a/parent/pom.xml b/parent/pom.xml index e4a6f84..3e9a71c 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -76,6 +76,7 @@ <jackson.version>1.9.13</jackson.version> <jackson2.version>2.7.5</jackson2.version> <javax.cache.bundle.version>1.0.0_1</javax.cache.bundle.version> + <javax.cache.version>1.0.0</javax.cache.version> <jetty.version>9.2.11.v20150529</jetty.version> <jms.spec.version>1.1.1</jms.spec.version> <jsch.bundle.version>0.1.53_1</jsch.bundle.version>
