@Test public void testGetConfig() { int times = 11; String message = "testGetConfig"; String a0 = "a0"; String configId = "raw:times " + times + "\nmessage " + message + "\na[1]\na[0].name " + a0; ConfigGetter<AppConfig> getter = new ConfigGetter<>(AppConfig.class); AppConfig config = getter.getConfig(configId); assertThat(config.times(), is(times)); assertThat(config.message(), is(message)); assertThat(config.a().size(), is(1)); assertThat(config.a(0).name(), is(a0)); AppService service = new AppService(configId, sourceSet); AppConfig serviceConfig = service.getConfig(); assertTrue(service.isConfigured()); assertThat(config, is(serviceConfig)); service.cancelSubscription(); }
public synchronized T getConfig(String configId) { try (ConfigSubscriber subscriber = source == null ? new ConfigSubscriber() : new ConfigSubscriber(source)) { ConfigHandle<T> handle = subscriber.subscribe(clazz, configId); subscriber.nextConfig(); return handle.getConfig(); } }
ConfigGetter { public synchronized T getConfig(String configId) { try (ConfigSubscriber subscriber = source == null ? new ConfigSubscriber() : new ConfigSubscriber(source)) { ConfigHandle<T> handle = subscriber.subscribe(clazz, configId); subscriber.nextConfig(); return handle.getConfig(); } } }
ConfigGetter { public synchronized T getConfig(String configId) { try (ConfigSubscriber subscriber = source == null ? new ConfigSubscriber() : new ConfigSubscriber(source)) { ConfigHandle<T> handle = subscriber.subscribe(clazz, configId); subscriber.nextConfig(); return handle.getConfig(); } } ConfigGetter(Class<T> clazz);  ConfigGetter(ConfigSource source, Class<T> clazz); }
ConfigGetter { public synchronized T getConfig(String configId) { try (ConfigSubscriber subscriber = source == null ? new ConfigSubscriber() : new ConfigSubscriber(source)) { ConfigHandle<T> handle = subscriber.subscribe(clazz, configId); subscriber.nextConfig(); return handle.getConfig(); } } ConfigGetter(Class<T> clazz);  ConfigGetter(ConfigSource source, Class<T> clazz); synchronized T getConfig(String configId); static T getConfig(Class<T> c, String configId); static T getConfig(Class<T> c, String configId, ConfigSource source); }
ConfigGetter { public synchronized T getConfig(String configId) { try (ConfigSubscriber subscriber = source == null ? new ConfigSubscriber() : new ConfigSubscriber(source)) { ConfigHandle<T> handle = subscriber.subscribe(clazz, configId); subscriber.nextConfig(); return handle.getConfig(); } } ConfigGetter(Class<T> clazz);  ConfigGetter(ConfigSource source, Class<T> clazz); synchronized T getConfig(String configId); static T getConfig(Class<T> c, String configId); static T getConfig(Class<T> c, String configId, ConfigSource source);  }