Methods Summary |
---|
private static java.lang.String | concat(java.lang.String s1, java.lang.String s2, java.lang.String s3, java.lang.String s4)
final StringBuffer sb = new StringBuffer();
if (s1 != null)
sb.append(s1);
if (s2 != null)
sb.append(s2);
if (s3 != null)
sb.append(s3);
if (s4 != null)
sb.append(s4);
return ( sb.toString() );
|
public static javax.management.remote.JMXServiceURL | forJconsoleOverRmiWithJndiInAppserver(java.lang.String host, int port)
return ( forRmiWithJndi(host, port, JCONSOLE_RMI_JSR160_CS_JNDI_SUFFIX, false) );
|
public static javax.management.remote.JMXServiceURL | forJmxmp(int port)
return ( forJmxmp(localhost(), port) );
|
public static javax.management.remote.JMXServiceURL | forJmxmp(java.lang.String host, int port)Returns the JMXServiceURL for JMXMP and given host and port.
The host may not be null.
JMXServiceURL url;
if (host == null)
throw new IllegalArgumentException("Null Host");
try {
url = new JMXServiceURL("jmxmp", host, port);
final String msg = "JMXServiceURL is: " + url;
logger.fine(msg);
}
catch (MalformedURLException m) {
url = null;
//squelching the exception purposely, as I want to be sure.
}
assert (url != null): "Something seriously wrong, can't form the JMXServiceURL";
return ( url );
|
public static javax.management.remote.JMXServiceURL | forRmiIiopWithoutIor(int port)This API should be called when the ConnectorServer and
following is true.
- The protocol is RMI over IIOP.
- There is no JNDI involved.
After the ConnectorServer is created with this URL, its address will
contain the actual base-64 encoded IOR that it can be used by ConnectorClients.
In order to connect to such a ConnectorServer the client has to be provide
the IIOP stub to form the JMXServiceURL.
Bottom line: This API should be called when creating ConnectorServer.
JMXServiceURL url;
try {
final String s = "service:jmx:iiop://" + localhost() + ":" + port;
url = new JMXServiceURL(s);
final String msg = "JMXServiceURL is: " + url;
logger.fine(msg);
}
catch (MalformedURLException m) {
url = null;
//squelching the exception purposely, as I want to be sure.
}
assert (url != null): "Something seriously wrong, can't form the JMXServiceURL";
return ( url );
|
public static javax.management.remote.JMXServiceURL | forRmiJrmpWithoutStub(int port)This API should be called when the ConnectorServer and
following is true.
- The protocol is RMI over JRMP.
- There is no JNDI involved.
After the ConnectorServer is created with this URL, its address will
contain the actual base-64 encoded stub that it can be used by ConnectorClients.
In order to connect to such a ConnectorServer the client has to be provide
the stub to form the JMXServiceURL.
Bottom line: This API should be called when creating ConnectorServer.
JMXServiceURL url;
try {
final String s = "service:jmx:rmi://" + localhost() + ":" + port;
url = new JMXServiceURL(s);
final String msg = "JmxServiceUrlFactory=>JMXServiceURL is: " + url;
logger.fine(msg);
}
catch (MalformedURLException m) {
url = null;
//squelching the exception purposely, as I want to be sure.
}
assert (url != null): "Something seriously wrong, can't form the JMXServiceURL";
return ( url );
|
private static javax.management.remote.JMXServiceURL | forRmiWithJndi(java.lang.String host, int port, java.lang.String jn, boolean addHost)A convenience method to create the JMXServiceURL for both Connector Client and
Connector Server. This API should be used when:
- JNDI is used to obtain the stub. This must start with '/'. Must not be null.
- Naming Service's host and port are known.
- The JNDI name of the stub with which it is registered is known.
This is a symmetric form of URL.
JMXServiceURL url;
String hps = ""; //empty String
if (host == null || jn == null) {
throw new IllegalArgumentException("Null Argument");
}
if (! jn.startsWith("/"))
throw new IllegalArgumentException("jndi-name must start with a /");
if (addHost) {
hps = host + ":" + port;
}
try {
final String s = "service:jmx:rmi://" + hps + "/jndi/rmi://" + host + ":" + port + jn;
url = new JMXServiceURL(s);
final String msg = "JMXServiceURL is: " + url;
logger.fine(msg);
}
catch (MalformedURLException m) {
url = null;
//squelching the exception purposely, as I want to be sure. No real need to propagate.
}
assert (url != null): "Something seriously wrong, can't form the JMXServiceURL";
return ( url );
|
private static javax.management.remote.JMXServiceURL | forRmiWithJndi(int port, java.lang.String jn)A variant of forRmiWithJndi(String, int, String, boolean).
Returns the ignored host form with localhost as the naming host for
the given jndi name.
return ( forRmiWithJndi(localhost(), port, jn, false) );
|
private static javax.management.remote.JMXServiceURL | forRmiWithJndi(int port)A variant of forRmiWithJndi(String, int, String, boolean).
Returns the System Jmx Connector address at the given port. The jndi
name is fixed by the field RMI_JSR160_CS_JNDI_SUFFIX.
return ( forRmiWithJndi(port, RMI_JSR160_CS_JNDI_SUFFIX) );
|
public static javax.management.remote.JMXServiceURL | forRmiWithJndiInAppserver(java.lang.String host, int port)This is a method used by both JSR 160 connector server and connector clients
within the application server. This API should be used by all the components within
the application server. Note the following points about the returned JMXServiceURL.
- Naming Service's host and port are provided.
- The JNDI name of the stub is fixed.
- This is the "ignored-host" kind of form. It always returns the URL which looks like
service:jmx:rmi:///jndi/rmi://host:port/
This is a symmetric form of URL.
return ( forRmiWithJndi(host, port, RMI_JSR160_CS_JNDI_SUFFIX, false) );
|
static java.lang.String | localhost()
String h;
try {
h = java.net.InetAddress.getLocalHost().getCanonicalHostName();
}
catch (java.net.UnknownHostException e) {
h = "localhost";
}
return ( h );
|