[ https://issues.apache.org/jira/browse/MAPREDUCE-954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12753198#action_12753198 ]
Owen O'Malley commented on MAPREDUCE-954: ----------------------------------------- bq. I'd be interested to hear more about what the problem was here. Is it in intrinsic problem caused by using abstract classes, or could we improve this by using better encapsulation? The problem came about because of the generics and the way we set it up. Basically, if we do: {noformat} public abstract class TaskContext<K1,V1,K2,V2> { public abstract K1 getKey(); ... } public class Mapper<K1,V1,K2,V2> { public class Context extends TaskContext<K1,V1,K2,V2> { public Context(.... a lot of implementation details ... ) { ... details ... } public K1 getKey() { ... details ... } } } {noformat} Since Mapper.Context is an inner class, it has to be concrete. Clearly, my goal for this jira was to remove the implementation details. After playing with prototypes, I'd suggest we back off of interfaces and make it look like: {noformat} public abstract class TaskContext<K1,V1,K2,V2> { ... } public class Mapper<K1,V1,K2,V2> { public abstract class Context extends TaskContext<K1,V1,K2,V2> { } } {noformat} and then the implementation can be done as: {noformat} class MapperImpl<K1,V1,K2,V2> extends Mapper<K1,V1,K2,V2> { class ContextImpl implements Context { ... details ... } } {noformat} > The new interface's Context objects should be interfaces > -------------------------------------------------------- > > Key: MAPREDUCE-954 > URL: https://issues.apache.org/jira/browse/MAPREDUCE-954 > Project: Hadoop Map/Reduce > Issue Type: Improvement > Components: client > Reporter: Owen O'Malley > Assignee: Arun C Murthy > Fix For: 0.21.0 > > Attachments: MAPREDUCE-954.patch > > > When I was doing HADOOP-1230, I was persuaded to make the Context objects as > classes. I think that was a serious mistake. It caused a lot of information > leakage into the public classes. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.