Pool doe's not need locks on connection objects, "synchronized" can be used for "wait/notifyAll", but it needs monitor of some "global" object. Pool must never return the same connection for different threads, but connection can be "fail-fast" itself, it is not a very big overhead for connection objects to call "if(owner != Thread.currentThread()) throw new ConcurrentModificationException();" and to set "owner" at "getConnection" time. "owner" can be used for "automagic", but I am a very big enemy for this kind of workarounds myself.
> Hello Ken! > > There have been very strongly argumented opinions > that the pool should do nothing of the sort, but > I'd like to go to the bottom of discussing other > alternatives too. > > KH> * emulates a legal timeout from the database server > > I have been stricken with the beauty of approach > you have proposed, indeed its nice to emulate > a server timeout :-)) > > I still have one reservation: its synchronization. > Does this proposition mean that we have to make > all the normal operations on the connections > synchronized? > > I'm afraid something nasty may happen if while > the user is executing a lengthy query another > thread close()-s the connection. > > (I'm not concerned that we shall kill legitimate > client operation - after all the client should > have specified a longer timeout then, I'm concerned > that we may upset the driver or something.) > > Another synchronization issue is that theoretically > w/o a synchronization the fact that we have > called close() on the connection is not guaranteed > to be propagated to the other thread that is probably > holding the connection. Unless the db driver does > synchronization somewhere underneath of course. > > What do you think of this synchronization overhead? > Negligible? > > - Anton > > > --------------------------------------------------------------------- > 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]