singleton httpclient
Cantor, Scott
cantor.2 at osu.edu
Mon Nov 18 16:46:59 EST 2019
On 11/18/19, 4:40 PM, "Jim Fox" <fox at washington.edu> wrote:
> Possibly I was confused by the code in .../ext/spring/factory/HttpClientFactoryBean.java, which seemd to indicate
> that the HttpClient was a singleton. Is that something of a distraction?
The bean it produces is a singleton (one client), but it internally has a pooling manager, and is safe to use across threads or components, up to a point.
There's a bug in Spring with parent beans that manifests when you have parent/child Spring contexts, and causes our service reloading to fail. So if you directly inherit from or use that one bean defined up top in a connector in the resolver, for example, things start breaking if you reload the resolver.
As long as you directly create your own copy of the factory bean definition to do what you need done, it all works fine, but it isn't a single connection at a time in either case even though the beans themselves are singletons. As you probably were seeing, you do *not* want to use prototype, it's not meant to be used that way.
-- Scott
More information about the dev
mailing list