use of com.sun.enterprise.admin.remote.ServerRemoteRestAdminCommand in project Payara by payara.
the class StopInstanceCommand method callInstance.
/**
* return null if all went OK...
*/
private String callInstance() {
String msg = initializeInstance();
if (msg != null)
return msg;
String host = instance.getAdminHost();
if (host == null)
return Strings.get("stop.instance.noHost", instanceName);
int port = helper.getAdminPort(instance);
if (port < 0)
return Strings.get("stop.instance.noPort", instanceName);
if (!instance.isRunning())
return null;
try {
logger.info(Strings.get("stop.instance.init", instanceName));
RemoteRestAdminCommand rac = new ServerRemoteRestAdminCommand(habitat, "_stop-instance", host, port, false, "admin", null, logger);
// notice how we do NOT send in the instance's name as an operand!!
ParameterMap map = new ParameterMap();
map.add("force", Boolean.toString(force));
rac.executeCommand(map);
} catch (Exception e) {
// The instance server may have died so fast we didn't have time to
// get the (always successful!!) return data. This is NOT AN ERROR!
// see: http://java.net/jira/browse/GLASSFISH-19672
// also see StopDomainCommand which does the same thing.
}
return null;
}
Aggregations