User: ejort   
  Date: 02/01/05 04:08:53

  Modified:    src/main/org/jboss/jms ConnectionFactoryHelper.java
  Log:
  Guarded debug logging
  
  Revision  Changes    Path
  1.5       +20 -12    jboss/src/main/org/jboss/jms/ConnectionFactoryHelper.java
  
  Index: ConnectionFactoryHelper.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/jms/ConnectionFactoryHelper.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ConnectionFactoryHelper.java      2001/08/06 22:55:00     1.4
  +++ ConnectionFactoryHelper.java      2002/01/05 12:08:53     1.5
  @@ -21,7 +21,7 @@
    * A helper for creating connections from jms connection factories.
    *      
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public class ConnectionFactoryHelper
   {
  @@ -51,7 +51,9 @@
         if (factory == null)
            throw new IllegalArgumentException("factory is null");
   
  -      if (log.isDebugEnabled()) {
  +      boolean debug = log.isDebugEnabled();
  +      if (debug)
  +      {
            log.debug("using connection factory: " + factory);
            log.debug("using username/password: " +
                      String.valueOf(username) + "/" +
  @@ -59,7 +61,7 @@
         }
   
         QueueConnection connection;
  -      
  +
         if (factory instanceof XAQueueConnectionFactory) {
            XAQueueConnectionFactory qFactory = (XAQueueConnectionFactory)factory;
            if (username != null) {
  @@ -68,7 +70,8 @@
            else {
               connection = qFactory.createXAQueueConnection();
            }
  -         log.debug("created XAQueueConnection: " + connection);
  +         if (debug)
  +            log.debug("created XAQueueConnection: " + connection);
         }
         else if (factory instanceof QueueConnectionFactory) {
            QueueConnectionFactory qFactory = (QueueConnectionFactory)factory;
  @@ -78,12 +81,13 @@
            else {
               connection = qFactory.createQueueConnection();
            }
  -         log.debug("created QueueConnection: " + connection);
  +         if (debug)
  +            log.debug("created QueueConnection: " + connection);
         }
         else {
            throw new IllegalArgumentException("factory is invalid");
         }
  -      
  +
         return connection;
      }
   
  @@ -94,7 +98,7 @@
       * @param factory     An object that implements QueueConnectionFactory,
       *                    XAQueueConnectionFactory
       * @return            A queue connection.
  -    *                    
  +    *
       * @throws JMSException                Failed to create connection.
       * @throws IllegalArgumentException    Factory is null or invalid.
       */
  @@ -103,7 +107,7 @@
      {
         return createQueueConnection(factory, null, null);
      }
  -   
  +
      /**
       * Create a topic connection from the given factory.  An XA connection will
       * be created if possible.
  @@ -126,7 +130,9 @@
         if (factory == null)
            throw new IllegalArgumentException("factory is null");
   
  -      if (log.isDebugEnabled()) {
  +      boolean debug = log.isDebugEnabled();
  +      if (debug)
  +      {
            log.debug("using connection factory: " + factory);
            log.debug("using username/password: " +
                      String.valueOf(username) + "/" +
  @@ -134,7 +140,7 @@
         }
   
         TopicConnection connection;
  -      
  +
         if (factory instanceof XATopicConnectionFactory) {
            XATopicConnectionFactory tFactory = (XATopicConnectionFactory)factory;
            if (username != null) {
  @@ -143,7 +149,8 @@
            else {
               connection = tFactory.createXATopicConnection();
            }
  -         log.debug("created XATopicConnection: " + connection);
  +         if (debug)
  +            log.debug("created XATopicConnection: " + connection);
         }
         else if (factory instanceof TopicConnectionFactory) {
            TopicConnectionFactory tFactory = (TopicConnectionFactory)factory;
  @@ -153,7 +160,8 @@
            else {
               connection = tFactory.createTopicConnection();
            }
  -         log.debug("created TopicConnection: " + connection);
  +         if (debug)
  +            log.debug("created TopicConnection: " + connection);
         }
         else {
            throw new IllegalArgumentException("factory is invalid");
  
  
  

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

Reply via email to