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
}
}