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

Íñigo Goiri commented on HDFS-14545:
------------------------------------

Thanks [~ayushtkn] for pushing the update.
* For RouterProtocols I was referring to have {{interface RouterProtocols 
implements ClientProtocol, NamenodeProtocol, RefreshUserMappingsProtocol, 
GetUserMappingsProtocol}}. Having the one you added {{RouterProtocol}} to be 
{{RouterUserProtocol}} looks good though.
* Fix the minor checkstyles.
* Before anything, we should probably check if the protocol exists on the map 
and if not throw the current exception as that's the right "Unsupported 
protocol".
* I think we can use templates to wrap the getNewConnection() and the generic 
constructor with something like:
{code}

  private static <T> T newProtoClient(
      Class<T> proto, ProtoImpl classes, Object proxy) {
    Class<?> clazz0 = classes.protoPb;
    Class<?> clazz1 = classes.protoClientPb;
    try {
      Constructor<?> constructor = clazz1.getConstructor(clazz0);
      Object o = constructor.newInstance(new Object[] {proxy});
      if (proto.isAssignableFrom(o.getClass())) {
        @SuppressWarnings("unchecked")
        T client = (T)o;
        return client;
      }
    } catch (Exception e) {
      LOG.error("");
    }
    return null;
  }
{code}
It should be possible to make it fancier with better generics.

> RBF: Router should support GetUserMappingsProtocol
> --------------------------------------------------
>
>                 Key: HDFS-14545
>                 URL: https://issues.apache.org/jira/browse/HDFS-14545
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Íñigo Goiri
>            Assignee: Ayush Saxena
>            Priority: Major
>         Attachments: HDFS-14545-HDFS-13891-01.patch, 
> HDFS-14545-HDFS-13891-02.patch, HDFS-14545-HDFS-13891-03.patch, 
> HDFS-14545-HDFS-13891-04.patch, HDFS-14545-HDFS-13891-05.patch, 
> HDFS-14545-HDFS-13891-06.patch, HDFS-14545-HDFS-13891.000.patch
>
>
> We should be able to check the groups for a user from a Router.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to