tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: Tomcat 7 JDBC Connection Pool - question about usage from Java code
Date Sat, 25 Oct 2014 22:24:56 GMT
2014-10-26 1:49 GMT+04:00 Ric Bernat <ric@brinydeep.net>:
>> There is no such method to be called like on the above line.
>> "DataSource(PoolConfiguration)" is a constructor. To call a constructor you need
the keyword "new".
>
> My bad: I copied some code around and dropped the "new." You are quite right: I am calling
the constructor.
>
>> No. A constructor creates a new object.
>
> Of course, I realize a constructor creates a new object. However, I had assumed that
connections opened from two separate DataSource instances would still coexist in the same
Tomcat connection pool.
>
> To confirm: you are saying that one DataSource instance == one connection pool, period.
Right?

With that code, yes.

> (...)
>
> In the context of a JAX-RS application, this means I must persist my DataSource instances
in memory across web service calls (which is fine, I can do that), and reuse them.

Yes.

> Otherwise I simply am not getting any connection pooling at all. Right?

You get pooling for the duration of that single web service call. If
open connection several times during that single call, all those
connections will come from the same pool.

BTW,
http://en.wikipedia.org/wiki/Design_Patterns#Structural

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message