activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r358785 - /incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/broker/region/PrefetchSubscription.java
Date Fri, 23 Dec 2005 09:48:00 GMT
Author: aco
Date: Fri Dec 23 01:47:47 2005
New Revision: 358785

URL: http://svn.apache.org/viewcvs?rev=358785&view=rev
Log:
Postpone incrementing of reference count and preload size, only after we are sure that the
message will be dispatched by the current subscription. This is to prevent a memory leak type
of scenario.

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/broker/region/PrefetchSubscription.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/broker/region/PrefetchSubscription.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/broker/region/PrefetchSubscription.java?rev=358785&r1=358784&r2=358785&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/broker/region/PrefetchSubscription.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/broker/region/PrefetchSubscription.java
Fri Dec 23 01:47:47 2005
@@ -239,19 +239,19 @@
 
     private void dispatch(final MessageReference node) throws IOException {
         
-        node.incrementReferenceCount();
-        
         final Message message = node.getMessage();
         if( message == null ) {
             return;
-        }
-        incrementPreloadSize(node.getMessage().getSize());        
+        }       
         
         // Make sure we can dispatch a message.
         if( canDispatch(node) ) {
 
             MessageDispatch md = createMessageDispatch(node, message);
             dispatched.addLast(node);
+            
+            node.incrementReferenceCount();
+            incrementPreloadSize(node.getMessage().getSize()); 
             
             if( info.isDispatchAsync() ) {
                 md.setConsumer(new Runnable(){



Mime
View raw message