/** Get the update strategy. */ public static String getUpdateStrategy() { String strategy = (String) (TxBB.getBB().getSharedMap().get(UpdateStrategy)); if (strategy == null) { strategy = TxPrms.getUpdateStrategy(); TxBB.getBB().getSharedMap().put(UpdateStrategy, strategy); Log.getLogWriter().info("Update strategy is " + strategy); } return strategy; }
/** Increment the given counter */ public static void inc(int whichCounter) { TxBB.getBB().getSharedCounters().increment(whichCounter); }
/** * Return the expected commit success/failure for the current thread. * * @returns true if the current thread should succeed in its commit, false otherwise. */ public static boolean getCommitStatus() { Object key = TxBB.CommitStatusKey + Thread.currentThread().getName(); Object result = TxBB.getBB().getSharedMap().get(key); if (result instanceof Boolean) return ((Boolean) result).booleanValue(); else throw new TestException("Unknown value " + result + " for TxBB sharedMap key " + key); }
/** * Write to the blackboard the expected commit success/failure for the current thread. * * @param expectCommitStatus True if we expect the current thread to successfully commit, false * otherwise. */ public static void recordCommitStatus(boolean expectCommitStatus) { Object key = TxBB.CommitStatusKey + Thread.currentThread().getName(); TxBB.getBB().getSharedMap().put(key, new Boolean(expectCommitStatus)); Log.getLogWriter().info("Written to TxBB: " + key + ", " + expectCommitStatus); }
/** Convenience method for reading the list of operations for the current client thread. */ public static OpList getOpList() { Object key = OpListKey + Thread.currentThread().getName(); OpList opList = (OpList) (TxBB.getBB().getSharedMap().get(key)); Log.getLogWriter().info("TxBB read from shared map key " + key + ", value " + opList); return opList; }
/** Convenience method for writing a list of operations for the current client thread. */ public static void putOpList(OpList opList) { Object key = OpListKey + Thread.currentThread().getName(); TxBB.getBB().getSharedMap().put(key, opList); Log.getLogWriter().info("TxBB put into shared map key " + key + ", value " + opList); }