Jon Yeargers wrote:

Hi. I have a series of tomcat based apps that all use a single .jar to do some common admin tasks like sending mail and connecting to a DB. The .jar file uses the Tomcat/JNDI connection pooling to save overhead (supposedly).

In the other apps (that use the above .jar) I have both servlets and session beans. Im trying to minimize memory use by putting the creation of the .jar classes into a base class and declaring it 'static'. Ill then (re)base my servlets and beans on these two base classes.

Something about this is striking me as wrong.

It seems like I will be getting an instance of my 'support' jar for each session. Which means each one will have its own connection pool. So if there are 4 web apps being used, with 5 users I will end up with 20 instances of the connection pool.

Surely there is a better way.. yes? no? maybe??

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Strikes me as wrong as well and maybe it's just because I'm misunderstanding what you are trying to do. So you have a .jar library with some classes to encapsulate using various JNDI resources. Very cool.

Next, it looks like you are creating a base class for your beans and servlets that use the pooled resources. Cool as long as these classes aren't managing the pool themselves. The base classes encapsulating the JNDI resources should get connections, do whatever and immediately close them so they return to the pool. That is where your performance improvement will come from.

I would drop the static stuff unless you are using a static factory method, but then again, such a method should not be in the base class of a bean or servlet.

Done right, there should be fewer connections to the pool than clients as each connection services several different requests (even from different contexts).

One last word of caution -- don't store connections from your pooled JNDI resources in the session. They'll idle and wasting memory waiting for the user to come back with a new request.

--David

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to