Package groovy.transform
Annotation Interface ActiveObject
Marks a class as an active object whose
ActiveMethod-annotated
methods are automatically routed through an internal actor for
thread-safe, serialised execution.
All @ActiveMethod calls on the same instance are processed
one at a time — no locks needed.
{@literal @}ActiveObject
class Account {
private double balance = 0
{@literal @}ActiveMethod
void deposit(double amount) { balance += amount }
{@literal @}ActiveMethod(blocking = false)
Awaitable<Double> getBalance() { balance }
}
- Since:
- 6.0.0
- See Also:
-
Optional Element Summary
Optional Elements
-
Element Details
-
actorName
String actorNameThe name of the generated actor field.- Default:
- "internalActiveObjectActor"
-