Overview
Features
Download
Documentation
Community
Add-Ons & Services

PocoData SessionPool lists

General discussion regarding the development of POCO for contributors.

PocoData SessionPool lists

Postby phireis » 13 Dec 2007, 02:50

I was looking at the SessionPool implementation, and had some questions about some of the lists traversing:

1. Is it needed to traverse the whole idle sessions list every time someone gets a session from the pool (throught get(), purgeDeadSessions()) ?

2. Is it needed to traverse the active sessions list on putting back a session to the pool (a list iterator could be in PooledSessionHolder to avoid that) ?

3. Is it needed to traverse the whole idle sessions list on janitor function (older sessions are at the back of the list)?

About 1, sisce purgeDeadSession is called every time a session is "get()" from the pool, I thought of not traverse the whole list, like it is implemented now, but stop once a valid session is found.

About 2, the linear "std::find" for the session to be put back to the pool (removed from the active sessions list and put in the idle list) could be avoided if, at the moment of putting a session in the active list, the list iterator pointing to it would be held by it, so that at the put back time, the pool would have constant time findind it in the active list.

About 3, since the sessions are added in the idle list always in the front, the list is is always ordered by time. So, if the janitor function start looking from the back of the idle list, when it find some session not older than the idle time, it should stop traversing the idle list, since the next ones will always be younger. Eventually the not connected session would be caught and elimitated from the front (on purgeDeadSession on get) or from the back(on janitor).


thanks,

Philipe
phireis
 
Posts: 12
Joined: 21 Oct 2006, 03:18

Return to Contributors

Who is online

Users browsing this forum: No registered users and 1 guest