Reputation: 31
I have an application that should work like this:
What I've found is that my application moves too fast for the Transport thread. I end up missing messages, because I move on to the next message before the Transport thread is finished with the one before it. To (temporarily) solve this problem, I have resorted to putting a 2-second pause between the launch of one message, and the creation of the next. But this is unacceptable! What I want is some sort of semaphore that I can wait on to determine when the Transport thread is completely done with a message (i.e., I want synchronous operation).
Does anyone know of such a thing?
Upvotes: 0
Views: 1127
Reputation: 29971
Transport is synchronous.
What do you mean you're "missing messages"? Do you mean that, even though the Transport says the message has been sent (with no exceptions), the message never arrives at the destination? That likely indicates a bug in your mail server.
You might want to try turning on Session debugging as described in the JavaMail FAQ to see if there's anything in the conversation with the mail server that would indicate why it's not working as you expect.
Upvotes: 1