use of org.apache.synapse.transport.nhttp.config.ServerConnFactoryBuilder in project wso2-synapse by wso2.
the class HttpCoreNIOListener method reloadSpecificEndpoints.
/**
* Restart specific endpoints which was updated by new configurations
*
* @param transportIn TransportInDescription of new configuration
* @throws AxisFault
*/
public void reloadSpecificEndpoints(final TransportInDescription transportIn) throws AxisFault {
if (state != BaseConstants.STARTED) {
return;
}
HttpHost host = new HttpHost(listenerContext.getHostname(), listenerContext.getPort(), scheme.getName());
// Rebuild connection factory
ServerConnFactoryBuilder connFactoryBuilder = initConnFactoryBuilder(transportIn, host);
connFactory = connFactoryBuilder.build(params);
iodispatch.update(connFactory);
List<InetSocketAddress> endPointsClosed = new ArrayList<InetSocketAddress>();
// Close endpoints related to new profile's bind addresses
Set<InetSocketAddress> endPointsToReload = connFactory.getBindAddresses();
for (InetSocketAddress inetSocketAddress : endPointsToReload) {
for (ListenerEndpoint listenerEndpoint : ioReactor.getEndpoints()) {
if (inetSocketAddress.getHostName().equalsIgnoreCase(((InetSocketAddress) listenerEndpoint.getAddress()).getHostName())) {
listenerEndpoint.close();
endPointsClosed.add((InetSocketAddress) listenerEndpoint.getAddress());
}
}
}
// Start closed inpoints again with new configurations
startSpecificEndpoints(endPointsClosed);
log.info(name + " Reloaded");
}
Aggregations