|
@@ -25,10 +25,10 @@ public class HttpClientUtil {
|
|
|
}
|
|
|
|
|
|
public static HttpClientUtil instance(String name) {
|
|
|
- HttpClientUtil newObj = new HttpClientUtil();
|
|
|
- HttpClientUtil exist = instanceMap.putIfAbsent(name, newObj);
|
|
|
- if (exist == null) {
|
|
|
+ if (!instanceMap.containsKey(name)) {
|
|
|
+ HttpClientUtil newObj = new HttpClientUtil();
|
|
|
newObj.client = HttpClients.createDefault();
|
|
|
+ instanceMap.putIfAbsent(name, newObj);
|
|
|
}
|
|
|
HttpClientUtil instance = instanceMap.get(name);
|
|
|
return instance;
|