Re: HttpClient thread seems waiting for stuff for a long time and do not stop

2018-06-11 Thread Oleg Kalnichevski
On Mon, 2018-06-11 at 23:33 +0800, zhangminglei wrote: > Hi, Oleg. I fixed it. Thank you. Codes below is nice. > > I would not dare call anything with Exception#e.printStackTrace in it nice, but that certainly should fix the resource leak issue. Oleg > > public class HttpClientWithSync { >  

Re: HttpClient thread seems waiting for stuff for a long time and do not stop

2018-06-11 Thread zhangminglei
Hi, Oleg. I fixed it. Thank you. Codes below is nice. public class HttpClientWithSync { public static void main(String[] args) { String url = "https://www.baidu.com/;; String url1 = "http://hc.apache.org/httpcomponents-client-4.5.x/tutorial/html/fundamentals.html;;

Re: HttpClient thread seems waiting for stuff for a long time and do not stop

2018-06-11 Thread zhangminglei
Yes. I know it is leaking connections…. But it can stop the program in the end. If I make the url the same, it can not stop…. > 在 2018年6月11日,下午11:16,Oleg Kalnichevski 写道: > > On Mon, 2018-06-11 at 23:13 +0800, zhangminglei wrote: >> Hi, Oleg. >> >> I found the interesting thing. If I change

Re: HttpClient thread seems waiting for stuff for a long time and do not stop

2018-06-11 Thread Oleg Kalnichevski
On Mon, 2018-06-11 at 23:13 +0800, zhangminglei wrote: > Hi, Oleg. > > I found the interesting thing. If I change the code like the below, > everything will be fine. No, it will not. Your code keeps on leaking connections. Please fix it. Oleg > I just make the url different from one of

Re: HttpClient thread seems waiting for stuff for a long time and do not stop

2018-06-11 Thread zhangminglei
Hi, Oleg. I found the interesting thing. If I change the code like the below, everything will be fine. I just make the url different from one of them. Url, Url1, Url2 . This time, the program can stoped. Confused….. Minglei. public class HttpClientWithSync { public static void

Re: HttpClient thread seems waiting for stuff for a long time and do not stop

2018-06-11 Thread zhangminglei
Hi, Oleg, Thank you for your response, But my question is why this program never stopped ? And always running… Minglei. > 在 2018年6月11日,下午8:27,Oleg Kalnichevski 写道: > > On Fri, 2018-06-08 at 15:30 +0800, zhangminglei wrote: >> Hi, friends. >> >> I am using HttpClient for a few tests. And I

Re: HttpClient thread seems waiting for stuff for a long time and do not stop

2018-06-11 Thread Oleg Kalnichevski
On Fri, 2018-06-08 at 15:30 +0800, zhangminglei wrote: > Hi, friends. > >  I am using HttpClient for a few tests. And I use the below code to > run without success. But the process never stoped.  > I use jstack for this and found it always wait for something. Could > you help me please ? Thanks.