@Test public void testSubscribeAll() throws InterruptedException, NoSuchFieldException, IllegalAccessException { RadarClientConfig config = new RadarClientConfig(rgUrl); config.setHost("1.1.1.1"); DiscoveryClient client = DiscoveryClient.getInstance(); client.setConfig(config); Field field = client.getClass().getDeclaredField("config"); field.setAccessible(true); field.set(client, config); Thread.sleep(2000); field = client.getClass().getDeclaredField("appVersion"); field.setAccessible(true); Map<String, Long> appVersion = (Map<String, Long>)field.get(client); Assert.assertTrue(appVersion.get("121").equals(0L)); }
private void subscribeAll() { if (isSub.compareAndSet(false, true)) { Transaction transaction = Tracer.newTransaction("radar-client", "subscribeAll"); try { synAppMeta(); transaction.setStatus(Transaction.SUCCESS); } catch (Exception e) { transaction.setStatus(e); throw e; } finally { transaction.complete(); } } }
DiscoveryClient { private void subscribeAll() { if (isSub.compareAndSet(false, true)) { Transaction transaction = Tracer.newTransaction("radar-client", "subscribeAll"); try { synAppMeta(); transaction.setStatus(Transaction.SUCCESS); } catch (Exception e) { transaction.setStatus(e); throw e; } finally { transaction.complete(); } } } }
DiscoveryClient { private void subscribeAll() { if (isSub.compareAndSet(false, true)) { Transaction transaction = Tracer.newTransaction("radar-client", "subscribeAll"); try { synAppMeta(); transaction.setStatus(Transaction.SUCCESS); } catch (Exception e) { transaction.setStatus(e); throw e; } finally { transaction.complete(); } } } private  DiscoveryClient(); }
DiscoveryClient { private void subscribeAll() { if (isSub.compareAndSet(false, true)) { Transaction transaction = Tracer.newTransaction("radar-client", "subscribeAll"); try { synAppMeta(); transaction.setStatus(Transaction.SUCCESS); } catch (Exception e) { transaction.setStatus(e); throw e; } finally { transaction.complete(); } } } private  DiscoveryClient(); static DiscoveryClient getInstance(); RadarInstance getInstanceRadar(); RadarClientConfig getConfig(); void setConfig(RadarClientConfig config); boolean isConfiged(); boolean isRegistered(); Map<String, RadarApp> getData(); void register(RadarInstance instanceRadar); synchronized void addAppChangedListener(AppChangedListener changeListener); Map<String, RadarApp> getApps(List<String> appIds); Map<String, RadarApp> getApps(); RadarApp getApp(String appId); void deregister(); AdjustResponse adjust(Boolean isUp); }
DiscoveryClient { private void subscribeAll() { if (isSub.compareAndSet(false, true)) { Transaction transaction = Tracer.newTransaction("radar-client", "subscribeAll"); try { synAppMeta(); transaction.setStatus(Transaction.SUCCESS); } catch (Exception e) { transaction.setStatus(e); throw e; } finally { transaction.complete(); } } } private  DiscoveryClient(); static DiscoveryClient getInstance(); RadarInstance getInstanceRadar(); RadarClientConfig getConfig(); void setConfig(RadarClientConfig config); boolean isConfiged(); boolean isRegistered(); Map<String, RadarApp> getData(); void register(RadarInstance instanceRadar); synchronized void addAppChangedListener(AppChangedListener changeListener); Map<String, RadarApp> getApps(List<String> appIds); Map<String, RadarApp> getApps(); RadarApp getApp(String appId); void deregister(); AdjustResponse adjust(Boolean isUp);  }