use of org.jboss.modcluster.config.ProxyConfiguration 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();
}
Aggregations