Coverage Report - org.mule.service.processor.ServiceOutboundStatisticsObserver
 
Classes in this File Line Coverage Branch Coverage Complexity
ServiceOutboundStatisticsObserver
0%
0/10
0%
0/10
0
 
 1  
 /*
 2  
  * $Id$
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.service.processor;
 12  
 
 13  
 import org.mule.api.MuleEvent;
 14  
 import org.mule.api.routing.OutboundRouterCollection;
 15  
 import org.mule.api.service.Service;
 16  
 import org.mule.management.stats.ServiceStatistics;
 17  
 import org.mule.processor.AbstractMessageObserver;
 18  
 
 19  
 public class ServiceOutboundStatisticsObserver extends AbstractMessageObserver
 20  
 {
 21  
 
 22  
     protected Service service;
 23  
 
 24  
     public ServiceOutboundStatisticsObserver(Service service)
 25  0
     {
 26  0
         this.service = service;
 27  0
     }
 28  
 
 29  
     @Override
 30  
     public void observe(MuleEvent event)
 31  
     {
 32  0
         ServiceStatistics stats = service.getStatistics();
 33  0
         if (stats.isEnabled())
 34  
         {
 35  0
             if (!(service.getOutboundMessageProcessor() instanceof OutboundRouterCollection)
 36  
                 || (service.getOutboundMessageProcessor() instanceof OutboundRouterCollection && ((OutboundRouterCollection) service.getOutboundMessageProcessor()).hasEndpoints()))
 37  
             {
 38  0
                 if (event.getEndpoint().getExchangePattern().hasResponse())
 39  
                 {
 40  0
                     stats.incSentEventSync();
 41  
                 }
 42  
                 else
 43  
                 {
 44  0
                     stats.incSentEventASync();
 45  
                 }
 46  
             }
 47  
         }
 48  0
     }
 49  
 }