From 4753ffdf1e8529a636c5dbb6ee005bf2aeec2d76 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Thu, 21 Feb 2013 20:07:40 +0100 Subject: [PATCH] allow to set which queue implementation to use expert setting, but still would be great to be able to control it --- .../common/util/concurrent/ConcurrentCollections.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentCollections.java b/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentCollections.java index 14bd21a9ea7..2293f26a297 100644 --- a/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentCollections.java +++ b/src/main/java/org/elasticsearch/common/util/concurrent/ConcurrentCollections.java @@ -26,6 +26,7 @@ import java.util.Queue; import java.util.Set; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentMap; /** @@ -33,7 +34,8 @@ import java.util.concurrent.ConcurrentMap; */ public abstract class ConcurrentCollections { - private final static boolean useNonBlockingMap = Boolean.parseBoolean(System.getProperty("elasticsearch.useNonBlockingMap", "false")); + private final static boolean useNonBlockingMap = Boolean.parseBoolean(System.getProperty("es.useNonBlockingMap", "false")); + private final static boolean useLinkedTransferQueue = Boolean.parseBoolean(System.getProperty("es.useLinkedTransferQueue", "false")); public static ConcurrentMap newConcurrentMap() { // if (useNonBlockingMap) { @@ -57,7 +59,10 @@ public abstract class ConcurrentCollections { } public static Queue newQueue() { - return new LinkedTransferQueue(); + if (useLinkedTransferQueue) { + return new LinkedTransferQueue(); + } + return new ConcurrentLinkedQueue(); } public static BlockingQueue newBlockingQueue() {