host.anzo.commons.concurrent.CloseableReentrantLock Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-core Show documentation
Show all versions of commons-core Show documentation
Commons library to make me happy.
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();
}
}