Skip to content

Commit 1454179

Browse files
author
胡贵
committed
将 任务队列 和 业务日志记录器 使用spi扩展
1 parent 9dfdc76 commit 1454179

File tree

93 files changed

+992
-758
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+992
-758
lines changed

data/mongo/mongo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ db.auth("lts", "lts");
88
db.JobPo.ensureIndex({"jobId":1},{unique:true});
99
db.JobPo.ensureIndex({"taskTrackerNodeGroup":1, "taskId":1},{unique:true});
1010
db.JobPo.ensureIndex({"taskTrackerIdentity":1});
11-
db.JobPo.ensureIndex({"priority":1, "triggerTime":1});
11+
db.JobPo.ensureIndex({"triggerTime":1, "priority":1, "gmtCreate": 1});
1212
db.JobPo.ensureIndex({"isRunning":1});
1313
db.JobPo.ensureIndex({"taskTrackerNodeGroup":1, "isRunning":1, "triggerTime":1});
1414

job-admin/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<parent>
6-
<artifactId>light-task-schedule</artifactId>
6+
<artifactId>job-parent</artifactId>
77
<groupId>com.lts</groupId>
8-
<version>1.3.3-SNAPSHOT</version>
8+
<version>1.4.0-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111
<packaging>war</packaging>

job-admin/src/main/java/com/lts/job/web/support/node/ZkNodeManager.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
package com.lts.job.web.support.node;
22

3+
import com.lts.job.core.cluster.Config;
34
import com.lts.job.core.cluster.Node;
45
import com.lts.job.core.cluster.NodeType;
6+
import com.lts.job.core.constant.Constants;
57
import com.lts.job.core.registry.NodeRegistryUtils;
8+
import com.lts.job.core.registry.Registry;
9+
import com.lts.job.core.registry.RegistryFactory;
610
import com.lts.job.core.util.CollectionUtils;
711
import com.lts.job.zookeeper.ZookeeperClient;
812
import com.lts.job.zookeeper.zkclient.ZkClientZookeeperClient;
@@ -21,7 +25,11 @@ public class ZkNodeManager implements NodeManager {
2125
private ZookeeperClient zkClient;
2226

2327
public ZkNodeManager() {
24-
this.zkClient = new ZkClientZookeeperClient(AppConfigurer.getProperties("zookeeper.address"));
28+
Config config = new Config();
29+
config.setParameter(Constants.ZK_CLIENT_KEY, "");
30+
config.setRegistryAddress(AppConfigurer.getProperties("registry.address"));
31+
// Registry registry = RegistryFactory.getRegistry(config);
32+
// this.zkClient = new ZkClientZookeeperClient();
2533
}
2634

2735
@Override
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22
#zookeeper地址
3-
zookeeper.address=127.0.0.1:2181
3+
registry.address=zookeeper://127.0.0.1:2181

job-client/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
xmlns="http://maven.apache.org/POM/4.0.0"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<parent>
6-
<artifactId>light-task-schedule</artifactId>
6+
<artifactId>job-parent</artifactId>
77
<groupId>com.lts</groupId>
8-
<version>1.3.3-SNAPSHOT</version>
8+
<version>1.4.0-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

job-core/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
xmlns="http://maven.apache.org/POM/4.0.0"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<parent>
6-
<artifactId>light-task-schedule</artifactId>
6+
<artifactId>job-parent</artifactId>
77
<groupId>com.lts</groupId>
8-
<version>1.3.3-SNAPSHOT</version>
8+
<version>1.4.0-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
11-
11+
<packaging>jar</packaging>
1212
<artifactId>job-core</artifactId>
1313
</project>

job-core/src/main/java/com/lts/job/core/cluster/AbstractJobNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public void destroy() {
106106
}
107107

108108
private void initRegistry() {
109-
registry = RegistryFactory.getRegistry(application);
109+
registry = RegistryFactory.getRegistry(config);
110110
if (registry instanceof AbstractRegistry) {
111111
((AbstractRegistry) registry).setNode(node);
112112
}

job-core/src/main/java/com/lts/job/core/constant/Constants.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,13 @@ public interface Constants {
5555
/**
5656
* 注册中心自动重连时间
5757
*/
58-
public static final String REGISTRY_RECONNECT_PERIOD_KEY = "reconnect.period";
58+
public static final String REGISTRY_RECONNECT_PERIOD_KEY = "reconnect.period";
5959

60-
public static final int DEFAULT_REGISTRY_RECONNECT_PERIOD = 3 * 1000;
60+
public static final int DEFAULT_REGISTRY_RECONNECT_PERIOD = 3 * 1000;
6161

62+
public static final String ZK_CLIENT_KEY = "zk.client";
63+
64+
public static final String JOB_LOGGER_KEY = "job.logger";
65+
66+
public static final String JOB_QUEUE_KEY = "job.queue";
6267
}

job-core/src/main/java/com/lts/job/core/extension/ExtensionFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package com.lts.job.core.extension;
1717

1818
/**
19-
* Created by hugui on 5/18/15.
19+
* @author Robert HG (254963746@qq.com) on 5/18/15.
2020
*/
2121
@SPI
2222
public interface ExtensionFactory {

job-core/src/main/java/com/lts/job/core/listener/NodeChangeListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import java.util.List;
66

77
/**
8-
* Created by hugui on 5/18/15.
8+
* @author Robert HG (254963746@qq.com) on 5/18/15.
99
*/
1010
public interface NodeChangeListener {
1111

0 commit comments

Comments
 (0)