Merge branch 'sprint-1' into ignite-35
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/be2e7fe2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/be2e7fe2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/be2e7fe2 Branch: refs/heads/ignite-53 Commit: be2e7fe2d32d83be8eb0aa7ddaf8f30be7ad8538 Parents: a9c0e0c b9288ff Author: nikolay_tikhonov <ntikho...@gridgain.com> Authored: Thu Jan 22 17:22:39 2015 +0300 Committer: nikolay_tikhonov <ntikho...@gridgain.com> Committed: Thu Jan 22 17:45:20 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 +- .../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 | 25 +- .../org/apache/ignite/IgniteCacheManager.java | 12 +- .../java/org/apache/ignite/IgnitePortables.java | 3 +- .../org/apache/ignite/IgniteTransactions.java | 3 +- .../apache/ignite/cache/CacheConfiguration.java | 1784 +++++++++++++++++- .../cache/store/CacheLoadOnlyStoreAdapter.java | 324 ++++ .../ignite/cache/store/CacheLocalStore.java | 31 + .../apache/ignite/cache/store/CacheStore.java | 180 ++ .../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 + .../org/apache/ignite/compute/ComputeTask.java | 4 +- .../ignite/compute/ComputeTaskAdapter.java | 4 +- .../configuration/IgniteConfiguration.java | 10 +- .../processors/cache/IgniteCacheProxy.java | 38 +- .../resources/IgniteCacheNameResource.java | 9 +- .../spi/discovery/tcp/TcpDiscoverySpi.java | 8 +- .../spi/swapspace/file/FileSwapSpaceSpi.java | 2 +- .../apache/ignite/transactions/IgniteTx.java | 6 +- .../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 | 220 --- .../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 | 8 +- .../transactions/IgniteTxLocalAdapter.java | 26 +- .../cache/transactions/IgniteTxLocalEx.java | 2 + .../cache/transactions/IgniteTxProxyImpl.java | 72 - .../dataload/GridDataLoadCacheUpdaters.java | 3 +- .../dr/GridDrDataLoadCacheUpdater.java | 5 +- .../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/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 | 5 +- .../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 | 4 +- .../GridCacheAbstractProjectionSelfTest.java | 5 +- .../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 | 12 +- ...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 | 3 +- .../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 | 5 +- .../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 +- ...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 | 28 +- ...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 +- ...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 +- 628 files changed, 12018 insertions(+), 6348 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be2e7fe2/modules/clients/src/test/java/org/gridgain/client/integration/GridClientAbstractMultiNodeSelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be2e7fe2/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java index 0000000,4ad668b..970d252 mode 000000,100644..100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java @@@ -1,0 -1,586 +1,586 @@@ + /* + * 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.jdbc; + + import org.apache.ignite.*; + import org.apache.ignite.cache.store.*; + import org.apache.ignite.marshaller.*; + import org.apache.ignite.resources.*; + import org.apache.ignite.transactions.*; + import org.gridgain.grid.*; + import org.gridgain.grid.util.tostring.*; + import org.gridgain.grid.util.typedef.*; + import org.gridgain.grid.util.typedef.internal.*; + import org.jdk8.backport.*; + import org.jetbrains.annotations.*; + + import javax.cache.*; + import javax.cache.integration.*; + import javax.sql.*; + import java.sql.*; + import java.util.*; + import java.util.concurrent.*; + import java.util.concurrent.atomic.*; + + /** + * {@link CacheStore} implementation backed by JDBC. This implementation + * stores objects in underlying database in {@code BLOB} format. + * <p> + * Store will create table {@code ENTRIES} in the database to store data. + * Table will have {@code key} and {@code val} fields. + * <p> + * If custom DDL and DML statements are provided, table and field names have + * to be consistent for all statements and sequence of parameters have to be + * preserved. + * <h2 class="header">Configuration</h2> + * Sections below describe mandatory and optional configuration settings as well + * as providing example using Java and Spring XML. + * <h3>Mandatory</h3> + * There are no mandatory configuration parameters. + * <h3>Optional</h3> + * <ul> + * <li>Data source (see {@link #setDataSource(DataSource)}</li> + * <li>Connection URL (see {@link #setConnectionUrl(String)})</li> + * <li>User name (see {@link #setUser(String)})</li> + * <li>Password (see {@link #setPassword(String)})</li> + * <li>Create table query (see {@link #setConnectionUrl(String)})</li> + * <li>Load entry query (see {@link #setLoadQuery(String)})</li> + * <li>Update entry query (see {@link #setUpdateQuery(String)})</li> + * <li>Insert entry query (see {@link #setInsertQuery(String)})</li> + * <li>Delete entry query (see {@link #setDeleteQuery(String)})</li> + * </ul> + * <h2 class="header">Java Example</h2> + * <pre name="code" class="java"> + * ... + * GridCacheJdbcBlobStore<String, String> store = new GridCacheJdbcBlobStore<String, String>(); + * ... + * </pre> + * <h2 class="header">Spring Example</h2> + * <pre name="code" class="xml"> + * ... + * <bean id="cache.jdbc.store" + * class="org.gridgain.grid.cache.store.jdbc.GridCacheJdbcBlobStore"> + * <property name="connectionUrl" value="jdbc:h2:mem:"/> + * <property name="createTableQuery" + * value="create table if not exists ENTRIES (key other, val other)"/> + * </bean> + * ... + * </pre> + * <p> + * <img src="http://www.gridgain.com/images/spring-small.png"> + * <br> + * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a> + */ + public class CacheJdbcBlobStore<K, V> extends CacheStoreAdapter<K, V> { + /** Default connection URL (value is <tt>jdbc:h2:mem:jdbcCacheStore;DB_CLOSE_DELAY=-1</tt>). */ + public static final String DFLT_CONN_URL = "jdbc:h2:mem:jdbcCacheStore;DB_CLOSE_DELAY=-1"; + + /** + * Default create table query + * (value is <tt>create table if not exists ENTRIES (key other primary key, val other)</tt>). + */ + public static final String DFLT_CREATE_TBL_QRY = "create table if not exists ENTRIES " + + "(key binary primary key, val binary)"; + + /** Default load entry query (value is <tt>select * from ENTRIES where key=?</tt>). */ + public static final String DFLT_LOAD_QRY = "select * from ENTRIES where key=?"; + + /** Default update entry query (value is <tt>select * from ENTRIES where key=?</tt>). */ + public static final String DFLT_UPDATE_QRY = "update ENTRIES set val=? where key=?"; + + /** Default insert entry query (value is <tt>insert into ENTRIES (key, val) values (?, ?)</tt>). */ + public static final String DFLT_INSERT_QRY = "insert into ENTRIES (key, val) values (?, ?)"; + + /** Default delete entry query (value is <tt>delete from ENTRIES where key=?</tt>). */ + public static final String DFLT_DEL_QRY = "delete from ENTRIES where key=?"; + + /** Connection attribute name. */ + private static final String ATTR_CONN = "JDBC_STORE_CONNECTION"; + + /** Connection URL. */ + private String connUrl = DFLT_CONN_URL; + + /** Query to create table. */ + private String createTblQry = DFLT_CREATE_TBL_QRY; + + /** Query to load entry. */ + private String loadQry = DFLT_LOAD_QRY; + + /** Query to update entry. */ + private String updateQry = DFLT_UPDATE_QRY; + + /** Query to insert entries. */ + private String insertQry = DFLT_INSERT_QRY; + + /** Query to delete entries. */ + private String delQry = DFLT_DEL_QRY; + + /** User name for database access. */ + private String user; + + /** Password for database access. */ + @GridToStringExclude + private String passwd; + + /** Data source. */ + private DataSource dataSrc; + + /** Flag for schema initialization. */ + private boolean initSchema = true; + + /** Log. */ + @IgniteLoggerResource + private IgniteLogger log; + + /** Marshaller. */ - @IgniteMarshallerResource - private IgniteMarshaller marsh; ++ @IgniteInstanceResource ++ private Ignite ignite; + + /** Init guard. */ + @GridToStringExclude + private final AtomicBoolean initGuard = new AtomicBoolean(); + + /** Init latch. */ + @GridToStringExclude + private final CountDownLatch initLatch = new CountDownLatch(1); + + /** Opened connections. */ + @GridToStringExclude + private final LongAdder opened = new LongAdder(); + + /** Closed connections. */ + @GridToStringExclude + private final LongAdder closed = new LongAdder(); + + /** Test mode flag. */ + @GridToStringExclude + private boolean testMode; + + /** Successful initialization flag. */ + private boolean initOk; + + /** {@inheritDoc} */ + @Override public void txEnd(boolean commit) { + init(); + + IgniteTx tx = transaction(); + + Map<String, Connection> props = session().properties(); + + Connection conn = props.remove(ATTR_CONN); + + if (conn != null) { + try { + if (commit) + conn.commit(); + else + conn.rollback(); + } + catch (SQLException e) { + throw new CacheWriterException("Failed to end transaction [xid=" + tx.xid() + ", commit=" + commit + ']', e); + } + finally { + closeConnection(conn); + } + } + + if (log.isDebugEnabled()) + log.debug("Transaction ended [xid=" + tx.xid() + ", commit=" + commit + ']'); + } + + /** {@inheritDoc} */ + @SuppressWarnings({"RedundantTypeArguments"}) + @Override public V load(K key) { + init(); + + IgniteTx tx = transaction(); + + if (log.isDebugEnabled()) + log.debug("Store load [key=" + key + ", tx=" + tx + ']'); + + Connection conn = null; + + PreparedStatement stmt = null; + + try { + conn = connection(tx); + + stmt = conn.prepareStatement(loadQry); + + stmt.setObject(1, toBytes(key)); + + ResultSet rs = stmt.executeQuery(); + + if (rs.next()) + return fromBytes(rs.getBytes(2)); + } + catch (IgniteCheckedException | SQLException e) { + throw new CacheLoaderException("Failed to load object: " + key, e); + } + finally { + end(tx, conn, stmt); + } + + return null; + } + + /** {@inheritDoc} */ + @Override public void write(Cache.Entry<? extends K, ? extends V> entry) { + init(); + + IgniteTx tx = transaction(); + + K key = entry.getKey(); + V val = entry.getValue(); + + if (log.isDebugEnabled()) + log.debug("Store put [key=" + key + ", val=" + val + ", tx=" + tx + ']'); + + Connection conn = null; + + PreparedStatement stmt = null; + + try { + conn = connection(tx); + + stmt = conn.prepareStatement(updateQry); + + stmt.setObject(1, toBytes(val)); + stmt.setObject(2, toBytes(key)); + + if (stmt.executeUpdate() == 0) { + stmt.close(); + + stmt = conn.prepareStatement(insertQry); + + stmt.setObject(1, toBytes(key)); + stmt.setObject(2, toBytes(val)); + + stmt.executeUpdate(); + } + } + catch (IgniteCheckedException | SQLException e) { + throw new CacheWriterException("Failed to put object [key=" + key + ", val=" + val + ']', e); + } + finally { + end(tx, conn, stmt); + } + } + + /** {@inheritDoc} */ + @Override public void delete(Object key) { + init(); + + IgniteTx tx = transaction(); + + if (log.isDebugEnabled()) + log.debug("Store remove [key=" + key + ", tx=" + tx + ']'); + + Connection conn = null; + + PreparedStatement stmt = null; + + try { + conn = connection(tx); + + stmt = conn.prepareStatement(delQry); + + stmt.setObject(1, toBytes(key)); + + stmt.executeUpdate(); + } + catch (IgniteCheckedException | SQLException e) { + throw new CacheWriterException("Failed to remove object: " + key, e); + } + finally { + end(tx, conn, stmt); + } + } + + /** + * @param tx Cache transaction. + * @return Connection. + * @throws SQLException In case of error. + */ + private Connection connection(@Nullable IgniteTx tx) throws SQLException { + if (tx != null) { + Map<String, Connection> props = session().properties(); + + Connection conn = props.get(ATTR_CONN); + + if (conn == null) { + conn = openConnection(false); + + // Store connection in session properties, so it can be accessed + // for other operations on the same transaction. + props.put(ATTR_CONN, conn); + } + + return conn; + } + // Transaction can be null in case of simple load operation. + else + return openConnection(true); + } + + /** + * Closes allocated resources depending on transaction status. + * + * @param tx Active transaction, if any. + * @param conn Allocated connection. + * @param st Created statement, + */ + private void end(@Nullable IgniteTx tx, Connection conn, Statement st) { + U.closeQuiet(st); + + if (tx == null) + // Close connection right away if there is no transaction. + closeConnection(conn); + } + + /** + * Gets connection from a pool. + * + * @param autocommit {@code true} If connection should use autocommit mode. + * @return Pooled connection. + * @throws SQLException In case of error. + */ + private Connection openConnection(boolean autocommit) throws SQLException { + Connection conn = dataSrc != null ? dataSrc.getConnection() : + DriverManager.getConnection(connUrl, user, passwd); + + if (testMode) + opened.increment(); + + conn.setAutoCommit(autocommit); + + return conn; + } + + /** + * Closes connection. + * + * @param conn Connection to close. + */ + private void closeConnection(Connection conn) { + U.closeQuiet(conn); + + if (testMode) + closed.increment(); + } + + /** + * Initializes store. + * + * @throws IgniteException If failed to initialize. + */ + private void init() { + if (initLatch.getCount() > 0) { + if (initGuard.compareAndSet(false, true)) { + if (log.isDebugEnabled()) + log.debug("Initializing cache store."); + + if (F.isEmpty(connUrl)) + throw new IgniteException("Failed to initialize cache store (connection URL is not provided)."); + + if (!initSchema) { + initLatch.countDown(); + + return; + } + + if (F.isEmpty(createTblQry)) + throw new IgniteException("Failed to initialize cache store (create table query is not provided)."); + + Connection conn = null; + + Statement stmt = null; + + try { + conn = openConnection(false); + + stmt = conn.createStatement(); + + stmt.execute(createTblQry); + + conn.commit(); + + initOk = true; + } + catch (SQLException e) { + throw new IgniteException("Failed to create database table.", e); + } + finally { + U.closeQuiet(stmt); + + closeConnection(conn); + + initLatch.countDown(); + } + } + else { + try { + U.await(initLatch); + } + catch (GridInterruptedException e) { + throw new IgniteException(e); + } + } + } + + if (!initOk) + throw new IgniteException("Cache store was not properly initialized."); + } + + /** + * Flag indicating whether DB schema should be initialized by GridGain (default behaviour) or + * was explicitly created by user. + * + * @param initSchema {@code True} if DB schema should be initialized by GridGain (default behaviour), + * {code @false} if schema was explicitly created by user. + */ + public void setInitSchema(boolean initSchema) { + this.initSchema = initSchema; + } + + /** + * Sets connection URL. + * + * @param connUrl Connection URL. + */ + public void setConnectionUrl(String connUrl) { + this.connUrl = connUrl; + } + + /** + * Sets create table query. + * + * @param createTblQry Create table query. + */ + public void setCreateTableQuery(String createTblQry) { + this.createTblQry = createTblQry; + } + + /** + * Sets load query. + * + * @param loadQry Load query + */ + public void setLoadQuery(String loadQry) { + this.loadQry = loadQry; + } + + /** + * Sets update entry query. + * + * @param updateQry Update entry query. + */ + public void setUpdateQuery(String updateQry) { + this.updateQry = updateQry; + } + + /** + * Sets insert entry query. + * + * @param insertQry Insert entry query. + */ + public void setInsertQuery(String insertQry) { + this.insertQry = insertQry; + } + + /** + * Sets delete entry query. + * + * @param delQry Delete entry query. + */ + public void setDeleteQuery(String delQry) { + this.delQry = delQry; + } + + /** + * Sets user name for database access. + * + * @param user User name. + */ + public void setUser(String user) { + this.user = user; + } + + /** + * Sets password for database access. + * + * @param passwd Password. + */ + public void setPassword(String passwd) { + this.passwd = passwd; + } + + /** + * Sets data source. Data source should be fully configured and ready-to-use. + * <p> + * Note that if data source is provided, all connections will be + * acquired via this data source. If data source is not provided, a new connection + * will be created for each store call ({@code connectionUrl}, + * {@code user} and {@code password} parameters will be used). + * + * @param dataSrc Data source. + */ + public void setDataSource(DataSource dataSrc) { + this.dataSrc = dataSrc; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(CacheJdbcBlobStore.class, this, "passwd", passwd != null ? "*" : null); + } + + /** + * Serialize object to byte array using marshaller. + * + * @param obj Object to convert to byte array. + * @return Byte array. + * @throws IgniteCheckedException If failed to convert. + */ + protected byte[] toBytes(Object obj) throws IgniteCheckedException { - return marsh.marshal(obj); ++ return ignite.configuration().getMarshaller().marshal(obj); + } + + /** + * Deserialize object from byte array using marshaller. + * + * @param bytes Bytes to deserialize. + * @param <X> Result object type. + * @return Deserialized object. + * @throws IgniteCheckedException If failed. + */ + protected <X> X fromBytes(byte[] bytes) throws IgniteCheckedException { + if (bytes == null || bytes.length == 0) + return null; + - return marsh.unmarshal(bytes, getClass().getClassLoader()); ++ return ignite.configuration().getMarshaller().unmarshal(bytes, getClass().getClassLoader()); + } + + /** + * @return Current transaction. + */ + @Nullable private IgniteTx transaction() { + CacheStoreSession ses = session(); + + return ses != null ? ses.transaction() : null; + } + } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be2e7fe2/modules/core/src/main/java/org/apache/ignite/compute/ComputeTask.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/compute/ComputeTask.java index 27f618c,2269629..5c6e7fb --- a/modules/core/src/main/java/org/apache/ignite/compute/ComputeTask.java +++ b/modules/core/src/main/java/org/apache/ignite/compute/ComputeTask.java @@@ -170,13 -175,13 +170,13 @@@ import java.util.* * } * * // Aggregate results into one compound result. -- * public String reduce(List<GridComputeJobResult> results) throws IgniteCheckedException { ++ * public String reduce(List<ComputeJobResult> results) throws IgniteCheckedException { * // For the purpose of this example we simply * // concatenate string representation of every * // job result * StringBuilder buf = new StringBuilder(); * -- * for (GridComputeJobResult res : results) { ++ * for (ComputeJobResult res : results) { * // Append string representation of result * // returned by every job. * buf.append(res.getData().string()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be2e7fe2/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskAdapter.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskAdapter.java index bc78be4,60e8538..eec8f6d --- a/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskAdapter.java @@@ -47,13 -47,13 +47,13 @@@ import java.util.* * } * * // Aggregate results into one compound result. -- * public String reduce(List<GridComputeJobResult> results) throws IgniteCheckedException { ++ * public String reduce(List<ComputeJobResult> results) throws IgniteCheckedException { * // For the purpose of this example we simply * // concatenate string representation of every * // job result * StringBuilder buf = new StringBuilder(); * -- * for (GridComputeJobResult res : results) { ++ * for (ComputeJobResult res : results) { * // Append string representation of result * // returned by every job. * buf.append(res.getData().string()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be2e7fe2/modules/core/src/main/java/org/apache/ignite/resources/IgniteCacheNameResource.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be2e7fe2/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java index 005ad53,e5573e6..45e74d1 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java @@@ -5152,8 -5119,8 +5152,8 @@@ public class TcpDiscoverySpi extends Tc assert msg.verified() : msg; if (log.isDebugEnabled()) - log.debug("Redirecting message to client [sock=" + sock + ", locNodeId=" + - ignite.configuration().getNodeId() + ", rmtNodeId=" + nodeId + ", msg=" + msg + ']'); - log.debug("Redirecting message to client [sock=" + sock + ", locNodeId=" + locNodeId + - ", rmtNodeId=" + nodeId + ", msg=" + msg + ']'); ++ log.debug("Redirecting message to client [sock=" + sock + ", locNodeId=" ++ + ignite.configuration().getNodeId() + ", rmtNodeId=" + nodeId + ", msg=" + msg + ']'); try { prepareNodeAddedMessage(msg, nodeId, null, null); @@@ -5166,8 -5133,8 +5166,8 @@@ } catch (IgniteCheckedException | IOException e) { if (log.isDebugEnabled()) - U.error(log, "Client connection failed [sock=" + sock + ", locNodeId=" + - ignite.configuration().getNodeId() + ", rmtNodeId=" + nodeId + ", msg=" + msg + ']', e); - U.error(log, "Client connection failed [sock=" + sock + ", locNodeId=" + locNodeId + - ", rmtNodeId=" + nodeId + ", msg=" + msg + ']', e); ++ U.error(log, "Client connection failed [sock=" + sock + ", locNodeId=" ++ + ignite.configuration().getNodeId() + ", rmtNodeId=" + nodeId + ", msg=" + msg + ']', e); U.interrupt(clientMsgWorkers.remove(nodeId)); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be2e7fe2/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java index f215328,ae3407d..99f1b07 --- a/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java @@@ -1417,9 -1430,7 +1417,9 @@@ public class FileSwapSpaceSpi extends I final Object mux = new Object(); + String gridName = ignite.name(); + - writer = new IgniteSpiThread(gridName, "Swap writer: " + name, log) { + writer = new IgniteSpiThread(gridName, "Swap writer: " + name, log) { @Override protected void body() throws InterruptedException { while (!isInterrupted()) { SwapValues vals = que.take(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be2e7fe2/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheInterceptor.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/gridgain/grid/cache/GridCacheInterceptor.java index c09602b,f4ea728..efbe40d --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheInterceptor.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheInterceptor.java @@@ -26,10 -27,10 +27,10 @@@ import org.jetbrains.annotations.* * operations. The {@code onBefore} callbacks can also be used to change the values * stored in cache or preventing entries from being removed from cache. * <p> - * Cache interceptor is configured via {@link GridCacheConfiguration#getInterceptor()} + * Cache interceptor is configured via {@link CacheConfiguration#getInterceptor()} * configuration property. * <p> - * Any grid resource from {@code org.gridgain.grid.resources} package can be injected + * Any grid resource from {@code org.apache.ignite.resources} package can be injected * into implementation of this interface. */ public interface GridCacheInterceptor<K, V> { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be2e7fe2/modules/core/src/main/java/org/gridgain/grid/kernal/GridGainEx.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be2e7fe2/modules/core/src/test/java/org/gridgain/grid/kernal/GridJobMasterLeaveAwareSelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be2e7fe2/modules/core/src/test/java/org/gridgain/grid/kernal/managers/checkpoint/GridCheckpointTaskSelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be2e7fe2/modules/core/src/test/java/org/gridgain/testframework/junits/GridTestResources.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be2e7fe2/modules/hibernate/src/main/java/org/gridgain/grid/cache/store/hibernate/GridCacheHibernateBlobStore.java ---------------------------------------------------------------------- diff --cc modules/hibernate/src/main/java/org/gridgain/grid/cache/store/hibernate/GridCacheHibernateBlobStore.java index 4b6c001,da4c0dc..d8de005 --- a/modules/hibernate/src/main/java/org/gridgain/grid/cache/store/hibernate/GridCacheHibernateBlobStore.java +++ b/modules/hibernate/src/main/java/org/gridgain/grid/cache/store/hibernate/GridCacheHibernateBlobStore.java @@@ -558,6 -580,15 +580,15 @@@ public class GridCacheHibernateBlobStor if (bytes == null || bytes.length == 0) return null; - return marsh.unmarshal(bytes, getClass().getClassLoader()); + return ignite.configuration().getMarshaller().unmarshal(bytes, getClass().getClassLoader()); } + + /** + * @return Current transaction. + */ + @Nullable private IgniteTx transaction() { + CacheStoreSession ses = session(); + + return ses != null ? ses.transaction() : null; + } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be2e7fe2/modules/indexing/src/main/java/org/gridgain/grid/kernal/processors/query/h2/GridH2Indexing.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be2e7fe2/modules/indexing/src/test/java/org/apache/ignite/spi/communication/tcp/GridOrderedMessageCancelSelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be2e7fe2/modules/spring/src/test/java/org/gridgain/grid/p2p/GridP2PUserVersionChangeSelfTest.java ----------------------------------------------------------------------