- Enclosing class:
- ObjectScanner
public static final class ObjectScanner.ReusableSet
extends Object
This datastructure keeps track if an object was already put or not atomically. It takes
advantage of the fact that each typeflow iteration adds more objects to the set but never
removes elements. Since insertions into maps are expensive we keep the map around over
multiple iterations and only update the AtomicInteger sequence number after each iteration.
Furthermore it also serializes on the object put until the method release is called with this
object. So each object goes through two states:
In flight: counter = sequence - 1
Commited: counter = sequence
If the object is in state in flight, all other calls with this object to putAndAcquire will
block until release with the object is called.