[libbluray-devel] Unbind all registered Ixc objects when Xlet terminates

hpi1 git at videolan.org
Fri Aug 23 10:29:01 CEST 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Aug 23 11:20:33 2013 +0300| [1cde9460988aa605fe972640b7581e6511789e15] | committer: hpi1

Unbind all registered Ixc objects when Xlet terminates

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=1cde9460988aa605fe972640b7581e6511789e15
---

 src/libbluray/bdj/java/org/dvb/io/ixc/IxcRegistry.java |    4 ++++
 .../bdj/java/org/videolan/BDJXletContext.java          |    2 ++
 .../bdj/java/org/videolan/IxcRegistryImpl.java         |   16 ++++++++++++++++
 3 files changed, 22 insertions(+)

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 b861628..e82b3b9 100644
--- a/src/libbluray/bdj/java/org/dvb/io/ixc/IxcRegistry.java
+++ b/src/libbluray/bdj/java/org/dvb/io/ixc/IxcRegistry.java
@@ -108,4 +108,8 @@ public class IxcRegistry {
     public static String[] list(XletContext xc) {
         return getIxcRegistry().list();
     }
+
+    public static void unbindAll(XletContext xc) {
+        getIxcRegistry().unbindAll(xc);
+    }
 }
diff --git a/src/libbluray/bdj/java/org/videolan/BDJXletContext.java b/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
index bccf7fb..1a7d2fe 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
@@ -195,6 +195,8 @@ public class BDJXletContext implements javax.tv.xlet.XletContext, javax.microedi
     protected void release() {
         stopIxcThreads();
 
+        org.dvb.io.ixc.IxcRegistry.unbindAll(this);
+
         if (sceneFactory != null) {
             sceneFactory.dispose();
             sceneFactory = null;
diff --git a/src/libbluray/bdj/java/org/videolan/IxcRegistryImpl.java b/src/libbluray/bdj/java/org/videolan/IxcRegistryImpl.java
index 10f0d9c..2b23e5f 100644
--- a/src/libbluray/bdj/java/org/videolan/IxcRegistryImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/IxcRegistryImpl.java
@@ -395,4 +395,20 @@ public class IxcRegistryImpl {
 
         return result;
     }
+
+    public void unbindAll(XletContext xc) {
+
+        Debug("IxcRegistry.removeBinding(" + xc + ")");
+        String prefix = "/" + (String)xc.getXletProperty("dvb.org.id") + "/" + (String)xc.getXletProperty("dvb.app.id") + "/";
+
+        synchronized (remoteObjects) {
+            Iterator it = remoteObjects.keySet().iterator();
+            while (it.hasNext()) {
+                Object o = it.next();
+                String path = (String)o;
+                if (path.startsWith(prefix))
+                    it.remove();
+            }
+        }
+    }
 }



More information about the libbluray-devel mailing list