Skip to content

Commit

Permalink
#54 reduce zookeeper load by optimizing the read/write during the exe…
Browse files Browse the repository at this point in the history
…cution of the job
  • Loading branch information
chembohuang committed Jan 10, 2017
1 parent d0c57ed commit caad63f
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,18 @@ private ExecutionInfo getExecutionInfo(final String jobName, final String item)
result.setLastBeginTime(null == lastBeginTime ? null : dateFormat.format(new Date(Long.parseLong(lastBeginTime))));
String nextFireTime = curatorFrameworkOp.getData(JobNodePath.getExecutionNodePath(jobName, item, "nextFireTime"));
result.setNextFireTime(null == nextFireTime ? null : dateFormat.format(new Date(Long.parseLong(nextFireTime))));
if (completed) {
String lastCompleteTime = curatorFrameworkOp.getData(JobNodePath.getExecutionNodePath(jobName, item, "lastCompleteTime"));
result.setLastCompleteTime(null == lastCompleteTime ? null : dateFormat.format(new Date(Long.parseLong(lastCompleteTime))));
}
String lastCompleteTime = curatorFrameworkOp.getData(JobNodePath.getExecutionNodePath(jobName, item, "lastCompleteTime"));
if (lastCompleteTime != null) {
long lastCompleteTimeLong = Long.parseLong(lastCompleteTime);
if (lastBeginTime == null) {
result.setLastCompleteTime(dateFormat.format(new Date(lastCompleteTimeLong)));
} else {
long lastBeginTimeLong = Long.parseLong(lastBeginTime);
if (lastCompleteTimeLong > lastBeginTimeLong) {
result.setLastCompleteTime(dateFormat.format(new Date(lastCompleteTimeLong)));
}
}
}
if (running) {
long mtime = curatorFrameworkOp.getMtime(JobNodePath.getExecutionNodePath(jobName, item, "running"));
result.setTimeConsumed( (new Date().getTime() - mtime)/1000 );
Expand Down

0 comments on commit caad63f

Please sign in to comment.