Merge branch 'subtree'
authorNiki Roo <niki@nikiroo.be>
Sat, 25 Apr 2020 19:12:55 +0000 (21:12 +0200)
committerNiki Roo <niki@nikiroo.be>
Sat, 25 Apr 2020 19:12:55 +0000 (21:12 +0200)
src/be/nikiroo/fanfix/library/BasicLibrary.java
src/be/nikiroo/fanfix/library/CacheLibrary.java
src/be/nikiroo/fanfix/library/LocalLibrary.java

index 586c4ef17e11ff4d8c7eefa1cf6c689dac71ce59..a754c002d3e99b2ecb25df00038599b67b0fa021 100644 (file)
@@ -348,14 +348,14 @@ abstract public class BasicLibrary {
 
        /**
         * Check if the {@link Story} denoted by this Library UID is present in the
-        * cache (if we have no cache, we default to </t>true</tt>).
+        * cache (if we have no cache, we default to </tt>true</tt>).
         * 
         * @param luid
         *            the Library UID
         * 
         * @return TRUE if it is
         */
-       public boolean isCached(String luid) {
+       public boolean isCached(@SuppressWarnings("unused") String luid) {
                // By default, everything is cached
                return true;
        }
@@ -372,6 +372,7 @@ abstract public class BasicLibrary {
         * @throws IOException
         *             in case of I/O error
         */
+       @SuppressWarnings("unused")
        public void clearFromCache(String luid) throws IOException {
                // By default, this is a noop.
        }
@@ -637,7 +638,7 @@ abstract public class BasicLibrary {
         * @throws IOException
         *             in case of IOException
         */
-       public synchronized Story getStory(String luid, Progress pg)
+       public Story getStory(String luid, Progress pg)
                        throws IOException {
                Progress pgMetas = new Progress();
                Progress pgStory = new Progress();
index 23f19a9ed323de88cb2202c6cde7462bf53219de..92e4ae7a9951ec9715dc5faa9271bae362412dbf 100644 (file)
@@ -326,7 +326,7 @@ public class CacheLibrary extends BasicLibrary {
        }
 
        @Override
-       public void delete(String luid) throws IOException {
+       public synchronized void delete(String luid) throws IOException {
                if (isCached(luid)) {
                        cacheLib.delete(luid);
                }
index 3cf5a25bc232baddd6ed34df9faabbaa3d82281f..aec89721753252783a6b3f9c3468e4afd4b7f9d1 100644 (file)
@@ -637,10 +637,13 @@ public class LocalLibrary extends BasicLibrary {
                }
 
                Map<MetaData, File[]> stories = this.stories;
-               synchronized (lock) {
-                       if (stories == null) {
-                               stories = getStoriesDo(pg);
-                               this.stories = stories;
+               if (stories == null) {
+                       stories = getStoriesDo(pg);
+                       synchronized (lock) {
+                               if (this.stories == null)
+                                       this.stories = stories;
+                               else
+                                       stories = this.stories;
                        }
                }