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

Rohith Sharma K S commented on YARN-8834:
-----------------------------------------

Thanks [~abmodi] for the patch! Few comments
TimelineReaderClientImpl.java
# {{client = Client.create(cc);}}  should handle security login. So webclient 
should be created like below. Otherwise try making use of TimelineConnector but 
it retry internally few minutes.. 
{code}
webServiceClient = new Client(new URLConnectionClientHandler(
          new HttpURLConnectionFactory() {
          @Override
          public HttpURLConnection getHttpURLConnection(URL url)
              throws IOException {
            AuthenticatedURL.Token token = new AuthenticatedURL.Token();
            HttpURLConnection conn = null;
            try {
              conn = new AuthenticatedURL().openConnection(url, token);
            } catch (AuthenticationException e) {
              throw new IOException(e);
            }
            return conn;
          }
        }));
{code}
# I think we should create generic method improving the existing doGetUri to 
take multiple parameters which construct query parameter.   Say doGetUri(URI 
base, String path, MultivaluedMap<String, String> params). This could avoid 
code duplication.
# "application/json" could be changed to make use of 
MediaType.APPLICATION_JSON. 
# Add a test case for retrieval of entities. If we refactor the code, then in 
test getEntities method could be override and mock it.

> Provide Java client for fetching entities from TimelineReader
> -------------------------------------------------------------
>
>                 Key: YARN-8834
>                 URL: https://issues.apache.org/jira/browse/YARN-8834
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: timelinereader
>            Reporter: Rohith Sharma K S
>            Assignee: Abhishek Modi
>            Priority: Critical
>         Attachments: YARN-8834.001.patch
>
>
> While reviewing YARN-8303, we felt that it is necessary to provide 
> TimelineReaderClient which wraps all the REST calls in it so that user can 
> just provide EntityType and EntityId along with filters.Currently fetching 
> entities from TimelineReader is only via REST call or somebody need to write 
> java client get entities.
> It is good to provide TimelineReaderClient which fetch entities from 
> TimelineReaderServer. This will be more useful.



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

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

Reply via email to