Interface MonitoringStrategy

All Known Implementing Classes:
AbstractMonitoringStrategy, ImapIdleMonitoringStrategy, PollingMonitoringStrategy, Pop3PollingMonitoringStrategy

public interface MonitoringStrategy
Defines the contract for objects that monitor a given folder for new messages. Allows for multiple implementation strategies, including polling, or event-driven techniques such as IMAP's IDLE command.
Author:
Arjen Poutsma
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the folder open mode to be used by this strategy.
    jakarta.mail.Message[]
    monitor(jakarta.mail.Folder folder)
    Monitors the given folder, and returns any new messages when they arrive.
  • Method Details

    • monitor

      jakarta.mail.Message[] monitor(jakarta.mail.Folder folder) throws jakarta.mail.MessagingException, InterruptedException
      Monitors the given folder, and returns any new messages when they arrive.
      Parameters:
      folder - the folder in which to look for new messages
      Returns:
      the new messages
      Throws:
      jakarta.mail.MessagingException - in case of JavaMail errors
      InterruptedException - if a thread is interrupted
    • getFolderOpenMode

      int getFolderOpenMode()
      Returns the folder open mode to be used by this strategy. Can be either Folder.READ_ONLY or Folder.READ_WRITE.