geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r984470 - in /geronimo/components/txmanager/trunk: ./ geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/WrapperNamedXAResource.java
Date Wed, 11 Aug 2010 16:52:01 GMT
Author: djencks
Date: Wed Aug 11 16:52:01 2010
New Revision: 984470

URL: http://svn.apache.org/viewvc?rev=984470&view=rev
Log:
merge logging improvements from branches/2.1 rev 984262 (from branches/2.1.1 rev 981270)

Modified:
    geronimo/components/txmanager/trunk/   (props changed)
    geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/WrapperNamedXAResource.java

Propchange: geronimo/components/txmanager/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug 11 16:52:01 2010
@@ -1 +1,2 @@
-/geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.1:780438-803185,984259
+/geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.1:780438-803185,984259,984262
+/geronimo/components/txmanager/branches/geronimo-txmanager-parent-2.1.1:981270

Modified: geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/WrapperNamedXAResource.java
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/WrapperNamedXAResource.java?rev=984470&r1=984469&r2=984470&view=diff
==============================================================================
--- geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/WrapperNamedXAResource.java
(original)
+++ geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/WrapperNamedXAResource.java
Wed Aug 11 16:52:01 2010
@@ -21,7 +21,8 @@ import javax.transaction.xa.XAResource;
 import javax.transaction.xa.Xid;
 import javax.transaction.xa.XAException;
 
-import org.apache.geronimo.transaction.manager.NamedXAResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  *
@@ -30,6 +31,7 @@ import org.apache.geronimo.transaction.m
  *
  * */
 public class WrapperNamedXAResource implements NamedXAResource {
+    protected static Logger log = LoggerFactory.getLogger(WrapperNamedXAResource.class.getName());
 
     private final XAResource xaResource;
     private final String name;
@@ -46,14 +48,23 @@ public class WrapperNamedXAResource impl
     }
 
     public void commit(Xid xid, boolean onePhase) throws XAException {
+        if (log.isTraceEnabled()) {
+            log.trace("Commit called on XAResource " + getName() + "\n Xid: " + xid + "\n
onePhase:" + onePhase);
+        }
         xaResource.commit(xid, onePhase);
     }                                                                                   
                               
 
     public void end(Xid xid, int flags) throws XAException {
+        if (log.isTraceEnabled()) {
+            log.trace("End called on XAResource " + getName() + "\n Xid: " + xid + "\n flags:"
+ decodeFlags(flags));
+        }
         xaResource.end(xid, flags);
     }
 
     public void forget(Xid xid) throws XAException {
+        if (log.isTraceEnabled()) {
+            log.trace("Forget called on XAResource " + getName() + "\n Xid: " + xid);
+        }
         xaResource.forget(xid);
     }
 
@@ -69,14 +80,23 @@ public class WrapperNamedXAResource impl
     }
 
     public int prepare(Xid xid) throws XAException {
+        if (log.isTraceEnabled()) {
+            log.trace("Prepare called on XAResource " + getName() + "\n Xid: " + xid);
+        }
         return xaResource.prepare(xid);
     }
 
     public Xid[] recover(int flag) throws XAException {
+        if (log.isTraceEnabled()) {
+            log.trace("Recover called on XAResource " + getName() + "\n flags: " + decodeFlags(flag));
+        }
         return xaResource.recover(flag);
     }
 
     public void rollback(Xid xid) throws XAException {
+        if (log.isTraceEnabled()) {
+            log.trace("Rollback called on XAResource " + getName() + "\n Xid: " + xid);
+        }
         xaResource.rollback(xid);
     }
 
@@ -85,8 +105,36 @@ public class WrapperNamedXAResource impl
     }
 
     public void start(Xid xid, int flags) throws XAException {
+        if (log.isTraceEnabled()) {
+            log.trace("Start called on XAResource " + getName() + "\n Xid: " + xid + "\n
flags:" + decodeFlags(flags));
+        }
         xaResource.start(xid, flags);
     }
+    private String decodeFlags(int flags) {
+        if (flags == 0) {
+            return " TMNOFLAGS";
+        }
+        StringBuilder b = new StringBuilder();
+        decodeFlag(flags, b, TMENDRSCAN, " TMENDRSCAN");
+        decodeFlag(flags, b, TMFAIL, " TMFAIL");
+        decodeFlag(flags, b, TMJOIN, " TMJOIN");
+        decodeFlag(flags, b, TMONEPHASE, " TMONEPHASE");
+        decodeFlag(flags, b, TMRESUME, " TMRESUME");
+        decodeFlag(flags, b, TMSTARTRSCAN, " TMSTARTRSCAN");
+        decodeFlag(flags, b, TMSUCCESS, " TMSUCCESS");
+        decodeFlag(flags, b, TMSUSPEND, " TMSUSPEND");
+        if (flags != 0) {
+            b.append(" remaining: ").append(flags);
+        }
+        return b.toString();
+    }
+
+    private void decodeFlag(int flags, StringBuilder b, int flag, String flagName) {
+        if ((flags & flag) == flag) {
+            b.append(flagName);
+            flags = flags ^ flag;
+        }
+    }
 }
 
 



Mime
View raw message