This is an automated email from the ASF dual-hosted git repository.
lidongdai pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 0226f9f Deprecated method changes (#2706)
0226f9f is described below
commit 0226f9f97ee2fd9c1d89b687dee7a71b7299b459
Author: CalvinKirs <[email protected]>
AuthorDate: Thu May 14 19:06:46 2020 +0800
Deprecated method changes (#2706)
Co-authored-by: dailidong <[email protected]>
---
.../org/apache/dolphinscheduler/service/zk/ZookeeperOperator.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git
a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/ZookeeperOperator.java
b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/ZookeeperOperator.java
index a2cabce..cd479d4 100644
---
a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/ZookeeperOperator.java
+++
b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/ZookeeperOperator.java
@@ -20,6 +20,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.framework.api.ACLProvider;
+import org.apache.curator.framework.api.transaction.CuratorOp;
import org.apache.curator.framework.state.ConnectionState;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.curator.utils.CloseableUtils;
@@ -171,7 +172,11 @@ public class ZookeeperOperator implements InitializingBean
{
public void update(final String key, final String value) {
try {
-
zkClient.inTransaction().check().forPath(key).and().setData().forPath(key,
value.getBytes(StandardCharsets.UTF_8)).and().commit();
+
+ CuratorOp check = zkClient.transactionOp().check().forPath(key);
+ CuratorOp setData =
zkClient.transactionOp().setData().forPath(key,
value.getBytes(StandardCharsets.UTF_8));
+ zkClient.transaction().forOperations(check, setData);
+
} catch (Exception ex) {
logger.error("update key : {} , value : {}", key, value, ex);
}