You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/07/19 08:31:04 UTC
[shardingsphere-elasticjob] branch master updated: Consider about
cannot permit port as -1 for disable SnapshotService #1152 (#1163)
This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere-elasticjob.git
The following commit(s) were added to refs/heads/master by this push:
new 17385b6 Consider about cannot permit port as -1 for disable SnapshotService #1152 (#1163)
17385b6 is described below
commit 17385b62ec19d37d96f0af16669ce85907dd181c
Author: jiang2015 <27...@qq.com>
AuthorDate: Sun Jul 19 16:30:53 2020 +0800
Consider about cannot permit port as -1 for disable SnapshotService #1152 (#1163)
* Consider about cannot permit port as -1 for disable SnapshotService #1152
* modify test case dump-port
---
.../user-manual/elasticjob-lite/configuration/spring-namespace.cn.md | 2 +-
.../elasticjob/lite/internal/snapshot/SnapshotService.java | 3 ++-
.../src/main/resources/META-INF/namespace/elasticjob.xsd | 2 +-
.../src/test/resources/META-INF/snapshot/snapshotDisabled.xml | 2 +-
4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/docs/content/user-manual/elasticjob-lite/configuration/spring-namespace.cn.md b/docs/content/user-manual/elasticjob-lite/configuration/spring-namespace.cn.md
index 8669110..8887fde 100644
--- a/docs/content/user-manual/elasticjob-lite/configuration/spring-namespace.cn.md
+++ b/docs/content/user-manual/elasticjob-lite/configuration/spring-namespace.cn.md
@@ -109,4 +109,4 @@ elasticjob:distributed-listener 必须配置为 elasticjob:job 的子元素,
| ------------------- |:------ |:------ |:------ |:------------------------------------------------------------------------ |
| id | String | 是 | | 监控服务在 Spring 容器中的主键 |
| registry-center-ref | String | 是 | | 注册中心 Bean 的引用,需引用 reg:zookeeper 的声明 |
-| dump-port | String | 否 | -1 | 导出作业信息数据端口<br />使用方法: echo "dump@jobName" \| nc 127.0.0.1 9888 |
+| dump-port | String | 是 | | 导出作业信息数据端口<br />使用方法: echo "dump@jobName" \| nc 127.0.0.1 9888 |
diff --git a/elasticjob-lite/elasticjob-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/snapshot/SnapshotService.java b/elasticjob-lite/elasticjob-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/snapshot/SnapshotService.java
index 9099ea7..1ce6662 100644
--- a/elasticjob-lite/elasticjob-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/snapshot/SnapshotService.java
+++ b/elasticjob-lite/elasticjob-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/snapshot/SnapshotService.java
@@ -60,7 +60,8 @@ public final class SnapshotService {
*/
public void listen() {
if (port < 0) {
- return;
+ log.error("Elastic job: Snapshot service port must greater than 0, the port is '{}'", port);
+ throw new RuntimeException("config Snapshot service port must greater than 0.");
}
try {
log.info("Elastic job: Snapshot service is running, the port is '{}'", port);
diff --git a/elasticjob-lite/elasticjob-lite-spring/src/main/resources/META-INF/namespace/elasticjob.xsd b/elasticjob-lite/elasticjob-lite-spring/src/main/resources/META-INF/namespace/elasticjob.xsd
index 577a68a..d42c23b 100644
--- a/elasticjob-lite/elasticjob-lite-spring/src/main/resources/META-INF/namespace/elasticjob.xsd
+++ b/elasticjob-lite/elasticjob-lite-spring/src/main/resources/META-INF/namespace/elasticjob.xsd
@@ -102,7 +102,7 @@
<xsd:complexContent>
<xsd:extension base="beans:identifiedType">
<xsd:attribute name="registry-center-ref" type="xsd:string" use="required" />
- <xsd:attribute name="dump-port" type="xsd:string" default="-1" />
+ <xsd:attribute name="dump-port" type="xsd:string" use="required" />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
diff --git a/elasticjob-lite/elasticjob-lite-spring/src/test/resources/META-INF/snapshot/snapshotDisabled.xml b/elasticjob-lite/elasticjob-lite-spring/src/test/resources/META-INF/snapshot/snapshotDisabled.xml
index eb3a3ae..d2b5a52 100644
--- a/elasticjob-lite/elasticjob-lite-spring/src/test/resources/META-INF/snapshot/snapshotDisabled.xml
+++ b/elasticjob-lite/elasticjob-lite-spring/src/test/resources/META-INF/snapshot/snapshotDisabled.xml
@@ -34,5 +34,5 @@
max-sleep-time-milliseconds="${regCenter1.maxSleepTimeMilliseconds}"
max-retries="${regCenter1.maxRetries}"/>
- <elasticjob:snapshot id="jobSnapshotDisabled" registry-center-ref="regCenter1" dump-port="-1"/>
+ <elasticjob:snapshot id="jobSnapshotDisabled" registry-center-ref="regCenter1" dump-port="9987"/>
</beans>