X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffreenet%2Fwot%2FIdentity.java;h=090bf7f2cff689ca96eb92c6bfdb376b0f6a38c2;hb=902c5b14f671d84e90ed31cc738fd46560fe4fbd;hp=2909936ac2c65ccff8f6c3ed324a8bc59382fb28;hpb=da6c0a57ac23f13e25a2347237ef3d9ac52ac332;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/freenet/wot/Identity.java b/src/main/java/net/pterodactylus/sone/freenet/wot/Identity.java index 2909936..090bf7f 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/wot/Identity.java +++ b/src/main/java/net/pterodactylus/sone/freenet/wot/Identity.java @@ -45,6 +45,9 @@ public class Identity { /** The contexts of the identity. */ protected final Set contexts = Collections.synchronizedSet(new HashSet()); + /** Whether the contexts have already been loaded. */ + private volatile boolean contextsLoaded = false; + /** The properties of the identity. */ private final Map properties = Collections.synchronizedMap(new HashMap()); @@ -121,8 +124,9 @@ public class Identity { * plugin */ public Set getContexts(boolean forceReload) throws PluginException { - if (contexts.isEmpty() || forceReload) { + if (!contextsLoaded || forceReload) { Set contexts = webOfTrustConnector.loadIdentityContexts(this); + contextsLoaded = true; this.contexts.clear(); this.contexts.addAll(contexts); }