1 Reply Latest reply on Jan 14, 2003 5:16 AM by Paul Bandler

    Thread.sleep bad, what good?

    Mike Douglass Newbie

      I guess this is a general EJB thing but it came up in the context of an MDB.

      I have a simple MDB which when given an object representing an email message, interacts with our mailer to send the email.

      If there are network problems or the mailer is not running I could choose to fail, but I get a retry immediately until the object ends up on the DLQ.

      What I want to do is try the sendmail, if it fails sleep then try again until it works. This seems more appropriate then requeuing a message. However, Thread.sleep is bad (or so it says in the spec).

      Is there any alternative?