@Override
    public List<InstanceEntity> selectInstances(final String selectKey) {
        try {
            final String watchKey = StringUtils.isNotBlank(watchPath)
                    ? InstancePathConstants.buildRealNode(watchPath, selectKey) : InstancePathConstants.buildInstanceParentPath(selectKey);
            final Function<List<String>, List<InstanceEntity>> getInstanceRegisterFun = childrenList -> childrenList.stream().map(childPath -> {
                String instanceRegisterJsonStr = client.get(InstancePathConstants.buildRealNode(watchKey, childPath));
                InstanceEntity instanceEntity = GsonUtils.getInstance().fromJson(instanceRegisterJsonStr, InstanceEntity.class);
                instanceEntity.setUri(getURI(instanceRegisterJsonStr, instanceEntity.getPort(), instanceEntity.getHost()));
                if (Objects.isNull(instanceEntity.getUri())) {
                    final JsonObject hashMap = GsonUtils.getInstance().fromJson(instanceRegisterJsonStr, JsonObject.class);
                    final String address = hashMap.get("address").getAsString();
                    final Integer port = hashMap.get("port").getAsInt();
                    instanceEntity.setUri(getURI(instanceRegisterJsonStr, port, address));
                }
                return instanceEntity;
            }).collect(Collectors.toList());

            if (watcherInstanceRegisterMap.containsKey(selectKey)) {
                return watcherInstanceRegisterMap.get(selectKey);
            }

            List<String> childrenPathList = client.subscribeChildrenChanges(watchKey, new CuratorWatcher() {
                @Override
                public void process(final WatchedEvent event) {
                    try {
                        String path = Objects.isNull(event.getPath()) ? selectKey : event.getPath();
                        List<String> childrenList = StringUtils.isNotBlank(path) ? client.subscribeChildrenChanges(path, this)
                                : Collections.emptyList();
                        if (!childrenList.isEmpty()) {
                            watcherInstanceRegisterMap.put(selectKey, getInstanceRegisterFun.apply(childrenList));
                        }
                    } catch (Exception e) {
                        watcherInstanceRegisterMap.remove(selectKey);
                        LOGGER.error("zookeeper registry client subscribeChildrenChanges watch interrupt error:", e);
                    }
                }
            });

            final List<InstanceEntity> instanceEntities = getInstanceRegisterFun.apply(childrenPathList);
            watcherInstanceRegisterMap.put(selectKey, instanceEntities);
            return instanceEntities;
        } catch (Exception e) {
            LOGGER.error("zookeeper registry client selectInstances error:", e);
            return Collections.emptyList();
        }
    }
The type Zookeeper instance register repository.
shenyu-registry/shenyu-registry-zookeeper/src/main/java/org/apache/shenyu/registry/zookeeper/ZookeeperInstanceRegisterRepository.java