Package groovy.concurrent

# Class AwaitableAdapterRegistry

java.lang.Object
groovy.concurrent.AwaitableAdapterRegistry

public final class AwaitableAdapterRegistry extends Object
Central registry for `AwaitableAdapter` instances.

On class-load, adapters are discovered via `ServiceLoader` from `META-INF/services/groovy.concurrent.AwaitableAdapter`. Two built-in adapters are always present after SPI-loaded ones:

- `FlowPublisherAdapter` for `Flow.Publisher` (single-value `await` and multi-value `for await`).
- A `Future` fallback handling `CompletableFuture`, `CompletionStage`, and `Future` (via a blocking wrapper).

Since:
  6.0.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `register(AwaitableAdapter adapter)`
  Registers an adapter at the highest priority (before SPI-loaded adapters).
  `static <T> Iterable<T>`
  `toIterable(Object source)`
  Converts the given source to an `Iterable` for `for await`.
  `static void`
  `unregister(AwaitableAdapter adapter)`
  Removes a previously registered adapter.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### register

    public static void register(AwaitableAdapter adapter)
    Registers an adapter at the highest priority (before SPI-loaded adapters).

  - ### unregister

    public static void unregister(AwaitableAdapter adapter)
    Removes a previously registered adapter.

  - ### toIterable

    public static <T> Iterable<T> toIterable(Object source)
    Converts the given source to an `Iterable` for `for await`.