package org.vanilladb.core.latch;

import java.util.HashMap;
import java.util.Map;

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

public class LatchMgr {
	Map<String, Latch> latchMap = new HashMap<String, Latch>();

	public static LatchContext newLatchContext() {
		return new LatchContext();
	}

	public ReentrantLatch registerReentrantLatch(String caller, String callerMethod) {
		ReentrantLatch latch = new ReentrantLatch();
		latchMap.put(getKey(caller, callerMethod), latch);
		return latch;
	}

	public ReentrantReadWriteLatch registerReentrantReadWriteLatch(String caller, String callerMethod) {
		ReentrantReadWriteLatch latch = new ReentrantReadWriteLatch();
		latchMap.put(getKey(caller, callerMethod), latch);
		return latch;
	}

	public String getKey(String caller, String callerMethod) {
		return caller + callerMethod;
	}
}
@@ -295,24 +295,127 @@
 text();%0A%09%7D%0A%0A
+%09public static String getKey(String caller, String callerMethod) %7B%0A%09%09return caller + callerMethod;%0A%09%7D%0A%0A
 %09public Reen
@@ -848,102 +848,6 @@
 ;%0A%09%7D
-%0A%0A%09public String getKey(String caller, String callerMethod) %7B%0A%09%09return caller + callerMethod;%0A%09%7D
 %0A%7D

Refactor code