On Thursday 16 September 2010 2:26:58 am [email protected] wrote: > OK. Got it. So I will not further follow this approach. > > Maybe this solution is more straightforward. I'm just wondering if it will > work in a multiuser scenario?
It would work on the CLIENT side, yes (although USER_LOGICAL is probably better). On the server side, it would only log the time around the invoke of the service, not all the stuff CXF would do such as reading/writing, handling ws-security, etc... Guess it depends on what you want to time. :-) That said, have you looked at the ResponseTimeFeature we already have in CXF? http://svn.apache.org/viewvc/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/interceptor/ (which, apparently isn't documented) However, there is some very minimal docs at the bottom of: http://cxf.apache.org/docs/jmx-management.html about the counter repository stuff. Dan > > super(Phase.POST_LOGICAL); > addAfter(ReadHeadersInterceptor.class.getName()); > } > > public void handleMessage(SoapMessage message) throws Fault { > Exchange ex = message.getExchange(); > > if (message.getVersion() instanceof Soap11) { > > Map<String, List<String>> headers = CastUtils.cast((Map) > message.get(Message.PROTOCOL_HEADERS)); > if (headers != null) { > List<String> sa = headers.get("SOAPAction"); > if (sa != null && sa.size() > 0) { > String action = sa.get(0); > if (action.startsWith("\"")) { > action = action.substring(1, action.length() - 1); > } > > System.out.println("[STATISTICS] [action] " + action); > ex.put("startTime", System.currentTimeMillis()); > } > } > else { > long diff = System.currentTimeMillis() > -Long.valueOf(ex.get("startTime").toString()); > long diffMs = diff % 1000; > System.out.println("[STATISTICS] [duration]"+ diffMs + " ms"); > > } > } > } -- Daniel Kulp [email protected] http://dankulp.com/blog
