Ejemplo n.º 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);
      }
    }
  }
 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();
   }
 }