io.engineblock.activityimpl.marker.longheap.LongTreeTrackerAtomic Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of eb-api Show documentation
Show all versions of eb-api Show documentation
The driver API for engineblock;
Provides the interfaces needed to build drivers that can be loaded by engineblock core
package io.engineblock.activityimpl.marker.longheap;
import java.util.concurrent.atomic.AtomicLong;
/**
* This is a version of longTreeTracker that is safe for concurrent access.
*/
public class LongTreeTrackerAtomic extends LongTreeTracker {
private AtomicLong timage = new AtomicLong(0L);
@Override
public long setCompleted(long index) {
long before = timage.get();
long after = super.setCompleted(index, before);
while (!timage.compareAndSet(before,after)) {
before = timage.get();
after = super.setCompleted(index, before);
}
return after;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy