35 lines
784 B
Java
35 lines
784 B
Java
|
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);
|
||
|
}
|
||
|
}
|
||
|
}
|