@Test public void clear() { Subchannel subchannel1 = pool.takeOrCreateSubchannel(EAG1, ATTRS1); Subchannel subchannel2 = pool.takeOrCreateSubchannel(EAG2, ATTRS2); Subchannel subchannel3 = pool.takeOrCreateSubchannel(EAG2, ATTRS2); pool.returnSubchannel(subchannel1); pool.returnSubchannel(subchannel2); verify(subchannel1, never()).shutdown(); verify(subchannel2, never()).shutdown(); pool.clear(); verify(subchannel1).shutdown(); verify(subchannel2).shutdown(); verify(subchannel3, never()).shutdown(); assertThat(clock.numPendingTasks()).isEqualTo(0); }
@Override public void clear() { for (CacheEntry entry : cache.values()) { entry.shutdownTimer.cancel(); entry.subchannel.shutdown(); } cache.clear(); }
CachedSubchannelPool implements SubchannelPool { @Override public void clear() { for (CacheEntry entry : cache.values()) { entry.shutdownTimer.cancel(); entry.subchannel.shutdown(); } cache.clear(); } }
CachedSubchannelPool implements SubchannelPool { @Override public void clear() { for (CacheEntry entry : cache.values()) { entry.shutdownTimer.cancel(); entry.subchannel.shutdown(); } cache.clear(); }  }
CachedSubchannelPool implements SubchannelPool { @Override public void clear() { for (CacheEntry entry : cache.values()) { entry.shutdownTimer.cancel(); entry.subchannel.shutdown(); } cache.clear(); }  @Override void init(Helper helper); @Override Subchannel takeOrCreateSubchannel(
      EquivalentAddressGroup eag, Attributes defaultAttributes); @Override void returnSubchannel(Subchannel subchannel); @Override void clear(); }
CachedSubchannelPool implements SubchannelPool { @Override public void clear() { for (CacheEntry entry : cache.values()) { entry.shutdownTimer.cancel(); entry.subchannel.shutdown(); } cache.clear(); }  @Override void init(Helper helper); @Override Subchannel takeOrCreateSubchannel(
      EquivalentAddressGroup eag, Attributes defaultAttributes); @Override void returnSubchannel(Subchannel subchannel); @Override void clear();  }