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 | 0 | { |
22 | 0 | callbackCount = new AtomicInteger(0); |
23 | 0 | } |
24 | |
|
25 | |
public CounterCallback(AtomicInteger callbackCount) |
26 | 0 | { |
27 | 0 | this.callbackCount = callbackCount; |
28 | 0 | } |
29 | |
|
30 | |
public void eventReceived(MuleEventContext context, Object Component) throws Exception |
31 | |
{ |
32 | 0 | incCallbackCount(); |
33 | 0 | } |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
protected int incCallbackCount() |
40 | |
{ |
41 | 0 | return callbackCount.incrementAndGet(); |
42 | |
} |
43 | |
|
44 | |
public int getCallbackCount() |
45 | |
{ |
46 | 0 | return callbackCount.intValue(); |
47 | |
} |
48 | |
} |