Forums Register Login
is creating new sessions a heavy weight process???

i create sessions using Session.getInstance instead of Session.getDefaultInstance, cause my smtpHost might change per mail that is send. so tell me is creating session object per mail ,a heavy weight process.

also if i call Session.getDefaultInstance(props); with different props object ,( one contains mail.smtp.host=smtp.foo.com and other mail.smtp.host=smtp.goo.com)

and send a mail using this Default session object, then all the mails are send using smtp.foo.com mail server, even if i later pass a different property object containing smtp.goo.com when calling getDefaultInstance().

but i dont find this problem, when i use getInstance() instead of getDefaultInstance().

so i wnat to know whether getInstance() is a heavyweight operation, (per mail)


This thread has been viewed 444 times.

All times above are in ranch (not your local) time.
The current ranch time is
Sep 21, 2018 02:11:14.