Java code document.send() function hangs

I have a Java function that is called repeatedly in a while loop to send emails, one email sent with each call.

Somehow the function hangs at send() when the function is called the 2nd time.

Here is the major part of the function:

Document message = db.createDocument();

message.replaceItemValue(“Form”, “memo”);

message.replaceItemValue(“SendTo”, recipients);

message.setSaveMessageOnSend(true);

message.send(false); //hangs when called 2nd tm

message.recycle(); //no diff w/wo this line

I searched this forum and found some others posted similar problem but with no solution. If you have Java code that sends email repeatedly, can you please post your code? or do you see any issue in the code?

Thanks.