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

blah.concurrency.second.Locker Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version
package blah.concurrency.second;

import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;

public class Locker {

	final ReentrantLock lock = new ReentrantLock();
	final Condition waitCondition = lock.newCondition();
	
	public void parkNanos( final long nanos ){
		try {
			waitCondition.awaitNanos(nanos);
		} catch (final InterruptedException e) {
			throw new RuntimeException(e);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy