Пример #1
0
  /**
   * Do operations on the REGION_NAME's keys using keyIntervals to specify which keys get which
   * operations. This will return when all operations in all intervals have completed.
   *
   * @param availableOps - Bits which are true correspond to the operations that should be executed.
   */
  public void doOps(BitSet availableOps) {

    boolean useTransactions = getInitialImage.InitImagePrms.useTransactions();

    while (availableOps.cardinality() != 0) {
      int whichOp = getOp(availableOps, operations.length);
      boolean doneWithOps = false;

      if (useTransactions) {
        TxHelper.begin();
      }

      switch (whichOp) {
        case ADD_NEW_KEY:
          doneWithOps = addNewKey();
          break;
        case INVALIDATE:
          doneWithOps = invalidate();
          break;
        case DESTROY:
          doneWithOps = destroy();
          break;
        case UPDATE_EXISTING_KEY:
          doneWithOps = updateExistingKey();
          break;
        case GET:
          doneWithOps = get();
          break;
        case LOCAL_INVALIDATE:
          doneWithOps = localInvalidate();
          break;
        case LOCAL_DESTROY:
          doneWithOps = localDestroy();
          break;
        default:
          {
            throw new TestException("Unknown operation " + whichOp);
          }
      }

      if (useTransactions) {
        try {
          TxHelper.commit();
        } catch (CommitConflictException e) {
          // currently not expecting any conflicts ...
          throw new TestException(
              "Unexpected CommitConflictException " + TestHelper.getStackTrace(e));
        }
      }

      if (doneWithOps) {
        Log.getLogWriter().info("Done with operation " + whichOp);
        availableOps.clear(whichOp);
      }
      if (sleepBetweenOps) {
        Log.getLogWriter().info("Sleeping between ops for " + SLEEP_BETWEEN_OPS_MILLIS + " millis");
        MasterController.sleepForMs(SLEEP_BETWEEN_OPS_MILLIS);
      }
    }
  }
Пример #2
0
 /** Wait for the given vmid to recognize a severe alert. */
 public static void waitForSevereAlert(int vmID) {
   Log.getLogWriter().info("Waiting for vmID " + vmID + " to recognize a severe alert");
   String key = ControllerBB.SevereAlertKey + vmID;
   while (true) {
     if (ControllerBB.getBB().getSharedMap().containsKey(key)) {
       Log.getLogWriter().info("Done waiting for vmID " + vmID + " to recognize a severe alert");
       return;
     } else {
       MasterController.sleepForMs(2000);
     }
     checkForError();
   }
 }
Пример #3
0
 /** Wait for the given vmid to become dead. */
 public static void waitForIsDead(int vmID) {
   Log.getLogWriter().info("Waiting for vmID " + vmID + " to become dead");
   String key = ControllerBB.IsDeadKey + vmID;
   while (true) {
     if (ControllerBB.getBB().getSharedMap().containsKey(key)) {
       Log.getLogWriter().info("Done waiting for vmID " + vmID + " to become dead");
       return;
     } else {
       MasterController.sleepForMs(2000);
     }
     checkForError();
   }
 }
Пример #4
0
 /** Wait for the given vm to restart. */
 public static void waitForRestartedVm(int vmID) {
   Log.getLogWriter().info("Waiting for vmID " + vmID + " to restart");
   String key = ControllerBB.InitIsCompleteKey + vmID;
   while (true) {
     if (ControllerBB.getBB().getSharedMap().containsKey(key)) {
       Log.getLogWriter().info("Done Waiting for vmID " + vmID + " to restart");
       return;
     } else {
       MasterController.sleepForMs(2000);
     }
     checkForError();
   }
 }
Пример #5
0
 /** Wait for membership failure to complete. */
 public static void waitMembershipFailureComplete(int vmID) {
   Log.getLogWriter().info("Waiting for vmID " + vmID + " to complete membership failure");
   String key = ControllerBB.MembershipFailureCompleteKey + vmID;
   while (true) {
     if (ControllerBB.getBB().getSharedMap().containsKey(key)) {
       Log.getLogWriter()
           .info("Done waiting for vmID " + vmID + " to complete membership failure");
       return;
     } else {
       MasterController.sleepForMs(2000);
     }
     checkForError();
   }
 }
 protected void doAfterCreate(EntryEvent event) {
   if (ControllerBB.isPlayDeadEnabled()) {
     SBUtil.playDead();
   }
   if (ControllerBB.isSlowListenerEnabled()) { // slow
     logCall("afterCreate", event);
     Log.getLogWriter().info("Sleeping while slow listeners are enabled...");
     do {
       MasterController.sleepForMs(5000);
     } while (ControllerBB.isSlowListenerEnabled());
     Log.getLogWriter().info("Done being slow, returning from ForcedDiscListener.afterCreate");
   } else if (ControllerBB.isSicknessEnabled()) { // sick
     logCall("afterCreate", event);
     SBUtil.beSick();
   }
 }