james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1161482 - in /james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor: DefaultProcessorChain.java main/DefaultImapProcessorFactory.java
Date Thu, 25 Aug 2011 10:27:34 GMT
Author: norman
Date: Thu Aug 25 10:27:34 2011
New Revision: 1161482

URL: http://svn.apache.org/viewvc?rev=1161482&view=rev
Log:
DefaultImapProcessorFactory should allow to disable IDLE keep-alives. See IMAP-338

Modified:
    james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java
    james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/main/DefaultImapProcessorFactory.java

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java?rev=1161482&r1=1161481&r2=1161482&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java
(original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java
Thu Aug 25 10:27:34 2011
@@ -19,6 +19,9 @@
 
 package org.apache.james.imap.processor;
 
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
 import org.apache.james.imap.api.process.MailboxTyper;
@@ -31,7 +34,7 @@ import org.apache.james.mailbox.Subscrip
  */
 public class DefaultProcessorChain {
 
-    public static final ImapProcessor createDefaultChain(final ImapProcessor chainEndProcessor,
final MailboxManager mailboxManager, final SubscriptionManager subscriptionManager, final
StatusResponseFactory statusResponseFactory, MailboxTyper mailboxTyper, int batchSize) {
+    public static final ImapProcessor createDefaultChain(final ImapProcessor chainEndProcessor,
final MailboxManager mailboxManager, final SubscriptionManager subscriptionManager, final
StatusResponseFactory statusResponseFactory, MailboxTyper mailboxTyper, int batchSize, long
idleKeepAlive, TimeUnit milliseconds) {
         final SystemMessageProcessor systemProcessor = new SystemMessageProcessor(chainEndProcessor,
mailboxManager);
         final LogoutProcessor logoutProcessor = new LogoutProcessor(systemProcessor, mailboxManager,
statusResponseFactory);
 
@@ -54,7 +57,13 @@ public class DefaultProcessorChain {
         final AppendProcessor appendProcessor = new AppendProcessor(examineProcessor, mailboxManager,
statusResponseFactory);
         final StoreProcessor storeProcessor = new StoreProcessor(appendProcessor, mailboxManager,
statusResponseFactory);
         final NoopProcessor noopProcessor = new NoopProcessor(storeProcessor, mailboxManager,
statusResponseFactory);
-        final IdleProcessor idleProcessor = new IdleProcessor(noopProcessor, mailboxManager,
statusResponseFactory);
+        final IdleProcessor idleProcessor;
+        if (idleKeepAlive > 0) {
+            idleProcessor = new IdleProcessor(noopProcessor, mailboxManager, statusResponseFactory,
idleKeepAlive, milliseconds, Executors.newScheduledThreadPool(IdleProcessor.DEFAULT_SCHEDULED_POOL_CORE_SIZE));
+        } else {
+            // We don't want to send keep alives so now scheduled executur needed
+            idleProcessor = new IdleProcessor(noopProcessor, mailboxManager, statusResponseFactory,
idleKeepAlive, milliseconds, null);
+        }
         final StatusProcessor statusProcessor = new StatusProcessor(idleProcessor, mailboxManager,
statusResponseFactory);
         final LSubProcessor lsubProcessor = new LSubProcessor(statusProcessor, mailboxManager,
subscriptionManager, statusResponseFactory);
         final XListProcessor xlistProcessor = new XListProcessor(lsubProcessor, mailboxManager,
statusResponseFactory, mailboxTyper);

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/main/DefaultImapProcessorFactory.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/main/DefaultImapProcessorFactory.java?rev=1161482&r1=1161481&r2=1161482&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/main/DefaultImapProcessorFactory.java
(original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/main/DefaultImapProcessorFactory.java
Thu Aug 25 10:27:34 2011
@@ -19,12 +19,15 @@
 
 package org.apache.james.imap.processor.main;
 
+import java.util.concurrent.TimeUnit;
+
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
 import org.apache.james.imap.api.process.MailboxTyper;
 import org.apache.james.imap.message.response.UnpooledStatusResponseFactory;
 import org.apache.james.imap.processor.DefaultProcessorChain;
+import org.apache.james.imap.processor.IdleProcessor;
 import org.apache.james.imap.processor.base.ImapResponseMessageProcessor;
 import org.apache.james.imap.processor.base.UnknownRequestProcessor;
 import org.apache.james.mailbox.MailboxManager;
@@ -36,21 +39,21 @@ import org.apache.james.mailbox.Subscrip
 public class DefaultImapProcessorFactory {
 
     public static final ImapProcessor createDefaultProcessor(final MailboxManager mailboxManager,
final SubscriptionManager subscriptionManager) {
-        return createXListSupportingProcessor(mailboxManager, subscriptionManager, null,
ImapConstants.DEFAULT_BATCH_SIZE);
+        return createXListSupportingProcessor(mailboxManager, subscriptionManager, null,
ImapConstants.DEFAULT_BATCH_SIZE, IdleProcessor.DEFAULT_HEARTBEAT_INTERVAL_IN_SECONDS);
     }
 
-    public static final ImapProcessor createDefaultProcessor(final MailboxManager mailboxManager,
final SubscriptionManager subscriptionManager, int batchSize) {
-        return createXListSupportingProcessor(mailboxManager, subscriptionManager, null,
batchSize);
+    public static final ImapProcessor createDefaultProcessor(final MailboxManager mailboxManager,
final SubscriptionManager subscriptionManager, int batchSize, long idleKeepAlive) {
+        return createXListSupportingProcessor(mailboxManager, subscriptionManager, null,
batchSize, idleKeepAlive);
     }
 
     public static final ImapProcessor createXListSupportingProcessor(final MailboxManager
mailboxManager, final SubscriptionManager subscriptionManager, MailboxTyper mailboxTyper)
{
-        return createXListSupportingProcessor(mailboxManager, subscriptionManager, mailboxTyper,
ImapConstants.DEFAULT_BATCH_SIZE);
+        return createXListSupportingProcessor(mailboxManager, subscriptionManager, mailboxTyper,
ImapConstants.DEFAULT_BATCH_SIZE, IdleProcessor.DEFAULT_HEARTBEAT_INTERVAL_IN_SECONDS);
     }
 
-    public static final ImapProcessor createXListSupportingProcessor(final MailboxManager
mailboxManager, final SubscriptionManager subscriptionManager, MailboxTyper mailboxTyper,
int batchSize) {
+    public static final ImapProcessor createXListSupportingProcessor(final MailboxManager
mailboxManager, final SubscriptionManager subscriptionManager, MailboxTyper mailboxTyper,
int batchSize, long idleKeepAlive) {
         final StatusResponseFactory statusResponseFactory = new UnpooledStatusResponseFactory();
         final UnknownRequestProcessor unknownRequestImapProcessor = new UnknownRequestProcessor(statusResponseFactory);
-        final ImapProcessor imap4rev1Chain = DefaultProcessorChain.createDefaultChain(unknownRequestImapProcessor,
mailboxManager, subscriptionManager, statusResponseFactory, mailboxTyper, batchSize);
+        final ImapProcessor imap4rev1Chain = DefaultProcessorChain.createDefaultChain(unknownRequestImapProcessor,
mailboxManager, subscriptionManager, statusResponseFactory, mailboxTyper, batchSize, idleKeepAlive,
TimeUnit.MILLISECONDS);
         final ImapProcessor result = new ImapResponseMessageProcessor(imap4rev1Chain);
         return result;
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message