commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r528707 - in /jakarta/commons/proper/transaction/trunk/src/java1.4/org/apache/commons/transaction: memory/jca/MapXAResource.java util/xa/AbstractTransactionalResource.java
Date Fri, 13 Apr 2007 23:46:38 GMT
Author: joerg
Date: Fri Apr 13 16:46:37 2007
New Revision: 528707

URL: http://svn.apache.org/viewvc?view=rev&rev=528707
Log:
clean up, private fields

Modified:
    jakarta/commons/proper/transaction/trunk/src/java1.4/org/apache/commons/transaction/memory/jca/MapXAResource.java
    jakarta/commons/proper/transaction/trunk/src/java1.4/org/apache/commons/transaction/util/xa/AbstractTransactionalResource.java

Modified: jakarta/commons/proper/transaction/trunk/src/java1.4/org/apache/commons/transaction/memory/jca/MapXAResource.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/transaction/trunk/src/java1.4/org/apache/commons/transaction/memory/jca/MapXAResource.java?view=diff&rev=528707&r1=528706&r2=528707
==============================================================================
--- jakarta/commons/proper/transaction/trunk/src/java1.4/org/apache/commons/transaction/memory/jca/MapXAResource.java
(original)
+++ jakarta/commons/proper/transaction/trunk/src/java1.4/org/apache/commons/transaction/memory/jca/MapXAResource.java
Fri Apr 13 16:46:37 2007
@@ -34,13 +34,12 @@
  */
 public class MapXAResource extends AbstractXAResource {
 
-    TransactionalMapWrapper map;
-    LoggerFacade loggerFacade;
+    private final TransactionalMapWrapper map;
+    private LoggerFacade loggerFacade;
 
     public MapXAResource(TransactionalMapWrapper map) {
-        this.map = map;
         // log important stuff to standard out as long as nothing else is configured
-        this.loggerFacade = new PrintWriterLogger(new PrintWriter(System.out), "WebDAVXAResource",
false);
+        this(map, new PrintWriterLogger(new PrintWriter(System.out), "MapXAResource", false));
     }
 
     public MapXAResource(TransactionalMapWrapper map, LoggerFacade loggerFacade) {
@@ -57,7 +56,7 @@
     }
 
     public boolean isSameRM(XAResource xares) throws XAException {
-        return (xares != null && xares instanceof MapXAResource && map.equals(((MapXAResource)
xares).map));
+        return (xares instanceof MapXAResource && this.map.equals(((MapXAResource)
xares).map));
     }
 
     public Xid[] recover(int flag) throws XAException {
@@ -65,7 +64,7 @@
     }
 
     public LoggerFacade getLoggerFacade() {
-        return loggerFacade;
+        return this.loggerFacade;
     }
     
     public void setLoggerFacade(LoggerFacade loggerFacade) {
@@ -73,11 +72,11 @@
     }
 
     protected void setLoggerFacade(PrintWriter out) {
-        loggerFacade = new PrintWriterLogger(out, "WebDAVXAResource", true);
+        this.loggerFacade = new PrintWriterLogger(out, "MapXAResource", true);
     }
 
     protected TransactionalResource createTransactionResource(Xid xid) throws Exception {
-        return new MapTransactionalResource(xid, map, getLoggerFacade());
+        return new MapTransactionalResource(xid, this.map);
     }
 
     protected boolean includeBranchInXid() {
@@ -86,20 +85,17 @@
 
     protected static class MapTransactionalResource extends AbstractTransactionalResource
{
 
-        TransactionalMapWrapper map;
+        private final TransactionalMapWrapper map;
         private TransactionalMapWrapper.TxContext txContext = null;
 
-        LoggerFacade loggerFacade;
-
-        public MapTransactionalResource(Xid xid, TransactionalMapWrapper map, LoggerFacade
loggerFacade) {
+        public MapTransactionalResource(Xid xid, TransactionalMapWrapper map) {
             super(xid);
             this.map = map;
-            this.loggerFacade = loggerFacade;
         }
 
         public void commit() throws XAException {
             try {
-                map.commitTransaction();
+                this.map.commitTransaction();
             } catch (IllegalStateException e) {
                 throw new XAException(e.toString());
             }
@@ -112,7 +108,7 @@
                 resume();
 
             try {
-                map.rollbackTransaction();
+                this.map.rollbackTransaction();
             } catch (IllegalStateException e) {
                 throw new XAException(e.toString());
             }
@@ -124,25 +120,25 @@
             if (isSuspended())
                 resume();
 
-            if (map.isTransactionMarkedForRollback()) {
+            if (this.map.isTransactionMarkedForRollback()) {
                 throw new XAException(XAException.XA_RBROLLBACK);
             }
 
-            return (map.isReadOnly() ? XA_RDONLY : XA_OK);
+            return (this.map.isReadOnly() ? XA_RDONLY : XA_OK);
         }
 
         public void suspend() throws XAException {
             if (isSuspended()) {
                 throw new XAException(XAException.XAER_PROTO);
             }
-            this.txContext = map.suspendTransaction();
+            this.txContext = this.map.suspendTransaction();
         }
         
         public void resume() throws XAException {
             if (!isSuspended()) {
                 throw new XAException(XAException.XAER_PROTO);
             }
-            map.resumeTransaction(this.txContext);
+            this.map.resumeTransaction(this.txContext);
             this.txContext = null;
         }
         

Modified: jakarta/commons/proper/transaction/trunk/src/java1.4/org/apache/commons/transaction/util/xa/AbstractTransactionalResource.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/transaction/trunk/src/java1.4/org/apache/commons/transaction/util/xa/AbstractTransactionalResource.java?view=diff&rev=528707&r1=528706&r2=528707
==============================================================================
--- jakarta/commons/proper/transaction/trunk/src/java1.4/org/apache/commons/transaction/util/xa/AbstractTransactionalResource.java
(original)
+++ jakarta/commons/proper/transaction/trunk/src/java1.4/org/apache/commons/transaction/util/xa/AbstractTransactionalResource.java
Fri Apr 13 16:46:37 2007
@@ -25,17 +25,17 @@
  * @version $Id$
  */
 public abstract class AbstractTransactionalResource implements TransactionalResource, Status
{
-    protected Xid xid;
-
-    protected int status;
+    
+    private final Xid xid;
+    private int status;
 
     public AbstractTransactionalResource(Xid xid) {
         this.xid = xid;
-        status = STATUS_ACTIVE;
+        this.status = STATUS_ACTIVE;
     }
 
     public int getStatus() {
-        return status;
+        return this.status;
     }
 
     public void setStatus(int status) {
@@ -43,6 +43,7 @@
     }
 
     public Xid getXid() {
-        return xid;
+        return this.xid;
     }
-}
\ No newline at end of file
+    
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message