incubator-lokahi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tob...@apache.org
Subject svn commit: r423508 - /incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/jmx/JMXTomcat.java
Date Wed, 19 Jul 2006 16:05:21 GMT
Author: toback
Date: Wed Jul 19 09:05:21 2006
New Revision: 423508

URL: http://svn.apache.org/viewvc?rev=423508&view=rev
Log:
Fix so that even a started jvm has it's http port set correctly.

Modified:
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/jmx/JMXTomcat.java

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/jmx/JMXTomcat.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/jmx/JMXTomcat.java?rev=423508&r1=423507&r2=423508&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/jmx/JMXTomcat.java
(original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/jmx/JMXTomcat.java
Wed Jul 19 09:05:21 2006
@@ -32,9 +32,9 @@
 import javax.management.ReflectionException;
 import java.io.IOException;
 import java.sql.SQLException;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.ArrayList;
 
 /**
  * @author Stephen Toback
@@ -52,18 +52,18 @@
   private HashMap<String, String> env = new HashMap<String, String>();
 
   public void setEnvironment(String s) {
-    if (s!=null) {
-  	  try {
-    	while (!"".equals(s.trim())) {
-    		env.put(s.substring(0, s.indexOf('=')), s.substring(s.indexOf('=') + 1, s.indexOf(';')));
-    		s = s.substring(s.indexOf(';') + 1);
-    	}
-	  }
-	  catch(Exception e){
-		  if (logger.isInfoEnabled()) {
-		        logger.info("BAD Exception: " + e.getMessage());
-		  }
-	  }
+    if (s != null) {
+      try {
+        while (!"".equals(s.trim())) {
+          env.put(s.substring(0, s.indexOf('=')), s.substring(s.indexOf('=') + 1, s.indexOf(';')));
+          s = s.substring(s.indexOf(';') + 1);
+        }
+      }
+      catch (Exception e) {
+        if (logger.isInfoEnabled()) {
+          logger.info("BAD Exception: " + e.getMessage());
+        }
+      }
     }
   }
 
@@ -133,20 +133,20 @@
     buildVmName();
   }
 
-  public static JMXTomcat discover(int httpPort){
-      JMXTomcat t = null;
-      String name = "Agent" + (httpPort - 2);
-      ArrayList<JMXVirtualMachine> jmxvm = JMXConnect.getAllJMXVirtualMachines();
-      for (JMXVirtualMachine jvm : jmxvm) {
-        if (jvm instanceof JMXTomcat && name.equals(jvm.getVmName())) {
-          t = (JMXTomcat) jvm;
-        }
-      }
-      if (t == null) { // todo makesure that this is a jmxtomcat
-    	if (logger.isInfoEnabled()) logger.info("JMXtomcat is null. Creating new tomcat...");
-      	t = new JMXTomcat();
-      	t.setHttpPort(httpPort);
+  public static JMXTomcat discover(int httpPort) {
+    JMXTomcat t = null;
+    String name = "Agent" + (httpPort - 2);
+    ArrayList<JMXVirtualMachine> jmxvm = JMXConnect.getAllJMXVirtualMachines();
+    for (JMXVirtualMachine jvm : jmxvm) {
+      if (jvm instanceof JMXTomcat && name.equals(jvm.getVmName())) {
+        t = (JMXTomcat) jvm;
       }
+    }
+    if (t == null) { // todo makesure that this is a jmxtomcat
+      if (logger.isInfoEnabled()) logger.info("JMXtomcat is null. Creating new tomcat...");
+      t = new JMXTomcat();
+    }
+    t.setHttpPort(httpPort);
     return t;
   }
 
@@ -473,6 +473,9 @@
     result = 29 * result + (name != null ? name.hashCode() : 0);
     return result;
   }
+
+  
+
 }
 
 



Mime
View raw message