All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.engineblock.activityimpl.marker.longheap.LongTreeTrackerAtomic Maven / Gradle / Ivy

Go to download

The driver API for engineblock; Provides the interfaces needed to build drivers that can be loaded by engineblock core

There is a newer version: 2.12.65
Show newest version
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