Search in sources :

Example 11 with FaultMode

use of org.apache.cxf.message.FaultMode in project cxf by apache.

the class CodahaleMetricsContext method stop.

public void stop(long timeInNS, long inSize, long outSize, Exchange ex) {
    totals.update(timeInNS, TimeUnit.NANOSECONDS);
    if (inSize != -1) {
        incomingData.mark(inSize);
    }
    if (outSize != -1) {
        outgoingData.mark(outSize);
    }
    FaultMode fm = ex.get(FaultMode.class);
    if (fm == null && ex.getOutFaultMessage() != null) {
        fm = ex.getOutFaultMessage().get(FaultMode.class);
    }
    if (fm == null && ex.getInMessage() != null) {
        fm = ex.getInMessage().get(FaultMode.class);
    }
    if (fm != null) {
        switch(fm) {
            case CHECKED_APPLICATION_FAULT:
                checkedApplicationFaults.update(timeInNS, TimeUnit.NANOSECONDS);
                break;
            case UNCHECKED_APPLICATION_FAULT:
                uncheckedApplicationFaults.update(timeInNS, TimeUnit.NANOSECONDS);
                break;
            case RUNTIME_FAULT:
                runtimeFaults.update(timeInNS, TimeUnit.NANOSECONDS);
                break;
            case LOGICAL_RUNTIME_FAULT:
                logicalRuntimeFaults.update(timeInNS, TimeUnit.NANOSECONDS);
                break;
            default:
        }
    }
    inFlight.dec();
}
Also used : FaultMode(org.apache.cxf.message.FaultMode)

Example 12 with FaultMode

use of org.apache.cxf.message.FaultMode in project cxf by apache.

the class MetricsMessageClientOutInterceptor method handleFault.

public void handleFault(Message message) {
    if (isRequestor(message)) {
        Exception ex = message.getContent(Exception.class);
        if (ex != null) {
            FaultMode fm = message.getExchange().get(FaultMode.class);
            message.getExchange().put(FaultMode.class, FaultMode.RUNTIME_FAULT);
            stop(message);
            message.getExchange().put(FaultMode.class, fm);
        } else {
            stop(message);
        }
    }
}
Also used : FaultMode(org.apache.cxf.message.FaultMode)

Aggregations

FaultMode (org.apache.cxf.message.FaultMode)12 Exchange (org.apache.cxf.message.Exchange)4 Message (org.apache.cxf.message.Message)3 Method (java.lang.reflect.Method)2 Bus (org.apache.cxf.Bus)2 ClassLoaderHolder (org.apache.cxf.common.classloader.ClassLoaderUtils.ClassLoaderHolder)2 Fault (org.apache.cxf.interceptor.Fault)2 MessageHandlingTimeRecorder (org.apache.cxf.management.counters.MessageHandlingTimeRecorder)2 MessageImpl (org.apache.cxf.message.MessageImpl)2 PhaseInterceptorChain (org.apache.cxf.phase.PhaseInterceptorChain)2 BindingFaultInfo (org.apache.cxf.service.model.BindingFaultInfo)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Locale (java.util.Locale)1 QName (javax.xml.namespace.QName)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)1 Schema (javax.xml.validation.Schema)1 WebFault (javax.xml.ws.WebFault)1 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)1 SoapFault (org.apache.cxf.binding.soap.SoapFault)1