1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| package org.jboss.cache.optimistic; |
8 |
| |
9 |
| import org.apache.commons.logging.Log; |
10 |
| import org.apache.commons.logging.LogFactory; |
11 |
| import org.jboss.cache.notifications.annotation.CacheListener; |
12 |
| import org.jboss.cache.notifications.annotation.NodeCreated; |
13 |
| import org.jboss.cache.notifications.event.NodeEvent; |
14 |
| |
15 |
| |
16 |
| |
17 |
| |
18 |
| @CacheListener |
19 |
| public class TestListener |
20 |
| { |
21 |
| |
22 |
| Log log = LogFactory.getLog(getClass()); |
23 |
| private int nodesAdded = 0; |
24 |
| |
25 |
| |
26 |
| |
27 |
| |
28 |
618
| @NodeCreated
|
29 |
| public synchronized void nodeCreated(NodeEvent e) |
30 |
| { |
31 |
618
| if (e.isPre())
|
32 |
| { |
33 |
309
| nodesAdded++;
|
34 |
309
| log.info("DataNode created " + e.getFqn());
|
35 |
| } |
36 |
| } |
37 |
| |
38 |
| |
39 |
| |
40 |
| |
41 |
5
| public int getNodesAdded()
|
42 |
| { |
43 |
5
| return nodesAdded;
|
44 |
| } |
45 |
| |
46 |
| |
47 |
| |
48 |
| |
49 |
0
| public void setNodesAdded(int nodesAdded)
|
50 |
| { |
51 |
0
| this.nodesAdded = nodesAdded;
|
52 |
| } |
53 |
| } |