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

net.amygdalum.testrecorder.util.CircularityLock Maven / Gradle / Ivy

The newest version!
package net.amygdalum.testrecorder.util;

public class CircularityLock extends ThreadLocal {

    private static final Boolean NOT_ACQUIRED = null;

    public boolean acquire() {
        if (get() == NOT_ACQUIRED) {
            set(true);
            return true;
        } else {
            return false;
        }
    }
    
    public boolean locked() {
    	return get() != NOT_ACQUIRED;
    }
    
    public void release() {
        set(NOT_ACQUIRED);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy