/** * Get clock instance preferred by this system. * * @return clock instance preferred by this system. * @since 4.6 */ public MonotonicClock getClock() { return new MonotonicSystemClock(); }
/** {@inheritDoc} */ @Override public ProposedTimestamp propose() { final long u = nowMicros(); return new ProposedTimestamp() { @Override public long read(TimeUnit unit) { return unit.convert(u, MICROSECONDS); } @Override public void blockUntil(Duration maxWait) { // Assume system clock never goes backwards. } }; } }
/** * Create a default system with a thread pool of 1 thread per CPU. */ public KetchSystem() { this(defaultExecutor(), new MonotonicSystemClock(), DEFAULT_TXN_NAMESPACE); }
/** {@inheritDoc} */ @Override public ProposedTimestamp propose() { final long u = nowMicros(); return new ProposedTimestamp() { @Override public long read(TimeUnit unit) { return unit.convert(u, MICROSECONDS); } @Override public void blockUntil(Duration maxWait) { // Assume system clock never goes backwards. } }; } }
/** * Get clock instance preferred by this system. * * @return clock instance preferred by this system. * @since 4.6 */ public MonotonicClock getClock() { return new MonotonicSystemClock(); }
/** * Create a default system with a thread pool of 1 thread per CPU. */ public KetchSystem() { this(defaultExecutor(), new MonotonicSystemClock(), DEFAULT_TXN_NAMESPACE); }