mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
fixed both transport=/dev/shm/ references for www.xsede.org java (hdf5)
This commit is contained in:
+12
-10
@@ -2,12 +2,13 @@ package net.openhft.chronicle.map.fromdocs.acid.revelations;
|
||||
|
||||
import net.openhft.chronicle.map.ChronicleMap;
|
||||
import net.openhft.chronicle.map.fromdocs.BondVOInterface;
|
||||
|
||||
import java.util.Scanner;
|
||||
import java.util.concurrent.locks.StampedLock;
|
||||
|
||||
import static net.openhft.chronicle.values.Values.newNativeReference;
|
||||
|
||||
public class DirtyReadOffender {
|
||||
public class DirtyReadOffender {
|
||||
|
||||
public static void main(String args[]) {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
@@ -19,14 +20,15 @@ public class DirtyReadOffender {
|
||||
ChronicleMap<String, BondVOInterface> chm =
|
||||
DirtyReadTolerance.offHeap(
|
||||
args[2]
|
||||
+"OPERAND_CHRONICLE_MAP"
|
||||
+ "OPERAND_CHRONICLE_MAP"
|
||||
);
|
||||
System.out.println(
|
||||
" @t=" + System.currentTimeMillis() +
|
||||
" DirtyReadOffender established chm "
|
||||
);
|
||||
StampedLock offHeapLock = new ChronicleStampedLock(
|
||||
"OPERAND_ChronicleStampedLock"
|
||||
args[2]
|
||||
+ "OPERAND_ChronicleStampedLock"
|
||||
);
|
||||
BondVOInterface bond = newNativeReference(BondVOInterface.class);
|
||||
//BondVOInterface cslMock = newNativeReference(BondVOInterface.class);
|
||||
@@ -34,7 +36,7 @@ public class DirtyReadOffender {
|
||||
//chm.acquireUsing("Offender ", cslMock); // mock ChronicleStampLock
|
||||
System.out.println(
|
||||
" @t=" + System.currentTimeMillis() +
|
||||
" DirtyReadOffender sleeping "+sleepT+" seconds "
|
||||
" DirtyReadOffender sleeping " + sleepT + " seconds "
|
||||
);
|
||||
Thread.sleep(sleepT * 1_000);
|
||||
System.out.println(
|
||||
@@ -65,17 +67,17 @@ public class DirtyReadOffender {
|
||||
double newCoupon = 3.5 + Math.random();
|
||||
System.out.println(
|
||||
" @t=" + System.currentTimeMillis() +
|
||||
" DirtyReadOffender "+
|
||||
" calling chm.put('369604101',"+newCoupon+") "
|
||||
" DirtyReadOffender " +
|
||||
" calling chm.put('369604101'," + newCoupon + ") "
|
||||
);
|
||||
bond.setCoupon(newCoupon);
|
||||
chm.put("369604101", bond);
|
||||
//cslMock.setEntryLockState(System.currentTimeMillis()); //mock'd
|
||||
// chm.put("Offender ",cslMock); //mock'd
|
||||
// chm.put("Offender ",cslMock); //mock'd
|
||||
System.out.println(
|
||||
" @t=" + System.currentTimeMillis() +
|
||||
" DirtyReadOffender coupon=["+
|
||||
bond.getCoupon()+
|
||||
" DirtyReadOffender coupon=[" +
|
||||
bond.getCoupon() +
|
||||
"] written. "
|
||||
);
|
||||
} finally {
|
||||
@@ -83,7 +85,7 @@ public class DirtyReadOffender {
|
||||
System.out.println(
|
||||
" @t=" + System.currentTimeMillis() +
|
||||
" DirtyReadOffender called " +
|
||||
"offHeapLock.unlockWrite("+stamp+");"
|
||||
"offHeapLock.unlockWrite(" + stamp + ");"
|
||||
);
|
||||
}
|
||||
/**
|
||||
|
||||
+2
-1
@@ -20,7 +20,8 @@ public class DirtyReadTolerance<K,V> {
|
||||
|
||||
ChronicleMap<String, BondVOInterface> chm =
|
||||
DirtyReadTolerance.offHeap(
|
||||
"C:\\Users\\buddy\\dev\\shm\\OPERAND_CHRONICLE_MAP"
|
||||
args[2]
|
||||
+ "OPERAND_CHRONICLE_MAP"
|
||||
);
|
||||
System.out.println(",Established chm,");
|
||||
|
||||
|
||||
+3
-2
@@ -20,7 +20,7 @@ public class DirtyReadVictim {
|
||||
ChronicleMap<String, BondVOInterface> chm =
|
||||
DirtyReadTolerance.offHeap(
|
||||
args[2]
|
||||
+ "OPERAND_CHRONICLE_MAP"
|
||||
+ "OPERAND_CHRONICLE_MAP"
|
||||
);
|
||||
Double coupon = 0.00;
|
||||
BondVOInterface bond = newNativeReference(BondVOInterface.class);
|
||||
@@ -32,7 +32,8 @@ public class DirtyReadVictim {
|
||||
);
|
||||
StampedLock offHeapLock =
|
||||
new ChronicleStampedLock(
|
||||
"OPERAND_ChronicleStampedLock"
|
||||
args[2]
|
||||
+ "OPERAND_ChronicleStampedLock"
|
||||
);
|
||||
while ((stamp = offHeapLock.tryOptimisticRead()) < 0) {
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user