james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [25/41] james-project git commit: JAMES-2082 Propose using ArrayBlockingQueu instead of EvictingQueue
Date Mon, 10 Jul 2017 17:54:37 GMT
JAMES-2082 Propose using ArrayBlockingQueu instead of EvictingQueue

this have the advantage of blocking when polling. But if the queue is full, the
code will no ignore new message instead of old message.


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/26ce1f4b
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/26ce1f4b
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/26ce1f4b

Branch: refs/heads/master
Commit: 26ce1f4be93fe357eb1123fab3a1d78cdf182350
Parents: 15e77ea
Author: Luc DUZAN <lduzan@linagora.com>
Authored: Fri Jul 7 15:46:22 2017 +0200
Committer: Antoine Duprat <aduprat@linagora.com>
Committed: Mon Jul 10 14:23:58 2017 +0200

----------------------------------------------------------------------
 .../cassandra/CassandraConfiguration.java       | 37 +++++---------------
 .../cassandra/CassandraConfigurationTest.java   | 19 ----------
 .../destination/conf/cassandra.properties       |  1 -
 .../destination/conf/cassandra.properties       |  1 -
 .../cassandra/mail/CassandraMessageDAOV2.java   | 22 ++++++------
 .../mail/migration/V1ToV2Migration.java         | 18 +++++++---
 .../mail/migration/V1ToV2MigrationThread.java   | 19 +++-------
 .../modules/mailbox/CassandraSessionModule.java |  3 --
 .../mailbox/CassandraSessionModuleTest.java     |  1 -
 .../modules/mailbox/cassandra.properties        |  1 -
 src/site/xdoc/server/config-cassandra.xml       |  2 --
 11 files changed, 36 insertions(+), 88 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/26ce1f4b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/CassandraConfiguration.java
----------------------------------------------------------------------
diff --git a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/CassandraConfiguration.java
b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/CassandraConfiguration.java
index e125c1e..5f0850b 100644
--- a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/CassandraConfiguration.java
+++ b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/CassandraConfiguration.java
@@ -42,7 +42,6 @@ public class CassandraConfiguration {
     public static final int DEFAULT_BLOB_PART_SIZE = 100 * 1024;
     public static final int DEFAULT_MIGRATION_V1_TO_V2_QUEUE_LENGTH = 1000;
     public static final int DEFAULT_MIGRATION_V1_TO_V2_THREAD_COUNT = 2;
-    public static final int DEFAULT_MIGRATION_V1_TO_V2_POLLING_DELAY = 10;
 
     public static class Builder {
         private Optional<Integer> messageReadChunkSize = Optional.empty();
@@ -58,7 +57,6 @@ public class CassandraConfiguration {
         private Optional<Boolean> onTheFlyV1ToV2Migration = Optional.empty();
         private Optional<Integer> v1ToV2QueueLength = Optional.empty();
         private Optional<Integer> v1ToV2ThreadCount = Optional.empty();
-        private Optional<Integer> v1ToV2PollingDelay = Optional.empty();
 
         public Builder messageReadChunkSize(int value) {
             Preconditions.checkArgument(value > 0, "messageReadChunkSize needs to be strictly
positive");
@@ -132,12 +130,6 @@ public class CassandraConfiguration {
             return this;
         }
 
-        public Builder v1ToV2PollingDelay(int value) {
-            Preconditions.checkArgument(value > 0, "blobPartSize needs to be strictly
positive");
-            this.v1ToV2PollingDelay = Optional.of(value);
-            return this;
-        }
-
         public Builder onTheFlyV1ToV2Migration(boolean value) {
             this.onTheFlyV1ToV2Migration = Optional.of(value);
             return this;
@@ -208,11 +200,6 @@ public class CassandraConfiguration {
             return this;
         }
 
-        public Builder v1ToV2PollingDelay(Optional<Integer> value) {
-            value.ifPresent(this::v1ToV2PollingDelay);
-            return this;
-        }
-
         public CassandraConfiguration build() {
             return new CassandraConfiguration(aclMaxRetry.orElse(DEFAULT_ACL_MAX_RETRY),
                 messageReadChunkSize.orElse(DEFAULT_MESSAGE_CHUNK_SIZE_ON_READ),
@@ -226,8 +213,7 @@ public class CassandraConfiguration {
                 blobPartSize.orElse(DEFAULT_BLOB_PART_SIZE),
                 onTheFlyV1ToV2Migration.orElse(DEFAULT_ON_THE_FLY_MIGRATION_V1_TO_V2),
                 v1ToV2QueueLength.orElse(DEFAULT_MIGRATION_V1_TO_V2_QUEUE_LENGTH),
-                v1ToV2ThreadCount.orElse(DEFAULT_MIGRATION_V1_TO_V2_THREAD_COUNT),
-                v1ToV2PollingDelay.orElse(DEFAULT_MIGRATION_V1_TO_V2_POLLING_DELAY));
+                v1ToV2ThreadCount.orElse(DEFAULT_MIGRATION_V1_TO_V2_THREAD_COUNT));
         }
     }
 
@@ -248,12 +234,14 @@ public class CassandraConfiguration {
     private final boolean onTheFlyV1ToV2Migration;
     private final int v1ToV2QueueLength;
     private final int v1ToV2ThreadCount;
-    private final int v1ToV2PollingDelay;
 
     @VisibleForTesting
-    CassandraConfiguration(int aclMaxRetry, int messageReadChunkSize, int expungeChunkSize,
int flagsUpdateChunkSize,
-                           int flagsUpdateMessageIdMaxRetry, int flagsUpdateMessageMaxRetry,
int modSeqMaxRetry,
-                           int uidMaxRetry, int fetchNextPageInAdvanceRow, int blobPartSize,
boolean onTheFlyV1ToV2Migration, int v1ToV2QueueLength, int v1ToV2ThreadCount, int v1ToV2PollingDelay)
{
+    CassandraConfiguration(int aclMaxRetry, int messageReadChunkSize, int expungeChunkSize,
+                           int flagsUpdateChunkSize, int flagsUpdateMessageIdMaxRetry, int
flagsUpdateMessageMaxRetry,
+                           int modSeqMaxRetry, int uidMaxRetry, int fetchNextPageInAdvanceRow,
+                           int blobPartSize, boolean onTheFlyV1ToV2Migration, int v1ToV2QueueLength,
+                           int v1ToV2ThreadCount
+    ) {
         this.aclMaxRetry = aclMaxRetry;
         this.messageReadChunkSize = messageReadChunkSize;
         this.expungeChunkSize = expungeChunkSize;
@@ -267,7 +255,6 @@ public class CassandraConfiguration {
         this.onTheFlyV1ToV2Migration = onTheFlyV1ToV2Migration;
         this.v1ToV2QueueLength = v1ToV2QueueLength;
         this.v1ToV2ThreadCount = v1ToV2ThreadCount;
-        this.v1ToV2PollingDelay = v1ToV2PollingDelay;
     }
 
     public int getBlobPartSize() {
@@ -322,10 +309,6 @@ public class CassandraConfiguration {
         return v1ToV2ThreadCount;
     }
 
-    public int getV1ToV2PollingDelay() {
-        return v1ToV2PollingDelay;
-    }
-
     @Override
     public final boolean equals(Object o) {
         if (o instanceof CassandraConfiguration) {
@@ -343,8 +326,7 @@ public class CassandraConfiguration {
                 && Objects.equals(this.blobPartSize, that.blobPartSize)
                 && Objects.equals(this.onTheFlyV1ToV2Migration, that.onTheFlyV1ToV2Migration)
                 && Objects.equals(this.v1ToV2ThreadCount, that.v1ToV2ThreadCount)
-                && Objects.equals(this.v1ToV2QueueLength, that.v1ToV2QueueLength)
-                && Objects.equals(this.v1ToV2PollingDelay, that.v1ToV2PollingDelay);
+                && Objects.equals(this.v1ToV2QueueLength, that.v1ToV2QueueLength);
         }
         return false;
     }
@@ -353,7 +335,7 @@ public class CassandraConfiguration {
     public final int hashCode() {
         return Objects.hash(aclMaxRetry, messageReadChunkSize, expungeChunkSize, flagsUpdateMessageIdMaxRetry,
             flagsUpdateMessageMaxRetry, modSeqMaxRetry, uidMaxRetry, fetchNextPageInAdvanceRow,
flagsUpdateChunkSize,
-            blobPartSize, onTheFlyV1ToV2Migration, v1ToV2ThreadCount, v1ToV2QueueLength,
v1ToV2PollingDelay);
+            blobPartSize, onTheFlyV1ToV2Migration, v1ToV2ThreadCount, v1ToV2QueueLength);
     }
 
     @Override
@@ -372,7 +354,6 @@ public class CassandraConfiguration {
             .add("onTheFlyV1ToV2Migration", onTheFlyV1ToV2Migration)
             .add("v1ToV2ThreadCount", v1ToV2ThreadCount)
             .add("v1ToV2QueueLength", v1ToV2QueueLength)
-            .add("v1ToV2PollingDelay", v1ToV2PollingDelay)
             .toString();
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/26ce1f4b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraConfigurationTest.java
----------------------------------------------------------------------
diff --git a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraConfigurationTest.java
b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraConfigurationTest.java
index cd705f2..e88d4a8 100644
--- a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraConfigurationTest.java
+++ b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraConfigurationTest.java
@@ -224,22 +224,6 @@ public class CassandraConfigurationTest {
     }
 
     @Test
-    public void v1toV2PollingDelayShouldThrowOnZero() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        CassandraConfiguration.builder()
-            .v1ToV2PollingDelay(0);
-    }
-
-    @Test
-    public void v1toV2PollingDelayShouldThrowOnNegative() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        CassandraConfiguration.builder()
-            .v1ToV2PollingDelay(-1);
-    }
-
-    @Test
     public void builderShouldCreateTheRightObject() {
         int aclMaxRetry = 1;
         int modSeqMaxRetry = 2;
@@ -254,7 +238,6 @@ public class CassandraConfigurationTest {
         boolean onTheFlyV1ToV2Migration = true;
         int v1ToV2ThreadCount = 11;
         int v1ToV2QueueLength = 12;
-        int v1ToV2PollingDelay = 13;
 
         CassandraConfiguration configuration = CassandraConfiguration.builder()
             .aclMaxRetry(aclMaxRetry)
@@ -270,7 +253,6 @@ public class CassandraConfigurationTest {
             .onTheFlyV1ToV2Migration(onTheFlyV1ToV2Migration)
             .v1ToV2ThreadCount(v1ToV2ThreadCount)
             .v1ToV2QueueLength(v1ToV2QueueLength)
-            .v1ToV2PollingDelay(v1ToV2PollingDelay)
             .build();
 
         softly.assertThat(configuration.getAclMaxRetry()).isEqualTo(aclMaxRetry);
@@ -286,7 +268,6 @@ public class CassandraConfigurationTest {
         softly.assertThat(configuration.isOnTheFlyV1ToV2Migration()).isEqualTo(onTheFlyV1ToV2Migration);
         softly.assertThat(configuration.getV1ToV2ThreadCount()).isEqualTo(v1ToV2ThreadCount);
         softly.assertThat(configuration.getV1ToV2QueueLength()).isEqualTo(v1ToV2QueueLength);
-        softly.assertThat(configuration.getV1ToV2PollingDelay()).isEqualTo(v1ToV2PollingDelay);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/26ce1f4b/dockerfiles/run/guice/cassandra-ldap/destination/conf/cassandra.properties
----------------------------------------------------------------------
diff --git a/dockerfiles/run/guice/cassandra-ldap/destination/conf/cassandra.properties b/dockerfiles/run/guice/cassandra-ldap/destination/conf/cassandra.properties
index 87768f7..9a7a175 100644
--- a/dockerfiles/run/guice/cassandra-ldap/destination/conf/cassandra.properties
+++ b/dockerfiles/run/guice/cassandra-ldap/destination/conf/cassandra.properties
@@ -21,4 +21,3 @@ cassandra.retryConnection.minDelay=5000
 # migration.v1.v2.on.the.fly=false
 # migration.v1.v2.thread.count=2
 # migration.v1.v2.queue.length=1000
-# migration.v1.v2.polling.delay.in.ms=10
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/26ce1f4b/dockerfiles/run/guice/cassandra/destination/conf/cassandra.properties
----------------------------------------------------------------------
diff --git a/dockerfiles/run/guice/cassandra/destination/conf/cassandra.properties b/dockerfiles/run/guice/cassandra/destination/conf/cassandra.properties
index 5ecf606..61d55de 100644
--- a/dockerfiles/run/guice/cassandra/destination/conf/cassandra.properties
+++ b/dockerfiles/run/guice/cassandra/destination/conf/cassandra.properties
@@ -30,4 +30,3 @@ cassandra.retryConnection.minDelay=5000
 # migration.v1.v2.on.the.fly=false
 # migration.v1.v2.thread.count=2
 # migration.v1.v2.queue.length=1000
-# migration.v1.v2.polling.delay.in.ms=10
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/26ce1f4b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAOV2.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAOV2.java
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAOV2.java
index 14d1d08..c6817ff 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAOV2.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAOV2.java
@@ -155,16 +155,14 @@ public class CassandraMessageDAOV2 {
 
     private CompletableFuture<Pair<Optional<BlobId>, Optional<BlobId>>>
saveContent(MailboxMessage message) throws MailboxException {
         try {
-            CompletableFuture<Optional<BlobId>> bodyContent = blobsDAO.save(
-                IOUtils.toByteArray(
-                    message.getBodyContent()));
-            CompletableFuture<Optional<BlobId>> headerContent = blobsDAO.save(
-                IOUtils.toByteArray(
-                    message.getHeaderContent()));
-
-            return bodyContent.thenCompose(bodyContentId ->
-                headerContent.thenApply(headerContentId ->
-                    Pair.of(bodyContentId, headerContentId)));
+            return CompletableFutureUtil.combine(
+                blobsDAO.save(
+                    IOUtils.toByteArray(
+                        message.getHeaderContent())),
+                blobsDAO.save(
+                    IOUtils.toByteArray(
+                        message.getBodyContent())),
+                Pair::of);
         } catch (IOException e) {
             throw new MailboxException("Error saving mail content", e);
         }
@@ -178,8 +176,8 @@ public class CassandraMessageDAOV2 {
             .setInt(BODY_START_OCTET, (int) (message.getHeaderOctets()))
             .setLong(FULL_CONTENT_OCTETS, message.getFullContentOctets())
             .setLong(BODY_OCTECTS, message.getBodyOctets())
-            .setString(BODY_CONTENT, pair.getLeft().map(BlobId::getId).orElse(DEFAULT_OBJECT_VALUE))
-            .setString(HEADER_CONTENT, pair.getRight().map(BlobId::getId).orElse(DEFAULT_OBJECT_VALUE))
+            .setString(BODY_CONTENT, pair.getRight().map(BlobId::getId).orElse(DEFAULT_OBJECT_VALUE))
+            .setString(HEADER_CONTENT, pair.getLeft().map(BlobId::getId).orElse(DEFAULT_OBJECT_VALUE))
             .setLong(TEXTUAL_LINE_COUNT, Optional.ofNullable(message.getTextualLineCount()).orElse(DEFAULT_LONG_VALUE))
             .setList(PROPERTIES, buildPropertiesUdt(message))
             .setList(ATTACHMENTS, buildAttachmentUdt(message));

http://git-wip-us.apache.org/repos/asf/james-project/blob/26ce1f4b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2Migration.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2Migration.java
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2Migration.java
index 8b38faf..7522b03 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2Migration.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2Migration.java
@@ -19,6 +19,7 @@
 
 package org.apache.james.mailbox.cassandra.mail.migration;
 
+import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -40,15 +41,19 @@ import org.apache.james.mailbox.cassandra.mail.utils.Limit;
 import org.apache.james.mailbox.store.mail.MessageMapper;
 
 import com.github.fge.lambdas.Throwing;
-import com.google.common.collect.EvictingQueue;
 import com.google.common.collect.ImmutableList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class V1ToV2Migration {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(V1ToV2MigrationThread.class);
+
     private final CassandraMessageDAO messageDAOV1;
     private final AttachmentLoader attachmentLoader;
     private final CassandraConfiguration cassandraConfiguration;
     private final ExecutorService migrationExecutor;
-    private final EvictingQueue<Pair<MessageWithoutAttachment, Stream<MessageAttachmentRepresentation>>>
messagesToBeMigrated;
+    private final ArrayBlockingQueue<Pair<MessageWithoutAttachment, Stream<MessageAttachmentRepresentation>>>
messagesToBeMigrated;
 
     @Inject
     public V1ToV2Migration(CassandraMessageDAO messageDAOV1, CassandraMessageDAOV2 messageDAOV2,
@@ -57,9 +62,10 @@ public class V1ToV2Migration {
         this.attachmentLoader = new AttachmentLoader(attachmentMapper);
         this.cassandraConfiguration = cassandraConfiguration;
         this.migrationExecutor = Executors.newFixedThreadPool(cassandraConfiguration.getV1ToV2ThreadCount());
-        this.messagesToBeMigrated = EvictingQueue.create(cassandraConfiguration.getV1ToV2QueueLength());
+        boolean ensureFifoOrder = false;
+        this.messagesToBeMigrated = new ArrayBlockingQueue<>(cassandraConfiguration.getV1ToV2QueueLength(),
ensureFifoOrder);
         IntStream.range(0, cassandraConfiguration.getV1ToV2ThreadCount())
-            .mapToObj(i -> new V1ToV2MigrationThread(messagesToBeMigrated, messageDAOV1,
messageDAOV2, attachmentLoader, cassandraConfiguration))
+            .mapToObj(i -> new V1ToV2MigrationThread(messagesToBeMigrated, messageDAOV1,
messageDAOV2, attachmentLoader))
             .forEach(migrationExecutor::execute);
     }
 
@@ -85,7 +91,9 @@ public class V1ToV2Migration {
     private Pair<MessageWithoutAttachment, Stream<MessageAttachmentRepresentation>>
submitMigration(Pair<MessageWithoutAttachment, Stream<MessageAttachmentRepresentation>>
messageV1) {
         if (cassandraConfiguration.isOnTheFlyV1ToV2Migration()) {
             synchronized (messagesToBeMigrated) {
-                messagesToBeMigrated.add(messageV1);
+                if (!messagesToBeMigrated.offer(messageV1)) {
+                    LOGGER.info("Migration queue is full message {} is ignored", messageV1.getLeft().getMessageId());
+                }
             }
         }
         return messageV1;

http://git-wip-us.apache.org/repos/asf/james-project/blob/26ce1f4b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2MigrationThread.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2MigrationThread.java
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2MigrationThread.java
index b4a5b1b..26c96d6 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2MigrationThread.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/migration/V1ToV2MigrationThread.java
@@ -20,11 +20,11 @@
 package org.apache.james.mailbox.cassandra.mail.migration;
 
 import java.util.Optional;
+import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.CompletableFuture;
 import java.util.stream.Stream;
 
 import org.apache.commons.lang3.tuple.Pair;
-import org.apache.james.backends.cassandra.CassandraConfiguration;
 import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
 import org.apache.james.mailbox.cassandra.mail.AttachmentLoader;
 import org.apache.james.mailbox.cassandra.mail.CassandraMessageDAO;
@@ -37,27 +37,21 @@ import org.apache.james.mailbox.store.mail.model.impl.SimpleMailboxMessage;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Throwables;
-import com.google.common.collect.EvictingQueue;
-
 public class V1ToV2MigrationThread implements Runnable {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(V1ToV2MigrationThread.class);
 
-    private final EvictingQueue<Pair<MessageWithoutAttachment, Stream<MessageAttachmentRepresentation>>>
messagesToBeMigrated;
+    private final BlockingQueue<Pair<MessageWithoutAttachment, Stream<MessageAttachmentRepresentation>>>
messagesToBeMigrated;
     private final CassandraMessageDAO messageDAOV1;
     private final CassandraMessageDAOV2 messageDAOV2;
     private final AttachmentLoader attachmentLoader;
-    private final CassandraConfiguration cassandraConfiguration;
 
-    public V1ToV2MigrationThread(EvictingQueue<Pair<MessageWithoutAttachment, Stream<MessageAttachmentRepresentation>>>
messagesToBeMigrated,
-                                 CassandraMessageDAO messageDAOV1, CassandraMessageDAOV2
messageDAOV2, AttachmentLoader attachmentLoader,
-                                 CassandraConfiguration cassandraConfiguration) {
+    public V1ToV2MigrationThread(BlockingQueue<Pair<MessageWithoutAttachment, Stream<MessageAttachmentRepresentation>>>
messagesToBeMigrated,
+                                 CassandraMessageDAO messageDAOV1, CassandraMessageDAOV2
messageDAOV2, AttachmentLoader attachmentLoader) {
         this.messagesToBeMigrated = messagesToBeMigrated;
         this.messageDAOV1 = messageDAOV1;
         this.messageDAOV2 = messageDAOV2;
         this.attachmentLoader = attachmentLoader;
-        this.cassandraConfiguration = cassandraConfiguration;
     }
 
     @Override
@@ -78,11 +72,6 @@ public class V1ToV2MigrationThread implements Runnable {
             if (poll.isPresent()) {
                 return poll.get();
             }
-            try {
-                Thread.sleep(cassandraConfiguration.getV1ToV2PollingDelay());
-            } catch (InterruptedException e) {
-                Throwables.propagate(e);
-            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/26ce1f4b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraSessionModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraSessionModule.java
b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraSessionModule.java
index 62ba82f..73be94a 100644
--- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraSessionModule.java
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraSessionModule.java
@@ -90,7 +90,6 @@ public class CassandraSessionModule extends AbstractModule {
     private static final String MIGRATION_V1_V2_ON_THE_FLY = "migration.v1.v2.on.the.fly";
     private static final String MIGRATION_V1_V2_THREAD_COUNT = "migration.v1.v2.thread.count";
     private static final String MIGRATION_V1_V2_QUEUE_LENGTH = "migration.v1.v2.queue.length";
-    private static final String MIGRATION_V1_V2_POLLING_DELAY = "migration.v1.v2.polling.delay.in.ms";
 
     @Override
     protected void configure() {
@@ -290,8 +289,6 @@ public class CassandraSessionModule extends AbstractModule {
                 propertiesConfiguration.getInteger(MIGRATION_V1_V2_THREAD_COUNT, null)))
             .v1ToV2QueueLength(Optional.ofNullable(
                 propertiesConfiguration.getInteger(MIGRATION_V1_V2_QUEUE_LENGTH, null)))
-            .v1ToV2PollingDelay(Optional.ofNullable(
-                propertiesConfiguration.getInteger(MIGRATION_V1_V2_POLLING_DELAY, null)))
             .build();
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/26ce1f4b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/mailbox/CassandraSessionModuleTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/mailbox/CassandraSessionModuleTest.java
b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/mailbox/CassandraSessionModuleTest.java
index aabfd17..0ae927c 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/mailbox/CassandraSessionModuleTest.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/mailbox/CassandraSessionModuleTest.java
@@ -63,7 +63,6 @@ public class CassandraSessionModuleTest {
                 .onTheFlyV1ToV2Migration(true)
                 .v1ToV2ThreadCount(11)
                 .v1ToV2QueueLength(12)
-                .v1ToV2PollingDelay(13)
                 .build());
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/26ce1f4b/server/container/guice/cassandra-guice/src/test/resources/modules/mailbox/cassandra.properties
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/resources/modules/mailbox/cassandra.properties
b/server/container/guice/cassandra-guice/src/test/resources/modules/mailbox/cassandra.properties
index f1f50cb..a625b28 100644
--- a/server/container/guice/cassandra-guice/src/test/resources/modules/mailbox/cassandra.properties
+++ b/server/container/guice/cassandra-guice/src/test/resources/modules/mailbox/cassandra.properties
@@ -11,4 +11,3 @@ mailbox.blob.part.size=10
 migration.v1.v2.on.the.fly=true
 migration.v1.v2.thread.count=11
 migration.v1.v2.queue.length=12
-migration.v1.v2.polling.delay.in.ms=13

http://git-wip-us.apache.org/repos/asf/james-project/blob/26ce1f4b/src/site/xdoc/server/config-cassandra.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/server/config-cassandra.xml b/src/site/xdoc/server/config-cassandra.xml
index ced7a96..cd3bb24 100644
--- a/src/site/xdoc/server/config-cassandra.xml
+++ b/src/site/xdoc/server/config-cassandra.xml
@@ -119,8 +119,6 @@
         <dd>Optional. Defaults to 2.<br/> Controls the number of threads used
to asynchronously migrate from v1 to v2.</dd>
         <dt><strong>migration.v1.v2.queue.length</strong></dt>
         <dd>Optional. Defaults to 1000.<br/> Controls the queue size of v1 to
v2 migration task. Drops when full.</dd>
-        <dt><strong>migration.v1.v2.polling.delay.in.ms</strong></dt>
-        <dd>Optional. Defaults to 10.<br/> Controls the polling delay for v1
to v2 migration threads.</dd>
       </dl>
 
 


---------------------------------------------------------------------
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