View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.util.counters.impl;
8   
9   import org.mule.util.counters.Counter;
10  import org.mule.util.counters.CounterFactory.Type;
11  
12  public abstract class AggregateCounter extends AbstractCounter
13  {
14  
15      private final Counter base;
16  
17      public AggregateCounter(String name, Type type, AbstractCounter base)
18      {
19          super(name, type);
20          this.base = base;
21          base.addAggregate(this);
22      }
23  
24      public double increment()
25      {
26          throw new UnsupportedOperationException();
27      }
28  
29      public double incrementBy(double value)
30      {
31          throw new UnsupportedOperationException();
32      }
33  
34      public double decrement()
35      {
36          throw new UnsupportedOperationException();
37      }
38  
39      public void setRawValue(double value)
40      {
41          throw new UnsupportedOperationException();
42      }
43  
44      public final synchronized void compute()
45      {
46          this.doCompute();
47          this.propagate();
48      }
49  
50      public Counter getBase()
51      {
52          return this.base;
53      }
54  
55      public abstract double nextValue();
56  
57      public abstract void doCompute();
58  
59  }