From 8ab964453124b2ae38adce3a65b7faac9c5a0245 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 13 Oct 2010 16:42:18 +0200 Subject: [PATCH] Stub of Sone inserter main loop. --- .../java/net/pterodactylus/sone/core/SoneInserter.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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); + } } } -- 2.7.4