KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > optimistic > TestListener


1 /*
2  * Created on 23-Feb-2005
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.AbstractCacheListener;
12 import org.jboss.cache.Fqn;
13
14 /**
15  * @author swoodcock
16  */

17 public class TestListener extends AbstractCacheListener
18 {
19
20    Log log = LogFactory.getLog(getClass());
21    private int nodesAdded = 0;
22
23    /* (non-Javadoc)
24    * @see org.jboss.cache.TreeCacheListener#nodeCreated(org.jboss.cache.Fqn)
25    */

26    public synchronized void nodeCreated(Fqn fqn, boolean pre, boolean local)
27    {
28       if (pre)
29       {
30          nodesAdded++;
31          log.info("DataNode created " + fqn);
32       }
33    }
34
35    /**
36     * @return Returns the nodesAdded.
37     */

38    public int getNodesAdded()
39    {
40       return nodesAdded;
41    }
42
43    /**
44     * @param nodesAdded The nodesAdded to set.
45     */

46    public void setNodesAdded(int nodesAdded)
47    {
48       this.nodesAdded = nodesAdded;
49    }
50 }
51
Popular Tags