Wolfgang Beikircher
16 years ago
Hi there!
I need some help with the usage of the IDLE command in JavaMail. As far
as I have seen, I have to create for each observed folder a new thread.
Okay, that is fine. But do I have to create for EACH listener an
additional thread? Wouldn't that be a little counterproductive?
Following scenario: I'm connecting to an IMAP server through JavaMail
1.4.1. Then I'm starting on a specific folder one thread to monitor it.
The run() method of the thread looks like this:
...
folder.addMessageChangedListener(new MyMessageChangedListener());
folder.addMessageCountListener(new MyMessageCountListener());
while (!stop) {
try {
folder.idle();
} catch (FolderClosedException e) {
log.info("Leaving idle...");
}
...
As you can see, I install 2 listeners in this thread. Now, when I try to
delete a message (setting the 'deleted' flag and expunging afterwards
the folder) I get only the 'messageChanged' event. This is, I think,
because the IDLE state has to be exited and reentered and so I loose my
'messageRemoved' event. Am I right?
Is there any possibility to get the second notification too? Can I
install somewhere a queue where unprocessed notifications will be
stored?
Thanks for Your help.
Sincerely,
Wolfgang
===========================================================================
To unsubscribe, send email to ***@java.sun.com and include in the body
of the message "signoff JAVAMAIL-INTEREST". For general help, send email to
***@java.sun.com and include in the body of the message "help".
I need some help with the usage of the IDLE command in JavaMail. As far
as I have seen, I have to create for each observed folder a new thread.
Okay, that is fine. But do I have to create for EACH listener an
additional thread? Wouldn't that be a little counterproductive?
Following scenario: I'm connecting to an IMAP server through JavaMail
1.4.1. Then I'm starting on a specific folder one thread to monitor it.
The run() method of the thread looks like this:
...
folder.addMessageChangedListener(new MyMessageChangedListener());
folder.addMessageCountListener(new MyMessageCountListener());
while (!stop) {
try {
folder.idle();
} catch (FolderClosedException e) {
log.info("Leaving idle...");
}
...
As you can see, I install 2 listeners in this thread. Now, when I try to
delete a message (setting the 'deleted' flag and expunging afterwards
the folder) I get only the 'messageChanged' event. This is, I think,
because the IDLE state has to be exited and reentered and so I loose my
'messageRemoved' event. Am I right?
Is there any possibility to get the second notification too? Can I
install somewhere a queue where unprocessed notifications will be
stored?
Thanks for Your help.
Sincerely,
Wolfgang
===========================================================================
To unsubscribe, send email to ***@java.sun.com and include in the body
of the message "signoff JAVAMAIL-INTEREST". For general help, send email to
***@java.sun.com and include in the body of the message "help".