use of org.jboss.as.network.SocketBinding in project wildfly by wildfly.
the class ModClusterConfigurationServiceBuilder method getValue.
@Override
public ModClusterConfiguration getValue() throws IllegalStateException, IllegalArgumentException {
// Advertise
if (advertiseSocketDependency != null) {
final SocketBinding binding = advertiseSocketDependency.getValue();
builder.advertise().setAdvertiseSocketAddress(binding.getMulticastSocketAddress()).setAdvertiseInterface(binding.getSocketAddress().getAddress());
if (!isMulticastEnabled(binding.getSocketBindings().getDefaultInterfaceBinding().getNetworkInterfaces())) {
ROOT_LOGGER.multicastInterfaceNotAvailable();
}
}
// Proxies
List<ProxyConfiguration> proxies = new LinkedList<>();
for (final ValueDependency<OutboundSocketBinding> outboundSocketBindingValueDependency : outboundSocketBindings) {
OutboundSocketBinding binding = outboundSocketBindingValueDependency.getValue();
proxies.add(new ProxyConfiguration() {
@Override
public InetSocketAddress getRemoteAddress() {
// Don't do resolving here, let mod_cluster deal with it
return new InetSocketAddress(binding.getUnresolvedDestinationAddress(), binding.getDestinationPort());
}
@Override
public InetSocketAddress getLocalAddress() {
if (binding.getOptionalSourceAddress() != null) {
return new InetSocketAddress(binding.getOptionalSourceAddress(), binding.getAbsoluteSourcePort() == null ? 0 : binding.getAbsoluteSourcePort());
} else if (binding.getAbsoluteSourcePort() != null) {
// Bind to port only if source address is not configured
return new InetSocketAddress(binding.getAbsoluteSourcePort());
}
// No binding configured so don't bind
return null;
}
});
}
builder.mcmp().setProxyConfigurations(proxies);
// SSL
if (sslContextDependency != null) {
builder.mcmp().setSocketFactory(sslContextDependency.getValue().getSocketFactory());
}
return builder.build();
}
use of org.jboss.as.network.SocketBinding in project wildfly by wildfly.
the class TransportConfigurationBuilder method accept.
@Override
public void accept(T protocol) {
InetSocketAddress socketAddress = this.getSocketBinding().getSocketAddress();
protocol.setBindAddress(socketAddress.getAddress());
protocol.setBindPort(socketAddress.getPort());
protocol.setThreadFactory(new ClassLoaderThreadFactory(new DefaultThreadFactory("", false), JChannelFactory.class.getClassLoader()));
protocol.setDefaultThreadPool(this.threadPoolFactories.get(ThreadPoolResourceDefinition.DEFAULT).getValue().get());
protocol.setInternalThreadPool(this.threadPoolFactories.get(ThreadPoolResourceDefinition.INTERNAL).getValue().get());
protocol.setOOBThreadPool(this.threadPoolFactories.get(ThreadPoolResourceDefinition.OOB).getValue().get());
protocol.setTimer(this.timerFactory.getValue().get());
Optional<InetSocketAddress> diagnosticsSocketAddress = Optional.ofNullable(this.diagnosticsSocketBinding).map(Value::getValue).map(SocketBinding::getSocketAddress);
protocol.setValue("enable_diagnostics", diagnosticsSocketAddress.isPresent());
diagnosticsSocketAddress.ifPresent(address -> {
protocol.setValue("diagnostics_addr", address.getAddress());
protocol.setValue("diagnostics_port", address.getPort());
});
}
use of org.jboss.as.network.SocketBinding in project wildfly by wildfly.
the class CoreEnvironmentService method start.
@Override
public void start(StartContext context) throws StartException {
// Global configuration.
final CoreEnvironmentBean coreEnvironmentBean = arjPropertyManager.getCoreEnvironmentBean();
if (coreEnvironmentBean.getProcessImplementationClassName() == null) {
UuidProcessId id = new UuidProcessId();
coreEnvironmentBean.setProcessImplementation(id);
}
try {
coreEnvironmentBean.setNodeIdentifier(nodeIdentifier);
} catch (CoreEnvironmentBeanException e) {
throw new StartException(e.getCause());
}
// Setup the socket process id if there is a binding
SocketBinding binding = socketProcessBindingInjector.getOptionalValue();
if (binding != null) {
int port = binding.getPort();
coreEnvironmentBean.setSocketProcessIdPort(port);
}
}
Aggregations