User: d_jencks
  Date: 01/08/16 22:37:35

  Modified:    src/main/org/jboss/pool/connector BaseConnectionManager.java
                        XAConnectionManager.java
  Log:
  preliminary fix of logging: more logging cleanup soon
  
  Revision  Changes    Path
  1.4       +24 -19    
jbosspool/src/main/org/jboss/pool/connector/BaseConnectionManager.java
  
  Index: BaseConnectionManager.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosspool/src/main/org/jboss/pool/connector/BaseConnectionManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BaseConnectionManager.java        2001/08/16 03:05:45     1.3
  +++ BaseConnectionManager.java        2001/08/17 05:37:35     1.4
  @@ -23,6 +23,8 @@
   import org.jboss.pool.ObjectPool;
   import org.jboss.pool.PoolParameters;
   
  +import org.jboss.logging.log4j.JBossCategory;
  +
   /**
    * Abstract base class for ConnectionManager implementations.  This
    * handles connection pools, and provides listener implementations
  @@ -39,8 +41,10 @@
       protected transient Map handles;
       protected transient TransactionManager tm;
       protected transient ServerSecurityManager sec;
  -    protected transient PrintWriter logger;
   
  +    private JBossCategory log = 
(JBossCategory)JBossCategory.getInstance(BaseConnectionManager.class);
  +
  +
       public BaseConnectionManager() {
           pools = new PoolManager();
           handles = new HashMap();
  @@ -78,14 +82,13 @@
        * Sets the logger to use for this ConnectionManager.
        */
       public void setLogWriter(PrintWriter logger) {
  -        this.logger = logger;
       }
   
       /**
        * Gets the logger used by this ConnectionManager.
        */
       public PrintWriter getLogWriter() {
  -        return logger;
  +        return null;
       }
   
       /**
  @@ -138,8 +141,8 @@
           handles = null;
           tm = null;
           sec = null;
  -        logger.println(getClass().getName()+" shut down.");
  -        logger = null;
  +        log.info(getClass().getName()+" shut down.");
  +        log = null;
       }
   
       /**
  @@ -248,6 +251,7 @@
       // Probably won't be shared, since you usually share based on TX,
       // but who knows?
       protected class NoTransactionListener extends ConnectionListener {
  +        private JBossCategory log = 
(JBossCategory)JBossCategory.getInstance(NoTransactionListener.class);
   
           public NoTransactionListener(ObjectPool pool, ManagedConnection con) {
               super(pool, con);
  @@ -303,7 +307,7 @@
                   try {
                       con.destroy();
                   } catch(ResourceException e) {
  -                    e.printStackTrace();
  +                    log.error(e);
                   }
               }
           }
  @@ -324,6 +328,8 @@
           private Transaction trans;
           private LocalTransaction local;
   
  +        private JBossCategory log = 
(JBossCategory)JBossCategory.getInstance(SharedLocalConnectionListener.class);
  +
           public SharedLocalConnectionListener(ObjectPool pool, ManagedConnection 
con, Transaction trans, LocalTransaction local) {
               super(pool, con);
               this.trans = trans;
  @@ -378,10 +384,10 @@
               try {
                   if(status == Status.STATUS_COMMITTED) {
                       local.commit();
  -                System.out.println("local transaction committed");
  +                    log.trace("local transaction committed");
                   } else {
                       local.rollback();
  -                System.out.println("local transaction rolled back");
  +                    log.trace("local transaction rolled back");
                   }
               } catch(ResourceException e) {
                   // Dispose of the connection
  @@ -405,9 +411,7 @@
            * the connection is destroyed and this listener is cleared.
            */
           public void connectionErrorOccurred(ConnectionEvent evt) {
  -           System.out.println("===========================================");
  -           System.out.println("Connection Error Occurred");
  -           System.out.println("===========================================");
  +           log.trace("Connection Error Occurred");
               try {
                   local.rollback();
               } catch(Exception e) {}
  @@ -448,7 +452,7 @@
                   try {
                       con.destroy();
                   } catch(ResourceException e) {
  -                    e.printStackTrace();
  +                    log.error(e);
                   }
               }
           }
  @@ -473,7 +477,7 @@
                   try {
                       con.destroy();
                   } catch(ResourceException e) {
  -                    e.printStackTrace();
  +                    log.error(e);
                   }
               }
           }
  @@ -491,6 +495,7 @@
       protected class XAListener extends ConnectionListener implements 
Synchronization, ConnectionEventListener {
           private XAResource xar;
           private Transaction trans;
  +        private JBossCategory log = 
(JBossCategory)JBossCategory.getInstance(XAListener.class);
   
           public XAListener(ObjectPool pool, ManagedConnection con, Transaction 
trans, XAResource xar) {
               super(pool, con);
  @@ -535,7 +540,7 @@
                       try {
                           con.destroy();
                       } catch(ResourceException e) {
  -                        e.printStackTrace();
  +                        log.error(e);
                       }
                   }
               }
  @@ -553,7 +558,7 @@
               try {
                   trans.delistResource(xar, XAResource.TMFAIL);
               } catch(SystemException e) {
  -                e.printStackTrace();
  +                log.error(e);
               }
               if(pool != null) {
                   pool.markObjectAsInvalid(con);
  @@ -562,11 +567,11 @@
                   try {
                       con.destroy();
                   } catch(ResourceException e) {
  -                    e.printStackTrace();
  +                    log.error(e);
                   }
               }
   
  -                System.out.println("%%%%%%%%%%ConnectionClosedErrorOccured, clear 
might be late");
  +            log.warn("ConnectionClosedErrorOccured, clear might be late");
               clear();
           }
   
  @@ -587,7 +592,7 @@
                   try {
                       trans.delistResource(xar, XAResource.TMSUCCESS);
                   } catch(SystemException e) {
  -                    e.printStackTrace();
  +                    log.error(e);
                   }
               }
   
  @@ -602,7 +607,7 @@
                   try {
                       con.destroy();
                   } catch(ResourceException e) {
  -                    e.printStackTrace();
  +                    log.error(e);
                   }
                   clear();
               } else {
  
  
  
  1.3       +7 -3      
jbosspool/src/main/org/jboss/pool/connector/XAConnectionManager.java
  
  Index: XAConnectionManager.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosspool/src/main/org/jboss/pool/connector/XAConnectionManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XAConnectionManager.java  2001/08/16 03:05:45     1.2
  +++ XAConnectionManager.java  2001/08/17 05:37:35     1.3
  @@ -18,6 +18,8 @@
   import javax.transaction.xa.XAResource;
   import org.jboss.pool.ObjectPool;
   
  +import org.jboss.logging.log4j.JBossCategory;
  +
   /**
    * Manages connections using XAResources and JTA transactions.
    * There's no sharing - there's a one-to-one mapping of
  @@ -27,6 +29,8 @@
    */
   public class XAConnectionManager extends BaseConnectionManager implements 
Serializable {
   
  +    private JBossCategory log = 
(JBossCategory)JBossCategory.getInstance(BaseConnectionManager.class);
  +
       public XAConnectionManager() {
       }
   
  @@ -118,9 +122,9 @@
               } else if(listener instanceof XAListener) {
                   ManagedConnection con = listener.getManagedConnection();
                   XAResource res = con.getXAResource();
  -            System.out.println("==============================");
  -            System.out.println("Enlisting existing connection: xares: " + res);
  -            System.out.println("==============================");
  +                if (log.isTraceEnabled()) {
  +                    log.trace("Enlisting existing connection: xares: " + res);
  +                }
                   ((XAListener)listener).updateTransaction(trans, res);
               } else {
                   throw new ResourceException("Invalid connection "+connection+" for 
ConnectionManager "+this);
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to