You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/07/02 15:08:44 UTC
[camel] branch camel-3.11.x updated: CAMEL-16782: camel-core
ConcurrentModificationException with camel-ftp when service pool is
evicting from pool.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.11.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.11.x by this push:
new f128f68 CAMEL-16782: camel-core ConcurrentModificationException with camel-ftp when service pool is evicting from pool.
f128f68 is described below
commit f128f688cc68e438fc63799ffdbea834da53043b
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jul 2 17:06:34 2021 +0200
CAMEL-16782: camel-core ConcurrentModificationException with camel-ftp when service pool is evicting from pool.
---
.../src/main/java/org/apache/camel/support/cache/ServicePool.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/cache/ServicePool.java b/core/camel-support/src/main/java/org/apache/camel/support/cache/ServicePool.java
index 0dc1931..e98b71c 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/cache/ServicePool.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/cache/ServicePool.java
@@ -294,6 +294,7 @@ abstract class ServicePool<S extends Service> extends ServiceSupport implements
* thread at any given time.
*/
private class MultiplePool implements Pool<S> {
+ private final Object lock = new Object();
private final Endpoint endpoint;
private final BlockingQueue<S> queue;
private final List<S> evicts;
@@ -313,7 +314,7 @@ abstract class ServicePool<S extends Service> extends ServiceSupport implements
private void cleanupEvicts() {
if (!evicts.isEmpty()) {
- synchronized (this) {
+ synchronized (lock) {
if (!evicts.isEmpty()) {
for (S evict : evicts) {
doStop(evict);
@@ -365,7 +366,9 @@ abstract class ServicePool<S extends Service> extends ServiceSupport implements
@Override
public void evict(S s) {
// to be evicted
- evicts.add(s);
+ synchronized (lock) {
+ evicts.add(s);
+ }
}
@Override