@Test(groups = "conn") public void noActiveUrls() throws Exception { final RoundRobinConnectionStrategy strategy = new RoundRobinConnectionStrategy(); strategy.initialize( "ldap: ldapURL -> true); strategy.failure(strategy.ldapURLSet.getActiveUrls().iterator().next()); strategy.failure(strategy.ldapURLSet.getActiveUrls().iterator().next()); strategy.failure(strategy.ldapURLSet.getActiveUrls().iterator().next()); strategy.iterator(); strategy.iterator(); strategy.iterator(); strategy.iterator(); }
@Override public synchronized Iterator<LdapURL> iterator() { if (!isInitialized()) { throw new IllegalStateException("Strategy is not initialized"); } final List<LdapURL> urls = new ArrayList<>(ldapURLSet.getActiveUrls()); if (urls.size() > 1) { for (int i = 0; i < counter.get(); i++) { urls.add(urls.remove(0)); } } urls.addAll(ldapURLSet.getInactiveUrls()); counter.incrementAndGet(); if (iterFunction != null) { return iterFunction.apply(ldapURLSet.getUrls()); } return new DefaultLdapURLIterator(urls); }
RoundRobinConnectionStrategy extends AbstractConnectionStrategy { @Override public synchronized Iterator<LdapURL> iterator() { if (!isInitialized()) { throw new IllegalStateException("Strategy is not initialized"); } final List<LdapURL> urls = new ArrayList<>(ldapURLSet.getActiveUrls()); if (urls.size() > 1) { for (int i = 0; i < counter.get(); i++) { urls.add(urls.remove(0)); } } urls.addAll(ldapURLSet.getInactiveUrls()); counter.incrementAndGet(); if (iterFunction != null) { return iterFunction.apply(ldapURLSet.getUrls()); } return new DefaultLdapURLIterator(urls); } }
RoundRobinConnectionStrategy extends AbstractConnectionStrategy { @Override public synchronized Iterator<LdapURL> iterator() { if (!isInitialized()) { throw new IllegalStateException("Strategy is not initialized"); } final List<LdapURL> urls = new ArrayList<>(ldapURLSet.getActiveUrls()); if (urls.size() > 1) { for (int i = 0; i < counter.get(); i++) { urls.add(urls.remove(0)); } } urls.addAll(ldapURLSet.getInactiveUrls()); counter.incrementAndGet(); if (iterFunction != null) { return iterFunction.apply(ldapURLSet.getUrls()); } return new DefaultLdapURLIterator(urls); } RoundRobinConnectionStrategy();  RoundRobinConnectionStrategy(final Function<List<LdapURL>, Iterator<LdapURL>> function); }
RoundRobinConnectionStrategy extends AbstractConnectionStrategy { @Override public synchronized Iterator<LdapURL> iterator() { if (!isInitialized()) { throw new IllegalStateException("Strategy is not initialized"); } final List<LdapURL> urls = new ArrayList<>(ldapURLSet.getActiveUrls()); if (urls.size() > 1) { for (int i = 0; i < counter.get(); i++) { urls.add(urls.remove(0)); } } urls.addAll(ldapURLSet.getInactiveUrls()); counter.incrementAndGet(); if (iterFunction != null) { return iterFunction.apply(ldapURLSet.getUrls()); } return new DefaultLdapURLIterator(urls); } RoundRobinConnectionStrategy();  RoundRobinConnectionStrategy(final Function<List<LdapURL>, Iterator<LdapURL>> function); @Override synchronized Iterator<LdapURL> iterator(); }
RoundRobinConnectionStrategy extends AbstractConnectionStrategy { @Override public synchronized Iterator<LdapURL> iterator() { if (!isInitialized()) { throw new IllegalStateException("Strategy is not initialized"); } final List<LdapURL> urls = new ArrayList<>(ldapURLSet.getActiveUrls()); if (urls.size() > 1) { for (int i = 0; i < counter.get(); i++) { urls.add(urls.remove(0)); } } urls.addAll(ldapURLSet.getInactiveUrls()); counter.incrementAndGet(); if (iterFunction != null) { return iterFunction.apply(ldapURLSet.getUrls()); } return new DefaultLdapURLIterator(urls); } RoundRobinConnectionStrategy();  RoundRobinConnectionStrategy(final Function<List<LdapURL>, Iterator<LdapURL>> function); @Override synchronized Iterator<LdapURL> iterator();  }