diff options
author | Simon Rettberg | 2023-09-27 16:01:23 +0200 |
---|---|---|
committer | Simon Rettberg | 2023-09-27 16:01:23 +0200 |
commit | 89c27e8e8ab0e0d094ac94ff35c6987b5b11cd7d (patch) | |
tree | b402b0c3458e2955bd3b2b2993f2fee11e69d521 | |
parent | master<->sat transfer: Prefer SSL (diff) | |
download | tutor-module-89c27e8e8ab0e0d094ac94ff35c6987b5b11cd7d.tar.gz tutor-module-89c27e8e8ab0e0d094ac94ff35c6987b5b11cd7d.tar.xz tutor-module-89c27e8e8ab0e0d094ac94ff35c6987b5b11cd7d.zip |
[server] Fix deadlock
-rw-r--r-- | dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/CacheBase.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/CacheBase.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/CacheBase.java index 8b549800..ffc92d4e 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/CacheBase.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/cache/CacheBase.java @@ -6,8 +6,6 @@ import java.util.concurrent.TimeUnit; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.thrift.TException; -import org.openslx.util.QuickTimer; -import org.openslx.util.QuickTimer.Task; /** * Class that caches an instance of a given class for 10 minutes. @@ -49,9 +47,11 @@ public abstract class CacheBase<T> { if (doFetch) { // This invocation found latch == null, which means it is // responsible for triggering the actual update. - QuickTimer.scheduleOnce(new Task() { + // Do not use QuickTimer, as we might already be running in it + // and would only deadlock ourselves + new Thread(getClass().getSimpleName() + "-Update") { @Override - public void fire() { + public void run() { T freshInstance = null; try { freshInstance = getCallback(); @@ -68,7 +68,7 @@ public abstract class CacheBase<T> { localLatch.countDown(); } } - }); + }.start(); } // Now just wait for latch, regardless of whether we triggered the update or not boolean ok = false; |