Commit 829df481 authored by hpi1's avatar hpi1

BDJ: Clean up IxcRegistry at shutdown

parent 913b143f
......@@ -33,10 +33,24 @@ public class IxcRegistry {
private static IxcRegistryImpl registry = null;
private static IxcRegistryImpl getIxcRegistry() {
if (registry == null) {
registry = new IxcRegistryImpl();
synchronized (IxcRegistry.class) {
if (registry == null) {
registry = new IxcRegistryImpl();
}
return registry;
}
}
public static void shutdown() {
synchronized (IxcRegistry.class) {
try {
if (registry != null) {
registry.unbindAll();
}
} finally {
registry = null;
}
}
return registry;
}
public static Remote lookup(XletContext xc, String path) throws NotBoundException, RemoteException {
......
......@@ -473,8 +473,24 @@ public class IxcRegistryImpl {
return result;
}
public void unbindAll() {
if (null != BDJXletContext.getCurrentContext()) {
logger.error("unbindAll() from wrong thread: " + Logger.dumpStack());
return;
}
synchronized (remoteObjects) {
remoteObjects.clear();
}
}
public void unbindAll(XletContext xc) {
if (null != BDJXletContext.getCurrentContext()) {
logger.error("unbindAll(ctx) from wrong thread: " + Logger.dumpStack());
return;
}
Debug("IxcRegistry.removeBinding(" + xc + ")");
String prefix = "/" + (String)xc.getXletProperty("dvb.org.id") + "/" + (String)xc.getXletProperty("dvb.app.id") + "/";
......
......@@ -33,6 +33,7 @@ import org.bluray.ti.TitleImpl;
import org.bluray.ti.selection.TitleContext;
import org.bluray.ui.event.HRcEvent;
import org.dvb.event.EventManager;
import org.dvb.io.ixc.IxcRegistry;
import org.dvb.ui.FontFactory;
import org.videolan.bdjo.Bdjo;
import org.videolan.media.content.PlayerManager;
......@@ -135,6 +136,7 @@ public class Libbluray {
GUIManager.shutdown();
BDToolkit.shutdownDisc();
SIManagerImpl.shutdown();
IxcRegistry.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