GEODE-420: Rollback some checkAttributes changes
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/d3fbfbdf Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/d3fbfbdf Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/d3fbfbdf Branch: refs/heads/feature/GEODE-420 Commit: d3fbfbdf3222209f62952cd44cde6b4d7a57204c Parents: d35ec46 Author: Udo Kohlmeyer <[email protected]> Authored: Tue Aug 23 03:41:27 2016 +1000 Committer: Udo Kohlmeyer <[email protected]> Committed: Tue Aug 23 03:41:27 2016 +1000 ---------------------------------------------------------------------- .../internal/AbstractDistributionConfig.java | 16 +++++++--------- .../internal/RuntimeDistributionConfigImpl.java | 14 ++++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d3fbfbdf/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/AbstractDistributionConfig.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/AbstractDistributionConfig.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/AbstractDistributionConfig.java index ad43415..f46aede 100644 --- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/AbstractDistributionConfig.java +++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/AbstractDistributionConfig.java @@ -40,9 +40,9 @@ import com.gemstone.gemfire.internal.ConfigSource; import com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId; import com.gemstone.gemfire.internal.i18n.LocalizedStrings; import com.gemstone.gemfire.internal.logging.LogWriterImpl; -import com.gemstone.gemfire.internal.security.SecurableComponent; import com.gemstone.gemfire.internal.net.SSLEnabledComponent; import com.gemstone.gemfire.internal.net.SocketCreator; +import com.gemstone.gemfire.internal.security.SecurableComponent; import com.gemstone.gemfire.memcached.GemFireMemcachedServer; /** @@ -57,7 +57,7 @@ import com.gemstone.gemfire.memcached.GemFireMemcachedServer; @SuppressWarnings("deprecation") public abstract class AbstractDistributionConfig extends AbstractConfig implements DistributionConfig { - protected void checkAttribute(String attName, Object value) { + protected Object checkAttribute(String attName, Object value) { // first check to see if this attribute is modifiable, this also checks if the attribute is a valid one. if (!isAttributeModifiable(attName)) { throw new UnmodifiableException(_getUnmodifiableMsg(attName)); @@ -67,7 +67,7 @@ public abstract class AbstractDistributionConfig extends AbstractConfig implemen if (attribute == null) { // isAttributeModifiable already checks the validity of the attName, if reached here, then they // must be those special attributes that starts with ssl_system_props or sys_props, no further checking needed - return; + return value; } // for integer attribute, do the range check. if (attribute.type().equals(Integer.class)) { @@ -77,12 +77,12 @@ public abstract class AbstractDistributionConfig extends AbstractConfig implemen Method checker = checkers.get(attName); if (checker == null) { - return; + return value; } // if specific checker exists for this attribute, call that with the value try { - checker.invoke(this, value); + return checker.invoke(this, value); } catch (Exception e) { if (e instanceof RuntimeException) { throw (RuntimeException) e; @@ -496,13 +496,11 @@ public abstract class AbstractDistributionConfig extends AbstractConfig implemen return value; } - - /** * First check if sslComponents are in the list of valid components. If so, check that no other *-ssl-* properties other than cluster-ssl-* are set. * This would mean one is mixing the "old" with the "new" */ - @ConfigAttributeChecker(name=SECURITY_ENABLED_COMPONENTS) + @ConfigAttributeChecker(name = SECURITY_ENABLED_COMPONENTS) protected String checkSecurityEnabledComponents(String value) { // value with no commas // empty value @@ -515,7 +513,7 @@ public abstract class AbstractDistributionConfig extends AbstractConfig implemen return value; } StringTokenizer stringTokenizer = new StringTokenizer(value, ","); - while (stringTokenizer.hasMoreTokens()){ + while (stringTokenizer.hasMoreTokens()) { SecurableComponent.getEnum(stringTokenizer.nextToken()); } return value; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d3fbfbdf/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/RuntimeDistributionConfigImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/RuntimeDistributionConfigImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/RuntimeDistributionConfigImpl.java index 515e5df..c1384c3 100644 --- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/RuntimeDistributionConfigImpl.java +++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/RuntimeDistributionConfigImpl.java @@ -61,7 +61,7 @@ public final class RuntimeDistributionConfigImpl //////////////////// Configuration Methods //////////////////// @Override public void setLogLevel(int value) { - this.logLevel = value; + this.logLevel = (Integer)checkAttribute(LOG_LEVEL, value); getAttSourceMap().put(LOG_LEVEL, ConfigSource.runtime()); this.ds.getInternalLogWriter().setLogWriterLevel(value); LogWriterAppenders.configChanged(LogWriterAppenders.Identifier.MAIN); @@ -69,12 +69,13 @@ public final class RuntimeDistributionConfigImpl @Override public void setStatisticSamplingEnabled(boolean value) { - this.statisticSamplingEnabled = value; + this.statisticSamplingEnabled = (Boolean)checkAttribute(STATISTIC_SAMPLING_ENABLED, value); getAttSourceMap().put(STATISTIC_SAMPLING_ENABLED, ConfigSource.runtime()); } @Override public void setStatisticSampleRate(int value) { + value = (Integer)checkAttribute(STATISTIC_SAMPLE_RATE, value); if (value < DEFAULT_STATISTIC_SAMPLE_RATE) { // fix 48228 this.ds.getLogWriter().info("Setting statistic-sample-rate to " + DEFAULT_STATISTIC_SAMPLE_RATE + " instead of the requested " + value + " because VSD does not work with sub-second sampling."); @@ -85,6 +86,7 @@ public final class RuntimeDistributionConfigImpl @Override public void setStatisticArchiveFile(File value) { + value = (File)checkAttribute(STATISTIC_ARCHIVE_FILE, value); if (value == null) { value = new File(""); } @@ -100,26 +102,26 @@ public final class RuntimeDistributionConfigImpl @Override public void setArchiveDiskSpaceLimit(int value) { - this.archiveDiskSpaceLimit = value; + this.archiveDiskSpaceLimit = (Integer)checkAttribute(ARCHIVE_DISK_SPACE_LIMIT, value); getAttSourceMap().put(ARCHIVE_DISK_SPACE_LIMIT, ConfigSource.runtime()); } @Override public void setArchiveFileSizeLimit(int value) { - this.archiveFileSizeLimit = value; + this.archiveFileSizeLimit = (Integer)checkAttribute(ARCHIVE_FILE_SIZE_LIMIT, value); getAttSourceMap().put(ARCHIVE_FILE_SIZE_LIMIT, ConfigSource.runtime()); } @Override public void setLogDiskSpaceLimit(int value) { - this.logDiskSpaceLimit = value; + this.logDiskSpaceLimit = (Integer)checkAttribute(LOG_DISK_SPACE_LIMIT, value); getAttSourceMap().put(LOG_DISK_SPACE_LIMIT, ConfigSource.runtime()); LogWriterAppenders.configChanged(LogWriterAppenders.Identifier.MAIN); } @Override public void setLogFileSizeLimit(int value) { - this.logFileSizeLimit = value; + this.logFileSizeLimit = (Integer)checkAttribute(LOG_FILE_SIZE_LIMIT, value); getAttSourceMap().put(LOG_FILE_SIZE_LIMIT, ConfigSource.runtime()); LogWriterAppenders.configChanged(LogWriterAppenders.Identifier.MAIN); }
