Skip to content

Commit

Permalink
Optionally accept URI-path on the constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
varas committed Jun 17, 2019
1 parent f14fa2e commit 9919452
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/main/java/org/newrelic/nrjmx/JMXFetcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
* (usually stdout)
*/
public class JMXFetcher {
public static final String defaultURIPath = "";

private static final Logger logger = Logger.getLogger("nrjmx");

private MBeanServerConnection connection;
Expand All @@ -64,6 +66,24 @@ public ValueError(String message) {
}
}

/**
* Builds a new JMXFetcher
* @param hostname Hostname of the JMX endpoint
* @param port Port of the JMX endpoint
* @param username User name of the JMX endpoint, or an empty string if authentication is disabled
* @param password Password of the JMX endpoint, or an empty string if authentication is disabled
* @param keyStore Path of the client keystore file
* @param keyStorePassword Password of the keystore file
* @param trustStore Path of the client trust store file
* @param trustStorePassword Password of the trust store file
* @param isRemote true if the connection is remote. False otherwise.
*/
public JMXFetcher(String hostname, int port, String username, String password, String keyStore,
String keyStorePassword, String trustStore, String trustStorePassword, boolean isRemote) {
this(hostname, port, defaultURIPath, username, password, keyStore,
keyStorePassword, trustStore, trustStorePassword, isRemote);
}

/**
* Builds a new JMXFetcher
* @param hostname Hostname of the JMX endpoint
Expand All @@ -82,9 +102,6 @@ public JMXFetcher(String hostname, int port, String uriPath, String username, St
if (isRemote) {
connectionString = String.format("service:jmx:remoting-jmx://%s:%s", hostname, port);
} else {
if ("".equals(uriPath)) {
uriPath = "jmxrmi";
}
connectionString = String.format("service:jmx:rmi:///jndi/rmi://%s:%s/%s", hostname, port, uriPath);
}

Expand Down

0 comments on commit 9919452

Please sign in to comment.