}
}
}
session.popLineHandler();
if (!DONE.equals(line.toUpperCase(Locale.US))) {
StatusResponse response = getStatusResponseFactory().taggedBad(tag, command, HumanReadableText.INVALID_COMMAND);
responder.respond(response);
} else {
okComplete(command, tag, responder);
}
idleActive.set(false);
}
});
// Check if we should send heartbeats
if (heartbeatInterval > 0) {
heartbeatExecutor.schedule(new Runnable() {
public void run() {
// check if we need to cancel the Runnable
// See IMAP-275
if (session.getState() != ImapSessionState.LOGOUT && idleActive.get()) {
// Send a heartbeat to the client to make sure we
// reset the idle timeout. This is kind of the same
// workaround as dovecot use.
//
// This is mostly needed because of the broken
// outlook client, but can't harm for other clients
// too.
// See IMAP-272
StatusResponse response = getStatusResponseFactory().untaggedOk(HumanReadableText.HEARTBEAT);
responder.respond(response);
// schedule the heartbeat again for the next interval
heartbeatExecutor.schedule(this, heartbeatInterval, heartbeatIntervalUnit);
}