for (long i = 0; i < COUNT; i++) {
workInfos[(int) i] = timer.scheduleAtFixedRate(key, userTaskFactory, userId, userKey, DELAY, DELAY);
}
Thread.sleep(SLOP + DELAY);
assertEquals(COUNT, counter.get());
TransactionContext transactionContext = transactionContextManager.newContainerTransactionContext();
for (int i = 0; i < workInfos.length; i++) {
workInfos[i].getExecutorFeedingTimerTask().cancel();
}
Thread.sleep(SLOP + DELAY);
assertEquals(COUNT, counter.get());
transactionContext.rollback();
Thread.sleep(SLOP + DELAY);
// Catches up with two periods.
assertEquals(3 * COUNT, counter.get());
}