hadoop-mapreduce-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Templeton (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MAPREDUCE-6542) HistoryViewer use SimpleDateFormat,But SimpleDateFormat is not threadsafe
Date Wed, 11 Nov 2015 18:45:11 GMT

    [ https://issues.apache.org/jira/browse/MAPREDUCE-6542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15000875#comment-15000875
] 

Daniel Templeton commented on MAPREDUCE-6542:
---------------------------------------------

[~piaoyu zhang], I'd rather keep the method name the same and let the parameter types distinguish
it.

I strongly suspect that {{HistoryViewer}} is the only code in Hadoop using the current ({{DateFormat}}
version) of the method.  You should check.  There may be client code using it, though.  If
it really is otherwise unused within Hadoop, I would consider marking the {{DateFormat}} version
of the method as deprecated when you add the {{FastDateFormat}} version.  [~vinodkv], any
thoughts on that?

The alternative would be to keep both methods and refactor out the common parts into a third
private method.

> 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.patch
>
>
> I use SimpleDateFormat to Parse the JobHistory File before 
> 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();
> }
> 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 chang 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)

Mime
View raw message