GH-9623: Fix ThreadStatePropagationChannelInterceptor for concurrency
Fixes: #9623
Issue link: https://github.com/spring-projects/spring-integration/issues/9623
The `ConcurrentModificationException` is thrown from the `ThreadStatePropagationChannelInterceptor.MessageWithThreadState.stateQueue`
which is a not thread-safe `LinkedList`
* Fix `ThreadStatePropagationChannelInterceptor.MessageWithThreadState.stateQueue` to be a `LinkedBlockingQueue` instead
(cherry picked from commit ba57ee8a1b)
This commit is contained in:
committed by
Spring Builds
parent
16f58243a2
commit
6d64b6ebb8
@@ -16,8 +16,8 @@
|
||||
|
||||
package org.springframework.integration.channel.interceptor;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import io.micrometer.common.lang.Nullable;
|
||||
|
||||
@@ -105,14 +105,14 @@ public abstract class ThreadStatePropagationChannelInterceptor<S> implements Exe
|
||||
private final Queue<Object> stateQueue;
|
||||
|
||||
MessageWithThreadState(Message<?> message, Object state) {
|
||||
this(message, new LinkedList<>());
|
||||
this(message, new LinkedBlockingQueue<>());
|
||||
this.stateQueue.add(state);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private MessageWithThreadState(Message<?> message, Queue<Object> stateQueue) {
|
||||
this.message = (Message<Object>) message;
|
||||
this.stateQueue = new LinkedList<>(stateQueue);
|
||||
this.stateQueue = new LinkedBlockingQueue<>(stateQueue);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user