[ 
https://issues.apache.org/jira/browse/HADOOP-4187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12641324#action_12641324
 ] 

Tom White commented on HADOOP-4187:
-----------------------------------

bq. The removing of JobConf and JobConfigurable code from util.ReflectionUtils 
might break the applications as ReflectionUtils.newInstance and setConf are 
public apis; user code may be banking on to it to instantiate JobConfigurable 
objects.

To deal with this we could use reflection to do JobConfigurable configuration 
if the classes are present at runtime. This will break the compile-time 
dependency, which I think is sufficient for 0.20. Something like

{code}
Class<?> jobConfClass = Class.forName("org.apache.hadoop.mapred.JobConf");
Class<?> jobConfigurableClass = 
Class.forName("org.apache.hadoop.mapred.JobConfigurable");
 if (conf.getClass().isAssignableFrom(jobConfClass) &&
      theObject.getClass().isAssignableFrom(jobConfigurableClass)) {
  Method configureMethod = jobConfigurableClass.getMethod("configure", 
jobConfClass);
  configureMethod.invoke(theObject, conf);
}
{code}

We would need to be careful with classloading here.

The alternative is to make an incompatible change in 0.20. In this case I think 
it is OK to make mapred.ReflectionUtils public, since it will be deprecated 
(along with the whole mapred package) once HADOOP-1230 is finished.

> Create a MapReduce-specific ReflectionUtils that handles JobConf and 
> JobConfigurable
> ------------------------------------------------------------------------------------
>
>                 Key: HADOOP-4187
>                 URL: https://issues.apache.org/jira/browse/HADOOP-4187
>             Project: Hadoop Core
>          Issue Type: Sub-task
>            Reporter: Tom White
>


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

Reply via email to