}
public void testConcurrentStateTransfer() throws Exception {
testCount++;
log.info("testConcurrentStateTransfer start - " + testCount);
CacheContainer cm1 = null, cm2 = null, cm30 = null, cm40 = null;
try {
Cache<Object, Object> cache1 = null, cache2 = null, cache3 = null, cache4 = null;
cm1 = createCacheManager(tmpDirectory1);
cache1 = cm1.getCache(cacheName);
writeInitialData(cache1);
cm2 = createCacheManager(tmpDirectory2);
cache2 = cm2.getCache(cacheName);
cache1.put("delay", new StateTransferFunctionalTest.DelayTransfer());
// Pause to give caches time to see each other
TestingUtil.blockUntilViewsReceived(60000, cache1, cache2);
verifyInitialData(cache2);
final CacheContainer cm3 = createCacheManager(tmpDirectory3);
final CacheContainer cm4 = createCacheManager(tmpDirectory4);
cm30 = cm3;
cm40 = cm4;
Future<Void> f1 = fork(new Callable<Void>() {
@Override
public Void call() throws Exception {
cm3.getCache(cacheName);
return null;
}
});
Future<Void> f2 = fork(new Callable<Void>() {
@Override
public Void call() throws Exception {
cm4.getCache(cacheName);
return null;
}
});
f1.get();
f2.get();
cache3 = cm3.getCache(cacheName);
cache4 = cm4.getCache(cacheName);
TestingUtil.blockUntilViewsReceived(120000, cache1, cache2, cache3, cache4);
verifyInitialData(cache3);
verifyInitialData(cache4);
log.info("testConcurrentStateTransfer end - " + testCount);