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.
T - the message type| 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() |