Changing the table open/warmup logic a but to mininize the number of times the method was called.
Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/dffa4112 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/dffa4112 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/dffa4112 Branch: refs/heads/apache-blur-0.2 Commit: dffa41120383c20ea20d6c5743472df20f2197eb Parents: 44bad35 Author: Aaron McCurry <[email protected]> Authored: Sat Feb 22 17:24:14 2014 -0500 Committer: Aaron McCurry <[email protected]> Committed: Sat Feb 22 17:24:14 2014 -0500 ---------------------------------------------------------------------- .../indexserver/DistributedIndexServer.java | 22 +++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dffa4112/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java b/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java index ebf70dd..9500872 100644 --- a/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java +++ b/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java @@ -316,21 +316,28 @@ public class DistributedIndexServer extends AbstractDistributedIndexServer { Thread thread = new Thread(new Runnable() { @Override public void run() { + runWarmup(); while (_running.get()) { + long s = System.nanoTime(); synchronized (_warmupLock) { try { _warmupLock.wait(_delay); - } catch (InterruptedException e) { + } catch (InterruptedException ex) { return; } } - for (int i = 0; i < 10; i++) { + long e = System.nanoTime(); + if ((e - s) < TimeUnit.MILLISECONDS.toNanos(_delay)) { runWarmup(); - synchronized (_warmupLock) { - try { - _warmupLock.wait(_shortDelay); - } catch (InterruptedException e) { - return; + } else { + for (int i = 0; i < 10; i++) { + runWarmup(); + synchronized (_warmupLock) { + try { + _warmupLock.wait(_shortDelay); + } catch (InterruptedException ex) { + return; + } } } } @@ -386,6 +393,7 @@ public class DistributedIndexServer extends AbstractDistributedIndexServer { private synchronized void runWarmup() { try { + LOG.debug("Running warmup on the indexes."); warmupTables(); } catch (Throwable t) { if (_running.get()) {
