use of org.glassfish.grizzly.config.dom.NetworkListeners in project Payara by payara.
the class WebContainerImpl method removeListener.
private void removeListener(String name) {
try {
NetworkListeners networkListeners = networkConfig.getNetworkListeners();
final NetworkListener listenerToBeRemoved = networkConfig.getNetworkListener(name);
final Protocols protocols = networkConfig.getProtocols();
final Protocol protocol = networkConfig.findProtocol(name);
if (listenerToBeRemoved == null) {
log.severe("Network Listener " + name + " doesn't exist");
} else {
final com.sun.enterprise.config.serverbeans.VirtualServer virtualServer = httpService.getVirtualServerByName(listenerToBeRemoved.findHttpProtocol().getHttp().getDefaultVirtualServer());
ConfigSupport.apply(new ConfigCode() {
public Object run(ConfigBeanProxy... params) throws PropertyVetoException {
final NetworkListeners listeners = (NetworkListeners) params[0];
final com.sun.enterprise.config.serverbeans.VirtualServer server = (com.sun.enterprise.config.serverbeans.VirtualServer) params[1];
listeners.getNetworkListener().remove(listenerToBeRemoved);
server.removeNetworkListener(listenerToBeRemoved.getName());
return listenerToBeRemoved;
}
}, networkListeners, virtualServer);
ConfigSupport.apply(new ConfigCode() {
public Object run(ConfigBeanProxy... params) throws PropertyVetoException {
final Protocols protocols = (Protocols) params[0];
final Protocol protocol = (Protocol) params[1];
protocols.getProtocol().remove(protocol);
return protocol;
}
}, protocols, protocol);
}
} catch (TransactionFailure e) {
log.severe("Remove listener " + name + " failed " + e.getMessage());
}
}
Aggregations