this.scheduler = Scheduler.initScheduler(settings); TimeValue estimatedTimeInterval = ESTIMATED_TIME_INTERVAL_SETTING.get(settings); this.cachedTimeThread = new CachedTimeThread(EsExecutors.threadName(settings, "[timer]"), estimatedTimeInterval.millis()); this.cachedTimeThread.start();
public void shutdownNow() { cachedTimeThread.running = false; cachedTimeThread.interrupt(); scheduler.shutdownNow(); for (ExecutorHolder executor : executors.values()) { if (executor.executor() instanceof ThreadPoolExecutor) { executor.executor().shutdownNow(); } } }
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { boolean result = scheduler.awaitTermination(timeout, unit); for (ExecutorHolder executor : executors.values()) { if (executor.executor() instanceof ThreadPoolExecutor) { result &= executor.executor().awaitTermination(timeout, unit); } } cachedTimeThread.join(unit.toMillis(timeout)); return result; }
this.scheduler = Scheduler.initScheduler(settings); TimeValue estimatedTimeInterval = ESTIMATED_TIME_INTERVAL_SETTING.get(settings); this.cachedTimeThread = new CachedTimeThread(EsExecutors.threadName(settings, "[timer]"), estimatedTimeInterval.millis()); this.cachedTimeThread.start();
this.cachedTimeThread = new CachedTimeThread(EsExecutors.threadName(settings, "[timer]"), estimatedTimeInterval.millis()); this.cachedTimeThread.start();
this.scheduler = Scheduler.initScheduler(settings); TimeValue estimatedTimeInterval = ESTIMATED_TIME_INTERVAL_SETTING.get(settings); this.cachedTimeThread = new CachedTimeThread(EsExecutors.threadName(settings, "[timer]"), estimatedTimeInterval.millis()); this.cachedTimeThread.start();
CachedTimeThread(String name, long interval) { super(name); this.interval = interval; this.relativeMillis = TimeValue.nsecToMSec(System.nanoTime()); this.absoluteMillis = System.currentTimeMillis(); this.counter = new TimeCounter(); setDaemon(true); }
/** * Returns a value of milliseconds that may be used for relative time calculations. * * This method should only be used for calculating time deltas. For an epoch based * timestamp, see {@link #absoluteTimeInMillis()}. */ public long relativeTimeInMillis() { return cachedTimeThread.relativeTimeInMillis(); }
/** * Returns the value of milliseconds since UNIX epoch. * * This method should only be used for exact date/time formatting. For calculating * time deltas that should not suffer from negative deltas, which are possible with * this method, see {@link #relativeTimeInMillis()}. */ public long absoluteTimeInMillis() { return cachedTimeThread.absoluteTimeInMillis(); }
public void shutdown() { cachedTimeThread.running = false; cachedTimeThread.interrupt(); scheduler.shutdown(); for (ExecutorHolder executor : executors.values()) { if (executor.executor() instanceof ThreadPoolExecutor) { executor.executor().shutdown(); } } }
public void shutdownNow() { cachedTimeThread.running = false; cachedTimeThread.interrupt(); scheduler.shutdownNow(); for (ExecutorHolder executor : executors.values()) { if (executor.executor() instanceof ThreadPoolExecutor) { ((ThreadPoolExecutor) executor.executor()).shutdownNow(); } } }
public void shutdown() { cachedTimeThread.running = false; cachedTimeThread.interrupt(); scheduler.shutdown(); for (ExecutorHolder executor : executors.values()) { if (executor.executor() instanceof ThreadPoolExecutor) { ((ThreadPoolExecutor) executor.executor()).shutdown(); } } }
public void shutdownNow() { cachedTimeThread.running = false; cachedTimeThread.interrupt(); scheduler.shutdownNow(); for (ExecutorHolder executor : executors.values()) { if (executor.executor() instanceof ThreadPoolExecutor) { executor.executor().shutdownNow(); } } }
public void shutdownNow() { cachedTimeThread.running = false; cachedTimeThread.interrupt(); scheduler.shutdownNow(); for (ExecutorHolder executor : executors.values()) { if (executor.executor() instanceof ThreadPoolExecutor) { executor.executor().shutdownNow(); } } }
/** * Returns the value of milliseconds since UNIX epoch. * * This method should only be used for exact date/time formatting. For calculating * time deltas that should not suffer from negative deltas, which are possible with * this method, see {@link #relativeTimeInMillis()}. */ public long absoluteTimeInMillis() { return cachedTimeThread.absoluteTimeInMillis(); }
/** * Returns the value of milliseconds since UNIX epoch. * * This method should only be used for exact date/time formatting. For calculating * time deltas that should not suffer from negative deltas, which are possible with * this method, see {@link #relativeTimeInMillis()}. */ public long absoluteTimeInMillis() { return cachedTimeThread.absoluteTimeInMillis(); }
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { boolean result = scheduler.awaitTermination(timeout, unit); for (ExecutorHolder executor : executors.values()) { if (executor.executor() instanceof ThreadPoolExecutor) { result &= ((ThreadPoolExecutor) executor.executor()).awaitTermination(timeout, unit); } } cachedTimeThread.join(unit.toMillis(timeout)); return result; }
/** * Returns a value of milliseconds that may be used for relative time calculations. * * This method should only be used for calculating time deltas. For an epoch based * timestamp, see {@link #absoluteTimeInMillis()}. */ public long relativeTimeInMillis() { return cachedTimeThread.relativeTimeInMillis(); }
CachedTimeThread(String name, long interval) { super(name); this.interval = interval; this.relativeMillis = TimeValue.nsecToMSec(System.nanoTime()); this.absoluteMillis = System.currentTimeMillis(); this.counter = new TimeCounter(); setDaemon(true); }
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { boolean result = scheduler.awaitTermination(timeout, unit); for (ExecutorHolder executor : executors.values()) { if (executor.executor() instanceof ThreadPoolExecutor) { result &= executor.executor().awaitTermination(timeout, unit); } } cachedTimeThread.join(unit.toMillis(timeout)); return result; }