tuweni / org.apache.tuweni.concurrent

Package org.apache.tuweni.concurrent

Classes and utilities for working with concurrency.

These classes are included in the complete Tuweni distribution, or separately when using the gradle dependency org.apache.tuweni:tuweni-concurrent (tuweni-concurrent.jar).

Types

AsyncCompletion

interface AsyncCompletion

A completion that will be complete at a future time.

AsyncResult

interface AsyncResult<T : Any>

A result that will be available at a future time.

AtomicSlotMap

class AtomicSlotMap<K : Comparable<Any?>, V : Any>

An atomic map that locates available keys within a DiscreteDomain.

This is an atomic map that will allocate key slots based on availability. It will attempt to keep the range compact by filling slots as they become available.

This implementation should be used with small sets, as addition is an O(N) operation.

CompletableAsyncCompletion

interface CompletableAsyncCompletion : AsyncCompletion

An AsyncCompletion that can later be completed successfully or with a provided exception.

CompletableAsyncResult

interface CompletableAsyncResult<T : Any> : AsyncResult<T>

An AsyncResult that can be later completed successfully with a provided value, or completed with an exception.

ExpiringMap

class ExpiringMap<K : Any, V : Any> : MutableMap<K, V>

A concurrent hash map that stores values along with an expiry. Values are stored in the map until their expiry is reached, after which they will no longer be available and will appear as if removed. The actual removal is done lazily whenever the map is accessed, or when the #purgeExpired() method is invoked.

ExpiringSet

class ExpiringSet<E : Any> : MutableSet<E>

A concurrent hash set that stores values along with an expiry. Elements are stored in the set until their expiry is reached, after which they will no longer be available and will appear as if removed. The actual removal is done lazily whenever the set is accessed, or when the #purgeExpired() method is invoked.