Class AttributeLock

java.lang.Object
io.superdurable.dex.AttributeLock

public final class AttributeLock extends Object
Defines one Attribute lock for a Step's waitFor or execute method.

Add locks through StepOptions.Builder.addWaitForLock(AttributeLock) or StepOptions.Builder.addExecuteLock(AttributeLock). An Attribute lock targets its single stored value; an Attribute-map lock targets only the supplied instance. RPC methods support the same locking behavior through RPC.lockAttributes() and RPC.lockAttributeMaps(); Java annotations cannot accept AttributeLock objects, so RPC locks use annotation elements instead.

return StepOptions.newBuilder()
        .addExecuteLock(AttributeLock.of(balance))
        .addExecuteLock(AttributeLock.of(orderStatus, orderId))
        .build();
  • Method Details

    • of

      public static AttributeLock of(Attribute<?> attribute)
      Locks the value stored by an Attribute.
      Parameters:
      attribute - the registered Attribute to lock
      Returns:
      a lock definition for that Attribute
    • of

      public static AttributeLock of(AttributeMap<?> attribute, String instance)
      Locks one instance of an Attribute map.
      Parameters:
      attribute - the registered Attribute map
      instance - the map instance to lock. Slash is prohibited because it is a reserved character
      Returns:
      a lock definition for that map instance
      Throws:
      IllegalArgumentException - if instance is null, blank, or contains /