//*TODO CONSIDER USE LIST WITH INITIAL CAP SIZE
private void distribute(Distribution[] distributionList, int iterationNum) {
        Distribution[] busy = null; //*TODO CONSIDER USE LIST WITH INITIAL CAP SIZE
        for (int inc = 0; inc < distributionList.length; inc++) {
            if (distributionList[inc] == null)
                continue;
            if (!distributionList[inc].getiStepDecorator().offerQueueSubjectUpdate(distributionList[inc].getData(), distributionList[inc].getSubject())) {
                if (busy == null) {
                    busy = new Distribution[distributionList.length];
                }
                busy[inc] = distributionList[inc];
                logger.debug("Distribution not succeeded. Moving to Deceleration Mode for Subject: "  + busy[inc].getSubject() + ". Iteration number - " + iterationNum + "/" + MAXIMUM_OFFERS_RETRIES);
            }
        }
        if (!isEmpty(busy)) {
            //* ***** Deceleration Mode *****
            if (iterationNum >= MAXIMUM_OFFERS_RETRIES) {
                logger.debug("Deceleration Mode failed after " + iterationNum + "/" + MAXIMUM_OFFERS_RETRIES + " retries. Moving back to normal distribution");
                for (Distribution dist : distributionList) {
                    if (dist == null)
                        continue;
                    dist.getiStepDecorator().queueSubjectUpdate(dist.getData(), dist.getSubject());
                }
            }
            try {
                logger.debug("Retarding the distribution for " + WAIT_PERIOD_MILLI * iterationNum + " milliseconds");
                Thread.sleep(WAIT_PERIOD_MILLI * iterationNum);
            } catch (InterruptedException e) {
                throw new SteppingSystemException("Distribution timeout failed");
            }
            distribute(busy, ++iterationNum);
        }
    }
private void distribute(Distribution[] distributionList, int iterationNum) {
Distribution[] busy = null; //*TODO CONSIDER USE LIST WITH INITIAL CAP SIZE
for (int inc = 0; inc < distributionList.length; inc++) {
if (distributionList[inc] == null)
private void distribute(Distribution[] distributionList, int iterationNum) {
Distribution[] busy = null; //*TODO CONSIDER USE LIST WITH INITIAL CAP SIZE
for (int inc = 0; inc < distributionList.length; inc++) {
if (distributionList[inc] == null)
continue;
if (!distributionList[inc].getiStepDecorator().offerQueueSubjectUpdate(distributionList[inc].getData(), distributionList[inc].getSubject())) {
if (busy == null) {
busy = new Distribution[distributionList.length];
}
busy[inc] = distributionList[inc];
logger.debug("Distribution not succeeded. Moving to Deceleration Mode for Subject: " + busy[inc].getSubject() + ". Iteration number - " + iterationNum + "/" + MAXIMUM_OFFERS_RETRIES);
}
private void distribute(Distribution[] distributionList, int iterationNum) {
Distribution[] busy = null; //*TODO CONSIDER USE LIST WITH INITIAL CAP SIZE
for (int inc = 0; inc < distributionList.length; inc++) {
if (distributionList[inc] == null)
continue;
if (!distributionList[inc].getiStepDecorator().offerQueueSubjectUpdate(distributionList[inc].getData(), distributionList[inc].getSubject())) {
if (busy == null) {
busy = new Distribution[distributionList.length];
}
busy[inc] = distributionList[inc];
logger.debug("Distribution not succeeded. Moving to Deceleration Mode for Subject: " + busy[inc].getSubject() + ". Iteration number - " + iterationNum + "/" + MAXIMUM_OFFERS_RETRIES);
}
}
if (!isEmpty(busy)) {
//* ***** Deceleration Mode *****
if (iterationNum >= MAXIMUM_OFFERS_RETRIES) {
logger.debug("Deceleration Mode failed after " + iterationNum + "/" + MAXIMUM_OFFERS_RETRIES + " retries. Moving back to normal distribution");
for (Distribution dist : distributionList) {
if (dist == null)
continue;
dist.getiStepDecorator().queueSubjectUpdate(dist.getData(), dist.getSubject());
}