activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r651300 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region: Queue.java TempQueue.java TempTopic.java Topic.java
Date Thu, 24 Apr 2008 16:02:26 GMT
Author: chirino
Date: Thu Apr 24 09:02:16 2008
New Revision: 651300

URL: http://svn.apache.org/viewvc?rev=651300&view=rev
Log:
Fix for http://issues.apache.org/activemq/browse/AMQ-1681
 - Avoid logging object leak when temp destination are created and destroyed.

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempQueue.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempTopic.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java?rev=651300&r1=651299&r2=651300&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
Thu Apr 24 09:02:16 2008
@@ -77,7 +77,7 @@
  * @version $Revision: 1.28 $
  */
 public class Queue extends BaseDestination implements Task {
-    protected final Log log;
+    protected static final Log LOG = LogFactory.getLog(Queue.class);
     protected TaskRunnerFactory taskFactory;
     protected TaskRunner taskRunner;    
     protected final List<Subscription> consumers = new ArrayList<Subscription>(50);
@@ -114,7 +114,6 @@
                  TaskRunnerFactory taskFactory) throws Exception {
         super(brokerService, store, destination, parentStats);
         this.taskFactory=taskFactory;       
-        this.log = LogFactory.getLog(getClass().getName() + "." + destination.getPhysicalName());
         this.dispatchSelector=new QueueDispatchSelector(destination);
     }
         
@@ -174,7 +173,7 @@
                                 try {
                                     messages.addMessageLast(message);
                                 } catch (Exception e) {
-                                    log.fatal("Failed to add message to cursor", e);
+                                    LOG.fatal("Failed to add message to cursor", e);
                                 }
                             }
                             destinationStatistics.getMessages().increment();
@@ -406,8 +405,8 @@
                 // The usage manager could have delayed us by the time
                 // we unblock the message could have expired..
                 if (message.isExpired()) {
-                    if (log.isDebugEnabled()) {
-                        log.debug("Expired message: " + message);
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Expired message: " + message);
                     }
                     broker.getRoot().messageExpired(context, message);
                     return;
@@ -622,7 +621,7 @@
         try {
             doPageIn(true);
         } catch (Exception e) {
-            log.error("caught an exception browsing " + this, e);
+            LOG.error("caught an exception browsing " + this, e);
         }
         synchronized (pagedInMessages) {
             for (QueueMessageReference node:pagedInMessages.values()){
@@ -633,7 +632,7 @@
                         l.add(m);
                     }
                 } catch (IOException e) {
-                    log.error("caught an exception browsing " + this, e);
+                    LOG.error("caught an exception browsing " + this, e);
                 } finally {
                     node.decrementReferenceCount();
                 }
@@ -655,7 +654,7 @@
                             r.decrementReferenceCount();
                         }
                     } catch (IOException e) {
-                        log.error("caught an exception brwsing " + this, e);
+                        LOG.error("caught an exception brwsing " + this, e);
                     }
                 }
             } finally {
@@ -686,7 +685,7 @@
                             break;
                         }
                     } catch (IOException e) {
-                        log.error("got an exception retrieving message " + messageId);
+                        LOG.error("got an exception retrieving message " + messageId);
                     }
                 }
             } finally {
@@ -957,7 +956,7 @@
 	               pageInMessages(false);
 	               
 	            } catch (Throwable e) {
-	                log.error("Failed to page in more queue messages ", e);
+	                LOG.error("Failed to page in more queue messages ", e);
 	            }
 	        }
 	        synchronized(messagesWaitingForSpace) {
@@ -1068,7 +1067,7 @@
             try {
                 taskRunner.wakeup();
             } catch (InterruptedException e) {
-                log.warn("Task Runner failed to wakeup ", e);
+                LOG.warn("Task Runner failed to wakeup ", e);
             }
         }
     }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempQueue.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempQueue.java?rev=651300&r1=651299&r2=651300&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempQueue.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempQueue.java
Thu Apr 24 09:02:16 2008
@@ -69,7 +69,7 @@
                                         .getConnectionId()))) {
 
             tempDest.setConnectionId(sub.getConsumerInfo().getConsumerId().getConnectionId());
-            log.debug(" changed ownership of " + this + " to "+ tempDest.getConnectionId());
+            LOG.debug(" changed ownership of " + this + " to "+ tempDest.getConnectionId());
         }
         super.addSubscription(context, sub);
     } 
@@ -84,14 +84,14 @@
                pageInMessages(false);
                
             } catch (Throwable e) {
-                log.error("Failed to page in more queue messages ", e);
+                LOG.error("Failed to page in more queue messages ", e);
             }
         }
         if (!messagesWaitingForSpace.isEmpty() || !isRecoveryDispatchEmpty()) {
             try {
                 taskRunner.wakeup();
             } catch (InterruptedException e) {
-                log.warn("Task Runner failed to wakeup ", e);
+                LOG.warn("Task Runner failed to wakeup ", e);
             }
         }
     }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempTopic.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempTopic.java?rev=651300&r1=651299&r2=651300&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempTopic.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TempTopic.java
Thu Apr 24 09:02:16 2008
@@ -61,7 +61,7 @@
                                         .getConnectionId()))) {
 
             tempDest.setConnectionId(sub.getConsumerInfo().getConsumerId().getConnectionId());
-            log.debug(" changed ownership of " + this + " to "+ tempDest.getConnectionId());
+            LOG.debug(" changed ownership of " + this + " to "+ tempDest.getConnectionId());
         }
         super.addSubscription(context, sub);
     } 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java?rev=651300&r1=651299&r2=651300&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java
Thu Apr 24 09:02:16 2008
@@ -65,7 +65,7 @@
  * @version $Revision: 1.21 $
  */
 public class Topic  extends BaseDestination  implements Task{
-    protected final Log log;
+    protected static final Log LOG = LogFactory.getLog(Topic.class);
     private final TopicMessageStore topicStore;
     protected final CopyOnWriteArrayList<Subscription> consumers = new CopyOnWriteArrayList<Subscription>();
     protected final Valve dispatchValve = new Valve(true);   
@@ -90,7 +90,6 @@
                  TaskRunnerFactory taskFactory) throws Exception {
         super(brokerService, store, destination, parentStats);
         this.topicStore=store;
-        this.log = LogFactory.getLog(getClass().getName() + "." + destination.getPhysicalName());
         //set default subscription recovery policy
         if (destination.isTemporary() || AdvisorySupport.isAdvisoryTopic(destination) ){
         	 subscriptionRecoveryPolicy= new NoSubscriptionRecoveryPolicy();
@@ -346,15 +345,15 @@
                     if (count > 2 && context.isInTransaction()) {
                         count =0;
                         int size = context.getTransaction().size();
-                        log.warn("Waiting for space to send  transacted message - transaction
elements = " + size + " need more space to commit. Message = " + message);
+                        LOG.warn("Waiting for space to send  transacted message - transaction
elements = " + size + " need more space to commit. Message = " + message);
                     }
                 }
 
                 // The usage manager could have delayed us by the time
                 // we unblock the message could have expired..
                 if (message.isExpired()) {
-                    if (log.isDebugEnabled()) {
-                        log.debug("Expired message: " + message);
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Expired message: " + message);
                     }
                     return;
                 }
@@ -501,7 +500,7 @@
                 }
             }
         } catch (Throwable e) {
-            log.warn("Failed to browse Topic: " + getActiveMQDestination().getPhysicalName(),
e);
+            LOG.warn("Failed to browse Topic: " + getActiveMQDestination().getPhysicalName(),
e);
         }
         return result.toArray(new Message[result.size()]);
     }



Mime
View raw message