You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Manu George <ma...@gmail.com> on 2007/09/22 21:08:13 UTC

Question on Transaction Logging and recovery. David Jencks and Blevins pls read.

Hi,
     I was investigating GERONIMO-3354. Found that the exception
getting thrown was due to an XAResource getting passed to the the
geronimo transaction manager instead of a NamedXAResource .So I made
this change. Since I am a novice in this area, I had a chat with Dain.
The main points of raised by Dain are

There are two sides to this problem
1) You have to name the xaresouce objects so the TM knows which jobs are for
    which resource.You need to to register the resource using the name
with the TM.
    Neither of these is done in openejb. When using G ,G handles
registering the resource
    with the tm correctly. We need to determine the correct calls for
openejb standalone.

2) It would be better not to have a Geronimo specific api (Named
XAResource)used in the Endpoint factory.So we'll need some sort of
abstraction.

So what is the best way to setup this abstraction?

Dain has suggested having plugins.
Explanation of this
so lets say you commit your fix
	<dain>	we end up with a G specific API in EndPointFactory
	<mageorge>	yeah
	<dain>	we write a plugin interface ... say XAResourceNamer
	<dain>	with a method XAResource name(XAResource xaResource, String name)
	<dain>	in EndpointFactory we find the XAResourceNamer implementation
	<mageorge>	ok i am getting the idea
	<dain>	and call that method instead of using G code directly

Any suggestions/help on this will be appreciated. Maybe we can do it
using xbean-finder :)

Now there are a few questions

1) Is the patch enough for transaction recovery to work in openejb
embedded in geronimo?
    If not what else needs to be done?

2) What else is required inorder to get transaction recovery to work
in OpenEJB standalone?

Thanks
Manu

On 9/23/07, manugeorge@apache.org <ma...@apache.org> wrote:
> Author: manugeorge
> Date: Sat Sep 22 11:32:45 2007
> New Revision: 578471
>
> URL: http://svn.apache.org/viewvc?rev=578471&view=rev
> Log:
> Temporary Fix for GERONIMO-3354 - Exception thrown by MDB involved in XA transaction.
> Wrapped XAResource to make it NamedXAResource. Container id is passed as the name.
>
> Modified:
>     openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java
>
> Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java
> URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java?rev=578471&r1=578470&r2=578471&view=diff
> ==============================================================================
> --- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java (original)
> +++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java Sat Sep 22 11:32:45 2007
> @@ -17,6 +17,8 @@
>   */
>  package org.apache.openejb.core.mdb;
>
> +import org.apache.geronimo.transaction.manager.NamedXAResource;
> +import org.apache.geronimo.transaction.manager.WrapperNamedXAResource;
>  import org.apache.openejb.DeploymentInfo;
>  import org.apache.openejb.core.CoreDeploymentInfo;
>
> @@ -54,7 +56,11 @@
>      }
>
>      public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException {
> -        EndpointHandler endpointHandler = new EndpointHandler(container, deploymentInfo, instanceFactory, xaResource);
> +        // Hack to get GERONIMO-3354 error from not ocurring.
> +        //TODO Create an abstraction so that we need not use geronimo api classes(NamedXAResource).
> +        //TODO Confirm that this is all that is required for transaction recovery
> +        NamedXAResource wrapper = new WrapperNamedXAResource(xaResource, container.getContainerID().toString());
> +        EndpointHandler endpointHandler = new EndpointHandler(container, deploymentInfo, instanceFactory, wrapper);
>          MessageEndpoint messageEndpoint = (MessageEndpoint) Proxy.newProxyInstance(classLoader, interfaces, endpointHandler);
>          return messageEndpoint;
>      }
>
>
>