[
https://issues.apache.org/jira/browse/MAPREDUCE-6542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15032209#comment-15032209
]
Daniel Templeton commented on MAPREDUCE-6542:
---------------------------------------------
[~piaoyu zhang], making good progress! Now we just need to tune.
# Please don't import *. Add an import line for every class.
# Your try-catch in the {{Worker.run()}} method should catch only
{{InterruptedException}} and {{BrokenBarrierException}}. Feel free to use a
multi-catch. Also, the catch in the {{Worker.run()}} method should not print
the stack trace. Instead you can add a comment that explains that you're
ignoring the exceptions. In production code, that would be a bad thing, but in
this simple test case I think it's OK.
# If it were me, I think I'd restructure the test a little. First I'd make the
barrier final. Then I'd replace the {{Worker}} inner class with an anonymous
inner class that does the same thing, except that it references the barrier
directly. I'd only instantiate one of those anonymous {{Runnable}} objects and
use it repeatedly in the loop. If that's unclear, let me know.
# I don't think there's a need to make {{currentTime}} and {{currentTime2}}
final. It is technically correct, but it's not helpful in this context, and
it's a little distracting. (And inconsistent. If {{currentTime}} is final,
why isn't {{time1}}?)
# If you have {{time1}} and {{time2}}, you should have {{currentTime1}} and
{{currentTime2}}. Actually, I'd rather they were called something more like
{{start}}, {{end}}, {{formattedTime1}}, and {{formattedTime2}}.
# Mind your whitespace. I generally like to have blank lines separating code
blocks (loops, methods, etc) from other code.
> HistoryViewer use SimpleDateFormat,But SimpleDateFormat is not threadsafe
> -------------------------------------------------------------------------
>
> Key: MAPREDUCE-6542
> URL: https://issues.apache.org/jira/browse/MAPREDUCE-6542
> Project: Hadoop Map/Reduce
> Issue Type: Bug
> Components: jobhistoryserver
> Affects Versions: 2.2.0, 2.7.1
> Environment: CentOS6.5 Hadoop
> Reporter: zhangyubiao
> Assignee: zhangyubiao
> Attachments: MAPREDUCE-6542-v2.patch, MAPREDUCE-6542-v3.patch,
> MAPREDUCE-6542-v4.patch, MAPREDUCE-6542-v5.patch, MAPREDUCE-6542-v6.patch,
> MAPREDUCE-6542.patch
>
>
> I use SimpleDateFormat to Parse the JobHistory File before
> {code}
> private static final SimpleDateFormat dateFormat =
> new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
> public static String getJobDetail(JobInfo job) {
> StringBuffer jobDetails = new StringBuffer("");
> SummarizedJob ts = new SummarizedJob(job);
> jobDetails.append(job.getJobId().toString().trim()).append("\t");
> jobDetails.append(job.getUsername()).append("\t");
> jobDetails.append(job.getJobname().replaceAll("\\n",
> "")).append("\t");
> jobDetails.append(job.getJobQueueName()).append("\t");
> jobDetails.append(job.getPriority()).append("\t");
> jobDetails.append(job.getJobConfPath()).append("\t");
> jobDetails.append(job.getUberized()).append("\t");
>
> jobDetails.append(dateFormat.format(job.getSubmitTime())).append("\t");
>
> jobDetails.append(dateFormat.format(job.getLaunchTime())).append("\t");
>
> jobDetails.append(dateFormat.format(job.getFinishTime())).append("\t");
> return jobDetails.toString();
> }
> {code}
> But I find I query the SubmitTime and LaunchTime in hive and compare
> JobHistory File time , I find that the submitTime and launchTime was wrong.
> Finally,I change to use the FastDateFormat to parse the time format and the
> time become right
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)