SOLR-1435 ensure that all slaves with same pollInteval fetches index at same time

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@816144 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Noble Paul 2009-09-17 11:27:36 +00:00
parent 812907978d
commit a726c23c8b
1 changed files with 2 additions and 1 deletions

View File

@ -163,7 +163,8 @@ public class SnapPuller {
}
};
executorService = Executors.newSingleThreadScheduledExecutor();
executorService.scheduleAtFixedRate(task, pollInterval, pollInterval, TimeUnit.MILLISECONDS);
long initialDelay = pollInterval - (System.currentTimeMillis() % pollInterval);
executorService.scheduleAtFixedRate(task, initialDelay, pollInterval, TimeUnit.MILLISECONDS);
LOG.info("Poll Scheduled at an interval of " + pollInterval + "ms");
}