[jboss-cvs] JBossAS SVN: r60251 - branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Feb 4 00:10:02 EST 2007
Author: bstansberry at jboss.com
Date: 2007-02-04 00:10:02 -0500 (Sun, 04 Feb 2007)
New Revision: 60251
Modified:
branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java
Log:
Sync up with trunk
Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java 2007-02-04 05:08:32 UTC (rev 60250)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java 2007-02-04 05:10:02 UTC (rev 60251)
@@ -25,6 +25,7 @@
import java.util.Iterator;
import java.util.Set;
+import javax.annotation.PreDestroy;
import javax.ejb.Remote;
import javax.ejb.Remove;
import javax.ejb.Stateless;
@@ -34,12 +35,11 @@
import javax.persistence.PersistenceContext;
import org.jboss.cache.Fqn;
+import org.jboss.cache.AbstractTreeCacheListener;
import org.jboss.cache.TreeCache;
import org.jboss.cache.TreeCacheMBean;
-import org.jboss.cache.TreeCacheListener;
import org.jboss.mx.util.MBeanProxyExt;
import org.jboss.mx.util.MBeanServerLocator;
-import org.jgroups.View;
/**
* Comment
@@ -105,9 +105,13 @@
manager.persist(customer);
return customer;
}
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
catch (Exception e)
{
- throw new RuntimeException(e); // TODO Auto-generated catch block
+ throw new RuntimeException(e);
}
finally
{
@@ -125,9 +129,13 @@
return customer;
}
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
catch (Exception e)
{
- throw new RuntimeException(e); // TODO Auto-generated catch block
+ throw new RuntimeException(e);
}
finally
{
@@ -157,18 +165,41 @@
}
+ @PreDestroy
@Remove
public void cleanup()
{
- Customer c = findByCustomerId(1);
- if (c != null)
+ try
+ {
+ if (listener != null)
+ {
+ getCache().removeTreeCacheListener(listener);
+ }
+ }
+ catch (Exception e)
{
- Set contacts = c.getContacts();
- for (Iterator it = contacts.iterator(); it.hasNext();)
- manager.remove(it.next());
- c.setContacts(null);
- manager.remove(c);
+ e.printStackTrace();
}
+
+ try
+ {
+ if (manager != null)
+ {
+ Customer c = findByCustomerId(1);
+ if (c != null)
+ {
+ Set contacts = c.getContacts();
+ for (Iterator it = contacts.iterator(); it.hasNext();)
+ manager.remove(it.next());
+ c.setContacts(null);
+ manager.remove(c);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
}
private TreeCache getCache() throws Exception
@@ -180,7 +211,7 @@
return cache;
}
- class MyListener implements TreeCacheListener
+ class MyListener extends AbstractTreeCacheListener
{
HashSet visited = new HashSet();
@@ -189,73 +220,17 @@
visited.clear();
}
- public void nodeVisited(Fqn fqn, boolean pre)
+ @Override
+ public void nodeVisited(Fqn fqn)
{
- if (!pre)
- {
- System.out.println("MyListener - Visiting node " + fqn.toString());
- String name = fqn.toString();
- String token = ".clusteredentity.";
- int index = name.indexOf(token);
- index += token.length();
- name = name.substring(index);
- System.out.println(name);
- visited.add(name);
- }
+ System.out.println("MyListener - Visiting node " + fqn.toString());
+ String name = fqn.toString();
+ String token = ".clusteredentity.";
+ int index = name.indexOf(token);
+ index += token.length();
+ name = name.substring(index);
+ System.out.println(name);
+ visited.add(name);
}
-
- public void cacheStarted(TreeCache arg0)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void cacheStopped(TreeCache arg0)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void nodeCreated(Fqn arg0)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void nodeEvicted(Fqn arg0)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void nodeLoaded(Fqn arg0)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void nodeModified(Fqn arg0)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void nodeRemoved(Fqn arg0)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void nodeVisited(Fqn arg0)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void viewChange(View arg0)
- {
- // TODO Auto-generated method stub
-
- }
}
}
More information about the jboss-cvs-commits
mailing list