Commit 6cf64446 authored by hpi1's avatar hpi1

Status: release all listeners on shutdown

parent 977a0f23
......@@ -32,6 +32,17 @@ public class Status {
return instance;
}
public static void shutdown() {
Status s;
synchronized (Status.class) {
s = instance;
instance = null;
}
if (s != null) {
s.listeners.clear();
}
}
public void addListener(StatusListener listener) {
listeners.add(listener);
}
......
......@@ -42,14 +42,13 @@ public class IxcRegistry {
}
public static void shutdown() {
IxcRegistryImpl r;
synchronized (IxcRegistry.class) {
try {
if (registry != null) {
registry.unbindAll();
}
} finally {
registry = null;
}
r = registry;
registry = null;
}
if (r != null) {
r.unbindAll();
}
}
......
......@@ -75,6 +75,16 @@ public class BDJListeners {
}
}
public void clear() {
if (null != BDJXletContext.getCurrentContext()) {
logger.error("clear() from wrong thread: " + Logger.dumpStack());
return;
}
synchronized (listeners) {
listeners.clear();
}
}
public void putCallback(Object event) {
synchronized (listeners) {
for (Iterator it = listeners.iterator(); it.hasNext(); ) {
......
......@@ -28,6 +28,7 @@ import javax.media.PackageManager;
import javax.tv.service.SIManagerImpl;
import javax.tv.service.selection.ServiceContextFactory;
import org.bluray.bdplus.Status;
import org.bluray.ti.DiscManager;
import org.bluray.ti.TitleImpl;
import org.bluray.ti.selection.TitleContext;
......@@ -137,6 +138,7 @@ public class Libbluray {
BDToolkit.shutdownDisc();
SIManagerImpl.shutdown();
IxcRegistry.shutdown();
Status.shutdown();
} catch (Throwable e) {
e.printStackTrace();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment