ecology_maven/aiyh/utils/httpUtil/util/CloseThread.java

35 lines
784 B
Java
Raw Normal View History

2021-11-14 15:29:16 +08:00
package aiyh.utils.httpUtil.util;
import aiyh.utils.httpUtil.ExtendedIOUtils;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.impl.client.CloseableHttpClient;
/**
* @author EBU7-dev1-ayh
* @create 2021/11/5 0005 16:09
*/
public class CloseThread implements Runnable {
private CloseableHttpClient httpClient;
private CloseableHttpResponse response;
public CloseThread(CloseableHttpClient httpClient, CloseableHttpResponse response) {
this.httpClient = httpClient;
this.response = response;
}
@Override
public void run() {
try {
Thread.sleep(1000 * 60);
} catch (InterruptedException e) {
e.printStackTrace();
}finally {
ExtendedIOUtils.closeQuietly(httpClient);
ExtendedIOUtils.closeQuietly(response);
}
}
}