From: David ‘Bombe’ Roden Date: Wed, 11 Jun 2014 04:34:28 +0000 (+0200) Subject: Store fingerprint in insert information. X-Git-Tag: 0.9-rc1^2~3^2~245 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=300a7cb0c2bb400a2728ead095a232647173038b;p=Sone.git Store fingerprint in insert information. --- diff --git a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java index 1445613..d8564ba 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java @@ -268,10 +268,10 @@ public class SoneInserter extends AbstractService { */ if (success) { synchronized (sone) { - if (lastInsertedFingerprint.equals(sone.getFingerprint())) { + if (insertInformation.getFingerprint().equals(sone.getFingerprint())) { logger.log(Level.FINE, String.format("Sone “%s” was not modified further, resetting counter…", sone)); lastModificationTime = absent(); - lastInsertFingerprint = lastInsertedFingerprint; + lastInsertFingerprint = insertInformation.getFingerprint(); core.touchConfiguration(); modified = false; } @@ -293,6 +293,8 @@ public class SoneInserter extends AbstractService { */ private class InsertInformation { + private final String fingerprint; + /** All properties of the Sone, copied for thread safety. */ private final Map soneProperties = new HashMap(); @@ -303,6 +305,7 @@ public class SoneInserter extends AbstractService { * The sone to insert */ public InsertInformation(Sone sone) { + this.fingerprint = sone.getFingerprint(); soneProperties.put("id", sone.getId()); soneProperties.put("name", sone.getName()); soneProperties.put("time", sone.getTime()); @@ -320,6 +323,10 @@ public class SoneInserter extends AbstractService { // ACCESSORS // + private String getFingerprint() { + return fingerprint; + } + /** * Returns the insert URI of the Sone. *