Source:
<code>public void testMultiThreadAddContiguousRanges() throws InterruptedException { final int numThreads = 8; final int addsPerThread = 100000; final int totalNumberOfAdds = numThreads * addsPerThread; final long rangeTerm = 2; final long rangeLength = 2; final CountDownLatch countDownLatch = new CountDownLatch(numThreads * 2); final Runnable[] threads0 = new Runnable[numThreads]; final Runnable[] threads1 = new Runnable[numThreads]; final int gap = 100; for (int index = 0; index < numThreads; index++) { threads0[index] = new RegisterThread(countDownLatch, partitionManager, index, rangeTerm, rangeLength, 0, numThreads, addsPerThread, IndexParity.ALL_INDEX); } <START> final long secondStartIdx = numThreads * addsPerThread + gap; <END> for (int index = 0; index < numThreads; index++) { threads1[index] = new RegisterThread(countDownLatch, partitionManager, (int) secondStartIdx + index, rangeTerm, rangeLength, 0, numThreads, addsPerThread, IndexParity.ALL_INDEX); } TestUtils.runConcurrently(threads0); TestUtils.runConcurrently(threads1); final boolean allThreadsFinished = countDownLatch.await(60, TimeUnit.SECONDS); assertTrue(MSG_THREADS_NOT_FINISHED, allThreadsFinished); assertEquals(MSG_SIZE_ASSERTION, 2, partitionManager.getRangeSet(EVAL_ID, DATA_TYPE).size()); final Iterator<LongRange> iterator = partitionManager.getRangeSet(EVAL_ID, DATA_TYPE).iterator(); final LongRange range0 = iterator.next(); final LongRange range1 = iterator.next(); assertEquals(MSG_RANGE_INCORRECT, new LongRange(0, rangeLength * totalNumberOfAdds - 1), range0); assertEquals(MSG_RANGE_INCORRECT, new LongRange(rangeLength * secondStartIdx, rangeLength * secondStartIdx + rangeLength * totalNumberOfAdds - 1), range1); }</code><technical_language>is secondStartIdx a long variable</technical_language>

Target:
public void testMultiThreadAddContiguousRanges() throws InterruptedException { final int numThreads = 8; final int addsPerThread = 100000; final int totalNumberOfAdds = numThreads * addsPerThread; final long rangeTerm = 2; final long rangeLength = 2; final CountDownLatch countDownLatch = new CountDownLatch(numThreads * 2); final Runnable[] threads0 = new Runnable[numThreads]; final Runnable[] threads1 = new Runnable[numThreads]; final int gap = 100; for (int index = 0; index < numThreads; index++) { threads0[index] = new RegisterThread(countDownLatch, partitionManager, index, numThreads, addsPerThread, IndexParity.ALL_INDEX, EVAL_ID_PREFIX, DATA_TYPE_PREFIX, rangeTerm, rangeLength, 0); } final long secondStartIdx = numThreads * addsPerThread + gap; for (int index = 0; index < numThreads; index++) { threads1[index] = new RegisterThread(countDownLatch, partitionManager, (int) secondStartIdx + index, numThreads, addsPerThread, IndexParity.ALL_INDEX, EVAL_ID_PREFIX, DATA_TYPE_PREFIX, rangeTerm, rangeLength, 0 ); } TestUtils.runConcurrently(threads0); TestUtils.runConcurrently(threads1); final boolean allThreadsFinished = countDownLatch.await(60, TimeUnit.SECONDS); assertTrue(MSG_THREADS_NOT_FINISHED, allThreadsFinished); assertEquals(MSG_SIZE_ASSERTION, 2, partitionManager.getRangeSet(EVAL_ID_PREFIX, DATA_TYPE_PREFIX).size()); final Iterator<LongRange> iterator = partitionManager.getRangeSet(EVAL_ID_PREFIX, DATA_TYPE_PREFIX).iterator(); final LongRange range0 = iterator.next(); final LongRange range1 = iterator.next(); assertEquals(MSG_RANGE_INCORRECT, new LongRange(0, rangeLength * totalNumberOfAdds - 1), range0); assertEquals(MSG_RANGE_INCORRECT, new LongRange(rangeLength * secondStartIdx, rangeLength * secondStartIdx + rangeLength * totalNumberOfAdds - 1), range1); }