[
https://issues.apache.org/jira/browse/HTTPASYNC-119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
wang qi updated HTTPASYNC-119:
------------------------------
Description:
When I developed with the latest HttpAsyncclient, it was hard for me to know
whether the IO thread in BaseIOReactor was alive。 For example, if I throw an
error in the callback,the IO thread will terminate,but the connecting thread
will not check if the IO thread is alive,and will still add new channels to
the dispatcher。
The java code:
CloseableHttpAsyncClient client = HttpAsyncClients.custom().build();
client.start();
HttpUriRequest getRequest = new HttpGet("www.google.com");
client.execute(getRequest, new FutureCallback<HttpResponse>() {
@Override
public void completed(HttpResponse result) {
throw new StackOverflowError();
}
@Override
public void failed(Exception ex) {
}
@Override
public void cancelled() {
}
});
for(int i = 0 ; i < 100 ; i++){
client.execute(getRequest, new FutureCallback<HttpResponse>() {
@Override
public void completed(HttpResponse result) {
}
@Override
public void failed(Exception ex) {
}
@Override
public void cancelled() {
}
});
}
one of the IO threads is dead,but the java Error dose not be caught,and hte
client will continue work and add new channels to the dispather, but the
newChannel queue will be not be consumed, so I want to know is there any method
to deal with this situation.
Thanks
was:
When I developed with HttpAsyncclient, it was hard for me to know whether the
IO thread in BaseIOReactor was alive。 For example, if I throw an error in the
callback,the IO thread will terminate,but the connecting thread will not check
if the IO thread is alive,and will still add new channels to the dispatcher。
The java code:
CloseableHttpAsyncClient client = HttpAsyncClients.custom().build();
client.start();
HttpUriRequest getRequest = new HttpGet("www.google.com");
client.execute(getRequest, new FutureCallback<HttpResponse>() {
@Override
public void completed(HttpResponse result) {
throw new StackOverflowError();
}
@Override
public void failed(Exception ex) {
}
@Override
public void cancelled() {
}
});
for(int i = 0 ; i < 100 ; i++){
client.execute(getRequest, new FutureCallback<HttpResponse>() {
@Override
public void completed(HttpResponse result) {
}
@Override
public void failed(Exception ex) {
}
@Override
public void cancelled() {
}
});
}
one of the IO threads is dead,but the java Error dose not be caught,and hte
client will continue work and add new channels to the dispather, but the
newChannel queue will be not be consumed, so I want to know is there any method
to deal with this situation.
Thanks
> The client dose not check if the IO thread is alive
> ---------------------------------------------------
>
> Key: HTTPASYNC-119
> URL: https://issues.apache.org/jira/browse/HTTPASYNC-119
> Project: HttpComponents HttpAsyncClient
> Issue Type: Bug
> Environment: Mac OSX, Java 8
> Reporter: wang qi
>
> When I developed with the latest HttpAsyncclient, it was hard for me to know
> whether the IO thread in BaseIOReactor was alive。 For example, if I throw an
> error in the callback,the IO thread will terminate,but the connecting thread
> will not check if the IO thread is alive,and will still add new channels to
> the dispatcher。
> The java code:
> CloseableHttpAsyncClient client = HttpAsyncClients.custom().build();
> client.start();
> HttpUriRequest getRequest = new HttpGet("www.google.com");
> client.execute(getRequest, new FutureCallback<HttpResponse>() {
> @Override
> public void completed(HttpResponse result) {
> throw new StackOverflowError();
> }
> @Override
> public void failed(Exception ex) {
> }
> @Override
> public void cancelled() {
> }
> });
> for(int i = 0 ; i < 100 ; i++){
> client.execute(getRequest, new FutureCallback<HttpResponse>() {
> @Override
> public void completed(HttpResponse result) {
>
> }
> @Override
> public void failed(Exception ex) {
> }
> @Override
> public void cancelled() {
> }
> });
> }
> one of the IO threads is dead,but the java Error dose not be caught,and hte
> client will continue work and add new channels to the dispather, but the
> newChannel queue will be not be consumed, so I want to know is there any
> method to deal with this situation.
> Thanks
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]