diff --git a/src/main/java/org/jboss/netty/util/internal/QueueFactory.java b/src/main/java/org/jboss/netty/util/internal/QueueFactory.java index d432edb622..0d6ee6437c 100644 --- a/src/main/java/org/jboss/netty/util/internal/QueueFactory.java +++ b/src/main/java/org/jboss/netty/util/internal/QueueFactory.java @@ -42,6 +42,12 @@ public final class QueueFactory { * @return queue the {@link BlockingQueue} implementation */ public static BlockingQueue createQueue(Class itemClass) { + // if we run in java >=7 its the best to just use the LinkedTransferQueue which + // comes with java bundled. See #273 + if (DetectionUtil.javaVersion() >= 7) { + return new java.util.concurrent.LinkedTransferQueue(); + } + try { if (useUnsafe) { return new LinkedTransferQueue(); @@ -68,6 +74,12 @@ public final class QueueFactory { * @return queue the {@link BlockingQueue} implementation */ public static BlockingQueue createQueue(Collection collection, Class itemClass) { + // if we run in java >=7 its the best to just use the LinkedTransferQueue which + // comes with java bundled. See #273 + if (DetectionUtil.javaVersion() >= 7) { + return new java.util.concurrent.LinkedTransferQueue(); + } + try { if (useUnsafe) { return new LinkedTransferQueue(collection);