From: Niki Roo Date: Sat, 25 Apr 2020 19:12:55 +0000 (+0200) Subject: Merge branch 'subtree' X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=commitdiff_plain;h=4094d35262cee2bd2e41c0039b82bd0ef31041f8;hp=5a90a6ca7261f4c17407131fef58d5bcc793e2ce Merge branch 'subtree' --- diff --git a/src/be/nikiroo/fanfix/library/BasicLibrary.java b/src/be/nikiroo/fanfix/library/BasicLibrary.java index 586c4ef..a754c00 100644 --- a/src/be/nikiroo/fanfix/library/BasicLibrary.java +++ b/src/be/nikiroo/fanfix/library/BasicLibrary.java @@ -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 true). + * cache (if we have no cache, we default to true). * * @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(); diff --git a/src/be/nikiroo/fanfix/library/CacheLibrary.java b/src/be/nikiroo/fanfix/library/CacheLibrary.java index 23f19a9..92e4ae7 100644 --- a/src/be/nikiroo/fanfix/library/CacheLibrary.java +++ b/src/be/nikiroo/fanfix/library/CacheLibrary.java @@ -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); } diff --git a/src/be/nikiroo/fanfix/library/LocalLibrary.java b/src/be/nikiroo/fanfix/library/LocalLibrary.java index 3cf5a25..aec8972 100644 --- a/src/be/nikiroo/fanfix/library/LocalLibrary.java +++ b/src/be/nikiroo/fanfix/library/LocalLibrary.java @@ -637,10 +637,13 @@ public class LocalLibrary extends BasicLibrary { } Map 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; } }