As an additional note: I put up a simple test servlet that prints to
the screen and it does not leave any threads hanging nor does it have a
memory problem so it is definately something connected to how I use the
J-Connector or open and close the database. The problem only occurs
when I make a connection to the database. If this helps any.
Thanks again. I really need to solve this problem because it's a show
stopper for my application.
-- Dan
Daniel L. Gross wrote:
I looked at the profiler and it appears that there are many timer
threads left hanging. I have not set up a data source for Tomcat or
any connection pooling. I am opening a connection to the database
directly with the following code. Could this be causing my problem?
thanks again, Dan
public M5Connection(String DBHost, String DBName, String DBUsername,
String DBPassword) throws SQLException {
//setup the DB connectivity paramters
DATABASE_HOST = DBHost;
DATABASE_NAME = DBName;
DATABASE_USERNAME = DBUsername;
DATABASE_PASSWORD = DBPassword;
loadDBDriver(); //load the JDBC driver class into memory at runtime
connect(); //connect to the database using the above driver
} // constructor
public Connection getConnection() {
return conn;
}
//used to load the DB Driver into memory at runtime
private void loadDBDriver() {
// The newInstance() call is a work around for some
// mm.MySQL implementations
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
System.out.println("Driver instantiated"); //debug
}
catch (Exception E) {
System.err.println("Unable to load driver.");
E.printStackTrace();
}
}
//connects to a database
private void connect() throws SQLException {
conn = DriverManager.getConnection("jdbc:mysql://" + DATABASE_HOST
+ "/" +
DATABASE_NAME + "?user=" +
DATABASE_USERNAME + "&password=" +
DATABASE_PASSWORD);
System.out.println("Connection made"); //debug
}
Caldarale, Charles R wrote:
From: Daniel L. Gross [mailto:[EMAIL PROTECTED] Subject: Re:
Memory Usage
What appears to be happening is that every time I execute my app,
when it closes, Tomcat leaves an
inactive thread hanging.
I seriously doubt that Tomcat is doing this - much more likely that your
app is causing it, or possibly the DB driver. Does the app create any
auxiliary threads and not have them terminate? If that's not the case,
and threads from Tomcat's pool were not returning to it after processing
a request for your app, you'd run out of threads pretty quickly. What
does a thread dump show about where these hanging threads are hanging
out?
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]