You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by db...@apache.org on 2005/12/02 09:20:16 UTC

svn commit: r351630 - in /geronimo/gbuild/trunk/gbuild-agent/src: main/java/org/apache/geronimo/gbuild/agent/ test/java/org/apache/geronimo/gbuild/agent/

Author: dblevins
Date: Fri Dec  2 00:20:11 2005
New Revision: 351630

URL: http://svn.apache.org/viewcvs?rev=351630&view=rev
Log:
Moved the AbstractContinuumBuildAgent.Client out as a top level class.  Wrapped it with a ClientManager that can be made a plexus compoment and shared by all agents.

Added:
    geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/Client.java
    geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/ClientManager.java
Removed:
    geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/MessagingClient.java
    geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/MessagingClientTest.java
Modified:
    geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/AbstractContinuumBuildAgent.java
    geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/BuildResultsContinuumAgent.java
    geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PingMonitorAgent.java
    geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PropertiesBuildTaskProducer.java

Modified: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/AbstractContinuumBuildAgent.java
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/AbstractContinuumBuildAgent.java?rev=351630&r1=351629&r2=351630&view=diff
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/AbstractContinuumBuildAgent.java (original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/AbstractContinuumBuildAgent.java Fri Dec  2 00:20:11 2005
@@ -19,11 +19,7 @@
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Startable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.StartingException;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.StoppingException;
-import org.codehaus.plexus.logging.Logger;
-import org.activemq.ActiveMQConnectionFactory;
 
-import javax.jms.ExceptionListener;
-import javax.jms.Connection;
 import javax.jms.JMSException;
 import javax.jms.MessageConsumer;
 import javax.jms.Session;
@@ -33,13 +29,12 @@
 import javax.jms.DeliveryMode;
 import javax.jms.ObjectMessage;
 import javax.jms.Message;
-import javax.jms.TextMessage;
 import java.util.Map;
 
 /**
  * @version $Rev$ $Date$
  */
-public abstract class AbstractContinuumBuildAgent extends AbstractContinuumAgentAction implements BuildAgent, ExceptionListener, Startable {
+public abstract class AbstractContinuumBuildAgent extends AbstractContinuumAgentAction implements BuildAgent, Startable {
     /**
      * @plexus.configuration
      */
@@ -47,18 +42,12 @@
 
     private boolean run;
 
-    private Connection connection;
-    private Client client;
-
+    private ClientManager clientManager;
 
     public synchronized void start() throws StartingException {
-        try {
-            setClient(new Client(coordinatorUrl, this, getLogger()));
-            connection = getClient().getConnection();
-        } catch (Throwable e) {
-            getLogger().error("Could not create connection to: "+coordinatorUrl, e);
-            throw new StartingException("Could not create connection to: "+coordinatorUrl);
-        }
+        clientManager = new ClientManager(coordinatorUrl, 600000, 10, 10000);
+        clientManager.enableLogging(getLogger());
+        clientManager.start();
 
         run = true;
         Thread agentThread = new Thread(this);
@@ -76,39 +65,11 @@
         }
     }
 
-    public void onException(JMSException ex) {
-        getLogger().fatalError("JMS Exception occured.  Attempting reconnect.", ex);
-        try {
-            reconnect();
-        } catch (JMSException e) {
-            getLogger().error("Reconnect failed.", e);
-        }
-//        setRun(false);
-    }
-
-    public synchronized void reconnect() throws JMSException {
-        this.client = client.reconnect();
-    }
-
     public synchronized boolean isRunning() {
         return run;
     }
 
-    protected Connection createConnection(String coordinatorUrl) throws JMSException {
-        // Create a ConnectionFactory
-        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(coordinatorUrl);
-
-        // Create a Connection
-        Connection connection = connectionFactory.createConnection();
-
-        connection.start();
-
-        connection.setExceptionListener(this);
-
-        return connection;
-    }
-
-    protected MessageConsumer createQueueConsumer(Session session, String subject) throws JMSException {
+    protected static MessageConsumer createQueueConsumer(Session session, String subject) throws JMSException {
         Queue queue = session.createQueue(subject);
 
         return session.createConsumer(queue);
@@ -129,7 +90,7 @@
         return session.createConsumer(topic);
     }
 
-    protected Map getMap(ObjectMessage objectMessage, Message message) throws JMSException, BuildAgentException {
+    public static Map getMap(ObjectMessage objectMessage, Message message) throws JMSException, BuildAgentException {
         try {
             return (Map) objectMessage.getObject();
         } catch (Exception e) {
@@ -141,209 +102,8 @@
         this.run = run;
     }
 
-    public synchronized Connection getConnection() throws JMSException {
-        return getClient().getConnection();
-    }
-
-    public synchronized Session getSession() throws JMSException {
-        return getClient().getSession();
-    }
-
     public synchronized Client getClient() {
-        return client;
-    }
-
-    public synchronized void setClient(Client client) {
-        this.client = client;
-    }
-
-    public static class Client implements ExceptionListener {
-        private final String brokerUrl;
-        private final Connection connection;
-        private final Session session;
-        private final ExceptionListener listener;
-        private final Logger logger;
-        private boolean connected = true;
-        private final Ping ping;
-
-        private Client(Client old, Connection connection, Session session, Ping ping) {
-            this.brokerUrl = old.brokerUrl;
-            this.connection = connection;
-            this.session = session;
-            this.listener = old.listener;
-            this.logger = old.logger;
-            this.ping = ping;
-        }
-
-        public Client(String brokerUrl, ExceptionListener listener, Logger logger) throws JMSException {
-            this.brokerUrl = brokerUrl;
-            ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brokerUrl);
-            connection = connectionFactory.createConnection();
-            connection.setExceptionListener(this);
-            connection.start();
-            this.listener = listener;
-            this.session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-            this.logger = logger;
-            this.ping = new Ping(session, logger);
-            ping.start();
-        }
-
-        public synchronized boolean isConnected() {
-            return connected;
-        }
-
-        private Logger getLogger() {
-            return logger;
-        }
-
-        public String getBrokerUrl() {
-            return brokerUrl;
-        }
-
-        public Connection getConnection() {
-            return connection;
-        }
-
-        public Session getSession() {
-            return session;
-        }
-
-        public MessageConsumer createQueueConsumer(String subject) throws JMSException {
-            Queue queue = session.createQueue(subject);
-            return session.createConsumer(queue);
-        }
-
-        public MessageConsumer createTopicConsumer(String subject) throws JMSException {
-            Topic topic = session.createTopic(subject);
-            return session.createConsumer(topic);
-        }
-
-        public MessageProducer createTopicProducer(String subject) throws JMSException {
-            Topic topic = session.createTopic(subject);
-            MessageProducer producer = session.createProducer(topic);
-            producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
-            return producer;
-        }
-
-        public synchronized Client reconnect() throws JMSException {
-            failed();
-
-            Connection connection = connect();
-
-            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-            Ping ping = new Ping(session, getLogger());
-            ping.start();
-
-            return new Client(this, connection, session, ping);
-        }
-
-        public synchronized void close() throws JMSException {
-            ping.stop();
-            session.close();
-            connection.close();
-        }
-
-        private Connection connect() throws JMSException {
-            return connect(10);
-        }
-
-        private Connection connect(int tries) throws JMSException {
-
-            try {
-                ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brokerUrl);
-                Connection connection = connectionFactory.createConnection();
-                connection.setExceptionListener(this);
-                connection.start();
-                getLogger().info("Client reconnect successful.");
-                return connection;
-            } catch (JMSException e) {
-                if (tries <= 0) {
-                    getLogger().info("Client reconnect failed.  Giving up.", e);
-                    throw e;
-                } else {
-                    try {
-                        int delay = 5000;
-                        getLogger().info("Client reconnect failed.  Trying again in "+delay+" milliseconds. ("+ e.getMessage()+")");
-                        Thread.sleep(delay);
-                    } catch (InterruptedException dontCare) {
-                    }
-                    return connect(--tries);
-                }
-            }
-        }
-
-        /**
-         * Marks this client as failed and returns its previous state
-         * @return false if the client was not previously in a failed state
-         */
-        private synchronized boolean failed() {
-            boolean failed = !connected;
-            connected = false;
-            return failed;
-        }
-
-        public void onException(JMSException jmsException) {
-            getLogger().info("JMSException "+this.hashCode());
-            this.listener.onException(jmsException);
-        }
+        return clientManager.getClient();
     }
 
-    public static class Ping implements Runnable {
-        private boolean run;
-        private final Session session;
-        private final MessageProducer producer;
-        private final Logger logger;
-        private int pingInterval = 1000*60*5; // five minutes
-
-        public Ping(Session session, Logger logger) throws JMSException {
-            this.session = session;
-            Topic topic = session.createTopic("BUILD.PING");
-            producer = session.createProducer(topic);
-            this.logger = logger;
-            run = true;
-        }
-
-        public Logger getLogger() {
-            return logger;
-        }
-
-        public void start() {
-            Thread thread = new Thread(this);
-            thread.setDaemon(true);
-            thread.start();
-        }
-
-        public void stop(){
-            setRun(false);
-        }
-
-        public synchronized boolean isRunning() {
-            return run;
-        }
-
-        public synchronized void setRun(boolean run) {
-            this.run = run;
-        }
-
-        public void run() {
-            while (isRunning()){
-                try {
-                    ping();
-                } catch (JMSException e) {
-                    getLogger().warn("Ping thread killed ("+e.getMessage()+")");
-                }
-                try {
-                    Thread.sleep(pingInterval);
-                } catch (InterruptedException e) {
-                }
-            }
-        }
-
-        private void ping() throws JMSException {
-            TextMessage message = session.createTextMessage(Long.toString(System.currentTimeMillis()));
-            producer.send(message);
-//            getLogger().debug("ping sent");
-        }
-    }
 }

Modified: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/BuildResultsContinuumAgent.java
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/BuildResultsContinuumAgent.java?rev=351630&r1=351629&r2=351630&view=diff
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/BuildResultsContinuumAgent.java (original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/BuildResultsContinuumAgent.java Fri Dec  2 00:20:11 2005
@@ -21,6 +21,7 @@
 import javax.jms.Message;
 import javax.jms.ObjectMessage;
 import javax.jms.JMSException;
+import javax.jms.Connection;
 import java.util.Map;
 
 /**
@@ -77,7 +78,11 @@
             } else if (message instanceof ObjectMessage) {
 
                 try {
-                    getLogger().info("Message Received "+ message.getJMSMessageID() +" on "+ getConnection().getClientID()+":"+buildResultsTopic);
+                    Connection result;
+                    synchronized ((AbstractContinuumBuildAgent)this) {
+                        result = getClient().getConnection();
+                    }
+                    getLogger().info("Message Received "+ message.getJMSMessageID() +" on "+ result.getClientID()+":"+buildResultsTopic);
 
                     ObjectMessage objectMessage = (ObjectMessage) message;
 

Added: 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=351630&view=auto
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/Client.java (added)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/Client.java Fri Dec  2 00:20:11 2005
@@ -0,0 +1,236 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.gbuild.agent;
+
+import org.codehaus.plexus.logging.Logger;
+import org.activemq.ActiveMQConnectionFactory;
+
+import javax.jms.ExceptionListener;
+import javax.jms.Connection;
+import javax.jms.Session;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.Queue;
+import javax.jms.Topic;
+import javax.jms.MessageProducer;
+import javax.jms.DeliveryMode;
+import javax.jms.TextMessage;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Client implements ExceptionListener {
+
+    private final String brokerUrl;
+    private final Connection connection;
+    private final Session session;
+    private final ExceptionListener listener;
+    private final Logger logger;
+    private boolean connected = true;
+    private final Ping ping;
+    private final int delay;
+    private final int maxTries;
+
+    private Client(Client old, Connection connection, Session session) throws JMSException {
+        this.brokerUrl = old.brokerUrl;
+        this.delay = old.delay;
+        this.maxTries = old.maxTries;
+        this.listener = old.listener;
+        this.logger = old.logger;
+        this.connection = connection;
+        this.session = session;
+
+        this.ping = new Ping(session, getLogger(), old.ping.getInterval());
+        ping.start();
+     }
+
+    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.setExceptionListener(this);
+        connection.start();
+        this.listener = listener;
+        this.session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        this.logger = logger;
+        this.delay = reconnectDelay;
+        this.maxTries = reconnectTries;
+        this.ping = new Ping(session, logger, pingInterval);
+        ping.start();
+    }
+
+    public synchronized boolean isConnected() {
+        return connected;
+    }
+
+    private Logger getLogger() {
+        return logger;
+    }
+
+    public String getBrokerUrl() {
+        return brokerUrl;
+    }
+
+    public Connection getConnection() {
+        return connection;
+    }
+
+    public Session getSession() {
+        return session;
+    }
+
+    public MessageConsumer createQueueConsumer(String subject) throws JMSException {
+        Queue queue = session.createQueue(subject);
+        return session.createConsumer(queue);
+    }
+
+    public MessageConsumer createTopicConsumer(String subject) throws JMSException {
+        Topic topic = session.createTopic(subject);
+        return session.createConsumer(topic);
+    }
+
+    public MessageProducer createTopicProducer(String subject) throws JMSException {
+        Topic topic = session.createTopic(subject);
+        MessageProducer producer = session.createProducer(topic);
+        producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+        return producer;
+    }
+
+    public synchronized Client reconnect() throws JMSException {
+        failed();
+
+        Connection connection = connect();
+
+        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+        return new Client(this, connection, session);
+    }
+
+    public synchronized void close() throws JMSException {
+        ping.stop();
+        session.close();
+        connection.close();
+    }
+
+    private Connection connect() throws JMSException {
+        return connect(10);
+    }
+
+    private Connection connect(int tries) throws JMSException {
+
+        try {
+            ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brokerUrl);
+            Connection connection = connectionFactory.createConnection();
+            connection.setExceptionListener(this);
+            connection.start();
+            getLogger().info("Client reconnect successful.");
+            return connection;
+        } catch (JMSException e) {
+            if (tries <= 0) {
+                getLogger().info("Client reconnect failed.  Giving up.", e);
+                throw e;
+            } else {
+                try {
+                    int delay = 5000;
+                    getLogger().info("Client reconnect failed.  Trying again in "+delay+" milliseconds. ("+ e.getMessage()+")");
+                    Thread.sleep(delay);
+                } catch (InterruptedException dontCare) {
+                }
+                return connect(--tries);
+            }
+        }
+    }
+
+    /**
+     * Marks this client as failed and returns its previous state
+     * @return false if the client was not previously in a failed state
+     */
+    private synchronized boolean failed() {
+        boolean failed = !connected;
+        connected = false;
+        return failed;
+    }
+
+    public void onException(JMSException jmsException) {
+        getLogger().info("JMSException "+this.hashCode());
+        this.listener.onException(jmsException);
+    }
+
+    public static class Ping implements Runnable {
+        private boolean run;
+        private final Session session;
+        private final MessageProducer producer;
+        private final Logger logger;
+        private final int interval;
+
+        public Ping(Session session, Logger logger, int interval) throws JMSException {
+            this.logger = logger;
+            this.run = true;
+            this.interval = interval;
+
+            this.session = session;
+            Topic topic = session.createTopic("BUILD.PING");
+            this.producer = session.createProducer(topic);
+        }
+
+        public int getInterval() {
+            return interval;
+        }
+
+        public Logger getLogger() {
+            return logger;
+        }
+
+        public void start() {
+            Thread thread = new Thread(this);
+            thread.setDaemon(true);
+            thread.start();
+        }
+
+        public void stop(){
+            setRun(false);
+        }
+
+        public synchronized boolean isRunning() {
+            return run;
+        }
+
+        public synchronized void setRun(boolean run) {
+            this.run = run;
+        }
+
+        public void run() {
+            while (isRunning()){
+                try {
+                    ping();
+                } catch (JMSException e) {
+                    getLogger().warn("Ping thread killed ("+e.getMessage()+")");
+                }
+                try {
+                    Thread.sleep(interval);
+                } catch (InterruptedException e) {
+                }
+            }
+        }
+
+        private void ping() throws JMSException {
+            TextMessage message = session.createTextMessage(Long.toString(System.currentTimeMillis()));
+            producer.send(message);
+        }
+    }
+
+}

Added: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/ClientManager.java
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/ClientManager.java?rev=351630&view=auto
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/ClientManager.java (added)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/ClientManager.java Fri Dec  2 00:20:11 2005
@@ -0,0 +1,98 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.gbuild.agent;
+
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.StartingException;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.StoppingException;
+
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ClientManager extends AbstractLogEnabled implements ExceptionListener {
+
+    /**
+     * @plexus.configuration
+     */
+    private String brokerUrl;
+
+    /**
+     * @plexus.configuration
+     */
+    private int pingInterval;
+
+    /**
+     * @plexus.configuration
+     */
+    private int reconnectAttempts;
+
+    /**
+     * @plexus.configuration
+     */
+    private int reconnectDelay;
+
+    private Client client;
+
+    public ClientManager(String brokerUrl, int pingInterval, int reconnectAttempts, int reconnectDelay) {
+        this.brokerUrl = brokerUrl;
+        this.pingInterval = pingInterval;
+        this.reconnectAttempts = reconnectAttempts;
+        this.reconnectDelay = reconnectDelay;
+    }
+
+    public synchronized void start() throws StartingException {
+        try {
+            setClient(new Client(brokerUrl, this, getLogger(), reconnectDelay, reconnectAttempts, pingInterval));
+        } catch (Throwable e) {
+            getLogger().error("Could not create connection to: " + brokerUrl, e);
+            throw new StartingException("Could not create connection to: " + brokerUrl);
+        }
+    }
+
+    public synchronized void stop() throws StoppingException {
+        try {
+            getClient().close();
+        } catch (JMSException e) {
+            getLogger().error("Could not close connection to: " + brokerUrl, e);
+            throw new StoppingException("Could not close connection to: " + brokerUrl);
+        }
+    }
+
+    public void onException(JMSException ex) {
+        getLogger().fatalError("JMS Exception occured.  Attempting reconnect.", ex);
+        try {
+            reconnect();
+        } catch (JMSException e) {
+            getLogger().error("Reconnect failed.", e);
+        }
+    }
+
+    private synchronized void reconnect() throws JMSException {
+        this.client = client.reconnect();
+    }
+
+    public synchronized Client getClient() {
+        return client;
+    }
+
+    public synchronized void setClient(Client client) {
+        this.client = client;
+    }
+}

Modified: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PingMonitorAgent.java
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PingMonitorAgent.java?rev=351630&r1=351629&r2=351630&view=diff
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PingMonitorAgent.java (original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PingMonitorAgent.java Fri Dec  2 00:20:11 2005
@@ -19,7 +19,6 @@
 import javax.jms.Session;
 import javax.jms.MessageConsumer;
 import javax.jms.Message;
-import javax.jms.ObjectMessage;
 import javax.jms.TextMessage;
 import javax.jms.JMSException;
 import java.util.Map;

Modified: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PropertiesBuildTaskProducer.java
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PropertiesBuildTaskProducer.java?rev=351630&r1=351629&r2=351630&view=diff
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PropertiesBuildTaskProducer.java (original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PropertiesBuildTaskProducer.java Fri Dec  2 00:20:11 2005
@@ -16,16 +16,13 @@
  */
 package org.apache.geronimo.gbuild.agent;
 
-import org.activemq.ActiveMQConnectionFactory;
 import org.apache.maven.continuum.execution.shell.ShellBuildExecutor;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.project.ContinuumProjectState;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Startable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.StartingException;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.StoppingException;
 
-import javax.jms.Connection;
 import javax.jms.DeliveryMode;
 import javax.jms.MessageProducer;
 import javax.jms.Queue;
@@ -126,7 +123,11 @@
 
     public void execute(Map def) throws Exception {
 
-        Session session = getSession();
+        Session result;
+        synchronized ((AbstractContinuumBuildAgent)this) {
+            result = getClient().getSession();
+        }
+        Session session = result;
 
         Queue buildQueue = session.createQueue(buildTaskQueue);