hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrian Woodhead (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HADOOP-2268) Job.java should expose jobs as Lists rather than ArrayLists
Date Thu, 29 Nov 2007 12:58:43 GMT

     [ https://issues.apache.org/jira/browse/HADOOP-2268?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Adrian Woodhead updated HADOOP-2268:
------------------------------------

    Attachment: HADOOP-2268-2.patch

Code review of this patch please. 

I have not added extra methods with different names as it's not as simple as just the depending
jobs - in JobControl.java there is the same issue with getReadyJobs, getSuccessfulJobs and
getFailedJobs. 

What I have done is as follows:

Job.java
Changed all ArrayList to List<Job>. This shouldn't have much of an impact on existing
code except for the getDependingJobs method (this was only added in the last release so I
don't know how much it is being used).

ValueAggregatorJob.java
Changed all ArrayList to List<Job>.This class didn't need to be changed (no compile
errors), I just did it to be consistent.

JobControl.java
Changed all Hashtable for job collections to Maps. These only appear to be used internally
by private methods so this should have no impact on other code.
Changed all methods returning ArrayList<Job> to return List<Job> (this might impact
existing code, but it is a really easy fix, just changing the type of whatever you are assigning
the result to).

So, I think this cleans up these classes to adhere to the "program to the interface not the
implementation" principle, it is up to you guys to decide whether you want to do this directly
or whether you want to deprecate old methods, introduce new ones etc. If you go for the latter
I'm not sure what good names would be for the  getReadyJobs, getSuccessfulJobs and getFailedJobs
methods.

> Job.java should expose jobs as Lists rather than ArrayLists
> -----------------------------------------------------------
>
>                 Key: HADOOP-2268
>                 URL: https://issues.apache.org/jira/browse/HADOOP-2268
>             Project: Hadoop
>          Issue Type: Improvement
>          Components: mapred
>    Affects Versions: 0.15.0
>            Reporter: Adrian Woodhead
>            Assignee: Adrian Woodhead
>            Priority: Minor
>             Fix For: 0.16.0
>
>         Attachments: HADOOP-2268-1.patch, HADOOP-2268-2.patch
>
>
> See HADOOP-2202 for background on this issue. Arun C. Murthy agrees that when possible
it is preferable to program against the interface rather than a concrete implementation (more
flexible, allows for changes of the implementation in future etc.) JobControl currently exposes
running, waiting, ready, successful and dependent jobs as ArrayList rather than List. I propose
to change this to List.
> I will code up a patch for this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message