[libbluray-devel] Synchronize lazy initialization

hpi1 git at videolan.org
Sun Feb 19 12:27:39 CET 2017


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Jan 10 10:58:52 2017 +0200| [d701c4eb57cafecbb57a57a1bcae659e14264191] | committer: hpi1

Synchronize lazy initialization

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

 src/libbluray/bdj/java/java/io/FileInputStream.java | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/libbluray/bdj/java/java/io/FileInputStream.java b/src/libbluray/bdj/java/java/io/FileInputStream.java
index 2dff711..33e868e 100644
--- a/src/libbluray/bdj/java/java/io/FileInputStream.java
+++ b/src/libbluray/bdj/java/java/io/FileInputStream.java
@@ -51,9 +51,11 @@ public class FileInputStream extends InputStream
         if (file.isAbsolute()) {
             String cachedName = BDJLoader.getCachedFile(name);
             if (cachedName != name) {
+                synchronized (FileInputStream.class) {
                 if (logger == null) {
                     logger = Logger.getLogger(FileInputStream.class.getName());
                 }
+                }
                 logger.info("Using cached " + cachedName + " for " + name);
                 name = cachedName;
             }
@@ -64,9 +66,11 @@ public class FileInputStream extends InputStream
 
             String home = BDJXletContext.getCurrentXletHome();
             if (home == null) {
+                synchronized (FileInputStream.class) {
                 if (logger == null) {
                     logger = Logger.getLogger(FileInputStream.class.getName());
                 }
+                }
                 logger.error("no home found for " + name + " at " + Logger.dumpStack());
                 throw new FileNotFoundException(name);
             }



More information about the libbluray-devel mailing list