[
https://issues.apache.org/jira/browse/ARTEMIS-3604?focusedWorklogId=694009&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-694009
]
ASF GitHub Bot logged work on ARTEMIS-3604:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 10/Dec/21 14:45
Start Date: 10/Dec/21 14:45
Worklog Time Spent: 10m
Work Description: franz1981 commented on a change in pull request #3876:
URL: https://github.com/apache/activemq-artemis/pull/3876#discussion_r766733949
##########
File path:
artemis-commons/src/main/java/org/apache/activemq/artemis/utils/actors/BoundActor.java
##########
@@ -0,0 +1,79 @@
+/**
+ * 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.actors;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
+import java.util.function.ToIntFunction;
+
+public class BoundActor<T> extends ProcessorBase<Object> {
+
+ private static final AtomicIntegerFieldUpdater<BoundActor> SIZE_UPDATER =
AtomicIntegerFieldUpdater.newUpdater(BoundActor.class, "size");
+ private volatile int size = 0;
+
+ private static final AtomicIntegerFieldUpdater<BoundActor>
SCHEDULED_FUSH_UPDATER = AtomicIntegerFieldUpdater.newUpdater(BoundActor.class,
"scheduledFlush");
+ private volatile int scheduledFlush = 0;
+
+ private static final Object FLUSH = new Object();
+
+
+ final int maxSize;
+ final ToIntFunction<T> sizeGetter;
+ ActorListener<T> listener;
+
+ Runnable overLimit;
+ Runnable clearLimit;
+
+ public BoundActor(Executor parent, ActorListener<T> listener, int maxSize,
ToIntFunction<T> sizeGetter, Runnable overLimit, Runnable clearLimit) {
+ super(parent);
+ this.listener = listener;
+ this.maxSize = maxSize;
+ this.sizeGetter = sizeGetter;
+ this.overLimit = overLimit;
+ this.clearLimit = clearLimit;
+ }
+
+ @Override
+ protected final void doTask(Object task) {
+ if (task == FLUSH) {
+ this.scheduledFlush = 0;
Review comment:
@clebertsuconic this must be change to save bad things to happen
concurrently
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 694009)
Time Spent: 3h 20m (was: 3h 10m)
> Async sends could overflow server with messages in openwire
> -----------------------------------------------------------
>
> Key: ARTEMIS-3604
> URL: https://issues.apache.org/jira/browse/ARTEMIS-3604
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Reporter: Clebert Suconic
> Assignee: Clebert Suconic
> Priority: Major
> Fix For: 2.20.0
>
> Time Spent: 3h 20m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)