Posted By:
bharath_kumar
Posted On:
Monday, March 17, 2008 07:58 AM
Could anybody let me know if closing of Store and Folder mandatory? Are there any effects if these are left open? Does the connections to store and folder behave the same way as the connections to a Table in DB? Here is my code, pop3Host = getProperty(MESSAGING_HOST); pop3Port = getProperty(MESSAGING_POP3_PORT); props = new Properties(); props.put(POP3_HOST, pop3Host); props.put(POP3_PORT, pop3Port); if (action != null && !action.equalsIgnoreCase(MAIL_DELETE)) { props.put(POP3_DELETE_RESET, SET_TO_TRUE); } password = MessagingService.getMessagingPassword(userName); auth = new MessagingAuthenticator(userName, password); sessionObj = Session.getInstance(pro
More>>
Could anybody let me know if closing of Store and Folder mandatory? Are there any effects if these are left open? Does the connections to store and folder behave the same way as the connections to a Table in DB?
Here is my code,
pop3Host = getProperty(MESSAGING_HOST);
pop3Port = getProperty(MESSAGING_POP3_PORT);
props = new Properties();
props.put(POP3_HOST, pop3Host);
props.put(POP3_PORT, pop3Port);
if (action != null && !action.equalsIgnoreCase(MAIL_DELETE)) {
props.put(POP3_DELETE_RESET, SET_TO_TRUE);
}
password = MessagingService.getMessagingPassword(userName);
auth = new MessagingAuthenticator(userName, password);
sessionObj = Session.getInstance(props, auth);
store = sessionObj.getStore(MAIL_STORE);
store.connect();
folder = store.getFolder(INBOX_FOLDER_NAME);
folder.open(Folder.READ_WRITE);
// Logic for retrieving mails from server
//After retrieving, all mails are stored as an array of MimeMessages in HttpSession for quick access in other places.
// So, the connection to store and folder is left open.
The code above works properly for all scenarios, but I am skeptical with closing of store and folder
Will this have any effect at a later stage?
Please help. I tried searching docs on this but was unable to find any lines on this
<<Less