Stub of Sone inserter main loop.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 13 Oct 2010 14:42:18 +0000 (16:42 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 13 Oct 2010 14:42:18 +0000 (16:42 +0200)
src/main/java/net/pterodactylus/sone/core/SoneInserter.java

index b779b2e..a8f9951 100644 (file)
 
 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);
+               }
        }
 
 }