Merge branch 'sprint-1' into ignite-36
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e4c53f88 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e4c53f88 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e4c53f88 Branch: refs/heads/ignite-32 Commit: e4c53f88509c8f562acf526d3df71050bc754669 Parents: 62ddaf3 b9288ff Author: nikolay_tikhonov <ntikho...@gridgain.com> Authored: Thu Jan 22 17:52:41 2015 +0300 Committer: nikolay_tikhonov <ntikho...@gridgain.com> Committed: Thu Jan 22 18:00:19 2015 +0300 ---------------------------------------------------------------------- config/fabric/default-config.xml | 6 +- config/hadoop/default-config.xml | 8 +- examples/config/example-cache.xml | 2 +- examples/config/filesystem/example-ggfs.xml | 4 +- .../examples/datagrid/CacheApiExample.java | 10 - .../HibernateL2CacheExampleNodeStartup.java | 6 +- .../store/CacheNodeWithStoreStartup.java | 19 +- .../store/dummy/CacheDummyPersonStore.java | 33 +- .../hibernate/CacheHibernatePersonStore.java | 68 +- .../store/jdbc/CacheJdbcPersonStore.java | 66 +- .../MemcacheRestExampleNodeStartup.java | 5 +- ...GridClientAbstractMultiThreadedSelfTest.java | 7 +- .../client/GridClientTopologyCacheSelfTest.java | 4 +- .../org/gridgain/client/GridHashMapStore.java | 22 +- .../GridClientAbstractMultiNodeSelfTest.java | 5 +- .../integration/GridClientAbstractSelfTest.java | 32 +- .../rest/GridAbstractRestProcessorSelfTest.java | 3 +- .../rest/GridRestBinaryProtocolSelfTest.java | 6 +- .../rest/GridRestMemcacheProtocolSelfTest.java | 7 +- .../rest/GridTaskCommandHandlerSelfTest.java | 7 +- .../jdbc/GridJdbcComplexQuerySelfTest.java | 3 +- .../jdbc/GridJdbcConnectionSelfTest.java | 6 +- .../jdbc/GridJdbcEmptyCacheSelfTest.java | 4 +- .../jdbc/GridJdbcLocalCachesSelfTest.java | 3 +- .../gridgain/jdbc/GridJdbcMetadataSelfTest.java | 3 +- .../jdbc/GridJdbcPreparedStatementSelfTest.java | 3 +- .../jdbc/GridJdbcResultSetSelfTest.java | 3 +- .../jdbc/GridJdbcStatementSelfTest.java | 3 +- .../clients/src/test/resources/spring-cache.xml | 8 +- .../src/test/resources/spring-server-node.xml | 12 +- .../test/resources/spring-server-ssl-node.xml | 10 +- .../java/org/apache/ignite/IgniteCache.java | 197 +- .../org/apache/ignite/IgniteCacheManager.java | 12 +- .../apache/ignite/IgniteCachingProvider.java | 2 +- .../java/org/apache/ignite/IgniteCluster.java | 15 +- .../org/apache/ignite/IgniteDataLoader.java | 20 +- .../java/org/apache/ignite/IgniteEvents.java | 22 +- .../main/java/org/apache/ignite/IgniteFs.java | 5 + .../java/org/apache/ignite/IgniteManaged.java | 18 +- .../java/org/apache/ignite/IgniteMessaging.java | 5 +- .../java/org/apache/ignite/IgnitePortables.java | 3 +- .../org/apache/ignite/IgniteTransactions.java | 3 +- .../apache/ignite/cache/CacheConfiguration.java | 1784 +++++++++++++++++- .../java/org/apache/ignite/cache/CacheFlag.java | 74 - .../cache/store/CacheLoadOnlyStoreAdapter.java | 324 ++++ .../ignite/cache/store/CacheLocalStore.java | 31 + .../apache/ignite/cache/store/CacheStore.java | 179 ++ .../ignite/cache/store/CacheStoreAdapter.java | 95 + .../cache/store/CacheStoreBalancingWrapper.java | 297 +++ .../ignite/cache/store/CacheStoreSession.java | 43 + .../cache/store/jdbc/CacheJdbcBlobStore.java | 586 ++++++ .../apache/ignite/cache/store/jdbc/package.html | 24 + .../org/apache/ignite/cache/store/package.html | 23 + .../configuration/IgniteConfiguration.java | 10 +- .../processors/cache/IgniteCacheProxy.java | 133 +- .../resources/IgniteCacheNameResource.java | 9 +- .../apache/ignite/transactions/IgniteTx.java | 4 +- .../gridgain/grid/GridBasicWarmupClosure.java | 19 +- .../java/org/gridgain/grid/cache/GridCache.java | 23 +- .../grid/cache/GridCacheAtomicityMode.java | 3 +- .../grid/cache/GridCacheConfiguration.java | 1750 ----------------- .../grid/cache/GridCacheDistributionMode.java | 7 +- .../org/gridgain/grid/cache/GridCacheFlag.java | 5 +- .../grid/cache/GridCacheInterceptor.java | 3 +- .../org/gridgain/grid/cache/GridCacheMBean.java | 3 +- .../org/gridgain/grid/cache/GridCacheMode.java | 5 +- .../grid/cache/GridCachePreloadMode.java | 5 +- .../grid/cache/GridCacheProjection.java | 159 +- .../GridCacheWriteSynchronizationMode.java | 2 +- .../grid/cache/affinity/GridCacheAffinity.java | 38 +- .../affinity/GridCacheAffinityFunction.java | 3 +- .../affinity/GridCacheAffinityKeyMapper.java | 4 +- ...GridCacheConsistentHashAffinityFunction.java | 4 +- .../fair/GridCachePartitionFairAffinity.java | 4 +- .../GridCacheRendezvousAffinityFunction.java | 5 +- .../grid/cache/cloner/GridCacheCloner.java | 7 +- .../cache/eviction/GridCacheEvictionFilter.java | 3 +- .../fifo/GridCacheFifoEvictionPolicy.java | 4 +- .../lru/GridCacheLruEvictionPolicy.java | 3 +- .../random/GridCacheRandomEvictionPolicy.java | 4 +- .../store/GridCacheLoadOnlyStoreAdapter.java | 328 ---- .../grid/cache/store/GridCacheLocalStore.java | 31 - .../grid/cache/store/GridCacheStore.java | 219 --- .../grid/cache/store/GridCacheStoreAdapter.java | 100 - .../store/GridCacheStoreBalancingWrapper.java | 278 --- .../store/jdbc/GridCacheJdbcBlobStore.java | 552 ------ .../gridgain/grid/cache/store/jdbc/package.html | 24 - .../org/gridgain/grid/cache/store/package.html | 23 - .../org/gridgain/grid/kernal/GridGainEx.java | 29 +- .../org/gridgain/grid/kernal/GridKernal.java | 5 +- .../kernal/processors/cache/CacheEntryImpl.java | 60 + .../processors/cache/CacheInvokeEntry.java | 5 +- .../cache/CacheStorePartialUpdateException.java | 48 + .../processors/cache/GridCacheAdapter.java | 393 +++- .../processors/cache/GridCacheAttributes.java | 53 +- .../processors/cache/GridCacheContext.java | 41 +- .../GridCacheDefaultAffinityKeyMapper.java | 5 +- .../cache/GridCacheEvictionManager.java | 3 +- .../cache/GridCacheLoaderWriterStore.java | 140 ++ .../processors/cache/GridCacheMapEntry.java | 8 +- .../processors/cache/GridCacheProcessor.java | 175 +- .../processors/cache/GridCacheProjectionEx.java | 18 +- .../processors/cache/GridCacheProxyImpl.java | 3 +- .../processors/cache/GridCacheStoreManager.java | 776 +++++++- .../processors/cache/GridCacheTtlManager.java | 4 +- .../kernal/processors/cache/GridCacheUtils.java | 19 +- .../cache/GridCacheWriteBehindStore.java | 200 +- .../distributed/dht/GridDhtCacheAdapter.java | 119 +- .../cache/distributed/dht/GridDhtGetFuture.java | 12 +- .../dht/GridDhtTransactionalCacheAdapter.java | 2 +- .../dht/GridPartitionedGetFuture.java | 8 + .../dht/atomic/GridDhtAtomicCache.java | 52 +- .../dht/atomic/GridNearAtomicUpdateFuture.java | 6 +- .../dht/colocated/GridDhtColocatedCache.java | 4 + .../colocated/GridDhtColocatedLockFuture.java | 4 +- .../distributed/near/GridNearCacheAdapter.java | 6 + .../distributed/near/GridNearGetFuture.java | 8 + .../distributed/near/GridNearGetRequest.java | 89 +- .../near/GridNearTransactionalCache.java | 3 + .../cache/distributed/near/GridNearTxLocal.java | 9 +- .../cache/jta/GridCacheJtaManagerAdapter.java | 4 +- .../cache/jta/GridCacheNoopJtaManager.java | 4 +- .../local/atomic/GridLocalAtomicCache.java | 66 +- .../cache/transactions/IgniteTxAdapter.java | 3 +- .../cache/transactions/IgniteTxEx.java | 6 + .../transactions/IgniteTxLocalAdapter.java | 26 +- .../cache/transactions/IgniteTxLocalEx.java | 2 + .../dataload/GridDataLoadCacheUpdaters.java | 9 +- .../dataload/GridDataLoadRequest.java | 36 +- .../dataload/GridDataLoadUpdateJob.java | 12 +- .../dataload/GridDataLoaderProcessor.java | 13 +- .../dataload/IgniteDataLoaderImpl.java | 18 +- .../dr/GridDrDataLoadCacheUpdater.java | 7 +- .../kernal/processors/ggfs/GridGgfsHelper.java | 6 +- .../processors/ggfs/GridGgfsHelperImpl.java | 6 +- .../kernal/processors/ggfs/GridGgfsImpl.java | 5 +- .../processors/ggfs/GridGgfsProcessor.java | 10 +- .../processors/ggfs/GridNoopGgfsHelper.java | 7 +- .../processors/query/GridQueryProcessor.java | 8 +- .../grid/kernal/visor/cache/VisorCache.java | 4 +- .../cache/VisorCacheAffinityConfiguration.java | 4 +- .../visor/cache/VisorCacheConfiguration.java | 7 +- .../cache/VisorCacheDefaultConfiguration.java | 10 +- .../visor/cache/VisorCacheDgcConfiguration.java | 4 +- .../cache/VisorCacheEvictionConfiguration.java | 10 +- .../cache/VisorCacheNearConfiguration.java | 4 +- .../cache/VisorCachePreloadConfiguration.java | 3 +- .../cache/VisorCacheStoreConfiguration.java | 12 +- .../VisorCacheWriteBehindConfiguration.java | 4 +- .../spring-cache-client-benchmark-1.xml | 4 +- .../spring-cache-client-benchmark-2.xml | 4 +- .../spring-cache-client-benchmark-3.xml | 4 +- .../core/src/test/config/discovery-stress.xml | 2 +- modules/core/src/test/config/example-cache.xml | 2 +- modules/core/src/test/config/ggfs-loopback.xml | 4 +- .../core/src/test/config/ggfs-no-endpoint.xml | 4 +- modules/core/src/test/config/ggfs-shmem.xml | 4 +- .../src/test/config/load/cache-benchmark.xml | 4 +- .../test/config/load/cache-client-benchmark.xml | 4 +- .../config/load/dsi-49-server-production.xml | 4 +- .../src/test/config/load/dsi-load-client.xml | 4 +- .../src/test/config/load/dsi-load-server.xml | 4 +- .../test/config/load/mongo-multinode-foster.xml | 4 +- .../core/src/test/config/spring-cache-load.xml | 2 +- .../config/spring-cache-put-remove-load.xml | 2 +- .../core/src/test/config/spring-cache-swap.xml | 2 +- .../src/test/config/spring-cache-teststore.xml | 2 +- .../core/src/test/config/spring-multicache.xml | 18 +- .../test/config/websession/spring-cache-1.xml | 6 +- .../test/config/websession/spring-cache-2.xml | 6 +- .../test/config/websession/spring-cache-3.xml | 6 +- ...CacheJdbcBlobStoreMultithreadedSelfTest.java | 250 +++ .../jdbc/GridCacheJdbcBlobStoreSelfTest.java | 51 + .../apache/ignite/cache/store/jdbc/package.html | 23 + .../cache/IgniteCacheAbstractTest.java | 58 +- ...niteCacheAtomicLocalWithStoreInvokeTest.java | 4 +- ...micPrimaryWriteOrderWithStoreInvokeTest.java | 4 +- .../IgniteCacheEntryListenerAbstractTest.java | 8 +- .../cache/IgniteCacheInvokeAbstractTest.java | 4 +- .../cache/IgniteCacheInvokeReadThroughTest.java | 4 +- .../cache/IgniteCachingProviderSelfTest.java | 9 +- ...maryWriteOrderWithStoreExpiryPolicyTest.java | 4 +- ...iteCacheAtomicWithStoreExpiryPolicyTest.java | 4 +- .../IgniteCacheExpiryPolicyAbstractTest.java | 5 +- .../IgniteCacheTxWithStoreExpiryPolicyTest.java | 4 +- .../IgniteCacheAtomicLoadAllTest.java | 55 + .../IgniteCacheAtomicLoaderWriterTest.java | 55 + .../IgniteCacheAtomicLocalLoadAllTest.java | 49 + ...CacheAtomicLocalNoLoadPreviousValueTest.java | 49 + ...IgniteCacheAtomicLocalNoReadThroughTest.java | 49 + ...gniteCacheAtomicLocalNoWriteThroughTest.java | 49 + ...tomicNearEnabledNoLoadPreviousValueTest.java | 32 + ...CacheAtomicNearEnabledNoReadThroughTest.java | 32 + ...acheAtomicNearEnabledNoWriteThroughTest.java | 32 + ...gniteCacheAtomicNoLoadPreviousValueTest.java | 55 + .../IgniteCacheAtomicNoReadThroughTest.java | 55 + .../IgniteCacheAtomicNoWriteThroughTest.java | 55 + .../IgniteCacheAtomicStoreSessionTest.java | 55 + .../IgniteCacheLoadAllAbstractTest.java | 236 +++ .../IgniteCacheLoaderWriterAbstractTest.java | 377 ++++ ...iteCacheNoLoadPreviousValueAbstractTest.java | 213 +++ .../IgniteCacheNoReadThroughAbstractTest.java | 322 ++++ .../IgniteCacheNoWriteThroughAbstractTest.java | 345 ++++ .../IgniteCacheStoreSessionAbstractTest.java | 303 +++ .../integration/IgniteCacheTxLoadAllTest.java | 50 + .../IgniteCacheTxLoaderWriterTest.java | 49 + .../IgniteCacheTxLocalLoadAllTest.java | 49 + ...niteCacheTxLocalNoLoadPreviousValueTest.java | 49 + .../IgniteCacheTxLocalNoReadThroughTest.java | 49 + .../IgniteCacheTxLocalNoWriteThroughTest.java | 49 + ...cheTxNearEnabledNoLoadPreviousValueTest.java | 32 + ...niteCacheTxNearEnabledNoReadThroughTest.java | 32 + ...iteCacheTxNearEnabledNoWriteThroughTest.java | 32 + .../IgniteCacheTxNoLoadPreviousValueTest.java | 49 + .../IgniteCacheTxNoReadThroughTest.java | 49 + .../IgniteCacheTxNoWriteThroughTest.java | 49 + .../IgniteCacheTxStoreSessionTest.java | 286 +++ ...idCacheCheckpointSpiSecondCacheSelfTest.java | 5 +- .../tcp/GridCacheDhtLockBackupSelfTest.java | 7 +- .../GridCacheStoreValueBytesNode.java | 4 +- .../grid/GridCacheAffinityBackupsSelfTest.java | 4 +- ...CachePartitionFairAffinityNodesSelfTest.java | 7 +- .../store/GridCacheBalancingStoreSelfTest.java | 42 +- .../GridCacheLoadOnlyStoreAdapterSelfTest.java | 20 +- .../cache/store/GridGeneratingTestStore.java | 38 +- ...CacheJdbcBlobStoreMultithreadedSelfTest.java | 243 --- .../jdbc/GridCacheJdbcBlobStoreSelfTest.java | 51 - .../gridgain/grid/cache/store/jdbc/package.html | 23 - .../ggfs/GridGgfsEventsAbstractSelfTest.java | 11 +- .../GridGgfsFragmentizerAbstractSelfTest.java | 9 +- .../grid/kernal/GridAffinityMappedTest.java | 5 +- .../grid/kernal/GridAffinityP2PSelfTest.java | 4 +- .../grid/kernal/GridAffinitySelfTest.java | 11 +- .../grid/kernal/GridDiscoverySelfTest.java | 3 +- .../kernal/GridJobMasterLeaveAwareSelfTest.java | 4 +- .../grid/kernal/GridMultipleJobsSelfTest.java | 5 +- .../kernal/GridProjectionForCachesSelfTest.java | 6 +- ...ectionLocalJobMultipleArgumentsSelfTest.java | 4 +- .../grid/kernal/GridStartStopSelfTest.java | 6 +- .../GridCheckpointManagerAbstractSelfTest.java | 4 +- .../checkpoint/GridCheckpointTaskSelfTest.java | 7 +- .../GridDeploymentMessageCountSelfTest.java | 3 +- .../GridDiscoveryManagerAliveCacheSelfTest.java | 4 +- .../discovery/GridDiscoveryManagerSelfTest.java | 5 +- .../GridAffinityProcessorAbstractSelfTest.java | 3 +- .../GridCacheAbstractFailoverSelfTest.java | 6 +- .../cache/GridCacheAbstractFlagsTest.java | 9 +- .../cache/GridCacheAbstractFullApiSelfTest.java | 8 +- .../GridCacheAbstractProjectionSelfTest.java | 9 +- .../cache/GridCacheAbstractSelfTest.java | 34 +- .../cache/GridCacheAbstractTxReadTest.java | 7 +- .../cache/GridCacheAffinityApiSelfTest.java | 5 +- .../cache/GridCacheAffinityRoutingSelfTest.java | 6 +- .../GridCacheAsyncOperationsLimitSelfTest.java | 6 +- .../GridCacheAtomicMessageCountSelfTest.java | 3 +- .../cache/GridCacheBasicStoreAbstractTest.java | 15 +- ...acheBasicStoreMultithreadedAbstractTest.java | 25 +- .../cache/GridCacheClearAllSelfTest.java | 9 +- .../cache/GridCacheConcurrentMapSelfTest.java | 3 +- .../cache/GridCacheConcurrentMapTest.java | 3 +- .../GridCacheConcurrentTxMultiNodeTest.java | 3 +- ...idCacheConfigurationConsistencySelfTest.java | 264 +-- ...ridCacheConfigurationValidationSelfTest.java | 6 +- .../GridCacheDaemonNodeAbstractSelfTest.java | 3 +- .../GridCacheDeploymentOffHeapSelfTest.java | 6 +- .../cache/GridCacheDeploymentSelfTest.java | 5 +- .../cache/GridCacheEntryMemorySizeSelfTest.java | 3 +- .../cache/GridCacheEntryVersionSelfTest.java | 3 +- .../GridCacheEvictionEventAbstractTest.java | 3 +- .../GridCacheFieldsQueryNoDataSelfTest.java | 4 +- .../GridCacheFinishPartitionsSelfTest.java | 4 +- ...CacheFullTextQueryMultithreadedSelfTest.java | 5 +- .../cache/GridCacheGenericTestStore.java | 78 +- ...idCacheGetAndTransformStoreAbstractTest.java | 10 +- .../cache/GridCacheGlobalClearAllSelfTest.java | 3 +- .../GridCacheGroupLockAbstractSelfTest.java | 65 +- .../GridCacheGroupLockFailoverSelfTest.java | 3 +- .../cache/GridCacheIncrementTransformTest.java | 3 +- .../GridCacheInterceptorAbstractSelfTest.java | 54 +- ...cheInterceptorAtomicNearEnabledSelfTest.java | 1 + .../cache/GridCacheIteratorPerformanceTest.java | 5 +- .../cache/GridCacheKeyCheckSelfTest.java | 5 +- .../processors/cache/GridCacheLeakTest.java | 5 +- .../cache/GridCacheLifecycleAwareSelfTest.java | 60 +- .../cache/GridCacheLuceneQueryIndexTest.java | 5 +- .../cache/GridCacheMemoryModeSelfTest.java | 6 +- .../GridCacheMissingCommitVersionSelfTest.java | 3 +- ...GridCacheMixedPartitionExchangeSelfTest.java | 5 +- .../cache/GridCacheMultiUpdateLockSelfTest.java | 5 +- ...ridCacheMultinodeUpdateAbstractSelfTest.java | 4 +- ...inodeUpdateNearEnabledNoBackupsSelfTest.java | 6 +- .../cache/GridCacheMvccFlagsTest.java | 4 +- .../cache/GridCacheMvccManagerSelfTest.java | 5 +- .../cache/GridCacheMvccPartitionedSelfTest.java | 4 +- .../processors/cache/GridCacheMvccSelfTest.java | 4 +- .../cache/GridCacheObjectToStringSelfTest.java | 3 +- ...HeapMultiThreadedUpdateAbstractSelfTest.java | 5 +- .../cache/GridCacheOffHeapSelfTest.java | 3 +- .../processors/cache/GridCacheOffHeapTest.java | 3 +- .../GridCacheOffHeapTieredAbstractSelfTest.java | 6 +- ...heOffHeapTieredEvictionAbstractSelfTest.java | 5 +- .../cache/GridCacheOffheapUpdateSelfTest.java | 3 +- .../GridCacheOrderedPreloadingSelfTest.java | 5 +- .../cache/GridCacheP2PUndeploySelfTest.java | 6 +- .../cache/GridCachePartitionedGetSelfTest.java | 5 +- ...hePartitionedProjectionAffinitySelfTest.java | 3 +- .../cache/GridCachePartitionedWritesTest.java | 26 +- .../GridCachePreloadingEvictionsSelfTest.java | 3 +- .../cache/GridCachePutAllFailoverSelfTest.java | 3 +- .../GridCacheQueryIndexingDisabledSelfTest.java | 6 +- .../GridCacheQueryInternalKeysSelfTest.java | 5 +- .../GridCacheReferenceCleanupSelfTest.java | 3 +- .../cache/GridCacheReloadSelfTest.java | 28 +- ...ridCacheReplicatedSynchronousCommitTest.java | 3 +- .../GridCacheReturnValueTransferSelfTest.java | 6 +- .../cache/GridCacheSlowTxWarnTest.java | 7 +- .../processors/cache/GridCacheStopSelfTest.java | 3 +- .../cache/GridCacheStorePutxSelfTest.java | 48 +- .../cache/GridCacheStoreValueBytesSelfTest.java | 5 +- .../cache/GridCacheSwapPreloadSelfTest.java | 3 +- .../cache/GridCacheSwapReloadSelfTest.java | 29 +- .../processors/cache/GridCacheTestStore.java | 97 +- .../cache/GridCacheTtlManagerSelfTest.java | 4 +- .../GridCacheValueBytesPreloadingSelfTest.java | 5 +- ...idCacheValueConsistencyAbstractSelfTest.java | 5 +- .../GridCacheVariableTopologySelfTest.java | 3 +- ...idCacheWriteBehindStoreAbstractSelfTest.java | 13 +- .../GridCacheWriteBehindStoreAbstractTest.java | 10 +- ...BehindStorePartitionedMultiNodeSelfTest.java | 14 +- .../GridCacheWriteBehindStoreSelfTest.java | 50 +- .../IgniteTxExceptionAbstractSelfTest.java | 11 +- .../cache/IgniteTxReentryAbstractSelfTest.java | 3 +- .../IgniteTxStoreExceptionAbstractSelfTest.java | 48 +- ...eAbstractDataStructuresFailoverSelfTest.java | 6 +- ...actQueueFailoverDataConsistencySelfTest.java | 13 +- .../GridCacheAtomicLongApiSelfTest.java | 7 +- ...CacheAtomicReferenceApiSelfAbstractTest.java | 37 +- .../GridCacheCountDownLatchSelfTest.java | 8 +- .../GridCacheQueueCleanupSelfTest.java | 5 +- ...dCacheQueueMultiNodeConsistencySelfTest.java | 3 +- .../GridCacheSetAbstractSelfTest.java | 9 +- .../GridCacheSetFailoverAbstractSelfTest.java | 14 +- .../GridCacheLocalAtomicQueueApiSelfTest.java | 4 +- .../local/GridCacheLocalQueueApiSelfTest.java | 4 +- .../GridCacheLocalSequenceApiSelfTest.java | 4 +- ...dCachePartitionedAtomicQueueApiSelfTest.java | 4 +- ...ionedAtomicQueueCreateMultiNodeSelfTest.java | 6 +- ...PartitionedAtomicQueueMultiNodeSelfTest.java | 4 +- ...itionedAtomicQueueRotativeMultiNodeTest.java | 4 +- ...hePartitionedAtomicReferenceApiSelfTest.java | 4 +- ...PartitionedAtomicReferenceMultiNodeTest.java | 5 +- ...titionedAtomicSequenceMultiThreadedTest.java | 3 +- .../GridCachePartitionedAtomicSetSelfTest.java | 5 +- ...achePartitionedAtomicStampedApiSelfTest.java | 4 +- ...GridCachePartitionedNodeRestartSelfTest.java | 4 +- ...idCachePartitionedNodeRestartTxSelfTest.java | 4 +- .../GridCachePartitionedQueueApiSelfTest.java | 4 +- ...PartitionedQueueCreateMultiNodeSelfTest.java | 5 +- ...dCachePartitionedQueueEntryMoveSelfTest.java | 5 +- ...CachePartitionedQueueJoinedNodeSelfTest.java | 4 +- ...dCachePartitionedQueueMultiNodeSelfTest.java | 4 +- ...hePartitionedQueueRotativeMultiNodeTest.java | 4 +- ...GridCachePartitionedSequenceApiSelfTest.java | 4 +- ...chePartitionedSequenceMultiNodeSelfTest.java | 4 +- ...cheReplicatedAtomicReferenceApiSelfTest.java | 4 +- ...eReplicatedAtomicReferenceMultiNodeTest.java | 4 +- ...CacheReplicatedAtomicStampedApiSelfTest.java | 4 +- .../GridCacheReplicatedQueueApiSelfTest.java | 4 +- ...idCacheReplicatedQueueMultiNodeSelfTest.java | 4 +- ...cheReplicatedQueueRotativeMultiNodeTest.java | 4 +- .../GridCacheReplicatedSequenceApiSelfTest.java | 4 +- ...acheReplicatedSequenceMultiNodeSelfTest.java | 4 +- ...tractDistributedByteArrayValuesSelfTest.java | 19 +- .../GridCacheAbstractNodeRestartSelfTest.java | 2 +- ...tractPartitionedByteArrayValuesSelfTest.java | 13 +- .../GridCacheAbstractPrimarySyncSelfTest.java | 3 +- .../GridCacheAtomicTimeoutSelfTest.java | 4 +- .../GridCacheClientModesAbstractSelfTest.java | 15 +- ...acheEntrySetIterationPreloadingSelfTest.java | 5 +- ...heExpiredEntriesPreloadAbstractSelfTest.java | 9 +- .../distributed/GridCacheLockAbstractTest.java | 9 +- .../distributed/GridCacheMixedModeSelfTest.java | 5 +- ...dCacheMultithreadedFailoverAbstractTest.java | 3 +- ...dCachePartitionedAffinityFilterSelfTest.java | 3 +- ...chePartitionedReloadAllAbstractSelfTest.java | 31 +- .../GridCachePreloadEventsAbstractSelfTest.java | 5 +- ...GridCachePreloadRestartAbstractSelfTest.java | 5 +- .../GridCacheTransformEventSelfTest.java | 3 +- ...iteTxConsistencyRestartAbstractSelfTest.java | 5 +- ...xOriginatingNodeFailureAbstractSelfTest.java | 9 +- ...cOriginatingNodeFailureAbstractSelfTest.java | 9 +- .../IgniteTxPreloadAbstractTest.java | 13 +- ...tPartitionedOnlyByteArrayValuesSelfTest.java | 7 +- ...heAbstractTransformWriteThroughSelfTest.java | 11 +- .../dht/GridCacheAtomicFullApiSelfTest.java | 5 +- .../dht/GridCacheAtomicNearCacheSelfTest.java | 3 +- .../dht/GridCacheColocatedDebugTest.java | 30 +- ...eColocatedOptimisticTransactionSelfTest.java | 3 +- ...dCacheColocatedTxSingleThreadedSelfTest.java | 3 +- .../GridCacheDhtAtomicRemoveFailureTest.java | 6 +- .../dht/GridCacheDhtEntrySelfTest.java | 3 +- .../dht/GridCacheDhtEntrySetSelfTest.java | 6 +- ...GridCacheDhtEvictionNearReadersSelfTest.java | 4 +- .../dht/GridCacheDhtEvictionSelfTest.java | 4 +- .../GridCacheDhtEvictionsDisabledSelfTest.java | 3 +- .../dht/GridCacheDhtInternalEntrySelfTest.java | 4 +- .../dht/GridCacheDhtMappingSelfTest.java | 3 +- .../dht/GridCacheDhtPreloadBigDataSelfTest.java | 6 +- .../dht/GridCacheDhtPreloadDelayedSelfTest.java | 3 +- .../GridCacheDhtPreloadDisabledSelfTest.java | 4 +- .../GridCacheDhtPreloadMessageCountTest.java | 3 +- ...ridCacheDhtPreloadMultiThreadedSelfTest.java | 3 +- .../dht/GridCacheDhtPreloadOffHeapSelfTest.java | 6 +- .../dht/GridCacheDhtPreloadPutGetSelfTest.java | 3 +- .../dht/GridCacheDhtPreloadSelfTest.java | 8 +- .../GridCacheDhtPreloadStartStopSelfTest.java | 8 +- .../dht/GridCacheDhtPreloadUnloadSelfTest.java | 6 +- .../dht/GridCacheDhtRemoveFailureTest.java | 5 +- .../dht/GridCacheDhtTxPreloadSelfTest.java | 5 +- .../dht/GridCacheGlobalLoadTest.java | 16 +- ...ePartitionedNearDisabledMetricsSelfTest.java | 5 +- ...isabledTxOriginatingNodeFailureSelfTest.java | 1 - ...idCachePartitionedPreloadEventsSelfTest.java | 5 +- ...dCachePartitionedTopologyChangeSelfTest.java | 3 +- ...itionedTxOriginatingNodeFailureSelfTest.java | 5 +- ...ridCachePartitionedUnloadEventsSelfTest.java | 5 +- ...eAtomicInvalidPartitionHandlingSelfTest.java | 5 +- .../atomic/GridCacheAtomicPreloadSelfTest.java | 3 +- ...GridCacheValueConsistencyAtomicSelfTest.java | 4 +- ...unctionExcludeNeighborsAbstractSelfTest.java | 4 +- ...tomicClientOnlyMultiNodeFullApiSelfTest.java | 5 +- ...GridCacheAtomicMultiNodeFullApiSelfTest.java | 5 +- ...omicMultiNodeP2PDisabledFullApiSelfTest.java | 5 +- ...eAtomicNearOnlyMultiNodeFullApiSelfTest.java | 5 +- .../GridCacheAtomicNearRemoveFailureTest.java | 5 +- .../GridCacheAtomicOffHeapFullApiSelfTest.java | 5 +- ...heAtomicOffHeapMultiNodeFullApiSelfTest.java | 5 +- ...idCacheAtomicPartitionedMetricsSelfTest.java | 6 +- ...cPrimaryWriteOrderNearRemoveFailureTest.java | 5 +- .../near/GridCacheGetStoreErrorSelfTest.java | 29 +- .../near/GridCacheNearEvictionSelfTest.java | 3 +- .../near/GridCacheNearJobExecutionSelfTest.java | 3 +- .../near/GridCacheNearMetricsSelfTest.java | 5 +- .../near/GridCacheNearMultiGetSelfTest.java | 3 +- .../near/GridCacheNearMultiNodeSelfTest.java | 24 +- .../near/GridCacheNearOneNodeSelfTest.java | 26 +- ...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 5 +- .../near/GridCacheNearOnlyTopologySelfTest.java | 3 +- .../GridCacheNearPartitionedClearSelfTest.java | 14 +- .../GridCacheNearReaderPreloadSelfTest.java | 4 +- .../near/GridCacheNearReadersSelfTest.java | 3 +- .../near/GridCacheNearRemoveFailureTest.java | 6 +- .../near/GridCacheNearTxMultiNodeSelfTest.java | 3 +- .../near/GridCacheNearTxPreloadSelfTest.java | 5 +- ...AffinityExcludeNeighborsPerformanceTest.java | 4 +- ...rtitionedAffinityHashIdResolverSelfTest.java | 4 +- .../GridCachePartitionedAffinitySelfTest.java | 4 +- .../near/GridCachePartitionedBasicApiTest.java | 4 +- .../GridCachePartitionedBasicOpSelfTest.java | 3 +- ...ePartitionedBasicStoreMultiNodeSelfTest.java | 108 +- .../near/GridCachePartitionedEventSelfTest.java | 6 +- .../GridCachePartitionedEvictionSelfTest.java | 4 +- ...titionedExplicitLockNodeFailureSelfTest.java | 3 +- ...GridCachePartitionedFilteredPutSelfTest.java | 5 +- .../GridCachePartitionedFullApiSelfTest.java | 5 +- .../GridCachePartitionedLoadCacheSelfTest.java | 34 +- .../near/GridCachePartitionedLockSelfTest.java | 3 +- .../GridCachePartitionedMetricsSelfTest.java | 6 +- ...achePartitionedMultiNodeCounterSelfTest.java | 3 +- ...achePartitionedMultiNodeFullApiSelfTest.java | 5 +- ...idCachePartitionedMultiNodeLockSelfTest.java | 4 +- .../GridCachePartitionedMultiNodeSelfTest.java | 3 +- ...ePartitionedMultiThreadedPutGetSelfTest.java | 3 +- .../near/GridCachePartitionedNestedTxTest.java | 4 +- ...GridCachePartitionedNodeFailureSelfTest.java | 3 +- .../GridCachePartitionedNodeRestartTest.java | 4 +- ...ePartitionedOptimisticTxNodeRestartTest.java | 4 +- ...achePartitionedPreloadLifecycleSelfTest.java | 7 +- .../GridCachePartitionedProjectionSelfTest.java | 5 +- ...hePartitionedQueryMultiThreadedSelfTest.java | 3 +- .../GridCachePartitionedStorePutSelfTest.java | 28 +- ...GridCachePartitionedTxConcurrentGetTest.java | 4 +- ...GridCachePartitionedTxMultiNodeSelfTest.java | 4 +- ...CachePartitionedTxMultiThreadedSelfTest.java | 4 +- .../GridCachePartitionedTxSalvageSelfTest.java | 3 +- ...achePartitionedTxSingleThreadedSelfTest.java | 3 +- .../GridCachePartitionedTxTimeoutSelfTest.java | 4 +- .../near/GridCachePutArrayValueSelfTest.java | 5 +- ...idCacheRendezvousAffinityClientSelfTest.java | 3 +- .../near/GridPartitionedBackupLoadSelfTest.java | 30 +- ...stractReplicatedByteArrayValuesSelfTest.java | 14 +- ...ridCacheAtomicReplicatedMetricsSelfTest.java | 6 +- ...eplicatedAtomicMultiNodeFullApiSelfTest.java | 5 +- .../GridCacheReplicatedBasicApiTest.java | 4 +- .../GridCacheReplicatedBasicOpSelfTest.java | 4 +- .../GridCacheReplicatedClientOnlySelfTest.java | 5 +- .../GridCacheReplicatedEvictionSelfTest.java | 5 +- .../GridCacheReplicatedFullApiSelfTest.java | 5 +- .../GridCacheReplicatedInvalidateSelfTest.java | 3 +- .../GridCacheReplicatedJobExecutionTest.java | 3 +- .../GridCacheReplicatedMarshallerTxTest.java | 4 +- .../GridCacheReplicatedMetricsSelfTest.java | 6 +- ...ridCacheReplicatedMultiNodeLockSelfTest.java | 4 +- .../GridCacheReplicatedMultiNodeSelfTest.java | 4 +- .../GridCacheReplicatedNearOnlySelfTest.java | 5 +- .../GridCacheReplicatedNodeFailureSelfTest.java | 4 +- .../GridCacheReplicatedNodeRestartSelfTest.java | 4 +- ...dezvousAffinityMultiNodeFullApiSelfTest.java | 6 +- .../GridCacheReplicatedTxConcurrentGetTest.java | 4 +- ...GridCacheReplicatedTxMultiNodeBasicTest.java | 4 +- ...dCacheReplicatedTxMultiThreadedSelfTest.java | 4 +- ...CacheReplicatedTxSingleThreadedSelfTest.java | 4 +- .../GridCacheReplicatedTxTimeoutSelfTest.java | 4 +- ...idCacheReplicatedUnswapAdvancedSelfTest.java | 3 +- .../GridCacheSyncReplicatedPreloadSelfTest.java | 4 +- ...CacheReplicatedPreloadLifecycleSelfTest.java | 7 +- ...idCacheReplicatedPreloadOffHeapSelfTest.java | 7 +- .../GridCacheReplicatedPreloadSelfTest.java | 5 +- ...eplicatedPreloadStartStopEventsSelfTest.java | 4 +- .../GridCacheBatchEvictUnswapSelfTest.java | 30 +- ...heConcurrentEvictionConsistencySelfTest.java | 3 +- .../GridCacheConcurrentEvictionsSelfTest.java | 3 +- .../GridCacheDistributedEvictionsSelfTest.java | 3 +- .../GridCacheEmptyEntriesAbstractSelfTest.java | 32 +- .../eviction/GridCacheEvictionAbstractTest.java | 3 +- .../GridCacheEvictionFilterSelfTest.java | 3 +- .../GridCacheEvictionLockUnlockSelfTest.java | 3 +- .../GridCacheEvictionTouchSelfTest.java | 27 +- ...cheSynchronousEvictionsFailoverSelfTest.java | 5 +- .../GridCacheLruNearEvictionPolicySelfTest.java | 3 +- ...heNearOnlyLruNearEvictionPolicySelfTest.java | 3 +- ...dCacheAtomicLocalMetricsNoStoreSelfTest.java | 4 +- .../GridCacheAtomicLocalMetricsSelfTest.java | 6 +- .../local/GridCacheLocalBasicApiSelfTest.java | 4 +- .../GridCacheLocalByteArrayValuesSelfTest.java | 5 +- .../local/GridCacheLocalFullApiSelfTest.java | 5 +- .../local/GridCacheLocalLoadAllSelfTest.java | 39 +- .../cache/local/GridCacheLocalLockSelfTest.java | 5 +- .../local/GridCacheLocalMetricsSelfTest.java | 6 +- .../GridCacheLocalMultithreadedSelfTest.java | 2 +- .../GridCacheLocalTxMultiThreadedSelfTest.java | 4 +- .../GridCacheLocalTxSingleThreadedSelfTest.java | 4 +- .../local/GridCacheLocalTxTimeoutSelfTest.java | 3 +- .../GridCacheSwapScanQueryAbstractSelfTest.java | 5 +- ...ridCacheContinuousQueryAbstractSelfTest.java | 28 +- ...dCacheAbstractReduceFieldsQuerySelfTest.java | 5 +- .../dataload/GridDataLoaderImplSelfTest.java | 5 +- .../dataload/GridDataLoaderPerformanceTest.java | 4 +- .../GridDataLoaderProcessorSelfTest.java | 104 +- ...heGgfsPerBlockLruEvictionPolicySelfTest.java | 9 +- .../ggfs/GridGgfsAbstractSelfTest.java | 5 +- .../processors/ggfs/GridGgfsCacheSelfTest.java | 5 +- .../ggfs/GridGgfsDataManagerSelfTest.java | 5 +- .../ggfs/GridGgfsMetaManagerSelfTest.java | 6 +- .../ggfs/GridGgfsMetricsSelfTest.java | 9 +- .../processors/ggfs/GridGgfsModesSelfTest.java | 9 +- .../ggfs/GridGgfsProcessorSelfTest.java | 6 +- .../GridGgfsProcessorValidationSelfTest.java | 78 +- ...IpcEndpointRegistrationAbstractSelfTest.java | 5 +- .../processors/ggfs/GridGgfsSizeSelfTest.java | 5 +- .../ggfs/GridGgfsStreamsSelfTest.java | 6 +- .../processors/ggfs/GridGgfsTaskSelfTest.java | 6 +- .../GridGgfsAbstractRecordResolverSelfTest.java | 6 +- .../cache/GridCacheCommandHandlerSelfTest.java | 3 +- .../GridServiceProcessorAbstractSelfTest.java | 4 +- .../gridgain/grid/lang/GridFuncSelfTest.java | 4 +- .../marshaller/GridMarshallerAbstractTest.java | 6 +- .../GridP2PContinuousDeploymentSelfTest.java | 6 +- .../session/GridSessionCheckpointSelfTest.java | 4 +- .../util/future/GridEmbeddedFutureSelfTest.java | 2 +- .../shmem/GridIpcSharedMemoryNodeStartup.java | 4 +- .../loadtests/GridCacheMultiNodeLoadTest.java | 4 +- ...ridCacheAffinityTransactionsOffHeapTest.java | 3 +- .../cache/GridCachePutRemoveLoadTest.java | 3 +- .../cache/GridCacheSingleNodeLoadTest.java | 3 +- .../GridCacheWriteBehindStoreLoadTest.java | 23 +- .../capacity/spring-capacity-cache.xml | 4 +- .../colocation/GridTestCacheStore.java | 23 +- .../loadtests/colocation/spring-colocation.xml | 4 +- .../GridCachePartitionedAtomicLongLoadTest.java | 3 +- .../loadtests/hashmap/GridCacheTestContext.java | 13 +- .../loadtests/hashmap/GridHashMapLoadTest.java | 14 +- .../swap/GridSwapEvictAllBenchmark.java | 28 +- .../gridgain/testframework/GridTestUtils.java | 39 + .../testframework/junits/GridAbstractTest.java | 7 +- .../testframework/junits/GridTestResources.java | 7 + .../cache/GridAbstractCacheStoreSelfTest.java | 252 ++- .../junits/cache/TestCacheSession.java | 65 + .../cache/TestThreadLocalCacheSession.java | 65 + .../GridAbstractLifecycleAwareSelfTest.java | 7 + .../junits/common/GridCommonAbstractTest.java | 9 +- .../GridCacheGroupLockSelfTestSuite.java | 2 +- .../bamboo/GridDataGridTestSuite.java | 34 +- .../core/src/test/webapp/META-INF/gg-config.xml | 10 +- ...dGgfsHadoop20FileSystemAbstractSelfTest.java | 13 +- .../GridGgfsHadoopDualAbstractSelfTest.java | 5 +- ...ridGgfsHadoopFileSystemAbstractSelfTest.java | 13 +- .../GridGgfsHadoopFileSystemClientSelfTest.java | 10 +- ...idGgfsHadoopFileSystemHandshakeSelfTest.java | 6 +- ...ridGgfsHadoopFileSystemIpcCacheSelfTest.java | 9 +- ...GgfsHadoopFileSystemLoggerStateSelfTest.java | 5 +- ...fsHadoopFileSystemSecondaryModeSelfTest.java | 9 +- .../ggfs/GridGgfsNearOnlyMultiNodeSelfTest.java | 5 +- .../hadoop/GridHadoopAbstractSelfTest.java | 10 +- .../hibernate/GridCacheHibernateBlobStore.java | 85 +- ...idHibernateL2CacheConfigurationSelfTest.java | 5 +- .../hibernate/GridHibernateL2CacheSelfTest.java | 9 +- ...idHibernateL2CacheTransactionalSelfTest.java | 5 +- .../GridCacheHibernateBlobStoreSelfTest.java | 6 +- .../processors/query/h2/GridH2Indexing.java | 6 +- .../tcp/GridOrderedMessageCancelSelfTest.java | 4 +- .../GridCacheAbstractFieldsQuerySelfTest.java | 5 +- .../cache/GridCacheAbstractQuerySelfTest.java | 30 +- .../cache/GridCacheCrossCacheQuerySelfTest.java | 5 +- .../cache/GridCacheOffHeapAndSwapSelfTest.java | 3 +- .../cache/GridCacheQueryLoadSelfTest.java | 41 +- .../cache/GridCacheQueryMetricsSelfTest.java | 3 +- .../GridCacheQueryMultiThreadedSelfTest.java | 3 +- .../GridCacheQueryUserResourceSelfTest.java | 6 +- ...idCacheReduceQueryMultithreadedSelfTest.java | 5 +- .../GridCacheSqlQueryMultiThreadedSelfTest.java | 3 +- .../processors/cache/GridCacheSwapSelfTest.java | 3 +- .../cache/GridIndexingWithNoopSwapSelfTest.java | 3 +- ...GridCachePartitionedFieldsQuerySelfTest.java | 5 +- ...idCachePartitionedHitsAndMissesSelfTest.java | 5 +- .../near/GridCacheQueryNodeRestartSelfTest.java | 3 +- .../grid/cache/jta/GridCacheTmLookup.java | 5 +- .../cache/jta/GridCacheJtaManager.java | 4 +- ...CacheJtaConfigurationValidationSelfTest.java | 4 +- .../processors/cache/GridCacheJtaSelfTest.java | 9 +- .../GridTmLookupLifecycleAwareSelfTest.java | 4 +- .../scalar/src/test/resources/spring-cache.xml | 2 +- .../spring/GridSpringCacheManagerSelfTest.java | 3 +- .../GridSpringDynamicCacheManagerSelfTest.java | 3 +- .../p2p/GridP2PUserVersionChangeSelfTest.java | 4 +- .../cache/VisorCacheClearCommandSpec.scala | 5 +- .../cache/VisorCacheCompactCommandSpec.scala | 5 +- .../cswap/VisorCacheSwapCommandSpec.scala | 7 +- .../cache/websession/GridWebSessionFilter.java | 3 +- 639 files changed, 12273 insertions(+), 6671 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4c53f88/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStore.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/cache/store/CacheStore.java index 0000000,d2593ae..b127a18 mode 000000,100644..100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStore.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStore.java @@@ -1,0 -1,180 +1,179 @@@ + /* + * 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.cache.store; + + import org.apache.ignite.*; + import org.apache.ignite.cache.*; + import org.apache.ignite.cache.store.jdbc.*; + import org.apache.ignite.lang.*; + import org.apache.ignite.portables.*; + import org.apache.ignite.resources.*; + import org.apache.ignite.transactions.*; -import org.gridgain.grid.*; + import org.gridgain.grid.cache.*; + import org.jetbrains.annotations.*; + + import javax.cache.integration.*; + import java.sql.*; + import java.util.*; + import java.util.Date; + + import static javax.cache.Cache.*; + + /** + * API for cache persistent storage for read-through and write-through behavior. + * Persistent store is configured via {@link CacheConfiguration#getCacheStoreFactory()} + * configuration property. If not provided, values will be only kept in cache memory + * or swap storage without ever being persisted to a persistent storage. + * <p> + * {@link CacheStoreAdapter} provides default implementation for bulk operations, + * such as {@link #loadAll(Iterable)}, + * {@link #writeAll(Collection)}, and {@link #deleteAll(Collection)} + * by sequentially calling corresponding {@link #load(Object)}, + * {@link #write(Entry)}, and {@link #delete(Object)} + * operations. Use this adapter whenever such behaviour is acceptable. However + * in many cases it maybe more preferable to take advantage of database batch update + * functionality, and therefore default adapter implementation may not be the best option. + * <p> + * Provided implementations may be used for test purposes: + * <ul> + * <li>{@gglink org.gridgain.grid.cache.store.hibernate.GridCacheHibernateBlobStore}</li> + * <li>{@link CacheJdbcBlobStore}</li> + * </ul> + * <p> + * All transactional operations of this API are provided with ongoing {@link IgniteTx}, - * if any. As transaction is {@link GridMetadataAware}, you can attach any metadata to - * it, e.g. to recognize if several operations belong to the same transaction or not. ++ * if any. You can attach any metadata to it, e.g. to recognize if several operations belong ++ * to the same transaction or not. + * Here is an example of how attach a JDBC connection as transaction metadata: + * <pre name="code" class="java"> + * Connection conn = tx.meta("some.name"); + * + * if (conn == null) { + * conn = ...; // Get JDBC connection. + * + * // Store connection in transaction metadata, so it can be accessed + * // for other operations on the same transaction. + * tx.addMeta("some.name", conn); + * } + * </pre> + * <h1 class="header">Working With Portable Objects</h1> + * When portables are enabled for cache by setting {@link CacheConfiguration#isPortableEnabled()} to + * {@code true}), all portable keys and values are converted to instances of {@link PortableObject}. + * Therefore, all cache store methods will take parameters in portable format. To avoid class + * cast exceptions, store must have signature compatible with portables. E.g., if you use {@link Integer} + * as a key and {@code Value} class as a value (which will be converted to portable format), cache store + * signature should be the following: + * <pre name="code" class="java"> + * public class PortableCacheStore implements GridCacheStore<Integer, GridPortableObject> { + * public void put(@Nullable GridCacheTx tx, Integer key, GridPortableObject val) throws IgniteCheckedException { + * ... + * } + * + * ... + * } + * </pre> + * This behavior can be overridden by setting {@link CacheConfiguration#setKeepPortableInStore(boolean)} + * flag value to {@code false}. In this case, GridGain will deserialize keys and values stored in portable + * format before they are passed to cache store, so that you can use the following cache store signature instead: + * <pre name="code" class="java"> + * public class ObjectsCacheStore implements GridCacheStore<Integer, Person> { + * public void put(@Nullable GridCacheTx tx, Integer key, Person val) throws GridException { + * ... + * } + * + * ... + * } + * </pre> + * Note that while this can simplify store implementation in some cases, it will cause performance degradation + * due to additional serializations and deserializations of portable objects. You will also need to have key + * and value classes on all nodes since portables will be deserialized when store is invoked. + * <p> + * Note that only portable classes are converted to {@link PortableObject} format. Following + * types are stored in cache without changes and therefore should not affect cache store signature: + * <ul> + * <li>All primitives (byte, int, ...) and there boxed versions (Byte, Integer, ...)</li> + * <li>Arrays of primitives (byte[], int[], ...)</li> + * <li>{@link String} and array of {@link String}s</li> + * <li>{@link UUID} and array of {@link UUID}s</li> + * <li>{@link Date} and array of {@link Date}s</li> + * <li>{@link Timestamp} and array of {@link Timestamp}s</li> + * <li>Enums and array of enums</li> + * <li> + * Maps, collections and array of objects (but objects inside + * them will still be converted if they are portable) + * </li> + * </ul> + * + * @see IgnitePortables + * @see CacheStoreSession + */ + public abstract class CacheStore<K, V> implements CacheLoader<K, V>, CacheWriter<K, V> { + /** */ + private CacheStoreSession ses; + + /** */ + @IgniteInstanceResource + private Ignite ignite; + + /** + * Loads all values from underlying persistent storage. Note that keys are not + * passed, so it is up to implementation to figure out what to load. This method + * is called whenever {@link GridCache#loadCache(org.apache.ignite.lang.IgniteBiPredicate, long, Object...)} + * method is invoked which is usually to preload the cache from persistent storage. + * <p> + * This method is optional, and cache implementation does not depend on this + * method to do anything. Default implementation of this method in + * {@link CacheStoreAdapter} does nothing. + * <p> + * For every loaded value method {@link org.apache.ignite.lang.IgniteBiInClosure#apply(Object, Object)} + * should be called on the passed in closure. The closure will then make sure + * that the loaded value is stored in cache. + * + * @param clo Closure for loaded values. + * @param args Arguments passes into + * {@link GridCache#loadCache(org.apache.ignite.lang.IgniteBiPredicate, long, Object...)} method. + * @throws CacheLoaderException If loading failed. + */ + public abstract void loadCache(IgniteBiInClosure<K, V> clo, @Nullable Object... args) throws CacheLoaderException; + + /** + * Tells store to commit or rollback a transaction depending on the value of the {@code 'commit'} + * parameter. + * + * @param commit {@code True} if transaction should commit, {@code false} for rollback. + * @throws CacheWriterException If commit or rollback failed. Note that commit failure in some cases + * may bring cache transaction into {@link IgniteTxState#UNKNOWN} which will + * consequently cause all transacted entries to be invalidated. + */ + public abstract void txEnd(boolean commit) throws CacheWriterException; + + /** + * Gets session for current cache operation. Returns {@code null} if store is used with atomic cache. + * + * @return Session for current cache operation. + */ + @Nullable public CacheStoreSession session() { + return ses; + } + + /** + * @return {@link Ignite} instance. + */ + public Ignite ignite() { + return ignite; + } + } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4c53f88/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java index af4d432,0244e9b..58d9de4 --- a/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java +++ b/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java @@@ -18,10 -18,10 +18,12 @@@ package org.apache.ignite.transactions; import org.apache.ignite.*; + import org.apache.ignite.cache.*; import org.apache.ignite.lang.*; import org.gridgain.grid.cache.*; + +import org.jetbrains.annotations.*; + import java.util.*; /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4c53f88/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4c53f88/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4c53f88/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java index f33445d,5bf2404..ccab38a --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheStoreManager.java @@@ -499,7 -741,18 +741,18 @@@ public class GridCacheStoreManager<K, V * @throws IgniteCheckedException If failed. */ public void txEnd(IgniteTx tx, boolean commit) throws IgniteCheckedException { - store.txEnd(tx, commit); + assert store != null; + + initSession(tx); + + try { + store.txEnd(commit); + } + finally { + sesHolder.set(null); + - ((GridMetadataAware)tx).removeMeta(SES_ATTR); ++ tx.removeMeta(SES_ATTR); + } } /** @@@ -517,4 -770,349 +770,349 @@@ else throw e; } + + /** + * @param tx Current transaction. + */ + private void initSession(@Nullable IgniteTx tx) { + SessionData ses; + + if (tx != null) { - ses = ((GridMetadataAware)tx).meta(SES_ATTR); ++ ses = tx.meta(SES_ATTR); + + if (ses == null) { + ses = new SessionData(tx, cctx.name()); + - ((GridMetadataAware)tx).addMeta(SES_ATTR, ses); ++ tx.addMeta(SES_ATTR, ses); + } + } + else + ses = new SessionData(null, cctx.name()); + + sesHolder.set(ses); + } + + /** + * + */ + private static class SessionData { + /** */ + private final IgniteTx tx; + + /** */ + private final String cacheName; + + /** */ + private Map<Object, Object> props; + + /** + * @param tx Current transaction. + * @param cacheName Cache name. + */ + private SessionData(@Nullable IgniteTx tx, @Nullable String cacheName) { + this.tx = tx; + this.cacheName = cacheName; + } + + /** + * @return Transaction. + */ + @Nullable private IgniteTx transaction() { + return tx; + } + + /** + * @return Properties. + */ + private Map<Object, Object> properties() { + if (props == null) + props = new GridLeanMap<>(); + + return props; + } + + /** + * @return Cache name. + */ + private String cacheName() { + return cacheName; + } + } + + /** + * + */ + private static class ThreadLocalSession implements CacheStoreSession { + /** */ + private final ThreadLocal<SessionData> sesHolder; + + /** + * @param sesHolder Session holder. + */ + private ThreadLocalSession(ThreadLocal<SessionData> sesHolder) { + this.sesHolder = sesHolder; + } + + /** {@inheritDoc} */ + @Nullable @Override public IgniteTx transaction() { + SessionData ses0 = sesHolder.get(); + + return ses0 != null ? ses0.transaction() : null; + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override public <K1, V1> Map<K1, V1> properties() { + SessionData ses0 = sesHolder.get(); + + return ses0 != null ? (Map<K1, V1>)ses0.properties() : null; + } + + /** {@inheritDoc} */ + @Nullable @Override public String cacheName() { + SessionData ses0 = sesHolder.get(); + + return ses0 != null ? ses0.cacheName() : null; + } + } + + /** + * + */ + @SuppressWarnings("unchecked") + private class EntriesView extends AbstractCollection<Cache.Entry<? extends K, ?>> { + /** */ + private final Map<K, IgniteBiTuple<V, GridCacheVersion>> map; + + /** */ + private Set<K> rmvd; + + /** */ + private boolean cleared; + + /** + * @param map Map. + */ + private EntriesView(Map<K, IgniteBiTuple<V, GridCacheVersion>> map) { + assert map != null; + + this.map = map; + } + + /** {@inheritDoc} */ + @Override public int size() { + return cleared ? 0 : (map.size() - (rmvd != null ? rmvd.size() : 0)); + } + + /** {@inheritDoc} */ + @Override public boolean isEmpty() { + return cleared || !iterator().hasNext(); + } + + /** {@inheritDoc} */ + @Override public boolean contains(Object o) { + if (cleared || !(o instanceof Cache.Entry)) + return false; + + Cache.Entry<? extends K, ?> e = (Cache.Entry<? extends K, ?>)o; + + return map.containsKey(e.getKey()); + } + + /** {@inheritDoc} */ + @NotNull @Override public Iterator<Cache.Entry<? extends K, ?>> iterator() { + if (cleared) + return F.emptyIterator(); + + final Iterator<Map.Entry<K, IgniteBiTuple<V, GridCacheVersion>>> it0 = map.entrySet().iterator(); + + return new Iterator<Cache.Entry<? extends K, ?>>() { + /** */ + private Cache.Entry<? extends K, ?> cur; + + /** */ + private Cache.Entry<? extends K, ?> next; + + /** + * + */ + { + checkNext(); + } + + /** + * + */ + private void checkNext() { + while (it0.hasNext()) { + Map.Entry<K, IgniteBiTuple<V, GridCacheVersion>> e = it0.next(); + + K k = e.getKey(); + + if (rmvd != null && rmvd.contains(k)) + continue; + + Object v = locStore ? e.getValue() : e.getValue().get1(); + + if (convertPortable) { + k = (K)cctx.unwrapPortableIfNeeded(k, false); + v = cctx.unwrapPortableIfNeeded(v, false); + } + + next = new CacheEntryImpl<>(k, v); + + break; + } + } + + @Override public boolean hasNext() { + return next != null; + } + + @Override public Cache.Entry<? extends K, ?> next() { + if (next == null) + throw new NoSuchElementException(); + + cur = next; + + next = null; + + checkNext(); + + return cur; + } + + @Override public void remove() { + if (cur == null) + throw new IllegalStateException(); + + addRemoved(cur); + + cur = null; + } + }; + } + + /** {@inheritDoc} */ + @Override public boolean add(Cache.Entry<? extends K, ?> entry) { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public boolean addAll(Collection<? extends Cache.Entry<? extends K, ?>> col) { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public boolean remove(Object o) { + if (cleared || !(o instanceof Cache.Entry)) + return false; + + Cache.Entry<? extends K, ?> e = (Cache.Entry<? extends K, ?>)o; + + if (rmvd != null && rmvd.contains(e.getKey())) + return false; + + if (mapContains(e)) { + addRemoved(e); + + return true; + } + + return false; + } + + /** {@inheritDoc} */ + @Override public boolean containsAll(Collection<?> col) { + if (cleared) + return false; + + for (Object o : col) { + if (contains(o)) + return false; + } + + return true; + } + + /** {@inheritDoc} */ + @Override public boolean removeAll(Collection<?> col) { + if (cleared) + return false; + + boolean modified = false; + + for (Object o : col) { + if (remove(o)) + modified = true; + } + + return modified; + } + + /** {@inheritDoc} */ + @Override public boolean retainAll(Collection<?> col) { + if (cleared) + return false; + + boolean modified = false; + + for (Cache.Entry<? extends K, ?> e : this) { + if (!col.contains(e)) { + addRemoved(e); + + modified = true; + } + } + + return modified; + } + + /** {@inheritDoc} */ + @Override public void clear() { + cleared = true; + } + + /** + * @param e Entry. + */ + private void addRemoved(Cache.Entry<? extends K, ?> e) { + if (rmvd == null) + rmvd = new HashSet<>(); + + rmvd.add(e.getKey()); + } + + /** + * @param e Entry. + * @return {@code True} if original map contains entry. + */ + private boolean mapContains(Cache.Entry<? extends K, ?> e) { + K key = (K)(convertPortable ? cctx.marshalToPortable(e.getKey()) : e.getKey()); + + return map.containsKey(key); + + } + + /** {@inheritDoc} */ + public String toString() { + Iterator<Cache.Entry<? extends K, ?>> it = iterator(); + + if (!it.hasNext()) + return "[]"; + + SB sb = new SB("["); + + while (true) { + Cache.Entry<? extends K, ?> e = it.next(); + + sb.a(e.toString()); + + if (!it.hasNext()) + return sb.a(']').toString(); + + sb.a(", "); + } + } + } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4c53f88/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxEx.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxEx.java index 88be2f3,581f01e..cf1b3fd --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxEx.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxEx.java @@@ -31,7 -32,10 +32,10 @@@ import java.util.* /** * Transaction managed by cache ({@code 'Ex'} stands for external). */ -public interface IgniteTxEx<K, V> extends GridMetadataAware, IgniteTx, GridTimeoutObject { +public interface IgniteTxEx<K, V> extends IgniteTx, GridTimeoutObject { + /** + * + */ @SuppressWarnings("PublicInnerClass") public enum FinalizationStatus { /** Transaction was not finalized yet. */