You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by ke...@apache.org on 2007/05/10 03:23:25 UTC
svn commit: r536727 -
/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java
Author: kevan
Date: Wed May 9 18:23:24 2007
New Revision: 536727
URL: http://svn.apache.org/viewvc?view=rev&rev=536727
Log:
If transaction is imported from RA, don't enlist the xaResource in the transaction
Modified:
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java?view=diff&rev=536727&r1=536726&r2=536727
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java Wed May 9 18:23:24 2007
@@ -196,45 +196,7 @@
}
public Object invoke(Object deploymentId, Class callInterface, Method method, Object[] args, Object primKey) throws OpenEJBException {
- // get the target deployment (MDB)
- CoreDeploymentInfo deployInfo = (CoreDeploymentInfo) getDeploymentInfo(deploymentId);
- if (deployInfo == null) throw new SystemException("Unknown deployment " + deploymentId);
-
- // create instance
- Object instance = null;
- try {
- EndpointFactory endpointFactory = (EndpointFactory) deployInfo.getContainerData();
- instance = endpointFactory.getInstanceFactory().createInstance(true);
- } catch (UnavailableException e) {
- throw new SystemException("Unable to create new MDB instance: ", e);
- }
-
- try {
- // before
- beforeDelivery(deployInfo, instance, method, null);
-
- boolean exceptionThrown = false;
- try {
- // deliver the message
- return invoke(instance, method, args);
- } catch (OpenEJBException e) {
- exceptionThrown = true;
- throw e;
- } finally {
- try {
- // after
- afterDelivery(instance);
- } catch (SystemException e) {
- if (!exceptionThrown) {
- //noinspection ThrowFromFinallyBlock
- throw e;
- }
- logger.error("Unexpected exception from afterDelivery");
- }
- }
- } finally {
- release(deployInfo, instance);
- }
+ throw new OpenEJBException("This MdbContainer.invoke should not be used!");
}
public void beforeDelivery(CoreDeploymentInfo deployInfo, Object instance, Method method, XAResource xaResource) throws SystemException {
@@ -254,10 +216,11 @@
// call the tx before method
try {
+ boolean adapterTransaction = transactionManager.getTransaction() != null;
mdbCallContext.txPolicy.beforeInvoke(instance, mdbCallContext.txContext);
- // enrole the xaresource in the transaction
- if (xaResource != null) {
+ // if we have an xaResource and a transaction was not imported from the adapter, enlist the xaResource
+ if (xaResource != null && !adapterTransaction) {
Transaction transaction = transactionManager.getTransaction();
if (transaction != null) {
transaction.enlistResource(xaResource);