Skip to content

Instantly share code, notes, and snippets.

@rajdavies
Last active August 29, 2015 14:07
Show Gist options
  • Save rajdavies/254b30930193f9f6f3ff to your computer and use it in GitHub Desktop.
Save rajdavies/254b30930193f9f6f3ff to your computer and use it in GitHub Desktop.
static{
String host = null;
String port = null;
try {
host = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
String result = System.getProperty("org.apache.activemq.AMQ_HOST");
result = (result==null||result.isEmpty()) ? System.getProperty("AMQ_HOST","localhost") : result;
return result;
}
});
port = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
String result = System.getProperty("org.apache.activemq.AMQ_PORT");
result = (result==null||result.isEmpty()) ? System.getProperty("AMQ_PORT","61616") : result;
return result;
}
});
}catch(Throwable e){
LOG.debug("Failed to look up System properties for host and port",e);
}
host = (host == null || host.isEmpty()) ? "localhost" : host;
port = (port == null || port.isEmpty()) ? "61616" : port;
DEFAULT_BROKER_HOST = host;
DEFAULT_BROKER_PORT = Integer.parseInt(port);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment