@Test public void getProviders() throws Exception { SingleGroupAddressHolder addressHolder = new SingleGroupAddressHolder(null); Assert.assertTrue(ProviderHelper.isEmpty(addressHolder.getProviderGroup(null))); Assert.assertTrue(ProviderHelper.isEmpty(addressHolder.getProviderGroup(StringUtils.EMPTY))); Assert.assertTrue(ProviderHelper.isEmpty(addressHolder.getProviderGroup(ADDRESS_DEFAULT_GROUP))); addressHolder.registryGroup.add(ProviderHelper.toProviderInfo("127.0.0.1:12200")); addressHolder.registryGroup.add(ProviderHelper.toProviderInfo("127.0.0.1:12201")); Assert.assertTrue(addressHolder.getProviderGroup(null).size() == 2); Assert.assertTrue(addressHolder.getProviderGroup(StringUtils.EMPTY).size() == 2); Assert.assertTrue(addressHolder.getProviderGroup(ADDRESS_DEFAULT_GROUP).size() == 2); addressHolder.directUrlGroup.add(ProviderHelper.toProviderInfo("127.0.0.1:12200")); Assert.assertTrue(addressHolder.getProviderGroup(ADDRESS_DIRECT_GROUP).size() == 1); Assert.assertTrue(addressHolder.getProviderGroup(null).size() == 2); Assert.assertTrue(addressHolder.getProviderGroup(StringUtils.EMPTY).size() == 2); Assert.assertTrue(addressHolder.getProviderGroup(ADDRESS_DEFAULT_GROUP).size() == 2); }
@Override public ProviderGroup getProviderGroup(String groupName) { rLock.lock(); try { return RpcConstants.ADDRESS_DIRECT_GROUP.equals(groupName) ? directUrlGroup : registryGroup; } finally { rLock.unlock(); } }
SingleGroupAddressHolder extends AddressHolder { @Override public ProviderGroup getProviderGroup(String groupName) { rLock.lock(); try { return RpcConstants.ADDRESS_DIRECT_GROUP.equals(groupName) ? directUrlGroup : registryGroup; } finally { rLock.unlock(); } } }
SingleGroupAddressHolder extends AddressHolder { @Override public ProviderGroup getProviderGroup(String groupName) { rLock.lock(); try { return RpcConstants.ADDRESS_DIRECT_GROUP.equals(groupName) ? directUrlGroup : registryGroup; } finally { rLock.unlock(); } } protected  SingleGroupAddressHolder(ConsumerBootstrap consumerBootstrap); }
SingleGroupAddressHolder extends AddressHolder { @Override public ProviderGroup getProviderGroup(String groupName) { rLock.lock(); try { return RpcConstants.ADDRESS_DIRECT_GROUP.equals(groupName) ? directUrlGroup : registryGroup; } finally { rLock.unlock(); } } protected  SingleGroupAddressHolder(ConsumerBootstrap consumerBootstrap); @Override List<ProviderInfo> getProviderInfos(String groupName); @Override ProviderGroup getProviderGroup(String groupName); @Override List<ProviderGroup> getProviderGroups(); @Override int getAllProviderSize(); @Override void addProvider(ProviderGroup providerGroup); @Override void removeProvider(ProviderGroup providerGroup); @Override void updateProviders(ProviderGroup providerGroup); @Override void updateAllProviders(List<ProviderGroup> providerGroups); }
SingleGroupAddressHolder extends AddressHolder { @Override public ProviderGroup getProviderGroup(String groupName) { rLock.lock(); try { return RpcConstants.ADDRESS_DIRECT_GROUP.equals(groupName) ? directUrlGroup : registryGroup; } finally { rLock.unlock(); } } protected  SingleGroupAddressHolder(ConsumerBootstrap consumerBootstrap); @Override List<ProviderInfo> getProviderInfos(String groupName); @Override ProviderGroup getProviderGroup(String groupName); @Override List<ProviderGroup> getProviderGroups(); @Override int getAllProviderSize(); @Override void addProvider(ProviderGroup providerGroup); @Override void removeProvider(ProviderGroup providerGroup); @Override void updateProviders(ProviderGroup providerGroup); @Override void updateAllProviders(List<ProviderGroup> providerGroups);  }