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