activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1376431 - in /activemq/trunk/activemq-ra/src: main/java/org/apache/activemq/ra/ActiveMQConnectionRequestInfo.java test/java/org/apache/activemq/ra/ActiveMQConnectionFactoryTest.java
Date Thu, 23 Aug 2012 10:50:37 GMT
Author: dejanb
Date: Thu Aug 23 10:50:36 2012
New Revision: 1376431

URL: http://svn.apache.org/viewvc?rev=1376431&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3986 - optimizeDurablePrefetch with RA adapter

Modified:
    activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionRequestInfo.java
    activemq/trunk/activemq-ra/src/test/java/org/apache/activemq/ra/ActiveMQConnectionFactoryTest.java

Modified: activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionRequestInfo.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionRequestInfo.java?rev=1376431&r1=1376430&r2=1376431&view=diff
==============================================================================
--- activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionRequestInfo.java
(original)
+++ activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQConnectionRequestInfo.java
Thu Aug 23 10:50:36 2012
@@ -279,6 +279,12 @@ public class ActiveMQConnectionRequestIn
         }
     }
 
+    public void setOptimizeDurableTopicPrefetch(Integer optimizeDurableTopicPrefetch) {
+        if (optimizeDurableTopicPrefetch != null) {
+            prefetchPolicy().setOptimizeDurableTopicPrefetch(optimizeDurableTopicPrefetch.intValue());
+        }
+    }
+
     public void setInputStreamPrefetch(Integer inputStreamPrefetch) {
         if (inputStreamPrefetch != null) {
             prefetchPolicy().setInputStreamPrefetch(inputStreamPrefetch.intValue());

Modified: activemq/trunk/activemq-ra/src/test/java/org/apache/activemq/ra/ActiveMQConnectionFactoryTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/test/java/org/apache/activemq/ra/ActiveMQConnectionFactoryTest.java?rev=1376431&r1=1376430&r2=1376431&view=diff
==============================================================================
--- activemq/trunk/activemq-ra/src/test/java/org/apache/activemq/ra/ActiveMQConnectionFactoryTest.java
(original)
+++ activemq/trunk/activemq-ra/src/test/java/org/apache/activemq/ra/ActiveMQConnectionFactoryTest.java
Thu Aug 23 10:50:36 2012
@@ -22,8 +22,12 @@ import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import javax.jms.Connection;
+import javax.jms.Session;
+import javax.jms.TopicSubscriber;
+
 import junit.framework.TestCase;
 import org.apache.activemq.ActiveMQConnection;
+import org.apache.activemq.ActiveMQTopicSubscriber;
 
 /**
  *
@@ -77,4 +81,20 @@ public class ActiveMQConnectionFactoryTe
         assertNotNull("Connection object returned by ActiveMQConnectionFactory.createConnection()
is null", con);
     }
 
+    public void testOptimizeDurablePrefetch() throws Exception {
+        ActiveMQConnectionRequestInfo info = new ActiveMQConnectionRequestInfo();
+        info.setServerUrl(url);
+        info.setUserName(user);
+        info.setPassword(pwd);
+        info.setOptimizeDurableTopicPrefetch(new Integer(500));
+        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(mcf, new ConnectionManagerAdapter(),
info);
+        Connection con = factory.createConnection("defaultUser", "defaultPassword");
+        con.setClientID("x");
+        Session sess = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        TopicSubscriber sub = sess.createDurableSubscriber(sess.createTopic("TEST"), "x");
+        con.start();
+
+        assertEquals(500, ((ActiveMQTopicSubscriber)sub).getPrefetchNumber());
+    }
+
 }



Mime
View raw message