frankgh commented on code in PR #72:
URL: https://github.com/apache/cassandra-sidecar/pull/72#discussion_r1361343026
##########
src/main/java/org/apache/cassandra/sidecar/config/yaml/ServiceConfigurationImpl.java:
##########
@@ -88,117 +107,45 @@ public class ServiceConfigurationImpl implements
ServiceConfiguration
@JsonProperty(value = WORKER_POOLS_PROPERTY, required = true)
protected final Map<String, ? extends WorkerPoolConfiguration>
workerPoolsConfiguration;
- @JsonProperty("jmx")
+ @JsonProperty(value = JMX_PROPERTY)
protected final JmxConfiguration jmxConfiguration;
- public ServiceConfigurationImpl()
- {
- this(DEFAULT_HOST,
- DEFAULT_PORT,
- DEFAULT_REQUEST_IDLE_TIMEOUT_MILLIS,
- DEFAULT_REQUEST_TIMEOUT_MILLIS,
- DEFAULT_ALLOWABLE_SKEW_IN_MINUTES,
- new ThrottleConfigurationImpl(),
- new SSTableUploadConfigurationImpl(),
- new SSTableImportConfigurationImpl(),
- DEFAULT_WORKER_POOLS_CONFIGURATION,
- new JmxConfigurationImpl());
- }
-
- public ServiceConfigurationImpl(SSTableImportConfiguration
ssTableImportConfiguration)
- {
- this(DEFAULT_HOST,
- DEFAULT_PORT,
- DEFAULT_REQUEST_IDLE_TIMEOUT_MILLIS,
- DEFAULT_REQUEST_TIMEOUT_MILLIS,
- DEFAULT_ALLOWABLE_SKEW_IN_MINUTES,
- new ThrottleConfigurationImpl(),
- new SSTableUploadConfigurationImpl(),
- ssTableImportConfiguration,
- DEFAULT_WORKER_POOLS_CONFIGURATION,
- new JmxConfigurationImpl());
- }
-
- public ServiceConfigurationImpl(String host,
- ThrottleConfiguration
throttleConfiguration,
- SSTableUploadConfiguration
ssTableUploadConfiguration,
- JmxConfiguration jmxConfiguration)
- {
- this(host,
- DEFAULT_PORT,
- DEFAULT_REQUEST_IDLE_TIMEOUT_MILLIS,
- DEFAULT_REQUEST_TIMEOUT_MILLIS,
- DEFAULT_ALLOWABLE_SKEW_IN_MINUTES,
- throttleConfiguration,
- ssTableUploadConfiguration,
- new SSTableImportConfigurationImpl(),
- DEFAULT_WORKER_POOLS_CONFIGURATION,
- jmxConfiguration);
- }
-
- public ServiceConfigurationImpl(int requestIdleTimeoutMillis,
- long requestTimeoutMillis,
- SSTableUploadConfiguration
ssTableUploadConfiguration)
- {
+ @JsonProperty(value = TRAFFIC_SHAPING_PROPERTY)
+ protected final TrafficShapingConfiguration trafficShapingConfiguration;
- this(DEFAULT_HOST,
- DEFAULT_PORT,
- requestIdleTimeoutMillis,
- requestTimeoutMillis,
- DEFAULT_ALLOWABLE_SKEW_IN_MINUTES,
- new ThrottleConfigurationImpl(),
- ssTableUploadConfiguration,
- new SSTableImportConfigurationImpl(),
- DEFAULT_WORKER_POOLS_CONFIGURATION,
- new JmxConfigurationImpl());
- }
-
- public ServiceConfigurationImpl(String host,
- int port,
- int requestIdleTimeoutMillis,
- long requestTimeoutMillis,
- int allowableSkewInMinutes,
- ThrottleConfiguration
throttleConfiguration,
- SSTableUploadConfiguration
ssTableUploadConfiguration,
- SSTableImportConfiguration
ssTableImportConfiguration,
- Map<String, ? extends
WorkerPoolConfiguration> workerPoolsConfiguration,
- JmxConfiguration jmxConfiguration)
+ /**
+ * Constructs a new {@link ServiceConfigurationImpl} with the default
values
+ */
+ public ServiceConfigurationImpl()
{
- this.host = host;
- this.port = port;
- this.requestIdleTimeoutMillis = requestIdleTimeoutMillis;
- this.requestTimeoutMillis = requestTimeoutMillis;
- this.allowableSkewInMinutes = allowableSkewInMinutes;
- this.throttleConfiguration = throttleConfiguration;
- this.ssTableUploadConfiguration = ssTableUploadConfiguration;
- this.ssTableImportConfiguration = ssTableImportConfiguration;
- this.jmxConfiguration = jmxConfiguration;
- if (workerPoolsConfiguration == null ||
workerPoolsConfiguration.isEmpty())
- {
- this.workerPoolsConfiguration = DEFAULT_WORKER_POOLS_CONFIGURATION;
- }
- else
- {
- this.workerPoolsConfiguration = workerPoolsConfiguration;
- }
+ this(builder());
}
- public ServiceConfigurationImpl(String host)
+ /**
+ * Constructs a new {@link ServiceConfigurationImpl} with the configured
{@link Builder}
+ *
+ * @param builder the builder object
+ */
+ protected ServiceConfigurationImpl(Builder builder)
Review Comment:
this is another case of exploding number of constructors. So I decided to
simplify with a builder
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]