use of org.glassfish.grizzly.config.dom.NetworkListener in project Payara by payara.
the class CommandThreadPool method postConstruct.
/**
* Process the instance file if this is DAS and there are instances configured already in this domain
*/
@Override
public void postConstruct() {
// If this is not the DAS, no need for this pool
if (serverEnv.isInstance()) {
return;
}
int poolSize = 5;
Config svrConfig = domain.getConfigNamed("server-config");
// during build; got to check the reason why later.
if (svrConfig != null) {
NetworkConfig nwc = svrConfig.getNetworkConfig();
if (nwc != null) {
List<NetworkListener> lss = nwc.getNetworkListeners().getNetworkListener();
if ((lss != null) && (!lss.isEmpty())) {
for (NetworkListener ls : lss) {
if (ServerTags.ADMIN_LISTENER_ID.equals(ls.getName())) {
if (ls.findThreadPool() != null) {
poolSize = Integer.parseInt(ls.findThreadPool().getMaxThreadPoolSize());
}
}
}
}
}
}
svc = Executors.newFixedThreadPool(poolSize, new InstanceStateThreadFactory());
}
use of org.glassfish.grizzly.config.dom.NetworkListener in project Payara by payara.
the class FindHttpProtocolResource method get.
@GET
@Produces({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.APPLICATION_FORM_URLENCODED })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.APPLICATION_FORM_URLENCODED })
public ActionReportResult get() {
Dom dom = getEntity();
NetworkListener nl = dom.createProxy(NetworkListener.class);
Protocol p = nl.findHttpProtocol();
RestActionReporter ar = new RestActionReporter();
ar.setActionExitCode(ActionReport.ExitCode.SUCCESS);
ar.getTopMessagePart().getProps().put("protocol", p.getName());
ActionReportResult result = new ActionReportResult("find-http-protocol", ar, new OptionsResult());
return result;
}
use of org.glassfish.grizzly.config.dom.NetworkListener in project Payara by payara.
the class RuntimeRootImpl method getAdminListener.
private NetworkListener getAdminListener() {
final NetworkConfig network = networkConfig();
final NetworkListener listener = network.getNetworkListener(ADMIN_LISTENER_NAME);
return listener;
}
use of org.glassfish.grizzly.config.dom.NetworkListener in project Payara by payara.
the class GrizzlyService method getAddressInfoFromVirtualServers.
// get the ports from the http listeners that are associated with
// the virtual servers
private List<AddressInfo> getAddressInfoFromVirtualServers(Collection<String> virtualServers) {
List<AddressInfo> addressInfos = new ArrayList<AddressInfo>();
List<NetworkListener> networkListenerList = config.getNetworkConfig().getNetworkListeners().getNetworkListener();
for (String vs : virtualServers) {
VirtualServer virtualServer = config.getHttpService().getVirtualServerByName(vs);
if (virtualServer == null) {
// non-existent virtual server
LOGGER.log(Level.WARNING, KernelLoggerInfo.grizzlyNonExistentVS, vs);
continue;
}
String vsNetworkListeners = virtualServer.getNetworkListeners();
List<String> vsNetworkListenerList = StringUtils.parseStringList(vsNetworkListeners, ",");
if (vsNetworkListenerList != null && !vsNetworkListenerList.isEmpty()) {
for (String vsNetworkListener : vsNetworkListenerList) {
for (NetworkListener networkListener : networkListenerList) {
if (networkListener.getName().equals(vsNetworkListener) && Boolean.valueOf(networkListener.getEnabled())) {
addressInfos.add(new AddressInfo(networkListener.getAddress(), networkListener.getPort()));
break;
}
}
}
}
}
return addressInfos;
}
use of org.glassfish.grizzly.config.dom.NetworkListener in project Payara by payara.
the class PortsImpl method createPort.
private Port createPort(Integer portNumber) throws IOException {
for (NetworkListener nl : network.getNetworkListeners().getNetworkListener()) {
if (nl.getPort().equals(portNumber.toString())) {
throw new IOException("Port " + portNumber + " is already configured");
}
}
for (Integer pn : ports.keySet()) {
if (pn.equals(portNumber)) {
throw new IOException("Port " + portNumber + " is alredy open");
}
}
PortImpl port = habitat.getService(PortImpl.class);
port.setPortNumber(portNumber);
ports.put(portNumber, port);
return port;
}
Aggregations