Search in sources :

Example 6 with BindTransportException

use of org.elasticsearch.transport.BindTransportException in project crate by crate.

the class Netty4HttpServerTransport method createBoundHttpAddress.

private BoundTransportAddress createBoundHttpAddress() {
    // Bind and start to accept incoming connections.
    InetAddress[] hostAddresses;
    try {
        hostAddresses = networkService.resolveBindHostAddresses(bindHosts);
    } catch (IOException e) {
        throw new BindHttpException("Failed to resolve host [" + Arrays.toString(bindHosts) + "]", e);
    }
    List<TransportAddress> boundAddresses = new ArrayList<>(hostAddresses.length);
    for (InetAddress address : hostAddresses) {
        boundAddresses.add(bindAddress(address));
    }
    final InetAddress publishInetAddress;
    try {
        publishInetAddress = networkService.resolvePublishHostAddresses(publishHosts);
    } catch (Exception e) {
        throw new BindTransportException("Failed to resolve publish address", e);
    }
    final int publishPort = resolvePublishPort(settings, boundAddresses, publishInetAddress);
    final InetSocketAddress publishAddress = new InetSocketAddress(publishInetAddress, publishPort);
    return new BoundTransportAddress(boundAddresses.toArray(new TransportAddress[0]), new TransportAddress(publishAddress));
}
Also used : BoundTransportAddress(org.elasticsearch.common.transport.BoundTransportAddress) TransportAddress(org.elasticsearch.common.transport.TransportAddress) InetSocketAddress(java.net.InetSocketAddress) ArrayList(java.util.ArrayList) BoundTransportAddress(org.elasticsearch.common.transport.BoundTransportAddress) BindTransportException(org.elasticsearch.transport.BindTransportException) IOException(java.io.IOException) BindHttpException(org.elasticsearch.http.BindHttpException) InetAddress(java.net.InetAddress) BindHttpException(org.elasticsearch.http.BindHttpException) SettingsException(org.elasticsearch.common.settings.SettingsException) IOException(java.io.IOException) PatternSyntaxException(java.util.regex.PatternSyntaxException) BindTransportException(org.elasticsearch.transport.BindTransportException)

Aggregations

BindTransportException (org.elasticsearch.transport.BindTransportException)6 BoundTransportAddress (org.elasticsearch.common.transport.BoundTransportAddress)4 TransportAddress (org.elasticsearch.common.transport.TransportAddress)4 BindHttpException (org.elasticsearch.http.BindHttpException)4 IOException (java.io.IOException)3 InetAddress (java.net.InetAddress)3 InetSocketAddress (java.net.InetSocketAddress)3 ArrayList (java.util.ArrayList)2 Settings (org.elasticsearch.common.settings.Settings)2 SQLOperations (io.crate.action.sql.SQLOperations)1 AlwaysOKAuthentication (io.crate.auth.AlwaysOKAuthentication)1 NettyBootstrap (io.crate.netty.NettyBootstrap)1 PostgresNetty.resolvePublishPort (io.crate.protocols.postgres.PostgresNetty.resolvePublishPort)1 SslContextProvider (io.crate.protocols.ssl.SslContextProvider)1 StubUserManager (io.crate.user.StubUserManager)1 User (io.crate.user.User)1 ReadTimeoutException (io.netty.handler.timeout.ReadTimeoutException)1 Inet4Address (java.net.Inet4Address)1 Inet6Address (java.net.Inet6Address)1 InetAddress.getByName (java.net.InetAddress.getByName)1