You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2009/05/06 13:03:33 UTC

svn commit: r772143 - in /cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms: JMSFactory.java continuations/JMSContinuation.java

Author: sergeyb
Date: Wed May  6 11:03:32 2009
New Revision: 772143

URL: http://svn.apache.org/viewvc?rev=772143&view=rev
Log:
CXF-2002 : applying a patch on behalf of Freeman

Modified:
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java?rev=772143&r1=772142&r2=772143&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java (original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java Wed May  6 11:03:32 2009
@@ -29,7 +29,6 @@
 import javax.naming.NamingException;
 
 import org.apache.cxf.common.logging.LogUtils;
-import org.springframework.core.task.SimpleAsyncTaskExecutor;
 import org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter;
 import org.springframework.jms.core.JmsTemplate;
 import org.springframework.jms.core.JmsTemplate102;
@@ -166,11 +165,8 @@
         }
         if (jmsConfig.getTaskExecutor() != null) {
             jmsListener.setTaskExecutor(jmsConfig.getTaskExecutor());
-        } else {
-            SimpleAsyncTaskExecutor taskExecutor = new SimpleAsyncTaskExecutor();
-            taskExecutor.setConcurrencyLimit(jmsConfig.getMaxConcurrentTasks());
-            jmsListener.setTaskExecutor(taskExecutor);
-        }
+        } 
+        
         if (jmsConfig.isAutoResolveDestination()) {
             jmsListener.setDestinationName(destinationName);
         } else {

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java?rev=772143&r1=772142&r2=772143&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java (original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java Wed May  6 11:03:32 2009
@@ -22,11 +22,9 @@
 import java.util.Collection;
 import java.util.Timer;
 import java.util.TimerTask;
-import java.util.logging.Logger;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
-import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.continuations.Continuation;
 import org.apache.cxf.continuations.SuspendedInvocationException;
 import org.apache.cxf.message.Message;
@@ -36,8 +34,7 @@
 
 public class JMSContinuation implements Continuation {
 
-    static final String BOGUS_MESSAGE_SELECTOR = "org.apache.cxf.transports.jms.continuations=too-many";
-    private static final Logger LOG = LogUtils.getL7dLogger(JMSContinuation.class);
+    static final String BOGUS_MESSAGE_SELECTOR = "orgApacheCxfTransportsJmsContinuations='too-many'";
     
     private Bus bus;
     private Message inMessage;
@@ -153,28 +150,24 @@
     
     protected void updateContinuations(boolean remove) {
 
-        modifyList(remove);
-        
         if (jmsConfig.getMaxSuspendedContinuations() < 0
             || jmsListener.getCacheLevel() >= DefaultMessageListenerContainer.CACHE_CONSUMER) {
+            modifyList(remove);
             return;
         }
         
         // throttle the flow if there're too many continuation instances in memory
-        if (remove && !BOGUS_MESSAGE_SELECTOR.equals(currentMessageSelector)) {
-            LOG.fine("A number of continuations has dropped below the limit of "
-                     + jmsConfig.getMaxSuspendedContinuations()
-                     + ", resetting JMS MessageSelector to " + currentMessageSelector);
-            jmsListener.setMessageSelector(currentMessageSelector);
-            currentMessageSelector = BOGUS_MESSAGE_SELECTOR;
-        } else if (!remove && continuations.size() >= jmsConfig.getMaxSuspendedContinuations()) {
-            currentMessageSelector = jmsListener.getMessageSelector();
-            if (!BOGUS_MESSAGE_SELECTOR.equals(currentMessageSelector)) {
-                LOG.fine("A number of continuations has reached the limit of "
-                         + jmsConfig.getMaxSuspendedContinuations()
-                         + ", setting JMS MessageSelector to " + BOGUS_MESSAGE_SELECTOR);
-                jmsListener.setMessageSelector(BOGUS_MESSAGE_SELECTOR);
-                
+        synchronized (continuations) {
+            modifyList(remove);
+            if (remove && !BOGUS_MESSAGE_SELECTOR.equals(currentMessageSelector)) {
+                jmsListener.setMessageSelector(currentMessageSelector);
+                currentMessageSelector = BOGUS_MESSAGE_SELECTOR;
+            } else if (!remove && continuations.size() >= jmsConfig.getMaxSuspendedContinuations()) {
+                currentMessageSelector = jmsListener.getMessageSelector();
+                if (!BOGUS_MESSAGE_SELECTOR.equals(currentMessageSelector)) {
+                    jmsListener.setMessageSelector(BOGUS_MESSAGE_SELECTOR);
+                    
+                }
             }
         }