@Nullable private InetSocketAddress getAddress() { // Iterate over the masters and try to connect to each of their RPC ports. for (InetSocketAddress address : mConnectDetails.getAddresses()) { try { LOG.debug("Checking whether {} is listening for RPCs", address); pingMetaService(address); LOG.debug("Successfully connected to {}", address); return address; } catch (UnavailableException e) { LOG.debug("Failed to connect to {}", address); continue; } catch (UnauthenticatedException e) { throw new RuntimeException(e); } } return null; }
@Override public InetSocketAddress getPrimaryRpcAddress() throws UnavailableException { RetryPolicy retry = mRetryPolicySupplier.get(); while (retry.attempt()) { InetSocketAddress address = getAddress(); if (address != null) { return address; } } throw new UnavailableException(String.format( "Failed to determine primary master rpc address after polling each of %s %d times", mConnectDetails.getAddresses(), retry.getAttemptCount())); }
@Nullable private InetSocketAddress getAddress() { // Iterate over the masters and try to connect to each of their RPC ports. for (InetSocketAddress address : mConnectDetails.getAddresses()) { try { LOG.debug("Checking whether {} is listening for RPCs", address); pingMetaService(address); LOG.debug("Successfully connected to {}", address); return address; } catch (TTransportException e) { LOG.debug("Failed to connect to {}", address); continue; } catch (UnauthenticatedException e) { throw new RuntimeException(e); } } return null; }
@Override public InetSocketAddress getPrimaryRpcAddress() throws UnavailableException { RetryPolicy retry = mRetryPolicySupplier.get(); while (retry.attempt()) { InetSocketAddress address = getAddress(); if (address != null) { return address; } } throw new UnavailableException(String.format( "Failed to determine primary master rpc address after polling each of %s %d times", mConnectDetails.getAddresses(), retry.getAttemptCount())); }
@Override public List<InetSocketAddress> getMasterRpcAddresses() { return mConnectDetails.getAddresses(); }
@Override public List<InetSocketAddress> getMasterRpcAddresses() { return mConnectDetails.getAddresses(); }