java.lang.Object
i2p.susi.webmail.pop3.BackgroundChecker
Check for new mail periodically.
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classTimer event starting the periodic mailbox checks.private classThread fetching the new messages of a check.Field Summary
FieldsModifier and TypeFieldDescriptionprivate final LogLogger for the background checker.private static final intDefault interval between the checks, in minutes.private booleanTrue while a check is running.private booleanTrue once the mailbox is shut down.private final POP3MailBoxThe mailbox checked in the background.private static final intSmallest check interval allowed, in minutes.private static final longLeast idle time before a check runs.private static final longLeast time since the last check.private final SimpleTimer2.TimedEventThe timer scheduling the checks.The message ids marked for deletion.Constructor Summary
ConstructorsConstructorDescriptionBackgroundChecker(POP3MailBox mailbox) Creates a new background checker for the given mailbox.Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancels the background checker.private longReads the check interval from the config.Returns the list of queued deletions.
Field Details
mailbox
The mailbox checked in the background.toDelete
timer
The timer scheduling the checks.isChecking
private volatile boolean isCheckingTrue while a check is running.isDead
private volatile boolean isDeadTrue once the mailbox is shut down._log
Logger for the background checker.DEFAULT_CHECK_MINUTES
private static final int DEFAULT_CHECK_MINUTESDefault interval between the checks, in minutes.- See Also:
MIN_CHECK_MINUTES
private static final int MIN_CHECK_MINUTESSmallest check interval allowed, in minutes.- See Also:
MIN_IDLE
private static final long MIN_IDLELeast idle time before a check runs.- See Also:
MIN_SINCE
Constructor Details
BackgroundChecker
Creates a new background checker for the given mailbox.- Parameters:
mailbox- the POP3 mailbox to check for new mail
Method Details
getQueued
Returns the list of queued deletions.- Returns:
- a copy of the queued UIDLs
cancel
public void cancel()Cancels the background checker.getCheckTime
private long getCheckTime()Reads the check interval from the config.- Returns:
- the interval between checks, in ms