You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2005/08/23 21:59:06 UTC
svn commit: r239453 -
/geronimo/trunk/modules/transaction/src/java/org/apache/geronimo/transaction/manager/TransactionImpl.java
Author: djencks
Date: Tue Aug 23 12:59:04 2005
New Revision: 239453
URL: http://svn.apache.org/viewcvs?rev=239453&view=rev
Log:
resolve -1 from jstrachans commit, this will work for both of us. Using non-NamedXAResource with a real recovery log and 2pc will result in an exception.
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=239453&r1=239452&r2=239453&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 23 12:59:04 2005
@@ -1,6 +1,6 @@
/**
*
- * Copyright 2003-2004 The Apache Software Foundation
+ * Copyright 2003-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -374,7 +374,7 @@
//helper method used by Transaction.commit and XATerminator prepare.
private boolean internalPrepare() throws SystemException {
-
+
for (Iterator rms = resourceManagers.iterator(); rms.hasNext();) {
synchronized (this) {
if (status != Status.STATUS_PREPARING) {
@@ -400,7 +400,7 @@
}
}
-
+
// decision time...
boolean willCommit;
synchronized (this) {
@@ -631,30 +631,16 @@
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 XAResource committer;
private final Xid branchId;
public TransactionBranch(XAResource xaRes, Xid branchId) {
- committer = asNamedXAResource(xaRes);
+ committer = xaRes;
this.branchId = branchId;
}
- public NamedXAResource getCommitter() {
+ public XAResource getCommitter() {
return committer;
}
@@ -663,7 +649,11 @@
}
public String getResourceName() {
- return committer.getName();
+ if (committer instanceof NamedXAResource) {
+ return ((NamedXAResource)committer).getName();
+ } else {
+ throw new IllegalStateException("Cannot log transactions unles XAResources are named! " + committer);
+ }
}
public Xid getBranchXid() {