Rodney Waldhoff
Wed, 19 Mar 2003 08:36:45 -0800
In addition to all the things Craig lists, if you're using the commons-pool API directly, you can use pool.invalidateObject() to have the pool dispose of a previously active object. (E.g., if you know that some object you've borrowed has gone bad.)
On Wed, 19 Mar 2003, Craig R. McClanahan wrote: > > > On Wed, 19 Mar 2003, Donie Kelly wrote: > > > Date: Wed, 19 Mar 2003 11:07:46 -0000 > > From: Donie Kelly <[EMAIL PROTECTED]> > > Reply-To: Jakarta Commons Users List <[EMAIL PROTECTED]> > > To: 'Jakarta Commons Users List' <[EMAIL PROTECTED]> > > Subject: [Pool] Newbie question on pools (modified subject) > > > > Hi > > Sorry about posting without proper subject. I'm resending in case a lot of > > you are using filtering. > > > > Donie > > > > -----Original Message----- > > From: Donie Kelly [mailto:[EMAIL PROTECTED] > > Sent: 19 March 2003 11:03 > > To: Jakarta Commons (E-mail) > > Subject: Newbie question on pools > > > > Hi all > > > > I've looked through the source and all the javadocs and I cannot find a way > > to do the following with the pool library. Note I have marked that I can > > achieve parts of the intended functions: > > > > 1) Get a connection from the pool (I can do this) > > 2) Use the connection (I can do this) > > 3) Return the connection to the pool (I can do this) > > 4) When I get a connection and I have detected it has failed how can I > > mark it for removal as it may have been dropped by the server at the other > > end of the connection (HOW TO??) > > > > > > If you are using the [pool] APIs directly, you can set the testOnBorrow > and/or testOnReturn properties to validate objects as they are being > borrowed, or as they are being returned. See the [pool] API docs on > GenericObjectPool for more info. > > If you are using something like BasicDataSource from [dbcp] for database > connection pools, these APIs let you define a 'validationQuery' parameter > that represents an SQL SELECT statement. The pool will ensure that this > statement executes with no failures before letting you borrow it, throwing > the connection away if not. There are other tweaks for things like > periodically testing the idle connections in the pool as well. > > > I understand that I can use the pool ObjectPoolFactory to test connections > > on retrieval and submission to the pool but this is an overhead I don't > > want. I want the pool to drop the connection when the application has > > decided it is bad. I know the other way is desirable and I will probably > > implement this by using the evictor thread but surely it's important for the > > application to be able to decide that the connection is useless?? > > > > If you don't want the overhead of testOnBorrow (it's a price I feel > willing to pay, because the app should not even have to worry about things > like this), then you probably want to explore the testOnReturn thing > instead. > > > The connection I'm pooling is a Corba connection object. > > Thanks for any insights or help. > > > > Donie > > > > > > Craig > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]