GG-9141 - Renaming
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3008d2ad Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3008d2ad Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3008d2ad Branch: refs/heads/ignite-1 Commit: 3008d2ad03155d6ac438c86529220d32a557c88a Parents: 5ba15f0 Author: Alexey Goncharuk <agoncha...@gridgain.com> Authored: Fri Dec 19 17:59:40 2014 -0800 Committer: Alexey Goncharuk <agoncha...@gridgain.com> Committed: Fri Dec 19 17:59:42 2014 -0800 ---------------------------------------------------------------------- .../datagrid/CacheTransactionExample.java | 2 +- .../datagrid/store/CacheStoreExample.java | 2 +- .../store/dummy/CacheDummyPersonStore.java | 6 +- .../hibernate/CacheHibernatePersonStore.java | 14 +- .../store/jdbc/CacheJdbcPersonStore.java | 12 +- .../org/gridgain/client/GridHashMapStore.java | 6 +- .../integration/GridClientAbstractSelfTest.java | 6 +- .../java/org/apache/ignite/IgniteCache.java | 6 +- .../org/apache/ignite/IgniteTransactions.java | 12 +- .../java/org/apache/ignite/cache/CacheFlag.java | 2 +- .../TransactionsConfiguration.java | 4 +- .../apache/ignite/transactions/GridCacheTx.java | 244 ----- .../transactions/GridCacheTxConcurrency.java | 2 +- .../transactions/GridCacheTxIsolation.java | 2 +- .../GridCacheTxSynchronization.java | 8 +- .../apache/ignite/transactions/IgniteTx.java | 244 +++++ .../grid/cache/GridCacheAtomicityMode.java | 2 +- .../grid/cache/GridCacheConfiguration.java | 4 +- .../org/gridgain/grid/cache/GridCacheEntry.java | 2 +- .../org/gridgain/grid/cache/GridCacheFlag.java | 2 +- .../grid/cache/GridCacheProjection.java | 108 +-- .../GridCacheWriteSynchronizationMode.java | 4 +- .../store/GridCacheLoadOnlyStoreAdapter.java | 14 +- .../grid/cache/store/GridCacheStore.java | 24 +- .../grid/cache/store/GridCacheStoreAdapter.java | 16 +- .../store/GridCacheStoreBalancingWrapper.java | 14 +- .../store/jdbc/GridCacheJdbcBlobStore.java | 12 +- .../grid/kernal/IgniteTransactionsEx.java | 2 +- .../processors/cache/GridCacheAdapter.java | 30 +- .../processors/cache/GridCacheEventManager.java | 6 +- .../cache/GridCacheMultiTxFuture.java | 4 +- .../processors/cache/GridCacheProjectionEx.java | 8 +- .../cache/GridCacheProjectionImpl.java | 12 +- .../processors/cache/GridCacheProxyImpl.java | 12 +- .../cache/GridCacheSharedContext.java | 2 +- .../processors/cache/GridCacheStoreManager.java | 14 +- .../processors/cache/GridCacheTxAdapter.java | 16 +- .../kernal/processors/cache/GridCacheTxEx.java | 6 +- .../processors/cache/GridCacheTxHandler.java | 26 +- .../cache/GridCacheTxLocalAdapter.java | 16 +- .../processors/cache/GridCacheTxManager.java | 18 +- .../processors/cache/GridCacheTxProxy.java | 19 - .../processors/cache/GridCacheTxProxyImpl.java | 303 ------ .../kernal/processors/cache/GridCacheUtils.java | 12 +- .../cache/GridCacheWriteBehindStore.java | 14 +- .../kernal/processors/cache/IgniteTxProxy.java | 19 + .../processors/cache/IgniteTxProxyImpl.java | 303 ++++++ .../datastructures/GridCacheAtomicLongImpl.java | 16 +- .../GridCacheAtomicReferenceImpl.java | 4 +- .../GridCacheAtomicSequenceImpl.java | 2 +- .../GridCacheAtomicStampedImpl.java | 4 +- .../GridCacheCountDownLatchImpl.java | 4 +- .../GridCacheDataStructuresManager.java | 14 +- .../GridTransactionalCacheQueueImpl.java | 8 +- .../GridDistributedTxRemoteAdapter.java | 8 +- .../dht/GridDhtTransactionalCacheAdapter.java | 4 +- .../distributed/dht/GridDhtTxFinishFuture.java | 12 +- .../cache/distributed/dht/GridDhtTxLocal.java | 4 +- .../near/GridNearTxFinishFuture.java | 16 +- .../cache/distributed/near/GridNearTxLocal.java | 12 +- .../processors/cache/local/GridLocalTx.java | 6 +- .../transactions/IgniteTransactionsImpl.java | 24 +- .../dataload/GridDataLoadCacheUpdaters.java | 2 +- .../processors/ggfs/GridGgfsDataManager.java | 4 +- .../processors/ggfs/GridGgfsMetaManager.java | 26 +- .../handlers/cache/GridCacheCommandHandler.java | 2 +- .../service/GridServiceProcessor.java | 2 +- .../store/GridCacheBalancingStoreSelfTest.java | 14 +- .../cache/store/GridGeneratingTestStore.java | 14 +- ...CacheJdbcBlobStoreMultithreadedSelfTest.java | 2 +- .../grid/kernal/GridStartStopSelfTest.java | 2 +- .../cache/GridCacheAbstractFullApiSelfTest.java | 80 +- .../GridCacheAbstractProjectionSelfTest.java | 4 +- .../cache/GridCacheAbstractSelfTest.java | 8 +- .../cache/GridCacheAbstractTtlSelfTest.java | 2 +- .../cache/GridCacheAbstractTxReadTest.java | 2 +- .../cache/GridCacheBasicStoreAbstractTest.java | 6 +- ...acheBasicStoreMultithreadedAbstractTest.java | 6 +- .../cache/GridCacheClearAllSelfTest.java | 2 +- ...dCacheColocatedTxStoreExceptionSelfTest.java | 2 +- .../GridCacheConcurrentTxMultiNodeTest.java | 2 +- ...idCacheConfigurationConsistencySelfTest.java | 14 +- .../GridCacheDaemonNodeAbstractSelfTest.java | 4 +- .../cache/GridCacheDeploymentSelfTest.java | 2 +- .../GridCacheExAbstractFullApiSelfTest.java | 2 +- .../GridCacheFinishPartitionsSelfTest.java | 4 +- .../cache/GridCacheGenericTestStore.java | 30 +- .../GridCacheGroupLockAbstractSelfTest.java | 38 +- .../cache/GridCacheGroupLockPutTask.java | 2 +- .../GridCacheInterceptorAbstractSelfTest.java | 2 +- .../cache/GridCacheLifecycleAwareSelfTest.java | 14 +- .../GridCacheLocalTxStoreExceptionSelfTest.java | 2 +- .../GridCacheMarshallerTxAbstractTest.java | 2 +- ...GridCacheMixedPartitionExchangeSelfTest.java | 2 +- .../cache/GridCacheMultiUpdateLockSelfTest.java | 4 +- .../cache/GridCacheMvccManagerSelfTest.java | 2 +- .../GridCacheNearTxStoreExceptionSelfTest.java | 2 +- .../cache/GridCacheNestedTxAbstractTest.java | 6 +- .../cache/GridCacheObjectToStringSelfTest.java | 2 +- ...CacheOffHeapMultiThreadedUpdateSelfTest.java | 8 +- .../GridCacheOffHeapTieredAbstractSelfTest.java | 10 +- .../cache/GridCacheOffheapUpdateSelfTest.java | 10 +- .../cache/GridCachePartitionedWritesTest.java | 8 +- .../GridCacheReferenceCleanupSelfTest.java | 4 +- .../GridCacheRefreshAheadAbstractSelfTest.java | 6 +- .../cache/GridCacheReloadSelfTest.java | 6 +- ...CacheReplicatedTxStoreExceptionSelfTest.java | 2 +- .../cache/GridCacheSlowTxWarnTest.java | 2 +- .../processors/cache/GridCacheStopSelfTest.java | 2 +- .../cache/GridCacheStorePutxSelfTest.java | 16 +- .../cache/GridCacheSwapReloadSelfTest.java | 6 +- .../processors/cache/GridCacheTestStore.java | 32 +- ...cheTransactionalAbstractMetricsSelfTest.java | 4 +- .../cache/GridCacheTxAbstractTest.java | 484 ---------- .../GridCacheTxConcurrentGetAbstractTest.java | 134 --- .../GridCacheTxExceptionAbstractSelfTest.java | 631 ------------- .../cache/GridCacheTxMultiNodeAbstractTest.java | 918 ------------------- .../GridCacheTxMultiThreadedAbstractTest.java | 275 ------ .../GridCacheTxReentryAbstractSelfTest.java | 169 ---- .../GridCacheTxSingleThreadedAbstractTest.java | 129 --- ...idCacheTxStoreExceptionAbstractSelfTest.java | 631 ------------- .../GridCacheVariableTopologySelfTest.java | 2 +- .../GridCacheWriteBehindStoreAbstractTest.java | 4 +- ...BehindStorePartitionedMultiNodeSelfTest.java | 2 +- .../GridCacheWriteBehindStoreSelfTest.java | 2 +- .../processors/cache/IgniteTxAbstractTest.java | 484 ++++++++++ .../IgniteTxConcurrentGetAbstractTest.java | 134 +++ .../IgniteTxExceptionAbstractSelfTest.java | 631 +++++++++++++ .../cache/IgniteTxMultiNodeAbstractTest.java | 918 +++++++++++++++++++ .../IgniteTxMultiThreadedAbstractTest.java | 275 ++++++ .../cache/IgniteTxReentryAbstractSelfTest.java | 169 ++++ .../IgniteTxSingleThreadedAbstractTest.java | 129 +++ .../IgniteTxStoreExceptionAbstractSelfTest.java | 631 +++++++++++++ .../GridCacheAtomicLongApiSelfTest.java | 2 +- .../GridCacheSequenceApiSelfAbstractTest.java | 2 +- ...idCachePartitionedNodeRestartTxSelfTest.java | 8 +- ...PartitionedQueueCreateMultiNodeSelfTest.java | 2 +- ...tractDistributedByteArrayValuesSelfTest.java | 2 +- .../GridCacheAbstractJobExecutionTest.java | 4 +- .../GridCacheAbstractNodeRestartSelfTest.java | 4 +- .../GridCacheAbstractPrimarySyncSelfTest.java | 2 +- .../GridCacheBasicOpAbstractTest.java | 4 +- .../GridCacheEntrySetAbstractSelfTest.java | 2 +- .../distributed/GridCacheEventAbstractTest.java | 20 +- ...dCacheMultithreadedFailoverAbstractTest.java | 2 +- .../GridCacheNodeFailureAbstractTest.java | 2 +- ...chePartitionedReloadAllAbstractSelfTest.java | 6 +- ...cheTxConsistencyRestartAbstractSelfTest.java | 194 ---- ...xOriginatingNodeFailureAbstractSelfTest.java | 294 ------ ...cOriginatingNodeFailureAbstractSelfTest.java | 488 ---------- .../GridCacheTxPreloadAbstractTest.java | 192 ---- .../GridCacheTxTimeoutAbstractTest.java | 147 --- ...iteTxConsistencyRestartAbstractSelfTest.java | 194 ++++ ...xOriginatingNodeFailureAbstractSelfTest.java | 294 ++++++ ...cOriginatingNodeFailureAbstractSelfTest.java | 488 ++++++++++ .../IgniteTxPreloadAbstractTest.java | 192 ++++ .../IgniteTxTimeoutAbstractTest.java | 147 +++ ...heAbstractTransformWriteThroughSelfTest.java | 2 +- .../dht/GridCacheColocatedDebugTest.java | 14 +- ...eColocatedOptimisticTransactionSelfTest.java | 2 +- .../GridCacheColocatedTxExceptionSelfTest.java | 2 +- ...ssimisticOriginatingNodeFailureSelfTest.java | 2 +- ...dCacheColocatedTxSingleThreadedSelfTest.java | 2 +- .../dht/GridCacheDhtEntrySelfTest.java | 2 +- .../dht/GridCacheDhtTxPreloadSelfTest.java | 3 +- ...cheGroupLockPartitionedAbstractSelfTest.java | 4 +- ...ockPartitionedMultiNodeAbstractSelfTest.java | 4 +- ...dCachePartitionedTopologyChangeSelfTest.java | 8 +- ...itionedTxOriginatingNodeFailureSelfTest.java | 2 +- ...heTxConsistencyColocatedRestartSelfTest.java | 28 - .../GridCacheTxReentryColocatedSelfTest.java | 71 -- ...teTxConsistencyColocatedRestartSelfTest.java | 28 + .../dht/IgniteTxReentryColocatedSelfTest.java | 71 ++ .../atomic/GridCacheAtomicPreloadSelfTest.java | 2 +- .../near/GridCacheGetStoreErrorSelfTest.java | 6 +- .../near/GridCacheNearMultiGetSelfTest.java | 4 +- .../near/GridCacheNearMultiNodeSelfTest.java | 16 +- .../near/GridCacheNearOneNodeSelfTest.java | 12 +- .../near/GridCacheNearOnlyTopologySelfTest.java | 4 +- .../near/GridCacheNearTxExceptionSelfTest.java | 2 +- .../near/GridCacheNearTxMultiNodeSelfTest.java | 6 +- ...ssimisticOriginatingNodeFailureSelfTest.java | 2 +- .../near/GridCacheNearTxPreloadSelfTest.java | 3 +- ...ePartitionedBasicStoreMultiNodeSelfTest.java | 18 +- .../GridCachePartitionedEvictionSelfTest.java | 2 +- ...GridCachePartitionedFilteredPutSelfTest.java | 4 +- .../GridCachePartitionedLoadCacheSelfTest.java | 6 +- ...achePartitionedMultiNodeCounterSelfTest.java | 8 +- ...ePartitionedMultiThreadedPutGetSelfTest.java | 2 +- .../GridCachePartitionedStorePutSelfTest.java | 6 +- ...GridCachePartitionedTxConcurrentGetTest.java | 2 +- ...GridCachePartitionedTxMultiNodeSelfTest.java | 2 +- ...CachePartitionedTxMultiThreadedSelfTest.java | 2 +- .../GridCachePartitionedTxSalvageSelfTest.java | 2 +- ...achePartitionedTxSingleThreadedSelfTest.java | 2 +- .../GridCachePartitionedTxTimeoutSelfTest.java | 2 +- .../near/GridCacheTxReentryNearSelfTest.java | 71 -- .../near/GridPartitionedBackupLoadSelfTest.java | 6 +- .../near/IgniteTxReentryNearSelfTest.java | 71 ++ .../GridCacheReplicatedInvalidateSelfTest.java | 2 +- .../GridCacheReplicatedTxConcurrentGetTest.java | 2 +- .../GridCacheReplicatedTxExceptionSelfTest.java | 2 +- ...GridCacheReplicatedTxMultiNodeBasicTest.java | 2 +- ...dCacheReplicatedTxMultiThreadedSelfTest.java | 2 +- ...licatedTxOriginatingNodeFailureSelfTest.java | 2 +- ...ssimisticOriginatingNodeFailureSelfTest.java | 2 +- ...CacheReplicatedTxSingleThreadedSelfTest.java | 2 +- .../GridCacheReplicatedTxTimeoutSelfTest.java | 2 +- .../replicated/GridReplicatedTxPreloadTest.java | 2 +- .../GridCacheBatchEvictUnswapSelfTest.java | 6 +- ...heConcurrentEvictionConsistencySelfTest.java | 2 +- .../GridCacheEmptyEntriesAbstractSelfTest.java | 8 +- .../eviction/GridCacheEvictionAbstractTest.java | 2 +- .../GridCacheEvictionTouchSelfTest.java | 10 +- .../GridCacheLocalByteArrayValuesSelfTest.java | 2 +- .../local/GridCacheLocalLoadAllSelfTest.java | 8 +- .../GridCacheLocalTxExceptionSelfTest.java | 2 +- .../GridCacheLocalTxMultiThreadedSelfTest.java | 2 +- .../GridCacheLocalTxSingleThreadedSelfTest.java | 2 +- .../local/GridCacheLocalTxTimeoutSelfTest.java | 2 +- ...ridCacheContinuousQueryAbstractSelfTest.java | 6 +- .../processors/ggfs/GridGgfsSizeSelfTest.java | 4 +- .../cache/GridCacheAbstractLoadTest.java | 4 +- ...ridCacheAffinityTransactionsOffHeapTest.java | 2 +- .../cache/GridCacheGroupLockComparisonTest.java | 2 +- .../GridCacheWriteBehindStoreLoadTest.java | 6 +- .../colocation/GridTestCacheStore.java | 6 +- .../GridCachePartitionedAtomicLongLoadTest.java | 2 +- .../gridgain/loadtests/dsi/GridDsiPerfJob.java | 2 +- .../swap/GridSwapEvictAllBenchmark.java | 6 +- .../cache/GridAbstractCacheStoreSelfTest.java | 12 +- .../bamboo/GridDataGridTestSuite.java | 4 +- .../GridHibernateReadWriteAccessStrategy.java | 4 +- .../hibernate/GridCacheHibernateBlobStore.java | 14 +- .../cache/GridCacheAbstractQuerySelfTest.java | 6 +- .../cache/GridCacheQueryLoadSelfTest.java | 6 +- .../GridCacheReplicatedQuerySelfTest.java | 4 +- .../cache/jta/GridCacheJtaManager.java | 2 +- .../processors/cache/GridCacheJtaSelfTest.java | 2 +- .../cache/websession/GridWebSessionFilter.java | 2 +- 240 files changed, 6149 insertions(+), 6151 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/examples/src/main/java/org/gridgain/examples/datagrid/CacheTransactionExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/gridgain/examples/datagrid/CacheTransactionExample.java b/examples/src/main/java/org/gridgain/examples/datagrid/CacheTransactionExample.java index 3986ecb..3edaced 100644 --- a/examples/src/main/java/org/gridgain/examples/datagrid/CacheTransactionExample.java +++ b/examples/src/main/java/org/gridgain/examples/datagrid/CacheTransactionExample.java @@ -81,7 +81,7 @@ public class CacheTransactionExample { // Clone every object we get from cache, so we can freely update it. GridCacheProjection<Integer, Account> cache = Ignition.ignite().<Integer, Account>cache(CACHE_NAME).flagsOn(CLONE); - try (GridCacheTx tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTx tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) { Account acct = cache.get(acctId); assert acct != null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/examples/src/main/java/org/gridgain/examples/datagrid/store/CacheStoreExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/gridgain/examples/datagrid/store/CacheStoreExample.java b/examples/src/main/java/org/gridgain/examples/datagrid/store/CacheStoreExample.java index 7e434f4..57de2d5 100644 --- a/examples/src/main/java/org/gridgain/examples/datagrid/store/CacheStoreExample.java +++ b/examples/src/main/java/org/gridgain/examples/datagrid/store/CacheStoreExample.java @@ -46,7 +46,7 @@ public class CacheStoreExample { // Clean up caches on all nodes before run. cache.globalClearAll(0); - try (GridCacheTx tx = cache.txStart()) { + try (IgniteTx tx = cache.txStart()) { Person val = cache.get(id); System.out.println("Read value: " + val); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/examples/src/main/java/org/gridgain/examples/datagrid/store/dummy/CacheDummyPersonStore.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/gridgain/examples/datagrid/store/dummy/CacheDummyPersonStore.java b/examples/src/main/java/org/gridgain/examples/datagrid/store/dummy/CacheDummyPersonStore.java index 4a18c2a..0eed43e 100644 --- a/examples/src/main/java/org/gridgain/examples/datagrid/store/dummy/CacheDummyPersonStore.java +++ b/examples/src/main/java/org/gridgain/examples/datagrid/store/dummy/CacheDummyPersonStore.java @@ -37,21 +37,21 @@ public class CacheDummyPersonStore extends GridCacheStoreAdapter<Long, Person> { private Map<Long, Person> dummyDB = new ConcurrentHashMap<>(); /** {@inheritDoc} */ - @Override public Person load(@Nullable GridCacheTx tx, Long key) throws IgniteCheckedException { + @Override public Person load(@Nullable IgniteTx tx, Long key) throws IgniteCheckedException { System.out.println(">>> Store load [key=" + key + ", xid=" + (tx == null ? null : tx.xid()) + ']'); return dummyDB.get(key); } /** {@inheritDoc} */ - @Override public void put(@Nullable GridCacheTx tx, Long key, Person val) throws IgniteCheckedException { + @Override public void put(@Nullable IgniteTx tx, Long key, Person val) throws IgniteCheckedException { System.out.println(">>> Store put [key=" + key + ", val=" + val + ", xid=" + (tx == null ? null : tx.xid()) + ']'); dummyDB.put(key, val); } /** {@inheritDoc} */ - @Override public void remove(@Nullable GridCacheTx tx, Long key) throws IgniteCheckedException { + @Override public void remove(@Nullable IgniteTx tx, Long key) throws IgniteCheckedException { System.out.println(">>> Store remove [key=" + key + ", xid=" + (tx == null ? null : tx.xid()) + ']'); dummyDB.remove(key); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/examples/src/main/java/org/gridgain/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/gridgain/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java b/examples/src/main/java/org/gridgain/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java index ffd1f1f..5da7f9f 100644 --- a/examples/src/main/java/org/gridgain/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java +++ b/examples/src/main/java/org/gridgain/examples/datagrid/store/hibernate/CacheHibernatePersonStore.java @@ -42,7 +42,7 @@ public class CacheHibernatePersonStore extends GridCacheStoreAdapter<Long, Perso } /** {@inheritDoc} */ - @Override public Person load(@Nullable GridCacheTx tx, Long key) throws IgniteCheckedException { + @Override public Person load(@Nullable IgniteTx tx, Long key) throws IgniteCheckedException { System.out.println(">>> Store load [key=" + key + ", xid=" + (tx == null ? null : tx.xid()) + ']'); Session ses = session(tx); @@ -61,7 +61,7 @@ public class CacheHibernatePersonStore extends GridCacheStoreAdapter<Long, Perso } /** {@inheritDoc} */ - @Override public void put(@Nullable GridCacheTx tx, Long key, @Nullable Person val) + @Override public void put(@Nullable IgniteTx tx, Long key, @Nullable Person val) throws IgniteCheckedException { System.out.println(">>> Store put [key=" + key + ", val=" + val + ", xid=" + (tx == null ? null : tx.xid()) + ']'); @@ -88,7 +88,7 @@ public class CacheHibernatePersonStore extends GridCacheStoreAdapter<Long, Perso /** {@inheritDoc} */ @SuppressWarnings({"JpaQueryApiInspection"}) - @Override public void remove(@Nullable GridCacheTx tx, Long key) throws IgniteCheckedException { + @Override public void remove(@Nullable IgniteTx tx, Long key) throws IgniteCheckedException { System.out.println(">>> Store remove [key=" + key + ", xid=" + (tx == null ? null : tx.xid()) + ']'); Session ses = session(tx); @@ -149,7 +149,7 @@ public class CacheHibernatePersonStore extends GridCacheStoreAdapter<Long, Perso * @param ses Hibernate session. * @param tx Cache ongoing transaction. */ - private void rollback(Session ses, GridCacheTx tx) { + private void rollback(Session ses, IgniteTx tx) { // Rollback only if there is no cache transaction, // otherwise txEnd() will do all required work. if (tx == null) { @@ -166,7 +166,7 @@ public class CacheHibernatePersonStore extends GridCacheStoreAdapter<Long, Perso * @param ses Hibernate session. * @param tx Cache ongoing transaction. */ - private void end(Session ses, @Nullable GridCacheTx tx) { + private void end(Session ses, @Nullable IgniteTx tx) { // Commit only if there is no cache transaction, // otherwise txEnd() will do all required work. if (tx == null) { @@ -180,7 +180,7 @@ public class CacheHibernatePersonStore extends GridCacheStoreAdapter<Long, Perso } /** {@inheritDoc} */ - @Override public void txEnd(GridCacheTx tx, boolean commit) throws IgniteCheckedException { + @Override public void txEnd(IgniteTx tx, boolean commit) throws IgniteCheckedException { Session ses = tx.removeMeta(ATTR_SES); if (ses != null) { @@ -215,7 +215,7 @@ public class CacheHibernatePersonStore extends GridCacheStoreAdapter<Long, Perso * @param tx Cache transaction. * @return Session. */ - private Session session(@Nullable GridCacheTx tx) { + private Session session(@Nullable IgniteTx tx) { Session ses; if (tx != null) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/examples/src/main/java/org/gridgain/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/gridgain/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java b/examples/src/main/java/org/gridgain/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java index 69a9063..43f0f08 100644 --- a/examples/src/main/java/org/gridgain/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java +++ b/examples/src/main/java/org/gridgain/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java @@ -56,7 +56,7 @@ public class CacheJdbcPersonStore extends GridCacheStoreAdapter<Long, Person> { } /** {@inheritDoc} */ - @Override public void txEnd(GridCacheTx tx, boolean commit) throws IgniteCheckedException { + @Override public void txEnd(IgniteTx tx, boolean commit) throws IgniteCheckedException { try (Connection conn = tx.removeMeta(ATTR_NAME)) { if (conn != null) { if (commit) @@ -73,7 +73,7 @@ public class CacheJdbcPersonStore extends GridCacheStoreAdapter<Long, Person> { } /** {@inheritDoc} */ - @Nullable @Override public Person load(@Nullable GridCacheTx tx, Long key) throws IgniteCheckedException { + @Nullable @Override public Person load(@Nullable IgniteTx tx, Long key) throws IgniteCheckedException { System.out.println(">>> Store load [key=" + key + ", xid=" + (tx == null ? null : tx.xid()) + ']'); Connection conn = null; @@ -101,7 +101,7 @@ public class CacheJdbcPersonStore extends GridCacheStoreAdapter<Long, Person> { } /** {@inheritDoc} */ - @Override public void put(@Nullable GridCacheTx tx, Long key, Person val) + @Override public void put(@Nullable IgniteTx tx, Long key, Person val) throws IgniteCheckedException { System.out.println(">>> Store put [key=" + key + ", val=" + val + ", xid=" + (tx == null ? null : tx.xid()) + ']'); @@ -142,7 +142,7 @@ public class CacheJdbcPersonStore extends GridCacheStoreAdapter<Long, Person> { } /** {@inheritDoc} */ - @Override public void remove(@Nullable GridCacheTx tx, Long key) throws IgniteCheckedException { + @Override public void remove(@Nullable IgniteTx tx, Long key) throws IgniteCheckedException { System.out.println(">>> Store remove [key=" + key + ", xid=" + (tx == null ? null : tx.xid()) + ']'); Connection conn = null; @@ -205,7 +205,7 @@ public class CacheJdbcPersonStore extends GridCacheStoreAdapter<Long, Person> { * @return Connection. * @throws SQLException In case of error. */ - private Connection connection(@Nullable GridCacheTx tx) throws SQLException { + private Connection connection(@Nullable IgniteTx tx) throws SQLException { if (tx != null) { Connection conn = tx.meta(ATTR_NAME); @@ -230,7 +230,7 @@ public class CacheJdbcPersonStore extends GridCacheStoreAdapter<Long, Person> { * @param tx Active transaction, if any. * @param conn Allocated connection. */ - private void end(@Nullable GridCacheTx tx, @Nullable Connection conn) { + private void end(@Nullable IgniteTx tx, @Nullable Connection conn) { if (tx == null && conn != null) { // Close connection right away if there is no transaction. try { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/clients/src/test/java/org/gridgain/client/GridHashMapStore.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/gridgain/client/GridHashMapStore.java b/modules/clients/src/test/java/org/gridgain/client/GridHashMapStore.java index 86f9671..b18c6af 100644 --- a/modules/clients/src/test/java/org/gridgain/client/GridHashMapStore.java +++ b/modules/clients/src/test/java/org/gridgain/client/GridHashMapStore.java @@ -32,19 +32,19 @@ public class GridHashMapStore extends GridCacheStoreAdapter { } /** {@inheritDoc} */ - @Override public Object load(@Nullable GridCacheTx tx, Object key) + @Override public Object load(@Nullable IgniteTx tx, Object key) throws IgniteCheckedException { return map.get(key); } /** {@inheritDoc} */ - @Override public void put(@Nullable GridCacheTx tx, Object key, + @Override public void put(@Nullable IgniteTx tx, Object key, @Nullable Object val) throws IgniteCheckedException { map.put(key, val); } /** {@inheritDoc} */ - @Override public void remove(@Nullable GridCacheTx tx, Object key) + @Override public void remove(@Nullable IgniteTx tx, Object key) throws IgniteCheckedException { map.remove(key); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/clients/src/test/java/org/gridgain/client/integration/GridClientAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/gridgain/client/integration/GridClientAbstractSelfTest.java b/modules/clients/src/test/java/org/gridgain/client/integration/GridClientAbstractSelfTest.java index f985c7b..4bd26f7 100644 --- a/modules/clients/src/test/java/org/gridgain/client/integration/GridClientAbstractSelfTest.java +++ b/modules/clients/src/test/java/org/gridgain/client/integration/GridClientAbstractSelfTest.java @@ -1569,19 +1569,19 @@ public abstract class GridClientAbstractSelfTest extends GridCommonAbstractTest } /** {@inheritDoc} */ - @Override public Object load(@Nullable GridCacheTx tx, Object key) + @Override public Object load(@Nullable IgniteTx tx, Object key) throws IgniteCheckedException { return map.get(key); } /** {@inheritDoc} */ - @Override public void put(@Nullable GridCacheTx tx, Object key, + @Override public void put(@Nullable IgniteTx tx, Object key, @Nullable Object val) throws IgniteCheckedException { map.put(key, val); } /** {@inheritDoc} */ - @Override public void remove(@Nullable GridCacheTx tx, Object key) + @Override public void remove(@Nullable IgniteTx tx, Object key) throws IgniteCheckedException { map.remove(key); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/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 0f7bef7..48a601e 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java @@ -118,14 +118,14 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS * the value will be loaded from the primary node, which in its turn may load the value * from the swap storage, and consecutively, if it's not in swap, * from the underlying persistent storage. If value has to be loaded from persistent - * storage, {@link org.gridgain.grid.cache.store.GridCacheStore#load(GridCacheTx, Object)} method will be used. + * storage, {@link org.gridgain.grid.cache.store.GridCacheStore#load(IgniteTx, Object)} method will be used. * <p> * If the returned value is not needed, method {@link #putIfAbsent(Object, Object)} should * always be used instead of this one to avoid the overhead associated with returning of the * previous value. * <p> * If write-through is enabled, the stored value will be persisted to {@link org.gridgain.grid.cache.store.GridCacheStore} - * via {@link org.gridgain.grid.cache.store.GridCacheStore#put(GridCacheTx, Object, Object)} method. + * via {@link org.gridgain.grid.cache.store.GridCacheStore#put(IgniteTx, Object, Object)} method. * <h2 class="header">Transactions</h2> * This method is transactional and will enlist the entry into ongoing transaction * if there is one. @@ -153,7 +153,7 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS * other concurrent transactional updates. * <p> * If write-through is enabled, the values will be removed from {@link org.gridgain.grid.cache.store.GridCacheStore} - * via {@link org.gridgain.grid.cache.store.GridCacheStore#removeAll(GridCacheTx, java.util.Collection)} method. + * via {@link org.gridgain.grid.cache.store.GridCacheStore#removeAll(IgniteTx, java.util.Collection)} method. * <h2 class="header">Transactions</h2> * This method is transactional and will enlist the entry into ongoing transaction * if there is one. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/main/java/org/apache/ignite/IgniteTransactions.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteTransactions.java b/modules/core/src/main/java/org/apache/ignite/IgniteTransactions.java index 837255d..e759308 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteTransactions.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteTransactions.java @@ -26,7 +26,7 @@ public interface IgniteTransactions { * @throws IllegalStateException If transaction is already started by this thread. * @throws UnsupportedOperationException If cache is {@link GridCacheAtomicityMode#ATOMIC}. */ - public GridCacheTx txStart() throws IllegalStateException; + public IgniteTx txStart() throws IllegalStateException; /** * Starts new transaction with the specified concurrency and isolation. @@ -37,7 +37,7 @@ public interface IgniteTransactions { * @throws IllegalStateException If transaction is already started by this thread. * @throws UnsupportedOperationException If cache is {@link GridCacheAtomicityMode#ATOMIC}. */ - public GridCacheTx txStart(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation); + public IgniteTx txStart(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation); /** * Starts transaction with specified isolation, concurrency, timeout, invalidation flag, @@ -51,7 +51,7 @@ public interface IgniteTransactions { * @throws IllegalStateException If transaction is already started by this thread. * @throws UnsupportedOperationException If cache is {@link GridCacheAtomicityMode#ATOMIC}. */ - public GridCacheTx txStart(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation, long timeout, + public IgniteTx txStart(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation, long timeout, int txSize); /** @@ -87,7 +87,7 @@ public interface IgniteTransactions { * @throws IgniteCheckedException If local node is not primary for any of provided keys. * @throws UnsupportedOperationException If cache is {@link GridCacheAtomicityMode#ATOMIC}. */ - public GridCacheTx txStartAffinity(String cacheName, Object affinityKey, GridCacheTxConcurrency concurrency, + public IgniteTx txStartAffinity(String cacheName, Object affinityKey, GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation, long timeout, int txSize) throws IllegalStateException, IgniteCheckedException; /** @@ -123,7 +123,7 @@ public interface IgniteTransactions { * @throws IgniteCheckedException If local node is not primary for any of provided keys. * @throws UnsupportedOperationException If cache is {@link GridCacheAtomicityMode#ATOMIC}. */ - public GridCacheTx txStartPartition(String cacheName, int partId, GridCacheTxConcurrency concurrency, + public IgniteTx txStartPartition(String cacheName, int partId, GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation, long timeout, int txSize) throws IllegalStateException, IgniteCheckedException; /** @@ -133,7 +133,7 @@ public interface IgniteTransactions { * @return Transaction started by this thread or {@code null} if this thread * does not have a transaction. */ - @Nullable public GridCacheTx tx(); + @Nullable public IgniteTx tx(); /** * @return Transaction metrics. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/main/java/org/apache/ignite/cache/CacheFlag.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheFlag.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheFlag.java index 4ddbceb..cd5b58c 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/CacheFlag.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheFlag.java @@ -36,7 +36,7 @@ public enum CacheFlag { * Instead of updating remote entries with new values, small invalidation * messages will be sent to set the values to {@code null}. * - * @see GridCacheTx#isInvalidate() + * @see IgniteTx#isInvalidate() * @see org.gridgain.grid.cache.GridCacheConfiguration#isInvalidate() */ INVALIDATE, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/main/java/org/apache/ignite/configuration/TransactionsConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/TransactionsConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/TransactionsConfiguration.java index 0ae9250..fea4ffa 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/TransactionsConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/TransactionsConfiguration.java @@ -92,7 +92,7 @@ public class TransactionsConfiguration { * specified. Default value is defined by {@link #DFLT_TX_CONCURRENCY}. * * @return Default cache transaction concurrency. - * @see GridCacheTx + * @see IgniteTx */ public GridCacheTxConcurrency getDefaultTxConcurrency() { return dfltConcurrency; @@ -112,7 +112,7 @@ public class TransactionsConfiguration { * specified. Default value is defined by {@link #DFLT_TX_ISOLATION}. * * @return Default cache transaction isolation. - * @see GridCacheTx + * @see IgniteTx */ public GridCacheTxIsolation getDefaultTxIsolation() { return dfltIsolation; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTx.java b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTx.java deleted file mode 100644 index 9a8341f..0000000 --- a/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTx.java +++ /dev/null @@ -1,244 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.apache.ignite.transactions; - -import org.apache.ignite.*; -import org.apache.ignite.lang.*; -import org.gridgain.grid.*; -import org.gridgain.grid.cache.*; - -import java.util.*; - -/** - * Grid cache transaction. Cache transactions have a default 2PC (two-phase-commit) behavior and - * can be plugged into ongoing {@code JTA} transaction by properly implementing - * {@gglink org.gridgain.grid.cache.jta.GridCacheTmLookup} - * interface. Cache transactions can also be started explicitly directly from {@link GridCacheProjection} API - * via any of the {@code 'GridCacheProjection.txStart(..)'} methods. - * <p> - * Cache transactions support the following isolation levels: - * <ul> - * <li> - * {@link GridCacheTxIsolation#READ_COMMITTED} isolation level means that always a committed value - * will be provided for read operations. With this isolation level values are always read - * from cache global memory or persistent store every time a value is accessed. In other words, - * if the same key is accessed more than once within the same transaction, it may have different - * value every time since global cache memory may be updated concurrently by other threads. - * </li> - * <li> - * {@link GridCacheTxIsolation#REPEATABLE_READ} isolation level means that if a value was read once - * within transaction, then all consecutive reads will provide the same in-transaction value. With - * this isolation level accessed values are stored within in-transaction memory, so consecutive access - * to the same key within the same transaction will always return the value that was previously read or - * updated within this transaction. If concurrency is {@link GridCacheTxConcurrency#PESSIMISTIC}, then a lock - * on the key will be acquired prior to accessing the value. - * </li> - * <li> - * {@link GridCacheTxIsolation#SERIALIZABLE} isolation level means that all transactions occur in a completely - * isolated fashion, as if all transactions in the system had executed serially, one after the other. - * Read access with this level happens the same way as with {@link GridCacheTxIsolation#REPEATABLE_READ} level. - * However, in {@link GridCacheTxConcurrency#OPTIMISTIC} mode, if some transactions cannot be serially isolated - * from each other, then one winner will be picked and the other transactions in conflict will result in - * {@link GridCacheTxOptimisticException} being thrown. - * </li> - * </ul> - * <p> - * Cache transactions support the following concurrency models: - * <ul> - * <li> - * {@link GridCacheTxConcurrency#OPTIMISTIC} - in this mode all cache operations are not distributed to other - * nodes until {@link #commit()} or {@link #commitAsync()} are called. In this mode one {@code 'PREPARE'} - * message will be sent to participating cache nodes to start acquiring per-transaction locks, and once - * all nodes reply {@code 'OK'} (i.e. {@code Phase 1} completes successfully), a one-way' {@code 'COMMIT'} - * message is sent without waiting for reply. If it is necessary to know whenever remote nodes have committed - * as well, synchronous commit or synchronous rollback should be enabled via - * {@link GridCacheConfiguration#setWriteSynchronizationMode} - * or by setting proper flags on cache projection, such as {@link GridCacheFlag#SYNC_COMMIT}. - * <p> - * Note that in this mode, optimistic failures are only possible in conjunction with - * {@link GridCacheTxIsolation#SERIALIZABLE} isolation level. In all other cases, optimistic - * transactions will never fail optimistically and will always be identically ordered on all participating - * grid nodes. - * </li> - * <li> - * {@link GridCacheTxConcurrency#PESSIMISTIC} - in this mode a lock is acquired on all cache operations - * with exception of read operations in {@link GridCacheTxIsolation#READ_COMMITTED} mode. All optional filters - * passed into cache operations will be evaluated after successful lock acquisition. Whenever - * {@link #commit()} or {@link #commitAsync()} is called, a single one-way {@code 'COMMIT'} message - * is sent to participating cache nodes without waiting for reply. Note that there is no reason for - * distributed 'PREPARE' step, as all locks have been already acquired. Just like with optimistic mode, - * it is possible to configure synchronous commit or rollback and wait till transaction commits on - * all participating remote nodes. - * </li> - * </ul> - * <p> - * <h1 class="header">Cache Atomicity Mode</h1> - * In addition to standard {@link GridCacheAtomicityMode#TRANSACTIONAL} behavior, GridGain also supports - * a lighter {@link GridCacheAtomicityMode#ATOMIC} mode as well. In this mode distributed transactions - * and distributed locking are not supported. Disabling transactions and locking allows to achieve much higher - * performance and throughput ratios. It is recommended that {@link GridCacheAtomicityMode#ATOMIC} mode - * is used whenever full {@code ACID}-compliant transactions are not needed. - * <p> - * <h1 class="header">Usage</h1> - * You can use cache transactions as follows: - * <pre name="code" class="java"> - * GridCache<String, Integer> cache = GridGain.grid().cache(); - * - * try (GridCacheTx tx = cache.txStart()) { - * // Perform transactional operations. - * Integer v1 = cache.get("k1"); - * - * // Check if v1 satisfies some condition before doing a put. - * if (v1 != null && v1 > 0) - * cache.putx("k1", 2); - * - * cache.removex("k2"); - * - * // Commit the transaction. - * tx.commit(); - * } - * </pre> - */ -public interface GridCacheTx extends GridMetadataAware, AutoCloseable { - /** - * Gets unique identifier for this transaction. - * - * @return Transaction UID. - */ - public IgniteUuid xid(); - - /** - * ID of the node on which this transaction started. - * - * @return Originating node ID. - */ - public UUID nodeId(); - - /** - * ID of the thread in which this transaction started. - * - * @return Thread ID. - */ - public long threadId(); - - /** - * Start time of this transaction. - * - * @return Start time of this transaction on this node. - */ - public long startTime(); - - /** - * Cache transaction isolation level. - * - * @return Isolation level. - */ - public GridCacheTxIsolation isolation(); - - /** - * Cache transaction concurrency mode. - * - * @return Concurrency mode. - */ - public GridCacheTxConcurrency concurrency(); - - /** - * Flag indicating whether transaction was started automatically by the - * system or not. System will start transactions implicitly whenever - * any cache {@code put(..)} or {@code remove(..)} operation is invoked - * outside of transaction. - * - * @return {@code True} if transaction was started implicitly. - */ - public boolean implicit(); - - /** - * Get invalidation flag for this transaction. If set to {@code true}, then - * remote values will be {@code invalidated} (set to {@code null}) instead - * of updated. - * <p> - * Invalidation messages don't carry new values, so they are a lot lighter - * than update messages. However, when a value is accessed on a node after - * it's been invalidated, it must be loaded from persistent store. - * - * @return Invalidation flag. - */ - public boolean isInvalidate(); - - /** - * Gets current transaction state value. - * - * @return Current transaction state. - */ - public GridCacheTxState state(); - - /** - * Gets timeout value in milliseconds for this transaction. If transaction times - * out prior to it's completion, {@link GridCacheTxTimeoutException} will be thrown. - * - * @return Transaction timeout value. - */ - public long timeout(); - - /** - * Sets transaction timeout value. This value can be set only before a first operation - * on transaction has been performed. - * - * @param timeout Transaction timeout value. - * @return Previous timeout. - */ - public long timeout(long timeout); - - /** - * Modify the transaction associated with the current thread such that the - * only possible outcome of the transaction is to roll back the - * transaction. - * - * @return {@code True} if rollback-only flag was set as a result of this operation, - * {@code false} if it was already set prior to this call or could not be set - * because transaction is already finishing up committing or rolling back. - */ - public boolean setRollbackOnly(); - - /** - * If transaction was marked as rollback-only. - * - * @return {@code True} if transaction can only be rolled back. - */ - public boolean isRollbackOnly(); - - /** - * Commits this transaction by initiating {@code two-phase-commit} process. - * - * @throws IgniteCheckedException If commit failed. - */ - public void commit() throws IgniteCheckedException; - - /** - * Ends the transaction. Transaction will be rolled back if it has not been committed. - * - * @throws IgniteCheckedException If transaction could not be gracefully ended. - */ - @Override public void close() throws IgniteCheckedException; - - /** - * Asynchronously commits this transaction by initiating {@code two-phase-commit} process. - * - * @return Future for commit operation. - */ - public IgniteFuture<GridCacheTx> commitAsync(); - - /** - * Rolls back this transaction. - * - * @throws IgniteCheckedException If rollback failed. - */ - public void rollback() throws IgniteCheckedException; -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxConcurrency.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxConcurrency.java b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxConcurrency.java index 4f723d9..7d0ad4c 100644 --- a/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxConcurrency.java +++ b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxConcurrency.java @@ -12,7 +12,7 @@ package org.apache.ignite.transactions; import org.jetbrains.annotations.Nullable; /** - * Transaction concurrency control. See {@link GridCacheTx} for more information + * Transaction concurrency control. See {@link IgniteTx} for more information * on transaction concurrency controls. */ public enum GridCacheTxConcurrency { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxIsolation.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxIsolation.java b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxIsolation.java index 3894a63..1644178 100644 --- a/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxIsolation.java +++ b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxIsolation.java @@ -12,7 +12,7 @@ package org.apache.ignite.transactions; import org.jetbrains.annotations.*; /** - * Defines different cache transaction isolation levels. See {@link GridCacheTx} + * Defines different cache transaction isolation levels. See {@link IgniteTx} * documentation for more information about cache transaction isolation levels. */ public enum GridCacheTxIsolation { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxSynchronization.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxSynchronization.java b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxSynchronization.java index d88714c..5e72f2c 100644 --- a/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxSynchronization.java +++ b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxSynchronization.java @@ -21,18 +21,18 @@ public interface GridCacheTxSynchronization { /** * State change callback for transaction. Note that unless transaction has been * completed, it is possible to mark it for <tt>rollbackOnly</tt> by calling - * {@link GridCacheTx#setRollbackOnly()} on the passed in transaction. - * You can check the return value of {@link GridCacheTx#setRollbackOnly() setRollbackOnly()} + * {@link IgniteTx#setRollbackOnly()} on the passed in transaction. + * You can check the return value of {@link IgniteTx#setRollbackOnly() setRollbackOnly()} * method to see if transaction was indeed marked for rollback or not. * * @param prevState Previous state of the transaction. If transaction has just been * started, then previous state is {@code null}. * @param newState New state of the transaction. In majority of the cases this will be the - * same as {@link GridCacheTx#state() tx.state()}, but it is also possible + * same as {@link IgniteTx#state() tx.state()}, but it is also possible * that transaction may be marked for rollback concurrently with this method * invocation, and in that case <tt>newState</tt> reflects the actual state of the * transition this callback is associated with. * @param tx Transaction whose state has changed. */ - public void onStateChanged(@Nullable GridCacheTxState prevState, GridCacheTxState newState, GridCacheTx tx); + public void onStateChanged(@Nullable GridCacheTxState prevState, GridCacheTxState newState, IgniteTx tx); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java b/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java new file mode 100644 index 0000000..ec6cbbb --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java @@ -0,0 +1,244 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.apache.ignite.transactions; + +import org.apache.ignite.*; +import org.apache.ignite.lang.*; +import org.gridgain.grid.*; +import org.gridgain.grid.cache.*; + +import java.util.*; + +/** + * Grid cache transaction. Cache transactions have a default 2PC (two-phase-commit) behavior and + * can be plugged into ongoing {@code JTA} transaction by properly implementing + * {@gglink org.gridgain.grid.cache.jta.GridCacheTmLookup} + * interface. Cache transactions can also be started explicitly directly from {@link GridCacheProjection} API + * via any of the {@code 'GridCacheProjection.txStart(..)'} methods. + * <p> + * Cache transactions support the following isolation levels: + * <ul> + * <li> + * {@link GridCacheTxIsolation#READ_COMMITTED} isolation level means that always a committed value + * will be provided for read operations. With this isolation level values are always read + * from cache global memory or persistent store every time a value is accessed. In other words, + * if the same key is accessed more than once within the same transaction, it may have different + * value every time since global cache memory may be updated concurrently by other threads. + * </li> + * <li> + * {@link GridCacheTxIsolation#REPEATABLE_READ} isolation level means that if a value was read once + * within transaction, then all consecutive reads will provide the same in-transaction value. With + * this isolation level accessed values are stored within in-transaction memory, so consecutive access + * to the same key within the same transaction will always return the value that was previously read or + * updated within this transaction. If concurrency is {@link GridCacheTxConcurrency#PESSIMISTIC}, then a lock + * on the key will be acquired prior to accessing the value. + * </li> + * <li> + * {@link GridCacheTxIsolation#SERIALIZABLE} isolation level means that all transactions occur in a completely + * isolated fashion, as if all transactions in the system had executed serially, one after the other. + * Read access with this level happens the same way as with {@link GridCacheTxIsolation#REPEATABLE_READ} level. + * However, in {@link GridCacheTxConcurrency#OPTIMISTIC} mode, if some transactions cannot be serially isolated + * from each other, then one winner will be picked and the other transactions in conflict will result in + * {@link GridCacheTxOptimisticException} being thrown. + * </li> + * </ul> + * <p> + * Cache transactions support the following concurrency models: + * <ul> + * <li> + * {@link GridCacheTxConcurrency#OPTIMISTIC} - in this mode all cache operations are not distributed to other + * nodes until {@link #commit()} or {@link #commitAsync()} are called. In this mode one {@code 'PREPARE'} + * message will be sent to participating cache nodes to start acquiring per-transaction locks, and once + * all nodes reply {@code 'OK'} (i.e. {@code Phase 1} completes successfully), a one-way' {@code 'COMMIT'} + * message is sent without waiting for reply. If it is necessary to know whenever remote nodes have committed + * as well, synchronous commit or synchronous rollback should be enabled via + * {@link GridCacheConfiguration#setWriteSynchronizationMode} + * or by setting proper flags on cache projection, such as {@link GridCacheFlag#SYNC_COMMIT}. + * <p> + * Note that in this mode, optimistic failures are only possible in conjunction with + * {@link GridCacheTxIsolation#SERIALIZABLE} isolation level. In all other cases, optimistic + * transactions will never fail optimistically and will always be identically ordered on all participating + * grid nodes. + * </li> + * <li> + * {@link GridCacheTxConcurrency#PESSIMISTIC} - in this mode a lock is acquired on all cache operations + * with exception of read operations in {@link GridCacheTxIsolation#READ_COMMITTED} mode. All optional filters + * passed into cache operations will be evaluated after successful lock acquisition. Whenever + * {@link #commit()} or {@link #commitAsync()} is called, a single one-way {@code 'COMMIT'} message + * is sent to participating cache nodes without waiting for reply. Note that there is no reason for + * distributed 'PREPARE' step, as all locks have been already acquired. Just like with optimistic mode, + * it is possible to configure synchronous commit or rollback and wait till transaction commits on + * all participating remote nodes. + * </li> + * </ul> + * <p> + * <h1 class="header">Cache Atomicity Mode</h1> + * In addition to standard {@link GridCacheAtomicityMode#TRANSACTIONAL} behavior, GridGain also supports + * a lighter {@link GridCacheAtomicityMode#ATOMIC} mode as well. In this mode distributed transactions + * and distributed locking are not supported. Disabling transactions and locking allows to achieve much higher + * performance and throughput ratios. It is recommended that {@link GridCacheAtomicityMode#ATOMIC} mode + * is used whenever full {@code ACID}-compliant transactions are not needed. + * <p> + * <h1 class="header">Usage</h1> + * You can use cache transactions as follows: + * <pre name="code" class="java"> + * GridCache<String, Integer> cache = GridGain.grid().cache(); + * + * try (GridCacheTx tx = cache.txStart()) { + * // Perform transactional operations. + * Integer v1 = cache.get("k1"); + * + * // Check if v1 satisfies some condition before doing a put. + * if (v1 != null && v1 > 0) + * cache.putx("k1", 2); + * + * cache.removex("k2"); + * + * // Commit the transaction. + * tx.commit(); + * } + * </pre> + */ +public interface IgniteTx extends GridMetadataAware, AutoCloseable { + /** + * Gets unique identifier for this transaction. + * + * @return Transaction UID. + */ + public IgniteUuid xid(); + + /** + * ID of the node on which this transaction started. + * + * @return Originating node ID. + */ + public UUID nodeId(); + + /** + * ID of the thread in which this transaction started. + * + * @return Thread ID. + */ + public long threadId(); + + /** + * Start time of this transaction. + * + * @return Start time of this transaction on this node. + */ + public long startTime(); + + /** + * Cache transaction isolation level. + * + * @return Isolation level. + */ + public GridCacheTxIsolation isolation(); + + /** + * Cache transaction concurrency mode. + * + * @return Concurrency mode. + */ + public GridCacheTxConcurrency concurrency(); + + /** + * Flag indicating whether transaction was started automatically by the + * system or not. System will start transactions implicitly whenever + * any cache {@code put(..)} or {@code remove(..)} operation is invoked + * outside of transaction. + * + * @return {@code True} if transaction was started implicitly. + */ + public boolean implicit(); + + /** + * Get invalidation flag for this transaction. If set to {@code true}, then + * remote values will be {@code invalidated} (set to {@code null}) instead + * of updated. + * <p> + * Invalidation messages don't carry new values, so they are a lot lighter + * than update messages. However, when a value is accessed on a node after + * it's been invalidated, it must be loaded from persistent store. + * + * @return Invalidation flag. + */ + public boolean isInvalidate(); + + /** + * Gets current transaction state value. + * + * @return Current transaction state. + */ + public GridCacheTxState state(); + + /** + * Gets timeout value in milliseconds for this transaction. If transaction times + * out prior to it's completion, {@link GridCacheTxTimeoutException} will be thrown. + * + * @return Transaction timeout value. + */ + public long timeout(); + + /** + * Sets transaction timeout value. This value can be set only before a first operation + * on transaction has been performed. + * + * @param timeout Transaction timeout value. + * @return Previous timeout. + */ + public long timeout(long timeout); + + /** + * Modify the transaction associated with the current thread such that the + * only possible outcome of the transaction is to roll back the + * transaction. + * + * @return {@code True} if rollback-only flag was set as a result of this operation, + * {@code false} if it was already set prior to this call or could not be set + * because transaction is already finishing up committing or rolling back. + */ + public boolean setRollbackOnly(); + + /** + * If transaction was marked as rollback-only. + * + * @return {@code True} if transaction can only be rolled back. + */ + public boolean isRollbackOnly(); + + /** + * Commits this transaction by initiating {@code two-phase-commit} process. + * + * @throws IgniteCheckedException If commit failed. + */ + public void commit() throws IgniteCheckedException; + + /** + * Ends the transaction. Transaction will be rolled back if it has not been committed. + * + * @throws IgniteCheckedException If transaction could not be gracefully ended. + */ + @Override public void close() throws IgniteCheckedException; + + /** + * Asynchronously commits this transaction by initiating {@code two-phase-commit} process. + * + * @return Future for commit operation. + */ + public IgniteFuture<IgniteTx> commitAsync(); + + /** + * Rolls back this transaction. + * + * @throws IgniteCheckedException If rollback failed. + */ + public void rollback() throws IgniteCheckedException; +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheAtomicityMode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheAtomicityMode.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheAtomicityMode.java index 2156adb..f599a14 100644 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheAtomicityMode.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheAtomicityMode.java @@ -24,7 +24,7 @@ import org.jetbrains.annotations.*; public enum GridCacheAtomicityMode { /** * Specified fully {@code ACID}-compliant transactional cache behavior. See - * {@link GridCacheTx} for more information about transactions. + * {@link IgniteTx} for more information about transactions. * <p> * This mode is currently the default cache atomicity mode. However, cache * atomicity mode will be changed to {@link #ATOMIC} starting from version {@code 5.2}, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheConfiguration.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheConfiguration.java index eda8846..78b7635 100644 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheConfiguration.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheConfiguration.java @@ -1252,8 +1252,8 @@ public class GridCacheConfiguration extends MutableConfiguration { /** * Maximum batch size for write-behind cache store operations. Store operations (get or remove) * are combined in a batch of this size to be passed to - * {@link GridCacheStore#putAll(GridCacheTx, Map)} or - * {@link GridCacheStore#removeAll(GridCacheTx, Collection)} methods. + * {@link GridCacheStore#putAll(IgniteTx, Map)} or + * {@link GridCacheStore#removeAll(IgniteTx, Collection)} methods. * <p/> * If not provided, default value is {@link #DFLT_WRITE_BEHIND_BATCH_SIZE}. * http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheEntry.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheEntry.java index bd23d53..6949dba 100644 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheEntry.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheEntry.java @@ -74,7 +74,7 @@ import java.util.Map.*; * Cache API supports distributed transactions. All {@code 'get(..)'}, {@code 'put(..)'}, {@code 'replace(..)'}, * and {@code 'remove(..)'} operations are transactional and will participate in an ongoing transaction. * Other methods like {@code 'peek(..)'} may be transaction-aware, i.e. check in-transaction entries first, but - * will not affect the current state of transaction. See {@link GridCacheTx} documentation for more information + * will not affect the current state of transaction. See {@link IgniteTx} documentation for more information * about transactions. * @param <K> Key type. * @param <V> Value type. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheFlag.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheFlag.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheFlag.java index 77f38e5..d57d7f7 100644 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheFlag.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheFlag.java @@ -70,7 +70,7 @@ public enum GridCacheFlag { * Instead of updating remote entries with new values, small invalidation * messages will be sent to set the values to {@code null}. * - * @see GridCacheTx#isInvalidate() + * @see IgniteTx#isInvalidate() * @see GridCacheConfiguration#isInvalidate() */ INVALIDATE,