[wise-commits] wise SVN: r457 - webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui.
wise-commits at lists.jboss.org
wise-commits at lists.jboss.org
Sun Jan 20 17:24:39 EST 2013
Author: alessio.soldano at jboss.com
Date: 2013-01-20 17:24:39 -0500 (Sun, 20 Jan 2013)
New Revision: 457
Modified:
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/CleanupHelper.java
webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/CleanupTask.java
Log:
Also cleanup references when undeploying app / stopping server
Modified: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/CleanupHelper.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/CleanupHelper.java 2013-01-20 22:14:49 UTC (rev 456)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/CleanupHelper.java 2013-01-20 22:24:39 UTC (rev 457)
@@ -19,6 +19,7 @@
import java.util.LinkedList;
import java.util.List;
+import javax.annotation.PreDestroy;
import javax.ejb.Schedule;
import javax.ejb.Singleton;
import javax.ejb.Startup;
@@ -38,6 +39,15 @@
}
}
+ @PreDestroy
+ public void cleanup() {
+ synchronized (tasks) {
+ for (CleanupTask<?> task : tasks) {
+ task.refsCleanupNoChecks();
+ }
+ }
+ }
+
public static void addTask(CleanupTask<?> task) {
synchronized (tasks) {
tasks.add(task);
Modified: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/CleanupTask.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/CleanupTask.java 2013-01-20 22:14:49 UTC (rev 456)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/CleanupTask.java 2013-01-20 22:24:39 UTC (rev 457)
@@ -49,6 +49,15 @@
}
}
+ public synchronized void refsCleanupNoChecks() {
+ for (Iterator<Entry<Long, Holder<T>>> it = refs.entrySet().iterator(); it.hasNext(); ) {
+ Entry<Long, Holder<T>> entry = it.next();
+ Holder<T> h = entry.getValue();
+ h.getCallback().cleanup(h.getData());
+ it.remove();
+ }
+ }
+
public synchronized void removeRef(T obj) {
boolean done = false;
final Holder<T> r = new Holder<T>(obj);
More information about the wise-commits
mailing list