// Path: src/main/java/mirror/tasks/TaskLogic.java
// public interface TaskLogic {
// 
//   /** Run one interaction, and return how long the task wants to sleep. */
//   Duration runOneLoop() throws InterruptedException;
// 
//   /** Called on the task thread, before we start calling {@link #runOneLoop()} in a loop. */
//   default void onStart() throws InterruptedException {
//   }
// 
//   default void onFailure() throws InterruptedException {
//   }
// 
//   /** Called on the task thread, after we've interrupted/stopped calling {@link #runOneLoop()}. */
//   default void onStop() throws InterruptedException {
//   }
// 
//   /**
//    * Called off the task thread, when we're trying to interrupt the task.
//    *
//    * Most threads shouldn't need this because they'll shut down
//    * when we call thread.interrupt().
//    */
//   default void onInterrupt() {
//   }
// 
//   default String getName() {
//     String name = getClass().getSimpleName();
//     // lambdas don't have simple names
//     if (name.equals("")) {
//       name = StringUtils.substringAfterLast(getClass().getName(), ".");
//     }
//     return name;
//   }
// }


import java.time.Duration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import mirror.tasks.TaskLogic;
package mirror;




public class QueueWatcher implements TaskLogic {

  private static final Logger log = LoggerFactory.getLogger(QueueWatcher.class);
  private final Queues queues;
  private int lastIncomingQueue;
  private int lastSaveToLocal;
  private int lastSaveToRemote;

  public QueueWatcher(Queues queues) {
    this.queues = queues;
  }

  @Override
  public Duration runOneLoop() {
    int incomingQueue = queues.incomingQueue.size();
    int saveToLocal = queues.saveToLocal.size();
// Path: src/main/java/mirror/tasks/TaskLogic.java
// public interface TaskLogic {
// 
//   /** Run one interaction, and return how long the task wants to sleep. */
//   Duration runOneLoop() throws InterruptedException;
// 
//   /** Called on the task thread, before we start calling {@link #runOneLoop()} in a loop. */
//   default void onStart() throws InterruptedException {
//   }
// 
//   default void onFailure() throws InterruptedException {
//   }
// 
//   /** Called on the task thread, after we've interrupted/stopped calling {@link #runOneLoop()}. */
//   default void onStop() throws InterruptedException {
//   }
// 
//   /**
//    * Called off the task thread, when we're trying to interrupt the task.
//    *
//    * Most threads shouldn't need this because they'll shut down
//    * when we call thread.interrupt().
//    */
//   default void onInterrupt() {
//   }
// 
//   default String getName() {
//     String name = getClass().getSimpleName();
//     // lambdas don't have simple names
//     if (name.equals("")) {
//       name = StringUtils.substringAfterLast(getClass().getName(), ".");
//     }
//     return name;
//   }
// }


// Path: src/main/java/mirror/QueueWatcher.java
import java.time.Duration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import mirror.tasks.TaskLogic;

package mirror;




public class QueueWatcher implements TaskLogic {

  private static final Logger log = LoggerFactory.getLogger(QueueWatcher.class);
  private final Queues queues;
  private int lastIncomingQueue;
  private int lastSaveToLocal;
  private int lastSaveToRemote;

  public QueueWatcher(Queues queues) {
    this.queues = queues;
  }

  @Override
  public Duration runOneLoop() {
    int incomingQueue = queues.incomingQueue.size();
    int saveToLocal = queues.saveToLocal.size();
    int saveToRemote = queues.saveToRemote.size();