Package: org.apache.groovy.runtime.async

## [Java] Class DefaultActor<T>

- org.apache.groovy.runtime.async.DefaultActor

- All Implemented Interfaces and Traits:
    Actor

      public final class DefaultActor<T>
      extends Object
      implements Actor

  Default implementation of Actor using a dedicated thread and a LinkedBlockingQueue for message processing.

  Each actor runs on its own thread (virtual on JDK 21+). Messages are processed one at a time, guaranteeing thread-safe state access without locks.

  Type Parameters:
    `T` - the message type
  See Also:
    Actor
  Since:
    6.0.0

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public boolean` | `isActive()`
    `<T, R>` | `public static Actor<T>` | `reactor(Function<T, R> handler)`
    `` | `public void` | `send(T message)`
    `<R>` | `public Awaitable<R>` | `sendAndGet(T message)`
    `<T, S>` | `public static Actor<T>` | `stateful(S initialState, BiFunction<S, T, S> handler)`
    `` | `public void` | `stop()`
    `` | `public String` | `toString()`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### public boolean isActive()

    - #### <T, R> public static Actor<T> reactor(Function<T, R> handler)

    - #### public void send(T message)

    - #### <R> public Awaitable<R> sendAndGet(T message)

    - #### <T, S> public static Actor<T> stateful(S initialState, BiFunction<S, T, S> handler)

    - #### public void stop()

    - #### public String toString()