From 84af4289165b915fcf1fbe53b1c3132feb45517b Mon Sep 17 00:00:00 2001 From: cotton-ben Date: Mon, 4 May 2020 06:43:29 -0400 Subject: [PATCH] made isoLevel a command line arg --- .../acid/ChronicleAcidIsolationGovernor.java | 38 +++++++++---------- .../map/fromdocs/acid/DirtyReadTolerance.java | 2 - .../map/fromdocs/acid/DirtyReadVictim.java | 4 +- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/main/java/net/openhft/chronicle/map/acid/ChronicleAcidIsolationGovernor.java b/src/main/java/net/openhft/chronicle/map/acid/ChronicleAcidIsolationGovernor.java index ec5c4eba8..5f2935a1d 100644 --- a/src/main/java/net/openhft/chronicle/map/acid/ChronicleAcidIsolationGovernor.java +++ b/src/main/java/net/openhft/chronicle/map/acid/ChronicleAcidIsolationGovernor.java @@ -118,24 +118,24 @@ public class ChronicleAcidIsolationGovernor implements ChronicleAcidIsolation { @Override public synchronized void commit() throws SQLException { System.out.println( - " ,---------- @t="+System.currentTimeMillis()+ - " Tx="+Thread.currentThread().toString().replaceAll(",",".")+ - " chrAig.commit() BEGIN "+ - "----------, " + " ,@t="+System.currentTimeMillis()+ + " Tx="+Thread.currentThread().toString().replaceAll(",",".")+ + " chrAig.commit() BEGIN "+ + "----------, " ); this.getTransactionIsolationMap().remove(Thread.currentThread().toString()); System.out.println( " ,---------- @t="+System.currentTimeMillis()+ - " Tx="+Thread.currentThread().toString().replaceAll(",",".")+ - " chrAig.commit() END "+ - "----------, " + " Tx="+Thread.currentThread().toString().replaceAll(",",".")+ + " chrAig.commit() END "+ + "----------, " ); this.notifyAll(); System.out.println( ", ---------- @t="+System.currentTimeMillis()+ - " Tx="+Thread.currentThread().toString().replaceAll(",",".")+ - " chrAig.commit() complete notifyAll() to waiting Tx Threads "+ - "---------- ," + " Tx="+Thread.currentThread().toString().replaceAll(",",".")+ + " chrAig.commit() complete notifyAll() to waiting Tx Threads "+ + "---------- ," ); } @@ -149,23 +149,23 @@ public class ChronicleAcidIsolationGovernor implements ChronicleAcidIsolation { } System.out.println( " ,---------- @t="+System.currentTimeMillis()+ - " Tx="+Thread.currentThread().toString().replaceAll(",",".")+ - " chrAig.rollback() BEGIN "+ - "----------, " + " Tx="+Thread.currentThread().toString().replaceAll(",",".")+ + " chrAig.rollback() BEGIN "+ + "----------, " ); this.getTransactionIsolationMap().remove(Thread.currentThread().toString()); System.out.println( " ,---------- @t="+System.currentTimeMillis()+ - " Tx="+Thread.currentThread().toString().replaceAll(",",".")+ - " chrAig.rollback() COMPLETE "+ - "----------, " + " Tx="+Thread.currentThread().toString().replaceAll(",",".")+ + " chrAig.rollback() COMPLETE "+ + "----------, " ); this.notifyAll(); System.out.println( ", ---------- @t="+System.currentTimeMillis()+ - " Tx="+Thread.currentThread().toString().replaceAll(",",".")+ - " chrAig.rollback() completed notifyAll() to waiting Tx Threads"+ - "----------, " + " Tx="+Thread.currentThread().toString().replaceAll(",",".")+ + " chrAig.rollback() completed notifyAll() to waiting Tx Threads"+ + "----------, " ); } // rest of these java.sql.Connection methods remain unimplemented ... diff --git a/src/test/java/net/openhft/chronicle/map/fromdocs/acid/DirtyReadTolerance.java b/src/test/java/net/openhft/chronicle/map/fromdocs/acid/DirtyReadTolerance.java index 12cf3b0bc..7ea9a091a 100644 --- a/src/test/java/net/openhft/chronicle/map/fromdocs/acid/DirtyReadTolerance.java +++ b/src/test/java/net/openhft/chronicle/map/fromdocs/acid/DirtyReadTolerance.java @@ -8,12 +8,10 @@ import net.openhft.chronicle.map.acid.ChronicleAcidIsolation; import net.openhft.chronicle.map.acid.ChronicleAcidIsolationGovernor; import net.openhft.chronicle.map.acid.BondVOInterface; import net.openhft.chronicle.map.fromdocs.pingpong_latency.PingPongCASLeft; - import java.io.File; import java.io.IOException; import java.sql.SQLException; import java.util.Arrays; - import static net.openhft.chronicle.values.Values.newNativeReference; diff --git a/src/test/java/net/openhft/chronicle/map/fromdocs/acid/DirtyReadVictim.java b/src/test/java/net/openhft/chronicle/map/fromdocs/acid/DirtyReadVictim.java index d41b963fa..d2b85012c 100644 --- a/src/test/java/net/openhft/chronicle/map/fromdocs/acid/DirtyReadVictim.java +++ b/src/test/java/net/openhft/chronicle/map/fromdocs/acid/DirtyReadVictim.java @@ -52,8 +52,8 @@ public class DirtyReadVictim implements Runnable { bond = chrAig.get("369604101"); Double coupon = bond.getCoupon(); System.out.println( - " ,,---------- @t="+System.currentTimeMillis()+ - " DirtyReadVictim got() coupon="+coupon+" calling chrAig.commmit()" + " ,,---------- @t="+System.currentTimeMillis()+ + " DirtyReadVictim got() coupon="+coupon+" calling chrAig.commmit()" ); //sc.nextLine(); chrAig.commit();