Package io.airlift.discovery.client

Examples of io.airlift.discovery.client.DiscoveryException


    @Override
    public HiveMetastoreClient createMetastoreClient()
    {
        List<ServiceDescriptor> descriptors = Lists.newArrayList(Iterables.filter(selector.selectAllServices(), runningPredicate()));
        if (descriptors.isEmpty()) {
            throw new DiscoveryException("No metastore servers available for pool: " + selector.getPool());
        }

        Collections.shuffle(descriptors);
        TTransportException lastException = null;
        for (ServiceDescriptor descriptor : descriptors) {
            String thrift = descriptor.getProperties().get("thrift");
            if (thrift != null) {
                try {
                    HostAndPort metastore = HostAndPort.fromString(thrift);
                    checkArgument(metastore.hasPort());
                    return clientFactory.create(metastore.getHostText(), metastore.getPort());
                }
                catch (IllegalArgumentException ignored) {
                    // Ignore entries with parse issues
                }
                catch (TTransportException e) {
                    lastException = e;
                }
            }
        }

        throw new DiscoveryException("Unable to connect to any metastore servers in pool: " + selector.getPool(), lastException);
    }
View Full Code Here

TOP

Related Classes of io.airlift.discovery.client.DiscoveryException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.