jetty / jetty.project

Eclipse Jetty® - Web Container & Clients - supports HTTP/2, HTTP/1.1, HTTP/1.0, websocket, servlets, and more
https://eclipse.dev/jetty
Other
3.84k stars 1.91k forks source link

Fixes #12289 - Improve ConcurrentPool concurrency. #12290

Closed sbordet closed 1 week ago

sbordet commented 1 week ago

A call to sweep(), although protected by the lock for concurrent calls to reserve(), may be concurrent with remove(Entry).

remove(Entry) in turn calls entries.remove(Object), so that the concurrent iteration in sweep() over entries fails with an ArrayIndexOutOfBoundsException.

Now using the bulk entries.removeIf(Predicate) method in sweep(), so that sweeping is atomic with respect to entries.remove(Object).