You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2022/05/27 07:06:10 UTC
[james-project] branch master updated: JAMES-3772 Avoid calling block when invalidating channels (#1021)
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
The following commit(s) were added to refs/heads/master by this push:
new 14ac84eccc JAMES-3772 Avoid calling block when invalidating channels (#1021)
14ac84eccc is described below
commit 14ac84eccccfe1f9b645509b412ffe9e44a490f2
Author: Benoit TELLIER <bt...@linagora.com>
AuthorDate: Fri May 27 14:06:06 2022 +0700
JAMES-3772 Avoid calling block when invalidating channels (#1021)
---
.../apache/james/backends/rabbitmq/ReactorRabbitMQChannelPool.java | 6 ++++--
.../james/backends/rabbitmq/ReactorRabbitMQChannelPoolTest.java | 5 ++++-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/backends-common/rabbitmq/src/main/java/org/apache/james/backends/rabbitmq/ReactorRabbitMQChannelPool.java b/backends-common/rabbitmq/src/main/java/org/apache/james/backends/rabbitmq/ReactorRabbitMQChannelPool.java
index 218f375674..eb2160d8c9 100644
--- a/backends-common/rabbitmq/src/main/java/org/apache/james/backends/rabbitmq/ReactorRabbitMQChannelPool.java
+++ b/backends-common/rabbitmq/src/main/java/org/apache/james/backends/rabbitmq/ReactorRabbitMQChannelPool.java
@@ -728,11 +728,13 @@ public class ReactorRabbitMQChannelPool implements ChannelPool, Startable {
if (!channel.isOpen() || !executeWithoutError(signalType)) {
pooledRef.invalidate()
- .block();
+ .subscribeOn(Schedulers.elastic())
+ .subscribe();
return;
}
pooledRef.release()
- .block();
+ .subscribeOn(Schedulers.elastic())
+ .subscribe();
});
}
diff --git a/backends-common/rabbitmq/src/test/java/org/apache/james/backends/rabbitmq/ReactorRabbitMQChannelPoolTest.java b/backends-common/rabbitmq/src/test/java/org/apache/james/backends/rabbitmq/ReactorRabbitMQChannelPoolTest.java
index 271283481a..558eec7a34 100644
--- a/backends-common/rabbitmq/src/test/java/org/apache/james/backends/rabbitmq/ReactorRabbitMQChannelPoolTest.java
+++ b/backends-common/rabbitmq/src/test/java/org/apache/james/backends/rabbitmq/ReactorRabbitMQChannelPoolTest.java
@@ -96,11 +96,14 @@ class ReactorRabbitMQChannelPoolTest implements ChannelPoolContract {
}
@Test
- void usedChannelShouldBeClosedWhenPoolIsClosed() {
+ void usedChannelShouldBeClosedWhenPoolIsClosed() throws Exception {
ChannelPool channelPool = generateChannelPool(2);
Channel channel = channelPool.getChannelMono().block();
assertThat(channel.isOpen()).isTrue();
channelPool.close();
+
+ Thread.sleep(100); // Release of channels is done asynchronously
+
assertThat(channel.isOpen()).isFalse();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org