@Test public void testAddFirst() throws URISyntaxException { URI newUri = new URI("tcp: FailoverUriPool pool = new FailoverUriPool(uris, null); pool.setRandomize(false); pool.addFirst(newUri); assertEquals(newUri, pool.getNext()); for (int i = 0; i < uris.size(); ++i) { assertNotEquals(newUri, pool.getNext()); } assertEquals(newUri, pool.getNext()); }
public void addFirst(URI uri) { if (uri == null) { return; } synchronized (uris) { if (!contains(uri)) { if (!nestedOptions.isEmpty()) { try { uri = URISupport.applyParameters(uri, nestedOptions); } catch (URISyntaxException e) { LOG.debug("Failed to add nested options to uri: {}", uri); } } uris.addFirst(uri); } } }
FailoverUriPool { public void addFirst(URI uri) { if (uri == null) { return; } synchronized (uris) { if (!contains(uri)) { if (!nestedOptions.isEmpty()) { try { uri = URISupport.applyParameters(uri, nestedOptions); } catch (URISyntaxException e) { LOG.debug("Failed to add nested options to uri: {}", uri); } } uris.addFirst(uri); } } } }
FailoverUriPool { public void addFirst(URI uri) { if (uri == null) { return; } synchronized (uris) { if (!contains(uri)) { if (!nestedOptions.isEmpty()) { try { uri = URISupport.applyParameters(uri, nestedOptions); } catch (URISyntaxException e) { LOG.debug("Failed to add nested options to uri: {}", uri); } } uris.addFirst(uri); } } } FailoverUriPool();  FailoverUriPool(List<URI> uris, Map<String, String> nestedOptions); }
FailoverUriPool { public void addFirst(URI uri) { if (uri == null) { return; } synchronized (uris) { if (!contains(uri)) { if (!nestedOptions.isEmpty()) { try { uri = URISupport.applyParameters(uri, nestedOptions); } catch (URISyntaxException e) { LOG.debug("Failed to add nested options to uri: {}", uri); } } uris.addFirst(uri); } } } FailoverUriPool();  FailoverUriPool(List<URI> uris, Map<String, String> nestedOptions); int size(); boolean isEmpty(); URI getNext(); void connected(); boolean isRandomize(); void setRandomize(boolean random); void add(URI uri); void addAll(List<URI> additions); void addFirst(URI uri); boolean remove(URI uri); void removeAll(); void replaceAll(List<URI> replacements); List<URI> getList(); Map<String, String> getNestedOptions(); @Override String toString(); }
FailoverUriPool { public void addFirst(URI uri) { if (uri == null) { return; } synchronized (uris) { if (!contains(uri)) { if (!nestedOptions.isEmpty()) { try { uri = URISupport.applyParameters(uri, nestedOptions); } catch (URISyntaxException e) { LOG.debug("Failed to add nested options to uri: {}", uri); } } uris.addFirst(uri); } } } FailoverUriPool();  FailoverUriPool(List<URI> uris, Map<String, String> nestedOptions); int size(); boolean isEmpty(); URI getNext(); void connected(); boolean isRandomize(); void setRandomize(boolean random); void add(URI uri); void addAll(List<URI> additions); void addFirst(URI uri); boolean remove(URI uri); void removeAll(); void replaceAll(List<URI> replacements); List<URI> getList(); Map<String, String> getNestedOptions(); @Override String toString(); static final boolean DEFAULT_RANDOMIZE_ENABLED; }