/** * Get a {@link Timeout} that uses nanosecond precision. The accuracy will * depend on the accuracy of {@link System#nanoTime()}. * * @param time the maximum time to wait for the lock * @param unit the time unit of the <tt>time</tt> argument. * @return timeout with {@link TimeUnit#NANOSECONDS} precision. */ public static Timeout getNanosTimeout(final long time, final TimeUnit unit) { return new Timeout(time, unit, TimeSuppliers.NANOS); }
/** * Get a {@link Timeout} that uses millisecond precision. The accuracy will * depend on the accuracy of {@link System#currentTimeMillis()}. * * @param time the maximum time to wait for the lock * @param unit the time unit of the <tt>time</tt> argument. * @return timeout with {@link TimeUnit#MILLISECONDS} precision. */ public static Timeout getMillisTimeout(final long time, final TimeUnit unit) { return new Timeout(time, unit, TimeSuppliers.MILLIS); }
@Override public Timeout get() { return new Timeout(time, unit, supplier); } };