james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matth...@apache.org
Subject [james-project] 03/09: JAMES-2786 DockerRabbitMQ use boolean instead of atomic boolean
Date Fri, 14 Jun 2019 16:32:54 GMT
This is an automated email from the ASF dual-hosted git repository.

matthieu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 61b6bdcfc2b2d8dbb9f7bb3cee5c5c9e1a404502
Author: Tran Tien Duc <dtran@linagora.com>
AuthorDate: Wed Jun 12 10:38:13 2019 +0700

    JAMES-2786 DockerRabbitMQ use boolean instead of atomic boolean
---
 .../org/apache/james/backend/rabbitmq/DockerRabbitMQ.java  | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQ.java
b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQ.java
index fa278a8..e786d6c 100644
--- a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQ.java
+++ b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQ.java
@@ -25,7 +25,6 @@ import java.net.URISyntaxException;
 import java.time.Duration;
 import java.util.Optional;
 import java.util.UUID;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.http.client.utils.URIBuilder;
 import org.apache.james.util.docker.Images;
@@ -67,7 +66,7 @@ public class DockerRabbitMQ {
     private final String nodeName;
     private final String rabbitHostName;
     private final String hostNameSuffix;
-    private final AtomicBoolean paused;
+    private boolean paused;
 
     public static DockerRabbitMQ withCookieAndHostName(String hostNamePrefix, String clusterIdentity,
String erlangCookie, Network network) {
         return new DockerRabbitMQ(Optional.ofNullable(hostNamePrefix), Optional.ofNullable(clusterIdentity),
Optional.ofNullable(erlangCookie), Optional.of(network));
@@ -79,7 +78,7 @@ public class DockerRabbitMQ {
 
     @SuppressWarnings("resource")
     private DockerRabbitMQ(Optional<String> hostNamePrefix, Optional<String>
clusterIdentity, Optional<String> erlangCookie, Optional<Network> net) {
-        paused = new AtomicBoolean(false);
+        paused = false;
         this.hostNameSuffix = clusterIdentity.orElse(UUID.randomUUID().toString());
         this.rabbitHostName = hostName(hostNamePrefix);
         this.container = new GenericContainer<>(Images.RABBITMQ)
@@ -239,13 +238,16 @@ public class DockerRabbitMQ {
     }
 
     public void pause() {
-        DockerClientFactory.instance().client().pauseContainerCmd(container.getContainerId()).exec();
-        paused.set(true);
+        if (!paused) {
+            DockerClientFactory.instance().client().pauseContainerCmd(container.getContainerId()).exec();
+            paused = true;
+        }
     }
 
     public void unpause() {
-        if (paused.compareAndSet(true, false)) {
+        if (paused) {
             DockerClientFactory.instance().client().unpauseContainerCmd(container.getContainerId()).exec();
+            paused = false;
         }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message