[Seaside] [VW] Implementing pooled database connections

Martin J. Laubach mjl at laubach.at
Sun Jun 4 11:49:52 UTC 2006


  I'm implementing pooled database connection for seaside sessions.
Here's my first cut at it:

  (PoolSession is a subclass of WASession, but that's not important
for the moment).


PoolSession>>initialize
	pool := SharedQueue new.

PoolSession>>addToPool: anObject
	pool nextPut: anObject

PoolSession>>withPooledDo: aBlock
	| poolEntry |
	
	[poolEntry := pool next.
	aBlock value: poolEntry] 
			ensure: [pool nextPut: poolEntry]



  Is that enough to ensure after use the connection gets put back
in the pool or do I need some additional exception catching or
process arbitration or whatever?

  I probably want to validate the pooled connection before giving it
out so dead database connections get discarded/replaced, but that's
for later.

	mjl



More information about the Seaside mailing list