IGNITE-2776 - An option to enlist into JTA transaction using sync callback instead of XA resource
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8d976043 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8d976043 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8d976043 Branch: refs/heads/ignite-2801 Commit: 8d976043df92acc3fb036789e7a12919806037ce Parents: a395023 Author: Valentin Kulichenko <[email protected]> Authored: Wed Mar 9 16:18:36 2016 -0800 Committer: Valentin Kulichenko <[email protected]> Committed: Wed Mar 9 16:30:04 2016 -0800 ---------------------------------------------------------------------- .../configuration/TransactionConfiguration.java | 32 ++ .../HibernateL2CacheTransactionalSelfTest.java | 9 + ...nateL2CacheTransactionalUseSyncSelfTest.java | 31 ++ .../testsuites/IgniteHibernateTestSuite.java | 4 +- .../processors/cache/jta/CacheJtaManager.java | 26 +- .../processors/cache/jta/CacheJtaResource.java | 304 +++++++++++++++++++ .../cache/jta/GridCacheXAResource.java | 251 --------------- .../cache/AbstarctCacheJtaSelfTest.java | 183 ----------- .../cache/AbstractCacheJtaSelfTest.java | 183 +++++++++++ .../GridPartitionedCacheJtaFactorySelfTest.java | 2 +- ...rtitionedCacheJtaFactoryUseSyncSelfTest.java | 32 ++ ...titionedCacheJtaLookupClassNameSelfTest.java | 2 +- ...eplicatedCacheJtaFactoryUseSyncSelfTest.java | 32 ++ .../ignite/testsuites/IgniteJtaTestSuite.java | 5 + 14 files changed, 649 insertions(+), 447 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/8d976043/modules/core/src/main/java/org/apache/ignite/configuration/TransactionConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/TransactionConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/TransactionConfiguration.java index b3d294d..95050a7 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/TransactionConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/TransactionConfiguration.java @@ -70,6 +70,12 @@ public class TransactionConfiguration implements Serializable { private Factory txManagerFactory; /** + * Whether to use JTA {@code javax.transaction.Synchronization} + * instead of {@code javax.transaction.xa.XAResource}. + */ + private boolean useJtaSync; + + /** * Empty constructor. */ public TransactionConfiguration() { @@ -88,6 +94,7 @@ public class TransactionConfiguration implements Serializable { txSerEnabled = cfg.isTxSerializableEnabled(); tmLookupClsName = cfg.getTxManagerLookupClassName(); txManagerFactory = cfg.getTxManagerFactory(); + useJtaSync = cfg.isUseJtaSynchronization(); } /** @@ -243,6 +250,7 @@ public class TransactionConfiguration implements Serializable { * * @param <T> Instance of {@code javax.transaction.TransactionManager}. * @return Transaction manager factory. + * @see #isUseJtaSynchronization() */ @SuppressWarnings("unchecked") public <T> Factory<T> getTxManagerFactory() { @@ -269,8 +277,32 @@ public class TransactionConfiguration implements Serializable { * * @param factory Transaction manager factory. * @param <T> Instance of {@code javax.transaction.TransactionManager}. + * @see #setUseJtaSynchronization(boolean) */ public <T> void setTxManagerFactory(Factory<T> factory) { txManagerFactory = factory; } + + /** + * @return Whether to use JTA {@code javax.transaction.Synchronization} + * instead of {@code javax.transaction.xa.XAResource}. + * @see #getTxManagerFactory() + */ + public boolean isUseJtaSynchronization() { + return useJtaSync; + } + + /** + * Sets the flag that defines whether to use lightweight JTA synchronization callback to enlist + * into JTA transaction instead of creating a separate XA resource. In some cases this can give + * performance improvement, but keep in mind that most of the transaction managers do not allow + * to add more that one callback to a single transaction. + * + * @param useJtaSync Whether to use JTA {@code javax.transaction.Synchronization} + * instead of {@code javax.transaction.xa.XAResource}. + * @see #setTxManagerFactory(Factory) + */ + public void setUseJtaSynchronization(boolean useJtaSync) { + this.useJtaSync = useJtaSync; + } } http://git-wip-us.apache.org/repos/asf/ignite/blob/8d976043/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java b/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java index 9141be2..e6117c0 100644 --- a/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java +++ b/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java @@ -19,6 +19,7 @@ package org.apache.ignite.cache.hibernate; import java.util.Collections; import javax.cache.configuration.Factory; +import javax.transaction.Synchronization; import javax.transaction.TransactionManager; import javax.transaction.UserTransaction; import org.apache.commons.dbcp.managed.BasicManagedDataSource; @@ -94,6 +95,7 @@ public class HibernateL2CacheTransactionalSelfTest extends HibernateL2CacheSelfT IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.getTransactionConfiguration().setTxManagerFactory(new TestTmFactory()); + cfg.getTransactionConfiguration().setUseJtaSynchronization(useJtaSynchronization()); return cfg; } @@ -142,4 +144,11 @@ public class HibernateL2CacheTransactionalSelfTest extends HibernateL2CacheSelfT @Override protected AccessType[] accessTypes() { return new AccessType[]{AccessType.TRANSACTIONAL}; } + + /** + * @return Whether to use {@link Synchronization}. + */ + protected boolean useJtaSynchronization() { + return false; + } } http://git-wip-us.apache.org/repos/asf/ignite/blob/8d976043/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.java b/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.java new file mode 100644 index 0000000..44899f9 --- /dev/null +++ b/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.cache.hibernate; + +import javax.transaction.Synchronization; + +/** + * Tests Hibernate L2 cache with TRANSACTIONAL access mode and {@link Synchronization} + * instead of XA resource. + */ +public class HibernateL2CacheTransactionalUseSyncSelfTest extends HibernateL2CacheTransactionalSelfTest { + /** {@inheritDoc} */ + @Override protected boolean useJtaSynchronization() { + return true; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/8d976043/modules/hibernate/src/test/java/org/apache/ignite/testsuites/IgniteHibernateTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/hibernate/src/test/java/org/apache/ignite/testsuites/IgniteHibernateTestSuite.java b/modules/hibernate/src/test/java/org/apache/ignite/testsuites/IgniteHibernateTestSuite.java index 309ed3b..99fea56 100644 --- a/modules/hibernate/src/test/java/org/apache/ignite/testsuites/IgniteHibernateTestSuite.java +++ b/modules/hibernate/src/test/java/org/apache/ignite/testsuites/IgniteHibernateTestSuite.java @@ -21,6 +21,7 @@ import junit.framework.TestSuite; import org.apache.ignite.cache.hibernate.HibernateL2CacheConfigurationSelfTest; import org.apache.ignite.cache.hibernate.HibernateL2CacheSelfTest; import org.apache.ignite.cache.hibernate.HibernateL2CacheTransactionalSelfTest; +import org.apache.ignite.cache.hibernate.HibernateL2CacheTransactionalUseSyncSelfTest; import org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreNodeRestartTest; import org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreSelfTest; import org.apache.ignite.cache.store.hibernate.CacheHibernateStoreFactorySelfTest; @@ -40,6 +41,7 @@ public class IgniteHibernateTestSuite extends TestSuite { // Hibernate L2 cache. suite.addTestSuite(HibernateL2CacheSelfTest.class); suite.addTestSuite(HibernateL2CacheTransactionalSelfTest.class); + suite.addTestSuite(HibernateL2CacheTransactionalUseSyncSelfTest.class); suite.addTestSuite(HibernateL2CacheConfigurationSelfTest.class); suite.addTestSuite(CacheHibernateBlobStoreSelfTest.class); @@ -52,4 +54,4 @@ public class IgniteHibernateTestSuite extends TestSuite { return suite; } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/8d976043/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 a65a4f8..f581ebb 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 @@ -36,7 +36,7 @@ import org.jetbrains.annotations.Nullable; */ public class CacheJtaManager extends CacheJtaManagerAdapter { /** */ - private final ThreadLocal<GridCacheXAResource> xaRsrc = new ThreadLocal<>(); + private final ThreadLocal<CacheJtaResource> rsrc = new ThreadLocal<>(); /** */ private TransactionManager jtaTm; @@ -47,6 +47,9 @@ public class CacheJtaManager extends CacheJtaManagerAdapter { /** */ private Factory<TransactionManager> tmFactory; + /** */ + private boolean useJtaSync; + /** {@inheritDoc} */ @Override protected void start0() throws IgniteCheckedException { super.start0(); @@ -80,14 +83,15 @@ public class CacheJtaManager extends CacheJtaManagerAdapter { + tmFactory + ", txMgr=" + txMgr + "]"); jtaTm = (TransactionManager)txMgr; - - return; } + else { + String txLookupClsName = cctx.txConfig().getTxManagerLookupClassName(); - String txLookupClsName = cctx.txConfig().getTxManagerLookupClassName(); + if (txLookupClsName != null) + tmLookupRef.set(createTmLookup(txLookupClsName)); + } - if (txLookupClsName != null) - tmLookupRef.set(createTmLookup(txLookupClsName)); + useJtaSync = cctx.txConfig().isUseJtaSynchronization(); } } @@ -140,7 +144,7 @@ public class CacheJtaManager extends CacheJtaManagerAdapter { } if (jtaTm != null) { - GridCacheXAResource rsrc = xaRsrc.get(); + CacheJtaResource rsrc = this.rsrc.get(); if (rsrc == null || rsrc.isFinished()) { try { @@ -165,12 +169,14 @@ public class CacheJtaManager extends CacheJtaManagerAdapter { ); } - rsrc = new GridCacheXAResource(tx, cctx.kernalContext()); + rsrc = new CacheJtaResource(tx, cctx.kernalContext()); - if (!jtaTx.enlistResource(rsrc)) + if (useJtaSync) + jtaTx.registerSynchronization(rsrc); + else if (!jtaTx.enlistResource(rsrc)) throw new IgniteCheckedException("Failed to enlist XA resource to JTA user transaction."); - xaRsrc.set(rsrc); + this.rsrc.set(rsrc); } } catch (SystemException e) { http://git-wip-us.apache.org/repos/asf/ignite/blob/8d976043/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/CacheJtaResource.java ---------------------------------------------------------------------- diff --git a/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/CacheJtaResource.java b/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/CacheJtaResource.java new file mode 100644 index 0000000..f43981e --- /dev/null +++ b/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/CacheJtaResource.java @@ -0,0 +1,304 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.jta; + +import java.util.concurrent.atomic.AtomicReference; +import javax.cache.CacheException; +import javax.transaction.Status; +import javax.transaction.Synchronization; +import javax.transaction.xa.XAException; +import javax.transaction.xa.XAResource; +import javax.transaction.xa.Xid; +import org.apache.ignite.IgniteCheckedException; +import org.apache.ignite.IgniteLogger; +import org.apache.ignite.internal.GridKernalContext; +import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx; +import org.apache.ignite.internal.util.typedef.internal.S; +import org.apache.ignite.internal.util.typedef.internal.U; +import org.apache.ignite.transactions.TransactionState; + +import static org.apache.ignite.transactions.TransactionState.ACTIVE; +import static org.apache.ignite.transactions.TransactionState.COMMITTED; +import static org.apache.ignite.transactions.TransactionState.PREPARED; +import static org.apache.ignite.transactions.TransactionState.ROLLED_BACK; + +/** + * Cache {@link XAResource} and {@link Synchronization} implementation. + */ +final class CacheJtaResource implements XAResource, Synchronization { + /** Logger reference. */ + private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>(); + + /** */ + private static IgniteLogger log; + + /** */ + private static final Xid[] NO_XID = new Xid[] {}; + + /** Cache transaction. */ + private IgniteInternalTx cacheTx; + + /** */ + private Xid xid; + + /** + * @param cacheTx Cache jta. + * @param ctx Kernal context. + */ + public CacheJtaResource(IgniteInternalTx cacheTx, GridKernalContext ctx) { + assert cacheTx != null; + assert ctx != null; + + this.cacheTx = cacheTx; + + if (log == null) + log = U.logger(ctx, logRef, CacheJtaResource.class); + } + + /** {@inheritDoc} */ + @Override public void start(Xid xid, int flags) { + if (log.isDebugEnabled()) + log.debug("XA resource start(...) [xid=" + xid + ", flags=<" + flags(flags) + ">]"); + + // Simply save global transaction id. + this.xid = xid; + } + + /** + * @param msg Message. + * @param cause Cause. + * @throws XAException XA exception. + */ + private void throwException(String msg, Throwable cause) throws XAException { + XAException ex = new XAException(msg); + + ex.initCause(cause); + + throw ex; + } + + /** {@inheritDoc} */ + @Override public void rollback(Xid xid) throws XAException { + assert this.xid.equals(xid); + + if (log.isDebugEnabled()) + log.debug("XA resource rollback(...) [xid=" + xid + "]"); + + try { + cacheTx.rollback(); + } + catch (IgniteCheckedException e) { + throwException("Failed to rollback cache transaction: " + e.getMessage(), e); + } + } + + /** {@inheritDoc} */ + @Override public int prepare(Xid xid) throws XAException { + assert this.xid.equals(xid); + + if (log.isDebugEnabled()) + log.debug("XA resource prepare(...) [xid=" + xid + "]"); + + if (cacheTx.state() != ACTIVE) + throw new XAException("Cache transaction is not in active state."); + + try { + cacheTx.prepare(); + } + catch (IgniteCheckedException e) { + throwException("Failed to prepare cache transaction.", e); + } + + return XA_OK; + } + + /** {@inheritDoc} */ + @Override public void end(Xid xid, int flags) { + assert this.xid.equals(xid); + + if (log.isDebugEnabled()) + log.debug("XA resource end(...) [xid=" + xid + ", flags=<" + flags(flags) + ">]"); + + if ((flags & TMFAIL) > 0) + cacheTx.setRollbackOnly(); + } + + /** {@inheritDoc} */ + @Override public void commit(Xid xid, boolean onePhase) throws XAException { + assert this.xid.equals(xid); + + if (log.isDebugEnabled()) + log.debug("XA resource commit(...) [xid=" + xid + ", onePhase=" + onePhase + "]"); + + try { + cacheTx.commit(); + } + catch (IgniteCheckedException e) { + throwException("Failed to commit cache transaction: " + e.getMessage(), e); + } + } + + /** {@inheritDoc} */ + @Override public void forget(Xid xid) throws XAException { + assert this.xid.equals(xid); + + if (log.isDebugEnabled()) + log.debug("XA resource forget(...) [xid=" + xid + "]"); + + try { + cacheTx.invalidate(true); + + cacheTx.commit(); + } + catch (IgniteCheckedException e) { + throwException("Failed to forget cache transaction: " + e.getMessage(), e); + } + } + + /** {@inheritDoc} */ + @Override public Xid[] recover(int i) { + if (cacheTx.state() == PREPARED) + return new Xid[] { xid }; + + return NO_XID; + } + + /** + * @param flags JTA Flags. + * @return Comma-separated flags string. + */ + private String flags(int flags) { + StringBuilder res = new StringBuilder(); + + addFlag(res, flags, TMENDRSCAN, "TMENDRSCAN"); + addFlag(res, flags, TMFAIL, "TMFAIL"); + addFlag(res, flags, TMJOIN, "TMJOIN"); + addFlag(res, flags, TMNOFLAGS, "TMNOFLAGS"); + addFlag(res, flags, TMONEPHASE, "TMONEPHASE"); + addFlag(res, flags, TMRESUME, "TMRESUME"); + addFlag(res, flags, TMSTARTRSCAN, "TMSTARTRSCAN"); + addFlag(res, flags, TMSUCCESS, "TMSUCCESS"); + addFlag(res, flags, TMSUSPEND, "TMSUSPEND"); + + return res.toString(); + } + + /** + * @param sb String builder. + * @param flags Flags bit set. + * @param mask Bit mask. + * @param flagName String name of the flag specified by given mask. + * @return String builder appended by flag if it's presented in bit set. + */ + private StringBuilder addFlag(StringBuilder sb, int flags, int mask, String flagName) { + if ((flags & mask) > 0) + sb.append(sb.length() > 0 ? "," : "").append(flagName); + + return sb; + } + + /** {@inheritDoc} */ + @Override public int getTransactionTimeout() { + return (int)(cacheTx.timeout() / 1000); + } + + /** {@inheritDoc} */ + @Override public boolean setTransactionTimeout(int i) { + cacheTx.timeout(i * 1000); + + return true; + } + + /** {@inheritDoc} */ + @Override public boolean isSameRM(XAResource xar) { + if (xar == this) + return true; + + if (!(xar instanceof CacheJtaResource)) + return false; + + CacheJtaResource other = (CacheJtaResource)xar; + + return cacheTx == other.cacheTx; + } + + /** {@inheritDoc} */ + @Override public void beforeCompletion() { + if (log.isDebugEnabled()) + log.debug("Synchronization.beforeCompletion() [xid=" + cacheTx.xid() + "]"); + + if (cacheTx.state() != ACTIVE) + throw new CacheException("Cache transaction is not in active state."); + + try { + cacheTx.prepare(); + } + catch (IgniteCheckedException e) { + throw new CacheException("Failed to prepare cache transaction.", e); + } + } + + /** {@inheritDoc} */ + @Override public void afterCompletion(int status) { + switch (status) { + case Status.STATUS_COMMITTED: + if (log.isDebugEnabled()) + log.debug("Synchronization.afterCompletion(STATUS_COMMITTED) [xid=" + cacheTx.xid() + "]"); + + try { + cacheTx.commit(); + } + catch (IgniteCheckedException e) { + throw new CacheException("Failed to commit cache transaction.", e); + } + + break; + + case Status.STATUS_ROLLEDBACK: + if (log.isDebugEnabled()) + log.debug("Synchronization.afterCompletion(STATUS_ROLLEDBACK) [xid=" + cacheTx.xid() + "]"); + + try { + cacheTx.rollback(); + } + catch (IgniteCheckedException e) { + throw new CacheException("Failed to rollback cache transaction.", e); + } + + break; + + default: + throw new IllegalArgumentException("Unknown transaction status: " + status); + } + } + + /** + * + * @return {@code true} if jta was already committed or rolled back. + */ + public boolean isFinished() { + TransactionState state = cacheTx.state(); + + return state == COMMITTED || state == ROLLED_BACK; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(CacheJtaResource.class, this); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/8d976043/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/GridCacheXAResource.java ---------------------------------------------------------------------- diff --git a/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/GridCacheXAResource.java b/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/GridCacheXAResource.java deleted file mode 100644 index 2cb4695..0000000 --- a/modules/jta/src/main/java/org/apache/ignite/internal/processors/cache/jta/GridCacheXAResource.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.jta; - -import java.util.concurrent.atomic.AtomicReference; -import javax.transaction.xa.XAException; -import javax.transaction.xa.XAResource; -import javax.transaction.xa.Xid; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.IgniteLogger; -import org.apache.ignite.internal.GridKernalContext; -import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.transactions.TransactionState; - -import static org.apache.ignite.transactions.TransactionState.ACTIVE; -import static org.apache.ignite.transactions.TransactionState.COMMITTED; -import static org.apache.ignite.transactions.TransactionState.PREPARED; -import static org.apache.ignite.transactions.TransactionState.ROLLED_BACK; - -/** - * Cache XA resource implementation. - */ -public final class GridCacheXAResource implements XAResource { - /** Logger reference. */ - private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>(); - - /** */ - private static IgniteLogger log; - - /** */ - private static final Xid[] NO_XID = new Xid[] {}; - - /** Cache transaction. */ - private IgniteInternalTx cacheTx; - - /** */ - private Xid xid; - - /** - * @param cacheTx Cache jta. - * @param ctx Kernal context. - */ - public GridCacheXAResource(IgniteInternalTx cacheTx, GridKernalContext ctx) { - assert cacheTx != null; - assert ctx != null; - - this.cacheTx = cacheTx; - - if (log == null) - log = U.logger(ctx, logRef, GridCacheXAResource.class); - } - - /** {@inheritDoc} */ - @Override public void start(Xid xid, int flags) { - if (log.isDebugEnabled()) - log.debug("XA resource start(...) [xid=" + xid + ", flags=<" + flags(flags) + ">]"); - - // Simply save global transaction id. - this.xid = xid; - } - - /** - * @param msg Message. - * @param cause Cause. - * @throws XAException XA exception. - */ - private void throwException(String msg, Throwable cause) throws XAException { - XAException ex = new XAException(msg); - - ex.initCause(cause); - - throw ex; - } - - /** {@inheritDoc} */ - @Override public void rollback(Xid xid) throws XAException { - assert this.xid.equals(xid); - - if (log.isDebugEnabled()) - log.debug("XA resource rollback(...) [xid=" + xid + "]"); - - try { - cacheTx.rollback(); - } - catch (IgniteCheckedException e) { - throwException("Failed to rollback cache transaction: " + e.getMessage(), e); - } - } - - /** {@inheritDoc} */ - @Override public int prepare(Xid xid) throws XAException { - assert this.xid.equals(xid); - - if (log.isDebugEnabled()) - log.debug("XA resource prepare(...) [xid=" + xid + "]"); - - if (cacheTx.state() != ACTIVE) - throw new XAException("Cache transaction is not in active state."); - - try { - cacheTx.prepare(); - } - catch (IgniteCheckedException e) { - throwException("Failed to prepare cache transaction.", e); - } - - return XA_OK; - } - - /** {@inheritDoc} */ - @Override public void end(Xid xid, int flags) { - assert this.xid.equals(xid); - - if (log.isDebugEnabled()) - log.debug("XA resource end(...) [xid=" + xid + ", flags=<" + flags(flags) + ">]"); - - if ((flags & TMFAIL) > 0) - cacheTx.setRollbackOnly(); - } - - /** {@inheritDoc} */ - @Override public void commit(Xid xid, boolean onePhase) throws XAException { - assert this.xid.equals(xid); - - if (log.isDebugEnabled()) - log.debug("XA resource commit(...) [xid=" + xid + ", onePhase=" + onePhase + "]"); - - try { - cacheTx.commit(); - } - catch (IgniteCheckedException e) { - throwException("Failed to commit cache transaction: " + e.getMessage(), e); - } - } - - /** {@inheritDoc} */ - @Override public void forget(Xid xid) throws XAException { - assert this.xid.equals(xid); - - if (log.isDebugEnabled()) - log.debug("XA resource forget(...) [xid=" + xid + "]"); - - try { - cacheTx.invalidate(true); - - cacheTx.commit(); - } - catch (IgniteCheckedException e) { - throwException("Failed to forget cache transaction: " + e.getMessage(), e); - } - } - - /** {@inheritDoc} */ - @Override public Xid[] recover(int i) { - if (cacheTx.state() == PREPARED) - return new Xid[] { xid }; - - return NO_XID; - } - - /** - * @param flags JTA Flags. - * @return Comma-separated flags string. - */ - private String flags(int flags) { - StringBuilder res = new StringBuilder(); - - addFlag(res, flags, TMENDRSCAN, "TMENDRSCAN"); - addFlag(res, flags, TMFAIL, "TMFAIL"); - addFlag(res, flags, TMJOIN, "TMJOIN"); - addFlag(res, flags, TMNOFLAGS, "TMNOFLAGS"); - addFlag(res, flags, TMONEPHASE, "TMONEPHASE"); - addFlag(res, flags, TMRESUME, "TMRESUME"); - addFlag(res, flags, TMSTARTRSCAN, "TMSTARTRSCAN"); - addFlag(res, flags, TMSUCCESS, "TMSUCCESS"); - addFlag(res, flags, TMSUSPEND, "TMSUSPEND"); - - return res.toString(); - } - - /** - * @param sb String builder. - * @param flags Flags bit set. - * @param mask Bit mask. - * @param flagName String name of the flag specified by given mask. - * @return String builder appended by flag if it's presented in bit set. - */ - private StringBuilder addFlag(StringBuilder sb, int flags, int mask, String flagName) { - if ((flags & mask) > 0) - sb.append(sb.length() > 0 ? "," : "").append(flagName); - - return sb; - } - - /** {@inheritDoc} */ - @Override public int getTransactionTimeout() { - return (int)(cacheTx.timeout() / 1000); - } - - /** {@inheritDoc} */ - @Override public boolean setTransactionTimeout(int i) { - cacheTx.timeout(i * 1000); - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean isSameRM(XAResource xar) { - if (xar == this) - return true; - - if (!(xar instanceof GridCacheXAResource)) - return false; - - GridCacheXAResource other = (GridCacheXAResource)xar; - - return cacheTx == other.cacheTx; - } - - /** - * - * @return {@code true} if jta was already committed or rolled back. - */ - public boolean isFinished() { - TransactionState state = cacheTx.state(); - - return state == COMMITTED || state == ROLLED_BACK; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(GridCacheXAResource.class, this); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/8d976043/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/AbstarctCacheJtaSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/AbstarctCacheJtaSelfTest.java b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/AbstarctCacheJtaSelfTest.java deleted file mode 100644 index 41c4565..0000000 --- a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/AbstarctCacheJtaSelfTest.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import javax.transaction.Status; -import javax.transaction.UserTransaction; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.transactions.Transaction; -import org.objectweb.jotm.Jotm; - -import static org.apache.ignite.cache.CacheMode.PARTITIONED; -import static org.apache.ignite.transactions.TransactionState.ACTIVE; - -/** - * Abstract class for cache tests. - */ -public abstract class AbstarctCacheJtaSelfTest extends GridCacheAbstractSelfTest { - /** */ - private static final int GRID_CNT = 1; - - /** Java Open Transaction Manager facade. */ - protected static Jotm jotm; - - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - jotm = new Jotm(true, false); - - super.beforeTestsStarted(); - } - - /** {@inheritDoc} */ - @Override protected void afterTestsStopped() throws Exception { - super.afterTestsStopped(); - - jotm.stop(); - } - - /** {@inheritDoc} */ - @Override protected int gridCount() { - return GRID_CNT; - } - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; - } - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); - - configureJta(cfg); - - CacheConfiguration cfg1 = cacheConfiguration(gridName); - - CacheConfiguration cfg2 = cacheConfiguration(gridName); - - cfg2.setName("cache-2"); - - cfg.setCacheConfiguration(cfg1, cfg2); - - return cfg; - } - - /** - * @param cfg Ignite Configuration. - */ - protected abstract void configureJta(IgniteConfiguration cfg); - - /** - * JUnit. - * - * @throws Exception If failed. - */ - public void testJta() throws Exception { - UserTransaction jtaTx = jotm.getUserTransaction(); - - IgniteCache<String, Integer> cache = jcache(); - - assert ignite(0).transactions().tx() == null; - - jtaTx.begin(); - - try { - assert ignite(0).transactions().tx() == null; - - assert cache.getAndPut("key", 1) == null; - - Transaction tx = ignite(0).transactions().tx(); - - assert tx != null; - assert tx.state() == ACTIVE; - - Integer one = 1; - - assertEquals(one, cache.get("key")); - - tx = ignite(0).transactions().tx(); - - assert tx != null; - assert tx.state() == ACTIVE; - - jtaTx.commit(); - - assert ignite(0).transactions().tx() == null; - } - finally { - if (jtaTx.getStatus() == Status.STATUS_ACTIVE) - jtaTx.rollback(); - } - - assertEquals((Integer)1, cache.get("key")); - } - - /** - * @throws Exception If failed. - */ - @SuppressWarnings("ConstantConditions") - public void testJtaTwoCaches() throws Exception { - UserTransaction jtaTx = jotm.getUserTransaction(); - - IgniteEx ignite = grid(0); - - IgniteCache<String, Integer> cache1 = jcache(); - - IgniteCache<Object, Object> cache2 = ignite.cache("cache-2"); - - assertNull(ignite.transactions().tx()); - - jtaTx.begin(); - - try { - cache1.put("key", 0); - cache2.put("key", 0); - cache1.put("key1", 1); - cache2.put("key2", 2); - - assertEquals(0, (int)cache1.get("key")); - assertEquals(0, (int)cache1.get("key")); - assertEquals(1, (int)cache1.get("key1")); - assertEquals(2, (int)cache2.get("key2")); - - assertEquals(ignite.transactions().tx().state(), ACTIVE); - - jtaTx.commit(); - - assertNull(ignite.transactions().tx()); - - assertEquals(0, (int)cache1.get("key")); - assertEquals(0, (int)cache2.get("key")); - assertEquals(1, (int)cache1.get("key1")); - assertEquals(2, (int)cache2.get("key2")); - } - finally { - if (jtaTx.getStatus() == Status.STATUS_ACTIVE) - jtaTx.rollback(); - } - - assertEquals(0, (int)cache1.get("key")); - assertEquals(0, (int)cache2.get("key")); - assertEquals(1, (int)cache1.get("key1")); - assertEquals(2, (int)cache2.get("key2")); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/8d976043/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/AbstractCacheJtaSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/AbstractCacheJtaSelfTest.java b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/AbstractCacheJtaSelfTest.java new file mode 100644 index 0000000..96e3258 --- /dev/null +++ b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/AbstractCacheJtaSelfTest.java @@ -0,0 +1,183 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache; + +import javax.transaction.Status; +import javax.transaction.UserTransaction; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.cache.CacheMode; +import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.internal.IgniteEx; +import org.apache.ignite.transactions.Transaction; +import org.objectweb.jotm.Jotm; + +import static org.apache.ignite.cache.CacheMode.PARTITIONED; +import static org.apache.ignite.transactions.TransactionState.ACTIVE; + +/** + * Abstract class for cache tests. + */ +public abstract class AbstractCacheJtaSelfTest extends GridCacheAbstractSelfTest { + /** */ + private static final int GRID_CNT = 1; + + /** Java Open Transaction Manager facade. */ + protected static Jotm jotm; + + /** {@inheritDoc} */ + @Override protected void beforeTestsStarted() throws Exception { + jotm = new Jotm(true, false); + + super.beforeTestsStarted(); + } + + /** {@inheritDoc} */ + @Override protected void afterTestsStopped() throws Exception { + super.afterTestsStopped(); + + jotm.stop(); + } + + /** {@inheritDoc} */ + @Override protected int gridCount() { + return GRID_CNT; + } + + /** {@inheritDoc} */ + @Override protected CacheMode cacheMode() { + return PARTITIONED; + } + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(gridName); + + configureJta(cfg); + + CacheConfiguration cfg1 = cacheConfiguration(gridName); + + CacheConfiguration cfg2 = cacheConfiguration(gridName); + + cfg2.setName("cache-2"); + + cfg.setCacheConfiguration(cfg1, cfg2); + + return cfg; + } + + /** + * @param cfg Ignite Configuration. + */ + protected abstract void configureJta(IgniteConfiguration cfg); + + /** + * JUnit. + * + * @throws Exception If failed. + */ + public void testJta() throws Exception { + UserTransaction jtaTx = jotm.getUserTransaction(); + + IgniteCache<String, Integer> cache = jcache(); + + assert ignite(0).transactions().tx() == null; + + jtaTx.begin(); + + try { + assert ignite(0).transactions().tx() == null; + + assert cache.getAndPut("key", 1) == null; + + Transaction tx = ignite(0).transactions().tx(); + + assert tx != null; + assert tx.state() == ACTIVE; + + Integer one = 1; + + assertEquals(one, cache.get("key")); + + tx = ignite(0).transactions().tx(); + + assert tx != null; + assert tx.state() == ACTIVE; + + jtaTx.commit(); + + assert ignite(0).transactions().tx() == null; + } + finally { + if (jtaTx.getStatus() == Status.STATUS_ACTIVE) + jtaTx.rollback(); + } + + assertEquals((Integer)1, cache.get("key")); + } + + /** + * @throws Exception If failed. + */ + @SuppressWarnings("ConstantConditions") + public void testJtaTwoCaches() throws Exception { + UserTransaction jtaTx = jotm.getUserTransaction(); + + IgniteEx ignite = grid(0); + + IgniteCache<String, Integer> cache1 = jcache(); + + IgniteCache<Object, Object> cache2 = ignite.cache("cache-2"); + + assertNull(ignite.transactions().tx()); + + jtaTx.begin(); + + try { + cache1.put("key", 0); + cache2.put("key", 0); + cache1.put("key1", 1); + cache2.put("key2", 2); + + assertEquals(0, (int)cache1.get("key")); + assertEquals(0, (int)cache1.get("key")); + assertEquals(1, (int)cache1.get("key1")); + assertEquals(2, (int)cache2.get("key2")); + + assertEquals(ignite.transactions().tx().state(), ACTIVE); + + jtaTx.commit(); + + assertNull(ignite.transactions().tx()); + + assertEquals(0, (int)cache1.get("key")); + assertEquals(0, (int)cache2.get("key")); + assertEquals(1, (int)cache1.get("key1")); + assertEquals(2, (int)cache2.get("key2")); + } + finally { + if (jtaTx.getStatus() == Status.STATUS_ACTIVE) + jtaTx.rollback(); + } + + assertEquals(0, (int)cache1.get("key")); + assertEquals(0, (int)cache2.get("key")); + assertEquals(1, (int)cache1.get("key1")); + assertEquals(2, (int)cache2.get("key2")); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/8d976043/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaFactorySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaFactorySelfTest.java b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaFactorySelfTest.java index 8d53d7f..f079974 100644 --- a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaFactorySelfTest.java +++ b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaFactorySelfTest.java @@ -25,7 +25,7 @@ import org.objectweb.transaction.jta.TransactionManager; /** * Factory JTA integration test using PARTITIONED cache. */ -public class GridPartitionedCacheJtaFactorySelfTest extends AbstarctCacheJtaSelfTest { +public class GridPartitionedCacheJtaFactorySelfTest extends AbstractCacheJtaSelfTest { /** {@inheritDoc} */ @Override protected void configureJta(IgniteConfiguration cfg) { TransactionConfiguration txCfg = cfg.getTransactionConfiguration(); http://git-wip-us.apache.org/repos/asf/ignite/blob/8d976043/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaFactoryUseSyncSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaFactoryUseSyncSelfTest.java b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaFactoryUseSyncSelfTest.java new file mode 100644 index 0000000..5e6deee --- /dev/null +++ b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaFactoryUseSyncSelfTest.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache; + +import org.apache.ignite.configuration.IgniteConfiguration; + +/** + * Factory JTA integration test using PARTITIONED cache. + */ +public class GridPartitionedCacheJtaFactoryUseSyncSelfTest extends GridPartitionedCacheJtaFactorySelfTest { + /** {@inheritDoc} */ + @Override protected void configureJta(IgniteConfiguration cfg) { + super.configureJta(cfg); + + cfg.getTransactionConfiguration().setUseJtaSynchronization(true); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/8d976043/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaLookupClassNameSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaLookupClassNameSelfTest.java b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaLookupClassNameSelfTest.java index ccebb9f..2e322f8 100644 --- a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaLookupClassNameSelfTest.java +++ b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaLookupClassNameSelfTest.java @@ -30,7 +30,7 @@ import org.apache.ignite.testframework.GridTestUtils; /** * Lookup class name based JTA integration test using PARTITIONED cache. */ -public class GridPartitionedCacheJtaLookupClassNameSelfTest extends AbstarctCacheJtaSelfTest { +public class GridPartitionedCacheJtaLookupClassNameSelfTest extends AbstractCacheJtaSelfTest { /** {@inheritDoc} */ @Override protected void configureJta(IgniteConfiguration cfg) { cfg.getTransactionConfiguration().setTxManagerLookupClassName(TestTmLookup.class.getName()); http://git-wip-us.apache.org/repos/asf/ignite/blob/8d976043/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridReplicatedCacheJtaFactoryUseSyncSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridReplicatedCacheJtaFactoryUseSyncSelfTest.java b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridReplicatedCacheJtaFactoryUseSyncSelfTest.java new file mode 100644 index 0000000..e25f5e8 --- /dev/null +++ b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridReplicatedCacheJtaFactoryUseSyncSelfTest.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache; + +import org.apache.ignite.configuration.IgniteConfiguration; + +/** + * Factory JTA integration test using REPLICATED cache. + */ +public class GridReplicatedCacheJtaFactoryUseSyncSelfTest extends GridReplicatedCacheJtaFactorySelfTest { + /** {@inheritDoc} */ + @Override protected void configureJta(IgniteConfiguration cfg) { + super.configureJta(cfg); + + cfg.getTransactionConfiguration().setUseJtaSynchronization(true); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/8d976043/modules/jta/src/test/java/org/apache/ignite/testsuites/IgniteJtaTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/jta/src/test/java/org/apache/ignite/testsuites/IgniteJtaTestSuite.java b/modules/jta/src/test/java/org/apache/ignite/testsuites/IgniteJtaTestSuite.java index 6e0c096..60c20dd 100644 --- a/modules/jta/src/test/java/org/apache/ignite/testsuites/IgniteJtaTestSuite.java +++ b/modules/jta/src/test/java/org/apache/ignite/testsuites/IgniteJtaTestSuite.java @@ -22,8 +22,10 @@ import org.apache.ignite.internal.processors.cache.CacheJndiTmFactorySelfTest; import org.apache.ignite.internal.processors.cache.GridCacheJtaConfigurationValidationSelfTest; import org.apache.ignite.internal.processors.cache.GridCacheJtaFactoryConfigValidationSelfTest; import org.apache.ignite.internal.processors.cache.GridPartitionedCacheJtaFactorySelfTest; +import org.apache.ignite.internal.processors.cache.GridPartitionedCacheJtaFactoryUseSyncSelfTest; import org.apache.ignite.internal.processors.cache.GridPartitionedCacheJtaLookupClassNameSelfTest; import org.apache.ignite.internal.processors.cache.GridReplicatedCacheJtaFactorySelfTest; +import org.apache.ignite.internal.processors.cache.GridReplicatedCacheJtaFactoryUseSyncSelfTest; import org.apache.ignite.internal.processors.cache.GridReplicatedCacheJtaLookupClassNameSelfTest; import org.apache.ignite.internal.processors.cache.GridJtaLifecycleAwareSelfTest; @@ -44,6 +46,9 @@ public class IgniteJtaTestSuite extends TestSuite { suite.addTestSuite(GridPartitionedCacheJtaLookupClassNameSelfTest.class); suite.addTestSuite(GridReplicatedCacheJtaLookupClassNameSelfTest.class); + suite.addTestSuite(GridPartitionedCacheJtaFactoryUseSyncSelfTest.class); + suite.addTestSuite(GridReplicatedCacheJtaFactoryUseSyncSelfTest.class); + suite.addTestSuite(GridJtaLifecycleAwareSelfTest.class); suite.addTestSuite(GridCacheJtaConfigurationValidationSelfTest.class); suite.addTestSuite(GridCacheJtaFactoryConfigValidationSelfTest.class);
