[
https://issues.apache.org/jira/browse/YARN-11492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17722093#comment-17722093
]
ASF GitHub Bot commented on YARN-11492:
---------------------------------------
slfan1989 commented on code in PR #5636:
URL: https://github.com/apache/hadoop/pull/5636#discussion_r1192144572
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/RouterWebServiceUtil.java:
##########
@@ -363,14 +363,30 @@ public static AppsInfo mergeAppsInfo(ArrayList<AppInfo>
appsInfo,
*/
protected static Client createJerseyClient(Configuration conf) {
Client client = Client.create();
- client.setConnectTimeout((int) conf
- .getTimeDuration(YarnConfiguration.ROUTER_WEBAPP_CONNECT_TIMEOUT,
- YarnConfiguration.DEFAULT_ROUTER_WEBAPP_CONNECT_TIMEOUT,
- TimeUnit.MILLISECONDS));
- client.setReadTimeout((int) conf
- .getTimeDuration(YarnConfiguration.ROUTER_WEBAPP_READ_TIMEOUT,
- YarnConfiguration.DEFAULT_ROUTER_WEBAPP_READ_TIMEOUT,
- TimeUnit.MILLISECONDS));
+
+ long connectTimeOut =
conf.getTimeDuration(YarnConfiguration.ROUTER_WEBAPP_CONNECT_TIMEOUT,
+ YarnConfiguration.DEFAULT_ROUTER_WEBAPP_CONNECT_TIMEOUT,
TimeUnit.MILLISECONDS);
+ long readTimeout =
conf.getTimeDuration(YarnConfiguration.ROUTER_WEBAPP_READ_TIMEOUT,
Review Comment:
Thank you for your help to review the code! I will modify the code.
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestRouterWebServiceUtil.java:
##########
@@ -678,4 +682,45 @@ public void testMergeDiffApplicationStatisticsInfo() {
Assert.assertEquals(YarnApplicationState.FINISHED, item3Result.getState());
Assert.assertEquals(item4.getCount(), item3Result.getCount());
}
+
+ @Test
+ public void testCreateJerseyClient() {
+ // Case1, default timeout, The default timeout is 30s.
+ YarnConfiguration configuration = new YarnConfiguration();
+ Client client01 = RouterWebServiceUtil.createJerseyClient(configuration);
+ Map<String, Object> properties = client01.getProperties();
+ Object readTimeOut = properties.get(ClientConfig.PROPERTY_READ_TIMEOUT);
Review Comment:
I will modify the code.
> Improve createJerseyClient#setConnectTimeout Code
> -------------------------------------------------
>
> Key: YARN-11492
> URL: https://issues.apache.org/jira/browse/YARN-11492
> Project: Hadoop YARN
> Issue Type: Improvement
> Components: federation
> Affects Versions: 3.4.0
> Reporter: Shilun Fan
> Assignee: Shilun Fan
> Priority: Major
> Labels: pull-request-available
>
> createJerseyClient#setConnectTimeout There is a type conversion code that
> converts long to int, we should be careful with this part of code, I added
> some verification rules.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]