You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by xx...@apache.org on 2020/06/18 02:34:03 UTC
[kylin] 02/02: KYLIN-4499 Refine waiting time for initialization
This is an automated email from the ASF dual-hosted git repository.
xxyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kylin.git
commit 121f8d23e3a918a6d93da716fe740bbcdaef56fc
Author: Zhichao Zhang <44...@qq.com>
AuthorDate: Wed Jun 17 19:30:35 2020 +0800
KYLIN-4499 Refine waiting time for initialization
yanghong's PR #1268
---
.../apache/kylin/common/zookeeper/KylinServerDiscovery.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/core-common/src/main/java/org/apache/kylin/common/zookeeper/KylinServerDiscovery.java b/core-common/src/main/java/org/apache/kylin/common/zookeeper/KylinServerDiscovery.java
index 07f59ad..8c95670 100644
--- a/core-common/src/main/java/org/apache/kylin/common/zookeeper/KylinServerDiscovery.java
+++ b/core-common/src/main/java/org/apache/kylin/common/zookeeper/KylinServerDiscovery.java
@@ -120,9 +120,17 @@ public class KylinServerDiscovery implements Closeable {
serviceCache.start();
registerSelf();
+ int i = 1;
+ long maxWaitingTime = 60 * 1000L; // 1 min
while (!isFinishInit.get()) {
logger.info("Haven't registered, waiting ...");
- Thread.sleep(100L);
+ long waitingTime = 100L * i * i;
+ if (waitingTime > maxWaitingTime) {
+ waitingTime = maxWaitingTime;
+ } else {
+ i++;
+ }
+ Thread.sleep(waitingTime);
}
} catch (Exception e) {
throw new RuntimeException("Fail to initialize due to ", e);