[
https://issues.apache.org/jira/browse/ARTEMIS-1273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16080353#comment-16080353
]
ASF GitHub Bot commented on ARTEMIS-1273:
-----------------------------------------
Github user clebertsuconic commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/1390#discussion_r126428552
--- Diff:
artemis-commons/src/main/java/org/apache/activemq/artemis/utils/BoundedOrderedExecutorFactory.java
---
@@ -0,0 +1,269 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.utils;
+
+import java.util.Queue;
+import java.util.concurrent.Executor;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
+
+import org.apache.activemq.artemis.api.core.ActiveMQInterruptedException;
+import org.jboss.logging.Logger;
+import org.jctools.queues.MpscArrayQueue;
+import org.jctools.queues.MpscChunkedArrayQueue;
+import org.jctools.queues.SpscArrayQueue;
+import org.jctools.queues.SpscChunkedArrayQueue;
+import org.jctools.util.Pow2;
+
+/**
+ * A factory for producing executors that run all tasks in order, which
delegate to a single common executor instance.
+ */
+public final class BoundedOrderedExecutorFactory implements
ExecutorFactory {
--- End diff --
QueueArrayOrderedExecutor
> Bounded OrderedExecutor
> -----------------------
>
> Key: ARTEMIS-1273
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1273
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Components: Broker
> Reporter: Francesco Nigro
> Assignee: Francesco Nigro
>
> The default OrderedExecutor is limited by:
> # scattered allocations of linked list nodes
> # no OOM protection
> # always garbage producing
> # uses a not scalable (ie false sharing + CAS based) handmade spin lock
> # cost of monitoring pending tasks list size O(n)
> # doesn't allow optimized version of task submission (ie single producer)
> The BoundedOrderedExecutor (enabled by default) solves them:
> # uses Array based lock/wait-free queues to have contiguos allocations
> # OOM protected limiting the allowed max size of the queue
> # produce garbage only if the consumer can't keep up with the producer by a
> configurable amount
> # uses a scalable handmade spin lock (XADD based)
> # cost of monitoring pending tasks list size O(1)
> # allow optimized versions of task submission using different specialized
> concurrent queues
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)