Skip to content

Commit

Permalink
fix NPE for buildTaskId
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Apr 7, 2017
1 parent a000cd2 commit 18bd679
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ private void setGuaranteeServiceForElasticJobListeners(final CoordinatorRegistry
public void init() {
JobRegistry.getInstance().setCurrentShardingTotalCount(liteJobConfig.getJobName(), liteJobConfig.getTypeConfig().getCoreConfig().getShardingTotalCount());
JobScheduleController jobScheduleController = new JobScheduleController(createScheduler(), createJobDetail(liteJobConfig.getTypeConfig().getJobClass()), liteJobConfig.getJobName());
jobScheduleController.scheduleJob(liteJobConfig.getTypeConfig().getCoreConfig().getCron());
JobRegistry.getInstance().registerJob(liteJobConfig.getJobName(), jobScheduleController, regCenter);
schedulerFacade.registerStartUpInfo(liteJobConfig);
jobScheduleController.scheduleJob(liteJobConfig.getTypeConfig().getCoreConfig().getCron());
}

private JobDetail createJobDetail(final String jobClass) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public ShardingContexts getJobShardingContext(final List<Integer> shardingItems)
}

private String buildTaskId(final LiteJobConfiguration liteJobConfig, final List<Integer> shardingItems) {
return Joiner.on("@-@").join(liteJobConfig.getJobName(), Joiner.on(",").join(shardingItems), "READY", JobRegistry.getInstance().getJobInstance(jobName).getJobInstanceId());
String jobInstanceId = JobRegistry.getInstance().getJobInstance(jobName).getJobInstanceId();
return Joiner.on("@-@").join(liteJobConfig.getJobName(), Joiner.on(",").join(shardingItems), "READY", null == jobInstanceId ? "127.0.0.1@-@1" : jobInstanceId);
}

private void removeRunningIfMonitorExecution(final boolean monitorExecution, final List<Integer> shardingItems) {
Expand Down

0 comments on commit 18bd679

Please sign in to comment.