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