ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [49/50] [abbrv] incubator-ignite git commit: Ignite-1 - TX async support.
Date Tue, 23 Dec 2014 00:00:23 GMT
Ignite-1 - TX async support.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7b68f596
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7b68f596
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7b68f596

Branch: refs/heads/master
Commit: 7b68f5968ff0a4984f24a485407a2cc369779165
Parents: ae8217f
Author: Alexey Goncharuk <agoncharuk@gridgain.com>
Authored: Mon Dec 22 15:13:01 2014 -0800
Committer: Alexey Goncharuk <agoncharuk@gridgain.com>
Committed: Mon Dec 22 15:13:01 2014 -0800

----------------------------------------------------------------------
 .../apache/ignite/transactions/IgniteTx.java    | 13 +--
 .../processors/cache/GridCacheAdapter.java      |  4 +-
 .../cache/GridCacheSharedContext.java           |  4 +-
 .../cache/distributed/dht/GridDhtTxLocal.java   |  5 --
 .../cache/distributed/near/GridNearTxLocal.java |  7 --
 .../processors/cache/local/GridLocalTx.java     |  5 --
 .../transactions/IgniteTransactionsImpl.java    |  4 +-
 .../cache/transactions/IgniteTxAdapter.java     | 35 ++++++--
 .../cache/transactions/IgniteTxEx.java          |  8 +-
 .../cache/transactions/IgniteTxLocalEx.java     |  5 --
 .../cache/transactions/IgniteTxProxyImpl.java   | 90 ++++++++++++++++----
 .../cache/GridCacheAbstractFullApiSelfTest.java | 10 ++-
 .../cache/GridCacheLifecycleAwareSelfTest.java  |  3 +-
 .../GridCacheReferenceCleanupSelfTest.java      |  4 +-
 ...cOriginatingNodeFailureAbstractSelfTest.java |  6 +-
 .../cache/GridAbstractCacheStoreSelfTest.java   | 12 ++-
 16 files changed, 150 insertions(+), 65 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b68f596/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
index 97a0210..346d540 100644
--- a/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java
+++ b/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java
@@ -54,7 +54,7 @@ import java.util.*;
  * <ul>
  * <li>
  *  {@link IgniteTxConcurrency#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'}
+ *  nodes until {@link #commit()} is 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
@@ -71,7 +71,7 @@ import java.util.*;
  *  {@link IgniteTxConcurrency#PESSIMISTIC} - in this mode a lock is acquired on all cache
operations
  *  with exception of read operations in {@link IgniteTxIsolation#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
+ *  {@link #commit()} 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
@@ -106,7 +106,7 @@ import java.util.*;
  * }
  * </pre>
  */
-public interface IgniteTx extends GridMetadataAware, AutoCloseable {
+public interface IgniteTx extends GridMetadataAware, AutoCloseable, IgniteAsyncSupport {
     /**
      * Gets unique identifier for this transaction.
      *
@@ -230,13 +230,6 @@ public interface IgniteTx extends GridMetadataAware, AutoCloseable {
     @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.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b68f596/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java
index a88cc02..82098bb 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheAdapter.java
@@ -3037,7 +3037,7 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
     @Nullable @Override public IgniteTx tx() {
         IgniteTxAdapter<K, V> tx = ctx.tm().threadLocalTx();
 
-        return tx == null ? null : new IgniteTxProxyImpl<>(tx, ctx.shared());
+        return tx == null ? null : new IgniteTxProxyImpl<>(tx, ctx.shared(), false);
     }
 
     /** {@inheritDoc} */
@@ -3455,7 +3455,7 @@ public abstract class GridCacheAdapter<K, V> extends GridMetadataAwareAdapter
im
      * @return Transaction commit future.
      */
     @SuppressWarnings("unchecked")
-    public IgniteFuture<IgniteTx> commitTxAsync(final IgniteTx tx) {
+    public IgniteFuture<IgniteTx> commitTxAsync(final IgniteTxEx tx) {
         FutureHolder holder = lastFut.get();
 
         holder.lock();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b68f596/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheSharedContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheSharedContext.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheSharedContext.java
index 82fb86f..0ca6d39 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheSharedContext.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheSharedContext.java
@@ -476,7 +476,7 @@ public class GridCacheSharedContext<K, V> {
      * @param tx Transaction to rollback.
      * @throws IgniteCheckedException If failed.
      */
-    public void rollbackTx(IgniteTxEx<K, V> tx) throws IgniteCheckedException {
+    public IgniteFuture rollbackTxAsync(IgniteTxEx<K, V> tx) throws IgniteCheckedException
{
         Collection<Integer> cacheIds = tx.activeCacheIds();
 
         if (!cacheIds.isEmpty()) {
@@ -484,7 +484,7 @@ public class GridCacheSharedContext<K, V> {
                 cacheContext(cacheId).cache().awaitLastFut();
         }
 
-        tx.rollback();
+        return tx.rollbackAsync();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b68f596/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxLocal.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxLocal.java
index 7bb56c1..0f11ecc 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxLocal.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxLocal.java
@@ -229,11 +229,6 @@ public class GridDhtTxLocal<K, V> extends GridDhtTxLocalAdapter<K,
V> implements
         return nearFinMiniId;
     }
 
-    /** {@inheritDoc} */
-    @Override public IgniteFuture<IgniteTxEx<K, V>> future() {
-        return prepFut.get();
-    }
-
     /**
      * @param nearFinMiniId Near future mini ID.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b68f596/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxLocal.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxLocal.java
index 0750b5c..74391e1 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -517,13 +517,6 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K,
V> {
     }
 
     /**
-     * @return Commit fut.
-     */
-    @Override public IgniteFuture<IgniteTxEx<K, V>> future() {
-        return prepFut.get();
-    }
-
-    /**
      * @param mapping Mapping to order.
      * @param pendingVers Pending versions.
      * @param committedVers Committed versions.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b68f596/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/local/GridLocalTx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/local/GridLocalTx.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/local/GridLocalTx.java
index 0226ff2..716b0b4 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/local/GridLocalTx.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/local/GridLocalTx.java
@@ -66,11 +66,6 @@ class GridLocalTx<K, V> extends IgniteTxLocalAdapter<K, V>
{
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteFuture<IgniteTxEx<K, V>> future() {
-        return fut.get();
-    }
-
-    /** {@inheritDoc} */
     @Override public boolean onOwnerChanged(GridCacheEntryEx<K, V> entry, GridCacheMvccCandidate<K>
owner) {
         GridLocalTxFuture<K, V> fut = this.fut.get();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b68f596/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTransactionsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTransactionsImpl.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTransactionsImpl.java
index 2f36aa8..03fa74b 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTransactionsImpl.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTransactionsImpl.java
@@ -139,7 +139,7 @@ public class IgniteTransactionsImpl<K, V> implements IgniteTransactionsEx
{
         assert tx != null;
 
         // Wrap into proxy.
-        return new IgniteTxProxyImpl<>(tx, cctx);
+        return new IgniteTxProxyImpl<>(tx, cctx, false);
 
     }
 
@@ -225,7 +225,7 @@ public class IgniteTransactionsImpl<K, V> implements IgniteTransactionsEx
{
         }
 
         // Wrap into proxy.
-        return new IgniteTxProxyImpl<>(tx0, cctx);
+        return new IgniteTxProxyImpl<>(tx0, cctx, false);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b68f596/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxAdapter.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxAdapter.java
index a9d28f4..1deae9d 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxAdapter.java
@@ -536,6 +536,21 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter
         return finalizing.get();
     }
 
+    /** {@inheritDoc} */
+    @Override public IgniteAsyncSupport enableAsync() {
+        throw new UnsupportedOperationException("enableAsync() should not be called on IgniteTxAdapter
directly.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isAsync() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public <R> IgniteFuture<R> future() {
+        throw new UnsupportedOperationException("future() should not be called on IgniteTxAdapter
directly.");
+    }
+
     /**
      * @return {@code True} if transaction has at least one key enlisted.
      */
@@ -1476,27 +1491,37 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter
         }
 
         /** {@inheritDoc} */
-        @Override public long timeout(long timeout) {
+        @Override public IgniteAsyncSupport enableAsync() {
             throw new IllegalStateException("Deserialized transaction can only be used as
read-only.");
         }
 
         /** {@inheritDoc} */
-        @Override public boolean setRollbackOnly() {
+        @Override public boolean isAsync() {
+            return false;
+        }
+
+        /** {@inheritDoc} */
+        @Override public <R> IgniteFuture<R> future() {
             throw new IllegalStateException("Deserialized transaction can only be used as
read-only.");
         }
 
         /** {@inheritDoc} */
-        @Override public void commit() {
+        @Override public long timeout(long timeout) {
             throw new IllegalStateException("Deserialized transaction can only be used as
read-only.");
         }
 
         /** {@inheritDoc} */
-        @Override public void close() {
+        @Override public boolean setRollbackOnly() {
             throw new IllegalStateException("Deserialized transaction can only be used as
read-only.");
         }
 
         /** {@inheritDoc} */
-        @Override public IgniteFuture<IgniteTx> commitAsync() {
+        @Override public void commit() {
+            throw new IllegalStateException("Deserialized transaction can only be used as
read-only.");
+        }
+
+        /** {@inheritDoc} */
+        @Override public void close() {
             throw new IllegalStateException("Deserialized transaction can only be used as
read-only.");
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b68f596/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxEx.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxEx.java
index 8c49f57..a318787 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxEx.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxEx.java
@@ -416,7 +416,6 @@ public interface IgniteTxEx<K, V> extends IgniteTx, GridTimeoutObject
{
     public boolean isSystemInvalidate();
 
     /**
-     * TODO-gg-4004 Put rollback async on public API?
      * Asynchronously rollback this transaction.
      *
      * @return Rollback future.
@@ -424,6 +423,13 @@ public interface IgniteTxEx<K, V> extends IgniteTx, GridTimeoutObject
{
     public IgniteFuture<IgniteTx> rollbackAsync();
 
     /**
+     * Asynchronously commits this transaction by initiating {@code two-phase-commit} process.
+     *
+     * @return Future for commit operation.
+     */
+    public IgniteFuture<IgniteTx> commitAsync();
+
+    /**
      * Callback invoked whenever there is a lock that has been acquired
      * by this transaction for any of the participating entries.
      *

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b68f596/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalEx.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalEx.java
index 7c8584c..63b5a79 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalEx.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxLocalEx.java
@@ -28,11 +28,6 @@ public interface IgniteTxLocalEx<K, V> extends IgniteTxEx<K, V>
{
     public GridCacheVersion minVersion();
 
     /**
-     * @return Future for this transaction.
-     */
-    public IgniteFuture<IgniteTxEx<K, V>> future();
-
-    /**
      * @return Commit error.
      */
     @Nullable public Throwable commitError();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b68f596/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxProxyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxProxyImpl.java
b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxProxyImpl.java
index a39a315..d45ca2d 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxProxyImpl.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxProxyImpl.java
@@ -14,6 +14,7 @@ import org.apache.ignite.lang.*;
 import org.apache.ignite.transactions.*;
 import org.gridgain.grid.*;
 import org.gridgain.grid.kernal.processors.cache.*;
+import org.gridgain.grid.util.future.*;
 import org.gridgain.grid.util.tostring.*;
 import org.gridgain.grid.util.typedef.internal.*;
 import org.jetbrains.annotations.*;
@@ -37,6 +38,12 @@ public class IgniteTxProxyImpl<K, V> implements IgniteTxProxy, Externalizable
{
     @GridToStringExclude
     private GridCacheSharedContext<K, V> cctx;
 
+    /** Async flag. */
+    private boolean async;
+
+    /** Async call result. */
+    private IgniteFuture asyncRes;
+
     /**
      * Empty constructor required for {@link Externalizable}.
      */
@@ -46,13 +53,16 @@ public class IgniteTxProxyImpl<K, V> implements IgniteTxProxy, Externalizable
{
 
     /**
      * @param tx Transaction.
+     * @param cctx Shared context.
+     * @param async Async flag.
      */
-    public IgniteTxProxyImpl(IgniteTxEx<K, V> tx, GridCacheSharedContext<K, V>
cctx) {
+    public IgniteTxProxyImpl(IgniteTxEx<K, V> tx, GridCacheSharedContext<K, V>
cctx, boolean async) {
         assert tx != null;
         assert cctx != null;
 
         this.tx = tx;
         this.cctx = cctx;
+        this.async = async;
     }
 
     /**
@@ -94,46 +104,73 @@ public class IgniteTxProxyImpl<K, V> implements IgniteTxProxy,
Externalizable {
 
     /** {@inheritDoc} */
     @Override public UUID nodeId() {
+        if (async)
+            save(tx.nodeId());
+
         return tx.nodeId();
     }
 
     /** {@inheritDoc} */
     @Override public long threadId() {
+        if (async)
+            save(tx.threadId());
+
         return tx.threadId();
     }
 
     /** {@inheritDoc} */
     @Override public long startTime() {
+        if (async)
+            save(tx.startTime());
+
         return tx.startTime();
     }
 
     /** {@inheritDoc} */
     @Override public IgniteTxIsolation isolation() {
+        if (async)
+            save(tx.isolation());
+
         return tx.isolation();
     }
 
     /** {@inheritDoc} */
     @Override public IgniteTxConcurrency concurrency() {
+        if (async)
+            save(tx.concurrency());
+
         return tx.concurrency();
     }
 
     /** {@inheritDoc} */
     @Override public boolean isInvalidate() {
+        if (async)
+            save(tx.isInvalidate());
+
         return tx.isInvalidate();
     }
 
     /** {@inheritDoc} */
     @Override public boolean implicit() {
+        if (async)
+            save(tx.implicit());
+
         return tx.implicit();
     }
 
     /** {@inheritDoc} */
     @Override public long timeout() {
+        if (async)
+            save(tx.timeout());
+
         return tx.timeout();
     }
 
     /** {@inheritDoc} */
     @Override public IgniteTxState state() {
+        if (async)
+            save(tx.state());
+
         return tx.state();
     }
 
@@ -143,6 +180,22 @@ public class IgniteTxProxyImpl<K, V> implements IgniteTxProxy,
Externalizable {
     }
 
     /** {@inheritDoc} */
+    @Override public IgniteAsyncSupport enableAsync() {
+        return new IgniteTxProxyImpl<>(tx, cctx, true);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isAsync() {
+        return async;
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public <R> IgniteFuture<R> future() {
+        return asyncRes;
+    }
+
+    /** {@inheritDoc} */
     @Override public boolean setRollbackOnly() {
         enter();
 
@@ -159,6 +212,9 @@ public class IgniteTxProxyImpl<K, V> implements IgniteTxProxy, Externalizable
{
         enter();
 
         try {
+            if (async)
+                save(tx.isRollbackOnly());
+
             return tx.isRollbackOnly();
         }
         finally {
@@ -171,7 +227,12 @@ public class IgniteTxProxyImpl<K, V> implements IgniteTxProxy,
Externalizable {
         enter();
 
         try {
-            cctx.commitTxAsync(tx).get();
+            IgniteFuture<IgniteTx> commitFut = cctx.commitTxAsync(tx);
+
+            if (async)
+                asyncRes = commitFut;
+            else
+                commitFut.get();
         }
         finally {
             leave();
@@ -191,28 +252,27 @@ public class IgniteTxProxyImpl<K, V> implements IgniteTxProxy,
Externalizable {
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteFuture<IgniteTx> commitAsync() {
+    @Override public void rollback() throws IgniteCheckedException {
         enter();
 
         try {
+            IgniteFuture rollbackFut = cctx.rollbackTxAsync(tx);
 
-            return cctx.commitTxAsync(tx);
+            if (async)
+                asyncRes = rollbackFut;
+            else
+                rollbackFut.get();
         }
         finally {
             leave();
         }
     }
 
-    /** {@inheritDoc} */
-    @Override public void rollback() throws IgniteCheckedException {
-        enter();
-
-        try {
-            cctx.rollbackTx(tx);
-        }
-        finally {
-            leave();
-        }
+    /**
+     * @param res Result to convert to finished future.
+     */
+    private void save(Object res) {
+        asyncRes = new GridFinishedFutureEx<>(res);
     }
 
     /** {@inheritDoc} */
@@ -294,7 +354,7 @@ public class IgniteTxProxyImpl<K, V> implements IgniteTxProxy, Externalizable
{
 
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
-        tx = (IgniteTxAdapter<K, V>)in.readObject();
+        tx = (IgniteTxEx<K, V>)in.readObject();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b68f596/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 77482d4..36ebc57 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -1555,7 +1555,15 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         IgniteFuture<Boolean> fut1 = cache().putxAsync("key1", 10);
         IgniteFuture<Boolean> fut2 = cache().putxAsync("key2", 11);
 
-        IgniteFuture<IgniteTx> f = tx == null ? null : tx.commitAsync();
+        IgniteFuture<IgniteTx> f = null;
+
+        if (tx != null) {
+            tx = (IgniteTx)tx.enableAsync();
+
+            tx.commit();
+
+            f = tx.future();
+        }
 
         assert fut1.get();
         assert fut2.get();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b68f596/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheLifecycleAwareSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheLifecycleAwareSelfTest.java
b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheLifecycleAwareSelfTest.java
index 08682ee..6ef64e8 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheLifecycleAwareSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheLifecycleAwareSelfTest.java
@@ -13,6 +13,7 @@ import org.apache.ignite.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.lang.*;
+import org.apache.ignite.lifecycle.LifecycleAware;
 import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.transactions.*;
 import org.gridgain.grid.cache.*;
@@ -29,7 +30,7 @@ import static org.gridgain.grid.cache.GridCacheDistributionMode.*;
 import static org.gridgain.grid.cache.GridCacheMode.*;
 
 /**
- * Test for {@link org.apache.ignite.lifecycle.LifecycleAware} support in {@link GridCacheConfiguration}.
+ * Test for {@link LifecycleAware} support in {@link GridCacheConfiguration}.
  */
 public class GridCacheLifecycleAwareSelfTest extends GridAbstractLifecycleAwareSelfTest {
     /** */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b68f596/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheReferenceCleanupSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheReferenceCleanupSelfTest.java
b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheReferenceCleanupSelfTest.java
index 603de12..67c9afb 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheReferenceCleanupSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheReferenceCleanupSelfTest.java
@@ -430,7 +430,7 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest
{
 
                     cache.putx(0, val);
 
-                    tx.commitAsync().get();
+                    tx.commit();
                 }
                 finally {
                     G.stop(g.name(), cancel);
@@ -469,7 +469,7 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest
{
                         cache.putxAsync(i, val);
                     }
 
-                    tx.commitAsync().get();
+                    tx.commit();
                 }
                 finally {
                     G.stop(g.name(), cancel);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b68f596/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
index 2f04b85..3b48c09 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
@@ -178,7 +178,11 @@ public abstract class IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest
 
                     info("Before commitAsync");
 
-                    IgniteFuture<IgniteTx> fut = tx.commitAsync();
+                    tx = (IgniteTx)tx.enableAsync();
+
+                    tx.commit();
+
+                    IgniteFuture<IgniteTx> fut = tx.future();
 
                     info("Got future for commitAsync().");
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b68f596/modules/core/src/test/java/org/gridgain/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java
b/modules/core/src/test/java/org/gridgain/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java
index 4d283a4..bcc8799 100644
--- a/modules/core/src/test/java/org/gridgain/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java
@@ -483,7 +483,17 @@ public abstract class GridAbstractCacheStoreSelfTest<T extends GridCacheStore<Ob
         }
 
         /** {@inheritDoc} */
-        @Nullable @Override public IgniteFuture<IgniteTx> commitAsync() {
+        @Override public IgniteAsyncSupport enableAsync() {
+            throw new UnsupportedOperationException();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isAsync() {
+            return false;
+        }
+
+        /** {@inheritDoc} */
+        @Override public <R> IgniteFuture<R> future() {
             return null;
         }
 


Mime
View raw message