frankgh commented on code in PR #72:
URL: https://github.com/apache/cassandra-sidecar/pull/72#discussion_r1361340142
##########
common/src/main/java/org/apache/cassandra/sidecar/common/JmxClient.java:
##########
@@ -65,94 +64,34 @@ public class JmxClient implements NotificationListener,
Closeable
private final Supplier<String> roleSupplier;
private final Supplier<String> passwordSupplier;
private final BooleanSupplier enableSslSupplier;
- private final int jmxConnectionMaxRetries;
- private final long jmxConnectionRetryDelayMillis;
+ private final int connectionMaxRetries;
+ private final long connectionRetryDelayMillis;
- /**
- * Creates a new client with the provided {@code host} and {@code port}.
- *
- * @param host the host of the JMX service
- * @param port the port of the JMX service
- */
- public JmxClient(String host, int port)
- {
- this(host, port, null, null, false);
- }
/**
- * Creates a new client with the provided parameters
+ * Creates a new JMX client with {@link Builder} options.
*
- * @param host the host of the JMX service
- * @param port the port of the JMX service
- * @param role the JMX role used for authentication
- * @param password the JMX role password used for authentication
- * @param enableSSl true if SSL is enabled for JMX, false otherwise
+ * @param builder the builder options
*/
- public JmxClient(String host, int port, String role, String password,
boolean enableSSl)
- {
- this(buildJmxServiceURL(host, port), () -> role, () -> password, () ->
enableSSl);
- }
-
- /**
- * Creates a new client with the provided parameters
- *
- * @param host the host of the JMX service
- * @param port the port of the JMX service
- * @param role the JMX role used for authentication
- * @param password the JMX role password used for
authentication
- * @param enableSSl true if SSL is enabled for JMX, false
otherwise
- * @param connectionMaxRetries the maximum number of connection
retries before failing to connect
- * @param connectionRetryDelayMillis the number of milliseconds to delay
between connection retries
- */
- public JmxClient(String host, int port, String role, String password,
- boolean enableSSl, int connectionMaxRetries, long
connectionRetryDelayMillis)
- {
- this(buildJmxServiceURL(host, port), () -> role, () -> password, () ->
enableSSl,
- connectionMaxRetries, connectionRetryDelayMillis);
- }
-
- @VisibleForTesting
- JmxClient(JMXServiceURL jmxServiceURL)
- {
- this(jmxServiceURL, () -> null, () -> null, () -> false);
- }
-
- @VisibleForTesting
- JmxClient(JMXServiceURL jmxServiceURL, String role, String password)
- {
- this(jmxServiceURL, () -> role, () -> password, () -> false);
- }
-
- public JmxClient(String host,
- int port,
- Supplier<String> roleSupplier,
- Supplier<String> passwordSupplier,
- BooleanSupplier enableSslSupplier)
+ private JmxClient(Builder builder)
Review Comment:
decided to go with the builder here, because the number of constructors was
getting crazy
--
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]