mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
clarifying small nuances in jeremy's coding of the "Will Chronicle accommodate the 'dirty read intolerant' ACID zealots"
This commit is contained in:
@@ -19,7 +19,7 @@ import static net.openhft.chronicle.values.Values.newNativeReference;
|
||||
|
||||
public class DirtyReadIntolerant {
|
||||
|
||||
public static void main(String... ignored) throws IOException, SQLException {
|
||||
public static void main(String... ignored) throws Exception {
|
||||
|
||||
ChronicleMap<String, BondVOInterface> operand =
|
||||
DirtyReadIntolerant.acquireChronicleMapOperand(
|
||||
|
||||
@@ -10,14 +10,14 @@ import static net.openhft.chronicle.values.Values.newNativeReference;
|
||||
|
||||
public class DirtyReadOffender implements Runnable {
|
||||
|
||||
ChronicleAcidIsolationGovernor craig;
|
||||
ChronicleAcidIsolationGovernor chraig;
|
||||
|
||||
public ChronicleAcidIsolationGovernor getCraig() {
|
||||
return craig;
|
||||
return chraig;
|
||||
}
|
||||
|
||||
public void setCraig(ChronicleAcidIsolationGovernor craig) {
|
||||
this.craig = craig;
|
||||
this.chraig = craig;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,14 +26,14 @@ public class DirtyReadOffender implements Runnable {
|
||||
|
||||
try {
|
||||
BondVOInterface bond = newNativeReference(BondVOInterface.class);
|
||||
craig.getCompositeChronicleMap().acquireUsing("369604101", bond);
|
||||
craig.setTransactionIsolation(ChronicleAcidIsolation.LOWEST_LATENCY);
|
||||
chraig.getCompositeChronicleMap().acquireUsing("369604101", bond);
|
||||
chraig.setTransactionIsolation(ChronicleAcidIsolation.LOWEST_LATENCY);
|
||||
bond.setCoupon(4.55);
|
||||
craig.put("369604101",bond);
|
||||
craig.commit();
|
||||
chraig.put("369604101",bond);
|
||||
chraig.commit();
|
||||
} catch (Exception throwables) {
|
||||
try {
|
||||
craig.rollback();
|
||||
chraig.rollback();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class DirtyReadVictim implements Runnable {
|
||||
BondVOInterface bond = newNativeReference(BondVOInterface.class);
|
||||
craig.getCompositeChronicleMap().acquireUsing("369604101", bond);
|
||||
|
||||
craig.setTransactionIsolation(ChronicleAcidIsolation.DIRTY_READ_INTOLERANT); //start tx
|
||||
craig.setTransactionIsolation(ChronicleAcidIsolation.DIRTY_READ_INTOLERANT);
|
||||
bond = craig.getCompositeChronicleMap().get("369604101");
|
||||
Double coupon = bond.getCoupon();
|
||||
craig.commit();
|
||||
|
||||
Reference in New Issue
Block a user