1
2
3
4
5
6
7 package org.mule.tck.functional;
8
9 import org.mule.api.MuleEventContext;
10
11 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger;
12
13
14
15
16 public class CounterCallback implements EventCallback
17 {
18 private AtomicInteger callbackCount;
19
20 public CounterCallback()
21 {
22 callbackCount = new AtomicInteger(0);
23 }
24
25 public CounterCallback(AtomicInteger callbackCount)
26 {
27 this.callbackCount = callbackCount;
28 }
29
30 public void eventReceived(MuleEventContext context, Object Component) throws Exception
31 {
32 incCallbackCount();
33 }
34
35
36
37
38
39 protected int incCallbackCount()
40 {
41 return callbackCount.incrementAndGet();
42 }
43
44 public int getCallbackCount()
45 {
46 return callbackCount.intValue();
47 }
48 }