Here's the client code
To connect, I'm using this method.
Code:
public boolean connect(){
//MBeanExporter mbe = new MBeanExporter();
try {
MseJmxClient listener = new MseJmxClient();
String address = "service:jmx:rmi:///jndi/rmi://" + host + ":" + port + "/" + name;
JMXServiceURL serviceURL = new JMXServiceURL(address);
Map environment = null;
JMXConnector connector = JMXConnectorFactory.connect(serviceURL, environment);
mBeanConnection = connector.getMBeanServerConnection();
incomingMseAdaptorEngineName = ObjectName.getInstance("MSE:type=mseIncomingMDBEngineMonitored");
outgoingMseAdaptorEngineName = ObjectName.getInstance("MSE:type=mseOutgoingMDBEngineMonitored");
smscMseAdaptorEngineName = ObjectName.getInstance("MSE:type=mseSmscAdaptorEngineMonitored");
incomingSmscEngineName= ObjectName.getInstance("MSE:type=mseSmscEngineMonitored");
outgoingSmscEngineName = ObjectName.getInstance("MSE:type=mseNotificationMDBEngineMonitored");
mBeanConnection.addNotificationListener(incomingMseAdaptorEngineName, listener, null, null);
mBeanConnection.addNotificationListener(outgoingMseAdaptorEngineName, listener, null, null);
mBeanConnection.addNotificationListener(smscMseAdaptorEngineName, listener, null, null);
mBeanConnection.addNotificationListener(incomingSmscEngineName, listener, null, null);
mBeanConnection.addNotificationListener(outgoingSmscEngineName, listener, null, null);
connected = true;
} catch (Exception e){
e.printStackTrace();
this.close();
connected = false;
return false;
}
return true;
}
Invoking below's method is basically ok.
Code:
public String updateIncomingMseLogins() throws Exception {
if (connected)
return (String) mBeanConnection.invoke(incomingMseAdaptorEngineName, "updateReactors", null, null);
else
return null;
}
But invoking this next method, I'm getting the exception.
Code:
public String restartIncomingMseLogins(int port) throws Exception {
if (connected)
return (String) mBeanConnection.invoke(incomingMseAdaptorEngineName, "restartReactor", new Object[]{port}, null);
else
return null;
}
Here's the updateReactors method under my code
Code:
@ManagedOperation(description="Update Reactors")
public String updateReactors(){
String reactorStatus = "";
if (log.isDebugEnabled()){
log.debug("[updateReactors]: START");
reactorStatus = reactorStatus.concat("begin\n");
}
....
and the restartReactor method
Code:
@ManagedOperation(description="Restart Reactor")
@ManagedOperationParameters({
@ManagedOperationParameter(name = "port", description = "mse port")})
public String restartReactor(int port){
String ret="";
try {
log.info("Restarting reactor with port :" + port + "....");
MseReactor reactor = getReactor(port);
if (null==reactor) {
log.info("no reset done. port not defined in any reactor.");
ret = "Port not defined in any reactor";
return ret;
}
....