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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MailReceiver.MailReceiverModule
-
Field Summary
Fields Modifier and Type Field Description protected EmailSettings
mailSettings
protected Set<String>
pendingDeletion
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
dispatchMailProcessor(List<com.google.gerrit.mail.MailMessage> messages, boolean async)
abstract void
handleEmails(boolean async)
handleEmails will open a connection to the mail server, remove emails where deletion is pending, read new email and close the connection.void
requestDeletion(String messageId)
requestDeletion will enqueue an email for deletion and delete it the next time we connect to the email server.void
start()
Invoked when the server is starting.void
stop()
Invoked when the server is stopping.
-
-
-
Field Detail
-
mailSettings
protected EmailSettings mailSettings
-
-
Method Detail
-
start
public void start()
Description copied from interface:LifecycleListener
Invoked when the server is starting.- Specified by:
start
in interfaceLifecycleListener
-
stop
public void stop()
Description copied from interface:LifecycleListener
Invoked when the server is stopping.- Specified by:
stop
in interfaceLifecycleListener
-
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 failureIOException
- in case of a low-level transport failure
-
dispatchMailProcessor
protected void dispatchMailProcessor(List<com.google.gerrit.mail.MailMessage> messages, boolean async)
-
-