From 54b784910d5690efa7698f64439b16350b151b2e Mon Sep 17 00:00:00 2001 From: zhangkewei Date: Thu, 8 Nov 2018 11:25:42 +0800 Subject: [PATCH] upgrade to 2.0.2.2 --- build.gradle | 4 ++-- .../porter/common/dic/AlertPlugin.java | 5 ++--- .../porter/boot/NodeBootApplication.java | 17 +++++++++-------- .../src/main/resources/application.properties | 16 ++++++++-------- .../zookeeper/ZKClusterNodeListener.java | 4 +++- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/build.gradle b/build.gradle index b85344ea..3bc95708 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ apply plugin: 'java' -version '2.0.2.1' +version '2.0.2.2' repositories { maven{ url"http://maven.aliyun.com/nexus/content/groups/public"} @@ -25,7 +25,7 @@ subprojects { ext { group = 'cn.vbill.middleware.porter' junitVersion = '4.12' - version '2.0.2.1' + version '2.0.2.2' springVersion = '1.5.9.RELEASE' swaggerVersion = '2.7.0' } diff --git a/common/src/main/java/cn/vbill/middleware/porter/common/dic/AlertPlugin.java b/common/src/main/java/cn/vbill/middleware/porter/common/dic/AlertPlugin.java index c8c30f8e..95b0c2b8 100644 --- a/common/src/main/java/cn/vbill/middleware/porter/common/dic/AlertPlugin.java +++ b/common/src/main/java/cn/vbill/middleware/porter/common/dic/AlertPlugin.java @@ -37,10 +37,9 @@ @AllArgsConstructor @JsonFormat(shape = JsonFormat.Shape.OBJECT) public enum AlertPlugin { - EMAIL("EMAIL", "邮件"), - - MOBILE("MOBILE", "手机号"); + MOBILE("MOBILE", "手机号"), + NONE("NONE", "无"); @Getter private final String code; diff --git a/porter/porter-boot/src/main/java/cn/vbill/middleware/porter/boot/NodeBootApplication.java b/porter/porter-boot/src/main/java/cn/vbill/middleware/porter/boot/NodeBootApplication.java index 6a47f2d2..9a10d918 100644 --- a/porter/porter-boot/src/main/java/cn/vbill/middleware/porter/boot/NodeBootApplication.java +++ b/porter/porter-boot/src/main/java/cn/vbill/middleware/porter/boot/NodeBootApplication.java @@ -18,7 +18,7 @@ package cn.vbill.middleware.porter.boot; import cn.vbill.middleware.porter.common.client.PublicClientContext; -import cn.vbill.middleware.porter.common.util.ProcessUtils; +import cn.vbill.middleware.porter.common.dic.AlertPlugin; import cn.vbill.middleware.porter.boot.config.SourcesConfig; import cn.vbill.middleware.porter.core.NodeContext; import cn.vbill.middleware.porter.task.TaskController; @@ -77,11 +77,13 @@ public static void main(String[] args) { NodeConfig config = context.getBean(NodeConfig.class); //从本地初始化告警配置 - try { - AlertProviderFactory.INSTANCE.initialize(config.getAlert()); - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("告警配置初始化失败, 数据同步节点退出!error:" + e.getMessage()); + if (null != config.getAlert() && config.getAlert().getStrategy() != AlertPlugin.NONE) { + try { + AlertProviderFactory.INSTANCE.initialize(config.getAlert()); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("告警配置初始化失败, 数据同步节点退出!error:" + e.getMessage()); + } } //初始化默认工作任务数 @@ -115,6 +117,7 @@ public static void main(String[] args) { //注册节点,注册失败退出进程 ClusterProviderProxy.INSTANCE.broadcast(new NodeRegisterCommand(config.getId(), config.getStatistic().isUpload())); } catch (Exception e) { + e.printStackTrace(); throw new RuntimeException(e.getMessage() + "数据同步节点退出!error:" + e.getMessage()); } @@ -127,7 +130,5 @@ public static void main(String[] args) { //启动节点任务执行容器,并尝试执行本地配置文件任务 controller.start(null != config.getTask() && !config.getTask().isEmpty() ? config.getTask() : null); LOGGER.info("NodeBootApplication started"); - //保持进程持续运行不退出 - ProcessUtils.keepRunning(); } } \ No newline at end of file diff --git a/porter/porter-boot/src/main/resources/application.properties b/porter/porter-boot/src/main/resources/application.properties index 36286822..8ff36361 100644 --- a/porter/porter-boot/src/main/resources/application.properties +++ b/porter/porter-boot/src/main/resources/application.properties @@ -8,19 +8,19 @@ porter.statistic.upload=false #集群配置 porter.cluster.strategy=ZOOKEEPER -porter.cluster.client.url=127.0.0.1:2181 +porter.cluster.client.url=172.16.135.30:2181 porter.cluster.client.sessionTimeout=100000 #告警配置 -porter.alert.strategy=EMAIL -porter.alert.client.host=smtphm.qq.com -porter.alert.client.username=test@qq.com -porter.alert.client.password=123456 -porter.alert.client.smtpAuth=true -porter.alert.client.smtpStarttlsEnable=true -porter.alert.client.smtpStarttlsRequired=false +porter.alert.strategy=NONE +#porter.alert.client.host=smtp.qq.com +#porter.alert.client.username=100000@qq.com +#porter.alert.client.password=pssword +#porter.alert.client.smtpAuth=true +#porter.alert.client.smtpStarttlsEnable=true +#porter.alert.client.smtpStarttlsRequired=false #porter.alert.receiver[0].realName=样板告警人 #porter.alert.receiver[0].email=test@qq.com diff --git a/porter/porter-cluster/src/main/java/cn/vbill/middleware/porter/cluster/zookeeper/ZKClusterNodeListener.java b/porter/porter-cluster/src/main/java/cn/vbill/middleware/porter/cluster/zookeeper/ZKClusterNodeListener.java index 7930a6fb..bd0495ad 100644 --- a/porter/porter-cluster/src/main/java/cn/vbill/middleware/porter/cluster/zookeeper/ZKClusterNodeListener.java +++ b/porter/porter-cluster/src/main/java/cn/vbill/middleware/porter/cluster/zookeeper/ZKClusterNodeListener.java @@ -212,7 +212,9 @@ public void run() { } }, 10, 30, TimeUnit.SECONDS); } else { - throw new Exception(lockPath + ",节点已注册"); + String msg = lockPath + ",节点已注册"; + LOGGER.error(msg); + throw new Exception(msg); } }