#
Junjie
1 天以前 98d120bd0633e4e0717d584cae5514132a18516b
src/main/java/com/zy/common/utils/HttpHandler.java
@@ -51,9 +51,12 @@
            }
        }
        Request request = headerBuilder.url(url).build();
        Response response = getClient(timeout, timeUnit).newCall(request).execute();
        OkHttpClient client = getClient(timeout, timeUnit);
        Response response = client.newCall(request).execute();
        String result = response.isSuccessful() ? response.body().string() : null;
        response.close();
        try { client.dispatcher().executorService().shutdown(); } catch (Exception ignore) {}
        try { client.connectionPool().evictAll(); } catch (Exception ignore) {}
        return result;
    }
@@ -86,10 +89,13 @@
            request = builder.post(body).build();
        }
        Call call = getClient(timeout, timeUnit).newCall(request);
        OkHttpClient client = getClient(timeout, timeUnit);
        Call call = client.newCall(request);
        Response response = call.execute();
        String result = response.body().string();
        response.close();
        try { client.dispatcher().executorService().shutdown(); } catch (Exception ignore) {}
        try { client.connectionPool().evictAll(); } catch (Exception ignore) {}
        return result;
    }