Annotation Interface ActiveObject


@Documented @Retention(SOURCE) @Target(TYPE) public @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
    Modifier and Type
    Optional Element
    Description
    The name of the generated actor field.
  • Element Details

    • actorName

      String actorName
      The name of the generated actor field.
      Default:
      "internalActiveObjectActor"