From 175d39938404d98546ca5f41d7a28e3162ad29f7 Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Sat, 19 Oct 2013 18:11:16 +0200 Subject: [PATCH] Give threaded startup 30s before warning about queue size --- .../limitedcreative/blockstate/thread/ThreadLink.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/jaschastarke/minecraft/limitedcreative/blockstate/thread/ThreadLink.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/blockstate/thread/ThreadLink.java index b64bc8d..71beb0e 100644 --- a/src/main/java/de/jaschastarke/minecraft/limitedcreative/blockstate/thread/ThreadLink.java +++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/blockstate/thread/ThreadLink.java @@ -23,6 +23,7 @@ public class ThreadLink { private static final int COUNT_WARNING_QUEUE = 5; private static final int COUNT_ERROR_QUEUE = 20; private static final int QUEUE_TIMING_DURATION = 500; // ms + private static final int STARTUP_TIMING = 30000; // ms private long lastTimeout; private Stack updateQueue = new Stack(); @@ -58,7 +59,14 @@ public class ThreadLink { public void run() { if (getModule().isDebug()) log.debug("DB-Thread '" + Thread.currentThread().getName() + "' started."); - lastTimeout = System.currentTimeMillis(); + lastTimeout = System.currentTimeMillis() + STARTUP_TIMING; + updateQueue.add(new Action() { // After Initial Queue caching + @Override + public void process(ThreadLink link, DBQueries q) { + if (lastTimeout > System.currentTimeMillis()) + lastTimeout = System.currentTimeMillis(); + } + }); while (!shutdown || !updateQueue.isEmpty()) { try { List acts = new LinkedList();