Merge pull request #4109 from mofleury/jetty-9.4.x

Support meaningful JMX ObjectNames for HttpDestinations by avoiding race condition at creation
This commit is contained in:
Simone Bordet 2019-10-01 17:31:45 +02:00 committed by GitHub
commit 72d1a297a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 17 deletions

View File

@ -540,24 +540,14 @@ public class HttpClient extends ContainerLifeCycle
port = normalizePort(scheme, port);
Origin origin = new Origin(scheme, host, port);
HttpDestination destination = destinations.get(origin);
if (destination == null)
return destinations.computeIfAbsent(origin, o ->
{
destination = transport.newHttpDestination(origin);
addManaged(destination);
HttpDestination existing = destinations.putIfAbsent(origin, destination);
if (existing != null)
{
removeBean(destination);
destination = existing;
}
else
{
if (LOG.isDebugEnabled())
LOG.debug("Created {}", destination);
}
}
return destination;
HttpDestination newDestination = getTransport().newHttpDestination(o);
addManaged(newDestination);
if (LOG.isDebugEnabled())
LOG.debug("Created {}", newDestination);
return newDestination;
});
}
protected boolean removeDestination(HttpDestination destination)