@Override public void doRun() throws Exception { TxnExecutor executor = createWriteBlock(); TxnVoidCallable callable = new TxnVoidCallable() { @Override public void call(Txn tx) throws Exception { GammaTxn btx = (GammaTxn) tx; for (int k = 0; k < refs.length; k++) { refs[k].set(btx, id); } } }; int mod = 1; int k = 0; while (!stop) { executor.execute(callable); sleepRandomUs(100); k++; if (k % mod == 0) { mod = mod * 2; System.out.printf("%s is at %s\n", getName(), k); } } }
@Override public void doRun() throws Exception { TxnExecutor executor = createReadBlock(); TxnVoidCallable callable = new TxnVoidCallable() { @Override public void call(Txn tx) throws Exception { GammaTxn btx = (GammaTxn) tx; long initial = refs[0].get(btx); for (int k = 1; k < refs.length; k++) { long s = refs[k].get(btx); if (initial != s) { inconsistencyDetected.set(true); stop = true; System.out.printf("Inconsistency detected at index %s!!\n", k); } } } }; int mod = 1; int k = 0; while (!stop) { executor.execute(callable); k++; if (k % mod == 0) { mod = mod * 2; System.out.printf("%s is at %s\n", getName(), k); } } }