Coverage Report - org.mule.management.stats.FlowConstructStatistics
 
Classes in this File Line Coverage Branch Coverage Complexity
FlowConstructStatistics
0%
0/21
N/A
1
 
 1  
 /*
 2  
  * $Id: FlowConstructStatistics.java 19191 2010-08-25 21:05:23Z tcarlson $
 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.management.stats;
 12  
 
 13  
 import org.mule.api.management.stats.Statistics;
 14  
 
 15  
 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicLong;
 16  
 
 17  
 public class FlowConstructStatistics implements Statistics
 18  
 {
 19  
     private static final long serialVersionUID = 5337576392583767442L;
 20  
 
 21  
     protected String name;
 22  0
     protected boolean enabled = false;
 23  0
     protected final AtomicLong receivedEventSync = new AtomicLong(0);
 24  0
     protected final AtomicLong receivedEventASync = new AtomicLong(0);
 25  
 
 26  
     public FlowConstructStatistics(String name)
 27  0
     {
 28  0
         this.name = name;
 29  0
     }
 30  
 
 31  
     /**
 32  
      * Are statistics logged
 33  
      */
 34  
     public boolean isEnabled()
 35  
     {
 36  0
         return enabled;
 37  
     }
 38  
 
 39  
     /**
 40  
      * Enable statistics logs (this is a dynamic parameter)
 41  
      */
 42  
     public synchronized void setEnabled(boolean b)
 43  
     {
 44  0
         enabled = b;
 45  0
     }
 46  
 
 47  
     public synchronized String getName()
 48  
     {
 49  0
         return name;
 50  
     }
 51  
 
 52  
     public synchronized void setName(String name)
 53  
     {
 54  0
         this.name = name;
 55  0
     }
 56  
 
 57  
     public synchronized void clear()
 58  
     {
 59  0
         receivedEventSync.set(0);
 60  0
         receivedEventASync.set(0);
 61  0
     }
 62  
 
 63  
     public void incReceivedEventSync()
 64  
     {
 65  0
         receivedEventSync.addAndGet(1);
 66  0
     }
 67  
 
 68  
     public void incReceivedEventASync()
 69  
     {
 70  0
         receivedEventASync.addAndGet(1);
 71  0
     }
 72  
 
 73  
     public long getAsyncEventsReceived()
 74  
     {
 75  0
         return receivedEventASync.get();
 76  
     }
 77  
 
 78  
     public long getSyncEventsReceived()
 79  
     {
 80  0
         return receivedEventSync.get();
 81  
     }
 82  
 
 83  
 }