diff --git a/lib/libthrift-0.8.0.wolog.jar b/lib/libthrift-0.8.0.wolog.jar
new file mode 100644
index 000000000..ff368b971
Binary files /dev/null and b/lib/libthrift-0.8.0.wolog.jar differ
diff --git a/makejar.sh b/makejar.sh
index 80c826f1d..6579dd3c1 100644
--- a/makejar.sh
+++ b/makejar.sh
@@ -1,4 +1,8 @@
-cd bin/
-jar cvfM ../HippoAgent.jar ../src/META-INF/MANIFEST.MF ./*
-cd ..
-cp ./HippoAgent.jar /work/003_Hippo/091_Lib/
+mvn clean package
+cd ./target/classes
+jar cvfM HippoAgent.jar ./src/META-INF/MANIFEST.MF ./*
+cp ./HippoAgent.jar ../../
+cd ../../
+ls -al HippoAgent.jar
+
+
diff --git a/pom.xml b/pom.xml
index 80cb4acdc..ffb726582 100644
--- a/pom.xml
+++ b/pom.xml
@@ -128,6 +128,19 @@
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.4
+
+
+
+ src/main/resources/META-INF/MANIFEST.MF
+
+
+
+
+
org.apache.maven.plugins
maven-dependency-plugin
diff --git a/hippo.config b/runscript/hippo.config
similarity index 81%
rename from hippo.config
rename to runscript/hippo.config
index 93a4a0188..36155e35f 100644
--- a/hippo.config
+++ b/runscript/hippo.config
@@ -4,10 +4,8 @@ SERVER_TCP_LISTEN_PORT= 9991
REQUEST_TRANSACTION_DATA_LISTEN_PORT= 9995
REQUEST_DATA_LISTEN_PORT= 9996
JVM_DATA_LISTEN_PORT= 9997
-
-#TOMCAT_LIB_PATH=/home1/irteam/apps/tomcat
-
JVM_STAT_GAP=5000
SERVER_CONNECT_RETRY_GAP=1000
QUERY_COUNT_OVER_10000=false
-JDBC_PROFILE=true
\ No newline at end of file
+JDBC_PROFILE=true
+LOG_LEVEL=DEBUG
\ No newline at end of file
diff --git a/runscript/hippo.env.sh b/runscript/hippo.env.sh
new file mode 100644
index 000000000..a0d1db567
--- /dev/null
+++ b/runscript/hippo.env.sh
@@ -0,0 +1,9 @@
+#
+# release
+#
+
+export HIPPO_AGENT_HOME="/home1/irteam/apps/hippo/agent"
+
+JAVA_OPTS="$JAVA_OPTS -javaagent:$HIPPO_AGENT_HOME/HippoAgent.jar -Dhippo.config=$HIPPO_AGENT_HOME/hippo.config "
+
+CLASSPATH="$HIPPO_AGENT_HOME/lib/javassist.jar:$HIPPO_AGENT_HOME/lib/libthrift-0.8.0.wolog.jar"
\ No newline at end of file
diff --git a/runscript/hippo.local.env.sh b/runscript/hippo.local.env.sh
new file mode 100755
index 000000000..1b17c0c5c
--- /dev/null
+++ b/runscript/hippo.local.env.sh
@@ -0,0 +1,9 @@
+#
+# local test
+#
+
+export HIPPO_AGENT_HOME="/Users/netspider/Documents/workspace_hippo/hippo-testbed/agent"
+
+JAVA_OPTS="$JAVA_OPTS -javaagent:$HIPPO_AGENT_HOME/hippo-tomcat-profiler-0.0.1.jar -Dhippo.config=$HIPPO_AGENT_HOME/hippo.config "
+
+CLASSPATH="$HIPPO_AGENT_HOME/lib/javassist.jar:$HIPPO_AGENT_HOME/lib/libthrift-0.8.0.wolog.jar"
\ No newline at end of file
diff --git a/src/main/java/com/profiler/Logger.java b/src/main/java/com/profiler/Logger.java
new file mode 100644
index 000000000..ed5e51976
--- /dev/null
+++ b/src/main/java/com/profiler/Logger.java
@@ -0,0 +1,78 @@
+package com.profiler;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import com.profiler.config.TomcatProfilerConfig;
+
+public abstract class Logger {
+
+ protected final String name;
+
+ protected final DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+
+ public Logger(String name) {
+ this.name = name;
+ }
+
+ public enum LogLevel {
+ INFO(0), DEBUG(1), WARN(2), ERROR(3), FATAL(4);
+
+ private int priority;
+
+ LogLevel(int priority) {
+ this.priority = priority;
+ }
+ }
+
+ public static Logger getLogger(Class> clazz) {
+ return new Logger(clazz.getName()) {
+ @Override
+ public void info(String message, Object... args) {
+ if (TomcatProfilerConfig.LOG_LEVEL.priority >= LogLevel.INFO.priority) {
+ System.out.printf("[HIPPO] %s [INFO] [%s] %s \n", df.format(new Date()), name, String.format(message, args));
+ }
+ }
+
+ @Override
+ public void debug(String message, Object... args) {
+ if (TomcatProfilerConfig.LOG_LEVEL.priority >= LogLevel.DEBUG.priority) {
+ System.out.printf("[HIPPO] %s [DEBUG] [%s] %s \n", df.format(new Date()), name, String.format(message, args));
+ }
+ }
+
+ @Override
+ public void warn(String message, Object... args) {
+ if (TomcatProfilerConfig.LOG_LEVEL.priority >= LogLevel.WARN.priority) {
+ System.out.printf("[HIPPO] %s [WARN] [%s] %s \n", df.format(new Date()), name, String.format(message, args));
+ }
+ }
+
+ @Override
+ public void error(String message, Object... args) {
+ if (TomcatProfilerConfig.LOG_LEVEL.priority >= LogLevel.ERROR.priority) {
+ System.out.printf("[HIPPO] %s [ERROR] [%s] %s \n", df.format(new Date()), name, String.format(message, args));
+ }
+ }
+
+ @Override
+ public void fatal(String message, Object... args) {
+ if (TomcatProfilerConfig.LOG_LEVEL.priority >= LogLevel.FATAL.priority) {
+ System.out.printf("[HIPPO] %s [FATAL] [%s] %s \n", df.format(new Date()), name, String.format(message, args));
+ }
+ }
+ };
+ }
+
+ public abstract void info(String message, Object... args);
+
+ public abstract void debug(String message, Object... args);
+
+ public abstract void warn(String message, Object... args);
+
+ public abstract void error(String message, Object... args);
+
+ public abstract void fatal(String message, Object... args);
+
+}
diff --git a/src/main/java/com/profiler/TomcatProfiler.java b/src/main/java/com/profiler/TomcatProfiler.java
index 0abd64150..45fff63c6 100644
--- a/src/main/java/com/profiler/TomcatProfiler.java
+++ b/src/main/java/com/profiler/TomcatProfiler.java
@@ -1,7 +1,5 @@
package com.profiler;
-import static com.profiler.config.TomcatProfilerConfig.TOMCAT_LIB_PATH;
-
import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.IllegalClassFormatException;
import java.lang.instrument.Instrumentation;
@@ -33,10 +31,15 @@ import com.profiler.modifier.db.oracle.OracleStatementModifier;
import com.profiler.modifier.tomcat.EntryPointStandardHostValveModifier;
import com.profiler.modifier.tomcat.TomcatConnectorModifier;
import com.profiler.modifier.tomcat.TomcatStandardServiceModifier;
+
public class TomcatProfiler implements ClassFileTransformer {
+
+ private static final Logger logger = Logger.getLogger(TomcatProfiler.class);
+
protected String agentArgString = "";
protected Instrumentation instrumentation;
- ClassPool classPool ;
+ ClassPool classPool;
+
public static void premain(String agentArgs, Instrumentation inst) {
new TomcatProfiler(agentArgs, inst);
}
@@ -45,179 +48,194 @@ public class TomcatProfiler implements ClassFileTransformer {
agentArgString = agentArgs;
instrumentation = inst;
instrumentation.addTransformer(this);
- classPool= ClassPool.getDefault();
+ classPool = ClassPool.getDefault();
try {
- classPool.appendClassPath(TOMCAT_LIB_PATH+"/lib/servlet-api.jar");
- classPool.appendClassPath(TOMCAT_LIB_PATH+"/lib/catalina.jar");
+ String catalinaHome = System.getProperty("catalina.home");
+ logger.info("CATALINA_HOME=%s", catalinaHome);
+
+ logger.info("TEST");
+
+ classPool.appendClassPath(catalinaHome + "/lib/servlet-api.jar");
+ classPool.appendClassPath(catalinaHome + "/lib/catalina.jar");
+ } catch (Exception e) {
+ logger.error(e.getMessage());
+ }
+ }
+
+ @Override
+ public byte[] transform(ClassLoader classLoader, String className, Class> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classFileBuffer) throws IllegalClassFormatException {
+ if (className.startsWith("org/apache/catalina")) {
+ String javassistClassName = className.replace('/', '.');
+ if (javassistClassName.equals("org.apache.catalina.core.StandardHostValve")) {
+ // Add code to monitor Request and Response
+ byte[] result = EntryPointStandardHostValveModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ } else if (javassistClassName.equals("org.apache.catalina.core.StandardService")) {
+ // Add code to monitor Tomcat start and stop
+ byte[] result = TomcatStandardServiceModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ } else if (javassistClassName.equals("org.apache.catalina.connector.Connector")) {
+ // Add code to set Tomcat's port numbers
+ byte[] result = TomcatConnectorModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ }
+ }
+ // #### If JDBC_PROFILE is true, SQL data will be collected
+ if (TomcatProfilerConfig.JDBC_PROFILE) {
+ if (className.startsWith("com/mysql/jdbc")) {
+ // MySQL !!!!!!!!!!
+ String javassistClassName = className.replace('/', '.');
+ if (javassistClassName.equals("com.mysql.jdbc.ConnectionImpl")) {
+ checkLibrary(javassistClassName, classLoader);
+ byte[] result = MySQLConnectionImplModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ } else if (javassistClassName.equals("com.mysql.jdbc.StatementImpl")) {
+ checkLibrary(javassistClassName, classLoader);
+ byte[] result = MySQLStatementModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ } else if (javassistClassName.equals("com.mysql.jdbc.PreparedStatement")) {
+ checkLibrary(javassistClassName, classLoader);
+ byte[] result = MySQLPreparedStatementModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ } else if (javassistClassName.equals("com.mysql.jdbc.ResultSetImpl")) {
+ checkLibrary(javassistClassName, classLoader);
+ byte[] result = MySQLResultSetModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ }
+
+ } else if (className.startsWith("net/sourceforge/jtds/jdbc")) {
+ // MSSQL !!!!!!!!!!
+ String javassistClassName = className.replace('/', '.');
+ if (javassistClassName.equals("net.sourceforge.jtds.jdbc.ConnectionJDBC2")) {
+ checkLibrary(javassistClassName, classLoader);
+ byte[] result = MSSQLConnectionModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ } else if (javassistClassName.equals("net.sourceforge.jtds.jdbc.JtdsStatement")) {
+ checkLibrary(javassistClassName, classLoader);
+ byte[] result = MSSQLStatementModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ } else if (javassistClassName.equals("net.sourceforge.jtds.jdbc.JtdsPreparedStatement")) {
+ checkLibrary(javassistClassName, classLoader);
+ byte[] result = MSSQLPreparedStatementModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ } else if (javassistClassName.equals("net.sourceforge.jtds.jdbc.JtdsResultSet")) {
+ checkLibrary(javassistClassName, classLoader);
+ byte[] result = MSSQLResultSetModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ }
+ } else if (className.startsWith("org/apache/commons/dbcp")) {
+ // DBCP !!!!!!!!!!
+ String javassistClassName = className.replace('/', '.');
+ if (javassistClassName.equals("org.apache.commons.dbcp.BasicDataSource")) {
+ checkLibrary(javassistClassName, classLoader);
+ byte[] result = DBCPBasicDataSourceModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ } else if (javassistClassName.equals("org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper")) {
+ checkLibrary(javassistClassName, classLoader);
+ byte[] result = DBCPPoolModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ }
+ } else if (className.startsWith("cubrid/jdbc")) {
+ // CUBRID !!!!!!!!!!
+ String javassistClassName = className.replace('/', '.');
+ /*
+ * if(!javassistClassName.equals(
+ * "cubrid.jdbc.driver.CUBRIDResultSet") &&
+ * !javassistClassName.startsWith
+ * ("cubrid.jdbc.driver.ConnectionProperties")) { byte[]
+ * result=AbstractModifier.addBeforeAfterLogics(classPool,
+ * javassistClassName); if(result!=null) return result; }
+ */
+
+ if (javassistClassName.equals("cubrid.jdbc.driver.CUBRIDStatement")) {
+ checkLibrary(javassistClassName, classLoader);
+ byte[] result = CubridStatementModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ } else if (javassistClassName.equals("cubrid.jdbc.driver.CUBRIDPreparedStatement")) {
+ checkLibrary(javassistClassName, classLoader);
+ byte[] result = CubridPreparedStatementModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ } else if (javassistClassName.equals("cubrid.jdbc.driver.CUBRIDResultSet")) {
+ checkLibrary(javassistClassName, classLoader);
+ byte[] result = CubridResultSetModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ } else if (javassistClassName.equals("cubrid.jdbc.jci.UStatement")) {
+ checkLibrary(javassistClassName, classLoader);
+ byte[] result = CubridUStatementModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ }
+ } else if (className.startsWith("oracle/jdbc")) {
+ String javassistClassName = className.replace('/', '.');
+ if (javassistClassName.equals("oracle.jdbc.driver.OraclePreparedStatement")) {
+ checkLibrary(javassistClassName, classLoader);
+ byte[] result = OraclePreparedStatementModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ } else if (javassistClassName.equals("oracle.jdbc.driver.OracleStatement")) {
+ checkLibrary(javassistClassName, classLoader);
+ byte[] result = OracleStatementModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ } else if (javassistClassName.equals("oracle.jdbc.driver.OracleResultSetImpl")) {
+ checkLibrary(javassistClassName, classLoader);
+ byte[] result = OracleResultSetModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
+ if (result != null)
+ return result;
+ }
+ }
+ }
+ // else if(className.startsWith("java/sql")) {
+ // String javassistClassName = className.replace('/', '.');
+ // System.out.println("***** Changing "+javassistClassName);
+ // byte[] result=AbstractModifier.addBeforeAfterLogics(classPool,
+ // javassistClassName);
+ // if(result!=null) return result;
+ // }
+
+ return null;
+ }
+
+ private void checkLibrary(String javassistClassName, ClassLoader classLoader) {
+ try {
+ classPool.get(javassistClassName);
+ } catch (NotFoundException nfe) {
+ // cnfe.printStackTrace();
+ loadClassLoaderLibraries(classLoader);
} catch (Exception e) {
e.printStackTrace();
}
}
- private void debug(String className) {
-// System.out.println(className);
-// if(className.startsWith("java/sql")) {
-// System.out.println(className);
-// }
-// System.out.print(".");
- }
- @Override
- public byte[] transform(ClassLoader classLoader, String className,
- Class> classBeingRedefined, ProtectionDomain protectionDomain,
- byte[] classFileBuffer) throws IllegalClassFormatException {
- debug(className);
- if(className.startsWith("org/apache/catalina")) {
- String javassistClassName = className.replace('/', '.');
- if(javassistClassName.equals("org.apache.catalina.core.StandardHostValve")) {
- //Add code to monitor Request and Response
- byte[] result=EntryPointStandardHostValveModifier.modify(classPool,classLoader,javassistClassName,classFileBuffer);
- if(result!=null) return result;
- } else if(javassistClassName.equals("org.apache.catalina.core.StandardService")) {
- //Add code to monitor Tomcat start and stop
- byte[] result=TomcatStandardServiceModifier.modify(classPool,classLoader,javassistClassName,classFileBuffer);
- if(result!=null) return result;
- } else if(javassistClassName.equals("org.apache.catalina.connector.Connector")) {
- //Add code to set Tomcat's port numbers
- byte[] result=TomcatConnectorModifier.modify(classPool,classLoader,javassistClassName,classFileBuffer);
- if(result!=null) return result;
- }
- }
- //#### If JDBC_PROFILE is true, SQL data will be collected
- if(TomcatProfilerConfig.JDBC_PROFILE) {
- if(className.startsWith("com/mysql/jdbc")) {
- // MySQL !!!!!!!!!!
- String javassistClassName = className.replace('/', '.');
- if(javassistClassName.equals("com.mysql.jdbc.ConnectionImpl")) {
- checkLibrary(javassistClassName,classLoader);
- byte[] result=MySQLConnectionImplModifier.modify(classPool,classLoader,javassistClassName,classFileBuffer);
- if(result!=null) return result;
- } else if(javassistClassName.equals("com.mysql.jdbc.StatementImpl")) {
- checkLibrary(javassistClassName,classLoader);
- byte[] result=MySQLStatementModifier.modify(classPool,classLoader,javassistClassName,classFileBuffer);
- if(result!=null) return result;
- } else if(javassistClassName.equals("com.mysql.jdbc.PreparedStatement")) {
- checkLibrary(javassistClassName,classLoader);
- byte[] result=MySQLPreparedStatementModifier.modify(classPool,classLoader,javassistClassName,classFileBuffer);
- if(result!=null) return result;
- } else if(javassistClassName.equals("com.mysql.jdbc.ResultSetImpl")) {
- checkLibrary(javassistClassName,classLoader);
- byte[] result=MySQLResultSetModifier.modify(classPool,classLoader,javassistClassName,classFileBuffer);
- if(result!=null) return result;
- }
-
- } else if(className.startsWith("net/sourceforge/jtds/jdbc")) {
- // MSSQL !!!!!!!!!!
- String javassistClassName = className.replace('/', '.');
- if(javassistClassName.equals("net.sourceforge.jtds.jdbc.ConnectionJDBC2")) {
- checkLibrary(javassistClassName,classLoader);
- byte[] result=MSSQLConnectionModifier.modify(classPool,classLoader,javassistClassName,classFileBuffer);
- if(result!=null) return result;
- } else if(javassistClassName.equals("net.sourceforge.jtds.jdbc.JtdsStatement")) {
- checkLibrary(javassistClassName,classLoader);
- byte[] result=MSSQLStatementModifier.modify(classPool,classLoader,javassistClassName,classFileBuffer);
- if(result!=null) return result;
- } else if(javassistClassName.equals("net.sourceforge.jtds.jdbc.JtdsPreparedStatement")) {
- checkLibrary(javassistClassName,classLoader);
- byte[] result=MSSQLPreparedStatementModifier.modify(classPool,classLoader,javassistClassName,classFileBuffer);
- if(result!=null) return result;
- } else if(javassistClassName.equals("net.sourceforge.jtds.jdbc.JtdsResultSet")) {
- checkLibrary(javassistClassName,classLoader);
- byte[] result=MSSQLResultSetModifier.modify(classPool,classLoader,javassistClassName,classFileBuffer);
- if(result!=null) return result;
- }
-
- } else if(className.startsWith("org/apache/commons/dbcp")) {
- // DBCP !!!!!!!!!!
- String javassistClassName = className.replace('/', '.');
- if(javassistClassName.equals("org.apache.commons.dbcp.BasicDataSource")) {
- checkLibrary(javassistClassName,classLoader);
- byte[] result=DBCPBasicDataSourceModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
- if(result!=null) return result;
- } else if(javassistClassName.equals("org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper")) {
- checkLibrary(javassistClassName,classLoader);
- byte[] result=DBCPPoolModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
- if(result!=null) return result;
- }
-
- } else if(className.startsWith("cubrid/jdbc")) {
- // CUBRID !!!!!!!!!!
- String javassistClassName = className.replace('/', '.');
- /*if(!javassistClassName.equals("cubrid.jdbc.driver.CUBRIDResultSet") &&
- !javassistClassName.startsWith("cubrid.jdbc.driver.ConnectionProperties")) {
- byte[] result=AbstractModifier.addBeforeAfterLogics(classPool, javassistClassName);
- if(result!=null) return result;
- }*/
-
- if(javassistClassName.equals("cubrid.jdbc.driver.CUBRIDStatement")) {
- checkLibrary(javassistClassName,classLoader);
- byte[] result=CubridStatementModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
- if(result!=null) return result;
- } else if(javassistClassName.equals("cubrid.jdbc.driver.CUBRIDPreparedStatement")) {
- checkLibrary(javassistClassName,classLoader);
- byte[] result=CubridPreparedStatementModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
- if(result!=null) return result;
- } else if(javassistClassName.equals("cubrid.jdbc.driver.CUBRIDResultSet")) {
- checkLibrary(javassistClassName,classLoader);
- byte[] result=CubridResultSetModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
- if(result!=null) return result;
- } else if(javassistClassName.equals("cubrid.jdbc.jci.UStatement")) {
- checkLibrary(javassistClassName,classLoader);
- byte[] result=CubridUStatementModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
- if(result!=null) return result;
- }
- } else if(className.startsWith("oracle/jdbc")) {
- String javassistClassName = className.replace('/', '.');
- if(javassistClassName.equals("oracle.jdbc.driver.OraclePreparedStatement")) {
- checkLibrary(javassistClassName,classLoader);
- byte[] result=OraclePreparedStatementModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
- if(result!=null) return result;
- } else if(javassistClassName.equals("oracle.jdbc.driver.OracleStatement")) {
- checkLibrary(javassistClassName,classLoader);
- byte[] result=OracleStatementModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
- if(result!=null) return result;
- } else if(javassistClassName.equals("oracle.jdbc.driver.OracleResultSetImpl")) {
- checkLibrary(javassistClassName,classLoader);
- byte[] result=OracleResultSetModifier.modify(classPool, classLoader, javassistClassName, classFileBuffer);
- if(result!=null) return result;
- }
- }
- }
-// else if(className.startsWith("java/sql")) {
-// String javassistClassName = className.replace('/', '.');
-// System.out.println("***** Changing "+javassistClassName);
-// byte[] result=AbstractModifier.addBeforeAfterLogics(classPool, javassistClassName);
-// if(result!=null) return result;
-// }
-
- return null;
- }
- private void checkLibrary(String javassistClassName,ClassLoader classLoader) {
- try {
- classPool.get(javassistClassName);
- } catch(NotFoundException nfe) {
-// cnfe.printStackTrace();
- loadClassLoaderLibraries(classLoader);
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
private void loadClassLoaderLibraries(ClassLoader classLoader) {
- if(classLoader instanceof URLClassLoader) {
- URLClassLoader urlClassLoader = (URLClassLoader)classLoader;
- URL[] urlList=urlClassLoader.getURLs();
- for(URL tempURL:urlList) {
- String filePath=tempURL.getFile();
+ if (classLoader instanceof URLClassLoader) {
+ URLClassLoader urlClassLoader = (URLClassLoader) classLoader;
+ URL[] urlList = urlClassLoader.getURLs();
+ for (URL tempURL : urlList) {
+ String filePath = tempURL.getFile();
try {
classPool.appendClassPath(filePath);
-// log("Loaded "+filePath+" library.");
- } catch(Exception e) {
-
+ // log("Loaded "+filePath+" library.");
+ } catch (Exception e) {
+
}
}
}
}
- @SuppressWarnings("unused")
- private static void log(String message) {
- System.out.println("%%%%% "+message);
- }
}
diff --git a/src/main/java/com/profiler/TomcatTracer.java b/src/main/java/com/profiler/TomcatTracer.java
index 1247cd1b7..6fe760798 100644
--- a/src/main/java/com/profiler/TomcatTracer.java
+++ b/src/main/java/com/profiler/TomcatTracer.java
@@ -1,6 +1,7 @@
package com.profiler;
import java.lang.instrument.ClassFileTransformer;
+
import java.lang.instrument.IllegalClassFormatException;
import java.lang.instrument.Instrumentation;
import java.security.ProtectionDomain;
@@ -14,8 +15,8 @@ public class TomcatTracer implements ClassFileTransformer {
protected String agentArgString = "";
protected Instrumentation instrumentation;
ClassPool classPool;
+
public static void premain(String agentArgs, Instrumentation inst) {
-// TomcatProfiler profiler = new TomcatProfiler(agentArgs, inst);
new TomcatTracer(agentArgs, inst);
}
@@ -27,57 +28,52 @@ public class TomcatTracer implements ClassFileTransformer {
}
@Override
- public byte[] transform(ClassLoader loader, String className,
- Class> classBeingRedefined, ProtectionDomain protectionDomain,
- byte[] classfileBuffer) throws IllegalClassFormatException {
-// System.out.println(className);
+ public byte[] transform(ClassLoader loader, String className, Class> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
String javassistClassName = className.replace('/', '.');
- if(javassistClassName.startsWith("javax.servlet.") ||
- javassistClassName.startsWith("org.apache.tomcat") ) {
- if(!javassistClassName.startsWith("org.apache.tomcat.util")) {
- byte []result=changeCode(javassistClassName,classfileBuffer);
- if(result!=null) return result;
+
+ if (javassistClassName.startsWith("javax.servlet.") || javassistClassName.startsWith("org.apache.tomcat")) {
+ if (!javassistClassName.startsWith("org.apache.tomcat.util")) {
+ byte[] result = changeCode(javassistClassName, classfileBuffer);
+ if (result != null)
+ return result;
}
- } else {
-// System.out.println("*** "+javassistClassName);
}
-
+
return null;
}
- private byte[] changeCode(String javassistClassName,byte[] classfileBuffer) {
- boolean insertFlag=false;
-// System.out.println("*** "+javassistClassName);
-
-// System.out.println("*** ClassPool OK");
+
+ private byte[] changeCode(String javassistClassName, byte[] classfileBuffer) {
+ boolean insertFlag = false;
+
classPool.insertClassPath(new ByteArrayClassPath(javassistClassName, classfileBuffer));
-// System.out.println("*** insertClassPath OK");
+
try {
- if(classPool==null) {
+ if (classPool == null) {
System.out.println("NULL");
classPool = ClassPool.getDefault();
}
+
CtClass cc = classPool.get(javassistClassName);
-// System.out.println("%%% ClassLoader="+cc.getClass().getClassLoader());
- CtMethod[] methodList=cc.getDeclaredMethods();
- for(CtMethod method:methodList) {
-// System.out.println(method.getLongName());
- String methodName=method.getLongName();
- if(!method.isEmpty()) {
- System.out.println("***inserted instrument code at "+methodName);
-// method.insertBefore("{ System.out.println(\"### "+method.getName()+" is called. URL=\"+$1+\" \");}");
- method.insertBefore("{ System.out.println(\"--- "+methodName+" is called. \");}");
- insertFlag=true;
+ CtMethod[] methodList = cc.getDeclaredMethods();
+
+ for (CtMethod method : methodList) {
+ String methodName = method.getLongName();
+
+ if (!method.isEmpty()) {
+ System.out.println("***inserted instrument code at " + methodName);
+ method.insertBefore("{ System.out.println(\"--- " + methodName + " is called. \");}");
+ insertFlag = true;
}
}
- if(insertFlag) {
+
+ if (insertFlag) {
byte[] newClassfileBuffer = cc.toBytecode();
- System.out.println("@@@"+javassistClassName+"class's new Buffer generated !!!");
-
+ System.out.println("@@@" + javassistClassName + "class's new Buffer generated !!!");
+
return newClassfileBuffer;
}
- } catch(Exception e) {
-// e.printStackTrace();
- System.err.println("!!!!! "+e.getMessage());
+ } catch (Exception e) {
+ System.err.println("!!!!! " + e.getMessage());
}
return null;
}
diff --git a/src/main/java/com/profiler/config/TomcatProfilerConfig.java b/src/main/java/com/profiler/config/TomcatProfilerConfig.java
index fa8a6a1e1..79039e20a 100644
--- a/src/main/java/com/profiler/config/TomcatProfilerConfig.java
+++ b/src/main/java/com/profiler/config/TomcatProfilerConfig.java
@@ -4,93 +4,108 @@ import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Properties;
+import com.profiler.Logger;
+import com.profiler.Logger.LogLevel;
+
public class TomcatProfilerConfig {
- public static String SERVER_IP="127.0.0.1";
-// public static String SERVER_IP="10.25.131.94";
- public static String TOMCAT_LIB_PATH="/home1/irteam/apps/tomcat";
- static {
- String catalinaHome=System.getProperty("catalina.home");
- if(catalinaHome!=null) {
- TOMCAT_LIB_PATH=catalinaHome;
- }
- }
+
+ private static final Logger logger = Logger.getLogger(TomcatProfilerConfig.class);
+
+ public static String SERVER_IP = "127.0.0.1";
+
+ public static int AGENT_TCP_LISTEN_PORT = 9990;
+ public static int SERVER_TCP_LISTEN_PORT = 9991;
+ public static int REQUEST_TRANSACTION_DATA_LISTEN_PORT = 9995;
+ public static int REQUEST_DATA_LISTEN_PORT = 9996;
+ public static int JVM_DATA_LISTEN_PORT = 9997;
+
+ public static long JVM_STAT_GAP = 5000L;
+ public static long SERVER_CONNECT_RETRY_GAP = 1000L;
+
+ public static LogLevel LOG_LEVEL = LogLevel.INFO;
-
- public static int AGENT_TCP_LISTEN_PORT=9990;
- public static int SERVER_TCP_LISTEN_PORT=9991;
- public static int REQUEST_TRANSACTION_DATA_LISTEN_PORT=9995;
- public static int REQUEST_DATA_LISTEN_PORT=9996;
- public static int JVM_DATA_LISTEN_PORT=9997;
-
-
- public static long JVM_STAT_GAP=5000;
- public static long SERVER_CONNECT_RETRY_GAP=1000;
-
/**
- * If sql query count is over 10000 it consumes Memory.
- * So sqlHashSet uses CopyOnWriteArraySet.
- * It is slow, but it is stable.
- * Default set is false and it uses HashSet.
+ * If sql query count is over 10000 it consumes Memory. So sqlHashSet uses
+ * CopyOnWriteArraySet. It is slow, but it is stable. Default set is false
+ * and it uses HashSet.
*/
- public static boolean QUERY_COUNT_OVER_10000=false;
- public static boolean JDBC_PROFILE=true;
-// public static boolean URL_COUNT_OVER_10000=false;
-
-// public static String MSSQL_ENCODING="MS949";
-
+ public static boolean QUERY_COUNT_OVER_10000 = false;
+ public static boolean JDBC_PROFILE = true;
+
static {
readConfigFile();
}
+
public static void readConfigFile() {
- String hippoConfigFileName=System.getProperty("hippo.config");
- if(hippoConfigFileName!=null) {
-// System.out.println("%%%%%%%%%%%%%%%%%%%%% hippo.config File="+hippoConfigFileName);
- Properties prop=new Properties();
+ String hippoConfigFileName = System.getProperty("hippo.config");
+
+ if (hippoConfigFileName != null) {
+ Properties prop = new Properties();
try {
- FileReader reader=new FileReader(hippoConfigFileName);
+ FileReader reader = new FileReader(hippoConfigFileName);
prop.load(reader);
reader.close();
setPropertyValues(prop);
- } catch(FileNotFoundException fnfe) {
- System.out.println("##### "+hippoConfigFileName+" file is not exists. Please check configuration.");
- } catch(Exception e) {
- e.printStackTrace();
+ } catch (FileNotFoundException fnfe) {
+ logger.error("%s file is not exists. Please check configuration.", hippoConfigFileName);
+ } catch (Exception e) {
+ logger.fatal(e.getMessage());
}
} else {
- System.out.println("##### hippo.config property is not set. Using default values #####");
+ logger.warn("hippo.config property is not set. Using default values");
}
}
- private static void setPropertyValues(Properties prop) {
- Object temp=null;
- //##### set String values #####
- if((temp=prop.get("SERVER_IP"))!=null)
- SERVER_IP=temp.toString();
- if((temp=prop.get("TOMCAT_LIB_PATH"))!=null)
- TOMCAT_LIB_PATH=temp.toString();
- //##### set int values #####
- if((temp=prop.get("AGENT_TCP_LISTEN_PORT"))!=null)
- AGENT_TCP_LISTEN_PORT=Integer.parseInt(temp.toString());
- if((temp=prop.get("SERVER_TCP_LISTEN_PORT"))!=null)
- SERVER_TCP_LISTEN_PORT=Integer.parseInt(temp.toString());
- if((temp=prop.get("REQUEST_TRANSACTION_DATA_LISTEN_PORT"))!=null)
- REQUEST_TRANSACTION_DATA_LISTEN_PORT=Integer.parseInt(temp.toString());
- if((temp=prop.get("REQUEST_DATA_LISTEN_PORT"))!=null)
- REQUEST_DATA_LISTEN_PORT=Integer.parseInt(temp.toString());
- if((temp=prop.get("JVM_DATA_LISTEN_PORT"))!=null)
- JVM_DATA_LISTEN_PORT=Integer.parseInt(temp.toString());
-
- //##### set long values #####
- if((temp=prop.get("JVM_STAT_GAP"))!=null)
- JVM_STAT_GAP=Long.parseLong(temp.toString());
- if((temp=prop.get("SERVER_CONNECT_RETRY_GAP"))!=null)
- SERVER_CONNECT_RETRY_GAP=Long.parseLong(temp.toString());
-
- //##### set boolean values #####
- if((temp=prop.get("QUERY_COUNT_OVER_10000"))!=null)
- QUERY_COUNT_OVER_10000=Boolean.parseBoolean(temp.toString());
- if((temp=prop.get("JDBC_PROFILE"))!=null)
- JDBC_PROFILE=Boolean.parseBoolean(temp.toString());
- System.out.println("##### Hippo Config Loaded successfully. #####");
+ private static void setPropertyValues(Properties prop) {
+ // TODO : use Properties defaultvalue instead of using temp variable.
+
+ Object temp = null;
+
+ if ((temp = prop.get("SERVER_IP")) != null) {
+ SERVER_IP = temp.toString();
+ logger.info("SERVER_IP=%s", SERVER_IP);
+ }
+ if ((temp = prop.get("AGENT_TCP_LISTEN_PORT")) != null) {
+ AGENT_TCP_LISTEN_PORT = Integer.parseInt(temp.toString());
+ logger.info("AGENT_TCP_LISTEN_PORT=%d", AGENT_TCP_LISTEN_PORT);
+ }
+ if ((temp = prop.get("SERVER_TCP_LISTEN_PORT")) != null) {
+ SERVER_TCP_LISTEN_PORT = Integer.parseInt(temp.toString());
+ logger.info("SERVER_TCP_LISTEN_PORT=%d", SERVER_TCP_LISTEN_PORT);
+ }
+ if ((temp = prop.get("REQUEST_TRANSACTION_DATA_LISTEN_PORT")) != null) {
+ REQUEST_TRANSACTION_DATA_LISTEN_PORT = Integer.parseInt(temp.toString());
+ logger.info("REQUEST_TRANSACTION_DATA_LISTEN_PORT=%d", REQUEST_TRANSACTION_DATA_LISTEN_PORT);
+ }
+ if ((temp = prop.get("REQUEST_DATA_LISTEN_PORT")) != null) {
+ REQUEST_DATA_LISTEN_PORT = Integer.parseInt(temp.toString());
+ logger.info("REQUEST_DATA_LISTEN_PORT=%d", REQUEST_DATA_LISTEN_PORT);
+ }
+ if ((temp = prop.get("JVM_DATA_LISTEN_PORT")) != null) {
+ JVM_DATA_LISTEN_PORT = Integer.parseInt(temp.toString());
+ logger.info("JVM_DATA_LISTEN_PORT=%d", JVM_DATA_LISTEN_PORT);
+ }
+ if ((temp = prop.get("JVM_STAT_GAP")) != null) {
+ JVM_STAT_GAP = Long.parseLong(temp.toString());
+ logger.info("JVM_STAT_GAP=%d", JVM_STAT_GAP);
+ }
+ if ((temp = prop.get("SERVER_CONNECT_RETRY_GAP")) != null) {
+ SERVER_CONNECT_RETRY_GAP = Long.parseLong(temp.toString());
+ logger.info("SERVER_CONNECT_RETRY_GAP=%d", SERVER_CONNECT_RETRY_GAP);
+ }
+ if ((temp = prop.get("QUERY_COUNT_OVER_10000")) != null) {
+ QUERY_COUNT_OVER_10000 = Boolean.parseBoolean(temp.toString());
+ logger.info("QUERY_COUNT_OVER_10000=%s", QUERY_COUNT_OVER_10000);
+ }
+ if ((temp = prop.get("JDBC_PROFILE")) != null) {
+ JDBC_PROFILE = Boolean.parseBoolean(temp.toString());
+ logger.info("JDBC_PROFILE=%s", JDBC_PROFILE);
+ }
+ if ((temp = prop.get("LOG_LEVEL")) != null) {
+ LOG_LEVEL = LogLevel.valueOf(temp.toString());
+ logger.info("LOG_LEVEL=%s", LOG_LEVEL);
+ }
+
+ logger.info("configuration loaded successfully.");
}
}
diff --git a/src/main/java/com/profiler/dto/AgentInfoDTO.java b/src/main/java/com/profiler/dto/AgentInfoDTO.java
index 7cca5599b..832a855ea 100644
--- a/src/main/java/com/profiler/dto/AgentInfoDTO.java
+++ b/src/main/java/com/profiler/dto/AgentInfoDTO.java
@@ -6,60 +6,75 @@ import com.profiler.config.TomcatProfilerConfig;
public class AgentInfoDTO implements Serializable {
private static final long serialVersionUID = 1465266151876398515L;
+
public AgentInfoDTO() {
- hostHashCode=staticHostHashCode;
- hostIP=staticHostIP;
- portNumbers=staticPortNumber;
- agentTCPPortNumber=TomcatProfilerConfig.AGENT_TCP_LISTEN_PORT;
- timestamp=System.currentTimeMillis();
+ hostHashCode = staticHostHashCode;
+ hostIP = staticHostIP;
+ portNumbers = staticPortNumber;
+ agentTCPPortNumber = TomcatProfilerConfig.AGENT_TCP_LISTEN_PORT;
+ timestamp = System.currentTimeMillis();
}
- public transient static final StringBuffer portNumberBuffer=new StringBuffer();
+
+ public transient static final StringBuffer portNumberBuffer = new StringBuffer();
// static variable is only used in the agent.
public static int staticHostHashCode;
- public static String staticHostIP,staticPortNumber;
+ public static String staticHostIP, staticPortNumber;
// instance variable is commonly used.
- private String hostIP,portNumbers;
- private int hostHashCode,agentTCPPortNumber;
- private boolean isAlive=true;
+ private String hostIP, portNumbers;
+ private int hostHashCode, agentTCPPortNumber;
+ private boolean isAlive = true;
private long timestamp;
+
public void setIsDead() {
- isAlive=false;
+ isAlive = false;
}
+
public static String getPortNumberString() {
- staticPortNumber=portNumberBuffer.toString();
+ staticPortNumber = portNumberBuffer.toString();
staticPortNumber.trim();
return staticPortNumber;
}
+
public String toString() {
- return hostHashCode+" "+hostIP+" "+portNumbers+" "+agentTCPPortNumber+" isAlive="+isAlive;
+ return hostHashCode + " " + hostIP + " " + portNumbers + " " + agentTCPPortNumber + " isAlive=" + isAlive;
}
+
public String getHostIP() {
return hostIP;
}
+
public void setHostIP(String hostIP) {
this.hostIP = hostIP;
}
+
public int getHostHashCode() {
return hostHashCode;
}
+
public void setHostHashCode(int hostHashCode) {
this.hostHashCode = hostHashCode;
}
+
public String getPortNumbers() {
return portNumbers;
}
+
public void setPortNumbers(String portNumber) {
this.portNumbers = portNumber;
}
+
public int getAgentTCPPortNumber() {
return agentTCPPortNumber;
}
+
public void setAgentTCPPortNumber(int agentTCPPortNumber) {
this.agentTCPPortNumber = agentTCPPortNumber;
}
+
public long getTimestamp() {
return timestamp;
}
+
public boolean isAlive() {
return isAlive;
}
diff --git a/src/main/java/com/profiler/dto/JVMInfoThriftDTO.java b/src/main/java/com/profiler/dto/JVMInfoThriftDTO.java
index 2cb2b056a..b9b588ea5 100644
--- a/src/main/java/com/profiler/dto/JVMInfoThriftDTO.java
+++ b/src/main/java/com/profiler/dto/JVMInfoThriftDTO.java
@@ -6,1416 +6,1551 @@
*/
package com.profiler.dto;
+import java.util.BitSet;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
-
import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class JVMInfoThriftDTO implements org.apache.thrift.TBase, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("JVMInfoThriftDTO");
-
- private static final org.apache.thrift.protocol.TField AGENT_HASH_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("agentHashCode", org.apache.thrift.protocol.TType.I32, (short)1);
- private static final org.apache.thrift.protocol.TField DATA_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("dataTime", org.apache.thrift.protocol.TType.I64, (short)2);
- private static final org.apache.thrift.protocol.TField ACTIVE_THREAD_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("activeThreadCount", org.apache.thrift.protocol.TType.I32, (short)3);
- private static final org.apache.thrift.protocol.TField GC1_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("gc1Count", org.apache.thrift.protocol.TType.I64, (short)4);
- private static final org.apache.thrift.protocol.TField GC1_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("gc1Time", org.apache.thrift.protocol.TType.I64, (short)5);
- private static final org.apache.thrift.protocol.TField GC2_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("gc2Count", org.apache.thrift.protocol.TType.I64, (short)6);
- private static final org.apache.thrift.protocol.TField GC2_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("gc2Time", org.apache.thrift.protocol.TType.I64, (short)7);
- private static final org.apache.thrift.protocol.TField HEAP_USED_FIELD_DESC = new org.apache.thrift.protocol.TField("heapUsed", org.apache.thrift.protocol.TType.I64, (short)8);
- private static final org.apache.thrift.protocol.TField HEAP_COMMITTED_FIELD_DESC = new org.apache.thrift.protocol.TField("heapCommitted", org.apache.thrift.protocol.TType.I64, (short)9);
- private static final org.apache.thrift.protocol.TField NON_HEAP_USED_FIELD_DESC = new org.apache.thrift.protocol.TField("nonHeapUsed", org.apache.thrift.protocol.TType.I64, (short)10);
- private static final org.apache.thrift.protocol.TField NON_HEAP_COMMITTED_FIELD_DESC = new org.apache.thrift.protocol.TField("nonHeapCommitted", org.apache.thrift.protocol.TType.I64, (short)11);
- private static final org.apache.thrift.protocol.TField PROCESS_CPUTIME_FIELD_DESC = new org.apache.thrift.protocol.TField("processCPUTime", org.apache.thrift.protocol.TType.DOUBLE, (short)12);
-
- private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new JVMInfoThriftDTOStandardSchemeFactory());
- schemes.put(TupleScheme.class, new JVMInfoThriftDTOTupleSchemeFactory());
- }
-
- public int agentHashCode; // required
- public long dataTime; // required
- public int activeThreadCount; // required
- public long gc1Count; // optional
- public long gc1Time; // optional
- public long gc2Count; // optional
- public long gc2Time; // optional
- public long heapUsed; // required
- public long heapCommitted; // required
- public long nonHeapUsed; // required
- public long nonHeapCommitted; // required
- public double processCPUTime; // optional
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- AGENT_HASH_CODE((short)1, "agentHashCode"),
- DATA_TIME((short)2, "dataTime"),
- ACTIVE_THREAD_COUNT((short)3, "activeThreadCount"),
- GC1_COUNT((short)4, "gc1Count"),
- GC1_TIME((short)5, "gc1Time"),
- GC2_COUNT((short)6, "gc2Count"),
- GC2_TIME((short)7, "gc2Time"),
- HEAP_USED((short)8, "heapUsed"),
- HEAP_COMMITTED((short)9, "heapCommitted"),
- NON_HEAP_USED((short)10, "nonHeapUsed"),
- NON_HEAP_COMMITTED((short)11, "nonHeapCommitted"),
- PROCESS_CPUTIME((short)12, "processCPUTime");
-
- private static final Map byName = new HashMap();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // AGENT_HASH_CODE
- return AGENT_HASH_CODE;
- case 2: // DATA_TIME
- return DATA_TIME;
- case 3: // ACTIVE_THREAD_COUNT
- return ACTIVE_THREAD_COUNT;
- case 4: // GC1_COUNT
- return GC1_COUNT;
- case 5: // GC1_TIME
- return GC1_TIME;
- case 6: // GC2_COUNT
- return GC2_COUNT;
- case 7: // GC2_TIME
- return GC2_TIME;
- case 8: // HEAP_USED
- return HEAP_USED;
- case 9: // HEAP_COMMITTED
- return HEAP_COMMITTED;
- case 10: // NON_HEAP_USED
- return NON_HEAP_USED;
- case 11: // NON_HEAP_COMMITTED
- return NON_HEAP_COMMITTED;
- case 12: // PROCESS_CPUTIME
- return PROCESS_CPUTIME;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- private static final int __AGENTHASHCODE_ISSET_ID = 0;
- private static final int __DATATIME_ISSET_ID = 1;
- private static final int __ACTIVETHREADCOUNT_ISSET_ID = 2;
- private static final int __GC1COUNT_ISSET_ID = 3;
- private static final int __GC1TIME_ISSET_ID = 4;
- private static final int __GC2COUNT_ISSET_ID = 5;
- private static final int __GC2TIME_ISSET_ID = 6;
- private static final int __HEAPUSED_ISSET_ID = 7;
- private static final int __HEAPCOMMITTED_ISSET_ID = 8;
- private static final int __NONHEAPUSED_ISSET_ID = 9;
- private static final int __NONHEAPCOMMITTED_ISSET_ID = 10;
- private static final int __PROCESSCPUTIME_ISSET_ID = 11;
- private BitSet __isset_bit_vector = new BitSet(12);
- private _Fields optionals[] = {_Fields.GC1_COUNT,_Fields.GC1_TIME,_Fields.GC2_COUNT,_Fields.GC2_TIME,_Fields.PROCESS_CPUTIME};
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.AGENT_HASH_CODE, new org.apache.thrift.meta_data.FieldMetaData("agentHashCode", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
- tmpMap.put(_Fields.DATA_TIME, new org.apache.thrift.meta_data.FieldMetaData("dataTime", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
- tmpMap.put(_Fields.ACTIVE_THREAD_COUNT, new org.apache.thrift.meta_data.FieldMetaData("activeThreadCount", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
- tmpMap.put(_Fields.GC1_COUNT, new org.apache.thrift.meta_data.FieldMetaData("gc1Count", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
- tmpMap.put(_Fields.GC1_TIME, new org.apache.thrift.meta_data.FieldMetaData("gc1Time", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
- tmpMap.put(_Fields.GC2_COUNT, new org.apache.thrift.meta_data.FieldMetaData("gc2Count", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
- tmpMap.put(_Fields.GC2_TIME, new org.apache.thrift.meta_data.FieldMetaData("gc2Time", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
- tmpMap.put(_Fields.HEAP_USED, new org.apache.thrift.meta_data.FieldMetaData("heapUsed", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
- tmpMap.put(_Fields.HEAP_COMMITTED, new org.apache.thrift.meta_data.FieldMetaData("heapCommitted", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
- tmpMap.put(_Fields.NON_HEAP_USED, new org.apache.thrift.meta_data.FieldMetaData("nonHeapUsed", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
- tmpMap.put(_Fields.NON_HEAP_COMMITTED, new org.apache.thrift.meta_data.FieldMetaData("nonHeapCommitted", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
- tmpMap.put(_Fields.PROCESS_CPUTIME, new org.apache.thrift.meta_data.FieldMetaData("processCPUTime", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(JVMInfoThriftDTO.class, metaDataMap);
- }
-
- public JVMInfoThriftDTO() {
- }
-
- public JVMInfoThriftDTO(
- int agentHashCode,
- long dataTime,
- int activeThreadCount,
- long heapUsed,
- long heapCommitted,
- long nonHeapUsed,
- long nonHeapCommitted)
- {
- this();
- this.agentHashCode = agentHashCode;
- setAgentHashCodeIsSet(true);
- this.dataTime = dataTime;
- setDataTimeIsSet(true);
- this.activeThreadCount = activeThreadCount;
- setActiveThreadCountIsSet(true);
- this.heapUsed = heapUsed;
- setHeapUsedIsSet(true);
- this.heapCommitted = heapCommitted;
- setHeapCommittedIsSet(true);
- this.nonHeapUsed = nonHeapUsed;
- setNonHeapUsedIsSet(true);
- this.nonHeapCommitted = nonHeapCommitted;
- setNonHeapCommittedIsSet(true);
- }
-
- /**
- * Performs a deep copy on other.
- */
- public JVMInfoThriftDTO(JVMInfoThriftDTO other) {
- __isset_bit_vector.clear();
- __isset_bit_vector.or(other.__isset_bit_vector);
- this.agentHashCode = other.agentHashCode;
- this.dataTime = other.dataTime;
- this.activeThreadCount = other.activeThreadCount;
- this.gc1Count = other.gc1Count;
- this.gc1Time = other.gc1Time;
- this.gc2Count = other.gc2Count;
- this.gc2Time = other.gc2Time;
- this.heapUsed = other.heapUsed;
- this.heapCommitted = other.heapCommitted;
- this.nonHeapUsed = other.nonHeapUsed;
- this.nonHeapCommitted = other.nonHeapCommitted;
- this.processCPUTime = other.processCPUTime;
- }
-
- public JVMInfoThriftDTO deepCopy() {
- return new JVMInfoThriftDTO(this);
- }
-
- @Override
- public void clear() {
- setAgentHashCodeIsSet(false);
- this.agentHashCode = 0;
- setDataTimeIsSet(false);
- this.dataTime = 0;
- setActiveThreadCountIsSet(false);
- this.activeThreadCount = 0;
- setGc1CountIsSet(false);
- this.gc1Count = 0;
- setGc1TimeIsSet(false);
- this.gc1Time = 0;
- setGc2CountIsSet(false);
- this.gc2Count = 0;
- setGc2TimeIsSet(false);
- this.gc2Time = 0;
- setHeapUsedIsSet(false);
- this.heapUsed = 0;
- setHeapCommittedIsSet(false);
- this.heapCommitted = 0;
- setNonHeapUsedIsSet(false);
- this.nonHeapUsed = 0;
- setNonHeapCommittedIsSet(false);
- this.nonHeapCommitted = 0;
- setProcessCPUTimeIsSet(false);
- this.processCPUTime = 0.0;
- }
-
- public int getAgentHashCode() {
- return this.agentHashCode;
- }
-
- public JVMInfoThriftDTO setAgentHashCode(int agentHashCode) {
- this.agentHashCode = agentHashCode;
- setAgentHashCodeIsSet(true);
- return this;
- }
-
- public void unsetAgentHashCode() {
- __isset_bit_vector.clear(__AGENTHASHCODE_ISSET_ID);
- }
-
- /** Returns true if field agentHashCode is set (has been assigned a value) and false otherwise */
- public boolean isSetAgentHashCode() {
- return __isset_bit_vector.get(__AGENTHASHCODE_ISSET_ID);
- }
-
- public void setAgentHashCodeIsSet(boolean value) {
- __isset_bit_vector.set(__AGENTHASHCODE_ISSET_ID, value);
- }
-
- public long getDataTime() {
- return this.dataTime;
- }
-
- public JVMInfoThriftDTO setDataTime(long dataTime) {
- this.dataTime = dataTime;
- setDataTimeIsSet(true);
- return this;
- }
-
- public void unsetDataTime() {
- __isset_bit_vector.clear(__DATATIME_ISSET_ID);
- }
-
- /** Returns true if field dataTime is set (has been assigned a value) and false otherwise */
- public boolean isSetDataTime() {
- return __isset_bit_vector.get(__DATATIME_ISSET_ID);
- }
-
- public void setDataTimeIsSet(boolean value) {
- __isset_bit_vector.set(__DATATIME_ISSET_ID, value);
- }
-
- public int getActiveThreadCount() {
- return this.activeThreadCount;
- }
-
- public JVMInfoThriftDTO setActiveThreadCount(int activeThreadCount) {
- this.activeThreadCount = activeThreadCount;
- setActiveThreadCountIsSet(true);
- return this;
- }
-
- public void unsetActiveThreadCount() {
- __isset_bit_vector.clear(__ACTIVETHREADCOUNT_ISSET_ID);
- }
-
- /** Returns true if field activeThreadCount is set (has been assigned a value) and false otherwise */
- public boolean isSetActiveThreadCount() {
- return __isset_bit_vector.get(__ACTIVETHREADCOUNT_ISSET_ID);
- }
-
- public void setActiveThreadCountIsSet(boolean value) {
- __isset_bit_vector.set(__ACTIVETHREADCOUNT_ISSET_ID, value);
- }
-
- public long getGc1Count() {
- return this.gc1Count;
- }
-
- public JVMInfoThriftDTO setGc1Count(long gc1Count) {
- this.gc1Count = gc1Count;
- setGc1CountIsSet(true);
- return this;
- }
-
- public void unsetGc1Count() {
- __isset_bit_vector.clear(__GC1COUNT_ISSET_ID);
- }
-
- /** Returns true if field gc1Count is set (has been assigned a value) and false otherwise */
- public boolean isSetGc1Count() {
- return __isset_bit_vector.get(__GC1COUNT_ISSET_ID);
- }
-
- public void setGc1CountIsSet(boolean value) {
- __isset_bit_vector.set(__GC1COUNT_ISSET_ID, value);
- }
-
- public long getGc1Time() {
- return this.gc1Time;
- }
-
- public JVMInfoThriftDTO setGc1Time(long gc1Time) {
- this.gc1Time = gc1Time;
- setGc1TimeIsSet(true);
- return this;
- }
-
- public void unsetGc1Time() {
- __isset_bit_vector.clear(__GC1TIME_ISSET_ID);
- }
-
- /** Returns true if field gc1Time is set (has been assigned a value) and false otherwise */
- public boolean isSetGc1Time() {
- return __isset_bit_vector.get(__GC1TIME_ISSET_ID);
- }
-
- public void setGc1TimeIsSet(boolean value) {
- __isset_bit_vector.set(__GC1TIME_ISSET_ID, value);
- }
-
- public long getGc2Count() {
- return this.gc2Count;
- }
-
- public JVMInfoThriftDTO setGc2Count(long gc2Count) {
- this.gc2Count = gc2Count;
- setGc2CountIsSet(true);
- return this;
- }
-
- public void unsetGc2Count() {
- __isset_bit_vector.clear(__GC2COUNT_ISSET_ID);
- }
-
- /** Returns true if field gc2Count is set (has been assigned a value) and false otherwise */
- public boolean isSetGc2Count() {
- return __isset_bit_vector.get(__GC2COUNT_ISSET_ID);
- }
-
- public void setGc2CountIsSet(boolean value) {
- __isset_bit_vector.set(__GC2COUNT_ISSET_ID, value);
- }
-
- public long getGc2Time() {
- return this.gc2Time;
- }
-
- public JVMInfoThriftDTO setGc2Time(long gc2Time) {
- this.gc2Time = gc2Time;
- setGc2TimeIsSet(true);
- return this;
- }
-
- public void unsetGc2Time() {
- __isset_bit_vector.clear(__GC2TIME_ISSET_ID);
- }
-
- /** Returns true if field gc2Time is set (has been assigned a value) and false otherwise */
- public boolean isSetGc2Time() {
- return __isset_bit_vector.get(__GC2TIME_ISSET_ID);
- }
-
- public void setGc2TimeIsSet(boolean value) {
- __isset_bit_vector.set(__GC2TIME_ISSET_ID, value);
- }
-
- public long getHeapUsed() {
- return this.heapUsed;
- }
-
- public JVMInfoThriftDTO setHeapUsed(long heapUsed) {
- this.heapUsed = heapUsed;
- setHeapUsedIsSet(true);
- return this;
- }
-
- public void unsetHeapUsed() {
- __isset_bit_vector.clear(__HEAPUSED_ISSET_ID);
- }
-
- /** Returns true if field heapUsed is set (has been assigned a value) and false otherwise */
- public boolean isSetHeapUsed() {
- return __isset_bit_vector.get(__HEAPUSED_ISSET_ID);
- }
-
- public void setHeapUsedIsSet(boolean value) {
- __isset_bit_vector.set(__HEAPUSED_ISSET_ID, value);
- }
-
- public long getHeapCommitted() {
- return this.heapCommitted;
- }
-
- public JVMInfoThriftDTO setHeapCommitted(long heapCommitted) {
- this.heapCommitted = heapCommitted;
- setHeapCommittedIsSet(true);
- return this;
- }
-
- public void unsetHeapCommitted() {
- __isset_bit_vector.clear(__HEAPCOMMITTED_ISSET_ID);
- }
-
- /** Returns true if field heapCommitted is set (has been assigned a value) and false otherwise */
- public boolean isSetHeapCommitted() {
- return __isset_bit_vector.get(__HEAPCOMMITTED_ISSET_ID);
- }
-
- public void setHeapCommittedIsSet(boolean value) {
- __isset_bit_vector.set(__HEAPCOMMITTED_ISSET_ID, value);
- }
-
- public long getNonHeapUsed() {
- return this.nonHeapUsed;
- }
-
- public JVMInfoThriftDTO setNonHeapUsed(long nonHeapUsed) {
- this.nonHeapUsed = nonHeapUsed;
- setNonHeapUsedIsSet(true);
- return this;
- }
-
- public void unsetNonHeapUsed() {
- __isset_bit_vector.clear(__NONHEAPUSED_ISSET_ID);
- }
-
- /** Returns true if field nonHeapUsed is set (has been assigned a value) and false otherwise */
- public boolean isSetNonHeapUsed() {
- return __isset_bit_vector.get(__NONHEAPUSED_ISSET_ID);
- }
-
- public void setNonHeapUsedIsSet(boolean value) {
- __isset_bit_vector.set(__NONHEAPUSED_ISSET_ID, value);
- }
-
- public long getNonHeapCommitted() {
- return this.nonHeapCommitted;
- }
-
- public JVMInfoThriftDTO setNonHeapCommitted(long nonHeapCommitted) {
- this.nonHeapCommitted = nonHeapCommitted;
- setNonHeapCommittedIsSet(true);
- return this;
- }
-
- public void unsetNonHeapCommitted() {
- __isset_bit_vector.clear(__NONHEAPCOMMITTED_ISSET_ID);
- }
-
- /** Returns true if field nonHeapCommitted is set (has been assigned a value) and false otherwise */
- public boolean isSetNonHeapCommitted() {
- return __isset_bit_vector.get(__NONHEAPCOMMITTED_ISSET_ID);
- }
-
- public void setNonHeapCommittedIsSet(boolean value) {
- __isset_bit_vector.set(__NONHEAPCOMMITTED_ISSET_ID, value);
- }
-
- public double getProcessCPUTime() {
- return this.processCPUTime;
- }
-
- public JVMInfoThriftDTO setProcessCPUTime(double processCPUTime) {
- this.processCPUTime = processCPUTime;
- setProcessCPUTimeIsSet(true);
- return this;
- }
-
- public void unsetProcessCPUTime() {
- __isset_bit_vector.clear(__PROCESSCPUTIME_ISSET_ID);
- }
-
- /** Returns true if field processCPUTime is set (has been assigned a value) and false otherwise */
- public boolean isSetProcessCPUTime() {
- return __isset_bit_vector.get(__PROCESSCPUTIME_ISSET_ID);
- }
-
- public void setProcessCPUTimeIsSet(boolean value) {
- __isset_bit_vector.set(__PROCESSCPUTIME_ISSET_ID, value);
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case AGENT_HASH_CODE:
- if (value == null) {
- unsetAgentHashCode();
- } else {
- setAgentHashCode((Integer)value);
- }
- break;
-
- case DATA_TIME:
- if (value == null) {
- unsetDataTime();
- } else {
- setDataTime((Long)value);
- }
- break;
-
- case ACTIVE_THREAD_COUNT:
- if (value == null) {
- unsetActiveThreadCount();
- } else {
- setActiveThreadCount((Integer)value);
- }
- break;
-
- case GC1_COUNT:
- if (value == null) {
- unsetGc1Count();
- } else {
- setGc1Count((Long)value);
- }
- break;
-
- case GC1_TIME:
- if (value == null) {
- unsetGc1Time();
- } else {
- setGc1Time((Long)value);
- }
- break;
-
- case GC2_COUNT:
- if (value == null) {
- unsetGc2Count();
- } else {
- setGc2Count((Long)value);
- }
- break;
-
- case GC2_TIME:
- if (value == null) {
- unsetGc2Time();
- } else {
- setGc2Time((Long)value);
- }
- break;
-
- case HEAP_USED:
- if (value == null) {
- unsetHeapUsed();
- } else {
- setHeapUsed((Long)value);
- }
- break;
-
- case HEAP_COMMITTED:
- if (value == null) {
- unsetHeapCommitted();
- } else {
- setHeapCommitted((Long)value);
- }
- break;
-
- case NON_HEAP_USED:
- if (value == null) {
- unsetNonHeapUsed();
- } else {
- setNonHeapUsed((Long)value);
- }
- break;
-
- case NON_HEAP_COMMITTED:
- if (value == null) {
- unsetNonHeapCommitted();
- } else {
- setNonHeapCommitted((Long)value);
- }
- break;
-
- case PROCESS_CPUTIME:
- if (value == null) {
- unsetProcessCPUTime();
- } else {
- setProcessCPUTime((Double)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case AGENT_HASH_CODE:
- return Integer.valueOf(getAgentHashCode());
-
- case DATA_TIME:
- return Long.valueOf(getDataTime());
-
- case ACTIVE_THREAD_COUNT:
- return Integer.valueOf(getActiveThreadCount());
-
- case GC1_COUNT:
- return Long.valueOf(getGc1Count());
-
- case GC1_TIME:
- return Long.valueOf(getGc1Time());
-
- case GC2_COUNT:
- return Long.valueOf(getGc2Count());
-
- case GC2_TIME:
- return Long.valueOf(getGc2Time());
-
- case HEAP_USED:
- return Long.valueOf(getHeapUsed());
-
- case HEAP_COMMITTED:
- return Long.valueOf(getHeapCommitted());
-
- case NON_HEAP_USED:
- return Long.valueOf(getNonHeapUsed());
-
- case NON_HEAP_COMMITTED:
- return Long.valueOf(getNonHeapCommitted());
-
- case PROCESS_CPUTIME:
- return Double.valueOf(getProcessCPUTime());
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case AGENT_HASH_CODE:
- return isSetAgentHashCode();
- case DATA_TIME:
- return isSetDataTime();
- case ACTIVE_THREAD_COUNT:
- return isSetActiveThreadCount();
- case GC1_COUNT:
- return isSetGc1Count();
- case GC1_TIME:
- return isSetGc1Time();
- case GC2_COUNT:
- return isSetGc2Count();
- case GC2_TIME:
- return isSetGc2Time();
- case HEAP_USED:
- return isSetHeapUsed();
- case HEAP_COMMITTED:
- return isSetHeapCommitted();
- case NON_HEAP_USED:
- return isSetNonHeapUsed();
- case NON_HEAP_COMMITTED:
- return isSetNonHeapCommitted();
- case PROCESS_CPUTIME:
- return isSetProcessCPUTime();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof JVMInfoThriftDTO)
- return this.equals((JVMInfoThriftDTO)that);
- return false;
- }
-
- public boolean equals(JVMInfoThriftDTO that) {
- if (that == null)
- return false;
-
- boolean this_present_agentHashCode = true;
- boolean that_present_agentHashCode = true;
- if (this_present_agentHashCode || that_present_agentHashCode) {
- if (!(this_present_agentHashCode && that_present_agentHashCode))
- return false;
- if (this.agentHashCode != that.agentHashCode)
- return false;
- }
-
- boolean this_present_dataTime = true;
- boolean that_present_dataTime = true;
- if (this_present_dataTime || that_present_dataTime) {
- if (!(this_present_dataTime && that_present_dataTime))
- return false;
- if (this.dataTime != that.dataTime)
- return false;
- }
-
- boolean this_present_activeThreadCount = true;
- boolean that_present_activeThreadCount = true;
- if (this_present_activeThreadCount || that_present_activeThreadCount) {
- if (!(this_present_activeThreadCount && that_present_activeThreadCount))
- return false;
- if (this.activeThreadCount != that.activeThreadCount)
- return false;
- }
-
- boolean this_present_gc1Count = true && this.isSetGc1Count();
- boolean that_present_gc1Count = true && that.isSetGc1Count();
- if (this_present_gc1Count || that_present_gc1Count) {
- if (!(this_present_gc1Count && that_present_gc1Count))
- return false;
- if (this.gc1Count != that.gc1Count)
- return false;
- }
-
- boolean this_present_gc1Time = true && this.isSetGc1Time();
- boolean that_present_gc1Time = true && that.isSetGc1Time();
- if (this_present_gc1Time || that_present_gc1Time) {
- if (!(this_present_gc1Time && that_present_gc1Time))
- return false;
- if (this.gc1Time != that.gc1Time)
- return false;
- }
-
- boolean this_present_gc2Count = true && this.isSetGc2Count();
- boolean that_present_gc2Count = true && that.isSetGc2Count();
- if (this_present_gc2Count || that_present_gc2Count) {
- if (!(this_present_gc2Count && that_present_gc2Count))
- return false;
- if (this.gc2Count != that.gc2Count)
- return false;
- }
-
- boolean this_present_gc2Time = true && this.isSetGc2Time();
- boolean that_present_gc2Time = true && that.isSetGc2Time();
- if (this_present_gc2Time || that_present_gc2Time) {
- if (!(this_present_gc2Time && that_present_gc2Time))
- return false;
- if (this.gc2Time != that.gc2Time)
- return false;
- }
-
- boolean this_present_heapUsed = true;
- boolean that_present_heapUsed = true;
- if (this_present_heapUsed || that_present_heapUsed) {
- if (!(this_present_heapUsed && that_present_heapUsed))
- return false;
- if (this.heapUsed != that.heapUsed)
- return false;
- }
-
- boolean this_present_heapCommitted = true;
- boolean that_present_heapCommitted = true;
- if (this_present_heapCommitted || that_present_heapCommitted) {
- if (!(this_present_heapCommitted && that_present_heapCommitted))
- return false;
- if (this.heapCommitted != that.heapCommitted)
- return false;
- }
-
- boolean this_present_nonHeapUsed = true;
- boolean that_present_nonHeapUsed = true;
- if (this_present_nonHeapUsed || that_present_nonHeapUsed) {
- if (!(this_present_nonHeapUsed && that_present_nonHeapUsed))
- return false;
- if (this.nonHeapUsed != that.nonHeapUsed)
- return false;
- }
-
- boolean this_present_nonHeapCommitted = true;
- boolean that_present_nonHeapCommitted = true;
- if (this_present_nonHeapCommitted || that_present_nonHeapCommitted) {
- if (!(this_present_nonHeapCommitted && that_present_nonHeapCommitted))
- return false;
- if (this.nonHeapCommitted != that.nonHeapCommitted)
- return false;
- }
-
- boolean this_present_processCPUTime = true && this.isSetProcessCPUTime();
- boolean that_present_processCPUTime = true && that.isSetProcessCPUTime();
- if (this_present_processCPUTime || that_present_processCPUTime) {
- if (!(this_present_processCPUTime && that_present_processCPUTime))
- return false;
- if (this.processCPUTime != that.processCPUTime)
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- public int compareTo(JVMInfoThriftDTO other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- JVMInfoThriftDTO typedOther = (JVMInfoThriftDTO)other;
-
- lastComparison = Boolean.valueOf(isSetAgentHashCode()).compareTo(typedOther.isSetAgentHashCode());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAgentHashCode()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.agentHashCode, typedOther.agentHashCode);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetDataTime()).compareTo(typedOther.isSetDataTime());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetDataTime()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataTime, typedOther.dataTime);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetActiveThreadCount()).compareTo(typedOther.isSetActiveThreadCount());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetActiveThreadCount()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.activeThreadCount, typedOther.activeThreadCount);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGc1Count()).compareTo(typedOther.isSetGc1Count());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGc1Count()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gc1Count, typedOther.gc1Count);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGc1Time()).compareTo(typedOther.isSetGc1Time());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGc1Time()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gc1Time, typedOther.gc1Time);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGc2Count()).compareTo(typedOther.isSetGc2Count());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGc2Count()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gc2Count, typedOther.gc2Count);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGc2Time()).compareTo(typedOther.isSetGc2Time());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGc2Time()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gc2Time, typedOther.gc2Time);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetHeapUsed()).compareTo(typedOther.isSetHeapUsed());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetHeapUsed()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.heapUsed, typedOther.heapUsed);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetHeapCommitted()).compareTo(typedOther.isSetHeapCommitted());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetHeapCommitted()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.heapCommitted, typedOther.heapCommitted);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetNonHeapUsed()).compareTo(typedOther.isSetNonHeapUsed());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetNonHeapUsed()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nonHeapUsed, typedOther.nonHeapUsed);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetNonHeapCommitted()).compareTo(typedOther.isSetNonHeapCommitted());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetNonHeapCommitted()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nonHeapCommitted, typedOther.nonHeapCommitted);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetProcessCPUTime()).compareTo(typedOther.isSetProcessCPUTime());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetProcessCPUTime()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.processCPUTime, typedOther.processCPUTime);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("JVMInfoThriftDTO(");
- boolean first = true;
-
- sb.append("agentHashCode:");
- sb.append(this.agentHashCode);
- first = false;
- if (!first) sb.append(", ");
- sb.append("dataTime:");
- sb.append(this.dataTime);
- first = false;
- if (!first) sb.append(", ");
- sb.append("activeThreadCount:");
- sb.append(this.activeThreadCount);
- first = false;
- if (isSetGc1Count()) {
- if (!first) sb.append(", ");
- sb.append("gc1Count:");
- sb.append(this.gc1Count);
- first = false;
- }
- if (isSetGc1Time()) {
- if (!first) sb.append(", ");
- sb.append("gc1Time:");
- sb.append(this.gc1Time);
- first = false;
- }
- if (isSetGc2Count()) {
- if (!first) sb.append(", ");
- sb.append("gc2Count:");
- sb.append(this.gc2Count);
- first = false;
- }
- if (isSetGc2Time()) {
- if (!first) sb.append(", ");
- sb.append("gc2Time:");
- sb.append(this.gc2Time);
- first = false;
- }
- if (!first) sb.append(", ");
- sb.append("heapUsed:");
- sb.append(this.heapUsed);
- first = false;
- if (!first) sb.append(", ");
- sb.append("heapCommitted:");
- sb.append(this.heapCommitted);
- first = false;
- if (!first) sb.append(", ");
- sb.append("nonHeapUsed:");
- sb.append(this.nonHeapUsed);
- first = false;
- if (!first) sb.append(", ");
- sb.append("nonHeapCommitted:");
- sb.append(this.nonHeapCommitted);
- first = false;
- if (isSetProcessCPUTime()) {
- if (!first) sb.append(", ");
- sb.append("processCPUTime:");
- sb.append(this.processCPUTime);
- first = false;
- }
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
- __isset_bit_vector = new BitSet(1);
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class JVMInfoThriftDTOStandardSchemeFactory implements SchemeFactory {
- public JVMInfoThriftDTOStandardScheme getScheme() {
- return new JVMInfoThriftDTOStandardScheme();
- }
- }
-
- private static class JVMInfoThriftDTOStandardScheme extends StandardScheme {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, JVMInfoThriftDTO struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // AGENT_HASH_CODE
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.agentHashCode = iprot.readI32();
- struct.setAgentHashCodeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // DATA_TIME
- if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
- struct.dataTime = iprot.readI64();
- struct.setDataTimeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ACTIVE_THREAD_COUNT
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.activeThreadCount = iprot.readI32();
- struct.setActiveThreadCountIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // GC1_COUNT
- if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
- struct.gc1Count = iprot.readI64();
- struct.setGc1CountIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // GC1_TIME
- if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
- struct.gc1Time = iprot.readI64();
- struct.setGc1TimeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 6: // GC2_COUNT
- if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
- struct.gc2Count = iprot.readI64();
- struct.setGc2CountIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 7: // GC2_TIME
- if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
- struct.gc2Time = iprot.readI64();
- struct.setGc2TimeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 8: // HEAP_USED
- if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
- struct.heapUsed = iprot.readI64();
- struct.setHeapUsedIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 9: // HEAP_COMMITTED
- if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
- struct.heapCommitted = iprot.readI64();
- struct.setHeapCommittedIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 10: // NON_HEAP_USED
- if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
- struct.nonHeapUsed = iprot.readI64();
- struct.setNonHeapUsedIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 11: // NON_HEAP_COMMITTED
- if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
- struct.nonHeapCommitted = iprot.readI64();
- struct.setNonHeapCommittedIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 12: // PROCESS_CPUTIME
- if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
- struct.processCPUTime = iprot.readDouble();
- struct.setProcessCPUTimeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, JVMInfoThriftDTO struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(AGENT_HASH_CODE_FIELD_DESC);
- oprot.writeI32(struct.agentHashCode);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(DATA_TIME_FIELD_DESC);
- oprot.writeI64(struct.dataTime);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(ACTIVE_THREAD_COUNT_FIELD_DESC);
- oprot.writeI32(struct.activeThreadCount);
- oprot.writeFieldEnd();
- if (struct.isSetGc1Count()) {
- oprot.writeFieldBegin(GC1_COUNT_FIELD_DESC);
- oprot.writeI64(struct.gc1Count);
- oprot.writeFieldEnd();
- }
- if (struct.isSetGc1Time()) {
- oprot.writeFieldBegin(GC1_TIME_FIELD_DESC);
- oprot.writeI64(struct.gc1Time);
- oprot.writeFieldEnd();
- }
- if (struct.isSetGc2Count()) {
- oprot.writeFieldBegin(GC2_COUNT_FIELD_DESC);
- oprot.writeI64(struct.gc2Count);
- oprot.writeFieldEnd();
- }
- if (struct.isSetGc2Time()) {
- oprot.writeFieldBegin(GC2_TIME_FIELD_DESC);
- oprot.writeI64(struct.gc2Time);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldBegin(HEAP_USED_FIELD_DESC);
- oprot.writeI64(struct.heapUsed);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(HEAP_COMMITTED_FIELD_DESC);
- oprot.writeI64(struct.heapCommitted);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(NON_HEAP_USED_FIELD_DESC);
- oprot.writeI64(struct.nonHeapUsed);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(NON_HEAP_COMMITTED_FIELD_DESC);
- oprot.writeI64(struct.nonHeapCommitted);
- oprot.writeFieldEnd();
- if (struct.isSetProcessCPUTime()) {
- oprot.writeFieldBegin(PROCESS_CPUTIME_FIELD_DESC);
- oprot.writeDouble(struct.processCPUTime);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class JVMInfoThriftDTOTupleSchemeFactory implements SchemeFactory {
- public JVMInfoThriftDTOTupleScheme getScheme() {
- return new JVMInfoThriftDTOTupleScheme();
- }
- }
-
- private static class JVMInfoThriftDTOTupleScheme extends TupleScheme {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, JVMInfoThriftDTO struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetAgentHashCode()) {
- optionals.set(0);
- }
- if (struct.isSetDataTime()) {
- optionals.set(1);
- }
- if (struct.isSetActiveThreadCount()) {
- optionals.set(2);
- }
- if (struct.isSetGc1Count()) {
- optionals.set(3);
- }
- if (struct.isSetGc1Time()) {
- optionals.set(4);
- }
- if (struct.isSetGc2Count()) {
- optionals.set(5);
- }
- if (struct.isSetGc2Time()) {
- optionals.set(6);
- }
- if (struct.isSetHeapUsed()) {
- optionals.set(7);
- }
- if (struct.isSetHeapCommitted()) {
- optionals.set(8);
- }
- if (struct.isSetNonHeapUsed()) {
- optionals.set(9);
- }
- if (struct.isSetNonHeapCommitted()) {
- optionals.set(10);
- }
- if (struct.isSetProcessCPUTime()) {
- optionals.set(11);
- }
- oprot.writeBitSet(optionals, 12);
- if (struct.isSetAgentHashCode()) {
- oprot.writeI32(struct.agentHashCode);
- }
- if (struct.isSetDataTime()) {
- oprot.writeI64(struct.dataTime);
- }
- if (struct.isSetActiveThreadCount()) {
- oprot.writeI32(struct.activeThreadCount);
- }
- if (struct.isSetGc1Count()) {
- oprot.writeI64(struct.gc1Count);
- }
- if (struct.isSetGc1Time()) {
- oprot.writeI64(struct.gc1Time);
- }
- if (struct.isSetGc2Count()) {
- oprot.writeI64(struct.gc2Count);
- }
- if (struct.isSetGc2Time()) {
- oprot.writeI64(struct.gc2Time);
- }
- if (struct.isSetHeapUsed()) {
- oprot.writeI64(struct.heapUsed);
- }
- if (struct.isSetHeapCommitted()) {
- oprot.writeI64(struct.heapCommitted);
- }
- if (struct.isSetNonHeapUsed()) {
- oprot.writeI64(struct.nonHeapUsed);
- }
- if (struct.isSetNonHeapCommitted()) {
- oprot.writeI64(struct.nonHeapCommitted);
- }
- if (struct.isSetProcessCPUTime()) {
- oprot.writeDouble(struct.processCPUTime);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, JVMInfoThriftDTO struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(12);
- if (incoming.get(0)) {
- struct.agentHashCode = iprot.readI32();
- struct.setAgentHashCodeIsSet(true);
- }
- if (incoming.get(1)) {
- struct.dataTime = iprot.readI64();
- struct.setDataTimeIsSet(true);
- }
- if (incoming.get(2)) {
- struct.activeThreadCount = iprot.readI32();
- struct.setActiveThreadCountIsSet(true);
- }
- if (incoming.get(3)) {
- struct.gc1Count = iprot.readI64();
- struct.setGc1CountIsSet(true);
- }
- if (incoming.get(4)) {
- struct.gc1Time = iprot.readI64();
- struct.setGc1TimeIsSet(true);
- }
- if (incoming.get(5)) {
- struct.gc2Count = iprot.readI64();
- struct.setGc2CountIsSet(true);
- }
- if (incoming.get(6)) {
- struct.gc2Time = iprot.readI64();
- struct.setGc2TimeIsSet(true);
- }
- if (incoming.get(7)) {
- struct.heapUsed = iprot.readI64();
- struct.setHeapUsedIsSet(true);
- }
- if (incoming.get(8)) {
- struct.heapCommitted = iprot.readI64();
- struct.setHeapCommittedIsSet(true);
- }
- if (incoming.get(9)) {
- struct.nonHeapUsed = iprot.readI64();
- struct.setNonHeapUsedIsSet(true);
- }
- if (incoming.get(10)) {
- struct.nonHeapCommitted = iprot.readI64();
- struct.setNonHeapCommittedIsSet(true);
- }
- if (incoming.get(11)) {
- struct.processCPUTime = iprot.readDouble();
- struct.setProcessCPUTimeIsSet(true);
- }
- }
- }
-
-}
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("JVMInfoThriftDTO");
+
+ private static final org.apache.thrift.protocol.TField AGENT_HASH_CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("agentHashCode", org.apache.thrift.protocol.TType.I32, (short)1);
+ private static final org.apache.thrift.protocol.TField DATA_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("dataTime", org.apache.thrift.protocol.TType.I64, (short)2);
+ private static final org.apache.thrift.protocol.TField ACTIVE_THREAD_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("activeThreadCount", org.apache.thrift.protocol.TType.I32, (short)3);
+ private static final org.apache.thrift.protocol.TField GC1_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("gc1Count", org.apache.thrift.protocol.TType.I64, (short)4);
+ private static final org.apache.thrift.protocol.TField GC1_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("gc1Time", org.apache.thrift.protocol.TType.I64, (short)5);
+ private static final org.apache.thrift.protocol.TField GC2_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("gc2Count", org.apache.thrift.protocol.TType.I64, (short)6);
+ private static final org.apache.thrift.protocol.TField GC2_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("gc2Time", org.apache.thrift.protocol.TType.I64, (short)7);
+ private static final org.apache.thrift.protocol.TField HEAP_USED_FIELD_DESC = new org.apache.thrift.protocol.TField("heapUsed", org.apache.thrift.protocol.TType.I64, (short)8);
+ private static final org.apache.thrift.protocol.TField HEAP_COMMITTED_FIELD_DESC = new org.apache.thrift.protocol.TField("heapCommitted", org.apache.thrift.protocol.TType.I64, (short)9);
+ private static final org.apache.thrift.protocol.TField NON_HEAP_USED_FIELD_DESC = new org.apache.thrift.protocol.TField("nonHeapUsed", org.apache.thrift.protocol.TType.I64, (short)10);
+ private static final org.apache.thrift.protocol.TField NON_HEAP_COMMITTED_FIELD_DESC = new org.apache.thrift.protocol.TField("nonHeapCommitted", org.apache.thrift.protocol.TType.I64, (short)11);
+ private static final org.apache.thrift.protocol.TField PROCESS_CPUTIME_FIELD_DESC = new org.apache.thrift.protocol.TField("processCPUTime", org.apache.thrift.protocol.TType.DOUBLE, (short)12);
+
+ private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
+
+ static {
+ schemes.put(StandardScheme.class,
+ new JVMInfoThriftDTOStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new JVMInfoThriftDTOTupleSchemeFactory());
+ }
+
+ public int agentHashCode; // required
+ public long dataTime; // required
+ public int activeThreadCount; // required
+ public long gc1Count; // optional
+ public long gc1Time; // optional
+ public long gc2Count; // optional
+ public long gc2Time; // optional
+ public long heapUsed; // required
+ public long heapCommitted; // required
+ public long nonHeapUsed; // required
+ public long nonHeapCommitted; // required
+ public double processCPUTime; // optional
+
+ /**
+ * The set of fields this struct contains, along with convenience methods
+ * for finding and manipulating them.
+ */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ AGENT_HASH_CODE((short) 1, "agentHashCode"), DATA_TIME((short) 2,
+ "dataTime"), ACTIVE_THREAD_COUNT((short) 3, "activeThreadCount"), GC1_COUNT(
+ (short) 4, "gc1Count"), GC1_TIME((short) 5, "gc1Time"), GC2_COUNT(
+ (short) 6, "gc2Count"), GC2_TIME((short) 7, "gc2Time"), HEAP_USED(
+ (short) 8, "heapUsed"), HEAP_COMMITTED((short) 9,
+ "heapCommitted"), NON_HEAP_USED((short) 10, "nonHeapUsed"), NON_HEAP_COMMITTED(
+ (short) 11, "nonHeapCommitted"), PROCESS_CPUTIME((short) 12,
+ "processCPUTime");
+
+ private static final Map byName = new HashMap();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not
+ * found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch (fieldId) {
+ case 1: // AGENT_HASH_CODE
+ return AGENT_HASH_CODE;
+ case 2: // DATA_TIME
+ return DATA_TIME;
+ case 3: // ACTIVE_THREAD_COUNT
+ return ACTIVE_THREAD_COUNT;
+ case 4: // GC1_COUNT
+ return GC1_COUNT;
+ case 5: // GC1_TIME
+ return GC1_TIME;
+ case 6: // GC2_COUNT
+ return GC2_COUNT;
+ case 7: // GC2_TIME
+ return GC2_TIME;
+ case 8: // HEAP_USED
+ return HEAP_USED;
+ case 9: // HEAP_COMMITTED
+ return HEAP_COMMITTED;
+ case 10: // NON_HEAP_USED
+ return NON_HEAP_USED;
+ case 11: // NON_HEAP_COMMITTED
+ return NON_HEAP_COMMITTED;
+ case 12: // PROCESS_CPUTIME
+ return PROCESS_CPUTIME;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null)
+ throw new IllegalArgumentException("Field " + fieldId
+ + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not
+ * found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __AGENTHASHCODE_ISSET_ID = 0;
+ private static final int __DATATIME_ISSET_ID = 1;
+ private static final int __ACTIVETHREADCOUNT_ISSET_ID = 2;
+ private static final int __GC1COUNT_ISSET_ID = 3;
+ private static final int __GC1TIME_ISSET_ID = 4;
+ private static final int __GC2COUNT_ISSET_ID = 5;
+ private static final int __GC2TIME_ISSET_ID = 6;
+ private static final int __HEAPUSED_ISSET_ID = 7;
+ private static final int __HEAPCOMMITTED_ISSET_ID = 8;
+ private static final int __NONHEAPUSED_ISSET_ID = 9;
+ private static final int __NONHEAPCOMMITTED_ISSET_ID = 10;
+ private static final int __PROCESSCPUTIME_ISSET_ID = 11;
+ private BitSet __isset_bit_vector = new BitSet(12);
+ private _Fields optionals[] = { _Fields.GC1_COUNT, _Fields.GC1_TIME,
+ _Fields.GC2_COUNT, _Fields.GC2_TIME, _Fields.PROCESS_CPUTIME };
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(
+ _Fields.class);
+ tmpMap.put(_Fields.AGENT_HASH_CODE,
+ new org.apache.thrift.meta_data.FieldMetaData("agentHashCode",
+ org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(
+ org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.DATA_TIME,
+ new org.apache.thrift.meta_data.FieldMetaData("dataTime",
+ org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(
+ org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.ACTIVE_THREAD_COUNT,
+ new org.apache.thrift.meta_data.FieldMetaData(
+ "activeThreadCount",
+ org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(
+ org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.GC1_COUNT,
+ new org.apache.thrift.meta_data.FieldMetaData("gc1Count",
+ org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(
+ org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.GC1_TIME,
+ new org.apache.thrift.meta_data.FieldMetaData("gc1Time",
+ org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(
+ org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.GC2_COUNT,
+ new org.apache.thrift.meta_data.FieldMetaData("gc2Count",
+ org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(
+ org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.GC2_TIME,
+ new org.apache.thrift.meta_data.FieldMetaData("gc2Time",
+ org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(
+ org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.HEAP_USED,
+ new org.apache.thrift.meta_data.FieldMetaData("heapUsed",
+ org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(
+ org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.HEAP_COMMITTED,
+ new org.apache.thrift.meta_data.FieldMetaData("heapCommitted",
+ org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(
+ org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.NON_HEAP_USED,
+ new org.apache.thrift.meta_data.FieldMetaData("nonHeapUsed",
+ org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(
+ org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.NON_HEAP_COMMITTED,
+ new org.apache.thrift.meta_data.FieldMetaData(
+ "nonHeapCommitted",
+ org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(
+ org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.PROCESS_CPUTIME,
+ new org.apache.thrift.meta_data.FieldMetaData("processCPUTime",
+ org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(
+ org.apache.thrift.protocol.TType.DOUBLE)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(
+ JVMInfoThriftDTO.class, metaDataMap);
+ }
+
+ public JVMInfoThriftDTO() {
+ }
+
+ public JVMInfoThriftDTO(int agentHashCode, long dataTime,
+ int activeThreadCount, long heapUsed, long heapCommitted,
+ long nonHeapUsed, long nonHeapCommitted) {
+ this();
+ this.agentHashCode = agentHashCode;
+ setAgentHashCodeIsSet(true);
+ this.dataTime = dataTime;
+ setDataTimeIsSet(true);
+ this.activeThreadCount = activeThreadCount;
+ setActiveThreadCountIsSet(true);
+ this.heapUsed = heapUsed;
+ setHeapUsedIsSet(true);
+ this.heapCommitted = heapCommitted;
+ setHeapCommittedIsSet(true);
+ this.nonHeapUsed = nonHeapUsed;
+ setNonHeapUsedIsSet(true);
+ this.nonHeapCommitted = nonHeapCommitted;
+ setNonHeapCommittedIsSet(true);
+ }
+
+ /**
+ * Performs a deep copy on other.
+ */
+ public JVMInfoThriftDTO(JVMInfoThriftDTO other) {
+ __isset_bit_vector.clear();
+ __isset_bit_vector.or(other.__isset_bit_vector);
+ this.agentHashCode = other.agentHashCode;
+ this.dataTime = other.dataTime;
+ this.activeThreadCount = other.activeThreadCount;
+ this.gc1Count = other.gc1Count;
+ this.gc1Time = other.gc1Time;
+ this.gc2Count = other.gc2Count;
+ this.gc2Time = other.gc2Time;
+ this.heapUsed = other.heapUsed;
+ this.heapCommitted = other.heapCommitted;
+ this.nonHeapUsed = other.nonHeapUsed;
+ this.nonHeapCommitted = other.nonHeapCommitted;
+ this.processCPUTime = other.processCPUTime;
+ }
+
+ public JVMInfoThriftDTO deepCopy() {
+ return new JVMInfoThriftDTO(this);
+ }
+
+ @Override
+ public void clear() {
+ setAgentHashCodeIsSet(false);
+ this.agentHashCode = 0;
+ setDataTimeIsSet(false);
+ this.dataTime = 0;
+ setActiveThreadCountIsSet(false);
+ this.activeThreadCount = 0;
+ setGc1CountIsSet(false);
+ this.gc1Count = 0;
+ setGc1TimeIsSet(false);
+ this.gc1Time = 0;
+ setGc2CountIsSet(false);
+ this.gc2Count = 0;
+ setGc2TimeIsSet(false);
+ this.gc2Time = 0;
+ setHeapUsedIsSet(false);
+ this.heapUsed = 0;
+ setHeapCommittedIsSet(false);
+ this.heapCommitted = 0;
+ setNonHeapUsedIsSet(false);
+ this.nonHeapUsed = 0;
+ setNonHeapCommittedIsSet(false);
+ this.nonHeapCommitted = 0;
+ setProcessCPUTimeIsSet(false);
+ this.processCPUTime = 0.0;
+ }
+
+ public int getAgentHashCode() {
+ return this.agentHashCode;
+ }
+
+ public JVMInfoThriftDTO setAgentHashCode(int agentHashCode) {
+ this.agentHashCode = agentHashCode;
+ setAgentHashCodeIsSet(true);
+ return this;
+ }
+
+ public void unsetAgentHashCode() {
+ __isset_bit_vector.clear(__AGENTHASHCODE_ISSET_ID);
+ }
+
+ /**
+ * Returns true if field agentHashCode is set (has been assigned a value)
+ * and false otherwise
+ */
+ public boolean isSetAgentHashCode() {
+ return __isset_bit_vector.get(__AGENTHASHCODE_ISSET_ID);
+ }
+
+ public void setAgentHashCodeIsSet(boolean value) {
+ __isset_bit_vector.set(__AGENTHASHCODE_ISSET_ID, value);
+ }
+
+ public long getDataTime() {
+ return this.dataTime;
+ }
+
+ public JVMInfoThriftDTO setDataTime(long dataTime) {
+ this.dataTime = dataTime;
+ setDataTimeIsSet(true);
+ return this;
+ }
+
+ public void unsetDataTime() {
+ __isset_bit_vector.clear(__DATATIME_ISSET_ID);
+ }
+
+ /**
+ * Returns true if field dataTime is set (has been assigned a value) and
+ * false otherwise
+ */
+ public boolean isSetDataTime() {
+ return __isset_bit_vector.get(__DATATIME_ISSET_ID);
+ }
+
+ public void setDataTimeIsSet(boolean value) {
+ __isset_bit_vector.set(__DATATIME_ISSET_ID, value);
+ }
+
+ public int getActiveThreadCount() {
+ return this.activeThreadCount;
+ }
+
+ public JVMInfoThriftDTO setActiveThreadCount(int activeThreadCount) {
+ this.activeThreadCount = activeThreadCount;
+ setActiveThreadCountIsSet(true);
+ return this;
+ }
+
+ public void unsetActiveThreadCount() {
+ __isset_bit_vector.clear(__ACTIVETHREADCOUNT_ISSET_ID);
+ }
+
+ /**
+ * Returns true if field activeThreadCount is set (has been assigned a
+ * value) and false otherwise
+ */
+ public boolean isSetActiveThreadCount() {
+ return __isset_bit_vector.get(__ACTIVETHREADCOUNT_ISSET_ID);
+ }
+
+ public void setActiveThreadCountIsSet(boolean value) {
+ __isset_bit_vector.set(__ACTIVETHREADCOUNT_ISSET_ID, value);
+ }
+
+ public long getGc1Count() {
+ return this.gc1Count;
+ }
+
+ public JVMInfoThriftDTO setGc1Count(long gc1Count) {
+ this.gc1Count = gc1Count;
+ setGc1CountIsSet(true);
+ return this;
+ }
+
+ public void unsetGc1Count() {
+ __isset_bit_vector.clear(__GC1COUNT_ISSET_ID);
+ }
+
+ /**
+ * Returns true if field gc1Count is set (has been assigned a value) and
+ * false otherwise
+ */
+ public boolean isSetGc1Count() {
+ return __isset_bit_vector.get(__GC1COUNT_ISSET_ID);
+ }
+
+ public void setGc1CountIsSet(boolean value) {
+ __isset_bit_vector.set(__GC1COUNT_ISSET_ID, value);
+ }
+
+ public long getGc1Time() {
+ return this.gc1Time;
+ }
+
+ public JVMInfoThriftDTO setGc1Time(long gc1Time) {
+ this.gc1Time = gc1Time;
+ setGc1TimeIsSet(true);
+ return this;
+ }
+
+ public void unsetGc1Time() {
+ __isset_bit_vector.clear(__GC1TIME_ISSET_ID);
+ }
+
+ /**
+ * Returns true if field gc1Time is set (has been assigned a value) and
+ * false otherwise
+ */
+ public boolean isSetGc1Time() {
+ return __isset_bit_vector.get(__GC1TIME_ISSET_ID);
+ }
+
+ public void setGc1TimeIsSet(boolean value) {
+ __isset_bit_vector.set(__GC1TIME_ISSET_ID, value);
+ }
+
+ public long getGc2Count() {
+ return this.gc2Count;
+ }
+
+ public JVMInfoThriftDTO setGc2Count(long gc2Count) {
+ this.gc2Count = gc2Count;
+ setGc2CountIsSet(true);
+ return this;
+ }
+
+ public void unsetGc2Count() {
+ __isset_bit_vector.clear(__GC2COUNT_ISSET_ID);
+ }
+
+ /**
+ * Returns true if field gc2Count is set (has been assigned a value) and
+ * false otherwise
+ */
+ public boolean isSetGc2Count() {
+ return __isset_bit_vector.get(__GC2COUNT_ISSET_ID);
+ }
+
+ public void setGc2CountIsSet(boolean value) {
+ __isset_bit_vector.set(__GC2COUNT_ISSET_ID, value);
+ }
+
+ public long getGc2Time() {
+ return this.gc2Time;
+ }
+
+ public JVMInfoThriftDTO setGc2Time(long gc2Time) {
+ this.gc2Time = gc2Time;
+ setGc2TimeIsSet(true);
+ return this;
+ }
+
+ public void unsetGc2Time() {
+ __isset_bit_vector.clear(__GC2TIME_ISSET_ID);
+ }
+
+ /**
+ * Returns true if field gc2Time is set (has been assigned a value) and
+ * false otherwise
+ */
+ public boolean isSetGc2Time() {
+ return __isset_bit_vector.get(__GC2TIME_ISSET_ID);
+ }
+
+ public void setGc2TimeIsSet(boolean value) {
+ __isset_bit_vector.set(__GC2TIME_ISSET_ID, value);
+ }
+
+ public long getHeapUsed() {
+ return this.heapUsed;
+ }
+
+ public JVMInfoThriftDTO setHeapUsed(long heapUsed) {
+ this.heapUsed = heapUsed;
+ setHeapUsedIsSet(true);
+ return this;
+ }
+
+ public void unsetHeapUsed() {
+ __isset_bit_vector.clear(__HEAPUSED_ISSET_ID);
+ }
+
+ /**
+ * Returns true if field heapUsed is set (has been assigned a value) and
+ * false otherwise
+ */
+ public boolean isSetHeapUsed() {
+ return __isset_bit_vector.get(__HEAPUSED_ISSET_ID);
+ }
+
+ public void setHeapUsedIsSet(boolean value) {
+ __isset_bit_vector.set(__HEAPUSED_ISSET_ID, value);
+ }
+
+ public long getHeapCommitted() {
+ return this.heapCommitted;
+ }
+
+ public JVMInfoThriftDTO setHeapCommitted(long heapCommitted) {
+ this.heapCommitted = heapCommitted;
+ setHeapCommittedIsSet(true);
+ return this;
+ }
+
+ public void unsetHeapCommitted() {
+ __isset_bit_vector.clear(__HEAPCOMMITTED_ISSET_ID);
+ }
+
+ /**
+ * Returns true if field heapCommitted is set (has been assigned a value)
+ * and false otherwise
+ */
+ public boolean isSetHeapCommitted() {
+ return __isset_bit_vector.get(__HEAPCOMMITTED_ISSET_ID);
+ }
+
+ public void setHeapCommittedIsSet(boolean value) {
+ __isset_bit_vector.set(__HEAPCOMMITTED_ISSET_ID, value);
+ }
+
+ public long getNonHeapUsed() {
+ return this.nonHeapUsed;
+ }
+
+ public JVMInfoThriftDTO setNonHeapUsed(long nonHeapUsed) {
+ this.nonHeapUsed = nonHeapUsed;
+ setNonHeapUsedIsSet(true);
+ return this;
+ }
+
+ public void unsetNonHeapUsed() {
+ __isset_bit_vector.clear(__NONHEAPUSED_ISSET_ID);
+ }
+
+ /**
+ * Returns true if field nonHeapUsed is set (has been assigned a value) and
+ * false otherwise
+ */
+ public boolean isSetNonHeapUsed() {
+ return __isset_bit_vector.get(__NONHEAPUSED_ISSET_ID);
+ }
+
+ public void setNonHeapUsedIsSet(boolean value) {
+ __isset_bit_vector.set(__NONHEAPUSED_ISSET_ID, value);
+ }
+
+ public long getNonHeapCommitted() {
+ return this.nonHeapCommitted;
+ }
+
+ public JVMInfoThriftDTO setNonHeapCommitted(long nonHeapCommitted) {
+ this.nonHeapCommitted = nonHeapCommitted;
+ setNonHeapCommittedIsSet(true);
+ return this;
+ }
+
+ public void unsetNonHeapCommitted() {
+ __isset_bit_vector.clear(__NONHEAPCOMMITTED_ISSET_ID);
+ }
+
+ /**
+ * Returns true if field nonHeapCommitted is set (has been assigned a value)
+ * and false otherwise
+ */
+ public boolean isSetNonHeapCommitted() {
+ return __isset_bit_vector.get(__NONHEAPCOMMITTED_ISSET_ID);
+ }
+
+ public void setNonHeapCommittedIsSet(boolean value) {
+ __isset_bit_vector.set(__NONHEAPCOMMITTED_ISSET_ID, value);
+ }
+
+ public double getProcessCPUTime() {
+ return this.processCPUTime;
+ }
+
+ public JVMInfoThriftDTO setProcessCPUTime(double processCPUTime) {
+ this.processCPUTime = processCPUTime;
+ setProcessCPUTimeIsSet(true);
+ return this;
+ }
+
+ public void unsetProcessCPUTime() {
+ __isset_bit_vector.clear(__PROCESSCPUTIME_ISSET_ID);
+ }
+
+ /**
+ * Returns true if field processCPUTime is set (has been assigned a value)
+ * and false otherwise
+ */
+ public boolean isSetProcessCPUTime() {
+ return __isset_bit_vector.get(__PROCESSCPUTIME_ISSET_ID);
+ }
+
+ public void setProcessCPUTimeIsSet(boolean value) {
+ __isset_bit_vector.set(__PROCESSCPUTIME_ISSET_ID, value);
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case AGENT_HASH_CODE:
+ if (value == null) {
+ unsetAgentHashCode();
+ } else {
+ setAgentHashCode((Integer) value);
+ }
+ break;
+
+ case DATA_TIME:
+ if (value == null) {
+ unsetDataTime();
+ } else {
+ setDataTime((Long) value);
+ }
+ break;
+
+ case ACTIVE_THREAD_COUNT:
+ if (value == null) {
+ unsetActiveThreadCount();
+ } else {
+ setActiveThreadCount((Integer) value);
+ }
+ break;
+
+ case GC1_COUNT:
+ if (value == null) {
+ unsetGc1Count();
+ } else {
+ setGc1Count((Long) value);
+ }
+ break;
+
+ case GC1_TIME:
+ if (value == null) {
+ unsetGc1Time();
+ } else {
+ setGc1Time((Long) value);
+ }
+ break;
+
+ case GC2_COUNT:
+ if (value == null) {
+ unsetGc2Count();
+ } else {
+ setGc2Count((Long) value);
+ }
+ break;
+
+ case GC2_TIME:
+ if (value == null) {
+ unsetGc2Time();
+ } else {
+ setGc2Time((Long) value);
+ }
+ break;
+
+ case HEAP_USED:
+ if (value == null) {
+ unsetHeapUsed();
+ } else {
+ setHeapUsed((Long) value);
+ }
+ break;
+
+ case HEAP_COMMITTED:
+ if (value == null) {
+ unsetHeapCommitted();
+ } else {
+ setHeapCommitted((Long) value);
+ }
+ break;
+
+ case NON_HEAP_USED:
+ if (value == null) {
+ unsetNonHeapUsed();
+ } else {
+ setNonHeapUsed((Long) value);
+ }
+ break;
+
+ case NON_HEAP_COMMITTED:
+ if (value == null) {
+ unsetNonHeapCommitted();
+ } else {
+ setNonHeapCommitted((Long) value);
+ }
+ break;
+
+ case PROCESS_CPUTIME:
+ if (value == null) {
+ unsetProcessCPUTime();
+ } else {
+ setProcessCPUTime((Double) value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case AGENT_HASH_CODE:
+ return Integer.valueOf(getAgentHashCode());
+
+ case DATA_TIME:
+ return Long.valueOf(getDataTime());
+
+ case ACTIVE_THREAD_COUNT:
+ return Integer.valueOf(getActiveThreadCount());
+
+ case GC1_COUNT:
+ return Long.valueOf(getGc1Count());
+
+ case GC1_TIME:
+ return Long.valueOf(getGc1Time());
+
+ case GC2_COUNT:
+ return Long.valueOf(getGc2Count());
+
+ case GC2_TIME:
+ return Long.valueOf(getGc2Time());
+
+ case HEAP_USED:
+ return Long.valueOf(getHeapUsed());
+
+ case HEAP_COMMITTED:
+ return Long.valueOf(getHeapCommitted());
+
+ case NON_HEAP_USED:
+ return Long.valueOf(getNonHeapUsed());
+
+ case NON_HEAP_COMMITTED:
+ return Long.valueOf(getNonHeapCommitted());
+
+ case PROCESS_CPUTIME:
+ return Double.valueOf(getProcessCPUTime());
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * Returns true if field corresponding to fieldID is set (has been assigned
+ * a value) and false otherwise
+ */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case AGENT_HASH_CODE:
+ return isSetAgentHashCode();
+ case DATA_TIME:
+ return isSetDataTime();
+ case ACTIVE_THREAD_COUNT:
+ return isSetActiveThreadCount();
+ case GC1_COUNT:
+ return isSetGc1Count();
+ case GC1_TIME:
+ return isSetGc1Time();
+ case GC2_COUNT:
+ return isSetGc2Count();
+ case GC2_TIME:
+ return isSetGc2Time();
+ case HEAP_USED:
+ return isSetHeapUsed();
+ case HEAP_COMMITTED:
+ return isSetHeapCommitted();
+ case NON_HEAP_USED:
+ return isSetNonHeapUsed();
+ case NON_HEAP_COMMITTED:
+ return isSetNonHeapCommitted();
+ case PROCESS_CPUTIME:
+ return isSetProcessCPUTime();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof JVMInfoThriftDTO)
+ return this.equals((JVMInfoThriftDTO) that);
+ return false;
+ }
+
+ public boolean equals(JVMInfoThriftDTO that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_agentHashCode = true;
+ boolean that_present_agentHashCode = true;
+ if (this_present_agentHashCode || that_present_agentHashCode) {
+ if (!(this_present_agentHashCode && that_present_agentHashCode))
+ return false;
+ if (this.agentHashCode != that.agentHashCode)
+ return false;
+ }
+
+ boolean this_present_dataTime = true;
+ boolean that_present_dataTime = true;
+ if (this_present_dataTime || that_present_dataTime) {
+ if (!(this_present_dataTime && that_present_dataTime))
+ return false;
+ if (this.dataTime != that.dataTime)
+ return false;
+ }
+
+ boolean this_present_activeThreadCount = true;
+ boolean that_present_activeThreadCount = true;
+ if (this_present_activeThreadCount || that_present_activeThreadCount) {
+ if (!(this_present_activeThreadCount && that_present_activeThreadCount))
+ return false;
+ if (this.activeThreadCount != that.activeThreadCount)
+ return false;
+ }
+
+ boolean this_present_gc1Count = true && this.isSetGc1Count();
+ boolean that_present_gc1Count = true && that.isSetGc1Count();
+ if (this_present_gc1Count || that_present_gc1Count) {
+ if (!(this_present_gc1Count && that_present_gc1Count))
+ return false;
+ if (this.gc1Count != that.gc1Count)
+ return false;
+ }
+
+ boolean this_present_gc1Time = true && this.isSetGc1Time();
+ boolean that_present_gc1Time = true && that.isSetGc1Time();
+ if (this_present_gc1Time || that_present_gc1Time) {
+ if (!(this_present_gc1Time && that_present_gc1Time))
+ return false;
+ if (this.gc1Time != that.gc1Time)
+ return false;
+ }
+
+ boolean this_present_gc2Count = true && this.isSetGc2Count();
+ boolean that_present_gc2Count = true && that.isSetGc2Count();
+ if (this_present_gc2Count || that_present_gc2Count) {
+ if (!(this_present_gc2Count && that_present_gc2Count))
+ return false;
+ if (this.gc2Count != that.gc2Count)
+ return false;
+ }
+
+ boolean this_present_gc2Time = true && this.isSetGc2Time();
+ boolean that_present_gc2Time = true && that.isSetGc2Time();
+ if (this_present_gc2Time || that_present_gc2Time) {
+ if (!(this_present_gc2Time && that_present_gc2Time))
+ return false;
+ if (this.gc2Time != that.gc2Time)
+ return false;
+ }
+
+ boolean this_present_heapUsed = true;
+ boolean that_present_heapUsed = true;
+ if (this_present_heapUsed || that_present_heapUsed) {
+ if (!(this_present_heapUsed && that_present_heapUsed))
+ return false;
+ if (this.heapUsed != that.heapUsed)
+ return false;
+ }
+
+ boolean this_present_heapCommitted = true;
+ boolean that_present_heapCommitted = true;
+ if (this_present_heapCommitted || that_present_heapCommitted) {
+ if (!(this_present_heapCommitted && that_present_heapCommitted))
+ return false;
+ if (this.heapCommitted != that.heapCommitted)
+ return false;
+ }
+
+ boolean this_present_nonHeapUsed = true;
+ boolean that_present_nonHeapUsed = true;
+ if (this_present_nonHeapUsed || that_present_nonHeapUsed) {
+ if (!(this_present_nonHeapUsed && that_present_nonHeapUsed))
+ return false;
+ if (this.nonHeapUsed != that.nonHeapUsed)
+ return false;
+ }
+
+ boolean this_present_nonHeapCommitted = true;
+ boolean that_present_nonHeapCommitted = true;
+ if (this_present_nonHeapCommitted || that_present_nonHeapCommitted) {
+ if (!(this_present_nonHeapCommitted && that_present_nonHeapCommitted))
+ return false;
+ if (this.nonHeapCommitted != that.nonHeapCommitted)
+ return false;
+ }
+
+ boolean this_present_processCPUTime = true && this
+ .isSetProcessCPUTime();
+ boolean that_present_processCPUTime = true && that
+ .isSetProcessCPUTime();
+ if (this_present_processCPUTime || that_present_processCPUTime) {
+ if (!(this_present_processCPUTime && that_present_processCPUTime))
+ return false;
+ if (this.processCPUTime != that.processCPUTime)
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ public int compareTo(JVMInfoThriftDTO other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ JVMInfoThriftDTO typedOther = (JVMInfoThriftDTO) other;
+
+ lastComparison = Boolean.valueOf(isSetAgentHashCode()).compareTo(
+ typedOther.isSetAgentHashCode());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAgentHashCode()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(
+ this.agentHashCode, typedOther.agentHashCode);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetDataTime()).compareTo(
+ typedOther.isSetDataTime());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetDataTime()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(
+ this.dataTime, typedOther.dataTime);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetActiveThreadCount()).compareTo(
+ typedOther.isSetActiveThreadCount());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetActiveThreadCount()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(
+ this.activeThreadCount, typedOther.activeThreadCount);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGc1Count()).compareTo(
+ typedOther.isSetGc1Count());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGc1Count()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(
+ this.gc1Count, typedOther.gc1Count);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGc1Time()).compareTo(
+ typedOther.isSetGc1Time());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGc1Time()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(
+ this.gc1Time, typedOther.gc1Time);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGc2Count()).compareTo(
+ typedOther.isSetGc2Count());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGc2Count()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(
+ this.gc2Count, typedOther.gc2Count);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGc2Time()).compareTo(
+ typedOther.isSetGc2Time());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGc2Time()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(
+ this.gc2Time, typedOther.gc2Time);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetHeapUsed()).compareTo(
+ typedOther.isSetHeapUsed());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetHeapUsed()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(
+ this.heapUsed, typedOther.heapUsed);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetHeapCommitted()).compareTo(
+ typedOther.isSetHeapCommitted());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetHeapCommitted()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(
+ this.heapCommitted, typedOther.heapCommitted);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetNonHeapUsed()).compareTo(
+ typedOther.isSetNonHeapUsed());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetNonHeapUsed()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(
+ this.nonHeapUsed, typedOther.nonHeapUsed);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetNonHeapCommitted()).compareTo(
+ typedOther.isSetNonHeapCommitted());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetNonHeapCommitted()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(
+ this.nonHeapCommitted, typedOther.nonHeapCommitted);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetProcessCPUTime()).compareTo(
+ typedOther.isSetProcessCPUTime());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProcessCPUTime()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(
+ this.processCPUTime, typedOther.processCPUTime);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot)
+ throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot)
+ throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("JVMInfoThriftDTO(");
+ boolean first = true;
+
+ sb.append("agentHashCode:");
+ sb.append(this.agentHashCode);
+ first = false;
+ if (!first)
+ sb.append(", ");
+ sb.append("dataTime:");
+ sb.append(this.dataTime);
+ first = false;
+ if (!first)
+ sb.append(", ");
+ sb.append("activeThreadCount:");
+ sb.append(this.activeThreadCount);
+ first = false;
+ if (isSetGc1Count()) {
+ if (!first)
+ sb.append(", ");
+ sb.append("gc1Count:");
+ sb.append(this.gc1Count);
+ first = false;
+ }
+ if (isSetGc1Time()) {
+ if (!first)
+ sb.append(", ");
+ sb.append("gc1Time:");
+ sb.append(this.gc1Time);
+ first = false;
+ }
+ if (isSetGc2Count()) {
+ if (!first)
+ sb.append(", ");
+ sb.append("gc2Count:");
+ sb.append(this.gc2Count);
+ first = false;
+ }
+ if (isSetGc2Time()) {
+ if (!first)
+ sb.append(", ");
+ sb.append("gc2Time:");
+ sb.append(this.gc2Time);
+ first = false;
+ }
+ if (!first)
+ sb.append(", ");
+ sb.append("heapUsed:");
+ sb.append(this.heapUsed);
+ first = false;
+ if (!first)
+ sb.append(", ");
+ sb.append("heapCommitted:");
+ sb.append(this.heapCommitted);
+ first = false;
+ if (!first)
+ sb.append(", ");
+ sb.append("nonHeapUsed:");
+ sb.append(this.nonHeapUsed);
+ first = false;
+ if (!first)
+ sb.append(", ");
+ sb.append("nonHeapCommitted:");
+ sb.append(this.nonHeapCommitted);
+ first = false;
+ if (isSetProcessCPUTime()) {
+ if (!first)
+ sb.append(", ");
+ sb.append("processCPUTime:");
+ sb.append(this.processCPUTime);
+ first = false;
+ }
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out)
+ throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(
+ new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in)
+ throws java.io.IOException, ClassNotFoundException {
+ try {
+ // it doesn't seem like you should have to do this, but java
+ // serialization is wacky, and doesn't call the default constructor.
+ __isset_bit_vector = new BitSet(1);
+ read(new org.apache.thrift.protocol.TCompactProtocol(
+ new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class JVMInfoThriftDTOStandardSchemeFactory implements
+ SchemeFactory {
+ public JVMInfoThriftDTOStandardScheme getScheme() {
+ return new JVMInfoThriftDTOStandardScheme();
+ }
+ }
+
+ private static class JVMInfoThriftDTOStandardScheme extends
+ StandardScheme {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot,
+ JVMInfoThriftDTO struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true) {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // AGENT_HASH_CODE
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.agentHashCode = iprot.readI32();
+ struct.setAgentHashCodeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
+ schemeField.type);
+ }
+ break;
+ case 2: // DATA_TIME
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.dataTime = iprot.readI64();
+ struct.setDataTimeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
+ schemeField.type);
+ }
+ break;
+ case 3: // ACTIVE_THREAD_COUNT
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.activeThreadCount = iprot.readI32();
+ struct.setActiveThreadCountIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
+ schemeField.type);
+ }
+ break;
+ case 4: // GC1_COUNT
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.gc1Count = iprot.readI64();
+ struct.setGc1CountIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
+ schemeField.type);
+ }
+ break;
+ case 5: // GC1_TIME
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.gc1Time = iprot.readI64();
+ struct.setGc1TimeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
+ schemeField.type);
+ }
+ break;
+ case 6: // GC2_COUNT
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.gc2Count = iprot.readI64();
+ struct.setGc2CountIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
+ schemeField.type);
+ }
+ break;
+ case 7: // GC2_TIME
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.gc2Time = iprot.readI64();
+ struct.setGc2TimeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
+ schemeField.type);
+ }
+ break;
+ case 8: // HEAP_USED
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.heapUsed = iprot.readI64();
+ struct.setHeapUsedIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
+ schemeField.type);
+ }
+ break;
+ case 9: // HEAP_COMMITTED
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.heapCommitted = iprot.readI64();
+ struct.setHeapCommittedIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
+ schemeField.type);
+ }
+ break;
+ case 10: // NON_HEAP_USED
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.nonHeapUsed = iprot.readI64();
+ struct.setNonHeapUsedIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
+ schemeField.type);
+ }
+ break;
+ case 11: // NON_HEAP_COMMITTED
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.nonHeapCommitted = iprot.readI64();
+ struct.setNonHeapCommittedIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
+ schemeField.type);
+ }
+ break;
+ case 12: // PROCESS_CPUTIME
+ if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
+ struct.processCPUTime = iprot.readDouble();
+ struct.setProcessCPUTimeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
+ schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
+ schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be
+ // checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot,
+ JVMInfoThriftDTO struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(AGENT_HASH_CODE_FIELD_DESC);
+ oprot.writeI32(struct.agentHashCode);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(DATA_TIME_FIELD_DESC);
+ oprot.writeI64(struct.dataTime);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(ACTIVE_THREAD_COUNT_FIELD_DESC);
+ oprot.writeI32(struct.activeThreadCount);
+ oprot.writeFieldEnd();
+ if (struct.isSetGc1Count()) {
+ oprot.writeFieldBegin(GC1_COUNT_FIELD_DESC);
+ oprot.writeI64(struct.gc1Count);
+ oprot.writeFieldEnd();
+ }
+ if (struct.isSetGc1Time()) {
+ oprot.writeFieldBegin(GC1_TIME_FIELD_DESC);
+ oprot.writeI64(struct.gc1Time);
+ oprot.writeFieldEnd();
+ }
+ if (struct.isSetGc2Count()) {
+ oprot.writeFieldBegin(GC2_COUNT_FIELD_DESC);
+ oprot.writeI64(struct.gc2Count);
+ oprot.writeFieldEnd();
+ }
+ if (struct.isSetGc2Time()) {
+ oprot.writeFieldBegin(GC2_TIME_FIELD_DESC);
+ oprot.writeI64(struct.gc2Time);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldBegin(HEAP_USED_FIELD_DESC);
+ oprot.writeI64(struct.heapUsed);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(HEAP_COMMITTED_FIELD_DESC);
+ oprot.writeI64(struct.heapCommitted);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(NON_HEAP_USED_FIELD_DESC);
+ oprot.writeI64(struct.nonHeapUsed);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(NON_HEAP_COMMITTED_FIELD_DESC);
+ oprot.writeI64(struct.nonHeapCommitted);
+ oprot.writeFieldEnd();
+ if (struct.isSetProcessCPUTime()) {
+ oprot.writeFieldBegin(PROCESS_CPUTIME_FIELD_DESC);
+ oprot.writeDouble(struct.processCPUTime);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class JVMInfoThriftDTOTupleSchemeFactory implements
+ SchemeFactory {
+ public JVMInfoThriftDTOTupleScheme getScheme() {
+ return new JVMInfoThriftDTOTupleScheme();
+ }
+ }
+
+ private static class JVMInfoThriftDTOTupleScheme extends
+ TupleScheme {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot,
+ JVMInfoThriftDTO struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetAgentHashCode()) {
+ optionals.set(0);
+ }
+ if (struct.isSetDataTime()) {
+ optionals.set(1);
+ }
+ if (struct.isSetActiveThreadCount()) {
+ optionals.set(2);
+ }
+ if (struct.isSetGc1Count()) {
+ optionals.set(3);
+ }
+ if (struct.isSetGc1Time()) {
+ optionals.set(4);
+ }
+ if (struct.isSetGc2Count()) {
+ optionals.set(5);
+ }
+ if (struct.isSetGc2Time()) {
+ optionals.set(6);
+ }
+ if (struct.isSetHeapUsed()) {
+ optionals.set(7);
+ }
+ if (struct.isSetHeapCommitted()) {
+ optionals.set(8);
+ }
+ if (struct.isSetNonHeapUsed()) {
+ optionals.set(9);
+ }
+ if (struct.isSetNonHeapCommitted()) {
+ optionals.set(10);
+ }
+ if (struct.isSetProcessCPUTime()) {
+ optionals.set(11);
+ }
+ oprot.writeBitSet(optionals, 12);
+ if (struct.isSetAgentHashCode()) {
+ oprot.writeI32(struct.agentHashCode);
+ }
+ if (struct.isSetDataTime()) {
+ oprot.writeI64(struct.dataTime);
+ }
+ if (struct.isSetActiveThreadCount()) {
+ oprot.writeI32(struct.activeThreadCount);
+ }
+ if (struct.isSetGc1Count()) {
+ oprot.writeI64(struct.gc1Count);
+ }
+ if (struct.isSetGc1Time()) {
+ oprot.writeI64(struct.gc1Time);
+ }
+ if (struct.isSetGc2Count()) {
+ oprot.writeI64(struct.gc2Count);
+ }
+ if (struct.isSetGc2Time()) {
+ oprot.writeI64(struct.gc2Time);
+ }
+ if (struct.isSetHeapUsed()) {
+ oprot.writeI64(struct.heapUsed);
+ }
+ if (struct.isSetHeapCommitted()) {
+ oprot.writeI64(struct.heapCommitted);
+ }
+ if (struct.isSetNonHeapUsed()) {
+ oprot.writeI64(struct.nonHeapUsed);
+ }
+ if (struct.isSetNonHeapCommitted()) {
+ oprot.writeI64(struct.nonHeapCommitted);
+ }
+ if (struct.isSetProcessCPUTime()) {
+ oprot.writeDouble(struct.processCPUTime);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot,
+ JVMInfoThriftDTO struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(12);
+ if (incoming.get(0)) {
+ struct.agentHashCode = iprot.readI32();
+ struct.setAgentHashCodeIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.dataTime = iprot.readI64();
+ struct.setDataTimeIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.activeThreadCount = iprot.readI32();
+ struct.setActiveThreadCountIsSet(true);
+ }
+ if (incoming.get(3)) {
+ struct.gc1Count = iprot.readI64();
+ struct.setGc1CountIsSet(true);
+ }
+ if (incoming.get(4)) {
+ struct.gc1Time = iprot.readI64();
+ struct.setGc1TimeIsSet(true);
+ }
+ if (incoming.get(5)) {
+ struct.gc2Count = iprot.readI64();
+ struct.setGc2CountIsSet(true);
+ }
+ if (incoming.get(6)) {
+ struct.gc2Time = iprot.readI64();
+ struct.setGc2TimeIsSet(true);
+ }
+ if (incoming.get(7)) {
+ struct.heapUsed = iprot.readI64();
+ struct.setHeapUsedIsSet(true);
+ }
+ if (incoming.get(8)) {
+ struct.heapCommitted = iprot.readI64();
+ struct.setHeapCommittedIsSet(true);
+ }
+ if (incoming.get(9)) {
+ struct.nonHeapUsed = iprot.readI64();
+ struct.setNonHeapUsedIsSet(true);
+ }
+ if (incoming.get(10)) {
+ struct.nonHeapCommitted = iprot.readI64();
+ struct.setNonHeapCommittedIsSet(true);
+ }
+ if (incoming.get(11)) {
+ struct.processCPUTime = iprot.readDouble();
+ struct.setProcessCPUTimeIsSet(true);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/profiler/modifier/AbstractModifier.java b/src/main/java/com/profiler/modifier/AbstractModifier.java
index 46fa7c3d8..b6af99059 100644
--- a/src/main/java/com/profiler/modifier/AbstractModifier.java
+++ b/src/main/java/com/profiler/modifier/AbstractModifier.java
@@ -7,100 +7,109 @@ import javassist.CtMethod;
public abstract class AbstractModifier {
public static void printClassInfo(String className) {
- log("Printing Class Info of ["+className+"]");
+ log("Printing Class Info of [" + className + "]");
try {
- ClassPool pool=ClassPool.getDefault();
-// pool.insertClassPath(new ClassClassPath(currentClass));
+ ClassPool pool = ClassPool.getDefault();
log("try");
String javaassistClassName = className.replace('/', '.');
log("replace");
- CtClass cc=pool.get(javaassistClassName);
- log("ClassName:"+javaassistClassName);
- CtConstructor[] constructorList=cc.getConstructors();
- for(CtConstructor cons:constructorList) {
+ CtClass cc = pool.get(javaassistClassName);
+ log("ClassName:" + javaassistClassName);
+ CtConstructor[] constructorList = cc.getConstructors();
+ for (CtConstructor cons : constructorList) {
try {
- String signature=cons.getSignature();
- System.out.println("Constructor signature:"+signature);
- } catch(Exception e) {
+ String signature = cons.getSignature();
+ System.out.println("Constructor signature:" + signature);
+ } catch (Exception e) {
e.printStackTrace();
}
}
- CtMethod[] methodList=cc.getDeclaredMethods();
- for(CtMethod tempMethod:methodList) {
+ CtMethod[] methodList = cc.getDeclaredMethods();
+ for (CtMethod tempMethod : methodList) {
try {
- String methodName=tempMethod.getLongName();
- log("MethodName:"+methodName);
- CtClass[] params=tempMethod.getParameterTypes();
- if(params.length!=0) {
- int paramsLength=params.length;
- for(int loop=paramsLength-1;loop>0;loop--) {
- log("Param"+loop+":"+params[loop].getName());
+ String methodName = tempMethod.getLongName();
+ log("MethodName:" + methodName);
+ CtClass[] params = tempMethod.getParameterTypes();
+ if (params.length != 0) {
+ int paramsLength = params.length;
+ for (int loop = paramsLength - 1; loop > 0; loop--) {
+ log("Param" + loop + ":" + params[loop].getName());
}
} else {
log(" No params");
}
- log("ReturnType="+tempMethod.getReturnType().getName());
- } catch(Exception methodException) {
- log("Exception : "+methodException.getMessage());
+ log("ReturnType=" + tempMethod.getReturnType().getName());
+ } catch (Exception methodException) {
+ log("Exception : " + methodException.getMessage());
}
}
- } catch(Exception e) {
+ } catch (Exception e) {
log(e.getMessage());
e.printStackTrace();
- }
+ }
}
- public static byte[] addBeforeAfterLogics(ClassPool classPool,String javassistClassName) {
+ public static byte[] addBeforeAfterLogics(ClassPool classPool,
+ String javassistClassName) {
try {
CtClass cc = classPool.get(javassistClassName);
- CtMethod[] methods=cc.getDeclaredMethods();
- for(CtMethod method:methods) {
- if(!method.isEmpty() ) {
- String methodName=method.getName();
- CtClass[] params=method.getParameterTypes();
- StringBuilder sb=new StringBuilder();
- if(params.length!=0) {
- int paramsLength=params.length;
- for(int loop=paramsLength-1;loop>0;loop--) {
+ CtMethod[] methods = cc.getDeclaredMethods();
+ for (CtMethod method : methods) {
+ if (!method.isEmpty()) {
+ String methodName = method.getName();
+ CtClass[] params = method.getParameterTypes();
+ StringBuilder sb = new StringBuilder();
+ if (params.length != 0) {
+ int paramsLength = params.length;
+ for (int loop = paramsLength - 1; loop > 0; loop--) {
sb.append(params[loop].getName()).append(",");
}
-// sb.substring(0, sb.length()-2);
+ // sb.substring(0, sb.length()-2);
}
- method.insertBefore("{System.out.println(\"*****"+javassistClassName+"."+methodName+"("+sb+") is started.\");}");
- method.insertAfter("{System.out.println(\"*****"+javassistClassName+"."+methodName+"("+sb+") is finished.\");}");
+ method.insertBefore("{System.out.println(\"*****"
+ + javassistClassName + "." + methodName + "(" + sb
+ + ") is started.\");}");
+ method.insertAfter("{System.out.println(\"*****"
+ + javassistClassName + "." + methodName + "(" + sb
+ + ") is finished.\");}");
} else {
- log(method.getLongName()+" is empty !!!!!");
+ log(method.getLongName() + " is empty !!!!!");
}
}
- CtConstructor[] constructors=cc.getConstructors();
- for(CtConstructor constructor:constructors) {
- if(!constructor.isEmpty()) {
- CtClass[] params=constructor.getParameterTypes();
- StringBuilder sb=new StringBuilder();
- if(params.length!=0) {
- int paramsLength=params.length;
- for(int loop=paramsLength-1;loop>0;loop--) {
+ CtConstructor[] constructors = cc.getConstructors();
+ for (CtConstructor constructor : constructors) {
+ if (!constructor.isEmpty()) {
+ CtClass[] params = constructor.getParameterTypes();
+ StringBuilder sb = new StringBuilder();
+ if (params.length != 0) {
+ int paramsLength = params.length;
+ for (int loop = paramsLength - 1; loop > 0; loop--) {
sb.append(params[loop].getName()).append(",");
}
-// sb.substring(0, sb.length()-2);
+ // sb.substring(0, sb.length()-2);
}
- constructor.insertBefore("{System.out.println(\"*****"+javassistClassName+" Constructor:Param=("+sb+") is started.\");}");
- constructor.insertAfter("{System.out.println(\"*****"+javassistClassName+" Constructor:Param=("+sb+") is finished.\");}");
+ constructor.insertBefore("{System.out.println(\"*****"
+ + javassistClassName + " Constructor:Param=(" + sb
+ + ") is started.\");}");
+ constructor.insertAfter("{System.out.println(\"*****"
+ + javassistClassName + " Constructor:Param=(" + sb
+ + ") is finished.\");}");
} else {
- log(constructor.getLongName()+" is empty !!!!!");
+ log(constructor.getLongName() + " is empty !!!!!");
}
}
return cc.toBytecode();
- } catch(Exception e) {
+ } catch (Exception e) {
e.printStackTrace();
return null;
}
}
+
public static void log(String message) {
- System.out.println("[AbstractModifier] "+message);
+ System.out.println("[AbstractModifier] " + message);
}
+
public static void printClassConvertComplete(String javassistClassName) {
- log("@@@ "+javassistClassName+" class is converted !!!");
-
+ log("@@@ " + javassistClassName + " class is converted !!!");
}
}
diff --git a/src/main/java/com/profiler/modifier/tomcat/EntryPointStandardHostValveModifier.java b/src/main/java/com/profiler/modifier/tomcat/EntryPointStandardHostValveModifier.java
index 11d0a2a1b..a3ee1f78c 100644
--- a/src/main/java/com/profiler/modifier/tomcat/EntryPointStandardHostValveModifier.java
+++ b/src/main/java/com/profiler/modifier/tomcat/EntryPointStandardHostValveModifier.java
@@ -8,106 +8,128 @@ import javassist.CtClass;
import javassist.CtMethod;
import com.profiler.modifier.AbstractModifier;
-/**
+
+/**
* Modify org.apache.catalina.core.StandardHostValve class
+ *
* @author cowboy93
- *
+ *
*/
public class EntryPointStandardHostValveModifier extends AbstractModifier {
- public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) {
+ public static byte[] modify(ClassPool classPool, ClassLoader classLoader,
+ String javassistClassName, byte[] classFileBuffer) {
log("EntryPointModifier.modifyStandardHostValve()");
-// printClassInfo(javassistClassName);
- return changeServiceMethod(classPool,classLoader,javassistClassName,classFileBuffer);
+ // printClassInfo(javassistClassName);
+ return changeServiceMethod(classPool, classLoader, javassistClassName,
+ classFileBuffer);
}
- private static byte[] changeServiceMethod(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) {
- classPool.insertClassPath(new ByteArrayClassPath(javassistClassName, classfileBuffer));
+
+ private static byte[] changeServiceMethod(ClassPool classPool,
+ ClassLoader classLoader, String javassistClassName,
+ byte[] classfileBuffer) {
+ classPool.insertClassPath(new ByteArrayClassPath(javassistClassName,
+ classfileBuffer));
try {
addRequestTracerToCurrentClassLoader(classLoader);
-// log("Class loader="+classPool.getClassLoader().toString());
+ // log("Class loader="+classPool.getClassLoader().toString());
CtClass cc = classPool.get(javassistClassName);
- CtClass[] params=new CtClass[2];
-
- params[0]=classPool.getCtClass("org.apache.catalina.connector.Request");
- params[1]=classPool.getCtClass("org.apache.catalina.connector.Response");
- CtMethod serviceMethod=cc.getDeclaredMethod("invoke", params);
+ CtClass[] params = new CtClass[2];
+
+ params[0] = classPool
+ .getCtClass("org.apache.catalina.connector.Request");
+ params[1] = classPool
+ .getCtClass("org.apache.catalina.connector.Response");
+ CtMethod serviceMethod = cc.getDeclaredMethod("invoke", params);
log("*** Changing invoke method ");
serviceMethod.insertBefore(getInvokeMethodBeforeInsertCode());
serviceMethod.insertAfter(getInvokeMethodAfterInsertCode());
-
+
CtClass exceptionType = classPool.get("java.lang.Throwable");
- //CtClass exceptionType = classPool.get("java.lang.Exception");
- serviceMethod.addCatch(getInvokeMethodCatchInsertCode(), exceptionType);
-
-// cc.stopPruning(true);
-// cc.toClass(classLoader,classLoader.getClass().getProtectionDomain());
-// cc.stopPruning(false);
-
+ // CtClass exceptionType = classPool.get("java.lang.Exception");
+ serviceMethod.addCatch(getInvokeMethodCatchInsertCode(),
+ exceptionType);
+
+ // cc.stopPruning(true);
+ // cc.toClass(classLoader,classLoader.getClass().getProtectionDomain());
+ // cc.stopPruning(false);
+
byte[] newClassfileBuffer = cc.toBytecode();
-// cc.writeFile();
+ // cc.writeFile();
printClassConvertComplete(javassistClassName);
return newClassfileBuffer;
- } catch(Exception e) {
+ } catch (Exception e) {
e.printStackTrace();
}
return null;
}
-
+
private static String getInvokeMethodBeforeInsertCode() {
- StringBuilder insertCode=new StringBuilder();
+ StringBuilder insertCode = new StringBuilder();
insertCode.append("{");
insertCode.append("long requestTime=System.currentTimeMillis();");
-
- insertCode.append("javax.servlet.http.HttpServletRequest tempRequest=(javax.servlet.http.HttpServletRequest)$1;");
+
+ insertCode
+ .append("javax.servlet.http.HttpServletRequest tempRequest=(javax.servlet.http.HttpServletRequest)$1;");
insertCode.append("String requestURL=tempRequest.getRequestURI();");
insertCode.append("String clientIP=tempRequest.getRemoteAddr();");
insertCode.append(getParameterValues());
- insertCode.append(CLASS_NAME_REQUEST_TRACER).append(".startTransaction(requestURL,clientIP,requestTime,params);");
-
-// insertCode.append("System.out.println(\"--- ApplicationFilterChain.doFilter() is started.\");");
+ insertCode.append(CLASS_NAME_REQUEST_TRACER).append(
+ ".startTransaction(requestURL,clientIP,requestTime,params);");
+
+ // insertCode.append("System.out.println(\"--- ApplicationFilterChain.doFilter() is started.\");");
insertCode.append("}");
return insertCode.toString();
}
+
private static StringBuilder getParameterValues() {
- StringBuilder insertCode=new StringBuilder();
- insertCode.append("java.util.Enumeration attrs=tempRequest.getParameterNames();");
+ StringBuilder insertCode = new StringBuilder();
+ insertCode
+ .append("java.util.Enumeration attrs=tempRequest.getParameterNames();");
insertCode.append("StringBuilder params=new StringBuilder();");
insertCode.append("while(attrs.hasMoreElements()) {");
insertCode.append("String keyString=attrs.nextElement().toString();");
-// insertCode.append("System.out.println(key+\"=\"+tempRequest.getParameter(key.toString()));");
+ // insertCode.append("System.out.println(key+\"=\"+tempRequest.getParameter(key.toString()));");
insertCode.append("Object value=tempRequest.getParameter(keyString);");
insertCode.append("if(value!=null) {");
insertCode.append("String valueString=value.toString();");
insertCode.append("int valueStringLength=valueString.length();");
- insertCode.append("if(valueStringLength>0 && valueStringLength<100) params.append(keyString).append(\"=\").append(valueString).append(\",\");");
+ insertCode
+ .append("if(valueStringLength>0 && valueStringLength<100) params.append(keyString).append(\"=\").append(valueString).append(\",\");");
insertCode.append("}}");
-// insertCode.append("System.out.println(params);");
+ // insertCode.append("System.out.println(params);");
return insertCode;
}
+
private static String getInvokeMethodAfterInsertCode() {
- StringBuilder insertCode=new StringBuilder();
+ StringBuilder insertCode = new StringBuilder();
insertCode.append("{");
- insertCode.append(CLASS_NAME_REQUEST_TRACER).append(".endTransaction();");
-// insertCode.append("System.out.println(\"--- ApplicationFilterChain.doFilter() is ended.\");");
+ insertCode.append(CLASS_NAME_REQUEST_TRACER).append(
+ ".endTransaction();");
+ // insertCode.append("System.out.println(\"--- ApplicationFilterChain.doFilter() is ended.\");");
insertCode.append("}");
return insertCode.toString();
}
+
private static String getInvokeMethodCatchInsertCode() {
- StringBuilder insertCode=new StringBuilder();
-// insertCode.append("{");
-// insertCode.append("System.out.println(\"------------------------------------------------\");");
-// insertCode.append("System.out.println(\"--- \"+$e.getMessage()+\" is occured !!!\");");
- insertCode.append(CLASS_NAME_REQUEST_TRACER).append(".exceptionTransaction($e);");
-// insertCode.append("System.out.println(\"------------------------------------------------\");");
+ StringBuilder insertCode = new StringBuilder();
+ // insertCode.append("{");
+ // insertCode.append("System.out.println(\"------------------------------------------------\");");
+ // insertCode.append("System.out.println(\"--- \"+$e.getMessage()+\" is occured !!!\");");
+ insertCode.append(CLASS_NAME_REQUEST_TRACER).append(
+ ".exceptionTransaction($e);");
+ // insertCode.append("System.out.println(\"------------------------------------------------\");");
insertCode.append("throw $e;");
-// insertCode.append("}");
+ // insertCode.append("}");
return insertCode.toString();
}
- private static void addRequestTracerToCurrentClassLoader(ClassLoader classLoader) {
+
+ private static void addRequestTracerToCurrentClassLoader(
+ ClassLoader classLoader) {
try {
classLoader.loadClass(CLASS_NAME_REQUEST_TRACER);
classLoader.loadClass(CLASS_NAME_REQUEST_THRIFT_DTO);
classLoader.loadClass("org.apache.thrift.TBase");
- } catch(Exception e) {
+ } catch (Exception e) {
e.printStackTrace();
}
}
diff --git a/src/main/java/com/profiler/modifier/tomcat/TomcatConnectorModifier.java b/src/main/java/com/profiler/modifier/tomcat/TomcatConnectorModifier.java
index 7c46a9928..f0a7d514c 100644
--- a/src/main/java/com/profiler/modifier/tomcat/TomcatConnectorModifier.java
+++ b/src/main/java/com/profiler/modifier/tomcat/TomcatConnectorModifier.java
@@ -5,31 +5,40 @@ import com.profiler.modifier.AbstractModifier;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
+
/**
* When org.apache.catalina.core.StandardService class is loaded in ClassLoader,
* this class modifies methods.
+ *
* @author cowboy93
- *
+ *
*/
-public class TomcatConnectorModifier extends AbstractModifier{
- public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) {
-// printClassInfo(javassistClassName);
- return changeMethod(classPool,classLoader,javassistClassName,classFileBuffer);
+public class TomcatConnectorModifier extends AbstractModifier {
+ public static byte[] modify(ClassPool classPool, ClassLoader classLoader,
+ String javassistClassName, byte[] classFileBuffer) {
+ // printClassInfo(javassistClassName);
+ return changeMethod(classPool, classLoader, javassistClassName,
+ classFileBuffer);
}
- public static byte[] changeMethod(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) {
+
+ public static byte[] changeMethod(ClassPool classPool,
+ ClassLoader classLoader, String javassistClassName,
+ byte[] classfileBuffer) {
try {
CtClass cc = classPool.get(javassistClassName);
-
- CtClass param[]=new CtClass[1];
- param[0]=classPool.getCtClass("int");
- CtMethod setPortMethod=cc.getDeclaredMethod("setPort", param);
- setPortMethod.insertBefore("{" +
-// "System.out.println(\"*** setPort() method *** Port number=\"+$1);" +
- "com.profiler.dto.AgentInfoDTO.portNumberBuffer.append($1).append(\" \");"+
- "}");
+
+ CtClass param[] = new CtClass[1];
+ param[0] = classPool.getCtClass("int");
+ CtMethod setPortMethod = cc.getDeclaredMethod("setPort", param);
+ setPortMethod.insertBefore("{"
+ +
+ // "System.out.println(\"*** setPort() method *** Port number=\"+$1);"
+ // +
+ "com.profiler.dto.AgentInfoDTO.portNumberBuffer.append($1).append(\" \");"
+ + "}");
printClassConvertComplete(javassistClassName);
return cc.toBytecode();
- } catch(Exception e) {
+ } catch (Exception e) {
e.printStackTrace();
}
return null;
diff --git a/src/main/java/com/profiler/modifier/tomcat/TomcatStandardServiceModifier.java b/src/main/java/com/profiler/modifier/tomcat/TomcatStandardServiceModifier.java
index 338292c82..2dfeaa3b2 100644
--- a/src/main/java/com/profiler/modifier/tomcat/TomcatStandardServiceModifier.java
+++ b/src/main/java/com/profiler/modifier/tomcat/TomcatStandardServiceModifier.java
@@ -7,34 +7,43 @@ import com.profiler.modifier.AbstractModifier;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
+
/**
* When org.apache.catalina.core.StandardService class is loaded in ClassLoader,
* this class modifies methods.
+ *
* @author cowboy93
- *
+ *
*/
-public class TomcatStandardServiceModifier extends AbstractModifier{
- public static byte[] modify(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classFileBuffer) {
-// printClassInfo(javassistClassName);
- return changeMethod(classPool,classLoader,javassistClassName,classFileBuffer);
+public class TomcatStandardServiceModifier extends AbstractModifier {
+ public static byte[] modify(ClassPool classPool, ClassLoader classLoader,
+ String javassistClassName, byte[] classFileBuffer) {
+ // printClassInfo(javassistClassName);
+ return changeMethod(classPool, classLoader, javassistClassName,
+ classFileBuffer);
}
- public static byte[] changeMethod(ClassPool classPool,ClassLoader classLoader,String javassistClassName,byte[] classfileBuffer) {
+
+ public static byte[] changeMethod(ClassPool classPool,
+ ClassLoader classLoader, String javassistClassName,
+ byte[] classfileBuffer) {
try {
CtClass cc = classPool.get(javassistClassName);
- CtMethod startMethod=cc.getDeclaredMethod("start", null);
- startMethod.insertBefore("{" +
- "System.out.println(\"*** Start TomcatProfiler JVMStat Thread ***\");" +
- CLASS_NAME_AGENT_STATE_MANAGER+".startJVMTraceThread();" +
- "}");
- CtMethod stopMethod=cc.getDeclaredMethod("stop", null);
- stopMethod.insertBefore("{" +
- "System.out.println(\"*** TomcatProfiler send JVM is stopped info ***\");" +
- CLASS_NAME_AGENT_STATE_MANAGER+".sendJVMStoppedInfo();" +
- "}");
-
+ CtMethod startMethod = cc.getDeclaredMethod("start", null);
+ startMethod
+ .insertBefore("{"
+ + "System.out.println(\"*** Start TomcatProfiler JVMStat Thread ***\");"
+ + CLASS_NAME_AGENT_STATE_MANAGER
+ + ".startJVMTraceThread();" + "}");
+ CtMethod stopMethod = cc.getDeclaredMethod("stop", null);
+ stopMethod
+ .insertBefore("{"
+ + "System.out.println(\"*** TomcatProfiler send JVM is stopped info ***\");"
+ + CLASS_NAME_AGENT_STATE_MANAGER
+ + ".sendJVMStoppedInfo();" + "}");
+
printClassConvertComplete(javassistClassName);
return cc.toBytecode();
- } catch(Exception e) {
+ } catch (Exception e) {
e.printStackTrace();
}
return null;
diff --git a/src/main/java/com/profiler/receiver/TCPSocketManager.java b/src/main/java/com/profiler/receiver/TCPSocketManager.java
index ff5bf5c3b..f4e9d9bcc 100644
--- a/src/main/java/com/profiler/receiver/TCPSocketManager.java
+++ b/src/main/java/com/profiler/receiver/TCPSocketManager.java
@@ -6,24 +6,28 @@ import java.net.Socket;
import com.profiler.config.TomcatProfilerConfig;
-public class TCPSocketManager extends Thread{
- ServerSocket serverSocket=null;
+public class TCPSocketManager extends Thread {
+ ServerSocket serverSocket = null;
+
public TCPSocketManager() {
}
+
public void run() {
try {
- serverSocket=new ServerSocket(TomcatProfilerConfig.AGENT_TCP_LISTEN_PORT, 100);
- System.out.println("*** Start TomcatProfiler TCP Listen Thread ***");
- while(true) {
- Socket socket=serverSocket.accept();
- InputStream stream=socket.getInputStream();
- byte[] readData=new byte[1024];
+ serverSocket = new ServerSocket(
+ TomcatProfilerConfig.AGENT_TCP_LISTEN_PORT, 100);
+ System.out
+ .println("*** Start TomcatProfiler TCP Listen Thread ***");
+ while (true) {
+ Socket socket = serverSocket.accept();
+ InputStream stream = socket.getInputStream();
+ byte[] readData = new byte[1024];
stream.read(readData);
System.out.println(new String(readData));
}
-// } catch(InterruptedException ie) {
-
- } catch(Exception e) {
+ // } catch(InterruptedException ie) {
+
+ } catch (Exception e) {
e.printStackTrace();
}
}
diff --git a/src/main/java/com/profiler/sender/AbstractDataSender.java b/src/main/java/com/profiler/sender/AbstractDataSender.java
index 6f20a68e3..683ca9724 100644
--- a/src/main/java/com/profiler/sender/AbstractDataSender.java
+++ b/src/main/java/com/profiler/sender/AbstractDataSender.java
@@ -7,28 +7,33 @@ import java.net.InetSocketAddress;
public abstract class AbstractDataSender {
public void send() {
try {
- byte [] sendData=getSendData();
- int sendDataLength=sendData.length;
-
-// System.out.println("sendDataLength="+sendDataLength);
-
- InetSocketAddress address=getAddress();
- DatagramPacket packet=new DatagramPacket(sendData,sendDataLength,address);
-
- DatagramSocket udpSocket=new DatagramSocket();
-// System.out.println("sendBufferSize="+udpSocket.getSendBufferSize());
+ byte[] sendData = getSendData();
+ int sendDataLength = sendData.length;
+
+ // System.out.println("sendDataLength="+sendDataLength);
+
+ InetSocketAddress address = getAddress();
+ DatagramPacket packet = new DatagramPacket(sendData,
+ sendDataLength, address);
+
+ DatagramSocket udpSocket = new DatagramSocket();
+ // System.out.println("sendBufferSize="+udpSocket.getSendBufferSize());
udpSocket.send(packet);
-// if(this instanceof RequestDataSender || this instanceof RequestTransactionDataSender ) {
-// System.out.println(this.getClass().getName()+" Send bufferSize="+udpSocket.getSendBufferSize()+" dataLength="+sendDataLength);
-// }
+ // if(this instanceof RequestDataSender || this instanceof
+ // RequestTransactionDataSender ) {
+ // System.out.println(this.getClass().getName()+" Send bufferSize="+udpSocket.getSendBufferSize()+" dataLength="+sendDataLength);
+ // }
udpSocket.close();
- } catch(Exception e) {
+ } catch (Exception e) {
e.printStackTrace();
}
}
+
protected abstract byte[] getSendData() throws Exception;
+
protected abstract InetSocketAddress getAddress() throws Exception;
+
public void log(String message) {
-// System.out.println("[AbstractDataSenderThread] "+message);
+ // System.out.println("[AbstractDataSenderThread] "+message);
}
}
diff --git a/src/main/java/com/profiler/sender/AgentInfoSender.java b/src/main/java/com/profiler/sender/AgentInfoSender.java
index 352c27eb6..976683c9c 100644
--- a/src/main/java/com/profiler/sender/AgentInfoSender.java
+++ b/src/main/java/com/profiler/sender/AgentInfoSender.java
@@ -3,85 +3,104 @@ package com.profiler.sender;
import java.io.ObjectOutputStream;
import java.net.Socket;
+import com.profiler.Logger;
import com.profiler.config.TomcatProfilerConfig;
import com.profiler.dto.AgentInfoDTO;
-public class AgentInfoSender extends Thread{
+public class AgentInfoSender extends Thread {
+
+ private static final Logger logger = Logger.getLogger(AgentInfoSender.class);
+
boolean isAgentStart;
+
public AgentInfoSender(boolean isAgentStart) {
- this.isAgentStart=isAgentStart;
+ this.isAgentStart = isAgentStart;
}
- Socket requestSocket=null;
+
+ Socket requestSocket = null;
+
public void run() {
- if(isAgentStart) {
+ if (isAgentStart) {
sendAgentStartInfo();
} else {
sendAgentStopInfo();
}
}
+
private void sendAgentStopInfo() {
try {
connectToServer();
- ObjectOutputStream stream=new ObjectOutputStream(requestSocket.getOutputStream());
- AgentInfoDTO dto=new AgentInfoDTO();
+
+ ObjectOutputStream stream = new ObjectOutputStream(requestSocket.getOutputStream());
+ AgentInfoDTO dto = new AgentInfoDTO();
dto.setIsDead();
- log(dto.toString());
+
+ logger.info("send agent stop info. %s", dto.toString());
+
stream.writeObject(dto);
stream.close();
- log("Agent Stopped message is sent");
- } catch(Exception e) {
- log("AgentInfoSender Exception occured:"+e.getMessage());
+
+ logger.info("Agent Stopped message is sent. %s", dto.toString());
+ } catch (Exception e) {
+ logger.error("AgentInfoSender Exception occured : %s", e.getMessage());
} finally {
closeSocket();
}
}
+
private void sendAgentStartInfo() {
- while(connectToServer()) {
+ while (connectToServer()) {
try {
- Thread.sleep(TomcatProfilerConfig.SERVER_CONNECT_RETRY_GAP);
- } catch(Exception e) {
+ Thread.sleep(TomcatProfilerConfig.SERVER_CONNECT_RETRY_GAP);
+ } catch (Exception e) {
e.printStackTrace();
}
}
try {
- ObjectOutputStream stream=new ObjectOutputStream(requestSocket.getOutputStream());
-// stream.write(("AGENT_HASH="+JVMInfoDTO.hostHashCode).getBytes());
-// stream.write(("AGENT_IP="+JVMInfoDTO.hostIP).getBytes());
-// stream.write(("AGENT_PORT="+JVMInfoDTO.portNumber).getBytes());
- AgentInfoDTO dto=new AgentInfoDTO();
- log(dto.toString());
+ ObjectOutputStream stream = new ObjectOutputStream(requestSocket.getOutputStream());
+
+ // stream.write(("AGENT_HASH="+JVMInfoDTO.hostHashCode).getBytes());
+ // stream.write(("AGENT_IP="+JVMInfoDTO.hostIP).getBytes());
+ // stream.write(("AGENT_PORT="+JVMInfoDTO.portNumber).getBytes());
+
+ AgentInfoDTO dto = new AgentInfoDTO();
+
+ logger.info("send agent startup info. %s", dto.toString());
+
stream.writeObject(dto);
stream.close();
- } catch(Exception e) {
+ } catch (Exception e) {
e.printStackTrace();
}
- if(requestSocket!=null) {
+ if (requestSocket != null) {
closeSocket();
}
}
- private void log(String message) {
- System.out.println("*** "+message);
- }
+
private boolean connectToServer() {
try {
- requestSocket=new Socket(TomcatProfilerConfig.SERVER_IP,TomcatProfilerConfig.SERVER_TCP_LISTEN_PORT);
- log("Connected to server ");
+ logger.info("Trying to connect server. %s:%s", TomcatProfilerConfig.SERVER_IP, TomcatProfilerConfig.SERVER_TCP_LISTEN_PORT);
+
+ requestSocket = new Socket(TomcatProfilerConfig.SERVER_IP, TomcatProfilerConfig.SERVER_TCP_LISTEN_PORT);
+
+ logger.info("Connected to server. %s:%s", TomcatProfilerConfig.SERVER_IP, TomcatProfilerConfig.SERVER_TCP_LISTEN_PORT);
return false;
- } catch(java.net.ConnectException ce) {
- log("Connect to TomcatProfiler server is failed ***");
+ } catch (java.net.ConnectException ce) {
+ logger.fatal("Connect to TomcatProfiler server is failed. %s:%s", TomcatProfilerConfig.SERVER_IP, TomcatProfilerConfig.SERVER_TCP_LISTEN_PORT);
return true;
- } catch(Exception e) {
+ } catch (Exception e) {
e.printStackTrace();
return true;
}
}
+
private void closeSocket() {
try {
requestSocket.close();
- log("TCP RequestSocket is closed");
+ logger.info("TCP RequestSocket is closed");
} catch (Exception e) {
-// e.printStackTrace();
+ logger.error("closeSocket(). %s", e.getMessage());
}
}
}
diff --git a/target/dependency/annotations-api-6.0.35.jar b/target/dependency/annotations-api-6.0.35.jar
deleted file mode 100644
index a8fdeb034..000000000
Binary files a/target/dependency/annotations-api-6.0.35.jar and /dev/null differ
diff --git a/target/dependency/catalina-6.0.35.jar b/target/dependency/catalina-6.0.35.jar
deleted file mode 100644
index a9bea06ba..000000000
Binary files a/target/dependency/catalina-6.0.35.jar and /dev/null differ
diff --git a/target/dependency/commons-codec-1.4.jar b/target/dependency/commons-codec-1.4.jar
deleted file mode 100644
index 458d432da..000000000
Binary files a/target/dependency/commons-codec-1.4.jar and /dev/null differ
diff --git a/target/dependency/commons-lang-2.5.jar b/target/dependency/commons-lang-2.5.jar
deleted file mode 100644
index ae491da8c..000000000
Binary files a/target/dependency/commons-lang-2.5.jar and /dev/null differ
diff --git a/target/dependency/commons-logging-1.1.1.jar b/target/dependency/commons-logging-1.1.1.jar
deleted file mode 100644
index 1deef144c..000000000
Binary files a/target/dependency/commons-logging-1.1.1.jar and /dev/null differ
diff --git a/target/dependency/httpclient-4.1.2.jar b/target/dependency/httpclient-4.1.2.jar
deleted file mode 100644
index 55cac3dbc..000000000
Binary files a/target/dependency/httpclient-4.1.2.jar and /dev/null differ
diff --git a/target/dependency/httpcore-4.1.3.jar b/target/dependency/httpcore-4.1.3.jar
deleted file mode 100644
index 245e43610..000000000
Binary files a/target/dependency/httpcore-4.1.3.jar and /dev/null differ
diff --git a/target/dependency/javassist-3.16.1.GA.jar b/target/dependency/javassist-3.16.1.GA.jar
deleted file mode 100644
index e8abb1971..000000000
Binary files a/target/dependency/javassist-3.16.1.GA.jar and /dev/null differ
diff --git a/target/dependency/juli-6.0.35.jar b/target/dependency/juli-6.0.35.jar
deleted file mode 100644
index 07571768c..000000000
Binary files a/target/dependency/juli-6.0.35.jar and /dev/null differ
diff --git a/target/dependency/libthrift-0.8.0.jar b/target/dependency/libthrift-0.8.0.jar
deleted file mode 100644
index ab6b43162..000000000
Binary files a/target/dependency/libthrift-0.8.0.jar and /dev/null differ
diff --git a/target/dependency/servlet-api-6.0.35.jar b/target/dependency/servlet-api-6.0.35.jar
deleted file mode 100644
index 1bf50af6e..000000000
Binary files a/target/dependency/servlet-api-6.0.35.jar and /dev/null differ
diff --git a/target/dependency/slf4j-api-1.5.8.jar b/target/dependency/slf4j-api-1.5.8.jar
deleted file mode 100644
index 20d1d3718..000000000
Binary files a/target/dependency/slf4j-api-1.5.8.jar and /dev/null differ
diff --git a/target/hippo-tomcat-profiler-0.0.1.jar b/target/hippo-tomcat-profiler-0.0.1.jar
deleted file mode 100644
index 039aa3cc7..000000000
Binary files a/target/hippo-tomcat-profiler-0.0.1.jar and /dev/null differ
diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties
deleted file mode 100644
index eeaa8976d..000000000
--- a/target/maven-archiver/pom.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-#Generated by Maven
-#Wed Jun 27 11:16:43 KST 2012
-version=0.0.1
-groupId=com.nhn.hippo
-artifactId=hippo-tomcat-profiler
diff --git a/JVMInfoThriftDTO.thrift b/thrift/JVMInfoThriftDTO.thrift
similarity index 100%
rename from JVMInfoThriftDTO.thrift
rename to thrift/JVMInfoThriftDTO.thrift
diff --git a/RequestDataThriftDTO.thrift b/thrift/RequestDataThriftDTO.thrift
similarity index 100%
rename from RequestDataThriftDTO.thrift
rename to thrift/RequestDataThriftDTO.thrift
diff --git a/RequestThriftDTO.thrift b/thrift/RequestThriftDTO.thrift
similarity index 100%
rename from RequestThriftDTO.thrift
rename to thrift/RequestThriftDTO.thrift
diff --git a/makethrift.sh b/thrift/makethrift.sh
similarity index 100%
rename from makethrift.sh
rename to thrift/makethrift.sh