{"action":"created","issue":{"url":"https://api.github.com/repos/chanjarster/weixin-java-tools/issues/256","labels_url":"https://api.github.com/repos/chanjarster/weixin-java-tools/issues/256/labels{/name}","comments_url":"https://api.github.com/repos/chanjarster/weixin-java-tools/issues/256/comments","events_url":"https://api.github.com/repos/chanjarster/weixin-java-tools/issues/256/events","html_url":"https://github.com/chanjarster/weixin-java-tools/issues/256","id":124884813,"number":256,"title":"httpclient没有close， CloseableHttpResponse也没有close","user":{"login":"sugar-xj","id":788689,"avatar_url":"https://avatars.githubusercontent.com/u/788689?v=3","gravatar_id":"","url":"https://api.github.com/users/sugar-xj","html_url":"https://github.com/sugar-xj","followers_url":"https://api.github.com/users/sugar-xj/followers","following_url":"https://api.github.com/users/sugar-xj/following{/other_user}","gists_url":"https://api.github.com/users/sugar-xj/gists{/gist_id}","starred_url":"https://api.github.com/users/sugar-xj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sugar-xj/subscriptions","organizations_url":"https://api.github.com/users/sugar-xj/orgs","repos_url":"https://api.github.com/users/sugar-xj/repos","events_url":"https://api.github.com/users/sugar-xj/events{/privacy}","received_events_url":"https://api.github.com/users/sugar-xj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-05T02:55:15Z","updated_at":"2016-01-05T05:03:25Z","closed_at":null,"body":"每天5AM 我的程序会启动10个线程同步所有用户的信息，但是每隔3天我就必须重启tomcat，原因是close—wait 的tcp链接很多，没有释放\r\nCloseableHttpResponse response = httpclient.execute(httpGet)) \r\n\r\nhttpclient 和 CloseableHttpResponse 没有调用 close方法\r\n\r\ntry (CloseableHttpResponse response = httpclient.execute(httpGet)) {\r\n      String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response);\r\n      WxError error = WxError.fromJson(responseContent);\r\n      if (error.getErrorCode() != 0) {\r\n        throw new WxErrorException(error);\r\n      }\r\n      return responseContent;\r\n    }finally {\r\n            response.close();\r\n            httpclient.close();\r\n      }\r\n"},"comment":{"url":"https://api.github.com/repos/chanjarster/weixin-java-tools/issues/comments/168898297","html_url":"https://github.com/chanjarster/weixin-java-tools/issues/256#issuecomment-168898297","issue_url":"https://api.github.com/repos/chanjarster/weixin-java-tools/issues/256","id":168898297,"user":{"login":"chanjarster","id":612413,"avatar_url":"https://avatars.githubusercontent.com/u/612413?v=3","gravatar_id":"","url":"https://api.github.com/users/chanjarster","html_url":"https://github.com/chanjarster","followers_url":"https://api.github.com/users/chanjarster/followers","following_url":"https://api.github.com/users/chanjarster/following{/other_user}","gists_url":"https://api.github.com/users/chanjarster/gists{/gist_id}","starred_url":"https://api.github.com/users/chanjarster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chanjarster/subscriptions","organizations_url":"https://api.github.com/users/chanjarster/orgs","repos_url":"https://api.github.com/users/chanjarster/repos","events_url":"https://api.github.com/users/chanjarster/events{/privacy}","received_events_url":"https://api.github.com/users/chanjarster/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T05:03:25Z","updated_at":"2016-01-05T05:03:25Z","body":"https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html\r\n\r\n``\r\nNote: A try-with-resources statement can have catch and finally blocks just like an ordinary try statement. In a try-with-resources statement, any catch or finally block is run after the resources declared have been closed.\r\n``"}}