You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by David Jencks <da...@yahoo.com> on 2005/08/16 17:05:19 UTC

Re: svn commit: r232975 - /geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/manager/TransactionImpl.java

Can you provide some justification for this?  Unless you have  
implemented some very special XAResource where toString returns the  
same name no matter which vm you are running in, whenever you start the  
server, this breaks recovery.  -1 without discussion and convincing me  
this will lead to greater stability and more reliable recovery.

thanks
david jencks

On Aug 16, 2005, at 3:28 AM, jstrachan@apache.org wrote:

> Author: jstrachan
> Date: Tue Aug 16 03:28:43 2005
> New Revision: 232975
>
> URL: http://svn.apache.org/viewcvs?rev=232975&view=rev
> Log:
> added a helper method to avoid ClassCastException when using Geronimo  
> TransactionManager with regular, non-wrapped XAResource instances
>
> Modified:
>      
> geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/ 
> transaction/manager/TransactionImpl.java
>
> Modified:  
> geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/ 
> transaction/manager/TransactionImpl.java
> URL:  
> http://svn.apache.org/viewcvs/geronimo/trunk/modules/transaction/src/ 
> java/org/apache/geronimo/transaction/manager/TransactionImpl.java? 
> rev=232975&r1=232974&r2=232975&view=diff
> ======================================================================= 
> =======
> ---  
> geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/ 
> transaction/manager/TransactionImpl.java (original)
> +++  
> geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/ 
> transaction/manager/TransactionImpl.java Tue Aug 16 03:28:43 2005
> @@ -631,12 +631,26 @@
>          return manager;
>      }
>
> +    /**
> +     * A helper method to convert an {@link XAResource} into a {@link  
> NamedXAResource}
> +     * either via casting or wrapping.
> +     */
> +    protected static NamedXAResource asNamedXAResource(XAResource  
> xaRes) {
> +        if (xaRes instanceof NamedXAResource) {
> +            return (NamedXAResource) xaRes;
> +        }
> +        else {
> +            String name = xaRes.toString();
> +            return new WrapperNamedXAResource(xaRes, name);
> +        }
> +    }
> +
>      private static class TransactionBranch implements  
> TransactionBranchInfo {
>          private final NamedXAResource committer;
>          private final Xid branchId;
>
>          public TransactionBranch(XAResource xaRes, Xid branchId) {
> -            committer = (NamedXAResource)xaRes;
> +            committer = asNamedXAResource(xaRes);
>              this.branchId = branchId;
>          }
>
>
>


Re: svn commit: r232975 - /geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/manager/TransactionImpl.java

Posted by David Jencks <da...@yahoo.com>.
After some discussion we came to a solution we can both live with, and  
it is committed, removing the -1.

Now, you can use non-NamedXAResources as long as you have the  
no-recovery log or don't do 2pc.  If you try to use a  
non-NamedXAResource in a 2pc transaction while using a real recovery  
log, you will get an exception.

thanks
david jencks

On Aug 23, 2005, at 9:22 AM, jastrachan@mac.com wrote:

> On 23 Aug 2005, at 08:13, David Jencks wrote:
>> There hasn't been any response to my -1 here.  Unless there's a  
>> response within 24 hours I'm going to revert this.
>
> Sorry David - missed your mail.
>
> The reason for the change was to be able to use the Geronimo  
> TransactionManager without recovery, folks don't often have a  
> NamedXAResource. So this relatively minor change just avoids a  
> ClassCastException I was getting when trying to use the Geronimo  
> TransactionManager in a spring application without Howl.
>
> Its a pretty trivial change and just avoids a really nasty stack  
> trace. Note that recovery is optional in the TransactionManager (you  
> can omit the journal) so the TransactionManager should be able to work  
> with regular XAResources without throwing nasty exceptions IMHO.
>
> Did you have a different solution in mind? I just want Geronimo  
> TransactionManager to work with an XAResource without throwing  
> exceptions.
>
> James
>
>
>>
>> thanks
>> david jencks
>>
>> On Aug 16, 2005, at 8:05 AM, David Jencks wrote:
>>
>>
>>> Can you provide some justification for this?  Unless you have  
>>> implemented some very special XAResource where toString returns the  
>>> same name no matter which vm you are running in, whenever you start  
>>> the server, this breaks recovery.  -1 without discussion and  
>>> convincing me this will lead to greater stability and more reliable  
>>> recovery.
>>>
>>> thanks
>>> david jencks
>>>
>>> On Aug 16, 2005, at 3:28 AM, jstrachan@apache.org wrote:
>>>
>>>
>>>> Author: jstrachan
>>>> Date: Tue Aug 16 03:28:43 2005
>>>> New Revision: 232975
>>>>
>>>> URL: http://svn.apache.org/viewcvs?rev=232975&view=rev
>>>> Log:
>>>> added a helper method to avoid ClassCastException when using  
>>>> Geronimo TransactionManager with regular, non-wrapped XAResource  
>>>> instances
>>>>
>>>> Modified:
>>>>      
>>>> geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/ 
>>>> transaction/manager/TransactionImpl.java
>>>>
>>>> Modified:  
>>>> geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/ 
>>>> transaction/manager/TransactionImpl.java
>>>> URL:  
>>>> http://svn.apache.org/viewcvs/geronimo/trunk/modules/transaction/ 
>>>> src/java/org/apache/geronimo/transaction/manager/ 
>>>> TransactionImpl.java?rev=232975&r1=232974&r2=232975&view=diff
>>>> ==================================================================== 
>>>> ==========
>>>> ---  
>>>> geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/ 
>>>> transaction/manager/TransactionImpl.java (original)
>>>> +++  
>>>> geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/ 
>>>> transaction/manager/TransactionImpl.java Tue Aug 16 03:28:43 2005
>>>> @@ -631,12 +631,26 @@
>>>>          return manager;
>>>>      }
>>>>
>>>> +    /**
>>>> +     * A helper method to convert an {@link XAResource} into a  
>>>> {@link NamedXAResource}
>>>> +     * either via casting or wrapping.
>>>> +     */
>>>> +    protected static NamedXAResource asNamedXAResource(XAResource  
>>>> xaRes) {
>>>> +        if (xaRes instanceof NamedXAResource) {
>>>> +            return (NamedXAResource) xaRes;
>>>> +        }
>>>> +        else {
>>>> +            String name = xaRes.toString();
>>>> +            return new WrapperNamedXAResource(xaRes, name);
>>>> +        }
>>>> +    }
>>>> +
>>>>      private static class TransactionBranch implements  
>>>> TransactionBranchInfo {
>>>>          private final NamedXAResource committer;
>>>>          private final Xid branchId;
>>>>
>>>>          public TransactionBranch(XAResource xaRes, Xid branchId) {
>>>> -            committer = (NamedXAResource)xaRes;
>>>> +            committer = asNamedXAResource(xaRes);
>>>>              this.branchId = branchId;
>>>>          }
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
> James
> -------
> http://radio.weblogs.com/0112098/
>


Re: svn commit: r232975 - /geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/manager/TransactionImpl.java

Posted by ja...@mac.com.
On 23 Aug 2005, at 08:13, David Jencks wrote:
> There hasn't been any response to my -1 here.  Unless there's a  
> response within 24 hours I'm going to revert this.

Sorry David - missed your mail.

The reason for the change was to be able to use the Geronimo  
TransactionManager without recovery, folks don't often have a  
NamedXAResource. So this relatively minor change just avoids a  
ClassCastException I was getting when trying to use the Geronimo  
TransactionManager in a spring application without Howl.

Its a pretty trivial change and just avoids a really nasty stack  
trace. Note that recovery is optional in the TransactionManager (you  
can omit the journal) so the TransactionManager should be able to  
work with regular XAResources without throwing nasty exceptions IMHO.

Did you have a different solution in mind? I just want Geronimo  
TransactionManager to work with an XAResource without throwing  
exceptions.

James


>
> thanks
> david jencks
>
> On Aug 16, 2005, at 8:05 AM, David Jencks wrote:
>
>
>> Can you provide some justification for this?  Unless you have  
>> implemented some very special XAResource where toString returns  
>> the same name no matter which vm you are running in, whenever you  
>> start the server, this breaks recovery.  -1 without discussion and  
>> convincing me this will lead to greater stability and more  
>> reliable recovery.
>>
>> thanks
>> david jencks
>>
>> On Aug 16, 2005, at 3:28 AM, jstrachan@apache.org wrote:
>>
>>
>>> Author: jstrachan
>>> Date: Tue Aug 16 03:28:43 2005
>>> New Revision: 232975
>>>
>>> URL: http://svn.apache.org/viewcvs?rev=232975&view=rev
>>> Log:
>>> added a helper method to avoid ClassCastException when using  
>>> Geronimo TransactionManager with regular, non-wrapped XAResource  
>>> instances
>>>
>>> Modified:
>>>     geronimo/trunk/modules/transaction/src/java/org/apache/ 
>>> geronimo/transaction/manager/TransactionImpl.java
>>>
>>> Modified: geronimo/trunk/modules/transaction/src/java/org/apache/ 
>>> geronimo/transaction/manager/TransactionImpl.java
>>> URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/ 
>>> transaction/src/java/org/apache/geronimo/transaction/manager/ 
>>> TransactionImpl.java?rev=232975&r1=232974&r2=232975&view=diff
>>> ==================================================================== 
>>> ==========
>>> --- geronimo/trunk/modules/transaction/src/java/org/apache/ 
>>> geronimo/transaction/manager/TransactionImpl.java (original)
>>> +++ geronimo/trunk/modules/transaction/src/java/org/apache/ 
>>> geronimo/transaction/manager/TransactionImpl.java Tue Aug 16  
>>> 03:28:43 2005
>>> @@ -631,12 +631,26 @@
>>>          return manager;
>>>      }
>>>
>>> +    /**
>>> +     * A helper method to convert an {@link XAResource} into a  
>>> {@link NamedXAResource}
>>> +     * either via casting or wrapping.
>>> +     */
>>> +    protected static NamedXAResource asNamedXAResource 
>>> (XAResource xaRes) {
>>> +        if (xaRes instanceof NamedXAResource) {
>>> +            return (NamedXAResource) xaRes;
>>> +        }
>>> +        else {
>>> +            String name = xaRes.toString();
>>> +            return new WrapperNamedXAResource(xaRes, name);
>>> +        }
>>> +    }
>>> +
>>>      private static class TransactionBranch implements  
>>> TransactionBranchInfo {
>>>          private final NamedXAResource committer;
>>>          private final Xid branchId;
>>>
>>>          public TransactionBranch(XAResource xaRes, Xid branchId) {
>>> -            committer = (NamedXAResource)xaRes;
>>> +            committer = asNamedXAResource(xaRes);
>>>              this.branchId = branchId;
>>>          }
>>>
>>>
>>>
>>>
>>
>>
>
>


James
-------
http://radio.weblogs.com/0112098/


Re: svn commit: r232975 - /geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/manager/TransactionImpl.java

Posted by David Jencks <da...@yahoo.com>.
There hasn't been any response to my -1 here.  Unless there's a  
response within 24 hours I'm going to revert this.

thanks
david jencks

On Aug 16, 2005, at 8:05 AM, David Jencks wrote:

> Can you provide some justification for this?  Unless you have  
> implemented some very special XAResource where toString returns the  
> same name no matter which vm you are running in, whenever you start  
> the server, this breaks recovery.  -1 without discussion and  
> convincing me this will lead to greater stability and more reliable  
> recovery.
>
> thanks
> david jencks
>
> On Aug 16, 2005, at 3:28 AM, jstrachan@apache.org wrote:
>
>> Author: jstrachan
>> Date: Tue Aug 16 03:28:43 2005
>> New Revision: 232975
>>
>> URL: http://svn.apache.org/viewcvs?rev=232975&view=rev
>> Log:
>> added a helper method to avoid ClassCastException when using Geronimo  
>> TransactionManager with regular, non-wrapped XAResource instances
>>
>> Modified:
>>      
>> geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/ 
>> transaction/manager/TransactionImpl.java
>>
>> Modified:  
>> geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/ 
>> transaction/manager/TransactionImpl.java
>> URL:  
>> http://svn.apache.org/viewcvs/geronimo/trunk/modules/transaction/src/ 
>> java/org/apache/geronimo/transaction/manager/TransactionImpl.java? 
>> rev=232975&r1=232974&r2=232975&view=diff
>> ====================================================================== 
>> ========
>> ---  
>> geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/ 
>> transaction/manager/TransactionImpl.java (original)
>> +++  
>> geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/ 
>> transaction/manager/TransactionImpl.java Tue Aug 16 03:28:43 2005
>> @@ -631,12 +631,26 @@
>>          return manager;
>>      }
>>
>> +    /**
>> +     * A helper method to convert an {@link XAResource} into a  
>> {@link NamedXAResource}
>> +     * either via casting or wrapping.
>> +     */
>> +    protected static NamedXAResource asNamedXAResource(XAResource  
>> xaRes) {
>> +        if (xaRes instanceof NamedXAResource) {
>> +            return (NamedXAResource) xaRes;
>> +        }
>> +        else {
>> +            String name = xaRes.toString();
>> +            return new WrapperNamedXAResource(xaRes, name);
>> +        }
>> +    }
>> +
>>      private static class TransactionBranch implements  
>> TransactionBranchInfo {
>>          private final NamedXAResource committer;
>>          private final Xid branchId;
>>
>>          public TransactionBranch(XAResource xaRes, Xid branchId) {
>> -            committer = (NamedXAResource)xaRes;
>> +            committer = asNamedXAResource(xaRes);
>>              this.branchId = branchId;
>>          }
>>
>>
>>
>