Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1F6061892A for ; Fri, 18 Mar 2016 09:55:34 +0000 (UTC) Received: (qmail 70591 invoked by uid 500); 18 Mar 2016 09:55:33 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 70487 invoked by uid 500); 18 Mar 2016 09:55:33 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 70464 invoked by uid 99); 18 Mar 2016 09:55:33 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Mar 2016 09:55:33 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 6FCE42C1F54 for ; Fri, 18 Mar 2016 09:55:33 +0000 (UTC) Date: Fri, 18 Mar 2016 09:55:33 +0000 (UTC) From: "Mark Thomas (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (POOL-310) Keyed pool usage description correction MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/POOL-310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mark Thomas resolved POOL-310. ------------------------------ Resolution: Fixed Fix Version/s: 2.4.3 Thanks for the test case. I'd missed the code path if the factory destroyed the object. > Keyed pool usage description correction > --------------------------------------- > > Key: POOL-310 > URL: https://issues.apache.org/jira/browse/POOL-310 > Project: Commons Pool > Issue Type: Improvement > Affects Versions: 2.4.2 > Reporter: Ivan Iliev > Priority: Minor > Fix For: 2.4.3 > > Attachments: Test.java > > > This applies to GenericKeyedObjectPool. > Please consider the following situation: > 1. A pool has been setup to blockWhenExhausted=true > 2. maxTotal=maxTotalPerKey=1 > 3. no object has yet been added for any key > 4. two threads are running concurrently > 5. the first thread borrows key a > 6. the second thread borrows key b, but fails to create an object as the pool is now full, so it gets parked > 7. the first thread returns the object for its key(a) and also invalidates it > At this point we must manually unpark the second thread, which is achieved by adding a new object for the key b(possibly from the first thread). This behaviour is not described in the documentation of the pool. One could assume that at step 6, the second thread will block at the object creation and then be woken up automatically after returnObject(when the returned object also gets invalidated and destroyed). > Please add this information in the pool's description. Alternativley you could enchance the implementation to block at the creation - when the subpool is empty and there is no more space, and resume automatically from there, without the need of manual object addition. -- This message was sent by Atlassian JIRA (v6.3.4#6332)