From a6ab1cf80438ac7bf19b8cd33985f73776c6afc9 Mon Sep 17 00:00:00 2001 From: John Blum Date: Fri, 8 Jan 2016 15:10:00 -0800 Subject: [PATCH] SGF-458 - Enable resolution of GemFire's DistributedSystem and System properties to be overridden in PoolFactoryBean. (cherry picked from commit 10fadc0d9a92d007a7bff85045c5169f2d8797f7) Signed-off-by: John Blum --- .../data/gemfire/client/PoolFactoryBean.java | 23 +++++++++++++++---- ...orsAndServersPropertyPlaceholdersTest.java | 2 +- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/springframework/data/gemfire/client/PoolFactoryBean.java b/src/main/java/org/springframework/data/gemfire/client/PoolFactoryBean.java index ff1f5c22..fa43de2f 100644 --- a/src/main/java/org/springframework/data/gemfire/client/PoolFactoryBean.java +++ b/src/main/java/org/springframework/data/gemfire/client/PoolFactoryBean.java @@ -183,15 +183,30 @@ public class PoolFactoryBean implements FactoryBean, InitializingBean, Dis return PoolManager.createFactory(); } - /* (non-Javadoc) */ - void resolveDistributedSystem() { + /** + * Attempts to find an existing, running GemFire {@link DistributedSystem} or proceeds to create + * a new {@link DistributedSystem} if one does not exist. + * + * @see DistributedSystemUtils#getDistributedSystem() + * @see #resolveGemfireProperties() + * @see #doDistributedSystemConnect(Properties) + */ + protected void resolveDistributedSystem() { if (DistributedSystemUtils.isNotConnected(DistributedSystemUtils.getDistributedSystem())) { doDistributedSystemConnect(resolveGemfireProperties()); } } - /* (non-Javadoc) */ - Properties resolveGemfireProperties() { + /** + * Attempts to resolve existing GemFire System properties from the {@link ClientCacheFactoryBean} + * if set by the user. + * + * @return a {@link Properties} object containing GemFire System properties + * or null if no properties were configured. + * @see ClientCacheFactoryBean#resolveProperties() + * @see java.util.Properties + */ + protected Properties resolveGemfireProperties() { try { ClientCacheFactoryBean clientCacheFactoryBean = beanFactory.getBean(ClientCacheFactoryBean.class); return clientCacheFactoryBean.resolveProperties(); diff --git a/src/test/java/org/springframework/data/gemfire/client/PoolUsingLocatorsAndServersPropertyPlaceholdersTest.java b/src/test/java/org/springframework/data/gemfire/client/PoolUsingLocatorsAndServersPropertyPlaceholdersTest.java index 54e54372..4ebdf71c 100644 --- a/src/test/java/org/springframework/data/gemfire/client/PoolUsingLocatorsAndServersPropertyPlaceholdersTest.java +++ b/src/test/java/org/springframework/data/gemfire/client/PoolUsingLocatorsAndServersPropertyPlaceholdersTest.java @@ -155,7 +155,7 @@ public class PoolUsingLocatorsAndServersPropertyPlaceholdersTest { } @Override - void resolveDistributedSystem() { + protected void resolveDistributedSystem() { } }