http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java index e0dcbfa..c88604b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java @@ -43,8 +43,8 @@ import static org.apache.ignite.internal.managers.communication.GridIoPolicy.*; /** * */ -public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFuture<IgniteTx> - implements GridCacheFuture<IgniteTx> { +public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFuture<IgniteTxEx> + implements GridCacheFuture<IgniteTxEx> { /** */ private static final long serialVersionUID = 0L; @@ -93,7 +93,7 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur * @param commit Commit flag. */ public GridDhtTxFinishFuture(GridCacheSharedContext<K, V> cctx, GridDhtTxLocalAdapter<K, V> tx, boolean commit) { - super(cctx.kernalContext(), F.<IgniteTx>identityReducer(tx)); + super(cctx.kernalContext(), F.<IgniteTxEx>identityReducer(tx)); assert cctx != null; @@ -201,7 +201,7 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur */ public void onResult(UUID nodeId, GridDhtTxFinishResponse<K, V> res) { if (!isDone()) { - for (IgniteInternalFuture<IgniteTx> fut : futures()) { + for (IgniteInternalFuture<IgniteTxEx> fut : futures()) { if (isMini(fut)) { MiniFuture f = (MiniFuture)fut; @@ -216,7 +216,7 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur } /** {@inheritDoc} */ - @Override public boolean onDone(IgniteTx tx, Throwable err) { + @Override public boolean onDone(IgniteTxEx tx, Throwable err) { if (initialized() || err != null) { if (this.tx.onePhaseCommit() && (this.tx.state() == COMMITTING)) this.tx.tmCommit(); @@ -446,7 +446,7 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur * Mini-future for get operations. Mini-futures are only waiting on a single * node as opposed to multiple nodes. */ - private class MiniFuture extends GridFutureAdapter<IgniteTx> { + private class MiniFuture extends GridFutureAdapter<IgniteTxEx> { /** */ private static final long serialVersionUID = 0L;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java index 2197ca2..55b63a5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java @@ -450,7 +450,7 @@ public class GridDhtTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> implements /** {@inheritDoc} */ @SuppressWarnings({"ThrowableInstanceNeverThrown"}) - @Override public IgniteInternalFuture<IgniteTx> commitAsync() { + @Override public IgniteInternalFuture<IgniteTxEx> commitAsync() { if (log.isDebugEnabled()) log.debug("Committing dht local tx: " + this); @@ -545,7 +545,7 @@ public class GridDhtTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> implements } /** {@inheritDoc} */ - @Override public IgniteInternalFuture<IgniteTx> rollbackAsync() { + @Override public IgniteInternalFuture<IgniteTxEx> rollbackAsync() { GridDhtTxPrepareFuture<K, V> prepFut = this.prepFut.get(); final GridDhtTxFinishFuture<K, V> fut = new GridDhtTxFinishFuture<>(cctx, this, /*rollback*/false); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java index 00994f9..cc352f4 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java @@ -45,8 +45,8 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*; /** * */ -public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFuture<IgniteTx> - implements GridCacheFuture<IgniteTx> { +public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFuture<IgniteTxEx> + implements GridCacheFuture<IgniteTxEx> { /** */ private static final long serialVersionUID = 0L; @@ -91,7 +91,7 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu * @param commit Commit flag. */ public GridNearTxFinishFuture(GridCacheSharedContext<K, V> cctx, GridNearTxLocal<K, V> tx, boolean commit) { - super(cctx.kernalContext(), F.<IgniteTx>identityReducer(tx)); + super(cctx.kernalContext(), F.<IgniteTxEx>identityReducer(tx)); assert cctx != null; @@ -200,7 +200,7 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu */ public void onResult(UUID nodeId, GridNearTxFinishResponse<K, V> res) { if (!isDone()) - for (IgniteInternalFuture<IgniteTx> fut : futures()) { + for (IgniteInternalFuture<IgniteTxEx> fut : futures()) { if (isMini(fut)) { MiniFuture f = (MiniFuture)fut; @@ -214,7 +214,7 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu } /** {@inheritDoc} */ - @Override public boolean onDone(IgniteTx tx, Throwable err) { + @Override public boolean onDone(IgniteTxEx tx, Throwable err) { if ((initialized() || err != null)) { if (this.tx.onePhaseCommit() && (this.tx.state() == COMMITTING)) this.tx.tmCommit(); @@ -283,7 +283,7 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu // Finish local mapping only as we need send commit message to backups. for (GridDistributedTxMapping<K, V> m : mappings.values()) { if (m.node().isLocal()) { - IgniteInternalFuture<IgniteTx> fut = cctx.tm().txHandler().finishColocatedLocal(commit, tx); + IgniteInternalFuture<IgniteTxEx> fut = cctx.tm().txHandler().finishColocatedLocal(commit, tx); // Add new future. if (fut != null) @@ -370,7 +370,7 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu if (n.isLocal()) { req.miniId(IgniteUuid.randomUuid()); - IgniteInternalFuture<IgniteTx> fut = cctx.tm().txHandler().finish(n.id(), tx, req); + IgniteInternalFuture<IgniteTxEx> fut = cctx.tm().txHandler().finish(n.id(), tx, req); // Add new future. if (fut != null) @@ -415,7 +415,7 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu * Mini-future for get operations. Mini-futures are only waiting on a single * node as opposed to multiple nodes. */ - private class MiniFuture extends GridFutureAdapter<IgniteTx> { + private class MiniFuture extends GridFutureAdapter<IgniteTxEx> { /** */ private static final long serialVersionUID = 0L; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java index ac5404b..95f7593 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java @@ -762,7 +762,7 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> { /** {@inheritDoc} */ @SuppressWarnings({"ThrowableInstanceNeverThrown"}) - @Override public IgniteInternalFuture<IgniteTx> commitAsync() { + @Override public IgniteInternalFuture<IgniteTxEx> commitAsync() { if (log.isDebugEnabled()) log.debug("Committing near local tx: " + this); @@ -808,7 +808,7 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> { } /** {@inheritDoc} */ - @Override public IgniteInternalFuture<IgniteTx> rollbackAsync() { + @Override public IgniteInternalFuture<IgniteTxEx> rollbackAsync() { if (log.isDebugEnabled()) log.debug("Rolling back near tx: " + this); @@ -956,7 +956,7 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> { * * @return Commit future. */ - public IgniteInternalFuture<IgniteTx> commitAsyncLocal() { + public IgniteInternalFuture<IgniteTxEx> commitAsyncLocal() { if (log.isDebugEnabled()) log.debug("Committing colocated tx locally: " + this); @@ -969,9 +969,9 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> { // Do not create finish future if there are no remote nodes. if (F.isEmpty(dhtMap) && F.isEmpty(nearMap)) { if (prep != null) - return (IgniteInternalFuture<IgniteTx>)(IgniteInternalFuture)prep; + return (IgniteInternalFuture<IgniteTxEx>)(IgniteInternalFuture)prep; - return new GridFinishedFuture<IgniteTx>(cctx.kernalContext(), this); + return new GridFinishedFuture<IgniteTxEx>(cctx.kernalContext(), this); } final GridDhtTxFinishFuture<K, V> fut = new GridDhtTxFinishFuture<>(cctx, this, /*commit*/true); @@ -1029,7 +1029,7 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> { * * @return Commit future. */ - public IgniteInternalFuture<IgniteTx> rollbackAsyncLocal() { + public IgniteInternalFuture<IgniteTxEx> rollbackAsyncLocal() { if (log.isDebugEnabled()) log.debug("Rolling back colocated tx locally: " + this); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalTx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalTx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalTx.java index 17181d8..e53c98b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalTx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalTx.java @@ -146,7 +146,7 @@ class GridLocalTx<K, V> extends IgniteTxLocalAdapter<K, V> { /** {@inheritDoc} */ @SuppressWarnings( {"unchecked", "RedundantCast"}) - @Override public IgniteInternalFuture<IgniteTx> commitAsync() { + @Override public IgniteInternalFuture<IgniteTxEx> commitAsync() { try { prepare(); } @@ -177,7 +177,7 @@ class GridLocalTx<K, V> extends IgniteTxLocalAdapter<K, V> { } /** {@inheritDoc} */ - @Override public IgniteInternalFuture<IgniteTx> rollbackAsync() { + @Override public IgniteInternalFuture<IgniteTxEx> rollbackAsync() { try { state(ROLLING_BACK); @@ -185,7 +185,7 @@ class GridLocalTx<K, V> extends IgniteTxLocalAdapter<K, V> { state(ROLLED_BACK); - return new GridFinishedFuture<IgniteTx>(cctx.kernalContext(), this); + return new GridFinishedFuture<IgniteTxEx>(cctx.kernalContext(), this); } catch (IgniteCheckedException e) { return new GridFinishedFuture<>(cctx.kernalContext(), e); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java index de7416e..7c39317 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java @@ -55,7 +55,7 @@ public class IgniteTransactionsImpl<K, V> implements IgniteTransactionsEx { cfg.getDefaultTxTimeout(), 0, false - ); + ).proxy(); } /** {@inheritDoc} */ @@ -71,7 +71,7 @@ public class IgniteTransactionsImpl<K, V> implements IgniteTransactionsEx { cfg.getDefaultTxTimeout(), 0, false - ); + ).proxy(); } /** {@inheritDoc} */ @@ -88,9 +88,88 @@ public class IgniteTransactionsImpl<K, V> implements IgniteTransactionsEx { timeout, txSize, false - ); + ).proxy(); + } + + /** {@inheritDoc} */ + @Override public IgniteTxEx txStartEx( + GridCacheContext ctx, + IgniteTxConcurrency concurrency, + IgniteTxIsolation isolation, + long timeout, + int txSize) + { + A.notNull(concurrency, "concurrency"); + A.notNull(isolation, "isolation"); + A.ensure(timeout >= 0, "timeout cannot be negative"); + A.ensure(txSize >= 0, "transaction size cannot be negative"); + + return txStart0(concurrency, + isolation, + timeout, + txSize, + ctx.system()); } + /** {@inheritDoc} */ + @Override public IgniteTxEx txStartEx( + GridCacheContext ctx, + IgniteTxConcurrency concurrency, + IgniteTxIsolation isolation) + { + A.notNull(concurrency, "concurrency"); + A.notNull(isolation, "isolation"); + + TransactionsConfiguration cfg = cctx.gridConfig().getTransactionsConfiguration(); + + return txStart0(concurrency, + isolation, + cfg.getDefaultTxTimeout(), + 0, + ctx.system()); + } + + /** {@inheritDoc} */ + @Override public IgniteTxEx txStartAffinity(GridCacheContext ctx, + Object affinityKey, + IgniteTxConcurrency concurrency, + IgniteTxIsolation isolation, + long timeout, + int txSize) + throws IgniteCheckedException + { + return txStartGroupLock(ctx, + affinityKey, + concurrency, + isolation, + false, + timeout, + txSize, + ctx.system()); + } + + /** {@inheritDoc} */ + @Override public IgniteTxEx txStartPartitionEx(GridCacheContext ctx, + int partId, + IgniteTxConcurrency concurrency, + IgniteTxIsolation isolation, + long timeout, + int txSize) + throws IgniteCheckedException + { + Object grpLockKey = ctx.affinity().partitionAffinityKey(partId); + + return txStartGroupLock(ctx, + grpLockKey, + concurrency, + isolation, + true, + timeout, + txSize, + ctx.system()); + } + + /** {@inheritDoc} */ @Override public IgniteTx txStartSystem(IgniteTxConcurrency concurrency, IgniteTxIsolation isolation, long timeout, int txSize) { A.notNull(concurrency, "concurrency"); @@ -104,7 +183,7 @@ public class IgniteTransactionsImpl<K, V> implements IgniteTransactionsEx { timeout, txSize, true - ); + ).proxy(); } /** @@ -115,7 +194,7 @@ public class IgniteTransactionsImpl<K, V> implements IgniteTransactionsEx { * @param sys System flag. * @return Transaction. */ - private IgniteTx txStart0(IgniteTxConcurrency concurrency, IgniteTxIsolation isolation, + private IgniteTxEx txStart0(IgniteTxConcurrency concurrency, IgniteTxIsolation isolation, long timeout, int txSize, boolean sys) { TransactionsConfiguration cfg = cctx.gridConfig().getTransactionsConfiguration(); @@ -145,26 +224,36 @@ public class IgniteTransactionsImpl<K, V> implements IgniteTransactionsEx { assert tx != null; - // Wrap into proxy. - return new IgniteTxProxyImpl<>(tx, cctx, false); - + return tx; } /** {@inheritDoc} */ @Override public IgniteTx txStartAffinity(String cacheName, Object affinityKey, IgniteTxConcurrency concurrency, - IgniteTxIsolation isolation, long timeout, int txSize) throws IllegalStateException, IgniteCheckedException { + IgniteTxIsolation isolation, long timeout, int txSize) throws IllegalStateException, IgniteException { GridCacheAdapter<Object, Object> cache = cctx.kernalContext().cache().internalCache(cacheName); if (cache == null) throw new IllegalArgumentException("Failed to find cache with given name (cache is not configured): " + cacheName); - return txStartGroupLock(cache.context(), affinityKey, concurrency, isolation, false, timeout, txSize, false); + try { + return txStartGroupLock(cache.context(), + affinityKey, + concurrency, + isolation, + false, + timeout, + txSize, + false).proxy(); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ @Override public IgniteTx txStartPartition(String cacheName, int partId, IgniteTxConcurrency concurrency, - IgniteTxIsolation isolation, long timeout, int txSize) throws IllegalStateException, IgniteCheckedException { + IgniteTxIsolation isolation, long timeout, int txSize) throws IllegalStateException, IgniteException { GridCacheAdapter<Object, Object> cache = cctx.kernalContext().cache().internalCache(cacheName); if (cache == null) @@ -173,12 +262,25 @@ public class IgniteTransactionsImpl<K, V> implements IgniteTransactionsEx { Object grpLockKey = cache.context().affinity().partitionAffinityKey(partId); - return txStartGroupLock(cache.context(), grpLockKey, concurrency, isolation, true, timeout, txSize, false); + try { + return txStartGroupLock(cache.context(), + grpLockKey, + concurrency, + isolation, + true, + timeout, + txSize, + false).proxy(); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** * Internal method to start group-lock transaction. * + * @param ctx Cache context. * @param grpLockKey Group lock key. * @param concurrency Transaction concurrency control. * @param isolation Transaction isolation level. @@ -192,10 +294,10 @@ public class IgniteTransactionsImpl<K, V> implements IgniteTransactionsEx { * @throws IgniteCheckedException In case of error. */ @SuppressWarnings("unchecked") - private IgniteTx txStartGroupLock(GridCacheContext ctx, Object grpLockKey, IgniteTxConcurrency concurrency, + private IgniteTxEx txStartGroupLock(GridCacheContext ctx, Object grpLockKey, IgniteTxConcurrency concurrency, IgniteTxIsolation isolation, boolean partLock, long timeout, int txSize, boolean sys) throws IllegalStateException, IgniteCheckedException { - IgniteTx tx = cctx.tm().userTx(); + IgniteTxEx tx = cctx.tm().userTx(); if (tx != null) throw new IllegalStateException("Failed to start new transaction " + @@ -231,13 +333,14 @@ public class IgniteTransactionsImpl<K, V> implements IgniteTransactionsEx { throw e; } - // Wrap into proxy. - return new IgniteTxProxyImpl<>(tx0, cctx, false); + return tx0; } /** {@inheritDoc} */ @Nullable @Override public IgniteTx tx() { - return cctx.tm().userTx(); + IgniteTxEx tx = cctx.tm().userTx(); + + return tx != null ? tx.proxy() : null; } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java index e009b65..6b8c9ed 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java @@ -180,7 +180,7 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter /** */ @GridToStringExclude - private AtomicReference<GridFutureAdapter<IgniteTx>> finFut = new AtomicReference<>(); + private AtomicReference<GridFutureAdapter<IgniteTxEx>> finFut = new AtomicReference<>(); /** Topology version. */ private AtomicLong topVer = new AtomicLong(-1); @@ -203,6 +203,9 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter /** Store used flag. */ protected boolean storeEnabled = true; + /** */ + private IgniteTxProxyImpl proxy; + /** * Empty constructor required for {@link Externalizable}. */ @@ -547,21 +550,6 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter return finalizing.get(); } - /** {@inheritDoc} */ - @Override public IgniteAsyncSupport withAsync() { - throw new UnsupportedOperationException("withAsync() 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. */ @@ -950,11 +938,11 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter /** {@inheritDoc} */ @SuppressWarnings("ExternalizableWithoutPublicNoArgConstructor") - @Override public IgniteInternalFuture<IgniteTx> finishFuture() { - GridFutureAdapter<IgniteTx> fut = finFut.get(); + @Override public IgniteInternalFuture<IgniteTxEx> finishFuture() { + GridFutureAdapter<IgniteTxEx> fut = finFut.get(); if (fut == null) { - fut = new GridFutureAdapter<IgniteTx>(cctx.kernalContext()) { + fut = new GridFutureAdapter<IgniteTxEx>(cctx.kernalContext()) { @Override public String toString() { return S.toString(GridFutureAdapter.class, this, "tx", IgniteTxAdapter.this); } @@ -1076,7 +1064,7 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter } if (notify) { - GridFutureAdapter<IgniteTx> fut = finFut.get(); + GridFutureAdapter<IgniteTxEx> fut = finFut.get(); if (fut != null) fut.onDone(this); @@ -1419,6 +1407,14 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter } /** {@inheritDoc} */ + @Override public IgniteTxProxy proxy() { + if (proxy == null) + proxy = new IgniteTxProxyImpl(this, cctx, false); + + return proxy; + } + + /** {@inheritDoc} */ @Override public boolean equals(Object o) { return o == this || (o instanceof IgniteTxAdapter && xidVer.equals(((IgniteTxAdapter)o).xidVer)); } @@ -1438,7 +1434,7 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter /** * Transaction shadow class to be used for deserialization. */ - private static class TxShadow extends GridMetadataAwareAdapter implements IgniteTx { + private static class TxShadow implements IgniteTxEx { /** */ private static final long serialVersionUID = 0L; @@ -1560,48 +1556,474 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter } /** {@inheritDoc} */ - @Override public IgniteAsyncSupport withAsync() { + @Override public long timeout(long timeout) { + throw new IllegalStateException("Deserialized transaction can only be used as read-only."); + } + + /** {@inheritDoc} */ + @Override public boolean setRollbackOnly() { + throw new IllegalStateException("Deserialized transaction can only be used as read-only."); + } + + /** {@inheritDoc} */ + @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."); + } + + /** {@inheritDoc} */ + @Override public void rollback() { + throw new IllegalStateException("Deserialized transaction can only be used as read-only."); + } + + /** {@inheritDoc} */ + @Override public Collection<Integer> activeCacheIds() { + throw new IllegalStateException("Deserialized transaction can only be used as read-only."); + } + + /** {@inheritDoc} */ + @Nullable @Override public Object addMeta(String name, Object val) { + throw new IllegalStateException("Deserialized transaction can only be used as read-only."); + } + + /** {@inheritDoc} */ + @Nullable @Override public Object removeMeta(String name) { + throw new IllegalStateException("Deserialized transaction can only be used as read-only."); + } + + /** {@inheritDoc} */ + @Nullable @Override public Object meta(String name) { + throw new IllegalStateException("Deserialized transaction can only be used as read-only."); + } + + /** {@inheritDoc} */ + @Override public int size() { + throw new IllegalStateException("Deserialized transaction can only be used as read-only."); + } + + /** {@inheritDoc} */ + @Override public boolean storeEnabled() { + throw new IllegalStateException("Deserialized transaction can only be used as read-only."); + } + + /** {@inheritDoc} */ + @Override public boolean storeUsed() { + throw new IllegalStateException("Deserialized transaction can only be used as read-only."); + } + + /** {@inheritDoc} */ + @Override public boolean system() { + throw new IllegalStateException("Deserialized transaction can only be used as read-only."); + } + + /** {@inheritDoc} */ + @Override public long topologyVersion() { + throw new IllegalStateException("Deserialized transaction can only be used as read-only."); + } + + /** {@inheritDoc} */ + @Override public boolean implicitSingle() { + throw new IllegalStateException("Deserialized transaction can only be used as read-only."); + } + + /** {@inheritDoc} */ + @Override public long topologyVersion(long topVer) { + throw new IllegalStateException("Deserialized transaction can only be used as read-only."); + } + + /** {@inheritDoc} */ + @Override public boolean empty() { throw new IllegalStateException("Deserialized transaction can only be used as read-only."); } /** {@inheritDoc} */ - @Override public boolean isAsync() { + @Override public boolean groupLock() { return false; } /** {@inheritDoc} */ - @Override public <R> IgniteFuture<R> future() { + @Nullable @Override public IgniteTxKey groupLockKey() { throw new IllegalStateException("Deserialized transaction can only be used as read-only."); } /** {@inheritDoc} */ - @Override public long timeout(long timeout) { + @Override public boolean markPreparing() { throw new IllegalStateException("Deserialized transaction can only be used as read-only."); } /** {@inheritDoc} */ - @Override public boolean setRollbackOnly() { + @Override public boolean markFinalizing(FinalizationStatus status) { throw new IllegalStateException("Deserialized transaction can only be used as read-only."); } /** {@inheritDoc} */ - @Override public void commit() { + @Override public void addInvalidPartition(GridCacheContext cacheCtx, int part) { throw new IllegalStateException("Deserialized transaction can only be used as read-only."); } /** {@inheritDoc} */ - @Override public void close() { + @Override public Set<Integer> invalidPartitions() { throw new IllegalStateException("Deserialized transaction can only be used as read-only."); } /** {@inheritDoc} */ - @Override public void rollback() { + @Nullable @Override public GridCacheVersion ownedVersion(IgniteTxKey key) { throw new IllegalStateException("Deserialized transaction can only be used as read-only."); } /** {@inheritDoc} */ + @Nullable @Override public UUID otherNodeId() { + throw new IllegalStateException("Deserialized transaction can only be used as read-only."); + } + + /** {@inheritDoc} */ + @Override public UUID eventNodeId() { + throw new IllegalStateException("Deserialized transaction can only be used as read-only."); + } + + /** {@inheritDoc} */ + @Override public UUID originatingNodeId() { + throw new IllegalStateException("Deserialized transaction can only be used as read-only."); + } + + /** {@inheritDoc} */ + @Override public Collection<UUID> masterNodeIds() { + return null; + } + + /** {@inheritDoc} */ + @Nullable @Override public GridCacheVersion nearXidVersion() { + return null; + } + + /** {@inheritDoc} */ + @Nullable @Override public Map<UUID, Collection<UUID>> transactionNodes() { + return null; + } + + /** {@inheritDoc} */ + @Override public boolean ownsLock(GridCacheEntryEx entry) throws GridCacheEntryRemovedException { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean ownsLockUnsafe(GridCacheEntryEx entry) { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean enforceSerializable() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean near() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean dht() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean colocated() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean local() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean replicated() { + return false; + } + + /** {@inheritDoc} */ + @Override public UUID subjectId() { + return null; + } + + /** {@inheritDoc} */ + @Override public int taskNameHash() { + return 0; + } + + /** {@inheritDoc} */ + @Override public boolean user() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean syncCommit() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean syncRollback() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean hasWriteKey(IgniteTxKey key) { + return false; + } + + /** {@inheritDoc} */ + @Override public Set<IgniteTxKey> readSet() { + return null; + } + + /** {@inheritDoc} */ + @Override public Set<IgniteTxKey> writeSet() { + return null; + } + + /** {@inheritDoc} */ + @Override public Collection<IgniteTxEntry> allEntries() { + return null; + } + + /** {@inheritDoc} */ + @Override public Collection<IgniteTxEntry> writeEntries() { + return null; + } + + /** {@inheritDoc} */ + @Override public Collection<IgniteTxEntry> readEntries() { + return null; + } + + /** {@inheritDoc} */ + @Override public Map<IgniteTxKey, IgniteTxEntry> writeMap() { + return null; + } + + /** {@inheritDoc} */ + @Override public Map<IgniteTxKey, IgniteTxEntry> readMap() { + return null; + } + + /** {@inheritDoc} */ + @Override public Collection<IgniteTxEntry> recoveryWrites() { + return null; + } + + /** {@inheritDoc} */ + @Override public Collection<IgniteTxEntry> optimisticLockEntries() { + return null; + } + + /** {@inheritDoc} */ + @Override public void seal() { + + } + + /** {@inheritDoc} */ + @Nullable @Override public IgniteTxEntry entry(IgniteTxKey key) { + return null; + } + + @Nullable + @Override + public GridTuple peek(GridCacheContext ctx, boolean failFast, Object key, @Nullable IgnitePredicate[] filter) throws GridCacheFilterFailedException { + return null; + } + + /** {@inheritDoc} */ + @Override public GridCacheVersion startVersion() { + return null; + } + + /** {@inheritDoc} */ + @Override public GridCacheVersion xidVersion() { + return null; + } + + /** {@inheritDoc} */ + @Override public GridCacheVersion commitVersion() { + return null; + } + + /** {@inheritDoc} */ + @Override public boolean commitVersion(GridCacheVersion commitVer) { + return false; + } + + /** {@inheritDoc} */ + @Override public GridCacheVersion endVersion() { + return null; + } + + /** {@inheritDoc} */ + @Override public void prepare() throws IgniteCheckedException { + + } + + /** {@inheritDoc} */ + @Override public IgniteInternalFuture<IgniteTxEx> prepareAsync() { + return null; + } + + /** {@inheritDoc} */ + @Override public void endVersion(GridCacheVersion endVer) { + + } + + /** {@inheritDoc} */ + @Override public GridCacheVersion writeVersion() { + return null; + } + + /** {@inheritDoc} */ + @Override public void writeVersion(GridCacheVersion ver) { + + } + + /** {@inheritDoc} */ + @Override public IgniteInternalFuture<IgniteTxEx> finishFuture() { + return null; + } + + /** {@inheritDoc} */ + @Override public boolean state(IgniteTxState state) { + return false; + } + + @Override + public void invalidate(boolean invalidate) { + + } + + /** {@inheritDoc} */ + @Override public void systemInvalidate(boolean sysInvalidate) { + + } + + /** {@inheritDoc} */ + @Override public boolean isSystemInvalidate() { + return false; + } + + /** {@inheritDoc} */ + @Override public IgniteInternalFuture<IgniteTxEx> rollbackAsync() { + return null; + } + + /** {@inheritDoc} */ + @Override public IgniteInternalFuture<IgniteTxEx> commitAsync() { + return null; + } + + /** {@inheritDoc} */ + @Override public boolean onOwnerChanged(GridCacheEntryEx entry, GridCacheMvccCandidate owner) { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean timedOut() { + return false; + } + + @Override + public boolean done() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean optimistic() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean pessimistic() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean readCommitted() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean repeatableRead() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean serializable() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean removed(IgniteTxKey key) { + return false; + } + + /** {@inheritDoc} */ + @Override public long remainingTime() throws IgniteTxTimeoutException { + return 0; + } + + /** {@inheritDoc} */ + @Override public Collection<GridCacheVersion> alternateVersions() { + return null; + } + + /** {@inheritDoc} */ + @Override public boolean needsCompletedVersions() { + return false; + } + + /** {@inheritDoc} */ + @Override public void completedVersions(GridCacheVersion base, Collection committed, Collection rolledback) { + + } + + /** {@inheritDoc} */ + @Override public boolean internal() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean onePhaseCommit() { + return false; + } + + /** {@inheritDoc} */ + @Override public boolean hasTransforms() { + return false; + } + + /** {@inheritDoc} */ + @Override public IgniteTxProxy proxy() { + return null; + } + + /** {@inheritDoc} */ + @Override public IgniteUuid timeoutId() { + return null; + } + + /** {@inheritDoc} */ + @Override public long endTime() { + return 0; + } + + /** {@inheritDoc} */ + @Override public void onTimeout() { + + } + + /** {@inheritDoc} */ @Override public boolean equals(Object o) { - return this == o || o instanceof IgniteTx && xid.equals(((IgniteTx)o).xid()); + return this == o || o instanceof IgniteTxEx && xid.equals(((IgniteTxEx)o).xid()); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEx.java index 63e4786..1bddf07 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEx.java @@ -33,7 +33,7 @@ import java.util.*; /** * Transaction managed by cache ({@code 'Ex'} stands for external). */ -public interface IgniteTxEx<K, V> extends IgniteTx, GridTimeoutObject { +public interface IgniteTxEx<K, V> extends AutoCloseable, GridTimeoutObject { /** * */ @@ -53,6 +53,165 @@ public interface IgniteTxEx<K, V> extends IgniteTx, GridTimeoutObject { } /** + * 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 IgniteTxIsolation isolation(); + + /** + * Cache transaction concurrency mode. + * + * @return Concurrency mode. + */ + public IgniteTxConcurrency 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 IgniteTxState state(); + + /** + * Gets timeout value in milliseconds for this transaction. If transaction times + * out prior to it's completion, {@link IgniteTxTimeoutException} 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. + */ + @IgniteAsyncSupported + 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; + + /** + * Rolls back this transaction. + * + * @throws IgniteCheckedException If rollback failed. + */ + @IgniteAsyncSupported + public void rollback() throws IgniteCheckedException; + + /** + * Removes metadata by name. + * + * @param name Name of the metadata to remove. + * @param <T> Type of the value. + * @return Value of removed metadata or {@code null}. + */ + @Nullable public <T> T removeMeta(String name); + + /** + * Gets metadata by name. + * + * @param name Metadata name. + * @param <T> Type of the value. + * @return Metadata value or {@code null}. + */ + @Nullable public <T> T meta(String name); + + /** + * Adds a new metadata. + * + * @param name Metadata name. + * @param val Metadata value. + * @param <T> Type of the value. + * @return Metadata previously associated with given name, or + * {@code null} if there was none. + */ + @Nullable public <T> T addMeta(String name, T val); + + /** * @return Size of the transaction. */ public int size(); @@ -407,7 +566,7 @@ public interface IgniteTxEx<K, V> extends IgniteTx, GridTimeoutObject { /** * @return Future for transaction completion. */ - public IgniteInternalFuture<IgniteTx> finishFuture(); + public IgniteInternalFuture<IgniteTxEx> finishFuture(); /** * @param state Transaction state. @@ -435,14 +594,14 @@ public interface IgniteTxEx<K, V> extends IgniteTx, GridTimeoutObject { * * @return Rollback future. */ - public IgniteInternalFuture<IgniteTx> rollbackAsync(); + public IgniteInternalFuture<IgniteTxEx> rollbackAsync(); /** * Asynchronously commits this transaction by initiating {@code two-phase-commit} process. * * @return Future for commit operation. */ - public IgniteInternalFuture<IgniteTx> commitAsync(); + public IgniteInternalFuture<IgniteTxEx> commitAsync(); /** * Callback invoked whenever there is a lock that has been acquired @@ -538,4 +697,9 @@ public interface IgniteTxEx<K, V> extends IgniteTx, GridTimeoutObject { * transactions. */ public boolean hasTransforms(); + + /** + * @return Public API proxy. + */ + public IgniteTxProxy proxy(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java index 2bc62ec..07b8839 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java @@ -345,7 +345,7 @@ public class IgniteTxHandler<K, V> { private void processNearTxFinishResponse(UUID nodeId, GridNearTxFinishResponse<K, V> res) { ctx.tm().onFinishedRemote(nodeId, res.threadId()); - GridNearTxFinishFuture<K, V> fut = (GridNearTxFinishFuture<K, V>)ctx.mvcc().<IgniteTx>future( + GridNearTxFinishFuture<K, V> fut = (GridNearTxFinishFuture<K, V>)ctx.mvcc().<IgniteTxEx>future( res.xid(), res.futureId()); if (fut == null) { @@ -384,7 +384,7 @@ public class IgniteTxHandler<K, V> { assert nodeId != null; assert res != null; - GridDhtTxFinishFuture<K, V> fut = (GridDhtTxFinishFuture<K, V>)ctx.mvcc().<IgniteTx>future(res.xid(), + GridDhtTxFinishFuture<K, V> fut = (GridDhtTxFinishFuture<K, V>)ctx.mvcc().<IgniteTxEx>future(res.xid(), res.futureId()); if (fut == null) { @@ -402,7 +402,7 @@ public class IgniteTxHandler<K, V> { * @param req Request. * @return Future. */ - @Nullable public IgniteInternalFuture<IgniteTx> processNearTxFinishRequest(UUID nodeId, GridNearTxFinishRequest<K, V> req) { + @Nullable public IgniteInternalFuture<IgniteTxEx> processNearTxFinishRequest(UUID nodeId, GridNearTxFinishRequest<K, V> req) { return finish(nodeId, null, req); } @@ -411,24 +411,24 @@ public class IgniteTxHandler<K, V> { * @param req Request. * @return Future. */ - @Nullable public IgniteInternalFuture<IgniteTx> finish(UUID nodeId, @Nullable GridNearTxLocal<K, V> locTx, + @Nullable public IgniteInternalFuture<IgniteTxEx> finish(UUID nodeId, @Nullable GridNearTxLocal<K, V> locTx, GridNearTxFinishRequest<K, V> req) { assert nodeId != null; assert req != null; // Transaction on local cache only. if (locTx != null && !locTx.nearLocallyMapped() && !locTx.colocatedLocallyMapped()) - return new GridFinishedFutureEx<IgniteTx>(locTx); + return new GridFinishedFutureEx<IgniteTxEx>(locTx); if (log.isDebugEnabled()) log.debug("Processing near tx finish request [nodeId=" + nodeId + ", req=" + req + "]"); - IgniteInternalFuture<IgniteTx> colocatedFinishFut = null; + IgniteInternalFuture<IgniteTxEx> colocatedFinishFut = null; if (locTx != null && locTx.colocatedLocallyMapped()) colocatedFinishFut = finishColocatedLocal(req.commit(), locTx); - IgniteInternalFuture<IgniteTx> nearFinishFut = null; + IgniteInternalFuture<IgniteTxEx> nearFinishFut = null; if (locTx == null || locTx.nearLocallyMapped()) { if (locTx != null) @@ -438,7 +438,7 @@ public class IgniteTxHandler<K, V> { } if (colocatedFinishFut != null && nearFinishFut != null) { - GridCompoundFuture<IgniteTx, IgniteTx> res = new GridCompoundFuture<>(ctx.kernalContext()); + GridCompoundFuture<IgniteTxEx, IgniteTxEx> res = new GridCompoundFuture<>(ctx.kernalContext()); res.add(colocatedFinishFut); res.add(nearFinishFut); @@ -460,7 +460,7 @@ public class IgniteTxHandler<K, V> { * @param req Finish request. * @return Finish future. */ - private IgniteInternalFuture<IgniteTx> finishDhtLocal(UUID nodeId, @Nullable GridNearTxLocal<K, V> locTx, + private IgniteInternalFuture<IgniteTxEx> finishDhtLocal(UUID nodeId, @Nullable GridNearTxLocal<K, V> locTx, GridNearTxFinishRequest<K, V> req) { GridCacheVersion dhtVer = ctx.tm().mappedVersion(req.version()); @@ -564,7 +564,7 @@ public class IgniteTxHandler<K, V> { if (tx.pessimistic()) tx.prepare(); - IgniteInternalFuture<IgniteTx> commitFut = tx.commitAsync(); + IgniteInternalFuture<IgniteTxEx> commitFut = tx.commitAsync(); // Only for error logging. commitFut.listenAsync(CU.errorLogger(log)); @@ -580,7 +580,7 @@ public class IgniteTxHandler<K, V> { tx.nearFinishFutureId(req.futureId()); tx.nearFinishMiniId(req.miniId()); - IgniteInternalFuture<IgniteTx> rollbackFut = tx.rollbackAsync(); + IgniteInternalFuture<IgniteTxEx> rollbackFut = tx.rollbackAsync(); // Only for error logging. rollbackFut.listenAsync(CU.errorLogger(log)); @@ -592,7 +592,7 @@ public class IgniteTxHandler<K, V> { U.error(log, "Failed completing transaction [commit=" + req.commit() + ", tx=" + tx + ']', e); if (tx != null) { - IgniteInternalFuture<IgniteTx> rollbackFut = tx.rollbackAsync(); + IgniteInternalFuture<IgniteTxEx> rollbackFut = tx.rollbackAsync(); // Only for error logging. rollbackFut.listenAsync(CU.errorLogger(log)); @@ -609,7 +609,7 @@ public class IgniteTxHandler<K, V> { * @param tx Transaction to commit. * @return Future. */ - public IgniteInternalFuture<IgniteTx> finishColocatedLocal(boolean commit, GridNearTxLocal<K, V> tx) { + public IgniteInternalFuture<IgniteTxEx> finishColocatedLocal(boolean commit, GridNearTxLocal<K, V> tx) { try { if (commit) { if (!tx.markFinalizing(USER_FINISH)) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java index 0145875..338a9d1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java @@ -3420,8 +3420,8 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V> setRollbackOnly(); if (commit && commitAfterLock()) - return rollbackAsync().chain(new C1<IgniteInternalFuture<IgniteTx>, T>() { - @Override public T apply(IgniteInternalFuture<IgniteTx> f) { + return rollbackAsync().chain(new C1<IgniteInternalFuture<IgniteTxEx>, T>() { + @Override public T apply(IgniteInternalFuture<IgniteTxEx> f) { throw new GridClosureException(e); } }); @@ -3437,8 +3437,8 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V> ", tx=" + this + ']')); if (commit && commitAfterLock()) - return rollbackAsync().chain(new C1<IgniteInternalFuture<IgniteTx>, T>() { - @Override public T apply(IgniteInternalFuture<IgniteTx> f) { + return rollbackAsync().chain(new C1<IgniteInternalFuture<IgniteTxEx>, T>() { + @Override public T apply(IgniteInternalFuture<IgniteTxEx> f) { throw ex; } }); @@ -3455,8 +3455,8 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V> if (commit && commitAfterLock()) { rollback = false; - return commitAsync().chain(new CX1<IgniteInternalFuture<IgniteTx>, T>() { - @Override public T applyx(IgniteInternalFuture<IgniteTx> f) throws IgniteCheckedException { + return commitAsync().chain(new CX1<IgniteInternalFuture<IgniteTxEx>, T>() { + @Override public T applyx(IgniteInternalFuture<IgniteTxEx> f) throws IgniteCheckedException { f.get(); return r; @@ -3470,8 +3470,8 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V> } catch (final IgniteCheckedException ex) { if (commit && commitAfterLock()) - return rollbackAsync().chain(new C1<IgniteInternalFuture<IgniteTx>, T>() { - @Override public T apply(IgniteInternalFuture<IgniteTx> f) { + return rollbackAsync().chain(new C1<IgniteInternalFuture<IgniteTxEx>, T>() { + @Override public T apply(IgniteInternalFuture<IgniteTxEx> f) { throw new GridClosureException(ex); } }); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java index 9cbd479..dc2183f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java @@ -516,10 +516,10 @@ public class IgniteTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V> { * @return Future that will be completed when all ongoing transactions are finished. */ public IgniteInternalFuture<Boolean> finishTxs(long topVer) { - GridCompoundFuture<IgniteTx, Boolean> res = + GridCompoundFuture<IgniteTxEx, Boolean> res = new GridCompoundFuture<>(context().kernalContext(), - new IgniteReducer<IgniteTx, Boolean>() { - @Override public boolean collect(IgniteTx e) { + new IgniteReducer<IgniteTxEx, Boolean>() { + @Override public boolean collect(IgniteTxEx e) { return true; } @@ -671,7 +671,7 @@ public class IgniteTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V> { /** * @return User transaction for current thread. */ - @Nullable public IgniteTx userTx() { + @Nullable public IgniteTxEx userTx() { IgniteTxEx<K, V> tx = txContext(); if (tx != null && tx.user() && tx.state() == ACTIVE) @@ -1692,10 +1692,10 @@ public class IgniteTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V> { * @param newState New state. * @param tx Cache transaction. */ - public void onTxStateChange(@Nullable IgniteTxState prevState, IgniteTxState newState, IgniteTx tx) { + public void onTxStateChange(@Nullable IgniteTxState prevState, IgniteTxState newState, IgniteTxEx tx) { // Notify synchronizations. for (IgniteTxSynchronization s : syncs) - s.onStateChanged(prevState, newState, tx); + s.onStateChanged(prevState, newState, tx.proxy()); } /** @@ -1993,8 +1993,8 @@ public class IgniteTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V> { final IgniteTxEx<K, V> tx0 = tx; - return tx.finishFuture().chain(new C1<IgniteInternalFuture<IgniteTx>, GridCacheCommittedTxInfo<K, V>>() { - @Override public GridCacheCommittedTxInfo<K, V> apply(IgniteInternalFuture<IgniteTx> txFut) { + return tx.finishFuture().chain(new C1<IgniteInternalFuture<IgniteTxEx>, GridCacheCommittedTxInfo<K, V>>() { + @Override public GridCacheCommittedTxInfo<K, V> apply(IgniteInternalFuture<IgniteTxEx> txFut) { GridCacheCommittedTxInfo<K, V> info = null; if (tx0.state() == COMMITTED) @@ -2190,7 +2190,7 @@ public class IgniteTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V> { /** * Commit listener. Checks if commit succeeded and rollbacks if case of error. */ - private class CommitListener implements CI1<IgniteInternalFuture<IgniteTx>> { + private class CommitListener implements CI1<IgniteInternalFuture<IgniteTxEx>> { /** */ private static final long serialVersionUID = 0L; @@ -2205,7 +2205,7 @@ public class IgniteTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V> { } /** {@inheritDoc} */ - @Override public void apply(IgniteInternalFuture<IgniteTx> t) { + @Override public void apply(IgniteInternalFuture<IgniteTxEx> t) { try { t.get(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxProxyImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxProxyImpl.java index 8167f7b..64c7e02 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxProxyImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxProxyImpl.java @@ -229,36 +229,42 @@ public class IgniteTxProxyImpl<K, V> implements IgniteTxProxy, Externalizable { } /** {@inheritDoc} */ - @Override public void commit() throws IgniteCheckedException { + @Override public void commit() { enter(); try { - IgniteInternalFuture<IgniteTx> commitFut = cctx.commitTxAsync(tx); + IgniteInternalFuture<IgniteTxEx> commitFut = cctx.commitTxAsync(tx); if (async) asyncRes = new IgniteFutureImpl(commitFut); else commitFut.get(); } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } finally { leave(); } } /** {@inheritDoc} */ - @Override public void close() throws IgniteCheckedException { + @Override public void close() { enter(); try { cctx.endTx(tx); } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } finally { leave(); } } /** {@inheritDoc} */ - @Override public void rollback() throws IgniteCheckedException { + @Override public void rollback() { enter(); try { @@ -269,6 +275,9 @@ public class IgniteTxProxyImpl<K, V> implements IgniteTxProxy, Externalizable { else rollbackFut.get(); } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } finally { leave(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDataManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDataManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDataManager.java index 1d9098a..ef8bf97 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDataManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDataManager.java @@ -26,6 +26,7 @@ import org.apache.ignite.fs.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.cluster.*; import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.transactions.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.thread.*; @@ -686,7 +687,7 @@ public class GridGgfsDataManager extends GridGgfsManager { // Need to check if block is partially written. // If so, must update it in pessimistic transaction. if (block.length != fileInfo.blockSize()) { - try (IgniteTx tx = dataCachePrj.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTxEx tx = dataCachePrj.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { Map<GridGgfsBlockKey, byte[]> vals = dataCachePrj.getAll(F.asList(colocatedKey, key)); byte[] val = vals.get(colocatedKey); @@ -1129,7 +1130,7 @@ public class GridGgfsDataManager extends GridGgfsManager { GridGgfsBlockKey key = new GridGgfsBlockKey(colocatedKey.getFileId(), null, colocatedKey.evictExclude(), colocatedKey.getBlockId()); - try (IgniteTx tx = dataCachePrj.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTxEx tx = dataCachePrj.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { // Lock keys. Map<GridGgfsBlockKey, byte[]> vals = dataCachePrj.getAll(F.asList(colocatedKey, key)); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsMetaManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsMetaManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsMetaManager.java index 1f1407e..b640703 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsMetaManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsMetaManager.java @@ -24,6 +24,7 @@ import org.apache.ignite.events.*; import org.apache.ignite.fs.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.transactions.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.transactions.*; @@ -408,7 +409,7 @@ public class GridGgfsMetaManager extends GridGgfsManager { assert validTxState(false); assert fileId != null; - IgniteTx tx = metaCache.txStart(PESSIMISTIC, REPEATABLE_READ); + IgniteTxEx tx = metaCache.txStartEx(PESSIMISTIC, REPEATABLE_READ); try { // Lock file ID for this transaction. @@ -491,7 +492,7 @@ public class GridGgfsMetaManager extends GridGgfsManager { IgniteUuid fileId = info.id(); - IgniteTx tx = metaCache.txStart(PESSIMISTIC, REPEATABLE_READ); + IgniteTxEx tx = metaCache.txStartEx(PESSIMISTIC, REPEATABLE_READ); try { // Lock file ID for this transaction. @@ -692,7 +693,7 @@ public class GridGgfsMetaManager extends GridGgfsManager { IgniteUuid res = null; - IgniteTx tx = metaCache.txStart(PESSIMISTIC, REPEATABLE_READ); + IgniteTxEx tx = metaCache.txStartEx(PESSIMISTIC, REPEATABLE_READ); try { res = putIfAbsentNonTx(parentId, fileName, newFileInfo); @@ -781,7 +782,7 @@ public class GridGgfsMetaManager extends GridGgfsManager { try { assert validTxState(false); - IgniteTx tx = metaCache.txStart(PESSIMISTIC, REPEATABLE_READ); + IgniteTxEx tx = metaCache.txStartEx(PESSIMISTIC, REPEATABLE_READ); try { moveNonTx(fileId, srcFileName, srcParentId, destFileName, destParentId); @@ -901,7 +902,7 @@ public class GridGgfsMetaManager extends GridGgfsManager { try { assert validTxState(false); - IgniteTx tx = metaCache.txStart(PESSIMISTIC, REPEATABLE_READ); + IgniteTxEx tx = metaCache.txStartEx(PESSIMISTIC, REPEATABLE_READ); try { if (parentId != null) @@ -1015,7 +1016,7 @@ public class GridGgfsMetaManager extends GridGgfsManager { try { assert validTxState(false); - IgniteTx tx = metaCache.txStart(PESSIMISTIC, REPEATABLE_READ); + IgniteTxEx tx = metaCache.txStartEx(PESSIMISTIC, REPEATABLE_READ); try { if (parentId == null) @@ -1136,7 +1137,7 @@ public class GridGgfsMetaManager extends GridGgfsManager { assert listing != null; assert validTxState(false); - IgniteTx tx = metaCache.txStart(PESSIMISTIC, REPEATABLE_READ); + IgniteTxEx tx = metaCache.txStartEx(PESSIMISTIC, REPEATABLE_READ); try { Collection<IgniteUuid> res = new HashSet<>(); @@ -1221,7 +1222,7 @@ public class GridGgfsMetaManager extends GridGgfsManager { try { assert validTxState(false); - IgniteTx tx = metaCache.txStart(PESSIMISTIC, REPEATABLE_READ); + IgniteTxEx tx = metaCache.txStartEx(PESSIMISTIC, REPEATABLE_READ); try { boolean res = false; @@ -1394,7 +1395,7 @@ public class GridGgfsMetaManager extends GridGgfsManager { try { assert validTxState(false); - IgniteTx tx = metaCache.txStart(PESSIMISTIC, REPEATABLE_READ); + IgniteTxEx tx = metaCache.txStartEx(PESSIMISTIC, REPEATABLE_READ); try { GridGgfsFileInfo info = updatePropertiesNonTx(parentId, fileId, fileName, props); @@ -1464,7 +1465,7 @@ public class GridGgfsMetaManager extends GridGgfsManager { if (log.isDebugEnabled()) log.debug("Update file info [fileId=" + fileId + ", c=" + c + ']'); - IgniteTx tx = metaCache.isLockedByThread(fileId) ? null : metaCache.txStart(PESSIMISTIC, + IgniteTxEx tx = metaCache.isLockedByThread(fileId) ? null : metaCache.txStartEx(PESSIMISTIC, REPEATABLE_READ); try { @@ -1527,7 +1528,7 @@ public class GridGgfsMetaManager extends GridGgfsManager { try { validTxState(false); - IgniteTx tx = metaCache.txStart(PESSIMISTIC, REPEATABLE_READ); + IgniteTxEx tx = metaCache.txStartEx(PESSIMISTIC, REPEATABLE_READ); try { Object prev = val != null ? metaCache.put(sampling, val) : metaCache.remove(sampling); @@ -2361,7 +2362,7 @@ public class GridGgfsMetaManager extends GridGgfsManager { pathIds.add(fileIds(path)); // Start pessimistic. - IgniteTx tx = metaCache.txStart(PESSIMISTIC, REPEATABLE_READ); + IgniteTxEx tx = metaCache.txStartEx(PESSIMISTIC, REPEATABLE_READ); try { // Lock the very first existing parents and possibly the leaf as well. @@ -2583,7 +2584,7 @@ public class GridGgfsMetaManager extends GridGgfsManager { assert validTxState(false); // Start pessimistic transaction. - IgniteTx tx = metaCache.txStart(PESSIMISTIC, REPEATABLE_READ); + IgniteTxEx tx = metaCache.txStartEx(PESSIMISTIC, REPEATABLE_READ); try { Map<IgniteUuid, GridGgfsFileInfo> infoMap = lockIds(fileId, parentId); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index 853f5d6..cabbc29 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -23,6 +23,7 @@ import org.apache.ignite.cache.datastructures.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.transactions.*; import org.apache.ignite.lang.*; import org.apache.ignite.resources.*; import org.apache.ignite.transactions.*; @@ -468,7 +469,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { return ctx.closure().callLocalSafe(new Callable<Object>() { @Override public Object call() throws Exception { - try (IgniteTx tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTxEx tx = cache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { Object curVal = cache.get(key); if (curVal == null) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java index e959ef3..dbada06 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java @@ -26,6 +26,7 @@ import org.apache.ignite.internal.*; import org.apache.ignite.internal.cluster.*; import org.apache.ignite.internal.processors.*; import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.transactions.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.managed.*; @@ -628,7 +629,7 @@ public class GridServiceProcessor extends GridProcessorAdapter { Object affKey = cfg.getAffinityKey(); while (true) { - try (IgniteTx tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (IgniteTxEx tx = cache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { GridServiceAssignmentsKey key = new GridServiceAssignmentsKey(cfg.getName()); GridServiceAssignments oldAssigns = (GridServiceAssignments)cache.get(key); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/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 af96a00..16b4826 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 @@ -226,25 +226,25 @@ public interface IgniteTx extends AutoCloseable, IgniteAsyncSupport { /** * Commits this transaction by initiating {@code two-phase-commit} process. * - * @throws IgniteCheckedException If commit failed. + * @throws IgniteException If commit failed. */ @IgniteAsyncSupported - public void commit() throws IgniteCheckedException; + public void commit() throws IgniteException; /** * Ends the transaction. Transaction will be rolled back if it has not been committed. * - * @throws IgniteCheckedException If transaction could not be gracefully ended. + * @throws IgniteException If transaction could not be gracefully ended. */ - @Override public void close() throws IgniteCheckedException; + @Override public void close() throws IgniteException; /** * Rolls back this transaction. * - * @throws IgniteCheckedException If rollback failed. + * @throws IgniteException If rollback failed. */ @IgniteAsyncSupported - public void rollback() throws IgniteCheckedException; + public void rollback() throws IgniteException; /** * Removes metadata by name. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/test/java/org/apache/ignite/internal/IgniteExecutorServiceTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteExecutorServiceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteExecutorServiceTest.java index d76fe95..ee1a0eb 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteExecutorServiceTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteExecutorServiceTest.java @@ -265,7 +265,7 @@ public class IgniteExecutorServiceTest extends GridCommonAbstractTest { private ExecutorService createExecutorService(Ignite ignite) { assert ignite != null; - return new GridExecutorService((ClusterGroupAdapter) ignite, log()); + return ignite.executorService(); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheNestedTxAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheNestedTxAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheNestedTxAbstractTest.java index 53c5e93..4e11eab 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheNestedTxAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheNestedTxAbstractTest.java @@ -159,7 +159,7 @@ public class GridCacheNestedTxAbstractTest extends GridCommonAbstractTest { tx.commit(); } - catch (IgniteCheckedException e) { + catch (IgniteException e) { error("Failed tx thread", e); } } @@ -252,7 +252,7 @@ public class GridCacheNestedTxAbstractTest extends GridCommonAbstractTest { tx.commit(); } - catch (IgniteCheckedException e) { + catch (IgniteException e) { error("Failed tx thread", e); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java index 00d0ccf..a71dc54 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java @@ -249,7 +249,7 @@ abstract class IgniteTxAbstractTest extends GridCommonAbstractTest { try { tx.rollback(); } - catch (IgniteCheckedException ex) { + catch (IgniteException ex) { error("Failed to rollback optimistic failure: " + tx, ex); throw ex; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java index 08f9339..ddbb970 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java @@ -278,7 +278,7 @@ public class GridCacheNearMultiGetSelfTest extends GridCommonAbstractTest { try { tx.rollback(); } - catch (IgniteCheckedException ex) { + catch (IgniteException ex) { error("Failed to rollback optimistic failure: " + tx, ex); throw ex; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/core/src/test/java/org/apache/ignite/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java index 0df84cd..a02b23a 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/cache/GridAbstractCacheStoreSelfTest.java @@ -532,12 +532,12 @@ public abstract class GridAbstractCacheStoreSelfTest<T extends CacheStore<Object } /** {@inheritDoc} */ - @Override public void commit() throws IgniteCheckedException { + @Override public void commit() { // No-op. } /** {@inheritDoc} */ - @Override public void close() throws IgniteCheckedException { + @Override public void close() { // No-op. } @@ -557,7 +557,7 @@ public abstract class GridAbstractCacheStoreSelfTest<T extends CacheStore<Object } /** {@inheritDoc} */ - @Override public void rollback() throws IgniteCheckedException { + @Override public void rollback() { // No-op. } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/GridHibernateReadWriteAccessStrategy.java ---------------------------------------------------------------------- diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/GridHibernateReadWriteAccessStrategy.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/GridHibernateReadWriteAccessStrategy.java index 848dac4..2e11949 100644 --- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/GridHibernateReadWriteAccessStrategy.java +++ b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/GridHibernateReadWriteAccessStrategy.java @@ -234,7 +234,7 @@ public class GridHibernateReadWriteAccessStrategy extends GridHibernateAccessStr tx.rollback(); } } - catch (IgniteCheckedException e) { + catch (IgniteException e) { log.error("Failed to rollback cache transaction.", e); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/CacheJtaManager.java ---------------------------------------------------------------------- diff --git a/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/CacheJtaManager.java b/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/CacheJtaManager.java index fec4d45..3c0c1aa 100644 --- a/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/CacheJtaManager.java +++ b/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/CacheJtaManager.java @@ -67,7 +67,7 @@ public class CacheJtaManager<K, V> extends CacheJtaManagerAdapter<K, V> { Transaction jtaTx = jtaTm.getTransaction(); if (jtaTx != null) { - IgniteTx tx = cctx.tm().userTx(); + IgniteTxEx tx = cctx.tm().userTx(); if (tx == null) { TransactionsConfiguration tCfg = cctx.kernalContext().config() http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d6afdaa/modules/web/src/main/java/org/apache/ignite/cache/websession/GridWebSessionFilter.java ---------------------------------------------------------------------- diff --git a/modules/web/src/main/java/org/apache/ignite/cache/websession/GridWebSessionFilter.java b/modules/web/src/main/java/org/apache/ignite/cache/websession/GridWebSessionFilter.java index cfae3f6..fd790e7 100644 --- a/modules/web/src/main/java/org/apache/ignite/cache/websession/GridWebSessionFilter.java +++ b/modules/web/src/main/java/org/apache/ignite/cache/websession/GridWebSessionFilter.java @@ -295,7 +295,7 @@ public class GridWebSessionFilter implements Filter { else sesId = doFilter0(httpReq, res, chain); } - catch (IgniteCheckedException e) { + catch (Exception e) { U.error(log, "Failed to update web session: " + sesId, e); } } @@ -310,10 +310,10 @@ public class GridWebSessionFilter implements Filter { * @return Session ID. * @throws IOException In case of I/O error. * @throws ServletException In case oif servlet error. - * @throws IgniteCheckedException In case of other error. + * @throws CacheException In case of other error. */ private String doFilter0(HttpServletRequest httpReq, ServletResponse res, FilterChain chain) throws IOException, - ServletException, IgniteCheckedException { + ServletException, CacheException { GridWebSession cached; String sesId = httpReq.getRequestedSessionId();