package org.vanilladb.core.latch;

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

import org.vanilladb.core.latch.feature.LatchFeatureCollector;

public class LatchMgr {
//	private static Logger logger = Logger.getLogger(LatchMgr.class.getName());
	private static final String FEATURE_CSV = "latch-features.csv";
	protected LatchFeatureCollector collector = new LatchFeatureCollector(FEATURE_CSV);

	private Map<String, Latch> latchMap = new HashMap<String, Latch>();

	public static String getKey(String caller, String target, int index) {
		return caller + "-" + target + "-" + index;
	}

	public void startCollecting() {
		collector.startCollecting();
	}

	public ReentrantLatch registerReentrantLatch(String caller, String target, int index) {
		String key = getKey(caller, target, index);
		ReentrantLatch latch = new ReentrantLatch(key, collector);
		latchMap.put(key, latch);
		return latch;
	}

	public ReentrantReadWriteLatch registerReentrantReadWriteLatch(String caller, String target, int index) {
		String key = getKey(caller, target, index);
		ReentrantReadWriteLatch latch = new ReentrantReadWriteLatch(key, collector);
		latchMap.put(key, latch);
		return latch;
	}
}
@@ -308,16 +308,139 @@
 s.csv%22;%0A
+%0A%09public static String getKey(String caller, String target, int index) %7B%0A%09%09return caller + %22-%22 + target + %22-%22 + index;%0A%09%7D%0A%0A
 %09protect
@@ -516,17 +516,16 @@
 E_CSV);%0A
-%0A
 %09private
@@ -590,130 +590,8 @@
 );%0A%0A
-%09public static String getKey(String caller, String target, int index) %7B%0A%09%09return caller + %22-%22 + target + %22-%22 + index;%0A%09%7D%0A%0A
 %09pub

Change style