ForwardingTimeout

open class ForwardingTimeout(var delegate: Timeout) : Timeout

A Timeout which forwards calls to another. Useful for subclassing.

Constructors

Link copied to clipboard
constructor(delegate: Timeout)

Properties

Link copied to clipboard
@get:JvmName(name = "delegate")
var delegate: Timeout

Functions

Link copied to clipboard
open override fun awaitSignal(condition: Condition)

Waits on monitor until it is signaled. Throws InterruptedIOException if either the thread is interrupted or if this timeout elapses before monitor is signaled. The caller must hold the lock that monitor is bound to.

Link copied to clipboard
open override fun cancel()

Prevent all current applications of this timeout from firing. Use this when a time-limited operation should no longer be time-limited because the nature of the operation has changed.

Link copied to clipboard
open override fun clearDeadline(): Timeout

Clears the deadline.

Link copied to clipboard
open override fun clearTimeout(): Timeout

Clears the timeout. Operating system timeouts may still apply.

Link copied to clipboard
fun deadline(duration: Long, unit: TimeUnit): Timeout

Set a deadline of now plus duration time.

Link copied to clipboard
open override fun deadlineNanoTime(): Long

Returns the nano time when the deadline will be reached.

open override fun deadlineNanoTime(deadlineNanoTime: Long): Timeout

Sets the nano time when the deadline will be reached. All operations must complete before this time. Use a deadline to set a maximum bound on the time spent on a sequence of operations.

Link copied to clipboard
open override fun hasDeadline(): Boolean

Returns true if a deadline is enabled.

Link copied to clipboard
inline fun <T> intersectWith(other: Timeout, block: () -> T): T

Applies the minimum intersection between this timeout and other, run block, then finally rollback this timeout's values.

Link copied to clipboard
Link copied to clipboard
open override fun throwIfReached()

Throws an InterruptedIOException if the deadline has been reached or if the current thread has been interrupted. This method doesn't detect timeouts; that should be implemented to asynchronously abort an in-progress operation.

Link copied to clipboard
open override fun timeout(timeout: Long, unit: TimeUnit): Timeout

Wait at most timeout time before aborting an operation. Using a per-operation timeout means that as long as forward progress is being made, no sequence of operations will fail.

Link copied to clipboard
fun Timeout.timeout(timeout: Long, unit: DurationUnit): Timeout
Link copied to clipboard
open override fun timeoutNanos(): Long

Returns the timeout in nanoseconds, or 0 for no timeout.

Link copied to clipboard
open override fun waitUntilNotified(monitor: Any)

Waits on monitor until it is notified. Throws InterruptedIOException if either the thread is interrupted or if this timeout elapses before monitor is notified. The caller must be synchronized on monitor.