[libbluray-devel] BD-J: Split Xlet context release to in-xlet and privileged parts

hpi1 git at videolan.org
Wed Mar 23 11:55:44 CET 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Mar 23 12:07:10 2016 +0200| [fdd5f1a607db3b26c78aadb88f76dec3ba4794b9] | committer: hpi1

BD-J: Split Xlet context release to in-xlet and privileged parts

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

 src/libbluray/bdj/java/org/videolan/BDJAppProxy.java     |    2 ++
 src/libbluray/bdj/java/org/videolan/BDJXletContext.java  |   14 +++++++++++---
 src/libbluray/bdj/java/org/videolan/IxcRegistryImpl.java |    4 ++--
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/libbluray/bdj/java/org/videolan/BDJAppProxy.java b/src/libbluray/bdj/java/org/videolan/BDJAppProxy.java
index b5dfcf6..1bacac0 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJAppProxy.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJAppProxy.java
@@ -252,6 +252,8 @@ class BDJAppProxy implements DVBJProxy, Runnable {
                 context.closeSockets();
                 context.getThreadGroup().waitForShutdown(1000, 1 + context.numEventQueueThreads());
 
+                context.exitXlet();
+
             } catch (Throwable e) {
                 logger.error("doStop() failed: " + e + "\n" + Logger.dumpStack(e));
                 state = INVALID;
diff --git a/src/libbluray/bdj/java/org/videolan/BDJXletContext.java b/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
index 8ee818a..57388a7 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
@@ -444,19 +444,27 @@ public class BDJXletContext implements javax.tv.xlet.XletContext, javax.microedi
                 entry.getInitialClass());
     }
 
-    protected void release() {
+    protected void exitXlet() {
+        // Called from AppProxy when destroyXlet() has been called.
+        // Release as much resources as possible while running in Xlet context.
+
+        org.dvb.io.ixc.IxcRegistry.unbindAll(this);
 
         closeSockets();
         removeAllFAA();
         stopIxcThreads();
-        defaultLooks.clear();
 
-        org.dvb.io.ixc.IxcRegistry.unbindAll(this);
+        defaultLooks.clear();
 
         if (sceneFactory != null) {
             sceneFactory.dispose();
             sceneFactory = null;
         }
+    }
+
+    protected void release() {
+
+        exitXlet();
 
         callbackQueue.shutdown();
         userEventQueue.shutdown();
diff --git a/src/libbluray/bdj/java/org/videolan/IxcRegistryImpl.java b/src/libbluray/bdj/java/org/videolan/IxcRegistryImpl.java
index bae986f..2413c2d 100644
--- a/src/libbluray/bdj/java/org/videolan/IxcRegistryImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/IxcRegistryImpl.java
@@ -510,8 +510,8 @@ public class IxcRegistryImpl {
     }
 
     public void unbindAll(XletContext xc) {
-
-        if (null != BDJXletContext.getCurrentContext()) {
+        XletContext requestor = BDJXletContext.getCurrentContext();
+        if (requestor != null && requestor != xc) {
             logger.error("unbindAll(ctx) from wrong thread: " + Logger.dumpStack());
             return;
         }



More information about the libbluray-devel mailing list