Merge remote-tracking branch 'remotes/origin/sprint-2' into ignite-432 Conflicts: modules/core/src/main/java/org/apache/ignite/IgniteCache.java modules/core/src/main/java/org/apache/ignite/cache/affinity/CacheAffinityKeyMapped.java modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerCacheUpdaters.java modules/core/src/main/java/org/apache/ignite/internal/util/GridTimer.java modules/core/src/main/java/org/apache/ignite/lang/IgnitePredicate.java
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/1f7ef61b Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1f7ef61b Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1f7ef61b Branch: refs/heads/ignite-375 Commit: 1f7ef61b6a47ce1ac9c20a49be5bf7f617046db7 Parents: 6657e08 bfda621 Author: avinogradov <avinogra...@gridgain.com> Authored: Tue Mar 17 15:38:58 2015 +0300 Committer: avinogradov <avinogra...@gridgain.com> Committed: Tue Mar 17 15:38:58 2015 +0300 ---------------------------------------------------------------------- assembly/dependencies-hadoop.xml | 7 +- bin/ignite-schema-import.bat | 2 +- bin/ignite-schema-import.sh | 4 +- bin/include/igniteservice.exe | Bin 6144 -> 0 bytes examples/config/store/example-database.script | 22 +- .../config/store/example-jdbc-pojo-store.xml | 142 -- examples/pom.xml | 7 + .../store/CacheNodeWithStoreStartup.java | 45 +- .../datagrid/store/CacheStoreExample.java | 19 + .../store/jdbc/CacheJdbcPojoPersonStore.java | 11 - .../examples/datagrid/store/model/Person.java | 2 +- .../datagrid/store/model/PersonKey.java | 97 - .../apache/ignite/gridify/AbstractAopTest.java | 6 +- .../rest/AbstractRestProcessorSelfTest.java | 2 +- modules/core/pom.xml | 7 + .../META-INF/native/linux64/libigniteshmem.so | Bin 138345 -> 0 bytes .../META-INF/native/osx/libigniteshmem.dylib | Bin 33116 -> 0 bytes .../src/main/java/org/apache/ignite/Ignite.java | 2 +- .../java/org/apache/ignite/IgniteCache.java | 93 +- .../ignite/cache/CacheEntryProcessor.java | 28 + .../java/org/apache/ignite/cache/GridCache.java | 221 --- .../ignite/cache/IgniteEntryProcessor.java | 28 - .../apache/ignite/cache/IgniteImmutable.java | 45 - .../cache/affinity/CacheAffinityKeyMapped.java | 10 +- .../ignite/cache/query/SqlFieldsQuery.java | 7 + .../org/apache/ignite/cache/query/SqlQuery.java | 7 + .../apache/ignite/cache/query/TextQuery.java | 7 + .../cache/store/CacheLoadOnlyStoreAdapter.java | 6 +- .../configuration/CacheConfiguration.java | 3 +- .../igfs/IgfsIpcEndpointConfiguration.java | 20 +- .../apache/ignite/igfs/IgfsIpcEndpointType.java | 2 +- .../ignite/internal/GridKernalContextImpl.java | 7 +- .../org/apache/ignite/internal/IgniteEx.java | 10 +- .../apache/ignite/internal/IgniteKernal.java | 4 +- .../ignite/internal/MarshallerContextImpl.java | 30 +- .../internal/managers/GridManagerAdapter.java | 6 - .../processors/cache/CacheObjectImpl.java | 6 + .../processors/cache/CacheProjection.java | 60 + .../internal/processors/cache/GridCache.java | 222 +++ .../processors/cache/GridCacheAdapter.java | 179 +- .../cache/GridCacheConcurrentMap.java | 2 +- .../cache/GridCacheProjectionImpl.java | 25 + .../processors/cache/GridCacheProxyImpl.java | 60 + .../processors/cache/GridCacheStoreManager.java | 30 +- .../cache/GridCacheWriteBehindStore.java | 69 +- .../processors/cache/IgniteCacheProxy.java | 65 +- .../cache/query/GridCacheQueryManager.java | 1 - .../processors/cache/query/QueryCursorEx.java | 46 + .../processors/cache/query/QueryCursorImpl.java | 14 +- .../continuous/CacheContinuousQueryHandler.java | 3 + .../continuous/CacheContinuousQueryManager.java | 11 +- .../jdbc/GridCacheQueryJdbcMetadataTask.java | 2 +- .../query/jdbc/GridCacheQueryJdbcTask.java | 2 +- .../cacheobject/IgniteCacheObjectProcessor.java | 2 +- .../IgniteCacheObjectProcessorImpl.java | 2 +- .../datastreamer/DataStreamerCacheUpdaters.java | 12 +- .../datastructures/DataStructuresProcessor.java | 1 - .../datastructures/GridCacheSetImpl.java | 1 - .../processors/task/GridTaskProcessor.java | 2 +- .../apache/ignite/internal/util/GridTimer.java | 2 +- .../internal/util/IgniteExceptionRegistry.java | 164 +- .../ignite/internal/util/IgniteUtils.java | 26 + .../util/nio/GridShmemCommunicationClient.java | 146 -- .../apache/ignite/internal/visor/VisorJob.java | 3 + .../internal/visor/VisorMultiNodeTask.java | 1 + .../visor/cache/VisorCacheMetadataTask.java | 1 + .../internal/visor/cache/VisorCacheMetrics.java | 1 + .../cache/VisorCacheMetricsCollectorTask.java | 1 + .../visor/cache/VisorCachePreloadTask.java | 1 + .../visor/cache/VisorCacheResetMetricsTask.java | 1 + .../visor/cache/VisorCacheSwapBackupsTask.java | 1 + .../compute/VisorComputeMonitoringHolder.java | 10 +- .../visor/node/VisorNodeDataCollectorJob.java | 7 +- .../node/VisorNodeDataCollectorJobResult.java | 17 + .../visor/node/VisorNodeDataCollectorTask.java | 2 + .../node/VisorNodeDataCollectorTaskResult.java | 10 + .../node/VisorNodeSuppressedErrorsTask.java | 99 ++ .../internal/visor/query/VisorQueryTask.java | 4 +- .../org/apache/ignite/lang/IgniteImmutable.java | 49 + .../org/apache/ignite/lang/IgnitePredicate.java | 4 +- .../optimized/OptimizedMarshallerUtils.java | 16 +- .../org/apache/ignite/spi/IgniteSpiAdapter.java | 7 +- .../org/apache/ignite/spi/IgniteSpiContext.java | 8 - .../communication/tcp/TcpCommunicationSpi.java | 392 +---- .../tcp/TcpCommunicationSpiMBean.java | 8 - .../TcpDiscoveryMulticastIpFinder.java | 4 +- .../ignite/startup/BasicWarmupClosure.java | 1 + .../StreamerCacheAffinityEventRouter.java | 2 +- .../TransactionSynchronization.java | 2 +- .../resources/META-INF/classnames.properties | 44 +- .../core/src/test/bin/start-nodes-custom.bat | 3 +- .../src/test/config/io-manager-benchmark.xml | 1 - .../config/spring-cache-put-remove-load.xml | 6 - .../core/src/test/config/store/jdbc/Ignite.xml | 2 +- .../GridCacheAffinityBackupsSelfTest.java | 2 + .../cache/store/jdbc/model/Organization.java | 2 +- .../cache/store/jdbc/model/OrganizationKey.java | 2 +- .../ignite/cache/store/jdbc/model/Person.java | 2 +- .../store/jdbc/model/PersonComplexKey.java | 2 +- .../cache/store/jdbc/model/PersonKey.java | 2 +- .../ignite/igfs/IgfsFragmentizerSelfTest.java | 1 + .../cache/GridCacheAbstractFullApiSelfTest.java | 203 ++- .../cache/GridCacheClearLocalySelfTest.java | 19 +- ...CacheFullTextQueryMultithreadedSelfTest.java | 1 - .../GridCacheReturnValueTransferSelfTest.java | 1 + ...idCacheWriteBehindStoreAbstractSelfTest.java | 2 +- .../IgniteCacheContainsKeyAbstractSelfTest.java | 2 - .../GridCacheAbstractJobExecutionTest.java | 9 +- .../GridCacheAtomicTimeoutSelfTest.java | 3 +- .../GridCacheNodeFailureAbstractTest.java | 1 + ...GridCachePreloadRestartAbstractSelfTest.java | 1 + .../IgniteCrossCacheTxStoreSelfTest.java | 6 - .../IgniteTxTimeoutAbstractTest.java | 2 +- .../dht/GridCacheDhtPreloadSelfTest.java | 1 + .../near/GridCacheNearEvictionSelfTest.java | 1 + .../near/GridCacheNearMultiNodeSelfTest.java | 1 + ...GridCachePartitionedFilteredPutSelfTest.java | 1 + ...achePartitionedPreloadLifecycleSelfTest.java | 1 + ...hePartitionedQueryMultiThreadedSelfTest.java | 1 + .../GridCacheReplicatedInvalidateSelfTest.java | 2 +- ...CacheReplicatedPreloadLifecycleSelfTest.java | 1 + ...eCacheAtomicStoreSessionWriteBehindTest.java | 38 + ...acheStoreSessionWriteBehindAbstractTest.java | 269 +++ ...gniteCacheTxStoreSessionWriteBehindTest.java | 32 + .../GridCacheSwapScanQueryAbstractSelfTest.java | 1 + ...ridCacheContinuousQueryAbstractSelfTest.java | 75 +- ...dCacheAbstractReduceFieldsQuerySelfTest.java | 1 - .../processors/igfs/IgfsAbstractSelfTest.java | 1 + .../igfs/IgfsDualAbstractSelfTest.java | 1 + .../igfs/IgfsExUniversalFileSystemAdapter.java | 17 + .../processors/igfs/IgfsProcessorSelfTest.java | 1 + .../processors/igfs/IgfsStreamsSelfTest.java | 1 + .../igfs/UniversalFileSystemAdapter.java | 17 + .../util/IgniteExceptionRegistrySelfTest.java | 51 +- .../communication/GridIoManagerBenchmark0.java | 1 - .../OptimizedMarshallerNodeFailoverTest.java | 200 +++ .../spi/GridTcpSpiForwardingSelfTest.java | 1 - .../GridTcpCommunicationSpiAbstractTest.java | 17 +- ...mmunicationSpiConcurrentConnectSelfTest.java | 1 - .../GridTcpCommunicationSpiConfigSelfTest.java | 2 - ...cpCommunicationSpiMultithreadedSelfTest.java | 13 +- ...pCommunicationSpiMultithreadedShmemTest.java | 28 - ...ommunicationSpiMultithreadedTcpSelfTest.java | 28 - ...dTcpCommunicationSpiRecoveryAckSelfTest.java | 1 - ...GridTcpCommunicationSpiRecoverySelfTest.java | 1 - .../GridTcpCommunicationSpiShmemSelfTest.java | 31 - .../tcp/GridTcpCommunicationSpiTcpSelfTest.java | 6 +- .../GridCacheStoreValueBytesNode.java | 5 - .../testframework/GridSpiTestContext.java | 5 - .../junits/GridTestKernalContext.java | 2 - .../ignite/testsuites/IgniteCacheTestSuite.java | 2 + .../IgniteMarshallerSelfTestSuite.java | 1 + .../IgniteSpiCommunicationSelfTestSuite.java | 4 +- .../query/h2/GridH2IndexingGeoSelfTest.java | 1 - modules/hadoop/pom.xml | 6 + .../HadoopIgfs20FileSystemAbstractSelfTest.java | 11 - .../igfs/HadoopIgfsDualAbstractSelfTest.java | 1 + ...oopSecondaryFileSystemConfigurationTest.java | 12 - .../IgniteHadoopFileSystemAbstractSelfTest.java | 14 - ...IgniteHadoopFileSystemHandshakeSelfTest.java | 7 - .../IgniteHadoopFileSystemIpcCacheSelfTest.java | 7 - .../hadoop/HadoopAbstractSelfTest.java | 6 - .../HadoopDefaultMapReducePlannerSelfTest.java | 6 +- .../HibernateAccessStrategyAdapter.java | 1 - .../hibernate/HibernateCollectionRegion.java | 2 +- .../cache/hibernate/HibernateEntityRegion.java | 2 +- .../hibernate/HibernateGeneralDataRegion.java | 2 +- .../hibernate/HibernateNaturalIdRegion.java | 2 +- .../HibernateNonStrictAccessStrategy.java | 2 +- .../hibernate/HibernateQueryResultsRegion.java | 2 +- .../HibernateReadOnlyAccessStrategy.java | 2 +- .../HibernateReadWriteAccessStrategy.java | 34 +- .../ignite/cache/hibernate/HibernateRegion.java | 2 +- .../cache/hibernate/HibernateRegionFactory.java | 6 +- .../hibernate/HibernateTimestampsRegion.java | 2 +- .../HibernateTransactionalAccessStrategy.java | 4 +- .../HibernateTransactionalDataRegion.java | 2 +- .../HibernateL2CacheConfigurationSelfTest.java | 2 +- .../hibernate/HibernateL2CacheSelfTest.java | 4 +- .../query/h2/sql/GridQueryParsingTest.java | 1 + .../schema-import/src/main/java/media/style.css | 2 +- .../schema/generator/SnippetGenerator.java | 10 +- .../ignite/cache/spring/SpringCacheManager.java | 2 +- .../util/nodestart/IgniteNodeCallableImpl.java | 42 +- .../commands/cache/VisorCacheCommand.scala | 8 +- modules/winservice/IgniteService.sln | 22 - .../winservice/IgniteService/IgniteService.cs | 170 -- .../IgniteService/IgniteService.csproj | 90 - modules/winservice/README.md | 20 - modules/yardstick/config/ignite-base-config.xml | 6 - .../yardstick/config/ignite-store-config.xml | 6 - pom.xml | 88 +- .../basic-concepts/async-support.md | 92 - .../basic-concepts/getting-started.md | 235 --- .../basic-concepts/ignite-life-cycel.md | 122 -- .../documentation/basic-concepts/maven-setup.md | 85 - .../basic-concepts/what-is-ignite.md | 48 - .../basic-concepts/zero-deployment.md | 73 - wiki/documentation/clustering/aws-config.md | 59 - wiki/documentation/clustering/cluster-config.md | 193 -- wiki/documentation/clustering/cluster-groups.md | 227 --- wiki/documentation/clustering/cluster.md | 145 -- .../documentation/clustering/leader-election.md | 76 - wiki/documentation/clustering/network-config.md | 118 -- wiki/documentation/clustering/node-local-map.md | 52 - .../documentation/compute-grid/checkpointing.md | 255 --- .../compute-grid/collocate-compute-and-data.md | 46 - wiki/documentation/compute-grid/compute-grid.md | 73 - .../documentation/compute-grid/compute-tasks.md | 122 -- .../compute-grid/distributed-closures.md | 124 -- .../compute-grid/executor-service.md | 40 - .../compute-grid/fault-tolerance.md | 96 - .../compute-grid/job-scheduling.md | 86 - .../compute-grid/load-balancing.md | 76 - .../data-grid/affinity-collocation.md | 95 - .../data-grid/automatic-db-integration.md | 119 -- wiki/documentation/data-grid/cache-modes.md | 254 --- wiki/documentation/data-grid/cache-queries.md | 181 -- wiki/documentation/data-grid/data-grid.md | 85 - wiki/documentation/data-grid/data-loading.md | 94 - wiki/documentation/data-grid/evictions.md | 103 -- .../data-grid/hibernate-l2-cache.md | 190 -- wiki/documentation/data-grid/jcache.md | 116 -- wiki/documentation/data-grid/off-heap-memory.md | 197 --- .../documentation/data-grid/persistent-store.md | 128 -- wiki/documentation/data-grid/rebalancing.md | 122 -- wiki/documentation/data-grid/transactions.md | 144 -- .../data-grid/web-session-clustering.md | 253 --- .../distributed-data-structures/atomic-types.md | 114 -- .../countdownlatch.md | 41 - .../distributed-data-structures/id-generator.md | 57 - .../queue-and-set.md | 133 -- .../distributed-events/automatic-batching.md | 33 - wiki/documentation/distributed-events/events.md | 118 -- .../distributed-file-system/igfs.md | 18 - .../distributed-messaging/messaging.md | 90 - wiki/documentation/http/configuration.md | 67 - wiki/documentation/http/rest-api.md | 1663 ------------------ .../release-notes/release-notes.md | 30 - .../service-grid/cluster-singletons.md | 111 -- .../service-grid/service-configuration.md | 50 - .../service-grid/service-example.md | 111 -- wiki/documentation/service-grid/service-grid.md | 79 - wiki/licence-prepender.sh | 51 - 244 files changed, 2367 insertions(+), 9430 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1f7ef61b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/IgniteCache.java index 411a519,6b2f24c..af518da --- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java @@@ -384,10 -435,10 +435,10 @@@ public interface IgniteCache<K, V> exte @Override public <T> T invoke(K key, EntryProcessor<K, V, T> entryProcessor, Object... arguments); /** - * Invokes an {@link IgniteEntryProcessor} against the {@link javax.cache.Cache.Entry} specified by - * Invokes an {@link CacheEntryProcessor} against the {@link Entry} specified by - * the provided key. If an {@link Entry} does not exist for the specified key, ++ * Invokes an {@link CacheEntryProcessor} against the {@link javax.cache.Cache.Entry} specified by + * the provided key. If an {@link javax.cache.Cache.Entry} does not exist for the specified key, * an attempt is made to load it (if a loader is configured) or a surrogate - * {@link Entry}, consisting of the key with a null value is used instead. + * {@link javax.cache.Cache.Entry}, consisting of the key with a null value is used instead. * This method different * <p> * @@@ -418,11 -469,11 +469,11 @@@ EntryProcessor<K, V, T> entryProcessor, Object... args); /** - * Invokes an {@link IgniteEntryProcessor} against the set of {@link javax.cache.Cache.Entry}s - * Invokes an {@link CacheEntryProcessor} against the set of {@link Entry}s ++ * Invokes an {@link CacheEntryProcessor} against the set of {@link javax.cache.Cache.Entry}s * specified by the set of keys. * <p> - * If an {@link Entry} does not exist for the specified key, an attempt is made - * to load it (if a loader is configured) or a surrogate {@link Entry}, + * If an {@link javax.cache.Cache.Entry} does not exist for the specified key, an attempt is made + * to load it (if a loader is configured) or a surrogate {@link javax.cache.Cache.Entry}, * consisting of the key and a value of null is provided. * <p> * The order that the entries for the keys are processed is undefined. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1f7ef61b/modules/core/src/main/java/org/apache/ignite/cache/affinity/CacheAffinityKeyMapped.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/cache/affinity/CacheAffinityKeyMapped.java index 86f432e,3fff1df..a26a9b0 --- a/modules/core/src/main/java/org/apache/ignite/cache/affinity/CacheAffinityKeyMapped.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/affinity/CacheAffinityKeyMapped.java @@@ -86,12 -86,56 +86,12 @@@ import java.util.concurrent.* * It is also possible to route computations to the nodes where the data is cached. This concept * is otherwise known as {@code Collocation Of Computations And Data}. In this case, * {@code @CacheAffinityKeyMapped} annotation allows to specify a routing affinity key for a - * {@link org.apache.ignite.compute.ComputeJob} or any other grid computation, such as {@link Runnable}, {@link Callable}, or - * {@link org.apache.ignite.lang.IgniteClosure}. It should be attached to a method or field that provides affinity key - * for the computation. Only one annotation per class is allowed. Whenever such annotation is detected, - * then {@link org.apache.ignite.spi.loadbalancing.LoadBalancingSpi} will be bypassed, and computation will be routed to the grid node - * where the specified affinity key is cached. + * {@link org.apache.ignite.compute.ComputeJob} or any other grid computation, such as {@link Runnable}, + * {@link Callable}, or {@link org.apache.ignite.lang.IgniteClosure}. It should be attached to a method or + * field that provides affinity key for the computation. Only one annotation per class is allowed. + * Whenever such annotation is detected, then {@link org.apache.ignite.spi.loadbalancing.LoadBalancingSpi} + * will be bypassed, and computation will be routed to the grid node where the specified affinity key is cached. * <p> - * Here is how this annotation can be used to route a job to a node where Person object - * is cached with ID "1234": - * <pre name="code" class="java"> - * G.grid().run(new Runnable() { - * // This annotation is optional. If omitted, then default - * // no-name cache will be used. - * @CacheName - * private String cacheName = "myCache"; - * - * // This annotation specifies that computation should be routed - * // precisely to the node where key '1234' is cached. - * @CacheAffinityKeyMapped - * private String personKey = "1234"; - * - * @Override public void run() { - * // Some computation logic here. - * ... - * } - * }; - * </pre> - * The same can be achieved by annotating method instead of field as follows: - * <pre name="code" class="java"> - * G.grid().run(new Runnable() { - * @Override public void run() { - * // Some computation logic here. - * ... - * } - * - * // This annotation is optional. If omitted, then default - * // no-name cache will be used. - * @CacheName - * public String cacheName() { - * return "myCache"; - * } - * - * // This annotation specifies that computation should be routed - * // precisely to the node where key '1234' is cached. - * @CacheAffinityKeyMapped - * public String personKey() { - * return "1234"; - * } - * }; - * </pre> - * <p> * For more information about cache affinity also see {@link CacheAffinityKeyMapper} and * {@link CacheAffinityFunction} documentation. * Affinity for a key can be found from any node, regardless of whether it has cache started http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1f7ef61b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheProjection.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1f7ef61b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCache.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCache.java index 0000000,7dbc05a..66e235e mode 000000,100644..100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCache.java @@@ -1,0 -1,222 +1,222 @@@ + /* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package org.apache.ignite.internal.processors.cache; + + import org.apache.ignite.*; + import org.apache.ignite.cache.*; + import org.apache.ignite.cache.affinity.*; + import org.apache.ignite.configuration.*; + import org.apache.ignite.internal.*; + import org.apache.ignite.internal.processors.cache.*; + import org.apache.ignite.mxbean.*; + import org.apache.ignite.transactions.*; + import org.jetbrains.annotations.*; + + import javax.cache.*; + import java.util.*; + + /** - * Main entry point for all <b>Data Grid APIs.</b> You can get a named cache by calling {@link org.apache.ignite.Ignite#cache(String)} ++ * Main entry point for all <b>Data Grid APIs.</b> You can get a named cache by calling {@link org.apache.ignite.Ignite#jcache(String)} + * method. + * <h1 class="header">Functionality</h1> + * This API extends {@link CacheProjection} API which contains vast majority of cache functionality + * and documentation. In addition to {@link CacheProjection} functionality this API provides: + * <ul> + * <li> + * Various {@code 'loadCache(..)'} methods to load cache either synchronously or asynchronously. + * These methods don't specify any keys to load, and leave it to the underlying storage to load cache + * data based on the optionally passed in arguments. + * </li> + * <li> + * Method {@link #affinity()} provides {@link org.apache.ignite.cache.affinity.CacheAffinityFunction} service for information on + * data partitioning and mapping keys to grid nodes responsible for caching those keys. + * </li> + * <li> + * Methods like {@code 'tx{Un}Synchronize(..)'} witch allow to get notifications for transaction state changes. + * This feature is very useful when integrating cache transactions with some other in-house transactions. + * </li> + * <li>Method {@link #metrics()} to provide metrics for the whole cache.</li> + * <li>Method {@link #configuration()} to provide cache configuration bean.</li> + * </ul> + * + * @param <K> Cache key type. + * @param <V> Cache value type. + */ + public interface GridCache<K, V> extends CacheProjection<K, V> { + /** + * Gets configuration bean for this cache. + * + * @return Configuration bean for this cache. + */ + public CacheConfiguration configuration(); + + /** + * Registers transactions synchronizations for all transactions started by this cache. + * Use it whenever you need to get notifications on transaction lifecycle and possibly change + * its course. It is also particularly useful when integrating cache transactions + * with some other in-house transactions. + * + * @param syncs Transaction synchronizations to register. + */ + public void txSynchronize(@Nullable TransactionSynchronization syncs); + + /** + * Removes transaction synchronizations. + * + * @param syncs Transactions synchronizations to remove. + * @see #txSynchronize(TransactionSynchronization) + */ + public void txUnsynchronize(@Nullable TransactionSynchronization syncs); + + /** + * Gets registered transaction synchronizations. + * + * @return Registered transaction synchronizations. + * @see #txSynchronize(TransactionSynchronization) + */ + public Collection<TransactionSynchronization> txSynchronizations(); + + /** + * Gets affinity service to provide information about data partitioning + * and distribution. + * + * @return Cache data affinity service. + */ + public CacheAffinity<K> affinity(); + + /** + * Gets metrics (statistics) for this cache. + * + * @return Cache metrics. + */ + public CacheMetrics metrics(); + + /** + * Gets metrics (statistics) for this cache. + * + * @return Cache metrics. + */ + public CacheMetricsMXBean mxBean(); + + /** + * Gets size (in bytes) of all entries swapped to disk. + * + * @return Size (in bytes) of all entries swapped to disk. + * @throws IgniteCheckedException In case of error. + */ + public long overflowSize() throws IgniteCheckedException; + + /** + * Gets number of cache entries stored in off-heap memory. + * + * @return Number of cache entries stored in off-heap memory. + */ + public long offHeapEntriesCount(); + + /** + * Gets memory size allocated in off-heap. + * + * @return Allocated memory size. + */ + public long offHeapAllocatedSize(); + + /** + * Gets size in bytes for swap space. + * + * @return Size in bytes. + * @throws IgniteCheckedException If failed. + */ + public long swapSize() throws IgniteCheckedException; + + /** + * Gets number of swap entries (keys). + * + * @return Number of entries stored in swap. + * @throws IgniteCheckedException If failed. + */ + public long swapKeys() throws IgniteCheckedException; + + /** + * Gets iterator over keys and values belonging to this cache swap space on local node. This + * iterator is thread-safe, which means that cache (and therefore its swap space) + * may be modified concurrently with iteration over swap. + * <p> + * Returned iterator supports {@code remove} operation which delegates to + * {@link #removex(Object, org.apache.ignite.lang.IgnitePredicate[])} method. + * <h2 class="header">Cache Flags</h2> + * This method is not available if any of the following flags are set on projection: + * {@link org.apache.ignite.internal.processors.cache.CacheFlag#SKIP_SWAP}. + * + * @return Iterator over keys. + * @throws IgniteCheckedException If failed. + * @see #promote(Object) + */ + public Iterator<Map.Entry<K, V>> swapIterator() throws IgniteCheckedException; + + /** + * Gets iterator over keys and values belonging to this cache off-heap memory on local node. This + * iterator is thread-safe, which means that cache (and therefore its off-heap memory) + * may be modified concurrently with iteration over off-heap. To achieve better performance + * the keys and values deserialized on demand, whenever accessed. + * <p> + * Returned iterator supports {@code remove} operation which delegates to + * {@link #removex(Object, org.apache.ignite.lang.IgnitePredicate[])} method. + * + * @return Iterator over keys. + * @throws IgniteCheckedException If failed. + */ + public Iterator<Map.Entry<K, V>> offHeapIterator() throws IgniteCheckedException; + + /** + * Gets a random entry out of cache. In the worst cache scenario this method + * has complexity of <pre>O(S * N/64)</pre> where {@code N} is the size of internal hash + * table and {@code S} is the number of hash table buckets to sample, which is {@code 5} + * by default. However, if the table is pretty dense, with density factor of {@code N/64}, + * which is true for near fully populated caches, this method will generally perform significantly + * faster with complexity of O(S) where {@code S = 5}. + * <p> + * Note that this method is not available on {@link CacheProjection} API since it is + * impossible (or very hard) to deterministically return a number value when pre-filtering + * and post-filtering is involved (e.g. projection level predicate filters). + * + * @return Random entry, or {@code null} if cache is empty. + */ + @Nullable public Cache.Entry<K, V> randomEntry(); + + /** + * Forces this cache node to re-balance its partitions. This method is usually used when + * {@link CacheConfiguration#getRebalanceDelay()} configuration parameter has non-zero value. + * When many nodes are started or stopped almost concurrently, it is more efficient to delay + * rebalancing until the node topology is stable to make sure that no redundant re-partitioning + * happens. + * <p> + * In case of{@link CacheMode#PARTITIONED} caches, for better efficiency user should + * usually make sure that new nodes get placed on the same place of consistent hash ring as + * the left nodes, and that nodes are restarted before + * {@link CacheConfiguration#getRebalanceDelay() rebalanceDelay} expires. To place nodes + * on the same place in consistent hash ring, use + * {@link org.apache.ignite.cache.affinity.rendezvous.CacheRendezvousAffinityFunction#setHashIdResolver(CacheAffinityNodeHashResolver)} to make sure that + * a node maps to the same hash ID if re-started. + * <p> + * See {@link org.apache.ignite.configuration.CacheConfiguration#getRebalanceDelay()} for more information on how to configure + * rebalance re-partition delay. + * <p> + * @return Future that will be completed when rebalancing is finished. + */ + public IgniteInternalFuture<?> forceRepartition(); + } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1f7ef61b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerCacheUpdaters.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerCacheUpdaters.java index f98c110,0f8ca6a..54061b0 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerCacheUpdaters.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerCacheUpdaters.java @@@ -38,8 -38,8 +38,8 @@@ public class DataStreamerCacheUpdaters private static final IgniteDataStreamer.Updater BATCHED_SORTED = new BatchedSorted(); /** - * Updates cache using independent {@link org.apache.ignite.cache.GridCache#put(Object, Object, CacheEntryPredicate[])} and - * {@link org.apache.ignite.cache.GridCache#remove(Object, CacheEntryPredicate[])} operations. Thus it is safe from deadlocks but performance - * Updates cache using independent {@link org.apache.ignite.internal.processors.cache.GridCache#put(Object, Object, org.apache.ignite.lang.IgnitePredicate[])} and - * {@link org.apache.ignite.internal.processors.cache.GridCache#remove(Object, org.apache.ignite.lang.IgnitePredicate[])} operations. Thus it is safe from deadlocks but performance ++ * Updates cache using independent {@link org.apache.ignite.internal.processors.cache.GridCache#put(Object, Object, CacheEntryPredicate[])} and ++ * {@link org.apache.ignite.internal.processors.cache.GridCache#remove(Object, CacheEntryPredicate[])} operations. Thus it is safe from deadlocks but performance * is not the best. * * @return Single updater. @@@ -49,8 -49,8 +49,8 @@@ } /** - * Updates cache using batched methods {@link org.apache.ignite.cache.GridCache#putAll(Map, CacheEntryPredicate[])} and - * {@link org.apache.ignite.cache.GridCache#removeAll(Collection, CacheEntryPredicate[])}. Can cause deadlocks if the same keys are getting - * Updates cache using batched methods {@link org.apache.ignite.internal.processors.cache.GridCache#putAll(Map, org.apache.ignite.lang.IgnitePredicate[])} and - * {@link org.apache.ignite.internal.processors.cache.GridCache#removeAll(Collection, org.apache.ignite.lang.IgnitePredicate[])}. Can cause deadlocks if the same keys are getting ++ * Updates cache using batched methods {@link org.apache.ignite.internal.processors.cache.GridCache#putAll(Map, CacheEntryPredicate[])} and ++ * {@link org.apache.ignite.internal.processors.cache.GridCache#removeAll(Collection, CacheEntryPredicate[])}. Can cause deadlocks if the same keys are getting * updated concurrently. Performance is generally better than in {@link #individual()}. * * @return Batched updater. @@@ -60,8 -60,8 +60,8 @@@ } /** - * Updates cache using batched methods {@link org.apache.ignite.cache.GridCache#putAll(Map, CacheEntryPredicate[])} and - * {@link org.apache.ignite.cache.GridCache#removeAll(Collection, CacheEntryPredicate[])}. Keys are sorted in natural order and if all updates - * Updates cache using batched methods {@link org.apache.ignite.internal.processors.cache.GridCache#putAll(Map, org.apache.ignite.lang.IgnitePredicate[])} and - * {@link org.apache.ignite.internal.processors.cache.GridCache#removeAll(Collection, org.apache.ignite.lang.IgnitePredicate[])}. Keys are sorted in natural order and if all updates ++ * Updates cache using batched methods {@link org.apache.ignite.internal.processors.cache.GridCache#putAll(Map, CacheEntryPredicate[])} and ++ * {@link org.apache.ignite.internal.processors.cache.GridCache#removeAll(Collection, CacheEntryPredicate[])}. Keys are sorted in natural order and if all updates * use the same rule deadlock can not happen. Performance is generally better than in {@link #individual()}. * * @return Batched sorted updater. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1f7ef61b/pom.xml ----------------------------------------------------------------------