You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-issues@hadoop.apache.org by "Zhijie Shen (JIRA)" <ji...@apache.org> on 2013/11/14 04:27:23 UTC

[jira] [Commented] (MAPREDUCE-5215) mapreduce.Job is missing getJobClient() so its incompatible with MR1

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

Zhijie Shen commented on MAPREDUCE-5215:
----------------------------------------

I checked the code of scoobi:

{code}
  /** invoke a method using reflection even if it is private or protected */
  def invokeProtected[T](klass: Class[_], instance: Any, methodName: String) = {
    val method = klass.getDeclaredMethod(methodName)
    method.setAccessible(true)
    method.invoke(instance).asInstanceOf[T]
  }
{code}

{code}
  /**
   * The getJobClient method is package-protected for hadoop < 2.0 and public after that.
   * Here we use reflection to get a uniform access to the job client
   */
  private lazy val getJobClient: JobClient = invokeProtected[JobClient](classOf[Job], job, "getJobClient")
{code}

Sigh, it's fine for users to leverage java reflection to invoke a method, however, it's no good of accessing the *non-public* method. If users bypass the accessibility check, they should be aware of the risk of being broken. I'm wondering this is case we'd like to fix. If we really should, we have to exhaustively revisit all the methods/fields. It would be nightmare.

> mapreduce.Job is missing getJobClient() so its incompatible with MR1
> --------------------------------------------------------------------
>
>                 Key: MAPREDUCE-5215
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-5215
>             Project: Hadoop Map/Reduce
>          Issue Type: Sub-task
>          Components: mrv2
>    Affects Versions: 2.2.0
>            Reporter: Robert Kanter
>            Assignee: Robert Kanter
>            Priority: Blocker
>         Attachments: MAPREDUCE-5215.patch, MAPREDUCE-5215.patch, MAPREDUCE-5215.patch
>
>
> The method {{org.apache.hadoop.mapred.JobClient getJobClient()}} is in MR1's {{mapreduce.Job}} but doesn't exist in MR2's, which makes them incompatible.  MR2's implementation of {{Job}} doesn't use a JobClient object, but we can create one and return it.



--
This message was sent by Atlassian JIRA
(v6.1#6144)