# Package groovy.concurrent

package groovy.concurrent
Structured concurrency abstractions for asynchronous and parallel programming.

Language-facing async types:

- `Awaitable` — async computation handle and static combinator surface used with the `await` keyword
- `AwaitResult` — success/failure value from `Awaitable.allSettled(Object...)`
- `AsyncScope` — structured concurrency
- `AsyncChannel` — CSP-style async channel
- `AwaitableAdapter` / `AwaitableAdapterRegistry` — SPI for third-party async types (RxJava, Reactor, …)

Additional high-level primitives: `Actor` (message-passing), `Pool` (thread management), and `ParallelScope` (combined async+parallel). Supports virtual threads (JDK 21+) and fail-fast exception handling. Runtime implementation details live in `org.apache.groovy.runtime.async`.

- Class
  Description
  Actor<T>
  A lightweight message-passing actor for concurrent state management.
  ActorContext<T>
  Context handle passed to context-aware actor handlers.
  ActorOptions
  Construction-time configuration for an `Actor`.
  ActorOptions.Overflow
  Policy applied when `Actor.send(Object)` is called on an actor whose bounded mailbox is full.
  ActorOptions.StashOverflow
  Policy applied when `ActorContext.stash()` is called and the actor's bounded stash is already at capacity.
  Agent<T>
  A thread-safe mutable-value container inspired by Clojure's agents and GPars' `Agent`.
  AsyncChannel<T>
  An asynchronous channel for inter-task communication with optional buffering.
  AsyncScope
  A structured concurrency scope that ensures all child tasks complete (or are cancelled) before the scope exits.
  Awaitable<T>
  Core abstraction for asynchronous computations in Groovy.
  AwaitableAdapter
  Service Provider Interface (SPI) for adapting third-party asynchronous types to Groovy's `Awaitable` abstraction and to iterables for `for await` loops.
  AwaitableAdapterRegistry
  Central registry for `AwaitableAdapter` instances.
  AwaitResult<T>
  Represents the outcome of an asynchronous computation that may have succeeded or failed.
  BroadcastChannel<T>
  A one-to-many broadcast channel where each value sent is delivered to all subscribers.
  Cancellable
  A handle for a scheduled action that can be called off before it fires (or that can have its further firings suppressed, in the case of a recurring schedule).
  ChannelClosedException
  Thrown when an `AsyncChannel` operation is attempted after the channel has been closed.
  ChannelSelect
  Selects the first offer that can complete among multiple `AsyncChannel` operations.
  ChannelSelect.Offer
  One branch of a select: an input guard created by `ChannelSelect.receive(AsyncChannel)`, an output guard created by `ChannelSelect.send(AsyncChannel, Object)`, or a timeout created by `ChannelSelect.after(long)`.
  ChannelSelect.Result
  The result of a `ChannelSelect.select()` operation, indicating which offer committed.
  ConcurrentConfig
  Central configuration for Groovy's concurrent and parallel features.
  DataflowVariable<T>
  A single-assignment variable for dataflow-style programming.
  ParallelScope
  Convenience API for running work within a pool-isolated `AsyncScope`.
  Pool
  A managed thread pool for parallel and concurrent operations.
  ReactorHandler<T,R>
  Context-aware handler for reactor actors.
  StatefulHandler<S,T>
  Context-aware handler for stateful actors.