clebertsuconic commented on a change in pull request #3041: Two JIRAs around
Paging and AMQP
URL: https://github.com/apache/activemq-artemis/pull/3041#discussion_r396605633
##########
File path:
artemis-commons/src/main/java/org/apache/activemq/artemis/utils/actors/ProcessorBase.java
##########
@@ -99,45 +98,23 @@ public void shutdown(long timeout, TimeUnit unit) {
}
}
- /**
- * It will wait the current execution (if there is one) to finish
- * but will not complete any further executions
- */
+ /** It will shutdown the executor however it will not wait for finishing
tasks*/
public int shutdownNow(Consumer<? super T> onPendingItem) {
//alert anyone that has been requested (at least) an immediate shutdown
requestedForcedShutdown = true;
requestedShutdown = true;
- if (inHandler()) {
- stateUpdater.set(this, STATE_FORCED_SHUTDOWN);
- } else {
- //it could take a very long time depending on the current executing
task
- do {
- //alert the ExecutorTask (if is running) to just drain the current
backlog of tasks
- final int startState = stateUpdater.get(this);
- if (startState == STATE_FORCED_SHUTDOWN) {
- //another thread has completed a forced shutdown: let it to
manage the tasks cleanup
- break;
- }
- if (startState == STATE_RUNNING) {
- //wait 100 ms to avoid burning CPU while waiting and
- //give other threads a chance to make progress
- LockSupport.parkNanos(100_000_000L);
- }
- }
- while (!stateUpdater.compareAndSet(this, STATE_NOT_RUNNING,
STATE_FORCED_SHUTDOWN));
- //this could happen just one time: the forced shutdown state is the
last one and
- //can be set by just one caller.
- //As noted on the execute method there is a small chance that some
tasks would be enqueued
+ if (!inHandler()) {
+ flush(1, TimeUnit.SECONDS);
Review comment:
I was afraid of failures on the testsuite. In a production system the
component would be going down anyways.
I will try to remove the condition for good.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services