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, [EMAIL PROTECTED] 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 [EMAIL PROTECTED] XAResource} into a
[EMAIL PROTECTED] 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/