X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FTrustUpdater.java;h=be6f39cce6601022eb2531dd30336c4218a379b5;hb=2d9d8cbf17b58cc6177af77befef5a69b7efd3f9;hp=91e17838ae07a25a5eec099e6bb73280c47510c8;hpb=7adb27cbfa8dd5b6f844eb07f5ef0307aeacee1b;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/TrustUpdater.java b/src/main/java/net/pterodactylus/sone/core/TrustUpdater.java index 91e1783..be6f39c 100644 --- a/src/main/java/net/pterodactylus/sone/core/TrustUpdater.java +++ b/src/main/java/net/pterodactylus/sone/core/TrustUpdater.java @@ -105,7 +105,16 @@ public class TrustUpdater extends AbstractService { * The comment of the trust relation */ public void setTrust(OwnIdentity truster, Identity trustee, Integer score, String comment) { - updateJobs.add(new SetTrustJob(truster, trustee, score, comment)); + SetTrustJob setTrustJob = new SetTrustJob(truster, trustee, score, comment); + if (updateJobs.contains(setTrustJob)) { + updateJobs.remove(setTrustJob); + } + logger.log(Level.FINER, "Adding Trust Update Job: " + setTrustJob); + try { + updateJobs.put(setTrustJob); + } catch (InterruptedException e) { + /* the queue is unbounded so it should never block. */ + } } //