use of org.glassfish.grizzly.config.dom.Protocol in project Payara by payara.
the class GrizzlyService method createNetworkProxy.
/*
* Creates a new NetworkProxy for a particular HttpListner
* @param listener NetworkListener
* @param networkConfig HttpService
*/
public synchronized Future<Result<Thread>> createNetworkProxy(NetworkListener listener) {
if (!Boolean.valueOf(listener.getEnabled())) {
// in case the listener will be enabled
addChangeListener(listener);
LOGGER.log(Level.INFO, KernelLoggerInfo.grizzlyPortDisabled, new Object[] { listener.getName(), listener.getPort() });
return null;
}
// create the proxy for the port.
GrizzlyProxy proxy = new GrizzlyProxy(this, listener);
Future<Result<Thread>> future = null;
try {
proxy.initialize();
if (!isLightWeightListener(listener)) {
final NetworkConfig networkConfig = listener.getParent(NetworkListeners.class).getParent(NetworkConfig.class);
// attach all virtual servers to this port
for (VirtualServer vs : networkConfig.getParent(Config.class).getHttpService().getVirtualServer()) {
List<String> vsListeners = StringUtils.parseStringList(vs.getNetworkListeners(), " ,");
if (vsListeners == null || vsListeners.isEmpty() || vsListeners.contains(listener.getName())) {
if (!hosts.contains(vs.getId())) {
hosts.add(vs.getId());
}
}
}
addChangeListener(listener);
addChangeListener(listener.findThreadPool());
addChangeListener(listener.findTransport());
final Protocol protocol = listener.findHttpProtocol();
if (protocol != null) {
addChangeListener(protocol);
addChangeListener(protocol.getHttp());
addChangeListener(protocol.getHttp().getFileCache());
addChangeListener(protocol.getSsl());
}
}
future = proxy.start();
// add the new proxy to our list of proxies.
proxies.add(proxy);
} catch (Throwable e) {
final Future<Result<Thread>> errorFuture = Futures.createReadyFuture(new Result<Thread>(e));
future = errorFuture;
} finally {
if (future == null) {
final FutureImpl<Result<Thread>> errorFuture = Futures.<Result<Thread>>createUnsafeFuture();
errorFuture.result(new Result<Thread>(new IllegalStateException("Unexpected error")));
future = errorFuture;
}
futures.add(future);
}
return future;
}
use of org.glassfish.grizzly.config.dom.Protocol in project Payara by payara.
the class SSLConfigurator method logEmptyWarning.
protected void logEmptyWarning(Ssl ssl, final String msg) {
final StringBuilder name = new StringBuilder();
for (NetworkListener listener : ((Protocol) ssl.getParent()).findNetworkListeners()) {
if (name.length() != 0) {
name.append(", ");
}
name.append(listener.getName());
}
LOGGER.log(Level.FINE, msg, name.toString());
}
Aggregations