You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2011/04/13 20:36:49 UTC
svn commit: r1091880 -
/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CopyProcessor.java
Author: norman
Date: Wed Apr 13 18:36:48 2011
New Revision: 1091880
URL: http://svn.apache.org/viewvc?rev=1091880&view=rev
Log:
Heartbeats are handled in a generic fashion now. See IMAP-296
Modified:
james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CopyProcessor.java
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CopyProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CopyProcessor.java?rev=1091880&r1=1091879&r2=1091880&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CopyProcessor.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CopyProcessor.java Wed Apr 13 18:36:48 2011
@@ -21,21 +21,14 @@ package org.apache.james.imap.processor;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
import javax.mail.Flags;
import org.apache.james.imap.api.ImapCommand;
-import org.apache.james.imap.api.ImapSessionState;
import org.apache.james.imap.api.ImapSessionUtils;
import org.apache.james.imap.api.display.HumanReadableText;
import org.apache.james.imap.api.message.IdRange;
import org.apache.james.imap.api.message.response.StatusResponse.ResponseCode;
-import org.apache.james.imap.api.message.response.ImapResponseMessage;
-import org.apache.james.imap.api.message.response.StatusResponse;
import org.apache.james.imap.api.message.response.StatusResponseFactory;
import org.apache.james.imap.api.process.ImapProcessor;
import org.apache.james.imap.api.process.ImapSession;
@@ -46,16 +39,13 @@ import org.apache.james.mailbox.MailboxM
import org.apache.james.mailbox.MailboxPath;
import org.apache.james.mailbox.MailboxSession;
import org.apache.james.mailbox.MessageManager;
-import org.apache.james.mailbox.MessageRangeException;
import org.apache.james.mailbox.MessageManager.MetaData.FetchGroup;
import org.apache.james.mailbox.MessageRange;
+import org.apache.james.mailbox.MessageRangeException;
public class CopyProcessor extends AbstractMailboxProcessor<CopyRequest> {
- private ScheduledExecutorService heartbeatService = Executors.newScheduledThreadPool(10);
- private final static String COPY_HEARTBEAT_FUTURE = "COPY_HEARTBEAT_FUTURE";
- private final static int COPY_HEARTBEAT_INTERVAL = 30;
-
+
public CopyProcessor(final ImapProcessor next,
final MailboxManager mailboxManager,
final StatusResponseFactory factory) {
@@ -81,25 +71,7 @@ public class CopyProcessor extends Abstr
no(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX,
ResponseCode.tryCreate());
} else {
- // Send heartbeats during COPY. See IMAP-296
- final ScheduledFuture<?> future = heartbeatService.scheduleWithFixedDelay(new Runnable() {
-
- public void run() {
- if (ImapSessionState.LOGOUT.equals(session.getState())) {
- Object o = session.getAttribute(COPY_HEARTBEAT_FUTURE);
- if (o != null) {
- ((ScheduledFuture<?>) o).cancel(true);
- session.setAttribute(COPY_HEARTBEAT_FUTURE, null);
- }
-
- } else {
- StatusResponse response = getStatusResponseFactory().untaggedOk(HumanReadableText.HEARTBEAT);
- responder.respond(response);
- }
- }
- }, COPY_HEARTBEAT_INTERVAL, COPY_HEARTBEAT_INTERVAL, TimeUnit.SECONDS);
- session.setAttribute(COPY_HEARTBEAT_FUTURE, future);
-
+
final MessageManager mailbox = mailboxManager.getMailbox(targetMailbox, mailboxSession);
List<IdRange> resultRanges=new ArrayList<IdRange>();
@@ -127,12 +99,6 @@ public class CopyProcessor extends Abstr
taggedBad(command, tag, responder, HumanReadableText.INVALID_MESSAGESET);
} catch (MailboxException e) {
no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
- } finally {
- Object o = session.getAttribute(COPY_HEARTBEAT_FUTURE);
- if (o != null) {
- ((ScheduledFuture<?>) o).cancel(true);
- session.setAttribute(COPY_HEARTBEAT_FUTURE, null);
- }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org