From: Warren Young Date: April 25 2009 2:43am Subject: =?WINDOWS-1252?Q?Re:_Connection_Pool_=96_How_to_remove_bad_conne?= =?WINDOWS-1252?Q?ction_from_pool=3F?= List-Archive: http://lists.mysql.com/plusplus/8529 Message-Id: MIME-Version: 1.0 (Apple Message framework v930.3) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On Apr 24, 2009, at 8:36 PM, Warren Young wrote: > I suggest giving the class a remove() method. A thought: it could be called exchange() instead, taking a pointer to a Connection, which is to be removed from the pool and destroyed, and then returning a new one. You could then have code like this: Connection* c = pool.grab(); try_again: try { // try to use c } catch (const Exception& e) { if (c.errnum() == CR_SERVER_GONE_ERROR) { // report problem, then... c = pool.exchange(c); goto try_again; } else { // some other exception, handle separately } }