From 7adb27cbfa8dd5b6f844eb07f5ef0307aeacee1b Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 5 Sep 2012 12:26:32 +0200 Subject: [PATCH] Only add get-trust jobs if there are none for the given identities yet. --- src/main/java/net/pterodactylus/sone/core/TrustUpdater.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/pterodactylus/sone/core/TrustUpdater.java b/src/main/java/net/pterodactylus/sone/core/TrustUpdater.java index d122235..91e1783 100644 --- a/src/main/java/net/pterodactylus/sone/core/TrustUpdater.java +++ b/src/main/java/net/pterodactylus/sone/core/TrustUpdater.java @@ -78,7 +78,15 @@ public class TrustUpdater extends AbstractService { * The identity receiving the trust */ public void getTrust(OwnIdentity truster, Identity trustee) { - updateJobs.add(new GetTrustJob(truster, trustee)); + GetTrustJob getTrustJob = new GetTrustJob(truster, trustee); + if (!updateJobs.contains(getTrustJob)) { + logger.log(Level.FINER, "Adding Trust Update Job: " + getTrustJob); + try { + updateJobs.put(getTrustJob); + } catch (InterruptedException ie1) { + /* the queue is unbounded so it should never block. */ + } + } } /** -- 2.7.4