shenyu-sync-data-center/shenyu-sync-data-zookeeper/src/main/java/org/apache/shenyu/sync/data/zookeeper/ZookeeperClient.java [159:175]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void createOrUpdate(final String key, final String value, final CreateMode mode) {
        String val = StringUtils.isEmpty(value) ? "" : value;
        try {
            synchronized (ZookeeperClient.class) {
                if (Objects.nonNull(client.checkExists()) && Objects.nonNull(client.checkExists().forPath(key))) {
                    LOG.debug("path exists, update zookeeper key={} with value={}", key, val);
                    client.setData().forPath(key, val.getBytes(StandardCharsets.UTF_8));
                    return;
                }
                LOG.debug("path not exists, set zookeeper key={} with value={}", key, val);
                client.create().orSetData().creatingParentsIfNeeded().withMode(mode).forPath(key, val.getBytes(StandardCharsets.UTF_8));
            }
        } catch (Exception e) {
            LOG.error("create or update key with value error, key:{} value:{}", key, value, e);
            throw new ShenyuException(e);
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



shenyu-registry/shenyu-registry-zookeeper/src/main/java/org/apache/shenyu/registry/zookeeper/ZookeeperClient.java [156:172]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void createOrUpdate(final String key, final String value, final CreateMode mode) {
        String val = StringUtils.isEmpty(value) ? "" : value;
        try {
            synchronized (ZookeeperClient.class) {
                if (Objects.nonNull(client.checkExists()) && Objects.nonNull(client.checkExists().forPath(key))) {
                    LOG.debug("path exists, update zookeeper key={} with value={}", key, val);
                    client.setData().forPath(key, val.getBytes(StandardCharsets.UTF_8));
                    return;
                }
                LOG.debug("path not exists, set zookeeper key={} with value={}", key, val);
                client.create().orSetData().creatingParentsIfNeeded().withMode(mode).forPath(key, val.getBytes(StandardCharsets.UTF_8));
            }
        } catch (Exception e) {
            LOG.error("create or update key with value error, key:{} value:{}", key, value, e);
            throw new ShenyuException(e);
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



shenyu-admin-listener/shenyu-admin-listener-zookeeper/src/main/java/org/apache/shenyu/admin/listener/zookeeper/ZookeeperClient.java [158:174]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void createOrUpdate(final String key, final String value, final CreateMode mode) {
        String val = StringUtils.isEmpty(value) ? "" : value;
        try {
            synchronized (ZookeeperClient.class) {
                if (Objects.nonNull(client.checkExists()) && Objects.nonNull(client.checkExists().forPath(key))) {
                    LOG.debug("path exists, update zookeeper key={} with value={}", key, val);
                    client.setData().forPath(key, val.getBytes(StandardCharsets.UTF_8));
                    return;
                }
                LOG.debug("path not exists, set zookeeper key={} with value={}", key, val);
                client.create().orSetData().creatingParentsIfNeeded().withMode(mode).forPath(key, val.getBytes(StandardCharsets.UTF_8));
            }
        } catch (Exception e) {
            LOG.error("create or update key with value error, key:{} value:{}", key, value, e);
            throw new ShenyuException(e);
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



