Skip to content

Commit

Permalink
RMI host is only configurable on JVM start...
Browse files Browse the repository at this point in the history
  • Loading branch information
Dag Liodden committed Apr 15, 2011
1 parent cd5e647 commit 963f24e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 22 deletions.
10 changes: 0 additions & 10 deletions src/java/voldemort/server/VoldemortConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ public class VoldemortConfig implements Serializable {
private RequestFormatType requestFormatType;

private int jmxRmiRegistryPort;
private String jmxRmiServerHost;
private int jmxRmiServerPort;

private boolean enableSlop;
Expand Down Expand Up @@ -268,7 +267,6 @@ public VoldemortConfig(Props props) {
this.clientMaxQueuedRequests = props.getInt("client.max.queued.requests", 1000);

this.enableJmxRemote = props.getBoolean("jmx.remote.enable", false);
this.jmxRmiServerHost = props.getString("jmx.remote.rmi.server.host", "localhost");
this.jmxRmiServerPort = props.getInt("jmx.remote.rmi.server.port", 10001);
this.jmxRmiRegistryPort = props.getInt("jmx.remote.rmi.registry.port", 10002);

Expand Down Expand Up @@ -1044,14 +1042,6 @@ public void setJmxRmiRegistryPort(int jmxRmiRegistryPort) {
this.jmxRmiRegistryPort = jmxRmiRegistryPort;
}

public String getJmxRmiServerHost() {
return jmxRmiServerHost;
}

public void setJmxRmiServerHost(String jmxRmiServerHost) {
this.jmxRmiServerHost = jmxRmiServerHost;
}

public int getJmxRmiServerPort() {
return jmxRmiServerPort;
}
Expand Down
1 change: 0 additions & 1 deletion src/java/voldemort/server/VoldemortServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ private List<VoldemortService> createServices() {
if(voldemortConfig.isJmxRemoteEnabled())
services.add(new JmxRemoteService(
voldemortConfig.getJmxRmiRegistryPort(),
voldemortConfig.getJmxRmiServerHost(),
voldemortConfig.getJmxRmiServerPort())
);

Expand Down
16 changes: 5 additions & 11 deletions src/java/voldemort/server/jmx/JmxRemoteService.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public class JmxRemoteService extends AbstractService {
private final Logger log = Logger.getLogger(JmxService.class);

private int rmiRegistryPort;
private String rmiServerHost;
private int rmiServerPort;

protected boolean rmiSSL = true;
Expand All @@ -63,12 +62,11 @@ public class JmxRemoteService extends AbstractService {
protected String accessFile = null;
protected boolean useLocalPorts = false;

protected JMXConnectorServer csPlatform = null;
protected JMXConnectorServer jmxConnector = null;

public JmxRemoteService(int rmiRegistryPort, String rmiServerHost, int rmiServerPort) {
public JmxRemoteService(int rmiRegistryPort, int rmiServerPort) {
super(ServiceType.JMX_REMOTE);
this.rmiRegistryPort = rmiRegistryPort;
this.rmiServerHost = rmiServerHost;
this.rmiServerPort = rmiServerPort;
}

Expand Down Expand Up @@ -147,9 +145,6 @@ protected void startInner() {
ssf);
}

// Explicitly specify host name to receive RMI callbacks.
env.put("java.rmi.server.useLocalHostname", "false");
env.put("java.rmi.server.hostname", rmiServerHost);

// Configure authentication
if (authenticate) {
Expand All @@ -158,7 +153,7 @@ protected void startInner() {
}

// Create the Platform server
csPlatform = createServer(rmiRegistryPort,
jmxConnector = createServer(rmiRegistryPort,
rmiServerPort, env,
ManagementFactory.getPlatformMBeanServer());

Expand All @@ -167,7 +162,7 @@ protected void startInner() {
@Override
protected void stopInner() {
// When the server starts, configure JMX/RMI
destroyServer("Platform", csPlatform);
destroyServer(jmxConnector);
}


Expand Down Expand Up @@ -211,8 +206,7 @@ private JMXConnectorServer createServer(int theRmiRegistryPort, int theRmiServer
return cs;
}

private void destroyServer(String serverName,
JMXConnectorServer theConnectorServer) {
private void destroyServer(JMXConnectorServer theConnectorServer) {
if (theConnectorServer != null) {
try {
theConnectorServer.stop();
Expand Down

0 comments on commit 963f24e

Please sign in to comment.