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]



>>
>> It's a servlet that is used for creating the instance of the pool and
>> saving  a pointer to it in ServletContext.
>> Here is how it may look like:
>>
>> void InitServlet::init()
>> {
>>
>>   string numCon =
>> getServletConfig().getInitParameter("num_connections");
>>   ServletContext& ctx = getServletConfig().getServletContext();
>>   uuDBPool* pool = new uuDBPool(numCon);
>>   ctx.setAttribute<uuDBPool*>("uu_pool", pool);
>>
>> }
>>
>> Perhaps I'm going to add InitServlet::destroy() to release all resources
>> and close all connections in the pool.
>>
> How about using UUServlet for that purpose?

There is a downside in overriding init() in UuServlet. It will be called
as many times as number of servlets that we have in our application. I
understand that UuDbPool() will be created only at the very first time,
though.
>
> --
> Ilya A. Volynets-Evenbakh
> Total Knowledge. CTO
> http://www.total-knowledge.com
>
>



Authoright © Total Knowledge: 2001-2008