You are viewing a plain text version of this content. The canonical link for it is here.
Posted to lokahi-commits@incubator.apache.org by to...@apache.org on 2006/07/19 16:05:21 UTC
svn commit: r423508 -
/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/core/agent/jmx/JMXTomcat.java
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;
}
+
+
+
}