You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2014/12/22 00:04:03 UTC
[10/46] incubator-ignite git commit: GG-9141 - Renaming.
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/12b08c99
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/12b08c99
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/12b08c99
Branch: refs/heads/ignite-1
Commit: 12b08c99c92581be1f91c451edfbfb8677933c8f
Parents: 4caf233
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Fri Dec 19 17:37:09 2014 -0800
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Fri Dec 19 17:37:10 2014 -0800
----------------------------------------------------------------------
.../datagrid/CacheTransactionExample.java | 6 +-
.../datagrid/store/CacheStoreExample.java | 2 +-
.../store/dummy/CacheDummyPersonStore.java | 2 +-
.../hibernate/CacheHibernatePersonStore.java | 2 +-
.../store/jdbc/CacheJdbcPersonStore.java | 2 +-
.../org/gridgain/client/GridHashMapStore.java | 2 +-
.../integration/GridClientAbstractSelfTest.java | 1 +
.../java/org/apache/ignite/IgniteCache.java | 8 +-
.../org/apache/ignite/IgniteTransactions.java | 1 +
.../java/org/apache/ignite/cache/CacheFlag.java | 3 +-
.../configuration/IgniteConfiguration.java | 6 +-
.../TransactionsConfiguration.java | 192 +++++++++++++++
.../org/apache/ignite/lang/IgniteFuture.java | 2 +-
.../communication/tcp/TcpCommunicationSpi.java | 2 +-
.../apache/ignite/transactions/GridCacheTx.java | 244 +++++++++++++++++++
.../transactions/GridCacheTxConcurrency.java | 37 +++
.../GridCacheTxHeuristicException.java | 43 ++++
.../transactions/GridCacheTxIsolation.java | 41 ++++
.../GridCacheTxOptimisticException.java | 39 +++
.../GridCacheTxRollbackException.java | 39 +++
.../ignite/transactions/GridCacheTxState.java | 57 +++++
.../GridCacheTxSynchronization.java | 38 +++
.../GridCacheTxTimeoutException.java | 39 +++
.../ignite/transactions/IgniteTxMetrics.java | 45 ++++
.../transactions/IgniteTxMetricsAdapter.java | 107 ++++++++
.../java/org/gridgain/grid/cache/GridCache.java | 1 +
.../grid/cache/GridCacheAtomicityMode.java | 1 +
.../grid/cache/GridCacheConfiguration.java | 1 +
.../org/gridgain/grid/cache/GridCacheEntry.java | 1 +
.../org/gridgain/grid/cache/GridCacheFlag.java | 1 +
.../grid/cache/GridCacheProjection.java | 1 +
.../org/gridgain/grid/cache/GridCacheTx.java | 243 ------------------
.../grid/cache/GridCacheTxConcurrency.java | 37 ---
.../cache/GridCacheTxHeuristicException.java | 43 ----
.../grid/cache/GridCacheTxIsolation.java | 41 ----
.../cache/GridCacheTxOptimisticException.java | 39 ---
.../cache/GridCacheTxRollbackException.java | 39 ---
.../gridgain/grid/cache/GridCacheTxState.java | 57 -----
.../grid/cache/GridCacheTxSynchronization.java | 37 ---
.../grid/cache/GridCacheTxTimeoutException.java | 39 ---
.../GridCacheWriteSynchronizationMode.java | 1 +
.../cache/GridTransactionsConfiguration.java | 190 ---------------
.../gridgain/grid/cache/IgniteTxMetrics.java | 45 ----
.../grid/cache/IgniteTxMetricsAdapter.java | 107 --------
.../store/GridCacheLoadOnlyStoreAdapter.java | 2 +-
.../grid/cache/store/GridCacheStore.java | 1 +
.../grid/cache/store/GridCacheStoreAdapter.java | 1 +
.../store/GridCacheStoreBalancingWrapper.java | 2 +-
.../store/jdbc/GridCacheJdbcBlobStore.java | 3 +-
.../org/gridgain/grid/kernal/GridGainEx.java | 2 +-
.../grid/kernal/GridNodeAttributes.java | 3 +
.../grid/kernal/IgniteTransactionsEx.java | 1 +
.../processors/cache/GridCacheAdapter.java | 11 +-
.../processors/cache/GridCacheEventManager.java | 2 +-
.../processors/cache/GridCacheMapEntry.java | 2 +-
.../cache/GridCacheMultiTxFuture.java | 2 +-
.../processors/cache/GridCacheProcessor.java | 27 +-
.../processors/cache/GridCacheProjectionEx.java | 1 +
.../cache/GridCacheProjectionImpl.java | 1 +
.../processors/cache/GridCacheProxyImpl.java | 1 +
.../cache/GridCacheSharedContext.java | 3 +-
.../processors/cache/GridCacheStoreManager.java | 2 +-
.../processors/cache/GridCacheTxAdapter.java | 8 +-
.../kernal/processors/cache/GridCacheTxEx.java | 1 +
.../processors/cache/GridCacheTxHandler.java | 8 +-
.../cache/GridCacheTxLocalAdapter.java | 3 +-
.../processors/cache/GridCacheTxManager.java | 6 +-
.../processors/cache/GridCacheTxProxy.java | 2 +-
.../processors/cache/GridCacheTxProxyImpl.java | 2 +-
.../kernal/processors/cache/GridCacheUtils.java | 1 +
.../cache/GridCacheWriteBehindStore.java | 1 +
.../datastructures/GridCacheAtomicLongImpl.java | 5 +-
.../GridCacheAtomicReferenceImpl.java | 6 +-
.../GridCacheAtomicSequenceImpl.java | 6 +-
.../GridCacheAtomicStampedImpl.java | 6 +-
.../GridCacheCountDownLatchImpl.java | 6 +-
.../GridCacheDataStructuresManager.java | 6 +-
.../GridTransactionalCacheQueueImpl.java | 6 +-
.../GridDistributedCacheAdapter.java | 1 +
.../distributed/GridDistributedLockRequest.java | 2 +-
.../GridDistributedTxPrepareRequest.java | 2 +-
.../GridDistributedTxRemoteAdapter.java | 3 +-
.../distributed/dht/GridDhtLockFuture.java | 1 +
.../distributed/dht/GridDhtLockRequest.java | 2 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 5 +-
.../distributed/dht/GridDhtTxFinishFuture.java | 4 +-
.../distributed/dht/GridDhtTxFinishRequest.java | 2 +-
.../cache/distributed/dht/GridDhtTxLocal.java | 4 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 3 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 2 +-
.../cache/distributed/dht/GridDhtTxRemote.java | 2 +-
.../dht/atomic/GridDhtAtomicCache.java | 1 +
.../dht/colocated/GridDhtColocatedCache.java | 1 +
.../colocated/GridDhtColocatedLockFuture.java | 1 +
.../distributed/near/GridNearAtomicCache.java | 1 +
.../distributed/near/GridNearGetFuture.java | 3 +-
.../distributed/near/GridNearLockFuture.java | 1 +
.../distributed/near/GridNearLockRequest.java | 1 +
.../near/GridNearTransactionalCache.java | 3 +-
.../near/GridNearTxFinishFuture.java | 4 +-
.../cache/distributed/near/GridNearTxLocal.java | 4 +-
.../near/GridNearTxPrepareFuture.java | 4 +-
.../distributed/near/GridNearTxRemote.java | 2 +-
.../processors/cache/local/GridLocalCache.java | 1 +
.../processors/cache/local/GridLocalTx.java | 4 +-
.../cache/local/GridLocalTxFuture.java | 5 +-
.../local/atomic/GridLocalAtomicCache.java | 1 +
.../transactions/IgniteTransactionsImpl.java | 11 +-
.../dataload/GridDataLoadCacheUpdaters.java | 5 +-
.../processors/ggfs/GridGgfsDataManager.java | 5 +-
.../processors/ggfs/GridGgfsMetaManager.java | 5 +-
.../handlers/cache/GridCacheCommandHandler.java | 5 +-
.../service/GridServiceProcessor.java | 5 +-
.../cache/VisorCacheDefaultConfiguration.java | 1 +
.../grid/util/future/GridCompoundFuture.java | 2 +-
.../store/GridCacheBalancingStoreSelfTest.java | 2 +-
.../cache/store/GridGeneratingTestStore.java | 2 +-
...CacheJdbcBlobStoreMultithreadedSelfTest.java | 1 +
.../grid/kernal/GridStartStopSelfTest.java | 5 +-
.../GridCacheAbstractFailoverSelfTest.java | 5 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 8 +-
.../GridCacheAbstractProjectionSelfTest.java | 4 +-
.../cache/GridCacheAbstractSelfTest.java | 1 +
.../cache/GridCacheAbstractTtlSelfTest.java | 1 +
.../cache/GridCacheAbstractTxReadTest.java | 1 +
.../cache/GridCacheBasicStoreAbstractTest.java | 5 +-
...acheBasicStoreMultithreadedAbstractTest.java | 1 +
.../cache/GridCacheClearAllSelfTest.java | 1 +
.../GridCacheConcurrentTxMultiNodeTest.java | 6 +-
...idCacheConfigurationConsistencySelfTest.java | 2 +-
.../GridCacheDaemonNodeAbstractSelfTest.java | 5 +-
.../cache/GridCacheDeploymentSelfTest.java | 5 +-
.../GridCacheExAbstractFullApiSelfTest.java | 5 +-
.../GridCacheFinishPartitionsSelfTest.java | 5 +-
.../cache/GridCacheGenericTestStore.java | 2 +-
.../GridCacheGroupLockAbstractSelfTest.java | 5 +-
.../cache/GridCacheGroupLockPutTask.java | 6 +-
.../GridCacheInterceptorAbstractSelfTest.java | 3 +-
.../cache/GridCacheLifecycleAwareSelfTest.java | 1 +
.../GridCacheMarshallerTxAbstractTest.java | 6 +-
...GridCacheMixedPartitionExchangeSelfTest.java | 5 +-
.../cache/GridCacheMultiUpdateLockSelfTest.java | 5 +-
.../cache/GridCacheMvccManagerSelfTest.java | 1 +
.../cache/GridCacheNestedTxAbstractTest.java | 5 +-
.../cache/GridCacheObjectToStringSelfTest.java | 5 +-
...CacheOffHeapMultiThreadedUpdateSelfTest.java | 5 +-
.../GridCacheOffHeapTieredAbstractSelfTest.java | 5 +-
.../cache/GridCacheOffheapUpdateSelfTest.java | 5 +-
.../cache/GridCachePartitionedWritesTest.java | 1 +
.../GridCacheReferenceCleanupSelfTest.java | 1 +
.../GridCacheRefreshAheadAbstractSelfTest.java | 1 +
.../cache/GridCacheReloadSelfTest.java | 1 +
.../cache/GridCacheSlowTxWarnTest.java | 1 +
.../processors/cache/GridCacheStopSelfTest.java | 1 +
.../cache/GridCacheStorePutxSelfTest.java | 1 +
.../cache/GridCacheSwapReloadSelfTest.java | 1 +
.../processors/cache/GridCacheTestStore.java | 2 +-
...cheTransactionalAbstractMetricsSelfTest.java | 5 +-
.../cache/GridCacheTxAbstractTest.java | 6 +-
.../GridCacheTxConcurrentGetAbstractTest.java | 6 +-
.../GridCacheTxExceptionAbstractSelfTest.java | 1 +
.../cache/GridCacheTxMultiNodeAbstractTest.java | 6 +-
.../GridCacheTxMultiThreadedAbstractTest.java | 6 +-
.../GridCacheTxReentryAbstractSelfTest.java | 5 +-
.../GridCacheTxSingleThreadedAbstractTest.java | 4 +-
...idCacheTxStoreExceptionAbstractSelfTest.java | 1 +
.../GridCacheVariableTopologySelfTest.java | 1 +
.../GridCacheWriteBehindStoreAbstractTest.java | 5 +-
...BehindStorePartitionedMultiNodeSelfTest.java | 5 +-
.../GridCacheWriteBehindStoreSelfTest.java | 2 +-
.../GridCacheAtomicLongApiSelfTest.java | 1 +
.../GridCacheSequenceApiSelfAbstractTest.java | 6 +-
...idCachePartitionedNodeRestartTxSelfTest.java | 5 +-
...PartitionedQueueCreateMultiNodeSelfTest.java | 5 +-
...tractDistributedByteArrayValuesSelfTest.java | 5 +-
.../GridCacheAbstractJobExecutionTest.java | 6 +-
.../GridCacheAbstractNodeRestartSelfTest.java | 5 +-
...tractPartitionedByteArrayValuesSelfTest.java | 2 +-
.../GridCacheAbstractPrimarySyncSelfTest.java | 5 +-
.../GridCacheBasicOpAbstractTest.java | 6 +-
.../GridCacheEntrySetAbstractSelfTest.java | 5 +-
.../distributed/GridCacheEventAbstractTest.java | 5 +-
...dCacheMultithreadedFailoverAbstractTest.java | 1 +
.../GridCacheNodeFailureAbstractTest.java | 6 +-
...chePartitionedReloadAllAbstractSelfTest.java | 1 +
.../GridCacheTransformEventSelfTest.java | 8 +-
...cheTxConsistencyRestartAbstractSelfTest.java | 5 +-
...xOriginatingNodeFailureAbstractSelfTest.java | 2 +-
...cOriginatingNodeFailureAbstractSelfTest.java | 3 +-
.../GridCacheTxPreloadAbstractTest.java | 3 +-
.../GridCacheTxTimeoutAbstractTest.java | 6 +-
...heAbstractTransformWriteThroughSelfTest.java | 5 +-
.../dht/GridCacheColocatedDebugTest.java | 6 +-
...eColocatedOptimisticTransactionSelfTest.java | 5 +-
.../dht/GridCacheDhtEntrySelfTest.java | 1 +
...cheGroupLockPartitionedAbstractSelfTest.java | 5 +-
...ockPartitionedMultiNodeAbstractSelfTest.java | 5 +-
...dCachePartitionedTopologyChangeSelfTest.java | 6 +-
.../atomic/GridCacheAtomicPreloadSelfTest.java | 5 +-
.../near/GridCacheGetStoreErrorSelfTest.java | 1 +
.../near/GridCacheNearMultiGetSelfTest.java | 6 +-
.../near/GridCacheNearMultiNodeSelfTest.java | 5 +-
.../near/GridCacheNearOneNodeSelfTest.java | 5 +-
.../near/GridCacheNearOnlyTopologySelfTest.java | 5 +-
.../near/GridCacheNearTxMultiNodeSelfTest.java | 5 +-
...ePartitionedBasicStoreMultiNodeSelfTest.java | 5 +-
.../GridCachePartitionedEvictionSelfTest.java | 5 +-
...GridCachePartitionedFilteredPutSelfTest.java | 1 +
.../GridCachePartitionedLoadCacheSelfTest.java | 1 +
...achePartitionedMultiNodeCounterSelfTest.java | 6 +-
...ePartitionedMultiThreadedPutGetSelfTest.java | 5 +-
.../GridCachePartitionedNodeRestartTest.java | 2 +-
...ePartitionedOptimisticTxNodeRestartTest.java | 3 +-
...achePartitionedPreloadLifecycleSelfTest.java | 2 +-
.../GridCachePartitionedStorePutSelfTest.java | 1 +
.../GridCachePartitionedTxSalvageSelfTest.java | 5 +-
.../GridCachePartitionedTxTimeoutSelfTest.java | 2 +-
.../near/GridPartitionedBackupLoadSelfTest.java | 1 +
.../GridCacheReplicatedInvalidateSelfTest.java | 6 +-
...dCacheReplicatedTxMultiThreadedSelfTest.java | 2 +-
...CacheReplicatedPreloadLifecycleSelfTest.java | 5 +-
.../GridCacheBatchEvictUnswapSelfTest.java | 2 +-
...heConcurrentEvictionConsistencySelfTest.java | 5 +-
.../GridCacheConcurrentEvictionsSelfTest.java | 4 +-
.../GridCacheDistributedEvictionsSelfTest.java | 6 +-
.../GridCacheEmptyEntriesAbstractSelfTest.java | 5 +-
.../eviction/GridCacheEvictionAbstractTest.java | 5 +-
.../GridCacheEvictionTouchSelfTest.java | 7 +-
.../GridCacheLocalByteArrayValuesSelfTest.java | 5 +-
.../local/GridCacheLocalLoadAllSelfTest.java | 2 +-
.../local/GridCacheLocalTxTimeoutSelfTest.java | 6 +-
...ridCacheContinuousQueryAbstractSelfTest.java | 1 +
.../processors/ggfs/GridGgfsSizeSelfTest.java | 5 +-
.../cache/GridCacheAbstractLoadTest.java | 2 +-
...ridCacheAffinityTransactionsOffHeapTest.java | 6 +-
.../cache/GridCacheGroupLockComparisonTest.java | 5 +-
.../GridCacheWriteBehindStoreLoadTest.java | 1 +
.../colocation/GridTestCacheStore.java | 2 +-
.../GridCachePartitionedAtomicLongLoadTest.java | 5 +-
.../gridgain/loadtests/dsi/GridDsiPerfJob.java | 2 +-
.../swap/GridSwapEvictAllBenchmark.java | 2 +-
.../cache/GridAbstractCacheStoreSelfTest.java | 2 +-
.../bamboo/GridDataGridRestartTestSuite.java | 4 -
.../GridHibernateReadWriteAccessStrategy.java | 6 +-
.../hibernate/GridHibernateRegionFactory.java | 15 +-
.../hibernate/GridCacheHibernateBlobStore.java | 3 +-
.../cache/GridCacheAbstractQuerySelfTest.java | 2 +-
.../cache/GridCacheQueryLoadSelfTest.java | 1 +
...idCachePartitionedHitsAndMissesSelfTest.java | 4 +-
.../GridCacheReplicatedQuerySelfTest.java | 2 +-
.../cache/jta/GridCacheJtaManager.java | 4 +-
.../cache/jta/GridCacheXAResource.java | 5 +-
.../processors/cache/GridCacheJtaSelfTest.java | 3 +-
.../cache/websession/GridWebSessionFilter.java | 6 +-
254 files changed, 1401 insertions(+), 1262 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/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 f6d4cc7..3986ecb 100644
--- a/examples/src/main/java/org/gridgain/examples/datagrid/CacheTransactionExample.java
+++ b/examples/src/main/java/org/gridgain/examples/datagrid/CacheTransactionExample.java
@@ -10,14 +10,14 @@
package org.gridgain.examples.datagrid;
import org.apache.ignite.*;
-import org.gridgain.grid.*;
+import org.apache.ignite.transactions.*;
import org.gridgain.grid.cache.*;
import java.io.*;
import static org.gridgain.grid.cache.GridCacheFlag.*;
-import static org.gridgain.grid.cache.GridCacheTxConcurrency.*;
-import static org.gridgain.grid.cache.GridCacheTxIsolation.*;
+import static org.apache.ignite.transactions.GridCacheTxConcurrency.*;
+import static org.apache.ignite.transactions.GridCacheTxIsolation.*;
/**
* Demonstrates how to use cache transactions.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/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 f33b463..7e434f4 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
@@ -11,7 +11,7 @@ package org.gridgain.examples.datagrid.store;
import org.apache.ignite.*;
import org.apache.ignite.configuration.*;
-import org.gridgain.grid.*;
+import org.apache.ignite.transactions.*;
import org.gridgain.grid.cache.*;
import java.util.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/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 8706873..4a18c2a 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
@@ -12,8 +12,8 @@ package org.gridgain.examples.datagrid.store.dummy;
import org.apache.ignite.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.resources.*;
+import org.apache.ignite.transactions.*;
import org.gridgain.examples.datagrid.store.*;
-import org.gridgain.grid.*;
import org.gridgain.grid.cache.*;
import org.gridgain.grid.cache.store.*;
import org.jetbrains.annotations.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/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 b08a7a5..ffd1f1f 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
@@ -11,8 +11,8 @@ package org.gridgain.examples.datagrid.store.hibernate;
import org.apache.ignite.*;
import org.apache.ignite.lang.*;
+import org.apache.ignite.transactions.*;
import org.gridgain.examples.datagrid.store.*;
-import org.gridgain.grid.cache.*;
import org.gridgain.grid.cache.store.*;
import org.hibernate.*;
import org.hibernate.cfg.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/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 eb52a61..69a9063 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
@@ -11,8 +11,8 @@ package org.gridgain.examples.datagrid.store.jdbc;
import org.apache.ignite.*;
import org.apache.ignite.lang.*;
+import org.apache.ignite.transactions.*;
import org.gridgain.examples.datagrid.store.*;
-import org.gridgain.grid.cache.*;
import org.gridgain.grid.cache.store.*;
import org.jetbrains.annotations.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/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 3e2bc44..86f9671 100644
--- a/modules/clients/src/test/java/org/gridgain/client/GridHashMapStore.java
+++ b/modules/clients/src/test/java/org/gridgain/client/GridHashMapStore.java
@@ -11,7 +11,7 @@ package org.gridgain.client;
import org.apache.ignite.*;
import org.apache.ignite.lang.*;
-import org.gridgain.grid.cache.*;
+import org.apache.ignite.transactions.*;
import org.gridgain.grid.cache.store.*;
import org.jetbrains.annotations.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/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 f10b9d5..f985c7b 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
@@ -19,6 +19,7 @@ import org.apache.ignite.spi.discovery.tcp.*;
import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
import org.apache.ignite.spi.swapspace.file.*;
+import org.apache.ignite.transactions.*;
import org.gridgain.client.*;
import org.gridgain.client.ssl.*;
import org.gridgain.grid.cache.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/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 3123221..0f7bef7 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -12,7 +12,7 @@ package org.apache.ignite;
import org.apache.ignite.cache.*;
import org.apache.ignite.cache.query.*;
import org.apache.ignite.lang.*;
-import org.gridgain.grid.cache.*;
+import org.apache.ignite.transactions.*;
import org.jetbrains.annotations.*;
import javax.cache.*;
@@ -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(org.gridgain.grid.cache.GridCacheTx, Object)} method will be used.
+ * storage, {@link org.gridgain.grid.cache.store.GridCacheStore#load(GridCacheTx, 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(org.gridgain.grid.cache.GridCacheTx, Object, Object)} method.
+ * via {@link org.gridgain.grid.cache.store.GridCacheStore#put(GridCacheTx, 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(org.gridgain.grid.cache.GridCacheTx, java.util.Collection)} method.
+ * via {@link org.gridgain.grid.cache.store.GridCacheStore#removeAll(GridCacheTx, 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/12b08c99/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 783dab4..837255d 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteTransactions.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteTransactions.java
@@ -10,6 +10,7 @@
package org.apache.ignite;
import org.apache.ignite.configuration.*;
+import org.apache.ignite.transactions.*;
import org.gridgain.grid.cache.*;
import org.jetbrains.annotations.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/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 4e89e6d..4ddbceb 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
@@ -9,6 +9,7 @@
package org.apache.ignite.cache;
+import org.apache.ignite.transactions.*;
import org.jetbrains.annotations.*;
/**
@@ -35,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 org.gridgain.grid.cache.GridCacheTx#isInvalidate()
+ * @see GridCacheTx#isInvalidate()
* @see org.gridgain.grid.cache.GridCacheConfiguration#isInvalidate()
*/
INVALIDATE,
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index 895bdb7..5bc33e6 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -379,7 +379,7 @@ public class IgniteConfiguration {
private GridCacheConfiguration[] cacheCfg;
/** Transactions configuration. */
- private GridTransactionsConfiguration txCfg = new GridTransactionsConfiguration();
+ private TransactionsConfiguration txCfg = new TransactionsConfiguration();
/** Configuration for .Net nodes. */
private GridDotNetConfiguration dotNetCfg;
@@ -3130,7 +3130,7 @@ public class IgniteConfiguration {
*
* @return Transactions configuration.
*/
- public GridTransactionsConfiguration getTransactionsConfiguration() {
+ public TransactionsConfiguration getTransactionsConfiguration() {
return txCfg;
}
@@ -3139,7 +3139,7 @@ public class IgniteConfiguration {
*
* @param txCfg Transactions configuration.
*/
- public void setTransactionsConfiguration(GridTransactionsConfiguration txCfg) {
+ public void setTransactionsConfiguration(TransactionsConfiguration txCfg) {
this.txCfg = txCfg;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/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
new file mode 100644
index 0000000..0ae9250
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/TransactionsConfiguration.java
@@ -0,0 +1,192 @@
+/* @java.file.header */
+
+/* _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.configuration;
+
+import org.apache.ignite.transactions.*;
+
+/**
+ * Transactions configuration.
+ */
+public class TransactionsConfiguration {
+ /** Default value for 'txSerializableEnabled' flag. */
+ public static final boolean DFLT_TX_SERIALIZABLE_ENABLED = false;
+
+ /** Default concurrency mode. */
+ public static final GridCacheTxConcurrency DFLT_TX_CONCURRENCY = GridCacheTxConcurrency.PESSIMISTIC;
+
+ /** Default transaction isolation level. */
+ public static final GridCacheTxIsolation DFLT_TX_ISOLATION = GridCacheTxIsolation.REPEATABLE_READ;
+
+ /** Default transaction timeout. */
+ public static final long DFLT_TRANSACTION_TIMEOUT = 0;
+
+ /** Default size of pessimistic transactions log. */
+ public static final int DFLT_PESSIMISTIC_TX_LOG_LINGER = 10_000;
+
+ /** Default transaction serializable flag. */
+ private boolean txSerEnabled = DFLT_TX_SERIALIZABLE_ENABLED;
+
+ /** Transaction isolation. */
+ private GridCacheTxIsolation dfltIsolation = DFLT_TX_ISOLATION;
+
+ /** Cache concurrency. */
+ private GridCacheTxConcurrency dfltConcurrency = DFLT_TX_CONCURRENCY;
+
+ /** Default transaction timeout. */
+ private long dfltTxTimeout = DFLT_TRANSACTION_TIMEOUT;
+
+ /** Pessimistic tx log size. */
+ private int pessimisticTxLogSize;
+
+ /** Pessimistic tx log linger. */
+ private int pessimisticTxLogLinger = DFLT_PESSIMISTIC_TX_LOG_LINGER;
+
+ /**
+ * Empty constructor.
+ */
+ public TransactionsConfiguration() {
+ // No-op.
+ }
+
+ /**
+ * @param cfg Configuration to copy.
+ */
+ public TransactionsConfiguration(TransactionsConfiguration cfg) {
+ dfltConcurrency = cfg.getDefaultTxConcurrency();
+ dfltIsolation = cfg.getDefaultTxIsolation();
+ dfltTxTimeout = cfg.getDefaultTxTimeout();
+ pessimisticTxLogLinger = cfg.getPessimisticTxLogLinger();
+ pessimisticTxLogSize = cfg.getPessimisticTxLogSize();
+ txSerEnabled = cfg.isTxSerializableEnabled();
+ }
+
+ /**
+ * Gets flag to enable/disable {@link GridCacheTxIsolation#SERIALIZABLE} isolation
+ * level for cache transactions. Serializable level does carry certain overhead and
+ * if not used, should be disabled. Default value is {@code false}.
+ *
+ * @return {@code True} if serializable transactions are enabled, {@code false} otherwise.
+ */
+ public boolean isTxSerializableEnabled() {
+ return txSerEnabled;
+ }
+
+ /**
+ * Enables/disables serializable cache transactions. See {@link #isTxSerializableEnabled()} for more information.
+ *
+ * @param txSerEnabled Flag to enable/disable serializable cache transactions.
+ */
+ public void setTxSerializableEnabled(boolean txSerEnabled) {
+ this.txSerEnabled = txSerEnabled;
+ }
+
+ /**
+ * Default cache transaction concurrency to use when one is not explicitly
+ * specified. Default value is defined by {@link #DFLT_TX_CONCURRENCY}.
+ *
+ * @return Default cache transaction concurrency.
+ * @see GridCacheTx
+ */
+ public GridCacheTxConcurrency getDefaultTxConcurrency() {
+ return dfltConcurrency;
+ }
+
+ /**
+ * Sets default transaction concurrency.
+ *
+ * @param dfltConcurrency Default cache transaction concurrency.
+ */
+ public void setDefaultTxConcurrency(GridCacheTxConcurrency dfltConcurrency) {
+ this.dfltConcurrency = dfltConcurrency;
+ }
+
+ /**
+ * Default cache transaction isolation to use when one is not explicitly
+ * specified. Default value is defined by {@link #DFLT_TX_ISOLATION}.
+ *
+ * @return Default cache transaction isolation.
+ * @see GridCacheTx
+ */
+ public GridCacheTxIsolation getDefaultTxIsolation() {
+ return dfltIsolation;
+ }
+
+ /**
+ * Sets default transaction isolation.
+ *
+ * @param dfltIsolation Default cache transaction isolation.
+ */
+ public void setDefaultTxIsolation(GridCacheTxIsolation dfltIsolation) {
+ this.dfltIsolation = dfltIsolation;
+ }
+
+ /**
+ * Gets default transaction timeout. Default value is defined by {@link #DFLT_TRANSACTION_TIMEOUT}
+ * which is {@code 0} and means that transactions will never time out.
+ *
+ * @return Default transaction timeout.
+ */
+ public long getDefaultTxTimeout() {
+ return dfltTxTimeout;
+ }
+
+ /**
+ * Sets default transaction timeout in milliseconds. By default this value is defined by {@link
+ * #DFLT_TRANSACTION_TIMEOUT}.
+ *
+ * @param dfltTxTimeout Default transaction timeout.
+ */
+ public void setDefaultTxTimeout(long dfltTxTimeout) {
+ this.dfltTxTimeout = dfltTxTimeout;
+ }
+
+ /**
+ * Gets size of pessimistic transactions log stored on node in order to recover transaction commit if originating
+ * node has left grid before it has sent all messages to transaction nodes.
+ * <p>
+ * If not set, default value is {@code 0} which means unlimited log size.
+ *
+ * @return Pessimistic transaction log size.
+ */
+ public int getPessimisticTxLogSize() {
+ return pessimisticTxLogSize;
+ }
+
+ /**
+ * Sets pessimistic transactions log size.
+ *
+ * @param pessimisticTxLogSize Pessimistic transactions log size.
+ * @see #getPessimisticTxLogSize()
+ */
+ public void setPessimisticTxLogSize(int pessimisticTxLogSize) {
+ this.pessimisticTxLogSize = pessimisticTxLogSize;
+ }
+
+ /**
+ * Gets delay, in milliseconds, after which pessimistic recovery entries will be cleaned up for failed node.
+ * <p>
+ * If not set, default value is {@link #DFLT_PESSIMISTIC_TX_LOG_LINGER}.
+ *
+ * @return Pessimistic log cleanup delay in milliseconds.
+ */
+ public int getPessimisticTxLogLinger() {
+ return pessimisticTxLogLinger;
+ }
+
+ /**
+ * Sets cleanup delay for pessimistic transaction recovery log for failed node, in milliseconds.
+ *
+ * @param pessimisticTxLogLinger Pessimistic log cleanup delay.
+ * @see #getPessimisticTxLogLinger()
+ */
+ public void setPessimisticTxLogLinger(int pessimisticTxLogLinger) {
+ this.pessimisticTxLogLinger = pessimisticTxLogLinger;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/modules/core/src/main/java/org/apache/ignite/lang/IgniteFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteFuture.java b/modules/core/src/main/java/org/apache/ignite/lang/IgniteFuture.java
index f478377..335d944 100644
--- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/lang/IgniteFuture.java
@@ -27,7 +27,7 @@ public interface IgniteFuture<R> {
* returns computation result.
*
* @return Computation result.
- * @throws org.gridgain.grid.GridInterruptedException Subclass of {@link IgniteCheckedException} thrown if the wait was interrupted.
+ * @throws GridInterruptedException Subclass of {@link IgniteCheckedException} thrown if the wait was interrupted.
* @throws IgniteFutureCancelledException Subclass of {@link IgniteCheckedException} throws if computation was cancelled.
* @throws IgniteCheckedException If computation failed.
*/
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 9ba7c45..c80617e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -163,7 +163,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
public static final int DFLT_PORT = 47100;
/** Default port which node sets listener for shared memory connections (value is <tt>48100</tt>). */
- public static final int DFLT_SHMEM_PORT = 48100;
+ public static final int DFLT_SHMEM_PORT = -1;
/** Default idle connection timeout (value is <tt>30000</tt>ms). */
public static final long DFLT_IDLE_CONN_TIMEOUT = 30000;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/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
new file mode 100644
index 0000000..9a8341f
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTx.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 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/12b08c99/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
new file mode 100644
index 0000000..4f723d9
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxConcurrency.java
@@ -0,0 +1,37 @@
+/* @java.file.header */
+
+/* _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.transactions;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Transaction concurrency control. See {@link GridCacheTx} for more information
+ * on transaction concurrency controls.
+ */
+public enum GridCacheTxConcurrency {
+ /** Optimistic concurrency control. */
+ OPTIMISTIC,
+
+ /** Pessimistic concurrency control. */
+ PESSIMISTIC;
+
+ /** Enum values. */
+ private static final GridCacheTxConcurrency[] VALS = values();
+
+ /**
+ * Efficiently gets enumerated value from its ordinal.
+ *
+ * @param ord Ordinal value.
+ * @return Enumerated value or {@code null} if ordinal out of range.
+ */
+ @Nullable public static GridCacheTxConcurrency fromOrdinal(int ord) {
+ return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxHeuristicException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxHeuristicException.java b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxHeuristicException.java
new file mode 100644
index 0000000..1813d72
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxHeuristicException.java
@@ -0,0 +1,43 @@
+/* @java.file.header */
+
+/* _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.transactions;
+
+import org.apache.ignite.*;
+
+/**
+ * Exception thrown whenever grid transaction enters an unknown state.
+ * This exception is usually thrown whenever commit partially succeeds.
+ * Cache will still resolve this situation automatically to ensure data
+ * integrity, by invalidating all values participating in this transaction
+ * on remote nodes.
+ */
+public class GridCacheTxHeuristicException extends IgniteCheckedException {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Creates new heuristic exception with given error message.
+ *
+ * @param msg Error message.
+ */
+ public GridCacheTxHeuristicException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Creates new heuristic exception with given error message and optional nested exception.
+ *
+ * @param msg Error message.
+ * @param cause Optional nested exception (can be <tt>null</tt>).
+ */
+ public GridCacheTxHeuristicException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/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
new file mode 100644
index 0000000..3894a63
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxIsolation.java
@@ -0,0 +1,41 @@
+/* @java.file.header */
+
+/* _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.transactions;
+
+import org.jetbrains.annotations.*;
+
+/**
+ * Defines different cache transaction isolation levels. See {@link GridCacheTx}
+ * documentation for more information about cache transaction isolation levels.
+ */
+public enum GridCacheTxIsolation {
+ /** Read committed isolation level. */
+ READ_COMMITTED,
+
+ /** Repeatable read isolation level. */
+ REPEATABLE_READ,
+
+ /** Serializable isolation level. */
+ SERIALIZABLE;
+
+ /** Enum values. */
+ private static final GridCacheTxIsolation[] VALS = values();
+
+ /**
+ * Efficiently gets enumerated value from its ordinal.
+ *
+ * @param ord Ordinal value.
+ * @return Enumerated value or {@code null} if ordinal out of range.
+ */
+ @Nullable
+ public static GridCacheTxIsolation fromOrdinal(int ord) {
+ return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxOptimisticException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxOptimisticException.java b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxOptimisticException.java
new file mode 100644
index 0000000..0799ff4
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxOptimisticException.java
@@ -0,0 +1,39 @@
+/* @java.file.header */
+
+/* _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.transactions;
+
+import org.apache.ignite.*;
+
+/**
+ * Exception thrown whenever grid transactions fail optimistically.
+ */
+public class GridCacheTxOptimisticException extends IgniteCheckedException {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Creates new optimistic exception with given error message.
+ *
+ * @param msg Error message.
+ */
+ public GridCacheTxOptimisticException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Creates new optimistic exception with given error message and optional nested exception.
+ *
+ * @param msg Error message.
+ * @param cause Optional nested exception (can be <tt>null</tt>).
+ */
+ public GridCacheTxOptimisticException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxRollbackException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxRollbackException.java b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxRollbackException.java
new file mode 100644
index 0000000..6823c03
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxRollbackException.java
@@ -0,0 +1,39 @@
+/* @java.file.header */
+
+/* _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.transactions;
+
+import org.apache.ignite.*;
+
+/**
+ * Exception thrown whenever grid transactions has been automatically rolled back.
+ */
+public class GridCacheTxRollbackException extends IgniteCheckedException {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Creates new rollback exception with given error message.
+ *
+ * @param msg Error message.
+ */
+ public GridCacheTxRollbackException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Creates new rollback exception with given error message and optional nested exception.
+ *
+ * @param msg Error message.
+ * @param cause Optional nested exception (can be <tt>null</tt>).
+ */
+ public GridCacheTxRollbackException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxState.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxState.java b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxState.java
new file mode 100644
index 0000000..591acb5
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxState.java
@@ -0,0 +1,57 @@
+/* @java.file.header */
+
+/* _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.transactions;
+
+import org.jetbrains.annotations.*;
+
+/**
+ * Cache transaction state.
+ */
+public enum GridCacheTxState {
+ /** Transaction started. */
+ ACTIVE,
+
+ /** Transaction validating. */
+ PREPARING,
+
+ /** Transaction validation succeeded. */
+ PREPARED,
+
+ /** Transaction is marked for rollback. */
+ MARKED_ROLLBACK,
+
+ /** Transaction commit started (validating finished). */
+ COMMITTING,
+
+ /** Transaction commit succeeded. */
+ COMMITTED,
+
+ /** Transaction rollback started (validation failed). */
+ ROLLING_BACK,
+
+ /** Transaction rollback succeeded. */
+ ROLLED_BACK,
+
+ /** Transaction rollback failed or is otherwise unknown state. */
+ UNKNOWN;
+
+ /** Enumerated values. */
+ private static final GridCacheTxState[] VALS = values();
+
+ /**
+ * Efficiently gets enumerated value from its ordinal.
+ *
+ * @param ord Ordinal value.
+ * @return Enumerated value or {@code null} if ordinal out of range.
+ */
+ @Nullable public static GridCacheTxState fromOrdinal(int ord) {
+ return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/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
new file mode 100644
index 0000000..d88714c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxSynchronization.java
@@ -0,0 +1,38 @@
+/* @java.file.header */
+
+/* _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.transactions;
+
+import org.gridgain.grid.cache.*;
+import org.jetbrains.annotations.*;
+
+/**
+ * Synchronization callback for transaction. You can subscribe to receive transaction
+ * state change callbacks by registering transaction synchronization via
+ * {@link GridCache#txSynchronize(GridCacheTxSynchronization)} method.
+ */
+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()}
+ * 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
+ * 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);
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxTimeoutException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxTimeoutException.java b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxTimeoutException.java
new file mode 100644
index 0000000..63828c8
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/GridCacheTxTimeoutException.java
@@ -0,0 +1,39 @@
+/* @java.file.header */
+
+/* _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.transactions;
+
+import org.apache.ignite.*;
+
+/**
+ * Exception thrown whenever grid transactions time out.
+ */
+public class GridCacheTxTimeoutException extends IgniteCheckedException {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Creates new timeout exception with given error message.
+ *
+ * @param msg Error message.
+ */
+ public GridCacheTxTimeoutException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Creates new timeout exception with given error message and optional nested exception.
+ *
+ * @param msg Error message.
+ * @param cause Optional nested exception (can be <tt>null</tt>).
+ */
+ public GridCacheTxTimeoutException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTxMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTxMetrics.java b/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTxMetrics.java
new file mode 100644
index 0000000..3b614fd
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTxMetrics.java
@@ -0,0 +1,45 @@
+/* @java.file.header */
+
+/* _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.transactions;
+
+import java.io.*;
+
+/**
+ * Transaction metrics, shared across all caches.
+ */
+public interface IgniteTxMetrics extends Serializable {
+ /**
+ * Gets last time transaction was committed.
+ *
+ * @return Last commit time.
+ */
+ public long commitTime();
+
+ /**
+ * Gets last time transaction was rollback.
+ *
+ * @return Last rollback time.
+ */
+ public long rollbackTime();
+
+ /**
+ * Gets total number of transaction commits.
+ *
+ * @return Number of transaction commits.
+ */
+ public int txCommits();
+
+ /**
+ * Gets total number of transaction rollbacks.
+ *
+ * @return Number of transaction rollbacks.
+ */
+ public int txRollbacks();
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTxMetricsAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTxMetricsAdapter.java b/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTxMetricsAdapter.java
new file mode 100644
index 0000000..9bc084a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTxMetricsAdapter.java
@@ -0,0 +1,107 @@
+/* @java.file.header */
+
+/* _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.transactions;
+
+import org.gridgain.grid.util.typedef.internal.*;
+
+import java.io.*;
+
+/**
+ * Tx metrics adapter.
+ */
+public class IgniteTxMetricsAdapter implements IgniteTxMetrics, Externalizable {
+ /** Number of transaction commits. */
+ private volatile int txCommits;
+
+ /** Number of transaction rollbacks. */
+ private volatile int txRollbacks;
+
+ /** Last commit time. */
+ private volatile long commitTime;
+
+ /** Last rollback time. */
+ private volatile long rollbackTime;
+
+ /**
+ *
+ */
+ public IgniteTxMetricsAdapter() {
+
+ }
+
+ /**
+ * @param m Transaction metrics to copy.
+ */
+ public IgniteTxMetricsAdapter(IgniteTxMetrics m) {
+ commitTime = m.commitTime();
+ rollbackTime = m.rollbackTime();
+ txCommits = m.txCommits();
+ txRollbacks = m.txRollbacks();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long commitTime() {
+ return commitTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long rollbackTime() {
+ return rollbackTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int txCommits() {
+ return txCommits;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int txRollbacks() {
+ return txRollbacks;
+ }
+
+ /**
+ * Transaction commit callback.
+ */
+ public void onTxCommit() {
+ commitTime = U.currentTimeMillis();
+
+ txCommits++;
+ }
+
+ /**
+ * Transaction rollback callback.
+ */
+ public void onTxRollback() {
+ rollbackTime = U.currentTimeMillis();
+
+ txRollbacks++;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeLong(commitTime);
+ out.writeLong(rollbackTime);
+ out.writeInt(txCommits);
+ out.writeInt(txRollbacks);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ commitTime = in.readLong();
+ rollbackTime = in.readLong();
+ txCommits = in.readInt();
+ txRollbacks = in.readInt();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(IgniteTxMetricsAdapter.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java
index 3af8e94..49bee3d 100644
--- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java
+++ b/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java
@@ -11,6 +11,7 @@ package org.gridgain.grid.cache;
import org.apache.ignite.*;
import org.apache.ignite.lang.*;
+import org.apache.ignite.transactions.*;
import org.gridgain.grid.cache.affinity.*;
import org.gridgain.grid.cache.affinity.consistenthash.*;
import org.gridgain.grid.cache.datastructures.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/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 674fdcc..2156adb 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
@@ -9,6 +9,7 @@
package org.gridgain.grid.cache;
+import org.apache.ignite.transactions.*;
import org.jetbrains.annotations.*;
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/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 dff9bdc..eda8846 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
@@ -13,6 +13,7 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.portables.PortableObject;
import org.apache.ignite.spi.indexing.*;
+import org.apache.ignite.transactions.*;
import org.gridgain.grid.cache.affinity.*;
import org.gridgain.grid.cache.affinity.consistenthash.*;
import org.gridgain.grid.cache.cloner.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/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 725f377..bd23d53 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
@@ -11,6 +11,7 @@ package org.gridgain.grid.cache;
import org.apache.ignite.*;
import org.apache.ignite.lang.*;
+import org.apache.ignite.transactions.*;
import org.gridgain.grid.*;
import org.jetbrains.annotations.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/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 b9ef589..77f38e5 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
@@ -9,6 +9,7 @@
package org.gridgain.grid.cache;
+import org.apache.ignite.transactions.*;
import org.jetbrains.annotations.*;
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheProjection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheProjection.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheProjection.java
index 92d7c99..ada5eea 100644
--- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheProjection.java
+++ b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheProjection.java
@@ -12,6 +12,7 @@ package org.gridgain.grid.cache;
import org.apache.ignite.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.lang.*;
+import org.apache.ignite.transactions.*;
import org.gridgain.grid.cache.affinity.*;
import org.gridgain.grid.cache.query.*;
import org.gridgain.grid.cache.store.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheTx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheTx.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheTx.java
deleted file mode 100644
index 6e8c5bd..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheTx.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/* @java.file.header */
-
-/* _________ _____ __________________ _____
- * __ ____/___________(_)______ /__ ____/______ ____(_)_______
- * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
- * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
- * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
- */
-
-package org.gridgain.grid.cache;
-
-import org.apache.ignite.*;
-import org.apache.ignite.lang.*;
-import org.gridgain.grid.*;
-
-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/12b08c99/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheTxConcurrency.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheTxConcurrency.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheTxConcurrency.java
deleted file mode 100644
index 2253b40..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheTxConcurrency.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/* @java.file.header */
-
-/* _________ _____ __________________ _____
- * __ ____/___________(_)______ /__ ____/______ ____(_)_______
- * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
- * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
- * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
- */
-
-package org.gridgain.grid.cache;
-
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Transaction concurrency control. See {@link GridCacheTx} for more information
- * on transaction concurrency controls.
- */
-public enum GridCacheTxConcurrency {
- /** Optimistic concurrency control. */
- OPTIMISTIC,
-
- /** Pessimistic concurrency control. */
- PESSIMISTIC;
-
- /** Enum values. */
- private static final GridCacheTxConcurrency[] VALS = values();
-
- /**
- * Efficiently gets enumerated value from its ordinal.
- *
- * @param ord Ordinal value.
- * @return Enumerated value or {@code null} if ordinal out of range.
- */
- @Nullable public static GridCacheTxConcurrency fromOrdinal(int ord) {
- return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/12b08c99/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheTxHeuristicException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheTxHeuristicException.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheTxHeuristicException.java
deleted file mode 100644
index 4633659..0000000
--- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheTxHeuristicException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/* @java.file.header */
-
-/* _________ _____ __________________ _____
- * __ ____/___________(_)______ /__ ____/______ ____(_)_______
- * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
- * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
- * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
- */
-
-package org.gridgain.grid.cache;
-
-import org.apache.ignite.*;
-
-/**
- * Exception thrown whenever grid transaction enters an unknown state.
- * This exception is usually thrown whenever commit partially succeeds.
- * Cache will still resolve this situation automatically to ensure data
- * integrity, by invalidating all values participating in this transaction
- * on remote nodes.
- */
-public class GridCacheTxHeuristicException extends IgniteCheckedException {
- /** */
- private static final long serialVersionUID = 0L;
-
- /**
- * Creates new heuristic exception with given error message.
- *
- * @param msg Error message.
- */
- public GridCacheTxHeuristicException(String msg) {
- super(msg);
- }
-
- /**
- * Creates new heuristic exception with given error message and optional nested exception.
- *
- * @param msg Error message.
- * @param cause Optional nested exception (can be <tt>null</tt>).
- */
- public GridCacheTxHeuristicException(String msg, Throwable cause) {
- super(msg, cause);
- }
-}