@Override public void afterPropertiesSet() throws Exception { registry = RegistryFactory.getRegistry(appContext); register(); }
private void initRegistry() { registry = RegistryFactory.getRegistry(application); if (registry instanceof AbstractRegistry) { ((AbstractRegistry) registry).setNode(node); } registry.subscribe( node, new NotifyListener() { private final Logger NOTIFY_LOGGER = LoggerFactory.getLogger(NotifyListener.class); @Override public void notify(NotifyEvent event, List<Node> nodes) { if (CollectionUtils.isEmpty(nodes)) { return; } switch (event) { case ADD: for (NodeChangeListener listener : nodeChangeListeners) { try { listener.addNodes(nodes); } catch (Throwable t) { NOTIFY_LOGGER.error( "{} add nodes failed , cause: {}", listener.getClass().getName(), t.getMessage(), t); } } break; case REMOVE: for (NodeChangeListener listener : nodeChangeListeners) { try { listener.removeNodes(nodes); } catch (Throwable t) { NOTIFY_LOGGER.error( "{} remove nodes failed , cause: {}", listener.getClass().getName(), t.getMessage(), t); } } break; } } }); }