use of com.sun.messaging.jmq.jmsserver.config.PropertyUpdateException in project openmq by eclipse-ee4j.
the class Globals method getPortMapper.
public static PortMapper getPortMapper() {
if (portMapper == null) {
synchronized (lock) {
if (portMapper == null) {
portMapper = new PortMapper(getConfigName());
try {
portMapper.configure(getConfig());
// Force portmapper to attempt to bind to port
portMapper.bind();
} catch (Exception e) {
portMapper = null;
Logger logger = getLogger();
if (e instanceof PropertyUpdateException) {
logger.log(Logger.ERROR, e.getMessage());
} else {
logger.logStack(Logger.ERROR, e.getMessage(), e);
}
}
}
}
}
return portMapper;
}
use of com.sun.messaging.jmq.jmsserver.config.PropertyUpdateException in project openmq by eclipse-ee4j.
the class GrizzlyIPService method updateService.
protected synchronized void updateService(int port, int min, int max, boolean store) throws IOException, PropertyUpdateException, BrokerException {
if (DEBUG) {
logger.log(logger.INFO, "GrizzlyIPService.updateService(" + port + ", " + min + ", " + max + ", " + store + ") for service " + getName());
}
String[] args = { getName(), String.valueOf(port), String.valueOf(min), String.valueOf(max) };
logger.log(Logger.INFO, BrokerResources.I_UPDATE_SERVICE_REQ, args);
try {
if (min > -1 || max > -1) {
int[] rets = protocol.setMinMaxThreads(min, max, getName());
this.setMinMaxThreadpool(protocol.getMinThreads(), protocol.getMaxThreads());
if (store) {
if (rets != null) {
if (rets[0] > -1) {
Globals.getConfig().updateProperty(IMQIPServiceFactory.SERVICE_PREFIX + name + ".min_threads", String.valueOf(2 * protocol.getMinThreads()));
}
if (rets[1] > -1) {
Globals.getConfig().updateProperty(IMQIPServiceFactory.SERVICE_PREFIX + name + ".max_threads", String.valueOf(2 * protocol.getMaxThreads()));
}
}
}
}
} catch (IllegalArgumentException e) {
String emsg = Globals.getBrokerResources().getKString(BrokerResources.X_THREADPOOL_BAD_SET, String.valueOf(min), String.valueOf(max)) + ": " + e.getMessage();
logger.logStack(logger.ERROR, emsg, e);
throw new BrokerException(emsg, e);
}
if (port > -1) {
boolean dostore = store;
Map params = new HashMap();
params.put("port", String.valueOf(port));
protocol.checkParameters(params);
Map oldparams = protocol.setParameters(params);
if (oldparams != null) {
Globals.getPortMapper().removeService(name);
try {
bindTransport(true);
} catch (Exception e) {
dostore = false;
String emsg = br.getKString(br.X_BIND_TRANSPORT_FOR_SERVICE, getName(), e.getMessage());
logger.logStack(Logger.ERROR, emsg, e);
protocol.setParameters(oldparams);
Globals.getPortMapper().removeService(name);
try {
bindTransport(true);
} catch (Exception ee) {
emsg = br.getKString(br.X_BIND_TRANSPORT_FOR_SERVICE, getName(), e.getMessage());
logger.logStack(Logger.ERROR, emsg, ee);
throw new BrokerException(emsg, ee);
}
}
}
if (dostore) {
Globals.getConfig().updateProperty(IMQIPServiceFactory.SERVICE_PREFIX + name + "." + protocol.getType() + ".port", String.valueOf(port));
}
}
}
use of com.sun.messaging.jmq.jmsserver.config.PropertyUpdateException in project openmq by eclipse-ee4j.
the class WebSocketIPService method updateService.
protected synchronized void updateService(int port, int min, int max, boolean store) throws IOException, PropertyUpdateException, BrokerException {
if (DEBUG) {
logger.log(logger.INFO, "WebSocketIPService.updateService(" + port + ", " + min + ", " + max + ", " + store + ") for service " + getName());
}
String[] args = { getName(), String.valueOf(port), String.valueOf(min), String.valueOf(max) };
logger.log(Logger.INFO, BrokerResources.I_UPDATE_SERVICE_REQ, args);
try {
if (min > -1 || max > -1) {
int[] rets = protocol.setMinMaxThreads(min, max, getName());
this.setMinMaxThreadpool(protocol.getMinThreads(), protocol.getMaxThreads());
if (store) {
if (rets != null) {
if (rets[0] > -1) {
Globals.getConfig().updateProperty(IMQIPServiceFactory.SERVICE_PREFIX + name + ".min_threads", String.valueOf(2 * protocol.getMinThreads()));
}
if (rets[1] > -1) {
Globals.getConfig().updateProperty(IMQIPServiceFactory.SERVICE_PREFIX + name + ".max_threads", String.valueOf(2 * protocol.getMaxThreads()));
}
}
}
}
} catch (IllegalArgumentException e) {
String emsg = Globals.getBrokerResources().getKString(BrokerResources.X_THREADPOOL_BAD_SET, String.valueOf(min), String.valueOf(max)) + ": " + e.getMessage();
logger.logStack(logger.ERROR, emsg, e);
throw new BrokerException(emsg, e);
}
if (port > -1) {
boolean dostore = store;
Map params = new HashMap();
params.put("port", String.valueOf(port));
protocol.checkParameters(params);
Map oldparams = protocol.setParameters(params);
if (oldparams != null) {
Globals.getPortMapper().removeService(name);
try {
bindTransport(true);
} catch (Exception e) {
dostore = false;
String emsg = br.getKString(br.X_BIND_TRANSPORT_FOR_SERVICE, getName(), e.getMessage());
logger.logStack(Logger.ERROR, emsg, e);
protocol.setParameters(oldparams);
Globals.getPortMapper().removeService(name);
try {
bindTransport(true);
} catch (Exception ee) {
emsg = br.getKString(br.X_BIND_TRANSPORT_FOR_SERVICE, getName(), e.getMessage());
logger.logStack(Logger.ERROR, emsg, ee);
throw new BrokerException(emsg, ee);
}
}
}
if (dostore) {
Globals.getConfig().updateProperty(IMQIPServiceFactory.SERVICE_PREFIX + name + "." + protocol.getType() + ".port", String.valueOf(port));
}
}
}
Aggregations