SGF-552 - Unset 'mcast-port' when 'locators' are specified and unset 'locators' when @EnableMcast is used.
This commit is contained in:
@@ -79,7 +79,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
@Configuration
|
||||
@SuppressWarnings("unused")
|
||||
public abstract class AbstractCacheConfiguration implements BeanFactoryAware, BeanClassLoaderAware, ImportAware {
|
||||
public abstract class AbstractCacheConfiguration implements BeanClassLoaderAware, BeanFactoryAware, ImportAware {
|
||||
|
||||
private static final AtomicBoolean CUSTOM_EDITORS_REGISTERED = new AtomicBoolean(false);
|
||||
private static final AtomicBoolean DEFINED_INDEXES_APPLICATION_LISTENER_REGISTERED = new AtomicBoolean(false);
|
||||
@@ -93,6 +93,7 @@ public abstract class AbstractCacheConfiguration implements BeanFactoryAware, Be
|
||||
|
||||
protected static final int DEFAULT_MCAST_PORT = 0;
|
||||
|
||||
protected static final String DEFAULT_LOCATORS = "";
|
||||
protected static final String DEFAULT_LOG_LEVEL = "config";
|
||||
protected static final String DEFAULT_NAME = "SpringDataGemFireApplication";
|
||||
|
||||
@@ -122,11 +123,11 @@ public abstract class AbstractCacheConfiguration implements BeanFactoryAware, Be
|
||||
|
||||
private PdxSerializer pdxSerializer;
|
||||
|
||||
private PropertiesBuilder customGemFireProperties = new PropertiesBuilder();
|
||||
private PropertiesBuilder customGemFireProperties = PropertiesBuilder.create();
|
||||
|
||||
private Resource cacheXml;
|
||||
|
||||
private String locators = "";
|
||||
private String locators = DEFAULT_LOCATORS;
|
||||
private String logLevel = DEFAULT_LOG_LEVEL;
|
||||
private String name;
|
||||
private String pdxDiskStoreName;
|
||||
@@ -188,7 +189,7 @@ public abstract class AbstractCacheConfiguration implements BeanFactoryAware, Be
|
||||
*/
|
||||
@Bean
|
||||
protected Properties gemfireProperties() {
|
||||
PropertiesBuilder gemfireProperties = new PropertiesBuilder();
|
||||
PropertiesBuilder gemfireProperties = PropertiesBuilder.create();
|
||||
|
||||
gemfireProperties.setProperty("name", name());
|
||||
gemfireProperties.setProperty("mcast-port", mcastPort());
|
||||
@@ -637,6 +638,7 @@ public abstract class AbstractCacheConfiguration implements BeanFactoryAware, Be
|
||||
/* (non-Javadoc) */
|
||||
void setLocators(String locators) {
|
||||
this.locators = locators;
|
||||
setMcastPort(DEFAULT_MCAST_PORT);
|
||||
}
|
||||
|
||||
protected String locators() {
|
||||
@@ -654,6 +656,7 @@ public abstract class AbstractCacheConfiguration implements BeanFactoryAware, Be
|
||||
|
||||
void setMcastPort(Integer mcastPort) {
|
||||
this.mcastPort = mcastPort;
|
||||
setLocators(DEFAULT_LOCATORS);
|
||||
}
|
||||
|
||||
protected Integer mcastPort() {
|
||||
|
||||
@@ -27,12 +27,12 @@ import java.lang.annotation.Target;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* The EnableLocator annotation marks a Spring {@link org.springframework.context.annotation.Configuration @Configuration}
|
||||
* The EnableLocator annotation configures a Spring {@link org.springframework.context.annotation.Configuration @Configuration}
|
||||
* annotated class to start an embedded GemFire Locator service in this GemFire server/data node.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.springframework.context.annotation.Import
|
||||
* @see LocatorConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.LocatorConfiguration
|
||||
* @since 1.9.0
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.data.gemfire.util.PropertiesBuilder;
|
||||
* @author John Blum
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableGemFireProperties
|
||||
* @see org.springframework.data.gemfire.config.annotation.support.EmbeddedServiceConfigurationSupport
|
||||
* @see org.springframework.data.gemfire.util.PropertiesBuilder
|
||||
* @since 1.9.0
|
||||
*/
|
||||
public class GemFirePropertiesConfiguration extends EmbeddedServiceConfigurationSupport {
|
||||
@@ -66,13 +67,17 @@ public class GemFirePropertiesConfiguration extends EmbeddedServiceConfiguration
|
||||
public static final String DEFAULT_DEPLOY_WORKING_DIRECTORY = ".";
|
||||
public static final String DEFAULT_MEMBERSHIP_PORT_RANGE = "1024-65535";
|
||||
|
||||
/* (non-Javadoc) */
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected Class getAnnotationType() {
|
||||
return EnableGemFireProperties.class;
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected Properties toGemFireProperties(Map<String, Object> annotationAttributes) {
|
||||
PropertiesBuilder gemfireProperties = new PropertiesBuilder();
|
||||
|
||||
@@ -24,9 +24,10 @@ import org.springframework.data.gemfire.config.annotation.support.EmbeddedServic
|
||||
import org.springframework.data.gemfire.util.PropertiesBuilder;
|
||||
|
||||
/**
|
||||
* The McastConfiguration class is a Spring {@link org.springframework.context.annotation.ImportBeanDefinitionRegistrar}
|
||||
* that applies additional GemFire/Geode configuration by way of GemFire/Geode System properties to configure
|
||||
* GemFire/Geode multi-cast networking rather than the (preferred) Locator-based location services.
|
||||
* The {@link McastConfiguration} class is a Spring {@link org.springframework.context.annotation.ImportBeanDefinitionRegistrar}
|
||||
* that applies additional GemFire configuration by way of GemFire System properties to configure and use
|
||||
* multi-cast networking for GemFire communication and distribution rather than the (preferred)
|
||||
* Locator-based location services.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableMcast
|
||||
@@ -42,17 +43,23 @@ public class McastConfiguration extends EmbeddedServiceConfigurationSupport {
|
||||
public static final String DEFAULT_MCAST_ADDRESS = "239.192.81.1";
|
||||
public static final String DEFAULT_MCAST_FLOW_CONTROL = "1048576,0.25,5000";
|
||||
|
||||
/* (non-Javadoc) */
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected Class getAnnotationType() {
|
||||
return EnableMcast.class;
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected Properties toGemFireProperties(Map<String, Object> annotationAttributes) {
|
||||
PropertiesBuilder gemfireProperties = PropertiesBuilder.create();
|
||||
|
||||
gemfireProperties.unsetProperty("locators");
|
||||
|
||||
gemfireProperties.setPropertyIfNotDefault("mcast-address",
|
||||
annotationAttributes.get("address"), DEFAULT_MCAST_ADDRESS);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user