Class MailDelivery

java.lang.Object
com.iizix.server.user.MailDelivery

public final class MailDelivery extends Object
The delivery of a mail a user is waiting for (CC-FIX-SIGNIN-ACCOUNT-MAIL): the mail is SENT now, not queued, so that the answer the user reads follows what the relay did - "Sent" when the relay accepted it, "not sent" with the reason when it refused it or could not be reached. The wait is bounded (BOUND_MS): a relay that has not answered within the bound is left to finish in the background, and the mail is answered as sent with a WARNING in the log, so that a hung relay never hangs a screen.

The mails nobody waits for (the notices, the sign-up's verification mail) stay on the queue (Mail.queue()), where a refusal is a WARNING of the queue thread.

Author:
Christopher Mindus
  • Field Details

  • Method Details

    • sendBounded

      public static boolean sendBounded(Mail mail) throws MessagingException
      Sends a mail now and waits at most BOUND_MS for the relay.
      Parameters:
      mail - The mail, built and not yet sent or queued.
      Returns:
      true when the relay accepted it, or when it has not answered within the bound (logged); false when the mail was already sent or queued.
      Throws:
      MessagingException - When the relay refused the mail or could not be reached.
    • sendBounded

      public static boolean sendBounded(Mail mail, long boundMs) throws MessagingException
      Sends a mail now and waits at most a bound for the relay.
      Parameters:
      mail - The mail, built and not yet sent or queued.
      boundMs - The bound in milliseconds.
      Returns:
      true when the relay accepted it, or when it has not answered within the bound (logged); false when the mail was already sent or queued.
      Throws:
      MessagingException - When the relay refused the mail or could not be reached.