ISPN-6955 Add guarantees that the cluster forms

This commit is contained in:
Galder Zamarreño 2012-01-11 15:26:42 +01:00
parent ad65da80ed
commit 8a4d604d9c
3 changed files with 19 additions and 0 deletions

View File

@ -221,4 +221,6 @@ public interface CacheAdapter {
*/
<T> T withinTx(Callable<T> c) throws Exception;
Cache getCache();
}

View File

@ -228,6 +228,11 @@ public class CacheAdapterImpl implements CacheAdapter {
return CacheHelper.withinTx(cache.getTransactionManager(), c);
}
@Override
public Cache getCache() {
return cache;
}
private Cache getFailSilentCache() {
return cache.withFlags(Flag.FAIL_SILENTLY);
}

View File

@ -23,11 +23,16 @@
*/
package org.hibernate.test.cache.infinispan.entity;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.hibernate.cache.infinispan.util.CacheHelper;
import org.infinispan.Cache;
import org.infinispan.test.TestingUtil;
import org.infinispan.transaction.tm.BatchModeTransactionManager;
import org.jboss.logging.Logger;
@ -107,8 +112,15 @@ public abstract class AbstractEntityRegionAccessStrategyTestCase extends Abstrac
remoteEntityRegion = remoteEnvironment.getEntityRegion( REGION_NAME, getCacheDataDescription() );
remoteAccessStrategy = remoteEntityRegion.buildAccessStrategy( getAccessType() );
waitForClusterToForm(localEntityRegion.getCacheAdapter().getCache(),
remoteEntityRegion.getCacheAdapter().getCache());
}
protected void waitForClusterToForm(Cache... caches) {
TestingUtil.blockUntilViewsReceived(10000, Arrays.asList(caches));
}
protected abstract String getConfigurationName();
protected static Configuration createConfiguration(String configName) {