Author: jim.ma
Date: 2015-03-19 06:03:26 -0400 (Thu, 19 Mar 2015)
New Revision: 19582
Modified:
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerImpl.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetInterceptor.java
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetOutInterceptor.java
stack/cxf/branches/management/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java
Log:
[JBWS-3890]:Enhance EndpointMetrics api to collect the concurrent request count and
endpoint method request count information
Modified:
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java
===================================================================
---
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java 2015-03-19
10:01:22 UTC (rev 19581)
+++
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java 2015-03-19
10:03:26 UTC (rev 19582)
@@ -59,8 +59,10 @@
import org.apache.cxf.service.model.BindingOperationInfo;
import org.jboss.security.auth.callback.CallbackHandlerPolicyContextHandler;
import org.jboss.ws.api.util.ServiceLoader;
+import org.jboss.ws.common.utils.RuntimeConfigUtils;
import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.RuntimeConfig;
import org.jboss.wsf.spi.invocation.Invocation;
import org.jboss.wsf.spi.invocation.InvocationContext;
import org.jboss.wsf.spi.invocation.InvocationHandler;
@@ -165,6 +167,10 @@
throws Exception
{
Endpoint ep = exchange.get(Endpoint.class);
+ if (isStatisticsEnabled(ep))
+ {
+ ep.getEndpointMetrics().processInvocation(m.getName());
+ }
final InvocationHandler invHandler = ep.getInvocationHandler();
final Invocation inv = createInvocation(invHandler, serviceObject, ep, m,
paramArray);
if (factory != null) {
@@ -213,4 +219,13 @@
nsCtxSelectorFactory.getWrapper().clearCurrentThreadSelector(exchange);
}
}
+
+ private boolean isStatisticsEnabled(Endpoint ep)
+ {
+ if (ep.getEndpointMetrics() != null)
+ {
+ return RuntimeConfigUtils.isEnabled(ep, RuntimeConfig.STATISTICS_ENABLED) ||
RuntimeConfigUtils.getServerConfig().isStatisticsEnabled();
+ }
+ return false;
+ }
}
Modified:
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerImpl.java
===================================================================
---
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerImpl.java 2015-03-19
10:01:22 UTC (rev 19581)
+++
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerImpl.java 2015-03-19
10:03:26 UTC (rev 19582)
@@ -92,8 +92,9 @@
out.close();
return;
}
- final boolean statisticsEnabled = getServerConfig().isStatisticsEnabled() ||
"true".equals(ep.getRuntimeProperty(RuntimeConfig.STATISTICS_ENABLED));
+ final boolean statisticsEnabled = isStatisticsEnabled(ep, req.getMethod());
final Long beginTime = statisticsEnabled == true ? initRequestMetrics(ep) : 0;
+
final Deployment dep = ep.getService().getDeployment();
final AbstractHTTPDestination dest = findDestination(req,
dep.getAttachment(BusHolder.class).getBus());
final HttpServletResponseWrapper response = new HttpServletResponseWrapper(res);
@@ -122,6 +123,14 @@
}
}
+ private boolean isStatisticsEnabled(Endpoint ep, String httpMethod) {
+ if ("POST".equals(httpMethod)) {
+ return getServerConfig().isStatisticsEnabled() ||
"true".equals(ep.getRuntimeProperty(RuntimeConfig.STATISTICS_ENABLED));
+ }
+ return false;
+
+ }
+
private boolean hasQueryString(HttpServletRequest req)
{
final String queryString = req.getQueryString();
Modified:
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetInterceptor.java
===================================================================
---
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetInterceptor.java 2015-03-19
10:01:22 UTC (rev 19581)
+++
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetInterceptor.java 2015-03-19
10:03:26 UTC (rev 19582)
@@ -50,7 +50,6 @@
static
{
httpMethods.add("GET");
- httpMethods.add("POST");
}
public EndpointMetricsGetInterceptor()
Modified:
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetOutInterceptor.java
===================================================================
---
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetOutInterceptor.java 2015-03-19
10:01:22 UTC (rev 19581)
+++
stack/cxf/branches/management/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointMetricsGetOutInterceptor.java 2015-03-19
10:03:26 UTC (rev 19582)
@@ -76,6 +76,10 @@
writeElement(mappedWriter, "maxProcessingTime",
metrics.getMaxProcessingTime());
writeElement(mappedWriter, "minProcessingTime",
metrics.getMinProcessingTime());
writeElement(mappedWriter, "averageProcessingTime",
metrics.getAverageProcessingTime());
+ writeElement(mappedWriter, "concurrentRequestCount",
metrics.getConcurrentCount());
+ for (String method : metrics.getRequestMethods()) {
+ writeElement(mappedWriter, "Method(" + method +
"())InvocationCount:", metrics.getInvocationCountByMethod(method));
+ }
mappedWriter.writeEndDocument();
out.flush();
}
Modified:
stack/cxf/branches/management/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java
===================================================================
---
stack/cxf/branches/management/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java 2015-03-19
10:01:22 UTC (rev 19581)
+++
stack/cxf/branches/management/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/context/WebServiceContextJSETestCase.java 2015-03-19
10:03:26 UTC (rev 19582)
@@ -156,7 +156,8 @@
assertEquals(200, connenction.getResponseCode());
bout = new ByteArrayOutputStream();
IOUtils.copy(connenction.getInputStream(), bout);
- assertTrue("Unexpected response",
bout.toString().contains("\"requestCount\":3"));
+ assertTrue("Unexpected rquestCount response",
bout.toString().contains("\"requestCount\":1"));
+ assertTrue("Unexpected invocation count",
bout.toString().contains("\"Method(testMessageContextProperties())InvocationCount:\":1"));
}
Show replies by date