Hi,
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);
mc.setMessage(message);
rsMessage.close();
retrieveMessage.close();
conn.close();
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.
Oki
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]