Author: jim.ma
Date: 2014-06-05 22:38:48 -0400 (Thu, 05 Jun 2014)
New Revision: 18721
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointMetricsDeploymentAspect.java
Log:
[JBWS-3733]:Allow enabling/disabling endpoint metrics
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointMetricsDeploymentAspect.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointMetricsDeploymentAspect.java 2014-06-06
02:37:56 UTC (rev 18720)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointMetricsDeploymentAspect.java 2014-06-06
02:38:48 UTC (rev 18721)
@@ -21,12 +21,16 @@
*/
package org.jboss.ws.common.deployment;
+import org.jboss.ws.common.configuration.ConfigHelper;
import org.jboss.ws.common.integration.AbstractDeploymentAspect;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.management.EndpointMetrics;
import org.jboss.wsf.spi.management.EndpointMetricsFactory;
+import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.spi.management.ServerConfigFactory;
+import org.jboss.wsf.spi.metadata.config.EndpointConfig;
/**
* A deployer that assigns the metrics to the Endpoint
@@ -40,10 +44,17 @@
public void start(Deployment dep)
{
EndpointMetricsFactory factory =
SPIProvider.getInstance().getSPI(EndpointMetricsFactory.class);
- for (Endpoint ep : dep.getService().getEndpoints())
+ ServerConfigFactory scf =
SPIProvider.getInstance().getSPI(ServerConfigFactory.class);
+ EndpointConfig defaultConfig =
scf.getServerConfig().getEndpointConfig(EndpointConfig.STANDARD_ENDPOINT_CONFIG);
+ boolean enabled =
Boolean.valueOf(defaultConfig.getProperty(EndpointConfig.STATISTICS_ENABLED));
+ if (enabled)
{
- EndpointMetrics metrics = factory.newEndpointMetrics();
- ep.setEndpointMetrics(metrics);
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+
+ EndpointMetrics metrics = factory.newEndpointMetrics();
+ ep.setEndpointMetrics(metrics);
+ }
}
}
}
Show replies by date