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

Oleg Kalnichevski commented on HTTPASYNC-131:
---------------------------------------------

Think of it as a maximum period of inactivity between two consecutive packets. 
One can decrease select time of the i/o reactor to a smaller value but that 
will cause the reactor to loop through open sessions more often and consume 
more CPU cycles. 

Oleg

> SocketTimeout doesn't work for me
> ---------------------------------
>
>                 Key: HTTPASYNC-131
>                 URL: https://issues.apache.org/jira/browse/HTTPASYNC-131
>             Project: HttpComponents HttpAsyncClient
>          Issue Type: Bug
>    Affects Versions: 4.1.3
>         Environment: httpasyncclient-4.1.3.jar
> httpcore-4.4.7.jar
> httpcore-nio-4.4.7.jar
>            Reporter: ccin
>            Priority: Critical
>
> my code is like this,but the timeout config doesn't work for me,i still get a 
> response more than 100ms which i expect a timeout exception.Is there 
> something wrong with my code?ths for your help
> {code:java}
>         RequestConfig requestConfig = RequestConfig.custom()
>                 .setConnectTimeout(50)
>                 .setSocketTimeout(50)
>                 
> .setConnectionRequestTimeout(config.getConnectTimeout()).build();
>         Registry<SchemeIOSessionStrategy> sessionStrategyRegistry = 
> RegistryBuilder
>                 .<SchemeIOSessionStrategy>create()
>                 .register("http", NoopIOSessionStrategy.INSTANCE)
>                 .build();
>         IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
>                 .setIoThreadCount(Runtime.getRuntime().availableProcessors())
>                 .setSoTimeout(50)
>                 .setConnectTimeout(50)
>                 .build();
>         ConnectingIOReactor ioReactor = new 
> DefaultConnectingIOReactor(ioReactorConfig);
>         PoolingNHttpClientConnectionManager conMgr = new 
> PoolingNHttpClientConnectionManager(
>                 ioReactor, null, sessionStrategyRegistry, null);
>         conMgr.setMaxTotal(config.getPoolSize());
>         conMgr.setDefaultMaxPerRoute(config.getMaxPerRoute());
>         ConnectionConfig connectionConfig = ConnectionConfig.custom()
>                 .setMalformedInputAction(CodingErrorAction.IGNORE)
>                 .setUnmappableInputAction(CodingErrorAction.IGNORE)
>                 .setCharset(Consts.UTF_8).build();
>         conMgr.setDefaultConnectionConfig(connectionConfig);
>         CloseableHttpAsyncClient client = 
> HttpAsyncClients.custom().setConnectionManager(conMgr)
>                 .setDefaultCookieStore(new BasicCookieStore())
>                 .setDefaultRequestConfig(requestConfig).build();
>         client.start();
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to