package org.vanilladb.core.latch;

import java.util.concurrent.locks.ReentrantReadWriteLock;

import org.vanilladb.core.latch.context.LatchContext;

public class ReentrantReadWriteLatch extends Latch {

	private ReentrantReadWriteLock latch;

	public ReentrantReadWriteLatch() {
		latch = new ReentrantReadWriteLock();
	}

	public void lockReadLatch(LatchContext context) {
		setContextBeforeLock(context, latch.getQueueLength());

		latch.readLock().lock();

		setContextAfterLock(context);
	}

	public void lockWriteLatch(LatchContext context) {
		setContextBeforeLock(context, latch.getQueueLength());

		latch.writeLock().lock();

		setContextAfterLock(context);
	}

	public void unlockReadLatch(LatchContext context) {
		latch.readLock().unlock();

		setContextAfterUnlock(context);
	}

	public void unlockWriteLatch(LatchContext context) {
		latch.writeLock().unlock();

		setContextAfterUnlock(context);
	}
}

@@ -329,29 +329,24 @@
 ic void 
-lockReadLatch
+readLock
 (LatchCo
@@ -497,30 +497,25 @@
 ic void 
-lockW
+w
 riteL
-atch
+ock
 (LatchCo
@@ -671,23 +671,18 @@
 oid 
-unlockReadLatch
+readUnlock
 (Lat
@@ -787,24 +787,19 @@
 oid 
-unlockWriteLatch
+writeUnlock
 (Lat

Rename methods