Added thread safety to logger

Jonathan Bell [2012-08-09 16:00:30]
Added thread safety to logger
Filename
testcase-generation/src/edu/columbia/cs/psl/invivo/bench/WallaceLogExplorer.java
testcase-generation/src/edu/columbia/cs/psl/invivo/record/Constants.java
testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedLog.java
testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedSerializableLog.java
testcase-generation/src/edu/columbia/cs/psl/invivo/record/Log.java
testcase-generation/src/edu/columbia/cs/psl/invivo/record/SerializableLog.java
testcase-generation/src/edu/columbia/cs/psl/invivo/record/WallaceExportRunner.java
testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/CloningAdviceAdapter.java
diff --git a/testcase-generation/src/edu/columbia/cs/psl/invivo/bench/WallaceLogExplorer.java b/testcase-generation/src/edu/columbia/cs/psl/invivo/bench/WallaceLogExplorer.java
index 225c4d6..ef6315f 100644
--- a/testcase-generation/src/edu/columbia/cs/psl/invivo/bench/WallaceLogExplorer.java
+++ b/testcase-generation/src/edu/columbia/cs/psl/invivo/bench/WallaceLogExplorer.java
@@ -8,14 +8,14 @@ import edu.columbia.cs.psl.invivo.record.ExportedSerializableLog;

 public class WallaceLogExplorer {
 	public static void main(String[] args) throws Exception {
-		File f = new File("instrumented-test/wallace_serializable_1344515523846.log");
+		File f = new File("instrumented/wallace_serializable_1344527362195.log");
 		ObjectInputStream ois = new ObjectInputStream(new FileInputStream(f));
 		ExportedSerializableLog log = (ExportedSerializableLog) ois.readObject();
 		Object[] alog = ExportedSerializableLog.aLog;

 		char[] clog = ExportedSerializableLog.cLog;
 		byte[] blog = ExportedSerializableLog.bLog;
-
+		String[] ownersA = ExportedSerializableLog.aLog_owners;
 		System.out.println(ExportedSerializableLog.aLog_fill);
 		System.out.println(ExportedSerializableLog.cLog_fill);
 		System.out.println(ExportedSerializableLog.dLog_fill);
diff --git a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/Constants.java b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/Constants.java
index c91c52b..8adae83 100644
--- a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/Constants.java
+++ b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/Constants.java
@@ -8,11 +8,11 @@ public interface Constants {
 	public static String LOG_DUMP_CLASS = "edu/columbia/cs/psl/invivo/record/Log";
 	public static String LOG_REPLAY_CLASS = "edu/columbia/cs/psl/invivo/record/ExportedLog";

-	public static int DEFAULT_LOG_SIZE = 1000;
+	public static int DEFAULT_LOG_SIZE = 2000;
 	public static int MAX_LOG_SIZE = 40000000;
 	public static int VERY_MAX_LOG_SIZE = 400000000;

-	public static double LOG_GROWTH_RATE = 1.5;
+	public static double LOG_GROWTH_RATE = 2.5;
 	public static String REPLAY_CLASS_SUFFIX = "InvivoReplay";
 	public static String INNER_COPY_METHOD_NAME = "_Invivo___copy";
 	public static String OUTER_COPY_METHOD_NAME = "_Invivo_copy";
diff --git a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedLog.java b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedLog.java
index feac8dc..d55ce7c 100644
--- a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedLog.java
+++ b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedLog.java
@@ -2,13 +2,14 @@ package edu.columbia.cs.psl.invivo.record;

 public class ExportedLog {
 	public static Object[] aLog = new Object[Constants.DEFAULT_LOG_SIZE];
+	public static String[] aLog_owners = new String[Constants.DEFAULT_LOG_SIZE];

 	public static int aLog_fill;
 	public static int aLog_replayIndex;

 	public static void clearLog() {
 		aLog = new Object[Constants.DEFAULT_LOG_SIZE];
-
+		aLog_owners =  new String[Constants.DEFAULT_LOG_SIZE];
 		aLog_fill = 0;
 	}
 }
diff --git a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedSerializableLog.java b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedSerializableLog.java
index 3d0ffbf..9d419aa 100644
--- a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedSerializableLog.java
+++ b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/ExportedSerializableLog.java
@@ -23,7 +23,16 @@ public class ExportedSerializableLog implements Serializable {
 	public static int aLog_fill, iLog_fill, jLog_fill, fLog_fill, dLog_fill, bLog_fill, zLog_fill, cLog_fill, sLog_fill;
 	public static int aLog_replayIndex , iLog_replayIndex, jLog_replayIndex, fLog_replayIndex, dLog_replayIndex, bLog_replayIndex, zLog_replayIndex, cLog_replayIndex, sLog_replayIndex;

-
+	public static String[] aLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+	public static String[] iLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+	public static String[] jLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+	public static String[] fLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+	public static String[] dLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+	public static String[] bLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+	public static String[] zLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+	public static String[] cLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+	public static String[] sLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+
 	public static void clearLog() {
 		aLog = new Serializable[Constants.DEFAULT_LOG_SIZE];
 		aLog_fill = 0;
@@ -49,6 +58,17 @@ public class ExportedSerializableLog implements Serializable {
 		oos.writeObject(cLog);
 		oos.writeInt(sLog_fill);
 		oos.writeObject(sLog);
+
+		oos.writeObject(aLog_owners);
+		oos.writeObject(iLog_owners);
+		oos.writeObject(jLog_owners);
+		oos.writeObject(fLog_owners);
+		oos.writeObject(dLog_owners);
+		oos.writeObject(bLog_owners);
+		oos.writeObject(zLog_owners);
+		oos.writeObject(cLog_owners);
+		oos.writeObject(sLog_owners);
+
 	}

 	private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
@@ -71,5 +91,15 @@ public class ExportedSerializableLog implements Serializable {
 		cLog = (char[]) ois.readObject();
 		sLog_fill = ois.readInt();
 		sLog = (short[]) ois.readObject();
+
+		aLog_owners = (String[]) ois.readObject();
+		iLog_owners = (String[]) ois.readObject();
+		jLog_owners = (String[]) ois.readObject();
+		fLog_owners = (String[]) ois.readObject();
+		dLog_owners = (String[]) ois.readObject();
+		bLog_owners = (String[]) ois.readObject();
+		zLog_owners = (String[]) ois.readObject();
+		cLog_owners = (String[]) ois.readObject();
+		sLog_owners = (String[]) ois.readObject();
 	}
 }
\ No newline at end of file
diff --git a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/Log.java b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/Log.java
index 8e6da82..b7ceeb4 100644
--- a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/Log.java
+++ b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/Log.java
@@ -5,22 +5,18 @@ import java.util.concurrent.locks.ReentrantLock;

 public class Log {
 	public static Object[] aLog = new Object[Constants.DEFAULT_LOG_SIZE];
+	public static String[] aLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
 	public static Lock logLock = new ReentrantLock();
 //	public static Object lock = new Object();
 	public static int logsize = 0;
 	public static int aLog_fill;
-	public static void growaLog()
-	{
-		Object[] newA = new Object[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
-		System.arraycopy(aLog, 0, newA, 0, aLog.length);
-		aLog = newA;
-	}
+

 	public static void clearLog() {
 //		System.err.println("start cl");
 		logsize = 0;
 		aLog = new Object[Constants.DEFAULT_LOG_SIZE];
-
+		aLog_owners = new String[Constants.DEFAULT_LOG_SIZE];

 		aLog_fill = 0;

diff --git a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/SerializableLog.java b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/SerializableLog.java
index 499e825..7b0c2db 100644
--- a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/SerializableLog.java
+++ b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/SerializableLog.java
@@ -15,87 +15,19 @@ public class SerializableLog implements Serializable{
 	public static boolean[] zLog = new boolean[Constants.DEFAULT_LOG_SIZE];
 	public static char[] cLog = new char[Constants.DEFAULT_LOG_SIZE];
 	public static short[] sLog = new short[Constants.DEFAULT_LOG_SIZE];
+
+	public static String[] aLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+	public static String[] iLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+	public static String[] jLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+	public static String[] fLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+	public static String[] dLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+	public static String[] bLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+	public static String[] zLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+	public static String[] cLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+	public static String[] sLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+
 	public static int logsize = 0;
 	public static int aLog_fill, iLog_fill, jLog_fill, fLog_fill, dLog_fill, bLog_fill, zLog_fill, cLog_fill, sLog_fill;


-	public static void growaLog()
-	{
-		Serializable[] newA = new Serializable[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
-		System.arraycopy(aLog, 0, newA, 0, aLog.length);
-		aLog = newA;
-	}
-	public static void growiLog()
-	{
-		int[] newA = new int[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
-		System.arraycopy(iLog, 0, newA, 0, iLog.length);
-		iLog = newA;
-	}
-	public static void growjLog()
-	{
-		long[] newA = new long[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
-		System.arraycopy(jLog, 0, newA, 0, jLog.length);
-		jLog = newA;
-	}
-	public static void growfLog()
-	{
-		float[] newA = new float[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
-		System.arraycopy(fLog, 0, newA, 0, fLog.length);
-		fLog = newA;
-	}
-	public static void growdLog()
-	{
-		double[] newA = new double[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
-		System.arraycopy(dLog, 0, newA, 0, dLog.length);
-		dLog = newA;
-	}
-	public static void growbLog()
-	{
-		byte[] newA = new byte[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
-		System.arraycopy(bLog, 0, newA, 0, bLog.length);
-		bLog = newA;
-	}
-	public static void growzLog()
-	{
-		boolean[] newA = new boolean[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
-		System.arraycopy(zLog, 0, newA, 0, zLog.length);
-		zLog = newA;
-	}
-	public static void growcLog()
-	{
-		char[] newA = new char[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
-		System.arraycopy(cLog, 0, newA, 0, cLog.length);
-		cLog = newA;
-	}
-	public static void growsLog()
-	{
-		short[] newA = new short[(int) (aLog.length * Constants.LOG_GROWTH_RATE)];
-		System.arraycopy(sLog, 0, newA, 0, sLog.length);
-		sLog = newA;
-	}
-	public static void clearLog() {
-//		System.err.println("start cl");
-		aLog = new Object[Constants.DEFAULT_LOG_SIZE];
-		iLog = new int[Constants.DEFAULT_LOG_SIZE];
-		jLog = new long[Constants.DEFAULT_LOG_SIZE];
-		fLog = new float[Constants.DEFAULT_LOG_SIZE];
-		dLog = new double[Constants.DEFAULT_LOG_SIZE];
-		bLog = new byte[Constants.DEFAULT_LOG_SIZE];
-		zLog = new boolean[Constants.DEFAULT_LOG_SIZE];
-		cLog = new char[Constants.DEFAULT_LOG_SIZE];
-		sLog = new short[Constants.DEFAULT_LOG_SIZE];
-		logsize = 0;
-		iLog_fill = 0;
-		jLog_fill = 0;
-		fLog_fill = 0;
-		dLog_fill = 0;
-		bLog_fill = 0;
-		zLog_fill = 0;
-		cLog_fill = 0;
-		sLog_fill = 0;
-		aLog_fill = 0;
-//		System.err.println("starting gc");
-//		System.gc();
-//		System.err.println("Fin gc");
-	}
 }
diff --git a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/WallaceExportRunner.java b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/WallaceExportRunner.java
index 1454783..fec9ada 100644
--- a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/WallaceExportRunner.java
+++ b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/WallaceExportRunner.java
@@ -11,108 +11,108 @@ import com.thoughtworks.xstream.XStream;
 import edu.columbia.cs.psl.invivo.record.xstream.StaticReflectionProvider;

 public class WallaceExportRunner extends Thread {
-	//	static Class<?> logger;
+	// static Class<?> logger;
 	static {
-		//		try {
-		////			System.err.println("Loading log class");
-		//			logger = Class.forName(Constants.LOG_DUMP_CLASS.replace("/", "."));
-		////			System.err.println("Loaded");
-		//		} catch (ClassNotFoundException e) {
-		//			// TODO Auto-generated catch block
-		//			e.printStackTrace();
-		//		}
+		// try {
+		// // System.err.println("Loading log class");
+		// logger = Class.forName(Constants.LOG_DUMP_CLASS.replace("/", "."));
+		// // System.err.println("Loaded");
+		// } catch (ClassNotFoundException e) {
+		// // TODO Auto-generated catch block
+		// e.printStackTrace();
+		// }
 	}

 	@Override
 	public void run() {
-		//		System.err.println("Export runner started");
-				while(1 == 1)
-				{
-		//			System.out.println("Exporting");
-		//			System.err.println("Exporting");
-		//			export(); //TODO uncomment
-		//			System.err.println("Exported");
-		try {
-			//				Thread.sleep(60000); //1 minute
-//			Thread.sleep(300000); //5 minutes
-							Thread.sleep(10000); //10 seconds
-			//				Thread.sleep(5000); //5 seconds
-//							Thread.sleep(1000); //1 seconds
-//							System.out.println("Waking up checking flag");
-							if(shouldExport == 1)
-								export();
-							if(shouldExportSerializable == 1)
-								exportSerializable();
-							if(shouldExport == 1)
-								export();
-
-		} catch (InterruptedException e) {
-			if(shouldExport == 1)
-				export();
-			if(shouldExportSerializable == 1)
-				exportSerializable();
-			if(shouldExport == 1)
-				export();
+		// System.err.println("Export runner started");
+		while (1 == 1) {
+			// System.out.println("Exporting");
+			// System.err.println("Exporting");
+			// export(); //TODO uncomment
+			// System.err.println("Exported");
+			try {
+				// Thread.sleep(60000); //1 minute
+				// Thread.sleep(300000); //5 minutes
+				Thread.sleep(10000); // 10 seconds
+				// Thread.sleep(5000); //5 seconds
+				// Thread.sleep(1000); //1 seconds
+				// System.out.println("Waking up checking flag");
+				if (shouldExport == 1)
+					export();
+				if (shouldExportSerializable == 1)
+					exportSerializable();
+				if (shouldExport == 1)
+					export();
+
+			} catch (InterruptedException e) {
+				if (shouldExport == 1)
+					export();
+				if (shouldExportSerializable == 1)
+					exportSerializable();
+				if (shouldExport == 1)
+					export();
+			}
 		}
-				}
 	}
+
 	static WallaceExportRunner inst = new WallaceExportRunner();
+
 	public WallaceExportRunner() {
 		setDaemon(true);
 		setPriority(Thread.MAX_PRIORITY);
 	}

-	private static ExportedLog	log	= new ExportedLog();
+	private static ExportedLog log = new ExportedLog();
+
 	public static void export() {
 		shouldExport = 0;
 		try {
 			XStream xstream = new XStream(new StaticReflectionProvider());
 			String xml = "";
-//			System.out.println("Waiting for the lock");
+			// System.out.println("Waiting for the lock");
 			Log.logLock.lock();
 			ExportedLog.aLog = Log.aLog;
-
-				ExportedLog.aLog_fill = Log.aLog_fill;
-				Log.logsize = 0;
-				Log.aLog = new Object[Constants.DEFAULT_LOG_SIZE];
-				Log.aLog_fill = 0;
+			ExportedLog.aLog_owners = Log.aLog_owners;
+			ExportedLog.aLog_fill = Log.aLog_fill;
+			Log.logsize = 0;
+			Log.aLog = new Object[Constants.DEFAULT_LOG_SIZE];
+			Log.aLog_fill = 0;
 			Log.logLock.unlock();
-				System.err.println("Serializing");
-				try{
+//			System.err.println("Serializing");
+			try {
 				xml = xstream.toXML(log);
-				}
-				catch(Exception ex)
-				{
-					System.err.println("NPE" + ex.getMessage());
-				}
-//				System.err.println("Clearing");
-				ExportedLog.clearLog();
-//				System.err.println("Cleared");
-
-			//CloningUtils.exportLock.writeLock().unlock();
+			} catch (Exception ex) {
+				System.err.println("NPE" + ex.getMessage());
+			}
+			// System.err.println("Clearing");
+			ExportedLog.clearLog();
+			// System.err.println("Cleared");
+
+			// CloningUtils.exportLock.writeLock().unlock();
 			File output = new File("wallace_" + System.currentTimeMillis() + ".log");
 			FileWriter fw = new FileWriter(output);
 			fw.write(xml);
 			fw.close();
-//			synchronized (Log.lock) {
-//				Log.lock.notifyAll();
-//			}
-//			synchronized (Log.lock) {
-//				Log.lock.notifyAll();
-//			}
-
+			// synchronized (Log.lock) {
+			// Log.lock.notifyAll();
+			// }
+			// synchronized (Log.lock) {
+			// Log.lock.notifyAll();
+			// }

 		} catch (Exception exi) {
-//			System.err.println(exi.getMessage());
+			// System.err.println(exi.getMessage());
 		}
 		shouldExport = -1;
 	}

 	private static ExportedSerializableLog logS = new ExportedSerializableLog();
+
 	public static void exportSerializable() {
 		shouldExportSerializable = 0;
 		try {
-
+
 			Log.logLock.lock();
 			{
 				ExportedSerializableLog.aLog = SerializableLog.aLog;
@@ -135,7 +135,16 @@ public class WallaceExportRunner extends Thread {
 				ExportedSerializableLog.zLog_fill = SerializableLog.zLog_fill;
 				ExportedSerializableLog.sLog_fill = SerializableLog.sLog_fill;

-
+				ExportedSerializableLog.aLog_owners = SerializableLog.aLog_owners;
+				ExportedSerializableLog.iLog_owners = SerializableLog.iLog_owners;
+				ExportedSerializableLog.jLog_owners = SerializableLog.jLog_owners;
+				ExportedSerializableLog.fLog_owners = SerializableLog.fLog_owners;
+				ExportedSerializableLog.dLog_owners = SerializableLog.dLog_owners;
+				ExportedSerializableLog.bLog_owners = SerializableLog.bLog_owners;
+				ExportedSerializableLog.zLog_owners = SerializableLog.zLog_owners;
+				ExportedSerializableLog.cLog_owners = SerializableLog.cLog_owners;
+				ExportedSerializableLog.sLog_owners = SerializableLog.sLog_owners;
+
 				SerializableLog.aLog = new Object[Constants.DEFAULT_LOG_SIZE];
 				SerializableLog.iLog = new int[Constants.DEFAULT_LOG_SIZE];
 				SerializableLog.jLog = new long[Constants.DEFAULT_LOG_SIZE];
@@ -145,6 +154,15 @@ public class WallaceExportRunner extends Thread {
 				SerializableLog.zLog = new boolean[Constants.DEFAULT_LOG_SIZE];
 				SerializableLog.cLog = new char[Constants.DEFAULT_LOG_SIZE];
 				SerializableLog.sLog = new short[Constants.DEFAULT_LOG_SIZE];
+				SerializableLog.aLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+				SerializableLog.iLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+				SerializableLog.jLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+				SerializableLog.fLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+				SerializableLog.dLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+				SerializableLog.bLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+				SerializableLog.zLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+				SerializableLog.cLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
+				SerializableLog.sLog_owners = new String[Constants.DEFAULT_LOG_SIZE];
 				SerializableLog.logsize = 0;
 				SerializableLog.iLog_fill = 0;
 				SerializableLog.jLog_fill = 0;
@@ -157,44 +175,44 @@ public class WallaceExportRunner extends Thread {
 				SerializableLog.aLog_fill = 0;
 			}
 			Log.logLock.unlock();
-//				System.err.println("Serializing serializable");
-				File output = new File("wallace_serializable_" + System.currentTimeMillis() + ".log");
-
-				ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(output));
-				oos.writeObject(logS);
-				oos.flush();
-				oos.close();
-//				System.err.println("Clearing serializable");
-				ExportedLog.clearLog();
-//				System.err.println("Cleared serializable");
-//				System.out.println("Notifying; " + Log.logsize +";"+SerializableLog.logsize);
-//				synchronized (Log.lock) {
-//					Log.lock.notifyAll();
-//				}
-//				synchronized (Log.lock) {
-//					Log.lock.notifyAll();
-//				}
+			// System.err.println("Serializing serializable");
+			File output = new File("wallace_serializable_" + System.currentTimeMillis() + ".log");
+
+			ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(output));
+			oos.writeObject(logS);
+			oos.flush();
+			oos.close();
+			// System.err.println("Clearing serializable");
+			ExportedLog.clearLog();
+			// System.err.println("Cleared serializable");
+			// System.out.println("Notifying; " + Log.logsize
+			// +";"+SerializableLog.logsize);
+			// synchronized (Log.lock) {
+			// Log.lock.notifyAll();
+			// }
+			// synchronized (Log.lock) {
+			// Log.lock.notifyAll();
+			// }
 		} catch (Exception exi) {
-//			System.err.println(exi.getMessage());
+			// System.err.println(exi.getMessage());
 		}
 		shouldExportSerializable = -1;
 	}
-
-	private static int	shouldExport	= -1;
-	private static int	shouldExportSerializable	= -1;
+
+	private static int shouldExport = -1;
+	private static int shouldExportSerializable = -1;
+
 	public static void _exportSerializable() {
-		if(shouldExportSerializable == -1)
-		{
-//			System.out.println("Flagged shouldexport serializble");
+		if (shouldExportSerializable == -1) {
+			// System.out.println("Flagged shouldexport serializble");
 			Thread.yield();
 			shouldExportSerializable = 1;
 			inst.interrupt();
 		}
 	}
-
+
 	public static void _export() {
-		if(shouldExport == -1)
-		{
+		if (shouldExport == -1) {
 			Thread.yield();
 			shouldExport = 1;
 			inst.interrupt();
diff --git a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/CloningAdviceAdapter.java b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/CloningAdviceAdapter.java
index 0ba94b4..c19240a 100644
--- a/testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/CloningAdviceAdapter.java
+++ b/testcase-generation/src/edu/columbia/cs/psl/invivo/record/visitor/CloningAdviceAdapter.java
@@ -228,23 +228,16 @@ public class CloningAdviceAdapter extends GeneratorAdapter implements Opcodes {
 		super.visitMethodInsn(INVOKEINTERFACE, Type.getInternalName(Lock.class), "lock", "()V");

 		// Grow the array if necessary
-		if (!isStaticLoggingField)
-			loadThis();
+
 		super.visitFieldInsn(getOpcode, logFieldOwner, logFieldName + "_fill", Type.INT_TYPE.getDescriptor());
-		if (!isStaticLoggingField)
-			loadThis();
 		super.visitFieldInsn(getOpcode, logFieldOwner, logFieldName, logFieldTypeDesc);
 		super.arrayLength();
 		Label labelForNoNeedToGrow = new Label();
 		super.ifCmp(Type.INT_TYPE, Opcodes.IFNE, labelForNoNeedToGrow);
 		// In this case, it's necessary to grow it
 		// Create the new array and initialize its size
-		// super.visitMethodInsn(Opcodes.INVOKESTATIC,
-		// Type.getInternalName(Log.class), "grow"+logFieldName, "()V");

 		int newArray = lvsorter.newLocal(Type.getType(logFieldTypeDesc));
-		if (!isStaticLoggingField)
-			loadThis();
 		visitFieldInsn(getOpcode, logFieldOwner, logFieldName, logFieldTypeDesc);
 		arrayLength();
 		visitInsn(Opcodes.I2D);
@@ -260,14 +253,10 @@ public class CloningAdviceAdapter extends GeneratorAdapter implements Opcodes {
 																// doing
 																// type.getElementType
 		storeLocal(newArray, Type.getType(logFieldTypeDesc));
-		// Do the copy
-		if (!isStaticLoggingField)
-			loadThis();
 		visitFieldInsn(getOpcode, logFieldOwner, logFieldName, logFieldTypeDesc);
 		visitInsn(Opcodes.ICONST_0);
 		loadLocal(newArray);
 		visitInsn(Opcodes.ICONST_0);
-
 		visitFieldInsn(getOpcode, logFieldOwner, logFieldName, logFieldTypeDesc);
 		arrayLength();
 		visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/System", "arraycopy", "(Ljava/lang/Object;ILjava/lang/Object;II)V");
@@ -276,6 +265,30 @@ public class CloningAdviceAdapter extends GeneratorAdapter implements Opcodes {

 		loadLocal(newArray);
 		visitFieldInsn(putOpcode, logFieldOwner, logFieldName, logFieldTypeDesc);
+
+		int newArray2 = lvsorter.newLocal(Type.getType("[Ljava/lang/String;"));
+		visitFieldInsn(getOpcode, logFieldOwner, logFieldName+"_owners", "[Ljava/lang/String;");
+		arrayLength();
+		visitInsn(Opcodes.I2D);
+		visitLdcInsn(Constants.LOG_GROWTH_RATE);
+		visitInsn(Opcodes.DMUL);
+		visitInsn(Opcodes.D2I);
+
+		newArray(Type.getType("Ljava/lang/String;"));
+
+		storeLocal(newArray2, Type.getType("[Ljava/lang/String;"));
+		visitFieldInsn(getOpcode, logFieldOwner, logFieldName+"_owners", "[Ljava/lang/String;");
+		visitInsn(Opcodes.ICONST_0);
+		loadLocal(newArray2);
+		visitInsn(Opcodes.ICONST_0);
+		visitFieldInsn(getOpcode, logFieldOwner, logFieldName+"_owners", "[Ljava/lang/String;");
+		arrayLength();
+		visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/System", "arraycopy", "(Ljava/lang/Object;ILjava/lang/Object;II)V");
+
+		// array = newarray
+
+		loadLocal(newArray2);
+		visitFieldInsn(putOpcode, logFieldOwner, logFieldName+"_owners", "[Ljava/lang/String;");

 		visitLabel(labelForNoNeedToGrow);
 		// Load this into the end piece of the array
@@ -323,9 +336,13 @@ public class CloningAdviceAdapter extends GeneratorAdapter implements Opcodes {
 		cloneValAtTopOfStack(elementType.getDescriptor(), debug, secondElHasArrayLen);

 		arrayStore(elementType);
-		// if(secondElHasArrayLen)
-		// super.visitInsn(POP)
+
+		visitFieldInsn(getOpcode, logFieldOwner, logFieldName+"_owners", "[Ljava/lang/String;");
+		visitFieldInsn(getOpcode, logFieldOwner, logFieldName + "_fill", Type.INT_TYPE.getDescriptor());

+		visitMethodInsn(INVOKESTATIC, "java/lang/Thread", "currentThread", "()Ljava/lang/Thread;");
+		visitMethodInsn(INVOKEVIRTUAL, "java/lang/Thread", "getName", "()Ljava/lang/String;");
+		arrayStore(Type.getType(String.class));
 		visitFieldInsn(getOpcode, logFieldOwner, logFieldName + "_fill", Type.INT_TYPE.getDescriptor());

 		super.visitInsn(Opcodes.ICONST_1);