host.anzo.commons.concurrent.CloseableReentrantLock Maven / Gradle / Ivy
package host.anzo.commons.concurrent;
import java.util.concurrent.locks.ReentrantLock;
/**
* @author tsa
* @since 20.11.2016
*/
public class CloseableReentrantLock extends ReentrantLock implements AutoCloseable {
public CloseableReentrantLock() {
super(true);
}
public CloseableReentrantLock open() {
this.lock();
return this;
}
@Override
public void close() {
this.unlock();
}
}