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 A8F8817CBB for ; Thu, 5 Feb 2015 19:28:36 +0000 (UTC) Received: (qmail 4959 invoked by uid 500); 5 Feb 2015 19:28:36 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 4688 invoked by uid 500); 5 Feb 2015 19:28:36 -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 4670 invoked by uid 99); 5 Feb 2015 19:28:36 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Feb 2015 19:28:36 +0000 Date: Thu, 5 Feb 2015 19:28:35 +0000 (UTC) From: "Thomas Neidhart (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (POOL-283) 'Object has already been retured to this pool or is invalid' for collections 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-283?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14307819#comment-14307819 ] Thomas Neidhart commented on POOL-283: -------------------------------------- Using an IdentityHashMap would not require such wrapper objects. > 'Object has already been retured to this pool or is invalid' for collections > ---------------------------------------------------------------------------- > > Key: POOL-283 > URL: https://issues.apache.org/jira/browse/POOL-283 > Project: Commons Pool > Issue Type: Bug > Affects Versions: 2.2 > Reporter: Valentin Mayamsin > > This test throws exception: > {code} > GenericObjectPoolConfig config = new GenericObjectPoolConfig (); > config.setMaxTotal ( 2 ); > GenericObjectPool setsPool = new GenericObjectPool<> ( new BasePooledObjectFactory () > { > @Override > public Set create () throws Exception > { > return new HashSet(); > } > @Override > public PooledObject wrap ( Set o ) > { > return new DefaultPooledObject<> ( o ); > } > @Override > public void passivateObject ( PooledObject p ) throws Exception > { > p.getObject ().clear (); > super.passivateObject ( p ); > } > }, config ); > final Set set1 = setsPool.borrowObject (); > final Set set2 = setsPool.borrowObject (); > setsPool.returnObject ( set1 ); > setsPool.returnObject ( set2 ); // this throws java.lang.IllegalStateException: Object has already been retured to this pool or is invalid > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)