commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <>
Subject Re: [pool] preparePool that only registers key, doesn't create new object
Date Sun, 05 Feb 2017 22:21:27 GMT
Anyone care to opine?


On Fri, Jan 20, 2017 at 7:38 AM, Martin Klepsch <> wrote:

> Hey,
> With a KeyedObjectPool I can use `setMinIdlePerKey` &  `preparePool` to
> "bootstrap" an object pool. Now `preparePool` creates new objects
> synchronously and the evictor thread doesn't seem to ensure min idle
> objects if there are none yet (since it can't know the keys I guess).
> Because of that I run into the situation that the evictor thread creates
> objects for keys that are currently being created by `preparePool`. It's
> not an absolute deal breaker but it would be nice to be able to register
> keys without synchronously creating the minimum idle objects. Instead I'd
> like to wait for the evictor thread to pick up newly registered keys and
> create the required objects for it.
> Unfortunately `register` is private and I don't see another way to trigger
> key-registering. (Calling `preparePool` with `minIdlePerKey` set to 0 will
> short circuit and not register the key).
> Any suggestions welcome!
> Cheers :)

E-Mail: |
Java Persistence with Hibernate, Second Edition

JUnit in Action, Second Edition

Spring Batch in Action

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message