@Test public void itShouldNotBeCreatedWhenThereAreNoActiveSubSenders() { RpcClientConnectionPoolStub pool = new RpcClientConnectionPoolStub(); RpcStrategy roundRobin = roundRobin(servers(ADDRESS_1, ADDRESS_2, ADDRESS_3)); assertNull(roundRobin.createSender(pool)); }
@Nullable @Override public RpcSender createSender(RpcClientConnectionPool pool) { List<RpcSender> subSenders = list.listOfSenders(pool); if (subSenders.size() < minActiveSubStrategies) return null; if (subSenders.size() == 0) return null; if (subSenders.size() == 1) return subSenders.get(0); return new Sender(subSenders); }
RpcStrategyRoundRobin implements RpcStrategy { @Nullable @Override public RpcSender createSender(RpcClientConnectionPool pool) { List<RpcSender> subSenders = list.listOfSenders(pool); if (subSenders.size() < minActiveSubStrategies) return null; if (subSenders.size() == 0) return null; if (subSenders.size() == 1) return subSenders.get(0); return new Sender(subSenders); } }
RpcStrategyRoundRobin implements RpcStrategy { @Nullable @Override public RpcSender createSender(RpcClientConnectionPool pool) { List<RpcSender> subSenders = list.listOfSenders(pool); if (subSenders.size() < minActiveSubStrategies) return null; if (subSenders.size() == 0) return null; if (subSenders.size() == 1) return subSenders.get(0); return new Sender(subSenders); } private  RpcStrategyRoundRobin(RpcStrategyList list, int minActiveSubStrategies); }
RpcStrategyRoundRobin implements RpcStrategy { @Nullable @Override public RpcSender createSender(RpcClientConnectionPool pool) { List<RpcSender> subSenders = list.listOfSenders(pool); if (subSenders.size() < minActiveSubStrategies) return null; if (subSenders.size() == 0) return null; if (subSenders.size() == 1) return subSenders.get(0); return new Sender(subSenders); } private  RpcStrategyRoundRobin(RpcStrategyList list, int minActiveSubStrategies); static RpcStrategyRoundRobin create(RpcStrategyList list); RpcStrategyRoundRobin withMinActiveSubStrategies(int minActiveSubStrategies); @Override Set<InetSocketAddress> getAddresses(); @Nullable @Override RpcSender createSender(RpcClientConnectionPool pool); }
RpcStrategyRoundRobin implements RpcStrategy { @Nullable @Override public RpcSender createSender(RpcClientConnectionPool pool) { List<RpcSender> subSenders = list.listOfSenders(pool); if (subSenders.size() < minActiveSubStrategies) return null; if (subSenders.size() == 0) return null; if (subSenders.size() == 1) return subSenders.get(0); return new Sender(subSenders); } private  RpcStrategyRoundRobin(RpcStrategyList list, int minActiveSubStrategies); static RpcStrategyRoundRobin create(RpcStrategyList list); RpcStrategyRoundRobin withMinActiveSubStrategies(int minActiveSubStrategies); @Override Set<InetSocketAddress> getAddresses(); @Nullable @Override RpcSender createSender(RpcClientConnectionPool pool);  }