[
https://issues.apache.org/jira/browse/STORM-1084?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14959339#comment-14959339
]
ASF GitHub Bot commented on STORM-1084:
---------------------------------------
Github user asfgit closed the pull request at:
https://github.com/apache/storm/pull/785
> Improve Storm config validation process to use java annotations instead of
> *_SCHEMA format
> ------------------------------------------------------------------------------------------
>
> Key: STORM-1084
> URL: https://issues.apache.org/jira/browse/STORM-1084
> Project: Apache Storm
> Issue Type: Improvement
> Components: storm-core
> Reporter: Boyang Jerry Peng
> Assignee: Boyang Jerry Peng
> Fix For: 0.11.0
>
>
> So currently we specify validators:
> public static final String STORM_MESSAGING_NETTY_MIN_SLEEP_MS =
> "storm.messaging.netty.min_wait_ms";
> public static final Object STORM_MESSAGING_NETTY_MIN_SLEEP_MS_SCHEMA =
> ConfigValidation.IntegerValidator;
> A better way to do this is using annotations. Something like:
> @isInteger
> public static final String STORM_MESSAGING_NETTY_MIN_SLEEP_MS =
> "storm.messaging.netty.min_wait_ms";
> Do this has many advantages. For one you can stack multiple annotations:
> @isInteger
> @NotNull
> public static final String STORM_MESSAGING_NETTY_MIN_SLEEP_MS =
> "storm.messaging.netty.min_wait_ms";
> And we can pass parameters into the annotations:
> @isPositiveInteger(includeZero = true)
> public static final String DRPC_REQUEST_TIMEOUT_SECS =
> "drpc.request.timeout.secs";
> instead of having to write another validator:
> ConfigValidation.NonNegativeIntegerValidator for including zero
> Also can pass in multiple validators to validate entries in lists or key and
> values in maps:
> @isNoDuplicateInList
> @NotNull
> @isListEntryCustom(entryValidatorClasses={IntegerValidator.class,PositiveNumberValidator.class})
> public static final String SUPERVISOR_SLOTS_PORTS = "supervisor.slots.ports";
> Users can pass in any number of validators to @isListEntryCustom and
> validation process I have implemented will validate every entry in the list
> with every validator.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)