dcsimg
Transport object expires while I am trying to reuse it for sending large number of emails.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Dave_Osof
Posted On:   Wednesday, October 23, 2002 12:46 PM

Hi, I am trying to send large number of emails and therefore for the reason of a performance gain trying to reuse created Transport object. I used transport.isConnected() to verify if it is valid. Otherwise I was getting exception as soon as transport was losing connection ... // sample code block session = Session.getDefaultInstance(props, null); transport=session.getTransport("smtp"); transport.connect(); while(i_need_it) { if (transport.isConnected()) { message.saveChanges(); transport.sendMessage(message, message.getAllRecipients()); } } This works fine fo   More>>

Hi,

I am trying to send large number of emails and therefore

for the reason of a performance gain trying to reuse
created Transport object.

I used transport.isConnected() to verify if it is valid.
Otherwise I was getting exception as soon as transport was losing connection ...


			
// sample code block
session = Session.getDefaultInstance(props, null);
transport=session.getTransport("smtp");
transport.connect();

while(i_need_it) {

if (transport.isConnected()) {
message.saveChanges();
transport.sendMessage(message, message.getAllRecipients());
}
}



This works fine for approximately 20 messages and then slows down ..
I mean that instead of 0.01 second as at the beginning it takes 0.18 sec, 0.36 sec
to just verify if transport is connected.
Method transport.isConnected returns "true" but
processing time DOUBLES every consecutive message ...
and obviously becomes a show-stopper.
(it grow up to 4 min!)



Application works fine if I use Transport.send() instead of transport.sendMessage(..)

but I am trying to make it run faster.

Any ideas what is wrong? May be something should be configured on SMTP server? Some session configurations?

Thanks,
Dave

   <<Less
About | Sitemap | Contact