*/
protected void doPublish(String addr) {
checkPublishPermission();
checkPublishable();
ServerImpl serv = null;
ClassLoaderHolder loader = null;
try {
if (bus != null) {
ClassLoader newLoader = bus.getExtension(ClassLoader.class);
if (newLoader != null) {
loader = ClassLoaderUtils.setThreadContextClassloader(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) {