List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:April 25 2009 2:43am
Subject:Re: Connection Pool – How to remove bad conne
ction from pool?
View as plain text  
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
		}
	}

Thread
Connection Pool – How to remove bad connection from pool?Jay Rajput24 Apr
  • Re: Connection Pool – How to remove bad connection from pool?Warren Young25 Apr
    • Re: Connection Pool – How to remove bad connection from pool?Warren Young25 Apr