geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r368137 - /geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/Client.java
Date Wed, 11 Jan 2006 21:45:08 GMT
Author: dblevins
Date: Wed Jan 11 13:45:05 2006
New Revision: 368137

URL: http://svn.apache.org/viewcvs?rev=368137&view=rev
Log:
Set queue prefetch to 1.   Fixes GBUILD-10

Modified:
    geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/Client.java

Modified: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/Client.java
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/Client.java?rev=368137&r1=368136&r2=368137&view=diff
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/Client.java
(original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/Client.java
Wed Jan 11 13:45:05 2006
@@ -18,6 +18,7 @@
 
 import org.codehaus.plexus.logging.Logger;
 import org.activemq.ActiveMQConnectionFactory;
+import org.activemq.ActiveMQPrefetchPolicy;
 
 import javax.jms.ExceptionListener;
 import javax.jms.Connection;
@@ -60,8 +61,7 @@
 
     public Client(String brokerUrl, ExceptionListener listener, Logger logger, int reconnectDelay,
int reconnectTries, int pingInterval) throws JMSException {
         this.brokerUrl = brokerUrl;
-        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brokerUrl);
-        connection = connectionFactory.createConnection();
+        connection = createConnection(brokerUrl);
         connection.setExceptionListener(this);
         connection.start();
         this.listener = listener;
@@ -138,8 +138,7 @@
     private Connection connect(int tries) throws JMSException {
 
         try {
-            ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brokerUrl);
-            Connection connection = connectionFactory.createConnection();
+            Connection connection = createConnection(brokerUrl);
             connection.setExceptionListener(this);
             connection.start();
             getLogger().info("Client reconnect successful.");
@@ -158,6 +157,13 @@
                 return connect(--tries);
             }
         }
+    }
+
+    private Connection createConnection(String brokerUrl) throws JMSException {
+        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brokerUrl);
+        ActiveMQPrefetchPolicy prefetchPolicy = connectionFactory.getPrefetchPolicy();
+        prefetchPolicy.setQueuePrefetch(1);
+        return connectionFactory.createConnection();
     }
 
     /**



Mime
View raw message