geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r666809 - in /geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo: ./ server/
Date Wed, 11 Jun 2008 19:54:02 GMT
Author: gawor
Date: Wed Jun 11 12:54:01 2008
New Revision: 666809

URL: http://svn.apache.org/viewvc?rev=666809&view=rev
Log:
be a little better about closing jmx connections

Modified:
    geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/ServerProxy.java
    geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/RunClientMojo.java
    geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/StartServerMojo.java
    geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/StopServerMojo.java
    geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/WaitForServerMojo.java

Modified: geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/ServerProxy.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/ServerProxy.java?rev=666809&r1=666808&r2=666809&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/ServerProxy.java
(original)
+++ geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/ServerProxy.java
Wed Jun 11 12:54:01 2008
@@ -54,11 +54,13 @@
 
     private JMXServiceURL url;
 
+    private JMXConnector connector;
+    
     private Map environment;
 
     private MBeanServerConnection mbeanConnection;
 
-    private Throwable lastError;
+    private Throwable lastError;    
 
     public ServerProxy(final JMXServiceURL url, final Map environment) throws Exception {
         assert url != null;
@@ -90,8 +92,8 @@
         if (this.mbeanConnection == null) {
             log.debug("Connecting to: " + url);
             
-            JMXConnector connector = JMXConnectorFactory.connect(url, environment);
-            this.mbeanConnection = connector.getMBeanServerConnection();
+            this.connector = JMXConnectorFactory.connect(url, environment);
+            this.mbeanConnection = this.connector.getMBeanServerConnection();
             
             log.debug("Connected");
         }
@@ -99,6 +101,26 @@
         return mbeanConnection;
     }
 
+    public void closeConnection() {
+        if (this.connector != null) {
+            try {
+                this.connector.close();
+            } catch (IOException e) {
+                String msg = "Failed to close JMXConnector";
+                if (log.isTraceEnabled()) {
+                    log.trace(msg,e);
+                }
+                if (log.isDebugEnabled()) {
+                    log.debug(msg + ":" + e);
+                }
+            } finally {
+                this.connector = null;
+                this.mbeanConnection = null;
+                this.lastError = null;
+            }
+        }
+    }
+    
     public boolean isFullyStarted() {
         boolean fullyStarted = true;
 

Modified: geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/RunClientMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/RunClientMojo.java?rev=666809&r1=666808&r2=666809&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/RunClientMojo.java
(original)
+++ geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/RunClientMojo.java
Wed Jun 11 12:54:01 2008
@@ -82,6 +82,8 @@
 
         String geronimoHomeStr = server.getGeronimoHome();
 
+        server.closeConnection();
+        
         log.info("Geronimo Home: " + geronimoHomeStr);
 
         if (geronimoHomeStr == null) {

Modified: geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/StartServerMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/StartServerMojo.java?rev=666809&r1=666808&r2=666809&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/StartServerMojo.java
(original)
+++ geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/StartServerMojo.java
Wed Jun 11 12:54:01 2008
@@ -365,6 +365,7 @@
                 Thread.sleep(1000);
             }
         }
+        server.closeConnection();
 
         // Stop the timer, server should be up now
         timeoutTask.cancel();

Modified: geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/StopServerMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/StopServerMojo.java?rev=666809&r1=666808&r2=666809&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/StopServerMojo.java
(original)
+++ geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/StopServerMojo.java
Wed Jun 11 12:54:01 2008
@@ -62,6 +62,7 @@
             log.info("Stopping Geronimo server...");
             
             server.shutdown();
+            server.closeConnection();
 
             //
             // TODO: Verify its down?

Modified: geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/WaitForServerMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/WaitForServerMojo.java?rev=666809&r1=666808&r2=666809&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/WaitForServerMojo.java
(original)
+++ geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/server/WaitForServerMojo.java
Wed Jun 11 12:54:01 2008
@@ -87,6 +87,7 @@
                 Thread.sleep(1000);
             }
         }
+        server.closeConnection();
 
         // Stop the timer, server should be up now
         timeoutTask.cancel();



Mime
View raw message