allow to set which queue implementation to use
expert setting, but still would be great to be able to control it
This commit is contained in:
parent
5cce40fa5e
commit
4753ffdf1e
|
@ -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 <K, V> ConcurrentMap<K, V> newConcurrentMap() {
|
||||
// if (useNonBlockingMap) {
|
||||
|
@ -57,8 +59,11 @@ public abstract class ConcurrentCollections {
|
|||
}
|
||||
|
||||
public static <T> Queue<T> newQueue() {
|
||||
if (useLinkedTransferQueue) {
|
||||
return new LinkedTransferQueue<T>();
|
||||
}
|
||||
return new ConcurrentLinkedQueue<T>();
|
||||
}
|
||||
|
||||
public static <T> BlockingQueue<T> newBlockingQueue() {
|
||||
return new LinkedTransferQueue<T>();
|
||||
|
|
Loading…
Reference in New Issue