[libbluray-devel] BDJ: kill xlet if terminating it takes too long time

hpi1 git at videolan.org
Sun Feb 22 22:08:22 CET 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Feb 22 23:06:03 2015 +0200| [64a48435eb3826e67bda39f03068e969806f6bc1] | committer: hpi1

BDJ: kill xlet if terminating it takes too long time

Fixes discs with badly behaving Xlets.

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

 src/libbluray/bdj/java/org/videolan/BDJAppProxy.java |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/libbluray/bdj/java/org/videolan/BDJAppProxy.java b/src/libbluray/bdj/java/org/videolan/BDJAppProxy.java
index b488e83..cdcfea9 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJAppProxy.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJAppProxy.java
@@ -140,10 +140,9 @@ public class BDJAppProxy implements DVBJProxy, Runnable {
             cmds.addLast(null);
             cmds.notifyAll();
         }
-        try {
-            thread.join();
-        } catch (InterruptedException e) {
 
+        if (!cmd.waitDone(5000)) {
+            logger.error("release(): STOP timeout, killing Xlet " + context.getThreadGroup().getName());
         }
 
         context.release();
@@ -382,16 +381,21 @@ public class BDJAppProxy implements DVBJProxy, Runnable {
             return arg;
         }
 
-        public void waitDone() {
+        public boolean waitDone(int timeoutMs) {
             synchronized(this) {
                 while (!done) {
                     try {
-                        this.wait();
+                        if (timeoutMs < 1) {
+                            this.wait();
+                        } else {
+                            this.wait(timeoutMs);
+                            break;
+                        }
                     } catch (InterruptedException e) {
-
                     }
                 }
             }
+            return done;
         }
 
         public void release() {



More information about the libbluray-devel mailing list