[libbluray-devel] EventManager: move current Xlet context resolving outside of synchronized( ) blocks

hpi1 git at videolan.org
Fri Apr 25 10:47:13 CEST 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Apr 25 09:32:42 2014 +0300| [9e9800b3c95917ae29f5cfd9239517e9d0a1289d] | committer: hpi1

EventManager: move current Xlet context resolving outside of synchronized() blocks

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

 src/libbluray/bdj/java/org/dvb/event/EventManager.java |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/libbluray/bdj/java/org/dvb/event/EventManager.java b/src/libbluray/bdj/java/org/dvb/event/EventManager.java
index c96ca2e..f75bfaf 100644
--- a/src/libbluray/bdj/java/org/dvb/event/EventManager.java
+++ b/src/libbluray/bdj/java/org/dvb/event/EventManager.java
@@ -48,10 +48,11 @@ public class EventManager implements ResourceServer {
         throws IllegalArgumentException {
         if (client == null)
             throw new IllegalArgumentException();
+        BDJXletContext context = BDJXletContext.getCurrentContext();
         synchronized (this) {
             if (!cleanupReservedEvents(userEvents))
                 return false;
-            exclusiveUserEventListener.add(new UserEventItem(BDJXletContext.getCurrentContext(), listener, client, userEvents));
+            exclusiveUserEventListener.add(new UserEventItem(context, listener, client, userEvents));
             sendResourceStatusEvent(new UserEventUnavailableEvent(userEvents));
             return true;
         }
@@ -60,8 +61,9 @@ public class EventManager implements ResourceServer {
     public void addUserEventListener(UserEventListener listener, UserEventRepository userEvents) {
         if (listener == null || userEvents == null)
             throw new NullPointerException();
+        BDJXletContext context = BDJXletContext.getCurrentContext();
         synchronized (this) {
-            sharedUserEventListener.add(new UserEventItem(BDJXletContext.getCurrentContext(), listener, null, userEvents));
+            sharedUserEventListener.add(new UserEventItem(context, listener, null, userEvents));
         }
     }
 
@@ -87,10 +89,11 @@ public class EventManager implements ResourceServer {
             throws IllegalArgumentException {
         if (client == null)
             throw new IllegalArgumentException();
+        BDJXletContext context = BDJXletContext.getCurrentContext();
         synchronized (this) {
             if (!cleanupReservedEvents(userEvents))
                 return false;
-            exclusiveAWTEventListener.add(new UserEventItem(BDJXletContext.getCurrentContext(), null, client, userEvents));
+            exclusiveAWTEventListener.add(new UserEventItem(context, null, client, userEvents));
             sendResourceStatusEvent(new UserEventUnavailableEvent(userEvents));
             return true;
         }



More information about the libbluray-devel mailing list