[libbluray-devel] shutdown ServiceContextFactory

hpi1 git at videolan.org
Mon Oct 20 13:30:49 CEST 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Oct 10 13:42:37 2014 +0300| [cb5df79d51cbbaff413799be9e9cdd8ea178da26] | committer: hpi1

shutdown ServiceContextFactory

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

 .../tv/service/selection/ServiceContextFactoryImpl.java  |    4 ++++
 src/libbluray/bdj/java/org/videolan/Libbluray.java       |   14 ++++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextFactoryImpl.java b/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextFactoryImpl.java
index 2d7a82a..e1e8dea 100644
--- a/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextFactoryImpl.java
+++ b/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextFactoryImpl.java
@@ -37,6 +37,10 @@ public class ServiceContextFactoryImpl extends ServiceContextFactory {
         return instance;
     }
 
+    public static void shutdown() {
+        instance = null;
+    }
+
     public ServiceContext createServiceContext()
             throws InsufficientResourcesException, SecurityException
     {
diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index 4061c0f..07088b7 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -28,6 +28,7 @@ import javax.media.PackageManager;
 import javax.tv.service.SIManager;
 import javax.tv.service.SIManagerImpl;
 import javax.tv.service.selection.ServiceContextFactory;
+import javax.tv.service.selection.ServiceContextFactoryImpl;
 import org.bluray.bdplus.Status;
 import org.bluray.net.BDLocator;
 import org.bluray.ti.DiscManager;
@@ -132,7 +133,7 @@ public class Libbluray {
 
     public static void shutdown() {
         try {
-            stopTitle();
+            stopTitle(true);
             BDJLoader.shutdown();
             BDJActionManager.shutdown();
             MountManager.unmountAll();
@@ -143,6 +144,7 @@ public class Libbluray {
             IxcRegistry.shutdown();
             EventManager.shutdown();
             Status.shutdown();
+            ServiceContextFactoryImpl.shutdown();
         } catch (Throwable e) {
             e.printStackTrace();
         }
@@ -354,11 +356,15 @@ public class Libbluray {
         }
     }
 
-    private static boolean stopTitle() {
+    private static boolean stopTitle(boolean shutdown) {
         TitleContext titleContext = null;
         try {
             titleContext = (TitleContext)ServiceContextFactory.getInstance().getServiceContext(null);
-            titleContext.destroy();
+            if (shutdown) {
+                titleContext.destroy();
+            } else {
+                titleContext.stop();
+            }
             return true;
         } catch (Throwable e) {
             System.err.println("stopTitle() failed: " + e);
@@ -376,7 +382,7 @@ public class Libbluray {
         case BDJ_EVENT_START:
             return startTitle(param);
         case BDJ_EVENT_STOP:
-            return stopTitle();
+            return stopTitle(false);
 
         case BDJ_EVENT_CHAPTER:
             PlayerManager.getInstance().onChapterReach(param);



More information about the libbluray-devel mailing list