From: David ‘Bombe’ Roden Date: Wed, 13 Oct 2010 14:42:18 +0000 (+0200) Subject: Stub of Sone inserter main loop. X-Git-Tag: 0.1-RC1~457 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=8ab964453124b2ae38adce3a65b7faac9c5a0245;p=Sone.git Stub of Sone inserter main loop. --- diff --git a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java index b779b2e..a8f9951 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java @@ -17,7 +17,11 @@ package net.pterodactylus.sone.core; +import java.util.logging.Level; +import java.util.logging.Logger; + import net.pterodactylus.sone.data.Sone; +import net.pterodactylus.util.logging.Logging; import net.pterodactylus.util.service.AbstractService; /** @@ -27,6 +31,9 @@ import net.pterodactylus.util.service.AbstractService; */ public class SoneInserter extends AbstractService { + /** The logger. */ + private static final Logger logger = Logging.getLogger(SoneInserter.class); + /** The Sone to insert. */ private final Sone sone; @@ -52,6 +59,15 @@ public class SoneInserter extends AbstractService { */ @Override protected void serviceRun() { + while (!shouldStop()) { + synchronized (sone) { + if (sone.getModificationCounter() > 0) { + sone.setModificationCounter(0); + } + } + logger.log(Level.FINEST, "Waiting 60 seconds before checking Sone “" + sone.getName() + "” again."); + sleep(60 * 1000); + } } }