Class MailReceiver

java.lang.Object
com.google.gerrit.server.mail.receive.MailReceiver
All Implemented Interfaces:
LifecycleListener, EventListener
Direct Known Subclasses:
ImapMailReceiver, Pop3MailReceiver

public abstract class MailReceiver extends Object implements LifecycleListener
MailReceiver implements base functionality for receiving emails.
  • Field Details

  • Method Details

    • start

      public void start()
      Description copied from interface: LifecycleListener
      Invoked when the server is starting.
      Specified by:
      start in interface LifecycleListener
    • stop

      public void stop()
      Description copied from interface: LifecycleListener
      Invoked when the server is stopping.
      Specified by:
      stop in interface LifecycleListener
    • requestDeletion

      public void requestDeletion(String messageId)
      requestDeletion will enqueue an email for deletion and delete it the next time we connect to the email server. This does not guarantee deletion as the Gerrit instance might fail before we connect to the email server.
    • handleEmails

      public abstract void handleEmails(boolean async) throws MailTransferException, IOException
      handleEmails will open a connection to the mail server, remove emails where deletion is pending, read new email and close the connection.
      Parameters:
      async - determines if processing messages should happen asynchronously
      Throws:
      MailTransferException - in case of a known transport failure
      IOException - in case of a low-level transport failure
    • dispatchMailProcessor

      protected void dispatchMailProcessor(List<com.google.gerrit.mail.MailMessage> messages, boolean async)