Exemple #1
0
 /** 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;
 }
 /** Initialize the key ranges */
 public void initialize() {
   long uniqueKeyCounter =
       TxBB.getBB().getSharedCounters().incrementAndRead(TxBB.UniqueKeyCounter);
   int lower = (int) (((uniqueKeyCounter - 1) * KEY_RANGE) + 1);
   int upper = (int) (uniqueKeyCounter * KEY_RANGE);
   lowerKeyRange.set(new Integer(lower));
   upperKeyRange.set(new Integer(upper));
   Log.getLogWriter()
       .info(
           "LowerKeyRange is "
               + lowerKeyRange.get()
               + ", upperKeyRange is "
               + upperKeyRange.get());
   super.initialize();
 }
Exemple #3
0
 /** Increment the given counter */
 public static void inc(int whichCounter) {
   TxBB.getBB().getSharedCounters().increment(whichCounter);
 }
Exemple #4
0
 /**
  * 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);
 }
Exemple #5
0
 /**
  * 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);
 }
Exemple #6
0
 /** 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;
 }
Exemple #7
0
 /** 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);
 }