james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oki DZ <ok...@pindad.com>
Subject JDBCMailRepository
Date Wed, 25 Jul 2001 02:49:26 GMT

As I understand it, MimeMessageJDBCSource creates a JDBC connection and
then returns an input stream that is to be used in MimeMessageWrapper (the
class that retrieves the bytes from the db server via the input stream). 
The JDBC connection in MimeMessageJDBCSource couldn't be closed before
MimeMessageWrapper reads the input stream; if it were, then no byte could
be read from the stream. Problem is, if the JDBC connection never be
closed, the server will run out of connection.

public MailImpl retrieve(String key) {
    MimeMessageJDBCSource source = new MimeMessageJDBCSource(this,key);
    MimeMessageWrapper message = new MimeMessageWrapper(source);
    return mc;

I think it would be nicer to put MimeMessageWrapper inside the
MimeMessageJDBCSource, so that you wouldn't have problem about when to
close the JDBC connection; and a getMessage() method in
MimeMessageJDBCSource would be sufficient. 

But addding java.sql.Connection as a parameter to MimeMessageJDBCSource's
constructor would be easier, though. 

BTW, you have conn = repository.getConnection() in MimeMessageJDBCSource's
getInputStream(), but getConnection() is protected in JDBCMailRepository.


To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org

View raw message