cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [3/6] git commit: [CXF-5839]:ResponseTimeCounter doesn't count the schema validation fault
Date Mon, 07 Jul 2014 06:44:08 GMT
[CXF-5839]:ResponseTimeCounter doesn't count the schema validation fault


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/5588092c
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5588092c
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5588092c

Branch: refs/heads/master
Commit: 5588092cebb1a6a67299443b683dc871ca62f751
Parents: b7f754d
Author: Jim Ma <ema@apache.org>
Authored: Mon Jul 7 11:26:53 2014 +0800
Committer: Jim Ma <ema@apache.org>
Committed: Mon Jul 7 14:43:38 2014 +0800

----------------------------------------------------------------------
 .../management/counters/CounterRepository.java  |  5 +--
 .../ResponseTimeMessageInInterceptor.java       | 37 ++++++++++++--------
 2 files changed, 25 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5588092c/rt/management/src/main/java/org/apache/cxf/management/counters/CounterRepository.java
----------------------------------------------------------------------
diff --git a/rt/management/src/main/java/org/apache/cxf/management/counters/CounterRepository.java
b/rt/management/src/main/java/org/apache/cxf/management/counters/CounterRepository.java
index 3175ba7..f57657c 100644
--- a/rt/management/src/main/java/org/apache/cxf/management/counters/CounterRepository.java
+++ b/rt/management/src/main/java/org/apache/cxf/management/counters/CounterRepository.java
@@ -76,6 +76,7 @@ public class CounterRepository {
         bus.getInInterceptors().add(in);
         bus.getInInterceptors().add(invoker);
         bus.getOutInterceptors().add(out);
+        bus.getOutFaultInterceptors().add(out);
         bus.setExtension(this, CounterRepository.class); 
         
         //create CounterRepositroyMoniter to writer the counter log
@@ -91,7 +92,7 @@ public class CounterRepository {
                 // check if the counter has been created during the locked time
                 counter = getCounter(on);
                 if (counter == null) {
-                    counter = createCounter(on, mhtr);
+                    counter = createCounter(on);
                     counters.put(on, counter);
                 }
             } finally {
@@ -109,7 +110,7 @@ public class CounterRepository {
         return counters.get(on);
     }
     
-    public Counter createCounter(ObjectName on, MessageHandlingTimeRecorder mhtr) {
+    public Counter createCounter(ObjectName on) {
         Counter counter = null;
         counter = new ResponseTimeCounter(on);
         InstrumentationManager im = bus.getExtension(InstrumentationManager.class);

http://git-wip-us.apache.org/repos/asf/cxf/blob/5588092c/rt/management/src/main/java/org/apache/cxf/management/interceptor/ResponseTimeMessageInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/management/src/main/java/org/apache/cxf/management/interceptor/ResponseTimeMessageInInterceptor.java
b/rt/management/src/main/java/org/apache/cxf/management/interceptor/ResponseTimeMessageInInterceptor.java
index 6c6f9a4..04dd0be 100644
--- a/rt/management/src/main/java/org/apache/cxf/management/interceptor/ResponseTimeMessageInInterceptor.java
+++ b/rt/management/src/main/java/org/apache/cxf/management/interceptor/ResponseTimeMessageInInterceptor.java
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.management.interceptor;
 
+import org.apache.cxf.interceptor.AttachmentInInterceptor;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.FaultMode;
@@ -28,29 +29,35 @@ import org.apache.cxf.phase.Phase;
 public class ResponseTimeMessageInInterceptor extends AbstractMessageResponseTimeInterceptor
{
     
     public ResponseTimeMessageInInterceptor() {
-        super(Phase.POST_LOGICAL);
+        super(Phase.RECEIVE);
+        addBefore(AttachmentInInterceptor.class.getName());
     }
     
-    public void handleMessage(Message message) throws Fault {
-        
-        Exchange ex = message.getExchange();        
-        if (isClient(message)) {
-            if (!ex.isOneWay()) {
-                endHandlingMessage(ex);
+    public void handleMessage(Message message) throws Fault {        
+        Exchange ex = message.getExchange();
+        //if serviceCounter is disabled , all responseTimeInterceptors will be skipped
+        Boolean forceDisabled = Boolean.FALSE.equals((Boolean)ex.get("org.apache.cxf.management.counter.enabled"));
+        if (isServiceCounterEnabled(ex) && !forceDisabled) {           
+            ex.put("org.apache.cxf.management.counter.enabled", true);
+            if (isClient(message)) {
+                if (!ex.isOneWay()) {
+                    endHandlingMessage(ex);
+                }
+            } else {
+                beginHandlingMessage(ex);
             }
-        } else {            
-            beginHandlingMessage(ex);            
         }
     }    
     
     @Override
-    public void handleFault(Message message) {
+    public void handleFault(Message message) {     
         Exchange ex = message.getExchange();
-        FaultMode mode = message.get(FaultMode.class);
-        if (mode == null) {
-            mode = FaultMode.RUNTIME_FAULT;
+        if (Boolean.TRUE.equals((Boolean)ex.get("org.apache.cxf.management.counter.enabled")))
{
+            FaultMode mode = message.get(FaultMode.class);
+            if (mode == null) {
+                mode = FaultMode.UNCHECKED_APPLICATION_FAULT;
+            }
+            ex.put(FaultMode.class, mode);
         }
-        ex.put(FaultMode.class, mode);
-        endHandlingMessage(ex);
     }
 }


Mime
View raw message