Skip to content

Commit b91b9ba

Browse files
committed
Merge pull request #34 from qq254963746/develop
Develop
2 parents 3fe8af5 + 7a81a4d commit b91b9ba

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LTS 轻量级分布式任务调度框架(Light Task Schedule)
1111
框架支持实时任务,也支持定时任务,同时也支持CronExpression, 有问题,请加QQ群:109500214 一起完善,探讨
1212

1313
##架构图
14-
![Aaron Swartz](https://raw.githubusercontent.com/qq254963746/light-task-schedule/master/doc/%E6%9E%B6%E6%9E%84%E5%9B%BE.png)
14+
![Aaron Swartz](https://raw.githubusercontent.com/qq254963746/light-task-schedule/master/doc/LTS_architecture.png)
1515
##节点组:
1616
* 1. 一个节点组等同于一个集群,同一个节点组中的各个节点是对等的,外界无论连接节点组中的任务一个节点都是可以的。
1717
* 2. 每个节点组中都有一个master节点(master宕机,会自动选举出新的master节点),框架会提供接口API来监听master节点的变化,用户可以自己使用master节点做自己想做的事情。

doc/LTS_architecture.png

79.5 KB
Loading

doc/架构图.png

-399 KB
Binary file not shown.

lts-job-tracker/src/main/java/com/lts/job/tracker/processor/JobPullProcessor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import com.lts.job.remoting.exception.RemotingCommandException;
77
import com.lts.job.remoting.protocol.RemotingCommand;
88
import com.lts.job.tracker.domain.JobTrackerApplication;
9-
import com.lts.job.tracker.support.JobDistributor;
9+
import com.lts.job.tracker.support.JobPusher;
1010
import io.netty.channel.ChannelHandlerContext;
1111

1212
/**
@@ -15,20 +15,20 @@
1515
*/
1616
public class JobPullProcessor extends AbstractProcessor {
1717

18-
private JobDistributor jobDistributor;
18+
private JobPusher jobPusher;
1919

2020
public JobPullProcessor(RemotingServerDelegate remotingServer, JobTrackerApplication application) {
2121
super(remotingServer, application);
2222

23-
jobDistributor = new JobDistributor(application);
23+
jobPusher = new JobPusher(application);
2424
}
2525

2626
@Override
2727
public RemotingCommand processRequest(final ChannelHandlerContext ctx, final RemotingCommand request) throws RemotingCommandException {
2828

2929
JobPullRequest requestBody = request.getBody();
3030

31-
jobDistributor.distribute(remotingServer, requestBody);
31+
jobPusher.push(remotingServer, requestBody);
3232

3333
return RemotingCommand.createResponseCommand(JobProtos.ResponseCode.JOB_PULL_SUCCESS.code(), "");
3434
}

lts-job-tracker/src/main/java/com/lts/job/tracker/support/JobDistributor.java renamed to lts-job-tracker/src/main/java/com/lts/job/tracker/support/JobPusher.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,24 @@
3232
* @author Robert HG (254963746@qq.com) on 8/18/14.
3333
* 任务分发管理
3434
*/
35-
public class JobDistributor {
35+
public class JobPusher {
3636

37-
private final Logger LOGGER = LoggerFactory.getLogger(JobDistributor.class);
37+
private final Logger LOGGER = LoggerFactory.getLogger(JobPusher.class);
3838
private JobTrackerApplication application;
3939
private final ExecutorService executor;
4040

41-
public JobDistributor(JobTrackerApplication application) {
41+
public JobPusher(JobTrackerApplication application) {
4242
this.application = application;
4343
executor = Executors.newFixedThreadPool(Constants.AVAILABLE_PROCESSOR * 5
44-
, new NamedThreadFactory(JobDistributor.class.getSimpleName()));
44+
, new NamedThreadFactory(JobPusher.class.getSimpleName()));
4545
}
4646

47-
public void distribute(final RemotingServerDelegate remotingServer, final JobPullRequest request) {
47+
public void push(final RemotingServerDelegate remotingServer, final JobPullRequest request) {
4848
executor.submit(new Runnable() {
4949
@Override
5050
public void run() {
5151
try {
52-
_sendJob(remotingServer, request);
52+
pushJob(remotingServer, request);
5353
} catch (Exception e) {
5454
LOGGER.error(e.getMessage(), e);
5555
}
@@ -64,7 +64,7 @@ public void run() {
6464
* @param remotingServer
6565
* @param request
6666
*/
67-
private void _sendJob(RemotingServerDelegate remotingServer, JobPullRequest request) {
67+
private void pushJob(RemotingServerDelegate remotingServer, JobPullRequest request) {
6868

6969
String nodeGroup = request.getNodeGroup();
7070
String identity = request.getIdentity();

0 commit comments

Comments
 (0)