Infinite loop in rest client
@@ -74,7 +74,8 @@ public class ClientImpl implements Client {
private TLSConfiguration secConfig;
private boolean closed;
private Set<WebClient> baseClients =
- Collections.newSetFromMap(new WeakHashMap<WebClient, Boolean>());
+ Collections.synchronizedSet(Collections.newSetFromMap(new WeakHashMap<WebClient, Boolean>()));
+
public ClientImpl(Configuration config,
TLSConfiguration secConfig) {
configImpl = new ClientConfigurableImpl<Client>(this, config);
@@ -84,9 +85,11 @@ public class ClientImpl implements Client {
@Override
public void close() {
if (!closed) {
+ synchronized (baseClients) {
for (WebClient wc : baseClients) {
wc.close();
}
+ }
baseClients = null;
closed = true;
}
