You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/06/10 18:27:53 UTC
[30/31] incubator-ignite git commit: ignite-471-2: huge merge from
sprint-6
ignite-471-2: huge merge from sprint-6
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3d78aa15
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3d78aa15
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3d78aa15
Branch: refs/heads/ignite-471-2
Commit: 3d78aa150d18121f5f5ccab0f9390c6522639b8f
Parents: a989aa0
Author: Denis Magda <dm...@gridgain.com>
Authored: Wed Jun 10 19:05:09 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Jun 10 19:05:09 2015 +0300
----------------------------------------------------------------------
DEVNOTES.txt | 42 +-
assembly/dependencies-visor-console.xml | 3 +
.../hibernate/CacheHibernatePersonStore.java | 202 +-
.../hibernate/CacheHibernateStoreExample.java | 17 +
.../store/jdbc/CacheJdbcPersonStore.java | 180 +-
.../store/jdbc/CacheJdbcStoreExample.java | 13 +
.../store/spring/CacheSpringPersonStore.java | 128 +
.../store/spring/CacheSpringStoreExample.java | 143 +
.../datagrid/store/spring/package-info.java | 22 +
.../client/memcache/MemcacheRestExample.java | 32 +-
.../client/router/TcpSslRouterSelfTest.java | 5 +
.../client/suite/IgniteClientTestSuite.java | 3 +-
.../java/org/apache/ignite/IgniteCache.java | 41 +-
.../main/java/org/apache/ignite/Ignition.java | 18 +-
.../org/apache/ignite/cache/CacheMetrics.java | 187 +-
.../ignite/cache/eviction/EvictableEntry.java | 7 +
.../ignite/cache/eviction/EvictionPolicy.java | 2 +
.../cache/eviction/fifo/FifoEvictionPolicy.java | 117 +-
.../eviction/fifo/FifoEvictionPolicyMBean.java | 22 +
.../cache/eviction/lru/LruEvictionPolicy.java | 135 +-
.../eviction/lru/LruEvictionPolicyMBean.java | 38 +
.../eviction/random/RandomEvictionPolicy.java | 10 +-
.../eviction/sorted/SortedEvictionPolicy.java | 141 +-
.../sorted/SortedEvictionPolicyMBean.java | 22 +
.../apache/ignite/cache/query/QueryMetrics.java | 6 +-
.../apache/ignite/cache/store/CacheStore.java | 2 +
.../ignite/cache/store/CacheStoreSession.java | 22 +
.../cache/store/CacheStoreSessionListener.java | 133 +
.../jdbc/CacheJdbcStoreSessionListener.java | 141 +
.../org/apache/ignite/cluster/ClusterNode.java | 24 +-
.../configuration/CacheConfiguration.java | 66 +-
.../configuration/IgniteConfiguration.java | 48 +-
.../org/apache/ignite/igfs/IgfsUserContext.java | 119 +
.../igfs/secondary/IgfsSecondaryFileSystem.java | 7 +
.../ignite/internal/ClusterMetricsSnapshot.java | 14 +
.../internal/GridEventConsumeHandler.java | 100 +-
.../ignite/internal/GridKernalContext.java | 5 +
.../ignite/internal/GridKernalContextImpl.java | 5 +
.../apache/ignite/internal/IgniteKernal.java | 56 +-
.../ignite/internal/IgniteNodeAttributes.java | 5 +-
.../org/apache/ignite/internal/IgnitionEx.java | 30 +-
.../internal/MarshallerContextAdapter.java | 36 +-
.../ignite/internal/MarshallerContextImpl.java | 2 +-
.../internal/events/DiscoveryCustomEvent.java | 18 +-
.../internal/igfs/common/IgfsMarshaller.java | 35 +-
.../igfs/common/IgfsPathControlRequest.java | 22 +
.../internal/interop/InteropIgnition.java | 2 +-
.../internal/managers/GridManagerAdapter.java | 68 +-
.../checkpoint/GridCheckpointManager.java | 52 +-
.../managers/communication/GridIoManager.java | 129 +-
.../managers/discovery/CustomEventListener.java | 31 +
.../discovery/CustomMessageWrapper.java | 63 +
.../discovery/DiscoveryCustomMessage.java | 54 +
.../discovery/GridDiscoveryManager.java | 278 +-
.../managers/indexing/GridIndexingManager.java | 4 -
.../affinity/GridAffinityAssignment.java | 12 +
.../affinity/GridAffinityAssignmentCache.java | 37 +-
.../affinity/GridAffinityProcessor.java | 23 +-
.../cache/CacheEvictableEntryImpl.java | 31 +
.../processors/cache/CacheMetricsImpl.java | 367 +-
.../cache/CacheMetricsMXBeanImpl.java | 100 +
.../processors/cache/CacheMetricsSnapshot.java | 380 +-
.../cache/DynamicCacheChangeBatch.java | 29 +-
.../cache/DynamicCacheDescriptor.java | 19 +
.../processors/cache/GridCacheAdapter.java | 50 +-
.../cache/GridCacheAffinityManager.java | 14 +
.../cache/GridCacheConcurrentMap.java | 21 +-
.../processors/cache/GridCacheContext.java | 22 +-
.../processors/cache/GridCacheEntryEx.java | 6 +
.../processors/cache/GridCacheGateway.java | 2 +-
.../processors/cache/GridCacheIoManager.java | 8 +-
.../processors/cache/GridCacheMapEntry.java | 69 +-
.../processors/cache/GridCacheMvccManager.java | 32 +-
.../GridCachePartitionExchangeManager.java | 97 +-
.../processors/cache/GridCachePreloader.java | 6 +-
.../cache/GridCachePreloaderAdapter.java | 11 +-
.../processors/cache/GridCacheProcessor.java | 121 +-
.../processors/cache/GridCacheProxyImpl.java | 26 +-
.../cache/GridCacheSharedContext.java | 48 +-
.../processors/cache/GridCacheSwapManager.java | 118 +-
.../processors/cache/GridCacheTtlManager.java | 9 +-
.../processors/cache/GridCacheUtils.java | 288 +-
.../processors/cache/IgniteCacheProxy.java | 23 +
.../processors/cache/IgniteInternalCache.java | 43 +-
.../processors/cache/KeyCacheObjectImpl.java | 11 +-
.../cache/affinity/GridCacheAffinityImpl.java | 10 +-
.../CacheDataStructuresManager.java | 2 +-
.../distributed/GridDistributedCacheEntry.java | 7 -
.../distributed/GridDistributedTxMapping.java | 17 +
.../dht/GridClientPartitionTopology.java | 10 +-
.../dht/GridDhtAssignmentFetchFuture.java | 4 +-
.../distributed/dht/GridDhtCacheAdapter.java | 27 +-
.../distributed/dht/GridDhtCacheEntry.java | 6 +-
.../cache/distributed/dht/GridDhtGetFuture.java | 11 +-
.../distributed/dht/GridDhtLockFuture.java | 10 +-
.../dht/GridDhtPartitionTopologyImpl.java | 38 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 224 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 8 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 3 +-
.../dht/atomic/GridDhtAtomicCache.java | 53 +-
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 10 +-
.../dht/atomic/GridNearAtomicUpdateFuture.java | 84 +-
.../dht/atomic/GridNearAtomicUpdateRequest.java | 112 +-
.../dht/colocated/GridDhtColocatedCache.java | 12 +-
.../colocated/GridDhtColocatedLockFuture.java | 213 +-
.../dht/preloader/GridDhtForceKeysFuture.java | 44 +-
.../preloader/GridDhtPartitionDemandPool.java | 26 +-
.../dht/preloader/GridDhtPartitionMap.java | 2 +-
.../preloader/GridDhtPartitionSupplyPool.java | 29 +-
.../GridDhtPartitionsExchangeFuture.java | 442 +-
.../preloader/GridDhtPartitionsFullMessage.java | 4 +-
.../GridDhtPartitionsSingleMessage.java | 33 +-
.../dht/preloader/GridDhtPreloader.java | 39 +-
.../preloader/GridDhtPreloaderAssignments.java | 3 +-
.../distributed/near/GridNearAtomicCache.java | 5 +
.../distributed/near/GridNearCacheAdapter.java | 2 +-
.../distributed/near/GridNearGetFuture.java | 2 +-
.../distributed/near/GridNearLockFuture.java | 271 +-
.../distributed/near/GridNearLockRequest.java | 68 +-
.../distributed/near/GridNearLockResponse.java | 48 +-
.../near/GridNearOptimisticTxPrepareFuture.java | 83 +-
.../GridNearPessimisticTxPrepareFuture.java | 5 +-
.../near/GridNearTransactionalCache.java | 4 +-
.../cache/distributed/near/GridNearTxLocal.java | 43 +-
.../near/GridNearTxPrepareRequest.java | 72 +-
.../near/GridNearTxPrepareResponse.java | 70 +-
.../processors/cache/local/GridLocalCache.java | 6 +-
.../local/atomic/GridLocalAtomicCache.java | 31 +-
.../cache/query/GridCacheQueryAdapter.java | 24 +-
.../cache/query/GridCacheQueryErrorFuture.java | 2 +
.../cache/query/GridCacheQueryManager.java | 2 +-
.../continuous/CacheContinuousQueryManager.java | 28 +-
.../cache/store/CacheOsStoreManager.java | 1 -
.../cache/store/CacheStoreManager.java | 7 +-
.../store/GridCacheStoreManagerAdapter.java | 202 +-
.../cache/transactions/IgniteInternalTx.java | 5 +
.../cache/transactions/IgniteTxAdapter.java | 48 +-
.../cache/transactions/IgniteTxHandler.java | 148 +-
.../transactions/IgniteTxLocalAdapter.java | 170 +-
.../cache/transactions/IgniteTxManager.java | 3 -
.../cacheobject/IgniteCacheObjectProcessor.java | 3 +-
.../IgniteCacheObjectProcessorImpl.java | 2 +-
.../continuous/AbstractContinuousMessage.java | 63 +
.../continuous/GridContinuousMessageType.java | 12 -
.../continuous/GridContinuousProcessor.java | 838 +--
.../processors/continuous/StartRequestData.java | 267 +
.../StartRoutineAckDiscoveryMessage.java | 63 +
.../StartRoutineDiscoveryMessage.java | 85 +
.../StopRoutineAckDiscoveryMessage.java | 49 +
.../continuous/StopRoutineDiscoveryMessage.java | 49 +
.../datastreamer/DataStreamerCacheUpdaters.java | 2 +-
.../datastreamer/DataStreamerImpl.java | 94 +-
.../datastructures/DataStructuresProcessor.java | 107 +-
.../internal/processors/hadoop/HadoopJob.java | 2 +-
.../processors/hadoop/HadoopTaskContext.java | 14 +-
.../ignite/internal/processors/igfs/IgfsEx.java | 8 +-
.../internal/processors/igfs/IgfsImpl.java | 8 +-
.../processors/igfs/IgfsIpcHandler.java | 184 +-
.../processors/igfs/IgfsMetaManager.java | 2 +-
.../igfs/IgfsSecondaryFileSystemImpl.java | 9 +-
.../internal/processors/igfs/IgfsServer.java | 4 +-
.../internal/processors/igfs/IgfsUtils.java | 16 +
.../processors/query/GridQueryProcessor.java | 305 +-
.../service/GridServiceProcessor.java | 125 +-
.../timeout/GridSpiTimeoutObject.java | 73 +
.../timeout/GridTimeoutProcessor.java | 105 +-
.../IgniteTxRollbackCheckedException.java | 9 +
.../ignite/internal/util/GridJavaProcess.java | 30 +-
.../internal/util/future/GridFutureAdapter.java | 4 +-
.../util/nio/GridCommunicationClient.java | 30 +-
.../util/nio/GridNioDelimitedBuffer.java | 2 +-
.../util/nio/GridNioRecoveryDescriptor.java | 13 +-
.../util/nio/GridTcpCommunicationClient.java | 554 --
.../util/nio/GridTcpNioCommunicationClient.java | 8 -
.../ignite/internal/visor/cache/VisorCache.java | 2 +-
.../VisorCacheConfigurationCollectorJob.java | 6 +-
.../internal/visor/cache/VisorCacheMetrics.java | 19 +-
.../cache/VisorCacheMetricsCollectorTask.java | 10 +-
.../cache/VisorCacheStoreConfiguration.java | 5 +-
.../visor/node/VisorNodeDataCollectorTask.java | 9 +-
.../node/VisorNodeDataCollectorTaskResult.java | 17 +-
.../node/VisorNodeSuppressedErrorsTask.java | 12 +-
.../internal/visor/query/VisorQueryJob.java | 13 +-
.../internal/visor/query/VisorQueryTask.java | 3 +-
.../visor/util/VisorExceptionWrapper.java | 81 +
.../internal/visor/util/VisorTaskUtils.java | 6 +-
.../ignite/mxbean/CacheMetricsMXBean.java | 80 +
.../apache/ignite/plugin/PluginProvider.java | 26 +-
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 70 +-
.../org/apache/ignite/spi/IgniteSpiContext.java | 57 +-
.../ignite/spi/IgniteSpiTimeoutObject.java | 44 +
.../spi/checkpoint/noop/NoopCheckpointSpi.java | 3 +-
.../communication/tcp/TcpCommunicationSpi.java | 438 +-
.../tcp/TcpCommunicationSpiMBean.java | 2 -
.../ignite/spi/discovery/DiscoverySpi.java | 20 +-
.../discovery/DiscoverySpiCustomMessage.java | 40 +
.../spi/discovery/DiscoverySpiListener.java | 5 +-
.../ignite/spi/discovery/tcp/ClientImpl.java | 1478 +++++
.../ignite/spi/discovery/tcp/ServerImpl.java | 4733 ++++++++++++++
.../discovery/tcp/TcpClientDiscoverySpi.java | 1264 ----
.../tcp/TcpClientDiscoverySpiMBean.java | 164 -
.../spi/discovery/tcp/TcpDiscoveryImpl.java | 212 +
.../spi/discovery/tcp/TcpDiscoverySpi.java | 5771 ++++--------------
.../discovery/tcp/TcpDiscoverySpiAdapter.java | 1160 ----
.../spi/discovery/tcp/TcpDiscoverySpiMBean.java | 9 +
.../tcp/internal/TcpDiscoveryNode.java | 7 +-
.../tcp/internal/TcpDiscoveryNodesRing.java | 2 +-
.../tcp/ipfinder/TcpDiscoveryIpFinder.java | 10 +-
.../TcpDiscoveryMulticastIpFinder.java | 57 +-
.../messages/TcpDiscoveryAbstractMessage.java | 24 +-
.../TcpDiscoveryClientHeartbeatMessage.java | 67 +
.../messages/TcpDiscoveryClientPingRequest.java | 56 +
.../TcpDiscoveryClientPingResponse.java | 67 +
.../TcpDiscoveryCustomEventMessage.java | 41 +-
.../messages/TcpDiscoveryHeartbeatMessage.java | 28 +-
.../TcpDiscoveryNodeAddFinishedMessage.java | 43 +
.../messages/TcpDiscoveryNodeAddedMessage.java | 2 +-
.../tcp/messages/TcpDiscoveryPingRequest.java | 6 +
.../tcp/messages/TcpDiscoveryPingResponse.java | 15 +-
.../RoundRobinGlobalLoadBalancer.java | 2 +-
.../spi/swapspace/file/FileSwapSpaceSpi.java | 8 +-
.../java/org/jsr166/ConcurrentHashMap8.java | 8 +-
.../java/org/jsr166/ConcurrentLinkedDeque8.java | 586 +-
.../src/main/java/org/jsr166/LongAdder8.java | 35 +-
.../core/src/main/java/org/jsr166/README.txt | 11 +
.../src/main/java/org/jsr166/Striped64_8.java | 22 +-
.../java/org/jsr166/ThreadLocalRandom8.java | 19 +-
.../src/main/java/org/jsr166/package-info.java | 12 +-
.../ignite/GridSuppressedExceptionSelfTest.java | 4 +-
.../affinity/IgniteClientNodeAffinityTest.java | 182 +
...cheStoreSessionListenerAbstractSelfTest.java | 315 +
...heStoreSessionListenerLifecycleSelfTest.java | 395 ++
.../CacheJdbcStoreSessionListenerSelfTest.java | 175 +
.../ignite/internal/GridAffinitySelfTest.java | 1 +
.../internal/GridDiscoveryEventSelfTest.java | 7 +-
...ridFailFastNodeFailureDetectionSelfTest.java | 7 +-
.../internal/GridProjectionAbstractTest.java | 16 +
.../GridProjectionForCachesSelfTest.java | 11 +-
.../internal/GridReleaseTypeSelfTest.java | 77 +-
.../apache/ignite/internal/GridSelfTest.java | 4 +-
.../GridDiscoveryManagerAliveCacheSelfTest.java | 62 +-
.../GridDiscoveryManagerAttributesSelfTest.java | 122 +-
.../discovery/GridDiscoveryManagerSelfTest.java | 46 +-
.../GridAffinityProcessorAbstractSelfTest.java | 1 +
...acheReadOnlyTransactionalClientSelfTest.java | 327 +
.../cache/CacheRemoveAllSelfTest.java | 2 +-
.../GridCacheAbstractFailoverSelfTest.java | 2 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 113 +
.../cache/GridCacheAbstractMetricsSelfTest.java | 48 +-
.../GridCacheAbstractRemoveFailureTest.java | 23 +
.../cache/GridCacheAbstractSelfTest.java | 2 +-
.../GridCacheAtomicMessageCountSelfTest.java | 1 +
.../GridCacheConcurrentTxMultiNodeTest.java | 8 +-
...idCacheConfigurationConsistencySelfTest.java | 14 +-
.../GridCacheExAbstractFullApiSelfTest.java | 103 -
.../cache/GridCacheMemoryModeSelfTest.java | 22 +-
...GridCacheMixedPartitionExchangeSelfTest.java | 2 +-
...inodeUpdateNearEnabledNoBackupsSelfTest.java | 2 +-
...CacheMultinodeUpdateNearEnabledSelfTest.java | 2 +-
.../processors/cache/GridCacheOffHeapTest.java | 33 +-
.../cache/GridCachePutAllFailoverSelfTest.java | 6 +
.../cache/GridCacheReloadSelfTest.java | 6 +-
.../GridCacheReturnValueTransferSelfTest.java | 3 +
.../processors/cache/GridCacheStopSelfTest.java | 5 +
...acheTcpClientDiscoveryMultiThreadedTest.java | 190 +
.../processors/cache/GridCacheTestEntryEx.java | 4 +
.../GridCacheVariableTopologySelfTest.java | 12 +-
.../cache/GridCacheVersionMultinodeTest.java | 2 +-
.../IgniteCacheAbstractStopBusySelfTest.java | 6 +-
.../cache/IgniteCacheAbstractTest.java | 2 +-
.../IgniteCacheConfigurationTemplateTest.java | 2 +-
.../IgniteCacheInterceptorSelfTestSuite.java | 2 +-
.../cache/IgniteCacheInvokeReadThroughTest.java | 5 +
.../cache/IgniteCacheNearLockValueSelfTest.java | 3 +
.../IgniteCacheP2pUnmarshallingErrorTest.java | 29 +-
...gniteCacheP2pUnmarshallingNearErrorTest.java | 13 +-
.../IgniteCachePartitionMapUpdateTest.java | 226 +
.../cache/IgniteCachePeekModesAbstractTest.java | 5 +-
...gniteCacheTransactionalStopBusySelfTest.java | 5 +
.../cache/IgniteDynamicCacheStartSelfTest.java | 62 +
...niteDynamicCacheWithConfigStartSelfTest.java | 97 +
.../IgniteDynamicClientCacheStartSelfTest.java | 283 +
.../cache/IgniteSystemCacheOnClientTest.java | 97 +
.../IgniteTxMultiThreadedAbstractTest.java | 4 +-
.../GridCacheQueueApiSelfAbstractTest.java | 4 +-
...dCacheQueueMultiNodeConsistencySelfTest.java | 5 +
.../IgniteClientDataStructuresAbstractTest.java | 283 +
.../IgniteClientDataStructuresTest.java | 28 +
...IgniteClientDiscoveryDataStructuresTest.java | 28 +
.../IgniteCountDownLatchAbstractSelfTest.java | 102 +
...omicOffheapQueueCreateMultiNodeSelfTest.java | 5 +
...ionedAtomicQueueCreateMultiNodeSelfTest.java | 5 +
...rtitionedDataStructuresFailoverSelfTest.java | 5 +
...edOffheapDataStructuresFailoverSelfTest.java | 5 +
...PartitionedQueueCreateMultiNodeSelfTest.java | 5 +
...dCachePartitionedQueueEntryMoveSelfTest.java | 5 +
...nedQueueFailoverDataConsistencySelfTest.java | 5 +
...eplicatedDataStructuresFailoverSelfTest.java | 5 +
...CacheLoadingConcurrentGridStartSelfTest.java | 5 +
.../GridCacheClientModesAbstractSelfTest.java | 94 +-
...ientModesTcpClientDiscoveryAbstractTest.java | 168 +
.../distributed/GridCacheMixedModeSelfTest.java | 3 +
...niteCacheClientNodeChangingTopologyTest.java | 1803 ++++++
.../IgniteCacheClientNodeConcurrentStart.java | 105 +
...teCacheClientNodePartitionsExchangeTest.java | 632 ++
.../IgniteCrossCacheTxStoreSelfTest.java | 147 +-
.../dht/GridCacheClientOnlySelfTest.java | 60 +-
.../dht/GridCacheColocatedFailoverSelfTest.java | 5 +
.../GridCacheColocatedTxExceptionSelfTest.java | 5 +
.../GridCacheDhtClientRemoveFailureTest.java | 28 +
...GridCacheDhtEvictionNearReadersSelfTest.java | 11 +-
.../dht/GridCacheDhtEvictionSelfTest.java | 11 +-
.../GridCacheExColocatedFullApiSelfTest.java | 33 -
...ePartitionedNearDisabledMetricsSelfTest.java | 4 +-
...dCachePartitionedTopologyChangeSelfTest.java | 5 +
.../dht/IgniteCacheMultiTxLockSelfTest.java | 53 +-
...cClientInvalidPartitionHandlingSelfTest.java | 29 +
.../GridCacheAtomicClientRemoveFailureTest.java | 28 +
...eAtomicInvalidPartitionHandlingSelfTest.java | 23 +-
...unctionExcludeNeighborsAbstractSelfTest.java | 3 +-
.../near/GridCacheAtomicNearOnlySelfTest.java | 32 -
.../near/GridCacheExNearFullApiSelfTest.java | 39 -
...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 2 +
.../near/GridCacheNearOnlySelfTest.java | 63 +-
.../near/GridCacheNearOnlyTopologySelfTest.java | 1 +
.../near/GridCacheNearTxExceptionSelfTest.java | 5 +
...ionedClientOnlyNoPrimaryFullApiSelfTest.java | 5 +-
.../GridCachePartitionedEvictionSelfTest.java | 11 +-
.../GridCachePartitionedFailoverSelfTest.java | 5 +
...PartitionedFullApiMultithreadedSelfTest.java | 5 +
.../GridCachePartitionedFullApiSelfTest.java | 32 +
...ePartitionedMultiThreadedPutGetSelfTest.java | 6 +-
.../GridCachePartitionedNodeRestartTest.java | 5 +
...edOffHeapTieredMultiNodeFullApiSelfTest.java | 2 +-
...ePartitionedOptimisticTxNodeRestartTest.java | 5 +
...CachePartitionedTxMultiThreadedSelfTest.java | 5 +
...idCacheRendezvousAffinityClientSelfTest.java | 4 +
.../GridCacheExReplicatedFullApiSelfTest.java | 33 -
.../GridCacheReplicatedClientOnlySelfTest.java | 43 -
.../GridCacheReplicatedFailoverSelfTest.java | 5 +
...eReplicatedFullApiMultithreadedSelfTest.java | 5 +
.../GridCacheReplicatedInvalidateSelfTest.java | 4 +-
...ridCacheReplicatedMultiNodeLockSelfTest.java | 5 +
.../GridCacheReplicatedMultiNodeSelfTest.java | 5 +
.../GridCacheReplicatedNearOnlySelfTest.java | 43 -
.../GridCacheReplicatedNodeRestartSelfTest.java | 5 +
.../GridCacheReplicatedTxExceptionSelfTest.java | 5 +
.../GridCacheSyncReplicatedPreloadSelfTest.java | 1 -
.../replicated/GridReplicatedTxPreloadTest.java | 2 +
...acheAtomicReplicatedNodeRestartSelfTest.java | 5 +
.../cache/eviction/EvictionAbstractTest.java | 1056 ++++
.../GridCacheBatchEvictUnswapSelfTest.java | 5 +-
...heConcurrentEvictionConsistencySelfTest.java | 82 +-
.../GridCacheConcurrentEvictionsSelfTest.java | 29 +-
.../GridCacheDistributedEvictionsSelfTest.java | 5 +-
.../GridCacheEmptyEntriesAbstractSelfTest.java | 11 +-
.../eviction/GridCacheEvictionAbstractTest.java | 484 --
.../GridCacheEvictionFilterSelfTest.java | 4 +-
.../GridCacheEvictionTouchSelfTest.java | 22 +-
.../cache/eviction/GridCacheMockEntry.java | 5 +
...cheSynchronousEvictionsFailoverSelfTest.java | 5 +
.../fifo/FifoEvictionPolicySelfTest.java | 262 +
...ridCacheFifoBatchEvictionPolicySelfTest.java | 384 --
.../GridCacheFifoEvictionPolicySelfTest.java | 372 --
.../lru/GridCacheLruEvictionPolicySelfTest.java | 417 --
.../GridCacheLruNearEvictionPolicySelfTest.java | 136 -
...heNearOnlyLruNearEvictionPolicySelfTest.java | 171 -
.../eviction/lru/LruEvictionPolicySelfTest.java | 353 ++
.../lru/LruNearEvictionPolicySelfTest.java | 140 +
.../LruNearOnlyNearEvictionPolicySelfTest.java | 172 +
.../GridCacheRandomEvictionPolicySelfTest.java | 258 -
.../RandomEvictionPolicyCacheSizeSelfTest.java | 6 +
.../random/RandomEvictionPolicySelfTest.java | 357 ++
...dCacheSortedBatchEvictionPolicySelfTest.java | 385 --
...acheSortedEvictionPolicyPerformanceTest.java | 135 -
.../GridCacheSortedEvictionPolicySelfTest.java | 373 --
.../SortedEvictionPolicyPerformanceTest.java | 134 +
.../sorted/SortedEvictionPolicySelfTest.java | 266 +
.../IgniteCacheClientNearCacheExpiryTest.java | 103 +
.../IgniteCacheExpiryPolicyAbstractTest.java | 10 +-
.../IgniteCacheExpiryPolicyTestSuite.java | 2 +
...eCacheExpiryPolicyWithStoreAbstractTest.java | 4 +-
...CacheLocalOffHeapAndSwapMetricsSelfTest.java | 412 ++
.../local/GridCacheExLocalFullApiSelfTest.java | 30 -
...dCacheLocalFullApiMultithreadedSelfTest.java | 5 +
.../GridCacheLocalTxExceptionSelfTest.java | 5 +
...ridCacheContinuousQueryAbstractSelfTest.java | 6 +-
.../continuous/GridEventConsumeSelfTest.java | 96 +-
.../DataStreamProcessorSelfTest.java | 1 +
.../DataStreamerMultiThreadedSelfTest.java | 59 +-
.../DataStreamerMultinodeCreateCacheTest.java | 97 +
.../igfs/IgfsClientCacheSelfTest.java | 12 +-
.../processors/igfs/IgfsCommonAbstractTest.java | 10 -
.../processors/igfs/IgfsModesSelfTest.java | 4 +-
.../processors/igfs/IgfsOneClientNodeTest.java | 8 +-
.../service/ClosureServiceClientsNodesTest.java | 16 +-
.../service/GridServiceClientNodeTest.java | 81 +
.../nio/GridNioDelimitedBufferSelfTest.java | 112 +
.../util/nio/GridNioDelimitedBufferTest.java | 112 -
.../internal/util/nio/GridNioSelfTest.java | 2 +-
.../unsafe/GridUnsafeMemorySelfTest.java | 4 +-
.../loadtests/GridCacheMultiNodeLoadTest.java | 5 +-
.../GridCachePartitionedAtomicLongLoadTest.java | 6 +-
.../loadtests/hashmap/GridCacheTestContext.java | 4 +-
.../swap/GridSwapEvictAllBenchmark.java | 6 +-
.../OptimizedMarshallerNodeFailoverTest.java | 4 +-
...GridMessagingNoPeerClassLoadingSelfTest.java | 75 +-
.../ignite/messaging/GridMessagingSelfTest.java | 4 +-
.../IgniteMessagingWithClientTest.java | 166 +
.../GridTcpCommunicationSpiAbstractTest.java | 4 +-
...mmunicationSpiConcurrentConnectSelfTest.java | 2 +-
.../GridTcpCommunicationSpiConfigSelfTest.java | 2 -
...cpCommunicationSpiMultithreadedSelfTest.java | 2 +-
.../discovery/AbstractDiscoverySelfTest.java | 21 +-
...pClientDiscoveryMarshallerCheckSelfTest.java | 76 +
.../tcp/TcpClientDiscoverySelfTest.java | 700 ---
.../tcp/TcpClientDiscoverySpiMulticastTest.java | 129 +
.../tcp/TcpClientDiscoverySpiSelfTest.java | 1196 ++++
.../tcp/TcpDiscoveryConcurrentStartTest.java | 61 +-
.../tcp/TcpDiscoveryMultiThreadedTest.java | 18 +-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 2 +-
.../stream/socket/SocketStreamerSelfTest.java | 29 +-
.../testframework/GridSpiTestContext.java | 35 +-
.../ignite/testframework/GridTestUtils.java | 17 +-
.../testframework/junits/GridAbstractTest.java | 52 +-
.../junits/cache/TestCacheSession.java | 18 +
.../cache/TestThreadLocalCacheSession.java | 15 +
.../junits/common/GridCommonAbstractTest.java | 83 +-
.../ignite/testsuites/IgniteBasicTestSuite.java | 10 +-
.../IgniteCacheDataStructuresSelfTestSuite.java | 27 +-
.../IgniteCacheEvictionSelfTestSuite.java | 17 +-
.../IgniteCacheFailoverTestSuite.java | 11 +-
.../IgniteCacheFullApiSelfTestSuite.java | 14 +-
.../IgniteCacheMetricsSelfTestSuite.java | 1 +
.../IgniteCacheNearOnlySelfTestSuite.java | 16 +-
...gniteCacheP2pUnmarshallingErrorTestSuit.java | 53 -
...niteCacheP2pUnmarshallingErrorTestSuite.java | 53 +
.../testsuites/IgniteCacheRestartTestSuite.java | 10 +-
.../IgniteCacheTcpClientDiscoveryTestSuite.java | 47 +
.../ignite/testsuites/IgniteCacheTestSuite.java | 21 +-
.../testsuites/IgniteCacheTestSuite2.java | 15 +-
.../testsuites/IgniteCacheTestSuite3.java | 14 +-
.../testsuites/IgniteCacheTestSuite4.java | 18 +-
.../testsuites/IgniteKernalSelfTestSuite.java | 7 +-
.../IgniteSpiDiscoverySelfTestSuite.java | 4 +-
.../testsuites/IgniteStreamSelfTestSuite.java | 39 +
.../testsuites/IgniteStreamTestSuite.java | 39 -
.../testsuites/IgniteUtilSelfTestSuite.java | 2 +-
.../apache/ignite/util/GridRandomSelfTest.java | 4 +-
.../gce/TcpDiscoveryGoogleStorageIpFinder.java | 43 +-
.../fs/IgniteHadoopFileSystemCounterWriter.java | 14 +-
.../fs/IgniteHadoopIgfsSecondaryFileSystem.java | 165 +-
.../hadoop/fs/v1/IgniteHadoopFileSystem.java | 137 +-
.../hadoop/fs/v2/IgniteHadoopFileSystem.java | 32 +-
.../processors/hadoop/HadoopDefaultJobInfo.java | 2 +-
.../internal/processors/hadoop/HadoopUtils.java | 288 +-
.../hadoop/SecondaryFileSystemProvider.java | 57 +-
.../hadoop/fs/HadoopDistributedFileSystem.java | 91 -
.../hadoop/fs/HadoopFileSystemsUtils.java | 17 -
.../hadoop/fs/HadoopLazyConcurrentMap.java | 204 +
.../processors/hadoop/igfs/HadoopIgfsEx.java | 6 +
.../hadoop/igfs/HadoopIgfsInProc.java | 170 +-
.../processors/hadoop/igfs/HadoopIgfsIpcIo.java | 2 +-
.../hadoop/igfs/HadoopIgfsOutProc.java | 33 +-
.../hadoop/igfs/HadoopIgfsWrapper.java | 19 +-
.../hadoop/taskexecutor/HadoopRunnableTask.java | 20 +-
.../processors/hadoop/v2/HadoopV2Job.java | 31 +-
.../hadoop/v2/HadoopV2JobResourceManager.java | 26 +-
.../hadoop/v2/HadoopV2TaskContext.java | 52 +-
.../hadoop/HadoopClientProtocolSelfTest.java | 6 +-
.../HadoopIgfs20FileSystemAbstractSelfTest.java | 60 +-
...oopSecondaryFileSystemConfigurationTest.java | 4 +-
.../igfs/IgfsNearOnlyMultiNodeSelfTest.java | 5 +-
.../IgniteHadoopFileSystemAbstractSelfTest.java | 65 +-
.../IgniteHadoopFileSystemClientSelfTest.java | 2 +-
.../IgniteHadoopFileSystemIpcCacheSelfTest.java | 2 +
.../hadoop/HadoopAbstractSelfTest.java | 14 +-
.../hadoop/HadoopCommandLineTest.java | 14 +-
.../hadoop/HadoopFileSystemsTest.java | 23 +-
.../processors/hadoop/HadoopMapReduceTest.java | 183 +-
.../hadoop/HadoopTaskExecutionSelfTest.java | 2 +-
.../hadoop/HadoopTasksAllVersionsTest.java | 15 +-
.../processors/hadoop/HadoopTasksV1Test.java | 5 +-
.../processors/hadoop/HadoopTasksV2Test.java | 5 +-
.../processors/hadoop/HadoopV2JobSelfTest.java | 6 +-
.../collections/HadoopAbstractMapTest.java | 12 +
.../collections/HadoopHashMapSelfTest.java | 4 +-
.../collections/HadoopSkipListSelfTest.java | 4 +-
.../HadoopExternalTaskExecutionSelfTest.java | 2 +
.../HadoopExternalCommunicationSelfTest.java | 5 +
.../testsuites/IgniteHadoopTestSuite.java | 7 +-
.../CacheHibernateStoreSessionListener.java | 216 +
.../hibernate/HibernateL2CacheSelfTest.java | 5 +
.../HibernateL2CacheTransactionalSelfTest.java | 5 +
...heHibernateStoreSessionListenerSelfTest.java | 228 +
.../testsuites/IgniteHibernateTestSuite.java | 6 +-
.../cache/GridCacheCrossCacheQuerySelfTest.java | 8 +-
.../GridCacheOffheapIndexEntryEvictTest.java | 200 +
.../cache/GridCacheOffheapIndexGetSelfTest.java | 80 +-
.../cache/GridCacheQueryMetricsSelfTest.java | 84 +-
.../cache/GridIndexingWithNoopSwapSelfTest.java | 6 +-
.../cache/IgniteCacheAbstractQuerySelfTest.java | 6 +-
...acheConfigurationPrimitiveTypesSelfTest.java | 104 +
...niteCacheP2pUnmarshallingQueryErrorTest.java | 3 +-
...QueryMultiThreadedOffHeapTieredSelfTest.java | 37 +
...eQueryMultiThreadedOffHeapTiredSelfTest.java | 37 -
.../IgniteCacheQueryMultiThreadedSelfTest.java | 11 +-
.../IgniteCacheQueryNodeRestartSelfTest.java | 5 +
.../cache/ttl/CacheTtlAbstractSelfTest.java | 6 +-
.../h2/GridIndexingSpiAbstractSelfTest.java | 4 +-
.../query/h2/sql/BaseH2CompareQueryTest.java | 4 +-
.../IgniteCacheQuerySelfTestSuite.java | 6 +-
.../IgniteCacheWithIndexingTestSuite.java | 3 +
modules/spring/pom.xml | 14 +
.../spring/CacheSpringStoreSessionListener.java | 207 +
...CacheSpringStoreSessionListenerSelfTest.java | 197 +
.../testsuites/IgniteSpringTestSuite.java | 3 +
.../commands/cache/VisorCacheScanCommand.scala | 2 +-
.../IgniteWebSessionSelfTestSuite.java | 2 +-
scripts/git-apply-patch.sh | 8 +-
scripts/git-format-patch.sh | 16 +-
scripts/git-patch-functions.sh | 36 +-
522 files changed, 31560 insertions(+), 17537 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/DEVNOTES.txt b/DEVNOTES.txt
index 8f1730c..cd72418 100644
--- a/DEVNOTES.txt
+++ b/DEVNOTES.txt
@@ -24,12 +24,14 @@ NOTE: JDK version should be 1.7.0-* or >= 1.8.0-u40.
Ignite Release Instructions
===========================
-Use people.apache.org/keys/committer/<username>.asc key to generate KEYS file.
-Execute these commands at source root:
+Use your people.apache.org/keys/committer/<username>.asc key to generate KEYS file.
+Download https://dist.apache.org/repos/dist/release/incubator/ignite/KEYS and append you key using commands:
gpg --list-sigs <keyname> >> KEYS
gpg --armor --export <keyname> >> KEYS
+Upload modified KEYS file.
+
Specify gpg profile at settings.xml. It will be used to sign sources and artifacts.
<profile>
@@ -43,24 +45,38 @@ Specify gpg profile at settings.xml. It will be used to sign sources and artifac
Ensure you have RELEASE (not SNAPSHOT) version at Ignite poms.
Maven release plugin release:prepare goal can be used to make release tag.
-Deploy Ignite release candidate to maven repository and dev-svn:
+Deploy Ignite release candidate to maven repository and dev-svn, make tag:
+
+ Following command deploys Ignite to maven repository, prepares sources and fabric edition binaries.
+ mvn deploy -P apache-release,gpg,release,scala,lgpl,deploy-ignite-site -Dignite.edition=fabric -DskipTests -B
+
+ In case you want to release both fabric and hadoop editions you have to build hadoop edition first using command
+ mvn package -P apache-release,gpg,release,scala,lgpl -Dignite.edition=hadoop -DskipTests -B
+ save /target/bin/*.zip, make "mvn clean" and restore saved files before deploying fabric.
- mvn deploy -P apache-release,gpg,release,scala,lgpl,deploy-ignite-site -Dignite.edition=fabric -DskipTests -B
+ Binary artifact name can be changed by setting additional property -Dignite.zip.pattern. Binary artifact will be
+ created inside /target/bin folder when release profile is used.
- Binary artifact name can be changed by setting additional property -Dignite.zip.pattern.
- Sources package name is fixed. Sources package zip will be created automatically when apache-release profile used.
+ Sources artifact name is fixed. Sources artifact will be created inside /target dir when apache-release profile is used.
- In case you want to release both fabric and hadoop editions you have to build hadoop first, save /target/bin/*.zip,
- make "mvn clean" and restore them before deploy step.
+ Nexus staging (repository.apache.org) should be closed with appropriate comment contains release version and
+ release candidate number, for example "Apache Ignite 1.0.0-rc7", when mvn deploy finished.
- Nexus staging (repository.apache.org) should be closed when mvn deploy finished.
- Checkout https://dist.apache.org/repos/dist/dev/incubator/ignite svn. Create new folder with name equals to released
- version at svn root. Copy target/site folder content to svn/ignite/<version> folder and commit.
+ Checkout https://dist.apache.org/repos/dist/dev/incubator/ignite svn. Create release candidate folder with name
+ equals to release version with "-rc*" ending, for example "1.0.0-rc7", at svn root.
+ Copy /target/site folder content to svn/ignite/<rc-version> folder and commit with appropriate comment.
-Start vote based on https://dist.apache.org/repos/dist/dev/incubator/ignite/<version>.
+ Make appropriate git tag for release candidate, for example "ignite-1.0.0-incubating-rc7".
-Release nexus staging and copy binaries and sources from https://dist.apache.org/repos/dist/dev/incubator/ignite/<version>
+Start vote based on https://dist.apache.org/repos/dist/dev/incubator/ignite/<rc-version>.
+
+Release nexus staging, move binaries and sources from https://dist.apache.org/repos/dist/dev/incubator/ignite/<rc-version>
to https://dist.apache.org/repos/dist/release/incubator/ignite/<version> when version accepted.
+Use svn mv ^/dev/incubator/ignite/<rc-version> ^/release/incubator/ignite/<version> command for proper moving.
+
+Make appropriate git tag for released version, for example "ignite-1.0.0-incubating".
+
+Send an email to dev@ignite.incubator.apache.org contains release svn url.
JCache TCK compliance
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/assembly/dependencies-visor-console.xml
----------------------------------------------------------------------
diff --git a/assembly/dependencies-visor-console.xml b/assembly/dependencies-visor-console.xml
index 28151da..d773769 100644
--- a/assembly/dependencies-visor-console.xml
+++ b/assembly/dependencies-visor-console.xml
@@ -90,6 +90,9 @@
<fileSet>
<directory>target/libs</directory>
<outputDirectory>/visor-common</outputDirectory>
+ <excludes>
+ <exclude>spring-jdbc-*.jar</exclude>
+ </excludes>
</fileSet>
<fileSet>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
index 577301c..80a9f22 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java
@@ -21,10 +21,7 @@ import org.apache.ignite.cache.store.*;
import org.apache.ignite.examples.datagrid.store.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.resources.*;
-import org.apache.ignite.transactions.Transaction;
import org.hibernate.*;
-import org.hibernate.cfg.*;
-import org.jetbrains.annotations.*;
import javax.cache.integration.*;
import java.util.*;
@@ -34,99 +31,55 @@ import java.util.*;
* and deals with maps {@link UUID} to {@link Person}.
*/
public class CacheHibernatePersonStore extends CacheStoreAdapter<Long, Person> {
- /** Default hibernate configuration resource path. */
- private static final String DFLT_HIBERNATE_CFG = "/org/apache/ignite/examples/datagrid/store/hibernate" +
- "/hibernate.cfg.xml";
-
- /** Session attribute name. */
- private static final String ATTR_SES = "HIBERNATE_STORE_SESSION";
-
- /** Session factory. */
- private SessionFactory sesFactory;
-
/** Auto-injected store session. */
@CacheStoreSessionResource
private CacheStoreSession ses;
- /**
- * Default constructor.
- */
- public CacheHibernatePersonStore() {
- sesFactory = new Configuration().configure(DFLT_HIBERNATE_CFG).buildSessionFactory();
- }
-
/** {@inheritDoc} */
@Override public Person load(Long key) {
- Transaction tx = transaction();
-
- System.out.println(">>> Store load [key=" + key + ", xid=" + (tx == null ? null : tx.xid()) + ']');
+ System.out.println(">>> Store load [key=" + key + ']');
- Session ses = session(tx);
+ Session hibSes = ses.attachment();
try {
- return (Person) ses.get(Person.class, key);
+ return (Person)hibSes.get(Person.class, key);
}
catch (HibernateException e) {
- rollback(ses, tx);
-
- throw new CacheLoaderException("Failed to load value from cache store with key: " + key, e);
- }
- finally {
- end(ses, tx);
+ throw new CacheLoaderException("Failed to load value from cache store [key=" + key + ']', e);
}
}
/** {@inheritDoc} */
@Override public void write(javax.cache.Cache.Entry<? extends Long, ? extends Person> entry) {
- Transaction tx = transaction();
-
Long key = entry.getKey();
-
Person val = entry.getValue();
- System.out.println(">>> Store put [key=" + key + ", val=" + val + ", xid=" + (tx == null ? null : tx.xid()) + ']');
+ System.out.println(">>> Store write [key=" + key + ", val=" + val + ']');
- if (val == null) {
- delete(key);
-
- return;
- }
-
- Session ses = session(tx);
+ Session hibSes = ses.attachment();
try {
- ses.saveOrUpdate(val);
+ hibSes.saveOrUpdate(val);
}
catch (HibernateException e) {
- rollback(ses, tx);
-
throw new CacheWriterException("Failed to put value to cache store [key=" + key + ", val" + val + "]", e);
}
- finally {
- end(ses, tx);
- }
}
/** {@inheritDoc} */
@SuppressWarnings({"JpaQueryApiInspection"})
@Override public void delete(Object key) {
- Transaction tx = transaction();
+ System.out.println(">>> Store delete [key=" + key + ']');
- System.out.println(">>> Store remove [key=" + key + ", xid=" + (tx == null ? null : tx.xid()) + ']');
-
- Session ses = session(tx);
+ Session hibSes = ses.attachment();
try {
- ses.createQuery("delete " + Person.class.getSimpleName() + " where key = :key")
- .setParameter("key", key).setFlushMode(FlushMode.ALWAYS).executeUpdate();
+ hibSes.createQuery("delete " + Person.class.getSimpleName() + " where key = :key").
+ setParameter("key", key).
+ executeUpdate();
}
catch (HibernateException e) {
- rollback(ses, tx);
-
- throw new CacheWriterException("Failed to remove value from cache store with key: " + key, e);
- }
- finally {
- end(ses, tx);
+ throw new CacheWriterException("Failed to remove value from cache store [key=" + key + ']', e);
}
}
@@ -137,18 +90,18 @@ public class CacheHibernatePersonStore extends CacheStoreAdapter<Long, Person> {
final int entryCnt = (Integer)args[0];
- Session ses = session(null);
+ Session hibSes = ses.attachment();
try {
int cnt = 0;
- List res = ses.createCriteria(Person.class).list();
-
- if (res != null) {
- Iterator iter = res.iterator();
+ List list = hibSes.createCriteria(Person.class).
+ setMaxResults(entryCnt).
+ list();
- while (cnt < entryCnt && iter.hasNext()) {
- Person person = (Person)iter.next();
+ if (list != null) {
+ for (Object obj : list) {
+ Person person = (Person)obj;
clo.apply(person.getId(), person);
@@ -161,120 +114,5 @@ public class CacheHibernatePersonStore extends CacheStoreAdapter<Long, Person> {
catch (HibernateException e) {
throw new CacheLoaderException("Failed to load values from cache store.", e);
}
- finally {
- end(ses, null);
- }
- }
-
- /**
- * Rolls back hibernate session.
- *
- * @param ses Hibernate session.
- * @param tx Cache ongoing transaction.
- */
- private void rollback(Session ses, Transaction tx) {
- // Rollback only if there is no cache transaction,
- // otherwise sessionEnd() will do all required work.
- if (tx == null) {
- org.hibernate.Transaction hTx = ses.getTransaction();
-
- if (hTx != null && hTx.isActive())
- hTx.rollback();
- }
- }
-
- /**
- * Ends hibernate session.
- *
- * @param ses Hibernate session.
- * @param tx Cache ongoing transaction.
- */
- private void end(Session ses, @Nullable Transaction tx) {
- // Commit only if there is no cache transaction,
- // otherwise sessionEnd() will do all required work.
- if (tx == null) {
- org.hibernate.Transaction hTx = ses.getTransaction();
-
- if (hTx != null && hTx.isActive())
- hTx.commit();
-
- ses.close();
- }
- }
-
- /** {@inheritDoc} */
- @Override public void sessionEnd(boolean commit) {
- Transaction tx = ses.transaction();
-
- Map<String, Session> props = ses.properties();
-
- Session ses = props.remove(ATTR_SES);
-
- if (ses != null) {
- org.hibernate.Transaction hTx = ses.getTransaction();
-
- if (hTx != null) {
- try {
- if (commit) {
- ses.flush();
-
- hTx.commit();
- }
- else
- hTx.rollback();
-
- System.out.println("Transaction ended [xid=" + tx.xid() + ", commit=" + commit + ']');
- }
- catch (HibernateException e) {
- throw new CacheWriterException("Failed to end transaction [xid=" + tx.xid() +
- ", commit=" + commit + ']', e);
- }
- finally {
- ses.close();
- }
- }
- }
- }
-
- /**
- * Gets Hibernate session.
- *
- * @param tx Cache transaction.
- * @return Session.
- */
- private Session session(@Nullable Transaction tx) {
- Session hbSes;
-
- if (tx != null) {
- Map<String, Session> props = ses.properties();
-
- hbSes = props.get(ATTR_SES);
-
- if (hbSes == null) {
- hbSes = sesFactory.openSession();
-
- hbSes.beginTransaction();
-
- // Store session in session properties, so it can be accessed
- // for other operations on the same transaction.
- props.put(ATTR_SES, hbSes);
-
- System.out.println("Hibernate session open [ses=" + hbSes + ", tx=" + tx.xid() + "]");
- }
- }
- else {
- hbSes = sesFactory.openSession();
-
- hbSes.beginTransaction();
- }
-
- return hbSes;
- }
-
- /**
- * @return Current transaction.
- */
- @Nullable private Transaction transaction() {
- return ses != null ? ses.transaction() : null;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
index 5a0cd0a..25760f0 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/hibernate/CacheHibernateStoreExample.java
@@ -18,6 +18,8 @@
package org.apache.ignite.examples.datagrid.store.hibernate;
import org.apache.ignite.*;
+import org.apache.ignite.cache.store.*;
+import org.apache.ignite.cache.store.hibernate.*;
import org.apache.ignite.configuration.*;
import org.apache.ignite.examples.*;
import org.apache.ignite.examples.datagrid.store.*;
@@ -37,6 +39,10 @@ import static org.apache.ignite.cache.CacheAtomicityMode.*;
* start node with {@code examples/config/example-ignite.xml} configuration.
*/
public class CacheHibernateStoreExample {
+ /** Hibernate configuration resource path. */
+ private static final String HIBERNATE_CFG =
+ "/org/apache/ignite/examples/datagrid/store/hibernate/hibernate.cfg.xml";
+
/** Cache name. */
private static final String CACHE_NAME = CacheHibernateStoreExample.class.getSimpleName();
@@ -71,6 +77,17 @@ public class CacheHibernateStoreExample {
// Configure Hibernate store.
cacheCfg.setCacheStoreFactory(FactoryBuilder.factoryOf(CacheHibernatePersonStore.class));
+ // Configure Hibernate session listener.
+ cacheCfg.setCacheStoreSessionListenerFactories(new Factory<CacheStoreSessionListener>() {
+ @Override public CacheStoreSessionListener create() {
+ CacheHibernateStoreSessionListener lsnr = new CacheHibernateStoreSessionListener();
+
+ lsnr.setHibernateConfigurationPath(HIBERNATE_CFG);
+
+ return lsnr;
+ }
+ });
+
cacheCfg.setReadThrough(true);
cacheCfg.setWriteThrough(true);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
index 791f861..ed14a99 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
@@ -22,23 +22,23 @@ import org.apache.ignite.cache.store.*;
import org.apache.ignite.examples.datagrid.store.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.resources.*;
-import org.jetbrains.annotations.*;
+import org.h2.jdbcx.*;
import javax.cache.*;
import javax.cache.integration.*;
+import javax.sql.*;
import java.sql.*;
-import java.util.*;
/**
* Example of {@link CacheStore} implementation that uses JDBC
* transaction with cache transactions and maps {@link Long} to {@link Person}.
- *
*/
public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> {
- /** Transaction metadata attribute name. */
- private static final String ATTR_NAME = "SIMPLE_STORE_CONNECTION";
+ /** Data source. */
+ public static final DataSource DATA_SRC =
+ JdbcConnectionPool.create("jdbc:h2:mem:example;DB_CLOSE_DELAY=-1", "", "");
- /** Auto-injected store session. */
+ /** Store session. */
@CacheStoreSessionResource
private CacheStoreSession ses;
@@ -58,11 +58,10 @@ public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> {
* @throws IgniteException If failed.
*/
private void prepareDb() throws IgniteException {
- try (Connection conn = openConnection(false); Statement st = conn.createStatement()) {
- st.execute("create table if not exists PERSONS (id number unique, firstName varchar(255), " +
- "lastName varchar(255))");
-
- conn.commit();
+ try (Connection conn = DATA_SRC.getConnection()) {
+ conn.createStatement().execute(
+ "create table if not exists PERSONS (" +
+ "id number unique, firstName varchar(255), lastName varchar(255))");
}
catch (SQLException e) {
throw new IgniteException("Failed to create database table.", e);
@@ -70,71 +69,39 @@ public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> {
}
/** {@inheritDoc} */
- @Override public void sessionEnd(boolean commit) {
- Map<String, Connection> props = ses.properties();
-
- try (Connection conn = props.remove(ATTR_NAME)) {
- if (conn != null) {
- if (commit)
- conn.commit();
- else
- conn.rollback();
- }
-
- System.out.println(">>> Transaction ended [commit=" + commit + ']');
- }
- catch (SQLException e) {
- throw new CacheWriterException("Failed to end transaction: " + ses.transaction(), e);
- }
- }
-
- /** {@inheritDoc} */
@Override public Person load(Long key) {
- System.out.println(">>> Loading key: " + key);
+ System.out.println(">>> Store load [key=" + key + ']');
- Connection conn = null;
+ Connection conn = ses.attachment();
- try {
- conn = connection();
-
- try (PreparedStatement st = conn.prepareStatement("select * from PERSONS where id=?")) {
- st.setString(1, key.toString());
+ try (PreparedStatement st = conn.prepareStatement("select * from PERSONS where id = ?")) {
+ st.setString(1, key.toString());
- ResultSet rs = st.executeQuery();
+ ResultSet rs = st.executeQuery();
- if (rs.next())
- return new Person(rs.getLong(1), rs.getString(2), rs.getString(3));
- }
+ return rs.next() ? new Person(rs.getLong(1), rs.getString(2), rs.getString(3)) : null;
}
catch (SQLException e) {
- throw new CacheLoaderException("Failed to load object: " + key, e);
+ throw new CacheLoaderException("Failed to load object [key=" + key + ']', e);
}
- finally {
- end(conn);
- }
-
- return null;
}
/** {@inheritDoc} */
@Override public void write(Cache.Entry<? extends Long, ? extends Person> entry) {
Long key = entry.getKey();
-
Person val = entry.getValue();
- System.out.println(">>> Putting [key=" + key + ", val=" + val + ']');
-
- Connection conn = null;
+ System.out.println(">>> Store write [key=" + key + ", val=" + val + ']');
try {
- conn = connection();
+ Connection conn = ses.attachment();
int updated;
// Try update first. If it does not work, then try insert.
// Some databases would allow these to be done in one 'upsert' operation.
try (PreparedStatement st = conn.prepareStatement(
- "update PERSONS set firstName=?, lastName=? where id=?")) {
+ "update PERSONS set firstName = ?, lastName = ? where id = ?")) {
st.setString(1, val.getFirstName());
st.setString(2, val.getLastName());
st.setLong(3, val.getId());
@@ -145,7 +112,7 @@ public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> {
// If update failed, try to insert.
if (updated == 0) {
try (PreparedStatement st = conn.prepareStatement(
- "insert into PERSONS (id, firstName, lastName) values(?, ?, ?)")) {
+ "insert into PERSONS (id, firstName, lastName) values (?, ?, ?)")) {
st.setLong(1, val.getId());
st.setString(2, val.getFirstName());
st.setString(3, val.getLastName());
@@ -155,33 +122,23 @@ public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> {
}
}
catch (SQLException e) {
- throw new CacheLoaderException("Failed to put object [key=" + key + ", val=" + val + ']', e);
- }
- finally {
- end(conn);
+ throw new CacheWriterException("Failed to write object [key=" + key + ", val=" + val + ']', e);
}
}
/** {@inheritDoc} */
@Override public void delete(Object key) {
- System.out.println(">>> Removing key: " + key);
-
- Connection conn = null;
+ System.out.println(">>> Store delete [key=" + key + ']');
- try {
- conn = connection();
+ Connection conn = ses.attachment();
- try (PreparedStatement st = conn.prepareStatement("delete from PERSONS where id=?")) {
- st.setLong(1, (Long)key);
+ try (PreparedStatement st = conn.prepareStatement("delete from PERSONS where id=?")) {
+ st.setLong(1, (Long)key);
- st.executeUpdate();
- }
+ st.executeUpdate();
}
catch (SQLException e) {
- throw new CacheWriterException("Failed to remove object: " + key, e);
- }
- finally {
- end(conn);
+ throw new CacheWriterException("Failed to delete object [key=" + key + ']', e);
}
}
@@ -192,84 +149,27 @@ public class CacheJdbcPersonStore extends CacheStoreAdapter<Long, Person> {
final int entryCnt = (Integer)args[0];
- try (Connection conn = connection()) {
- try (PreparedStatement st = conn.prepareStatement("select * from PERSONS")) {
- try (ResultSet rs = st.executeQuery()) {
- int cnt = 0;
+ Connection conn = ses.attachment();
- while (cnt < entryCnt && rs.next()) {
- Person person = new Person(rs.getLong(1), rs.getString(2), rs.getString(3));
+ try (PreparedStatement stmt = conn.prepareStatement("select * from PERSONS limit ?")) {
+ stmt.setInt(1, entryCnt);
- clo.apply(person.getId(), person);
+ ResultSet rs = stmt.executeQuery();
- cnt++;
- }
+ int cnt = 0;
- System.out.println(">>> Loaded " + cnt + " values into cache.");
- }
- }
- }
- catch (SQLException e) {
- throw new CacheLoaderException("Failed to load values from cache store.", e);
- }
- }
-
- /**
- * @return Connection.
- * @throws SQLException In case of error.
- */
- private Connection connection() throws SQLException {
- // If there is an ongoing transaction,
- // we must reuse the same connection.
- if (ses.isWithinTransaction()) {
- Map<Object, Object> props = ses.properties();
-
- Connection conn = (Connection)props.get(ATTR_NAME);
+ while (rs.next()) {
+ Person person = new Person(rs.getLong(1), rs.getString(2), rs.getString(3));
- if (conn == null) {
- conn = openConnection(false);
+ clo.apply(person.getId(), person);
- // Store connection in session properties, so it can be accessed
- // for other operations on the same transaction.
- props.put(ATTR_NAME, conn);
+ cnt++;
}
- return conn;
+ System.out.println(">>> Loaded " + cnt + " values into cache.");
}
- // Transaction can be null in case of simple load or put operation.
- else
- return openConnection(true);
- }
-
- /**
- * Closes allocated resources depending on transaction status.
- *
- * @param conn Allocated connection.
- */
- private void end(@Nullable Connection conn) {
- if (!ses.isWithinTransaction() && conn != null) {
- // Close connection right away if there is no transaction.
- try {
- conn.close();
- }
- catch (SQLException ignored) {
- // No-op.
- }
+ catch (SQLException e) {
+ throw new CacheLoaderException("Failed to load values from cache store.", e);
}
}
-
- /**
- * 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 = DriverManager.getConnection("jdbc:h2:mem:example;DB_CLOSE_DELAY=-1");
-
- conn.setAutoCommit(autocommit);
-
- return conn;
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
index 1cb73c9..637d6dc 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
@@ -18,6 +18,8 @@
package org.apache.ignite.examples.datagrid.store.jdbc;
import org.apache.ignite.*;
+import org.apache.ignite.cache.store.*;
+import org.apache.ignite.cache.store.jdbc.*;
import org.apache.ignite.configuration.*;
import org.apache.ignite.examples.*;
import org.apache.ignite.examples.datagrid.store.*;
@@ -71,6 +73,17 @@ public class CacheJdbcStoreExample {
// Configure JDBC store.
cacheCfg.setCacheStoreFactory(FactoryBuilder.factoryOf(CacheJdbcPersonStore.class));
+ // Configure JDBC session listener.
+ cacheCfg.setCacheStoreSessionListenerFactories(new Factory<CacheStoreSessionListener>() {
+ @Override public CacheStoreSessionListener create() {
+ CacheJdbcStoreSessionListener lsnr = new CacheJdbcStoreSessionListener();
+
+ lsnr.setDataSource(CacheJdbcPersonStore.DATA_SRC);
+
+ return lsnr;
+ }
+ });
+
cacheCfg.setReadThrough(true);
cacheCfg.setWriteThrough(true);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringPersonStore.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringPersonStore.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringPersonStore.java
new file mode 100644
index 0000000..50149ba
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringPersonStore.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.examples.datagrid.store.spring;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.store.*;
+import org.apache.ignite.examples.datagrid.store.*;
+import org.apache.ignite.lang.*;
+import org.springframework.dao.*;
+import org.springframework.jdbc.core.*;
+import org.springframework.jdbc.datasource.*;
+
+import javax.cache.*;
+import javax.cache.integration.*;
+import javax.sql.*;
+import java.sql.*;
+import java.util.concurrent.atomic.*;
+
+/**
+ * Example of {@link CacheStore} implementation that uses JDBC
+ * transaction with cache transactions and maps {@link Long} to {@link Person}.
+ */
+public class CacheSpringPersonStore extends CacheStoreAdapter<Long, Person> {
+ /** Data source. */
+ public static final DataSource DATA_SRC = new DriverManagerDataSource("jdbc:h2:mem:example;DB_CLOSE_DELAY=-1");
+
+ /** Spring JDBC template. */
+ private JdbcTemplate jdbcTemplate;
+
+ /**
+ * Constructor.
+ *
+ * @throws IgniteException If failed.
+ */
+ public CacheSpringPersonStore() throws IgniteException {
+ jdbcTemplate = new JdbcTemplate(DATA_SRC);
+
+ prepareDb();
+ }
+
+ /**
+ * Prepares database for example execution. This method will create a
+ * table called "PERSONS" so it can be used by store implementation.
+ *
+ * @throws IgniteException If failed.
+ */
+ private void prepareDb() throws IgniteException {
+ jdbcTemplate.update(
+ "create table if not exists PERSONS (" +
+ "id number unique, firstName varchar(255), lastName varchar(255))");
+ }
+
+ /** {@inheritDoc} */
+ @Override public Person load(Long key) {
+ System.out.println(">>> Store load [key=" + key + ']');
+
+ try {
+ return jdbcTemplate.queryForObject("select * from PERSONS where id = ?", new RowMapper<Person>() {
+ @Override public Person mapRow(ResultSet rs, int rowNum) throws SQLException {
+ return new Person(rs.getLong(1), rs.getString(2), rs.getString(3));
+ }
+ }, key);
+ }
+ catch (EmptyResultDataAccessException ignored) {
+ return null;
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void write(Cache.Entry<? extends Long, ? extends Person> entry) {
+ Long key = entry.getKey();
+ Person val = entry.getValue();
+
+ System.out.println(">>> Store write [key=" + key + ", val=" + val + ']');
+
+ int updated = jdbcTemplate.update("update PERSONS set firstName = ?, lastName = ? where id = ?",
+ val.getFirstName(), val.getLastName(), val.getId());
+
+ if (updated == 0) {
+ jdbcTemplate.update("insert into PERSONS (id, firstName, lastName) values (?, ?, ?)",
+ val.getId(), val.getFirstName(), val.getLastName());
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void delete(Object key) {
+ System.out.println(">>> Store delete [key=" + key + ']');
+
+ jdbcTemplate.update("delete from PERSONS where id = ?", key);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void loadCache(final IgniteBiInClosure<Long, Person> clo, Object... args) {
+ if (args == null || args.length == 0 || args[0] == null)
+ throw new CacheLoaderException("Expected entry count parameter is not provided.");
+
+ int entryCnt = (Integer)args[0];
+
+ final AtomicInteger cnt = new AtomicInteger();
+
+ jdbcTemplate.query("select * from PERSONS limit ?", new RowCallbackHandler() {
+ @Override public void processRow(ResultSet rs) throws SQLException {
+ Person person = new Person(rs.getLong(1), rs.getString(2), rs.getString(3));
+
+ clo.apply(person.getId(), person);
+
+ cnt.incrementAndGet();
+ }
+ }, entryCnt);
+
+ System.out.println(">>> Loaded " + cnt + " values into cache.");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringStoreExample.java
new file mode 100644
index 0000000..aa624bc
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/CacheSpringStoreExample.java
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.examples.datagrid.store.spring;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.store.*;
+import org.apache.ignite.cache.store.jdbc.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.examples.*;
+import org.apache.ignite.examples.datagrid.store.*;
+import org.apache.ignite.transactions.*;
+
+import javax.cache.configuration.*;
+import java.util.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+
+/**
+ * Demonstrates usage of cache with underlying persistent store configured.
+ * <p>
+ * This example uses {@link CacheSpringPersonStore} as a persistent store.
+ * <p>
+ * Remote nodes can be started with {@link ExampleNodeStartup} in another JVM which will
+ * start node with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class CacheSpringStoreExample {
+ /** Cache name. */
+ private static final String CACHE_NAME = CacheSpringStoreExample.class.getSimpleName();
+
+ /** Heap size required to run this example. */
+ public static final int MIN_MEMORY = 1024 * 1024 * 1024;
+
+ /** Number of entries to load. */
+ private static final int ENTRY_COUNT = 100_000;
+
+ /** Global person ID to use across entire example. */
+ private static final Long id = Math.abs(UUID.randomUUID().getLeastSignificantBits());
+
+ /**
+ * Executes example.
+ *
+ * @param args Command line arguments, none required.
+ * @throws IgniteException If example execution failed.
+ */
+ public static void main(String[] args) throws IgniteException {
+ ExamplesUtils.checkMinMemory(MIN_MEMORY);
+
+ // To start ignite with desired configuration uncomment the appropriate line.
+ try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+ System.out.println();
+ System.out.println(">>> Cache store example started.");
+
+ CacheConfiguration<Long, Person> cacheCfg = new CacheConfiguration<>(CACHE_NAME);
+
+ // Set atomicity as transaction, since we are showing transactions in example.
+ cacheCfg.setAtomicityMode(TRANSACTIONAL);
+
+ // Configure Spring store.
+ cacheCfg.setCacheStoreFactory(FactoryBuilder.factoryOf(CacheSpringPersonStore.class));
+
+ // Configure Spring session listener.
+ cacheCfg.setCacheStoreSessionListenerFactories(new Factory<CacheStoreSessionListener>() {
+ @Override public CacheStoreSessionListener create() {
+ CacheJdbcStoreSessionListener lsnr = new CacheJdbcStoreSessionListener();
+
+ lsnr.setDataSource(CacheSpringPersonStore.DATA_SRC);
+
+ return lsnr;
+ }
+ });
+
+ cacheCfg.setReadThrough(true);
+ cacheCfg.setWriteThrough(true);
+
+ try (IgniteCache<Long, Person> cache = ignite.getOrCreateCache(cacheCfg)) {
+ // Make initial cache loading from persistent store. This is a
+ // distributed operation and will call CacheStore.loadCache(...)
+ // method on all nodes in topology.
+ loadCache(cache);
+
+ // Start transaction and execute several cache operations with
+ // read/write-through to persistent store.
+ executeTransaction(cache);
+ }
+ }
+ }
+
+ /**
+ * Makes initial cache loading.
+ *
+ * @param cache Cache to load.
+ */
+ private static void loadCache(IgniteCache<Long, Person> cache) {
+ long start = System.currentTimeMillis();
+
+ // Start loading cache from persistent store on all caching nodes.
+ cache.loadCache(null, ENTRY_COUNT);
+
+ long end = System.currentTimeMillis();
+
+ System.out.println(">>> Loaded " + cache.size() + " keys with backups in " + (end - start) + "ms.");
+ }
+
+ /**
+ * Executes transaction with read/write-through to persistent store.
+ *
+ * @param cache Cache to execute transaction on.
+ */
+ private static void executeTransaction(IgniteCache<Long, Person> cache) {
+ try (Transaction tx = Ignition.ignite().transactions().txStart()) {
+ Person val = cache.get(id);
+
+ System.out.println("Read value: " + val);
+
+ val = cache.getAndPut(id, new Person(id, "Isaac", "Newton"));
+
+ System.out.println("Overwrote old value: " + val);
+
+ val = cache.get(id);
+
+ System.out.println("Read value: " + val);
+
+ tx.commit();
+ }
+
+ System.out.println("Read value after commit: " + cache.get(id));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/package-info.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/package-info.java
new file mode 100644
index 0000000..211239f
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/spring/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains Spring-based cache store implementation.
+ */
+package org.apache.ignite.examples.datagrid.store.spring;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/examples/src/main/java/org/apache/ignite/examples/misc/client/memcache/MemcacheRestExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/misc/client/memcache/MemcacheRestExample.java b/examples/src/main/java/org/apache/ignite/examples/misc/client/memcache/MemcacheRestExample.java
index 877dadd..a15afd7 100644
--- a/examples/src/main/java/org/apache/ignite/examples/misc/client/memcache/MemcacheRestExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/misc/client/memcache/MemcacheRestExample.java
@@ -85,22 +85,22 @@ public class MemcacheRestExample {
// Check that cache is empty.
System.out.println(">>> Current cache size: " + cache.size() + " (expected: 0).");
- // Create atomic long.
- IgniteAtomicLong l = ignite.atomicLong("atomicLong", 10, true);
-
- // Increment atomic long by 5 using Memcache client.
- if (client.incr("atomicLong", 5, 0) == 15)
- System.out.println(">>> Successfully incremented atomic long by 5.");
-
- // Increment atomic long using Ignite API and check that value is correct.
- System.out.println(">>> New atomic long value: " + l.incrementAndGet() + " (expected: 16).");
-
- // Decrement atomic long by 3 using Memcache client.
- if (client.decr("atomicLong", 3, 0) == 13)
- System.out.println(">>> Successfully decremented atomic long by 3.");
-
- // Decrement atomic long using Ignite API and check that value is correct.
- System.out.println(">>> New atomic long value: " + l.decrementAndGet() + " (expected: 12).");
+ // Create atomic long and close it after test is done.
+ try (IgniteAtomicLong l = ignite.atomicLong("atomicLong", 10, true)) {
+ // Increment atomic long by 5 using Memcache client.
+ if (client.incr("atomicLong", 5, 0) == 15)
+ System.out.println(">>> Successfully incremented atomic long by 5.");
+
+ // Increment atomic long using Ignite API and check that value is correct.
+ System.out.println(">>> New atomic long value: " + l.incrementAndGet() + " (expected: 16).");
+
+ // Decrement atomic long by 3 using Memcache client.
+ if (client.decr("atomicLong", 3, 0) == 13)
+ System.out.println(">>> Successfully decremented atomic long by 3.");
+
+ // Decrement atomic long using Ignite API and check that value is correct.
+ System.out.println(">>> New atomic long value: " + l.decrementAndGet() + " (expected: 12).");
+ }
}
finally {
if (client != null)
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpSslRouterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpSslRouterSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpSslRouterSelfTest.java
index 750c246..498be7d 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpSslRouterSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpSslRouterSelfTest.java
@@ -26,6 +26,11 @@ import org.apache.ignite.testframework.*;
*/
public class TcpSslRouterSelfTest extends TcpRouterAbstractSelfTest {
/** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-433");
+ }
+
+ /** {@inheritDoc} */
@Override protected boolean useSsl() {
return true;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java
index 5fdafb1..e9d1ebb 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java
@@ -103,8 +103,7 @@ public class IgniteClientTestSuite extends TestSuite {
// Router tests.
suite.addTest(new TestSuite(TcpRouterSelfTest.class));
- // TODO uncomment when fixed https://issues.apache.org/jira/browse/IGNITE-433
- // suite.addTest(new TestSuite(TcpSslRouterSelfTest.class));
+ suite.addTest(new TestSuite(TcpSslRouterSelfTest.class));
suite.addTest(new TestSuite(TcpRouterMultiNodeSelfTest.class));
suite.addTest(new TestSuite(ClientFailedInitSelfTest.class));
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index f9007a2..2b97e55 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -30,6 +30,7 @@ import org.jetbrains.annotations.*;
import javax.cache.*;
import javax.cache.configuration.*;
+import javax.cache.event.*;
import javax.cache.expiry.*;
import javax.cache.integration.*;
import javax.cache.processor.*;
@@ -311,10 +312,26 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@IgniteAsyncSupported
@Override public Map<K, V> getAll(Set<? extends K> keys);
+ /**
+ * Gets values from cache. Will bypass started transaction, if any, i.e. will not enlist entries
+ * and will not lock any keys if pessimistic transaction is started by thread.
+ *
+ * @param keys The keys whose associated values are to be returned.
+ * @return A map of entries that were found for the given keys.
+ */
+ @IgniteAsyncSupported
+ public Map<K, V> getAllOutTx(Set<? extends K> keys);
+
/** {@inheritDoc} */
@IgniteAsyncSupported
@Override public boolean containsKey(K key);
+ /**
+ * Determines if the {@link Cache} contains entries for the specified keys.
+ *
+ * @param keys Key whose presence in this cache is to be tested.
+ * @return {@code True} if this cache contains a mapping for the specified keys.
+ */
@IgniteAsyncSupported
public boolean containsKeys(Set<? extends K> keys);
@@ -362,7 +379,29 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@IgniteAsyncSupported
@Override public void removeAll(Set<? extends K> keys);
- /** {@inheritDoc} */
+ /**
+ * Removes all of the mappings from this cache.
+ * <p>
+ * The order that the individual entries are removed is undefined.
+ * <p>
+ * For every mapping that exists the following are called:
+ * <ul>
+ * <li>any registered {@link CacheEntryRemovedListener}s</li>
+ * <li>if the cache is a write-through cache, the {@link CacheWriter}</li>
+ * </ul>
+ * If the cache is empty, the {@link CacheWriter} is not called.
+ * <p>
+ * This operation is not transactional. It calls broadcast closure that
+ * deletes all primary keys from remote nodes.
+ * <p>
+ * This is potentially an expensive operation as listeners are invoked.
+ * Use {@link #clear()} to avoid this.
+ *
+ * @throws IllegalStateException if the cache is {@link #isClosed()}
+ * @throws CacheException if there is a problem during the remove
+ * @see #clear()
+ * @see CacheWriter#deleteAll
+ */
@IgniteAsyncSupported
@Override public void removeAll();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/main/java/org/apache/ignite/Ignition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/Ignition.java b/modules/core/src/main/java/org/apache/ignite/Ignition.java
index 6ed99bd..d5d59a5 100644
--- a/modules/core/src/main/java/org/apache/ignite/Ignition.java
+++ b/modules/core/src/main/java/org/apache/ignite/Ignition.java
@@ -20,6 +20,8 @@ package org.apache.ignite;
import org.apache.ignite.configuration.*;
import org.apache.ignite.internal.*;
import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.discovery.*;
+import org.apache.ignite.spi.discovery.tcp.*;
import org.jetbrains.annotations.*;
import java.io.*;
@@ -133,18 +135,30 @@ public class Ignition {
}
/**
- * Sets client mode flag.
+ * Sets client mode static flag.
+ * <p>
+ * This flag used when node is started if {@link IgniteConfiguration#isClientMode()}
+ * is {@code null}. When {@link IgniteConfiguration#isClientMode()} is set this flag is ignored.
+ * It is recommended to use {@link DiscoverySpi} in client mode too.
*
* @param clientMode Client mode flag.
+ * @see IgniteConfiguration#isClientMode()
+ * @see TcpDiscoverySpi#setForceServerMode(boolean)
*/
public static void setClientMode(boolean clientMode) {
IgnitionEx.setClientMode(clientMode);
}
/**
- * Gets client mode flag.
+ * Gets client mode static flag.
+ * <p>
+ * This flag used when node is started if {@link IgniteConfiguration#isClientMode()}
+ * is {@code null}. When {@link IgniteConfiguration#isClientMode()} is set this flag is ignored.
+ * It is recommended to use {@link DiscoverySpi} in client mode too.
*
* @return Client mode flag.
+ * @see IgniteConfiguration#isClientMode()
+ * @see TcpDiscoverySpi#setForceServerMode(boolean)
*/
public static boolean isClientMode() {
return IgnitionEx.isClientMode();