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);
        }
    }
create or update key with value.

@param key   zookeeper path key.
@param value string value.
@param mode  creation mode.
shenyu-sync-data-center/shenyu-sync-data-zookeeper/src/main/java/org/apache/shenyu/sync/data/zookeeper/ZookeeperClient.java