AbsentResourceList

open class AbsentResourceList<T>(maxTrys: Int, minCheckInterval: Duration)

Provides a collection to keep track of resources whose retrieval failed and when retrieval may be tried again.

Constructors

Link copied to clipboard
constructor(maxTrys: Int, minCheckInterval: Duration)

Properties

Link copied to clipboard

The amount of time, in milliseconds, beyond which retrieval attempts should again be allowed. When this time has elapsed from the most recent failed attempt the number of try's attempted is reset to 0. This prevents the resource from being permanently blocked.

Functions

Link copied to clipboard
fun clear()
Link copied to clipboard
fun isResourceAbsent(resourceId: T): Boolean

Indicates whether a specified resource is marked as absent.

Link copied to clipboard
fun markResourceAbsent(resourceId: T, permanent: Boolean = false)

Marks a resource attempt as having failed. This increments the number-of-tries counter and sets the time of the last attempt. When this method has been called AbsentResourceList.maxTrys times the resource is marked as absent until this absent resource list's AbsentResourceList.tryAgainInterval is reached.

Link copied to clipboard
fun unmarkResourceAbsent(resourceId: T)

Removes the specified resource from this absent resource list. Call this method when retrieval attempt succeeded.