From 724b5feaa9c41fd1b32684af7db46bf9137b8017 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Mon, 21 Dec 2015 22:23:51 +0300 Subject: [PATCH] Monkey-patch to disable XA in BPEL SE --- .../bpel/persist/impl/StateManagerImpl.java | 30 +++++++++---------- .../core/bpel/util/TxPropagationObject.java | 6 ++-- .../bpel/core/bpel/util/msgs.properties | 9 ------ 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/ojc-core/bpelse/bpelcore/src/com/sun/jbi/engine/bpel/core/bpel/persist/impl/StateManagerImpl.java b/ojc-core/bpelse/bpelcore/src/com/sun/jbi/engine/bpel/core/bpel/persist/impl/StateManagerImpl.java index c495c550e..85ab094bd 100755 --- a/ojc-core/bpelse/bpelcore/src/com/sun/jbi/engine/bpel/core/bpel/persist/impl/StateManagerImpl.java +++ b/ojc-core/bpelse/bpelcore/src/com/sun/jbi/engine/bpel/core/bpel/persist/impl/StateManagerImpl.java @@ -592,15 +592,15 @@ public class StateManagerImpl implements StateManager { * where its set in the Registry */ String stateId = state.getId(); - TransactionManager tm = (TransactionManager) BPELSERegistry.getInstance().lookup( - TransactionManager.class.getName()); +// TransactionManager tm = (TransactionManager) BPELSERegistry.getInstance().lookup( +// TransactionManager.class.getName()); if (StateManager.TransactionType.XAParticipate.equals(transactionInfo.getTransactionType())) { AbstractDBConnection xadbConnection = null; try { - tm.resume(transactionInfo.getTransaction()); - transactionInfo.getTransaction().registerSynchronization( - transactionInfo.getSynchronization()); +// tm.resume(transactionInfo.getTransaction()); +// transactionInfo.getTransaction().registerSynchronization( +// transactionInfo.getSynchronization()); xadbConnection = mDBFactory.createXAConnection(); performDBOperationForDBOs(insertUpdateDeleteDBOs, xadbConnection); @@ -614,13 +614,13 @@ public class StateManagerImpl implements StateManager { stateId, insertActIds, updateActIds, deleteActIds)); } - tm.suspend(); +// tm.suspend(); } catch (Exception pExcep) { printSQLBatchExceptions(pExcep); // Just in case the connection is stale, validate it. This will cause the connection to be removed // from the DataSource (sun impl of DataSource only) mDBFactory.validateXAConnection(xadbConnection); - transactionInfo.getTransaction().setRollbackOnly(); +// transactionInfo.getTransaction().setRollbackOnly(); if (LOGGER.isLoggable(Level.FINEST)) { String insertActIds = insertUpdateDeleteDBOs.getActIdForInserts(); String updateActIds = insertUpdateDeleteDBOs.getActIdForUpdates(); @@ -631,7 +631,7 @@ public class StateManagerImpl implements StateManager { stateId, insertActIds, updateActIds, deleteActIds)); } - tm.suspend(); +// tm.suspend(); throw new RuntimeException( I18n.loc("BPCOR-6076: Exception thrown while processing transaction type XAParticipate"), pExcep); @@ -650,24 +650,24 @@ public class StateManagerImpl implements StateManager { } } else if (StateManager.TransactionType.XAStartNew.equals(transactionInfo.getTransactionType())) { - try { +/* try { tm.begin(); transactionInfo.setTransaction(tm.getTransaction()); tm.suspend(); } catch (Exception startExcep) { throw new RuntimeException(I18n.loc("BPCOR-6078: Exception thrown while processing " + "transaction type XAStartNew: {0}"), startExcep); - } + }*/ } else if (StateManager.TransactionType.XAEnd.equals(transactionInfo.getTransactionType())) { AbstractDBConnection xadbConnection = null; boolean sucess = false; try { - tm.resume(transactionInfo.getTransaction()); +// tm.resume(transactionInfo.getTransaction()); xadbConnection = mDBFactory.createXAConnection(); performDBOperationForDBOs(insertUpdateDeleteDBOs, xadbConnection); - transactionInfo.getTransaction().commit(); +// transactionInfo.getTransaction().commit(); sucess = true; if (LOGGER.isLoggable(Level.FINEST)) { String insertActIds = insertUpdateDeleteDBOs.getActIdForInserts(); @@ -685,7 +685,7 @@ public class StateManagerImpl implements StateManager { boolean connOK = mDBFactory.validateXAConnection(xadbConnection); // Suspend the transaction and then throw the appropriate exception which would call the condition // XACanel that will perform the rollback of the transaction. - tm.suspend(); +// tm.suspend(); if (LOGGER.isLoggable(Level.FINEST)) { String insertActIds = insertUpdateDeleteDBOs.getActIdForInserts(); String updateActIds = insertUpdateDeleteDBOs.getActIdForUpdates(); @@ -728,8 +728,8 @@ public class StateManagerImpl implements StateManager { } else if (StateManager.TransactionType.XACancel.equals(transactionInfo.getTransactionType())) { try { - tm.resume(transactionInfo.getTransaction()); - transactionInfo.getTransaction().rollback(); +// tm.resume(transactionInfo.getTransaction()); +// transactionInfo.getTransaction().rollback(); if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, I18n.loc("BPCOR-3045: TX type XACancel rolledback with stateid = {0}", stateId)); diff --git a/ojc-core/bpelse/bpelcore/src/com/sun/jbi/engine/bpel/core/bpel/util/TxPropagationObject.java b/ojc-core/bpelse/bpelcore/src/com/sun/jbi/engine/bpel/core/bpel/util/TxPropagationObject.java index 175e4c519..f8d2a62b6 100755 --- a/ojc-core/bpelse/bpelcore/src/com/sun/jbi/engine/bpel/core/bpel/util/TxPropagationObject.java +++ b/ojc-core/bpelse/bpelcore/src/com/sun/jbi/engine/bpel/core/bpel/util/TxPropagationObject.java @@ -101,7 +101,9 @@ public class TxPropagationObject { * @return */ public boolean extractTransactionFromRequest(MessageContainer request, BPELProcessManager processMgr) { - mRequest = request; + mAtomicTxType = TransactionType.nosupport; + return false; +/* mRequest = request; mTransaction = request.getTransaction(); String atomicTxType = processMgr.getAtomicTxType(); if (mTransaction == null && atomicTxType != null && atomicTxType.equals(TX_TYPE_REQUIRED)) { @@ -131,7 +133,7 @@ public class TxPropagationObject { } catch (Exception e) { throw new RuntimeException(I18n.loc("BPCOR-6105: Encountered an error while trying to register " + "synchronization object with the transaction to be propagated."), e); - } + }*/ } public Transaction getTransaction() { diff --git a/ojc-core/bpelse/bpelcore/src/com/sun/jbi/engine/bpel/core/bpel/util/msgs.properties b/ojc-core/bpelse/bpelcore/src/com/sun/jbi/engine/bpel/core/bpel/util/msgs.properties index dd1a96c72..cde7beb2b 100755 --- a/ojc-core/bpelse/bpelcore/src/com/sun/jbi/engine/bpel/core/bpel/util/msgs.properties +++ b/ojc-core/bpelse/bpelcore/src/com/sun/jbi/engine/bpel/core/bpel/util/msgs.properties @@ -294,9 +294,6 @@ BPCOR-6076 = Exception thrown while processing transaction type XAParticipate # com.sun.jbi.engine.bpel.core.bpel.persist.impl.StateManagerImpl BPCOR-6077 = TX type XAParticipates, exception thrown when trying to close connection -# com.sun.jbi.engine.bpel.core.bpel.persist.impl.StateManagerImpl -BPCOR-6078 = Exception thrown while processing transaction type XAStartNew\: {0} - # com.sun.jbi.engine.bpel.core.bpel.persist.impl.StateManagerImpl BPCOR-6079 = Exception thrown while processing transaction type XAEnd @@ -379,9 +376,6 @@ BPCOR-6103 = Missmatched assign from message to non message. Process id {0}. Lin # com.sun.jbi.engine.bpel.core.bpel.management.BPELSEManagement BPCOR-6104 = The bpelQName parameter as well as the searchString parameter are required to search for bpel instances by variable value. -# com.sun.jbi.engine.bpel.core.bpel.util.TxPropagationObject -BPCOR-6105 = Encountered an error while trying to register synchronization object with the transaction to be propagated. - # com.sun.jbi.engine.bpel.core.bpel.util.Utility BPCOR-6106 = correlations with initiate value 'no' are not defined @@ -728,9 +722,6 @@ BPCOR-7134 = Invalid variable value \n{0}\nis assigned to {1} in BP instance ({2 # com.sun.jbi.engine.bpel.core.bpel.model.runtime.impl.ValidateUnitImpl BPCOR-7135 = Invalid variable value \n{0}\nis in {1} in BP instance ({2}) at line {3} BP {4}. Error Summary\: {5} -# com.sun.jbi.engine.bpel.core.bpel.util.TxPropagationObject -BPCOR-7136 = Atomic mode, encountered an error while trying to begin and associate a transaction. - # com.sun.jbi.engine.bpel.core.bpel.model.runtime.impl.IMAScopeBridge BPCOR-7137 = Atomic mode, encountered an error while trying to commit a Transaction that was started by the bpel-se.