geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r351639 - in /geronimo/gbuild/trunk: gbuild-agent-application/src/conf/ gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/ gbuild-agent/src/main/resources/META-INF/plexus/
Date Fri, 02 Dec 2005 09:05:24 GMT
Author: dblevins
Date: Fri Dec  2 01:05:19 2005
New Revision: 351639

URL: http://svn.apache.org/viewcvs?rev=351639&view=rev
Log:
Made ClientManager a plexus compoment.  Now one connection can be maintained and shared by
all agents.

Modified:
    geronimo/gbuild/trunk/gbuild-agent-application/src/conf/application.xml
    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/ClientManager.java
    geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/ContinuumBuildAgent.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
    geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml

Modified: geronimo/gbuild/trunk/gbuild-agent-application/src/conf/application.xml
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/gbuild-agent-application/src/conf/application.xml?rev=351639&r1=351638&r2=351639&view=diff
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent-application/src/conf/application.xml (original)
+++ geronimo/gbuild/trunk/gbuild-agent-application/src/conf/application.xml Fri Dec  2 01:05:19
2005
@@ -27,11 +27,25 @@
 
   <components>
     <component>
+      <role>org.apache.geronimo.gbuild.agent.ClientManager</role>
+      <implementation>org.apache.geronimo.gbuild.agent.ClientManager</implementation>
+      <configuration>
+        <broker-url>tcp://ci.gbuild.org:16161</broker-url>
+        <ping-interval>10000</ping-interval>
+        <reconnect-attempts>10</reconnect-attempts>
+        <reconnect-delay>600000</reconnect-delay>
+      </configuration>
+    </component>
+
+    <component>
       <role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
       <role-hint>build-executor</role-hint>
       <implementation>org.apache.geronimo.gbuild.agent.ContinuumBuildAgent</implementation>
       <requirements>
         <requirement>
+          <role>org.apache.geronimo.gbuild.agent.ClientManager</role>
+        </requirement>
+        <requirement>
           <role>org.apache.geronimo.gbuild.agent.BuildAgentExtentionManager</role>
         </requirement>
         <requirement>
@@ -44,7 +58,6 @@
       <configuration>
         <contributor>Unknown</contributor>
         <admin-address>scm@geronimo.apache.org</admin-address>
-        <coordinator-url>tcp://ci.gbuild.org:16161</coordinator-url>
         <build-task-queue>BUILD.TASKS</build-task-queue>
         <build-results-topic>BUILD.RESULTS</build-results-topic>
         <working-directory>${plexus.home}/agent/work</working-directory>
@@ -95,8 +108,12 @@
       <role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
       <role-hint>build-producer</role-hint>
       <implementation>org.apache.geronimo.gbuild.agent.PropertiesBuildTaskProducer</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.geronimo.gbuild.agent.ClientManager</role>
+        </requirement>
+      </requirements>
       <configuration>
-        <coordinator-url>tcp://ci.gbuild.org:16161</coordinator-url>
         <build-task-queue>BUILD.TASKS</build-task-queue>
         <include-prefix>include.</include-prefix>
         <header-prefix>header.</header-prefix>
@@ -114,11 +131,13 @@
       <implementation>org.apache.geronimo.gbuild.agent.BuildResultsContinuumAgent</implementation>
       <requirements>
         <requirement>
+          <role>org.apache.geronimo.gbuild.agent.ClientManager</role>
+        </requirement>
+        <requirement>
           <role>org.apache.geronimo.gbuild.agent.BuildResultsExtentionManager</role>
         </requirement>
       </requirements>
       <configuration>
-        <coordinator-url>tcp://ci.gbuild.org:16161</coordinator-url>
         <build-results-topic>BUILD.RESULTS</build-results-topic>
       </configuration>
     </component>
@@ -142,9 +161,11 @@
       <role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
       <role-hint>ping-monitor</role-hint>
       <implementation>org.apache.geronimo.gbuild.agent.PingMonitorAgent</implementation>
-      <configuration>
-        <coordinator-url>tcp://ci.gbuild.org:16161</coordinator-url>
-      </configuration>
+      <requirements>
+        <requirement>
+          <role>org.apache.geronimo.gbuild.agent.ClientManager</role>
+        </requirement>
+      </requirements>
     </component>
 
     <!--

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=351639&r1=351638&r2=351639&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 01:05:19 2005
@@ -35,20 +35,15 @@
  * @version $Rev$ $Date$
  */
 public abstract class AbstractContinuumBuildAgent extends AbstractContinuumAgentAction implements
BuildAgent, Startable {
-    /**
-     * @plexus.configuration
-     */
-    protected String coordinatorUrl;
 
     private boolean run;
 
+    /**
+     * @plexus.requirement
+     */
     private ClientManager clientManager;
 
     public synchronized void start() throws StartingException {
-        clientManager = new ClientManager(coordinatorUrl, 600000, 10, 10000);
-        clientManager.enableLogging(getLogger());
-        clientManager.start();
-
         run = true;
         Thread agentThread = new Thread(this);
         agentThread.setDaemon(false);
@@ -57,12 +52,6 @@
 
     public synchronized void stop() throws StoppingException {
         run = false;
-        try {
-            getClient().close();
-        } catch (JMSException e) {
-            getLogger().error("Could not close connection to: "+coordinatorUrl, e);
-            throw new StoppingException("Could not close connection to: "+coordinatorUrl);
-        }
     }
 
     public synchronized boolean isRunning() {

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=351639&r1=351638&r2=351639&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 01:05:19 2005
@@ -42,8 +42,7 @@
 
     public void run() {
         try {
-            getLogger().info("Results Agent starting. ("+coordinatorUrl+")");
-            getLogger().debug("coordinatorUrl " + coordinatorUrl);
+            getLogger().info("Results Agent starting.");
             getLogger().debug("buildResultsTopic " + buildResultsTopic);
 
             while (isRunning()) {

Modified: 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=351639&r1=351638&r2=351639&view=diff
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/ClientManager.java
(original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/ClientManager.java
Fri Dec  2 01:05:19 2005
@@ -19,6 +19,7 @@
 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 org.codehaus.plexus.personality.plexus.lifecycle.phase.Startable;
 
 import javax.jms.ExceptionListener;
 import javax.jms.JMSException;
@@ -26,7 +27,7 @@
 /**
  * @version $Rev$ $Date$
  */
-public class ClientManager extends AbstractLogEnabled implements ExceptionListener {
+public class ClientManager extends AbstractLogEnabled implements ExceptionListener, Startable
{
 
     /**
      * @plexus.configuration
@@ -50,6 +51,8 @@
 
     private Client client;
 
+    public ClientManager() {}
+
     public ClientManager(String brokerUrl, int pingInterval, int reconnectAttempts, int reconnectDelay)
{
         this.brokerUrl = brokerUrl;
         this.pingInterval = pingInterval;
@@ -57,6 +60,10 @@
         this.reconnectDelay = reconnectDelay;
     }
 
+    public String getBrokerUrl() {
+        return brokerUrl;
+    }
+
     public synchronized void start() throws StartingException {
         try {
             setClient(new Client(brokerUrl, this, getLogger(), reconnectDelay, reconnectAttempts,
pingInterval));
@@ -64,6 +71,7 @@
             getLogger().error("Could not create connection to: " + brokerUrl, e);
             throw new StartingException("Could not create connection to: " + brokerUrl);
         }
+        getLogger().info("Client connected: " + brokerUrl);
     }
 
     public synchronized void stop() throws StoppingException {
@@ -92,7 +100,7 @@
         return client;
     }
 
-    public synchronized void setClient(Client client) {
+    private synchronized void setClient(Client client) {
         this.client = client;
     }
 }

Modified: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/ContinuumBuildAgent.java
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/ContinuumBuildAgent.java?rev=351639&r1=351638&r2=351639&view=diff
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/ContinuumBuildAgent.java
(original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/ContinuumBuildAgent.java
Fri Dec  2 01:05:19 2005
@@ -85,8 +85,7 @@
 
     public void run() {
         try {
-            getLogger().info("Continuum Build Agent starting. (" + coordinatorUrl + ")");
-            getLogger().debug("coordinatorUrl " + coordinatorUrl);
+            getLogger().info("Continuum Build Agent starting.");
             getLogger().debug("buildTaskQueue " + buildTaskQueue);
             getLogger().debug("buildResultsTopic " + buildResultsTopic);
             getLogger().debug("workingDirectory " + workingDirectory);

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=351639&r1=351638&r2=351639&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 01:05:19 2005
@@ -35,8 +35,7 @@
 
     public void run() {
         try {
-            getLogger().info("Ping Agent starting. ("+coordinatorUrl+")");
-            getLogger().debug("coordinatorUrl " + coordinatorUrl);
+            getLogger().info("Ping Agent starting.");
 
             while (isRunning()){
                 Client client = getClient();

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=351639&r1=351638&r2=351639&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 01:05:19 2005
@@ -73,8 +73,7 @@
     private DirectoryMonitor scanner;
 
     public synchronized void start() throws StartingException {
-        getLogger().info("Task Producer Agent starting. ("+coordinatorUrl+")");
-        getLogger().debug("coordinatorUrl "+coordinatorUrl);
+        getLogger().info("Task Producer Agent starting.");
         getLogger().debug("buildTaskQueue "+buildTaskQueue);
 
         File dir = new File(watchDirectory);

Modified: geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml?rev=351639&r1=351638&r2=351639&view=diff
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml (original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml Fri
Dec  2 01:05:19 2005
@@ -12,11 +12,25 @@
     </component>
     -->
     <component>
+      <role>org.apache.geronimo.gbuild.agent.ClientManager</role>
+      <implementation>org.apache.geronimo.gbuild.agent.ClientManager</implementation>
+      <configuration>
+        <broker-url>tcp://localhost:61616</broker-url>
+        <ping-interval>10000</ping-interval>
+        <reconnect-attempts>10</reconnect-attempts>
+        <reconnect-delay>600000</reconnect-delay>
+      </configuration>
+    </component>
+
+    <component>
       <role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
       <role-hint>build-executor</role-hint>
       <implementation>org.apache.geronimo.gbuild.agent.ContinuumBuildAgent</implementation>
       <requirements>
         <requirement>
+          <role>org.apache.geronimo.gbuild.agent.ClientManager</role>
+        </requirement>
+        <requirement>
           <role>org.apache.geronimo.gbuild.agent.BuildAgentExtentionManager</role>
         </requirement>
         <requirement>
@@ -29,7 +43,6 @@
       <configuration>
         <contributor>Unknown</contributor>
         <admin-address>scm@geronimo.apache.org</admin-address>
-        <coordinator-url>tcp://localhost:61616</coordinator-url>
         <build-task-queue>BUILD.TASKS</build-task-queue>
         <build-results-topic>BUILD.RESULTS</build-results-topic>
         <working-directory>agent/work</working-directory>
@@ -111,8 +124,12 @@
       <role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
       <role-hint>build-producer</role-hint>
       <implementation>org.apache.geronimo.gbuild.agent.PropertiesBuildTaskProducer</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.geronimo.gbuild.agent.ClientManager</role>
+        </requirement>
+      </requirements>
       <configuration>
-        <coordinator-url>tcp://localhost:61616</coordinator-url>
         <build-task-queue>BUILD.TASKS</build-task-queue>
         <include-prefix>include.</include-prefix>
         <header-prefix>header.</header-prefix>
@@ -134,7 +151,6 @@
         </requirement>
       </requirements>
       <configuration>
-        <coordinator-url>tcp://localhost:61616</coordinator-url>
         <build-results-topic>BUILD.RESULTS</build-results-topic>
       </configuration>
     </component>
@@ -170,9 +186,11 @@
       <role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
       <role-hint>ping-monitor</role-hint>
       <implementation>org.apache.geronimo.gbuild.agent.PingMonitorAgent</implementation>
-      <configuration>
-        <coordinator-url>tcp://localhost:61616</coordinator-url>
-      </configuration>
+      <requirements>
+        <requirement>
+          <role>org.apache.geronimo.gbuild.agent.ClientManager</role>
+        </requirement>
+      </requirements>
     </component>
 
   </components>



Mime
View raw message