JdkAutoUpdatingVar

ca.dvgi.periodic.jdk.JdkAutoUpdatingVar
class JdkAutoUpdatingVar[T](updateVar: => T, updateInterval: UpdateInterval[T], updateAttemptStrategy: UpdateAttemptStrategy, blockUntilReadyTimeout: Option[Duration], handleInitializationError: PartialFunction[Throwable, T], varNameOverride: Option[String], executorOverride: Option[ScheduledExecutorService])(implicit ct: ClassTag[T]) extends AutoUpdatingVar[Identity, Future, T]

An AutoUpdatingVar based on the JDK's ScheduledExecutorService.

By default, a JdkAutoUpdatingVar starts a new thread to handle its updates. If you are running many JdkAutoUpdatingVars, you may want to consider providing a shared ScheduledExecutorService to them.

Value parameters

blockUntilReadyTimeout

If specified, class instantiation will block the calling thread until it succeeds, fails, or the timeout is reached.

executorOverride

If present, will be used instead of starting a new thread.

handleInitializationError

A PartialFunction used to recover from exceptions in the var initialization. If unspecified, the exception will fail the effect returned by ready.

updateAttemptStrategy

Configuration for retrying updates on failure

updateInterval

Configuration for the update interval

updateVar

A thunk to initialize and update the var

varNameOverride

A name for this variable, used in logging. If unspecified, the simple class name of T will be used.

Attributes

Graph
Supertypes
class AutoUpdatingVar[Identity, Future, T]
trait AutoCloseable
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def close(): Unit

Attributes

Definition Classes
AutoUpdatingVar -> AutoCloseable
override def latest: T

Wait for ready to be completed before calling this method.

Wait for ready to be completed before calling this method.

Attributes

Returns

The latest value of the variable. Calling this method is thread-safe.

Throws
UnreadyAutoUpdatingVarException

if there is not yet a value to return

Definition Classes
AutoUpdatingVar
override def ready: Future[Unit]

Attributes

Returns

An effect which, once successfully completed, signifies that the AutoUpdatingVar has a value, i.e. latest can be called and no exception will be thrown.

Definition Classes
AutoUpdatingVar
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
AutoUpdatingVar -> Any