UniverseUniversity


Home Projects Jobs Clientele Contact

uu


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Db pool [was: My little comments to CPP code]



>>>> Connection has to be closed and removed from the pool
>>>> 1. At shutdown. We have to loop through all connections in
>>>> m_connections
>>>> list and close them, then clear m_connections list.
>>>>
>>>>
>>> What happens to connections that were requested by servlets and weren't
>>> returned to the pool when shutdown occurs?
>>>
>>
>> Those unreturned connections have to be closed.
>> Perhaps we should have a list for checked in connections too and clear
>> it
>> on shutdown the same way as we clear m_connections.
>>
> But how will those functions that got hold of connections know that
> connections have disappeared from under them. What happens to
> transactions that are in progress at that time?

I did a research on this issue and here is how it imho should be:

After shutdown any connections that are currently active should be allowed
to return to the pool once their transaction is complete. Then we remove
them from m_connections list.
Basically it means that on shutdown we have to cleanup m_connections, then
wait(perhaps for limited time interval) for all used connections to return
to the pool(we know how many is used at any given time), then shutdown the
pool completely.

Also, since these problems related, any client' calls for connections that
are made during the shutdown should be queued until the pool is
avalailable again.
If want something like this, my guess is that we have to have a temporary
storage for those calls, then, when pool is available again, load them to
the pool at once.





Authoright © Total Knowledge: 2001-2008