Code example for ReentrantReadWriteLock

Methods: readLock, writeLock

0
package warGem; 
 
import java.awt.AWTException; 
import java.awt.Point; 
import java.awt.Robot; 
import java.util.concurrent.locks.Lock; 
import java.util.concurrent.locks.ReentrantReadWriteLock; 
 
public class mouseHandle { 
	private ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
	private Lock readLock = lock.readLock();
	private Lock writeLock = lock.writeLock();
	private Robot reseter;
 
	public mouseHandle() { 
		try { 
			reseter = new Robot();
		} catch (AWTException e) {
			// TODO Auto-generated catch block 
			e.printStackTrace();
		} 
	} 
 
	public void resetMousePosition() { 
		writeLock.lock();