@Test public void testConfigChangeNotify() throws InterruptedException { AtomicReference<ConfigDataChangeEvent> reference = new AtomicReference<>(); NotifyCenter.registerToPublisher(ConfigDataChangeEvent.class, NotifyCenter.ringBufferSize); NotifyCenter.registerSubscriber(new Subscriber() { @Override public void onEvent(Event event) { reference.set((ConfigDataChangeEvent) event); } @Override public Class<? extends Event> subscribeType() { return ConfigDataChangeEvent.class; } }); ApplicationUtils.setIsStandalone(true); PropertyUtil.setEmbeddedStorage(true); ConfigChangePublisher .notifyConfigChange(new ConfigDataChangeEvent("chuntaojun", "chuntaojun", System.currentTimeMillis())); Thread.sleep(2000); Assert.assertNotNull(reference.get()); reference.set(null); ApplicationUtils.setIsStandalone(true); PropertyUtil.setEmbeddedStorage(false); ConfigChangePublisher .notifyConfigChange(new ConfigDataChangeEvent("chuntaojun", "chuntaojun", System.currentTimeMillis())); Thread.sleep(2000); Assert.assertNotNull(reference.get()); reference.set(null); ApplicationUtils.setIsStandalone(false); PropertyUtil.setEmbeddedStorage(true); ConfigChangePublisher .notifyConfigChange(new ConfigDataChangeEvent("chuntaojun", "chuntaojun", System.currentTimeMillis())); Thread.sleep(2000); Assert.assertNull(reference.get()); reference.set(null); ApplicationUtils.setIsStandalone(false); PropertyUtil.setEmbeddedStorage(false); ConfigChangePublisher .notifyConfigChange(new ConfigDataChangeEvent("chuntaojun", "chuntaojun", System.currentTimeMillis())); Thread.sleep(2000); Assert.assertNotNull(reference.get()); reference.set(null); }
public static void notifyConfigChange(ConfigDataChangeEvent event) { if (PropertyUtil.isEmbeddedStorage() && !ApplicationUtils.getStandaloneMode()) { return; } NotifyCenter.publishEvent(event); }
ConfigChangePublisher { public static void notifyConfigChange(ConfigDataChangeEvent event) { if (PropertyUtil.isEmbeddedStorage() && !ApplicationUtils.getStandaloneMode()) { return; } NotifyCenter.publishEvent(event); } }
ConfigChangePublisher { public static void notifyConfigChange(ConfigDataChangeEvent event) { if (PropertyUtil.isEmbeddedStorage() && !ApplicationUtils.getStandaloneMode()) { return; } NotifyCenter.publishEvent(event); }  }
ConfigChangePublisher { public static void notifyConfigChange(ConfigDataChangeEvent event) { if (PropertyUtil.isEmbeddedStorage() && !ApplicationUtils.getStandaloneMode()) { return; } NotifyCenter.publishEvent(event); }  static void notifyConfigChange(ConfigDataChangeEvent event); }
ConfigChangePublisher { public static void notifyConfigChange(ConfigDataChangeEvent event) { if (PropertyUtil.isEmbeddedStorage() && !ApplicationUtils.getStandaloneMode()) { return; } NotifyCenter.publishEvent(event); }  static void notifyConfigChange(ConfigDataChangeEvent event);  }