Search in sources :

Example 1 with Counter

use of org.apache.cxf.management.counters.Counter in project cxf by apache.

the class AbstractMessageResponseTimeInterceptor method isServiceCounterEnabled.

protected boolean isServiceCounterEnabled(Exchange ex) {
    Bus bus = ex.getBus();
    CounterRepository counterRepo = bus.getExtension(CounterRepository.class);
    if (counterRepo == null) {
        return false;
    }
    ObjectName serviceCounterName = getServiceCounterName(ex);
    Counter serviceCounter = counterRepo.getCounter(serviceCounterName);
    // If serviceCounter is null, we need to wait ResponseTimeOutInterceptor to create it , hence set to true
    return serviceCounter == null || serviceCounter.isEnabled();
}
Also used : Bus(org.apache.cxf.Bus) Counter(org.apache.cxf.management.counters.Counter) CounterRepository(org.apache.cxf.management.counters.CounterRepository) ObjectName(javax.management.ObjectName)

Aggregations

ObjectName (javax.management.ObjectName)1 Bus (org.apache.cxf.Bus)1 Counter (org.apache.cxf.management.counters.Counter)1 CounterRepository (org.apache.cxf.management.counters.CounterRepository)1