test_class.declarator: executor
test_class.modifier: private
test_class.original_string: private ListeningExecutorService executor;
test_class.type: ListeningExecutorService
test_class.var_name: executor
test_class.declarator: reachableAddressFinder
test_class.modifier: private
test_class.original_string: private ConcurrentReachableAddressFinder reachableAddressFinder;
test_class.type: ConcurrentReachableAddressFinder
test_class.var_name: reachableAddressFinder
test_class.file: common/src/test/java/brooklyn/networking/util/ConcurrentReachableAddressFinderTest.java
test_class.identifier: ConcurrentReachableAddressFinderTest
test_case.body: @Test
      public void testFindsReachableKeepsAddressInOriginalFormat() throws Exception {
          String result = reachableAddressFinder.findReachable(ImmutableList.of("localhost"), Duration.TEN_SECONDS);
          assertEquals(result, "localhost");
      }
test_case.class_method_signature: ConcurrentReachableAddressFinderTest.testFindsReachableKeepsAddressInOriginalFormat()
test_case.full_signature: @Test public void testFindsReachableKeepsAddressInOriginalFormat()
test_case.identifier: testFindsReachableKeepsAddressInOriginalFormat
test_case.invocations: findReachable of assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testFindsReachableKeepsAddressInOriginalFormat()
focal_class.declarator: LOG = LoggerFactory.getLogger(ConcurrentReachableAddressFinder.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(ConcurrentReachableAddressFinder.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: pingTester
focal_class.modifier: private final
focal_class.original_string: private final Reachable pingTester;
focal_class.type: Reachable
focal_class.var_name: pingTester
focal_class.declarator: userExecutor
focal_class.modifier: private final
focal_class.original_string: private final ListeningExecutorService userExecutor;
focal_class.type: ListeningExecutorService
focal_class.var_name: userExecutor
focal_class.file: common/src/main/java/brooklyn/networking/util/ConcurrentReachableAddressFinder.java
focal_class.identifier: ConcurrentReachableAddressFinder
focal_class.class_method_signature: ConcurrentReachableAddressFinder.ConcurrentReachableAddressFinder(ListeningExecutorService userExecutor)
focal_class.full_signature: public  ConcurrentReachableAddressFinder(ListeningExecutorService userExecutor)
focal_class.identifier: ConcurrentReachableAddressFinder
focal_class.modifiers: public
focal_class.parameters: (ListeningExecutorService userExecutor)
focal_class.signature:  ConcurrentReachableAddressFinder(ListeningExecutorService userExecutor)
focal_class.class_method_signature: ConcurrentReachableAddressFinder.ConcurrentReachableAddressFinder(Reachable pingTester, ListeningExecutorService userExecutor)
focal_class.full_signature: public  ConcurrentReachableAddressFinder(Reachable pingTester, ListeningExecutorService userExecutor)
focal_class.identifier: ConcurrentReachableAddressFinder
focal_class.modifiers: public
focal_class.parameters: (Reachable pingTester, ListeningExecutorService userExecutor)
focal_class.signature:  ConcurrentReachableAddressFinder(Reachable pingTester, ListeningExecutorService userExecutor)
focal_class.class_method_signature: ConcurrentReachableAddressFinder.findReachable(Iterable<String> addresses, Duration timeout)
focal_class.full_signature: public String findReachable(Iterable<String> addresses, Duration timeout)
focal_class.identifier: findReachable
focal_class.modifiers: public
focal_class.parameters: (Iterable<String> addresses, Duration timeout)
focal_class.return: String
focal_class.signature: String findReachable(Iterable<String> addresses, Duration timeout)
focal_class.class_method_signature: ConcurrentReachableAddressFinder.updateRefOnAddressReachable(final AtomicReference<String> reachableAddress, final Duration timeout)
focal_class.full_signature: private Predicate<Iterable<String>> updateRefOnAddressReachable(final AtomicReference<String> reachableAddress, final Duration timeout)
focal_class.identifier: updateRefOnAddressReachable
focal_class.modifiers: private
focal_class.parameters: (final AtomicReference<String> reachableAddress, final Duration timeout)
focal_class.return: Predicate<Iterable<String>>
focal_class.signature: Predicate<Iterable<String>> updateRefOnAddressReachable(final AtomicReference<String> reachableAddress, final Duration timeout)
focal_method.body: public String findReachable(Iterable<String> addresses, Duration timeout) {
          AtomicReference<String> result = newReference(); // For retrieving the reachable address (if any)
          Duration timeoutPerAttempt = Duration.min(Duration.of(2, TimeUnit.SECONDS), timeout);
  
          // TODO Could exit early on other conditions (e.g. node no longer running), as jclouds does
          Predicate<Iterable<String>> findOrBreak = updateRefOnAddressReachable(result, timeoutPerAttempt);
  
          LOG.debug("blocking on reachability of addresses {} for max {}", addresses, timeout);
          boolean passed = Repeater
                  .create()
                  .until(addresses, findOrBreak)
                  .backoffTo(Duration.ONE_SECOND)
                  .limitTimeTo(timeout)
                  .run();
  
          if (passed) {
              LOG.debug("address {} reachable", result);
              assert result.get() != null;
              return result.get();
          } else {
              throw new NoSuchElementException("Could not connect to any address in "+addresses+" within "+timeout);
          }
      }
focal_method.class_method_signature: ConcurrentReachableAddressFinder.findReachable(Iterable<String> addresses, Duration timeout)
focal_method.full_signature: public String findReachable(Iterable<String> addresses, Duration timeout)
focal_method.identifier: findReachable
focal_method.invocations: newReference min of updateRefOnAddressReachable debug run limitTimeTo backoffTo until create debug get get
focal_method.modifiers: public
focal_method.parameters: (Iterable<String> addresses, Duration timeout)
focal_method.return: String
focal_method.signature: String findReachable(Iterable<String> addresses, Duration timeout)