You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2021/02/15 13:50:00 UTC

[jira] [Commented] (POOL-392) Add Async addObjects Implementation

    [ https://issues.apache.org/jira/browse/POOL-392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17284736#comment-17284736 ] 

Gary D. Gregory commented on POOL-392:
--------------------------------------

It seems simpler to make the app do this than make the library have a one off API. You have to think why this API and not others?

Gary


> Add Async addObjects Implementation
> -----------------------------------
>
>                 Key: POOL-392
>                 URL: https://issues.apache.org/jira/browse/POOL-392
>             Project: Commons Pool
>          Issue Type: Improvement
>            Reporter: David Mollitor
>            Priority: Major
>
> {code:java|title=ObjectPool.java}
>     default void addObjects(final int count) throws Exception {
>         for (int i = 0; i < count; i++) {
>             addObject();
>         }
>     }
> {code}
> I have a use case where `addObject` is a very expensive call: ~2m.  So, to pre-populate the pool with 5 objects requires 10m+.  Would be nice to have an async (ExecutorService) version which loads the pool in parallel.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)