*/
protected void doPublish(String addr) {
checkPublishPermission();
checkPublishable();
ServerImpl serv = null;
ClassLoader loader = Thread.currentThread().getContextClassLoader();
try {
if (bus != null) {
ClassLoader newLoader = bus.getExtension(ClassLoader.class);
if (newLoader != null) {
Thread.currentThread().setContextClassLoader(newLoader);
}
}
serv = getServer(addr);
if (addr != null) {
EndpointInfo endpointInfo = serv.getEndpoint().getEndpointInfo();
if (!endpointInfo.getAddress().contains(addr)) {
endpointInfo.setAddress(addr);
}
if (publishedEndpointUrl != null) {
// TODO is there a good place to put this key-string as a constant?
endpointInfo.setProperty("publishedEndpointUrl", publishedEndpointUrl);
}
if (null != properties) {
for (Entry<String, Object> entry : properties.entrySet()) {
endpointInfo.setProperty(entry.getKey(), entry.getValue());
}
}
this.address = endpointInfo.getAddress();
}
serv.start();
publishable = false;
} catch (Exception ex) {
try {
stop();
} catch (Exception e) {