Class AttributeLock
java.lang.Object
io.superdurable.dex.AttributeLock
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 Summary
Modifier and TypeMethodDescriptionstatic AttributeLockLocks the value stored by an Attribute.static AttributeLockof(AttributeMap<?> attribute, String instance) Locks one instance of an Attribute map.
-
Method Details
-
of
Locks the value stored by an Attribute.- Parameters:
attribute- the registered Attribute to lock- Returns:
- a lock definition for that Attribute
-
of
Locks one instance of an Attribute map.- Parameters:
attribute- the registered Attribute mapinstance- the map instance to lock. Slash is prohibited because it is a reserved character- Returns:
- a lock definition for that map instance
- Throws:
IllegalArgumentException- ifinstanceisnull, blank, or contains/
-