[libbluray-devel] BDJ: Clean up IxcRegistry at shutdown
hpi1
git at videolan.org
Thu Apr 24 11:32:35 CEST 2014
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Apr 24 12:05:00 2014 +0300| [829df481408439ce079790bcfe3339abc597b3d5] | committer: hpi1
BDJ: Clean up IxcRegistry at shutdown
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=829df481408439ce079790bcfe3339abc597b3d5
---
.../bdj/java/org/dvb/io/ixc/IxcRegistry.java | 20 +++++++++++++++++---
.../bdj/java/org/videolan/IxcRegistryImpl.java | 16 ++++++++++++++++
src/libbluray/bdj/java/org/videolan/Libbluray.java | 2 ++
3 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/src/libbluray/bdj/java/org/dvb/io/ixc/IxcRegistry.java b/src/libbluray/bdj/java/org/dvb/io/ixc/IxcRegistry.java
index e82b3b9..d68e1c1 100644
--- a/src/libbluray/bdj/java/org/dvb/io/ixc/IxcRegistry.java
+++ b/src/libbluray/bdj/java/org/dvb/io/ixc/IxcRegistry.java
@@ -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 {
diff --git a/src/libbluray/bdj/java/org/videolan/IxcRegistryImpl.java b/src/libbluray/bdj/java/org/videolan/IxcRegistryImpl.java
index 8c2b9b9..73271c8 100644
--- a/src/libbluray/bdj/java/org/videolan/IxcRegistryImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/IxcRegistryImpl.java
@@ -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") + "/";
diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index c61d52e..450299c 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -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();
}
More information about the libbluray-devel
mailing list