@Test public void registerNewConf() { ServerConfigurationStore configStore = createConfigStore(); Map<Address, List<ConfigRecord>> confMap = configStore.getConfMap(); assertTrue(confMap.containsKey(mAddressOne)); assertTrue(confMap.containsKey(mAddressTwo)); }
public synchronized void registerNewConf(Address address, List<ConfigProperty> configList) { Preconditions.checkNotNull(address, "address should not be null"); Preconditions.checkNotNull(configList, "configuration list should not be null"); mConfMap.put(address, configList.stream().map(c -> new ConfigRecord() .setKey(toPropertyKey(c.getName())).setSource(c.getSource()) .setValue(c.getValue())).collect(Collectors.toList())); mLostNodes.remove(address); for (Runnable function : mChangeListeners) { function.run(); } }
ServerConfigurationStore { public synchronized void registerNewConf(Address address, List<ConfigProperty> configList) { Preconditions.checkNotNull(address, "address should not be null"); Preconditions.checkNotNull(configList, "configuration list should not be null"); mConfMap.put(address, configList.stream().map(c -> new ConfigRecord() .setKey(toPropertyKey(c.getName())).setSource(c.getSource()) .setValue(c.getValue())).collect(Collectors.toList())); mLostNodes.remove(address); for (Runnable function : mChangeListeners) { function.run(); } } }
ServerConfigurationStore { public synchronized void registerNewConf(Address address, List<ConfigProperty> configList) { Preconditions.checkNotNull(address, "address should not be null"); Preconditions.checkNotNull(configList, "configuration list should not be null"); mConfMap.put(address, configList.stream().map(c -> new ConfigRecord() .setKey(toPropertyKey(c.getName())).setSource(c.getSource()) .setValue(c.getValue())).collect(Collectors.toList())); mLostNodes.remove(address); for (Runnable function : mChangeListeners) { function.run(); } } ServerConfigurationStore(); }
ServerConfigurationStore { public synchronized void registerNewConf(Address address, List<ConfigProperty> configList) { Preconditions.checkNotNull(address, "address should not be null"); Preconditions.checkNotNull(configList, "configuration list should not be null"); mConfMap.put(address, configList.stream().map(c -> new ConfigRecord() .setKey(toPropertyKey(c.getName())).setSource(c.getSource()) .setValue(c.getValue())).collect(Collectors.toList())); mLostNodes.remove(address); for (Runnable function : mChangeListeners) { function.run(); } } ServerConfigurationStore(); synchronized void reset(); synchronized void registerNewConf(Address address, List<ConfigProperty> configList); synchronized void handleNodeLost(Address address); synchronized void lostNodeFound(Address address); synchronized Map<Address, List<ConfigRecord>> getConfMap(); synchronized List<Address> getLiveNodeAddresses(); synchronized void registerChangeListener(Runnable function); }
ServerConfigurationStore { public synchronized void registerNewConf(Address address, List<ConfigProperty> configList) { Preconditions.checkNotNull(address, "address should not be null"); Preconditions.checkNotNull(configList, "configuration list should not be null"); mConfMap.put(address, configList.stream().map(c -> new ConfigRecord() .setKey(toPropertyKey(c.getName())).setSource(c.getSource()) .setValue(c.getValue())).collect(Collectors.toList())); mLostNodes.remove(address); for (Runnable function : mChangeListeners) { function.run(); } } ServerConfigurationStore(); synchronized void reset(); synchronized void registerNewConf(Address address, List<ConfigProperty> configList); synchronized void handleNodeLost(Address address); synchronized void lostNodeFound(Address address); synchronized Map<Address, List<ConfigRecord>> getConfMap(); synchronized List<Address> getLiveNodeAddresses(); synchronized void registerChangeListener(Runnable function);  }