[jboss-cvs] jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector ...
Takuro Okada
t2-okada at nri.co.jp
Mon Feb 19 05:53:01 EST 2007
User: tokada
Date: 07/02/19 05:53:01
Modified: java/src/expansion/org/jboss/profiler/exp/agent/collector
Tag: JBossProfiler_Expansion
TimeScaleMetricCollectorFactory.java
ConcurrentMetricCollectorFactory.java
MemoryMetricCollectorFactory.java
MetricCollectorFactory.java
ExecutionMetricCollectorFactory.java
StackTraceMetricCollectorFactory.java
ThreadMetricCollectorFactory.java
Log:
Added a property for collector config
Revision Changes Path
No revision
No revision
1.1.2.2 +2 -7 jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/Attic/TimeScaleMetricCollectorFactory.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TimeScaleMetricCollectorFactory.java
===================================================================
RCS file: /cvsroot/jboss/jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/Attic/TimeScaleMetricCollectorFactory.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- TimeScaleMetricCollectorFactory.java 26 Oct 2006 08:58:56 -0000 1.1.2.1
+++ TimeScaleMetricCollectorFactory.java 19 Feb 2007 10:53:01 -0000 1.1.2.2
@@ -43,13 +43,8 @@
private boolean cpuTimeSupported = false;
- public TimeScaleMetricCollectorFactory(String profilerServiceName) {
- super(profilerServiceName);
- initialize();
- }
-
- public TimeScaleMetricCollectorFactory(String profilerServiceName, String remoteUrl) {
- super(profilerServiceName, remoteUrl);
+ public TimeScaleMetricCollectorFactory() {
+ super();
initialize();
}
1.1.2.2 +2 -7 jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/Attic/ConcurrentMetricCollectorFactory.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ConcurrentMetricCollectorFactory.java
===================================================================
RCS file: /cvsroot/jboss/jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/Attic/ConcurrentMetricCollectorFactory.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- ConcurrentMetricCollectorFactory.java 26 Oct 2006 08:58:56 -0000 1.1.2.1
+++ ConcurrentMetricCollectorFactory.java 19 Feb 2007 10:53:01 -0000 1.1.2.2
@@ -47,13 +47,8 @@
private boolean contentionSupported = false;
- public ConcurrentMetricCollectorFactory(String profilerServiceName) {
- super(profilerServiceName);
- initialize();
- }
-
- public ConcurrentMetricCollectorFactory(String profilerServiceName, String remoteUrl) {
- super(profilerServiceName, remoteUrl);
+ public ConcurrentMetricCollectorFactory() {
+ super();
initialize();
}
1.1.2.2 +2 -7 jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/Attic/MemoryMetricCollectorFactory.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MemoryMetricCollectorFactory.java
===================================================================
RCS file: /cvsroot/jboss/jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/Attic/MemoryMetricCollectorFactory.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- MemoryMetricCollectorFactory.java 26 Oct 2006 08:58:56 -0000 1.1.2.1
+++ MemoryMetricCollectorFactory.java 19 Feb 2007 10:53:01 -0000 1.1.2.2
@@ -41,13 +41,8 @@
private transient static MemoryMXBean memoryMXBean = null;
- public MemoryMetricCollectorFactory(String profilerServiceName) {
- super(profilerServiceName);
- initialize();
- }
-
- public MemoryMetricCollectorFactory(String profilerServiceName, String remoteUrl) {
- super(profilerServiceName, remoteUrl);
+ public MemoryMetricCollectorFactory() {
+ super();
initialize();
}
1.1.2.3 +35 -12 jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/Attic/MetricCollectorFactory.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MetricCollectorFactory.java
===================================================================
RCS file: /cvsroot/jboss/jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/Attic/MetricCollectorFactory.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- MetricCollectorFactory.java 28 Nov 2006 02:48:49 -0000 1.1.2.2
+++ MetricCollectorFactory.java 19 Feb 2007 10:53:01 -0000 1.1.2.3
@@ -22,6 +22,10 @@
package org.jboss.profiler.exp.agent.collector;
+import java.io.IOException;
+
+import org.apache.log4j.Logger;
+import org.jboss.profiler.exp.adaptor.AgentConfig;
import org.jboss.profiler.exp.adaptor.ServiceManager;
import org.jboss.profiler.exp.agent.IProfilerService;
@@ -35,26 +39,36 @@
*/
public abstract class MetricCollectorFactory {
+ protected static Logger logger = Logger.getLogger(MetricCollectorFactory.class);
+
/*
* JMX service proxy
*/
private IProfilerService profilerServiceProxy = null;
- /**
- * Constructs instance and connects to JMX service by local access.
- * @param profilerServiceName - JMX service name
+ /*
+ * collector config
*/
- public MetricCollectorFactory(String profilerServiceName) {
- profilerServiceProxy = (IProfilerService)ServiceManager.createLocalProxy(profilerServiceName, IProfilerService.class);
- }
+ private CollectorConfig collectorConfig = null;
+ private static final String COLLECTOR_CONFIG_FILE_PATH = "/collector-config.xml";
+
+ private static final String DEFAULT_AGENT_SERVICE_NAME = "jboss.profiler:service=ProfilerService";
/**
- * Constructs instance and connects to JMX service by remote access.
- * @param profilerServiceName - JMX service name
- * @param remoteUrl - URL of remote host
+ * Constructs instance and connects to JMX service by local access.
*/
- public MetricCollectorFactory(String profilerServiceName, String remoteUrl) {
- profilerServiceProxy = (IProfilerService)ServiceManager.createRemoteProxy(remoteUrl, profilerServiceName, IProfilerService.class);
+ public MetricCollectorFactory() {
+ loadCollectorConfig();
+ if(collectorConfig!=null) {
+ AgentConfig agentConfig = collectorConfig.getAgent();
+ if(agentConfig.getJmxConnectorUrl().contains("localhost")) {
+ profilerServiceProxy = (IProfilerService)ServiceManager.createLocalProxy(agentConfig.getServiceName(), IProfilerService.class);
+ }else {
+ profilerServiceProxy = (IProfilerService)ServiceManager.createRemoteProxy(agentConfig, IProfilerService.class);
+ }
+ }else {
+ profilerServiceProxy = (IProfilerService)ServiceManager.createLocalProxy(DEFAULT_AGENT_SERVICE_NAME, IProfilerService.class);
+ }
}
/**
@@ -77,7 +91,16 @@
* @param collector - collector to submit
*/
public synchronized void submitCollector(MetricCollector collector) {
+ collector.setCollectorConfig(collectorConfig);
profilerServiceProxy.submitMetric(collector);
}
+ private void loadCollectorConfig() {
+ try {
+ collectorConfig = new CollectorConfig(COLLECTOR_CONFIG_FILE_PATH);
+ } catch (IOException e) {
+ logger.error("failed to load the collector config.", e);
+ }
+ }
+
}
1.1.2.3 +2 -7 jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/Attic/ExecutionMetricCollectorFactory.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ExecutionMetricCollectorFactory.java
===================================================================
RCS file: /cvsroot/jboss/jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/Attic/ExecutionMetricCollectorFactory.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- ExecutionMetricCollectorFactory.java 6 Nov 2006 07:33:01 -0000 1.1.2.2
+++ ExecutionMetricCollectorFactory.java 19 Feb 2007 10:53:01 -0000 1.1.2.3
@@ -45,13 +45,8 @@
private boolean cpuTimeSupported = false;
- public ExecutionMetricCollectorFactory(String profilerServiceName) {
- super(profilerServiceName);
- initialize();
- }
-
- public ExecutionMetricCollectorFactory(String profilerServiceName, String remoteUrl) {
- super(profilerServiceName, remoteUrl);
+ public ExecutionMetricCollectorFactory() {
+ super();
initialize();
}
1.1.2.2 +2 -7 jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/Attic/StackTraceMetricCollectorFactory.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: StackTraceMetricCollectorFactory.java
===================================================================
RCS file: /cvsroot/jboss/jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/Attic/StackTraceMetricCollectorFactory.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- StackTraceMetricCollectorFactory.java 26 Oct 2006 08:58:56 -0000 1.1.2.1
+++ StackTraceMetricCollectorFactory.java 19 Feb 2007 10:53:01 -0000 1.1.2.2
@@ -39,13 +39,8 @@
private transient static ThreadMXBean threadMXBean = null;
- public StackTraceMetricCollectorFactory(String profilerServiceName) {
- super(profilerServiceName);
- initialize();
- }
-
- public StackTraceMetricCollectorFactory(String profilerServiceName, String remoteUrl) {
- super(profilerServiceName, remoteUrl);
+ public StackTraceMetricCollectorFactory() {
+ super();
initialize();
}
1.1.2.2 +2 -7 jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/Attic/ThreadMetricCollectorFactory.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ThreadMetricCollectorFactory.java
===================================================================
RCS file: /cvsroot/jboss/jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/Attic/ThreadMetricCollectorFactory.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- ThreadMetricCollectorFactory.java 26 Oct 2006 08:58:56 -0000 1.1.2.1
+++ ThreadMetricCollectorFactory.java 19 Feb 2007 10:53:01 -0000 1.1.2.2
@@ -45,13 +45,8 @@
private boolean cpuTimeSupported = false;
- public ThreadMetricCollectorFactory(String profilerServiceName) {
- super(profilerServiceName);
- initialize();
- }
-
- public ThreadMetricCollectorFactory(String profilerServiceName, String remoteUrl) {
- super(profilerServiceName, remoteUrl);
+ public ThreadMetricCollectorFactory() {
+ super();
initialize();
}
More information about the jboss-cvs-commits
mailing list