Example #1
0
  /** {@inheritDoc} */
  @Override()
  protected void validateNonLDAPJobInfo(
      final int numClients,
      final int threadsPerClient,
      final int threadStartupDelay,
      final Date startTime,
      final Date stopTime,
      final int duration,
      final int collectionInterval,
      final ParameterList parameters)
      throws InvalidValueException {
    // Make sure that neither a stop time nor a duration were specified.
    if ((stopTime != null) || (duration > 0)) {
      throw new InvalidValueException(
          "Neither a stop time nor a duration " + "may be defined when scheduling this job.");
    }

    // Make sure that the upper bound is greater than the lower bound.
    IntegerParameter lowerParam = parameters.getIntegerParameter(lowerBoundParameter.getName());
    IntegerParameter upperParam = parameters.getIntegerParameter(upperBoundParameter.getName());
    if (lowerParam.getIntValue() >= upperParam.getIntValue()) {
      throw new InvalidValueException("The upper bound must be greater than " + "the lower bound.");
    }
  }
Example #2
0
  /** {@inheritDoc} */
  @Override()
  protected void initializeClientNonLDAP(final String clientID, final ParameterList parameters)
      throws UnableToRunException {
    activeThreads = new AtomicInteger(getClientSideJob().getThreadsPerClient());

    rdnAttributeParameter = parameters.getStringParameter(rdnAttributeParameter.getName());
    rdnAttribute = rdnAttributeParameter.getStringValue();

    rdnValuePrefix = "";
    rdnPrefixParameter = parameters.getStringParameter(rdnPrefixParameter.getName());
    if ((rdnPrefixParameter != null) && rdnPrefixParameter.hasValue()) {
      rdnValuePrefix = rdnPrefixParameter.getStringValue();
    }

    lowerBoundParameter = parameters.getIntegerParameter(lowerBoundParameter.getName());
    lowerBound = lowerBoundParameter.getIntValue();
    entryNumber = new AtomicInteger(lowerBound);

    upperBoundParameter = parameters.getIntegerParameter(upperBoundParameter.getName());
    upperBound = upperBoundParameter.getIntValue();

    rdnValueSuffix = "";
    rdnSuffixParameter = parameters.getStringParameter(rdnSuffixParameter.getName());
    if ((rdnSuffixParameter != null) && rdnSuffixParameter.hasValue()) {
      rdnValueSuffix = rdnSuffixParameter.getStringValue();
    }

    parentDNParameter = parameters.getStringParameter(parentDNParameter.getName());
    parentDN = parentDNParameter.getStringValue();

    responseTimeThreshold = -1;
    thresholdParameter = parameters.getIntegerParameter(thresholdParameter.getName());
    if ((thresholdParameter != null) && thresholdParameter.hasValue()) {
      responseTimeThreshold = thresholdParameter.getIntValue();
    }

    timeBetweenRequests = 0L;
    timeBetweenRequestsParameter =
        parameters.getIntegerParameter(timeBetweenRequestsParameter.getName());
    if ((timeBetweenRequestsParameter != null) && timeBetweenRequestsParameter.hasValue()) {
      timeBetweenRequests = timeBetweenRequestsParameter.getIntValue();
    }

    rateLimiter = null;
    maxRateParameter = parameters.getIntegerParameter(maxRateParameter.getName());
    if ((maxRateParameter != null) && maxRateParameter.hasValue()) {
      int maxRate = maxRateParameter.getIntValue();
      if (maxRate > 0) {
        int rateIntervalSeconds = 0;
        rateLimitDurationParameter =
            parameters.getIntegerParameter(rateLimitDurationParameter.getName());
        if ((rateLimitDurationParameter != null) && rateLimitDurationParameter.hasValue()) {
          rateIntervalSeconds = rateLimitDurationParameter.getIntValue();
        }

        if (rateIntervalSeconds <= 0) {
          rateIntervalSeconds = getClientSideJob().getCollectionInterval();
        }

        rateLimiter =
            new FixedRateBarrier(rateIntervalSeconds * 1000L, maxRate * rateIntervalSeconds);
      }
    }
  }