-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e771950
commit 44661c7
Showing
9 changed files
with
25 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package com.lts.jobtracker.complete.chain; | ||
|
||
import com.lts.core.commons.utils.CollectionUtils; | ||
import com.lts.core.commons.utils.StringUtils; | ||
import com.lts.core.constant.Constants; | ||
import com.lts.core.domain.Action; | ||
import com.lts.core.domain.Job; | ||
|
@@ -21,6 +22,7 @@ | |
|
||
/** | ||
* 任务完成 Chian | ||
* | ||
* @author Robert HG ([email protected]) on 11/11/15. | ||
*/ | ||
public class JobProcessChain implements JobCompletedChain { | ||
|
@@ -82,7 +84,7 @@ private void singleResultsProcess(List<TaskTrackerJobResult> results) { | |
|
||
if (!needRetry(result)) { | ||
// 这种情况下,如果要反馈客户端的,直接反馈客户端,不进行重试 | ||
if (result.getJobWrapper().getJob().isNeedFeedback()) { | ||
if (isNeedFeedback(result.getJobWrapper().getJob())) { | ||
clientNotifier.send(results); | ||
} else { | ||
jobFinishHandler.onComplete(results); | ||
|
@@ -131,7 +133,7 @@ private void multiResultsProcess(List<TaskTrackerJobResult> results) { | |
retryResults = new ArrayList<TaskTrackerJobResult>(); | ||
} | ||
retryResults.add(result); | ||
} else if (result.getJobWrapper().getJob().isNeedFeedback()) { | ||
} else if (isNeedFeedback(result.getJobWrapper().getJob())) { | ||
// 需要反馈给客户端 | ||
if (feedbackResults == null) { | ||
feedbackResults = new ArrayList<TaskTrackerJobResult>(); | ||
|
@@ -156,4 +158,12 @@ private void multiResultsProcess(List<TaskTrackerJobResult> results) { | |
retryHandler.onComplete(retryResults); | ||
} | ||
|
||
private boolean isNeedFeedback(Job job) { | ||
if (job == null) { | ||
return false; | ||
} | ||
// 容错,如果没有提交节点组,那么不反馈 | ||
return !StringUtils.isEmpty(job.getSubmitNodeGroup()) && job.isNeedFeedback(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
lts-startup 模块主要是提供一些脚本启动的扩展 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,6 @@ | |
|
||
import com.lts.tasktracker.TaskTracker; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* @author Robert HG ([email protected]) on 9/11/15. | ||
*/ | ||
|
@@ -26,10 +24,6 @@ public static void start(String cfgPath) { | |
taskTracker = DefaultStartup.start(cfg); | ||
} | ||
|
||
for (Map.Entry<String, String> config : cfg.getConfigs().entrySet()) { | ||
taskTracker.addConfig(config.getKey(), config.getValue()); | ||
} | ||
|
||
taskTracker.start(); | ||
|
||
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { | ||
|