@Test(timeout = 10000) public void pollRejectingDoesntHang() throws Exception { int port = mPort.getPort(); InetSocketAddress serverAddress = new InetSocketAddress("127.0.0.1", port); RejectingServer s = new RejectingServer(serverAddress); s.start(); List<InetSocketAddress> addrs = Arrays.asList(InetSocketAddress .createUnresolved(NetworkAddressUtils.getLocalHostName(Constants.SECOND_MS), port)); PollingMasterInquireClient client = new PollingMasterInquireClient(addrs, () -> new CountingRetry(0), new ConfigurationBuilder().build()); try { client.getPrimaryRpcAddress(); fail("Expected polling to fail"); } catch (UnavailableException e) { } }
@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())); }
PollingMasterInquireClient implements MasterInquireClient { @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())); } }
PollingMasterInquireClient implements MasterInquireClient { @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())); } PollingMasterInquireClient(List<InetSocketAddress> masterAddresses,
      AlluxioConfiguration alluxioConf,
      UserState userState);  PollingMasterInquireClient(List<InetSocketAddress> masterAddresses,
      Supplier<RetryPolicy> retryPolicySupplier,
      AlluxioConfiguration alluxioConf);  PollingMasterInquireClient(List<InetSocketAddress> masterAddresses,
      Supplier<RetryPolicy> retryPolicySupplier,
      AlluxioConfiguration alluxioConf,
      UserState userState); }
PollingMasterInquireClient implements MasterInquireClient { @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())); } PollingMasterInquireClient(List<InetSocketAddress> masterAddresses,
      AlluxioConfiguration alluxioConf,
      UserState userState);  PollingMasterInquireClient(List<InetSocketAddress> masterAddresses,
      Supplier<RetryPolicy> retryPolicySupplier,
      AlluxioConfiguration alluxioConf);  PollingMasterInquireClient(List<InetSocketAddress> masterAddresses,
      Supplier<RetryPolicy> retryPolicySupplier,
      AlluxioConfiguration alluxioConf,
      UserState userState); @Override InetSocketAddress getPrimaryRpcAddress(); @Override List<InetSocketAddress> getMasterRpcAddresses(); @Override ConnectDetails getConnectDetails(); }
PollingMasterInquireClient implements MasterInquireClient { @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())); } PollingMasterInquireClient(List<InetSocketAddress> masterAddresses,
      AlluxioConfiguration alluxioConf,
      UserState userState);  PollingMasterInquireClient(List<InetSocketAddress> masterAddresses,
      Supplier<RetryPolicy> retryPolicySupplier,
      AlluxioConfiguration alluxioConf);  PollingMasterInquireClient(List<InetSocketAddress> masterAddresses,
      Supplier<RetryPolicy> retryPolicySupplier,
      AlluxioConfiguration alluxioConf,
      UserState userState); @Override InetSocketAddress getPrimaryRpcAddress(); @Override List<InetSocketAddress> getMasterRpcAddresses(); @Override ConnectDetails getConnectDetails();  }