Immediate

State transactions are not Atomic (not serializable). This means ` StateReceiver.updateState and StateReceiver.withState functions are no-op and forward to updateStateImmediate.

This leads to the following consequences:

  1. The order of state operations is undefined in parallel contexts.

  2. There is no thread-safety for state reads and writes.

  3. State operation performance is increased significantly (about 10x faster)

  • Be very careful with this strategy and use it when you will ensure the safety of updates manually and you absolutely must squeeze the maximum performance out of a Store. Do not optimize prematurely.

  • For a semi-safe but faster alternative, consider using Atomic with Atomic.reentrant set to false.

  • This strategy configures state transactions for the whole Store. For one-time usage of non-atomic updates, see updateStateImmediate.