+ address cycle again
This commit is contained in:
Costin Leau
2011-08-25 18:39:05 +03:00
parent 53c93b5367
commit b4e2b4e92c
2 changed files with 9 additions and 6 deletions

View File

@@ -28,7 +28,6 @@ import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.Ordered;
import org.springframework.core.io.Resource;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.support.PersistenceExceptionTranslator;
@@ -59,7 +58,7 @@ import com.gemstone.gemfire.pdx.PdxSerializer;
* @author Costin Leau
*/
public class CacheFactoryBean implements BeanNameAware, BeanFactoryAware, BeanClassLoaderAware, DisposableBean,
InitializingBean, FactoryBean<GemFireCache>, PersistenceExceptionTranslator, Ordered {
InitializingBean, FactoryBean<GemFireCache>, PersistenceExceptionTranslator {
/**
* Inner class to avoid a hard dependency on the GemFire 6.6 API.
@@ -322,8 +321,4 @@ public class CacheFactoryBean implements BeanNameAware, BeanFactoryAware, BeanCl
protected BeanFactory getBeanFactory() {
return beanFactory;
}
public int getOrder() {
return 0;
}
}

View File

@@ -31,9 +31,11 @@ import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import com.gemstone.gemfire.cache.GemFireCache;
import com.gemstone.gemfire.cache.client.Pool;
import com.gemstone.gemfire.cache.client.PoolFactory;
import com.gemstone.gemfire.cache.client.PoolManager;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
/**
* Factory bean for easy declaration and configuration of a GemFire pool.
@@ -104,6 +106,12 @@ public class PoolFactoryBean implements FactoryBean<Pool>, InitializingBean, Dis
name = beanName;
}
// eagerly initialize cache (if needed)
if (InternalDistributedSystem.getAnyInstance() == null) {
// no cache found, do eager initialization
beanFactory.getBean(GemFireCache.class);
}
// first check the configured pools
Pool existingPool = PoolManager.find(name);
if (existingPool != null) {