From e460887d87382e16badebc205ad77ae49d63bfdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 7 Aug 2018 11:23:21 +0200 Subject: [PATCH 001/328] Add optional retry logic to topology recovery There's no topology recovery retry by default. The default implementation is composable: not all have the recoverable entities have to retry and the retry operations don't have to be only the corresponding entity recovery, but also other operations, like recovering the corresponding channel. Fixes #387 (cherry picked from commit 34e33ea80b9c71dfc0b2cb929b40e707e6e0fcac) --- .../rabbitmq/client/ConnectionFactory.java | 18 ++ .../client/impl/ConnectionParams.java | 9 + .../recovery/AutorecoveringConnection.java | 109 ++++++-- .../client/impl/recovery/BackoffPolicy.java | 34 +++ .../impl/recovery/DefaultRetryHandler.java | 131 +++++++++ .../client/impl/recovery/RetryContext.java | 99 +++++++ .../client/impl/recovery/RetryHandler.java | 62 +++++ .../client/impl/recovery/RetryResult.java | 57 ++++ .../TopologyRecoveryRetryHandlerBuilder.java | 115 ++++++++ .../recovery/TopologyRecoveryRetryLogic.java | 85 ++++++ .../com/rabbitmq/client/test/ClientTests.java | 3 +- .../client/test/DefaultRetryHandlerTest.java | 257 ++++++++++++++++++ .../com/rabbitmq/client/test/TestUtils.java | 120 +++++++- .../test/functional/ConnectionRecovery.java | 36 +-- .../test/functional/FunctionalTests.java | 3 +- .../functional/TopologyRecoveryFiltering.java | 103 +------ .../functional/TopologyRecoveryRetry.java | 70 +++++ src/test/java/com/rabbitmq/tools/Host.java | 4 + 18 files changed, 1160 insertions(+), 155 deletions(-) create mode 100644 src/main/java/com/rabbitmq/client/impl/recovery/BackoffPolicy.java create mode 100644 src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java create mode 100644 src/main/java/com/rabbitmq/client/impl/recovery/RetryContext.java create mode 100644 src/main/java/com/rabbitmq/client/impl/recovery/RetryHandler.java create mode 100644 src/main/java/com/rabbitmq/client/impl/recovery/RetryResult.java create mode 100644 src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java create mode 100644 src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java create mode 100644 src/test/java/com/rabbitmq/client/test/DefaultRetryHandlerTest.java create mode 100644 src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index a35a55f64d..0816abdde3 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -29,6 +29,7 @@ import com.rabbitmq.client.impl.nio.NioParams; import com.rabbitmq.client.impl.nio.SocketChannelFrameHandlerFactory; import com.rabbitmq.client.impl.recovery.AutorecoveringConnection; +import com.rabbitmq.client.impl.recovery.RetryHandler; import com.rabbitmq.client.impl.recovery.TopologyRecoveryFilter; import java.io.IOException; @@ -192,6 +193,13 @@ public class ConnectionFactory implements Cloneable { */ private Predicate connectionRecoveryTriggeringCondition; + /** + * Retry handler for topology recovery. + * Default is no retry. + * @since 5.4.0 + */ + private RetryHandler topologyRecoveryRetryHandler; + /** @return the default host to use for connections */ public String getHost() { return host; @@ -1087,6 +1095,7 @@ public ConnectionParams params(ExecutorService consumerWorkServiceExecutor) { result.setErrorOnWriteListener(errorOnWriteListener); result.setTopologyRecoveryFilter(topologyRecoveryFilter); result.setConnectionRecoveryTriggeringCondition(connectionRecoveryTriggeringCondition); + result.setTopologyRecoveryRetryHandler(topologyRecoveryRetryHandler); return result; } @@ -1454,4 +1463,13 @@ public void setConnectionRecoveryTriggeringCondition(Predicate connectionRecoveryTriggeringCondition; + private RetryHandler topologyRecoveryRetryHandler; private ExceptionHandler exceptionHandler; private ThreadFactory threadFactory; @@ -257,4 +259,11 @@ public Predicate getConnectionRecoveryTriggeringConditi return connectionRecoveryTriggeringCondition; } + public void setTopologyRecoveryRetryHandler(RetryHandler topologyRecoveryRetryHandler) { + this.topologyRecoveryRetryHandler = topologyRecoveryRetryHandler; + } + + public RetryHandler getTopologyRecoveryRetryHandler() { + return topologyRecoveryRetryHandler; + } } diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java index 9223cb11aa..c3e66e0d2f 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java @@ -95,6 +95,8 @@ public class AutorecoveringConnection implements RecoverableConnection, NetworkC private final Predicate connectionRecoveryTriggeringCondition; + private final RetryHandler retryHandler; + public AutorecoveringConnection(ConnectionParams params, FrameHandlerFactory f, List
addrs) { this(params, f, new ListAddressResolver(addrs)); } @@ -115,6 +117,8 @@ public AutorecoveringConnection(ConnectionParams params, FrameHandlerFactory f, this.channels = new ConcurrentHashMap<>(); this.topologyRecoveryFilter = params.getTopologyRecoveryFilter() == null ? letAllPassFilter() : params.getTopologyRecoveryFilter(); + + this.retryHandler = params.getTopologyRecoveryRetryHandler(); } private void setupErrorOnWriteListenerForPotentialRecovery() { @@ -125,12 +129,9 @@ private void setupErrorOnWriteListenerForPotentialRecovery() { // we should trigger the error handling and the recovery only once if (errorOnWriteLock.tryLock()) { try { - Thread recoveryThread = threadFactory.newThread(new Runnable() { - @Override - public void run() { - AMQConnection c = (AMQConnection) connection; - c.handleIoError(exception); - } + Thread recoveryThread = threadFactory.newThread(() -> { + AMQConnection c = (AMQConnection) connection; + c.handleIoError(exception); }); recoveryThread.setName("RabbitMQ Error On Write Thread"); recoveryThread.start(); @@ -630,6 +631,10 @@ private void recoverChannels(final RecoveryAwareAMQConnection newConn) { } } + void recoverChannel(AutorecoveringChannel channel) throws IOException { + channel.automaticallyRecover(this, this.delegate); + } + private void notifyRecoveryListenersComplete() { for (RecoveryListener f : Utility.copy(this.recoveryListeners)) { f.handleRecovery(this); @@ -651,16 +656,16 @@ private void recoverTopology(final ExecutorService executor) { if (executor == null) { // recover entities in serial on the main connection thread for (final RecordedExchange exchange : Utility.copy(recordedExchanges).values()) { - recoverExchange(exchange); + recoverExchange(exchange, true); } for (final Map.Entry entry : Utility.copy(recordedQueues).entrySet()) { - recoverQueue(entry.getKey(), entry.getValue()); + recoverQueue(entry.getKey(), entry.getValue(), true); } for (final RecordedBinding b : Utility.copy(recordedBindings)) { - recoverBinding(b); + recoverBinding(b, true); } for (final Map.Entry entry : Utility.copy(consumers).entrySet()) { - recoverConsumer(entry.getKey(), entry.getValue()); + recoverConsumer(entry.getKey(), entry.getValue(), true); } } else { // Support recovering entities in parallel for connections that have a lot of queues, bindings, & consumers @@ -680,11 +685,19 @@ private void recoverTopology(final ExecutorService executor) { } } - private void recoverExchange(final RecordedExchange x) { + private void recoverExchange(RecordedExchange x, boolean retry) { // recorded exchanges are guaranteed to be non-predefined (we filter out predefined ones in exchangeDeclare). MK. try { if (topologyRecoveryFilter.filterExchange(x)) { - x.recover(); + if (retry) { + final RecordedExchange entity = x; + x = (RecordedExchange) wrapRetryIfNecessary(x, () -> { + entity.recover(); + return null; + }).getRecordedEntity(); + } else { + x.recover(); + } LOGGER.debug("{} has recovered", x); } } catch (Exception cause) { @@ -695,12 +708,20 @@ private void recoverExchange(final RecordedExchange x) { } } - private void recoverQueue(final String oldName, final RecordedQueue q) { + void recoverQueue(final String oldName, RecordedQueue q, boolean retry) { try { if (topologyRecoveryFilter.filterQueue(q)) { LOGGER.debug("Recovering {}", q); - q.recover(); + if (retry) { + final RecordedQueue entity = q; + q = (RecordedQueue) wrapRetryIfNecessary(q, () -> { + entity.recover(); + return null; + }).getRecordedEntity(); + } else { + q.recover(); + } String newName = q.getName(); if (!oldName.equals(newName)) { // make sure server-named queues are re-added with @@ -731,10 +752,18 @@ private void recoverQueue(final String oldName, final RecordedQueue q) { } } - private void recoverBinding(final RecordedBinding b) { + private void recoverBinding(RecordedBinding b, boolean retry) { try { if (this.topologyRecoveryFilter.filterBinding(b)) { - b.recover(); + if (retry) { + final RecordedBinding entity = b; + b = (RecordedBinding) wrapRetryIfNecessary(b, () -> { + entity.recover(); + return null; + }).getRecordedEntity(); + } else { + b.recover(); + } LOGGER.debug("{} has recovered", b); } } catch (Exception cause) { @@ -745,11 +774,20 @@ private void recoverBinding(final RecordedBinding b) { } } - private void recoverConsumer(final String tag, final RecordedConsumer consumer) { + private void recoverConsumer(final String tag, RecordedConsumer consumer, boolean retry) { try { if (this.topologyRecoveryFilter.filterConsumer(consumer)) { LOGGER.debug("Recovering {}", consumer); - String newTag = consumer.recover(); + String newTag = null; + if (retry) { + final RecordedConsumer entity = consumer; + RetryResult retryResult = wrapRetryIfNecessary(consumer, () -> entity.recover()); + consumer = (RecordedConsumer) retryResult.getRecordedEntity(); + newTag = (String) retryResult.getResult(); + } else { + newTag = consumer.recover(); + } + // make sure server-generated tags are re-added. MK. if(tag != null && !tag.equals(newTag)) { synchronized (this.consumers) { @@ -772,6 +810,33 @@ private void recoverConsumer(final String tag, final RecordedConsumer consumer) } } + private RetryResult wrapRetryIfNecessary(RecordedEntity entity, Callable recoveryAction) throws Exception { + if (this.retryHandler == null) { + T result = recoveryAction.call(); + return new RetryResult(entity, result); + } else { + try { + T result = recoveryAction.call(); + return new RetryResult(entity, result); + } catch (Exception e) { + RetryContext retryContext = new RetryContext(entity, e, this); + RetryResult retryResult; + if (entity instanceof RecordedQueue) { + retryResult = this.retryHandler.retryQueueRecovery(retryContext); + } else if (entity instanceof RecordedExchange) { + retryResult = this.retryHandler.retryExchangeRecovery(retryContext); + } else if (entity instanceof RecordedBinding) { + retryResult = this.retryHandler.retryBindingRecovery(retryContext); + } else if (entity instanceof RecordedConsumer) { + retryResult = this.retryHandler.retryConsumerRecovery(retryContext); + } else { + throw new IllegalArgumentException("Unknown type of recorded entity: " + entity); + } + return retryResult; + } + } + } + private void propagateQueueNameChangeToBindings(String oldName, String newName) { for (RecordedBinding b : Utility.copy(this.recordedBindings)) { if (b.getDestination().equals(oldName)) { @@ -820,15 +885,15 @@ private List> groupEntitiesByChannel callables.add(Executors.callable(() -> { for (final E entity : entityList) { if (entity instanceof RecordedExchange) { - recoverExchange((RecordedExchange)entity); + recoverExchange((RecordedExchange)entity, true); } else if (entity instanceof RecordedQueue) { final RecordedQueue q = (RecordedQueue) entity; - recoverQueue(q.getName(), q); + recoverQueue(q.getName(), q, true); } else if (entity instanceof RecordedBinding) { - recoverBinding((RecordedBinding) entity); + recoverBinding((RecordedBinding) entity, true); } else if (entity instanceof RecordedConsumer) { final RecordedConsumer c = (RecordedConsumer) entity; - recoverConsumer(c.getConsumerTag(), c); + recoverConsumer(c.getConsumerTag(), c, true); } } })); diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/BackoffPolicy.java b/src/main/java/com/rabbitmq/client/impl/recovery/BackoffPolicy.java new file mode 100644 index 0000000000..a05c2a8a3c --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/recovery/BackoffPolicy.java @@ -0,0 +1,34 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl.recovery; + +/** + * Backoff policy for topology recovery retry attempts. + * + * @see DefaultRetryHandler + * @see TopologyRecoveryRetryHandlerBuilder + * @since 5.4.0 + */ +@FunctionalInterface +public interface BackoffPolicy { + + /** + * Wait depending on the current attempt number (1, 2, 3, etc) + * @param attemptNumber current attempt number + * @throws InterruptedException + */ + void backoff(int attemptNumber) throws InterruptedException; +} diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java b/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java new file mode 100644 index 0000000000..8c9b1df3fd --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java @@ -0,0 +1,131 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl.recovery; + +import java.util.Objects; +import java.util.function.BiPredicate; + +/** + * Composable topology recovery retry handler. + * This retry handler implementations let the user choose the condition + * to trigger retry and the retry operation for each type of recoverable + * entities. The number of attempts and the backoff policy (time to wait + * between retries) are also configurable. + *

+ * See also {@link TopologyRecoveryRetryHandlerBuilder} to easily create + * instances and {@link TopologyRecoveryRetryLogic} for ready-to-use + * conditions and operations. + * + * @see TopologyRecoveryRetryHandlerBuilder + * @see TopologyRecoveryRetryLogic + * @since 5.4.0 + */ +public class DefaultRetryHandler implements RetryHandler { + + private final BiPredicate queueRecoveryRetryCondition; + private final BiPredicate exchangeRecoveryRetryCondition; + private final BiPredicate bindingRecoveryRetryCondition; + private final BiPredicate consumerRecoveryRetryCondition; + + private final RetryOperation queueRecoveryRetryOperation; + private final RetryOperation exchangeRecoveryRetryOperation; + private final RetryOperation bindingRecoveryRetryOperation; + private final RetryOperation consumerRecoveryRetryOperation; + + private final int retryAttempts; + + private final BackoffPolicy backoffPolicy; + + public DefaultRetryHandler(BiPredicate queueRecoveryRetryCondition, + BiPredicate exchangeRecoveryRetryCondition, + BiPredicate bindingRecoveryRetryCondition, + BiPredicate consumerRecoveryRetryCondition, + RetryOperation queueRecoveryRetryOperation, + RetryOperation exchangeRecoveryRetryOperation, + RetryOperation bindingRecoveryRetryOperation, + RetryOperation consumerRecoveryRetryOperation, int retryAttempts, BackoffPolicy backoffPolicy) { + this.queueRecoveryRetryCondition = queueRecoveryRetryCondition; + this.exchangeRecoveryRetryCondition = exchangeRecoveryRetryCondition; + this.bindingRecoveryRetryCondition = bindingRecoveryRetryCondition; + this.consumerRecoveryRetryCondition = consumerRecoveryRetryCondition; + this.queueRecoveryRetryOperation = queueRecoveryRetryOperation; + this.exchangeRecoveryRetryOperation = exchangeRecoveryRetryOperation; + this.bindingRecoveryRetryOperation = bindingRecoveryRetryOperation; + this.consumerRecoveryRetryOperation = consumerRecoveryRetryOperation; + this.backoffPolicy = backoffPolicy; + if (retryAttempts <= 0) { + throw new IllegalArgumentException("Number of retry attempts must be greater than 0"); + } + this.retryAttempts = retryAttempts; + } + + @Override + public RetryResult retryQueueRecovery(RetryContext context) throws Exception { + return doRetry(queueRecoveryRetryCondition, queueRecoveryRetryOperation, context.queue(), context); + } + + @Override + public RetryResult retryExchangeRecovery(RetryContext context) throws Exception { + return doRetry(exchangeRecoveryRetryCondition, exchangeRecoveryRetryOperation, context.exchange(), context); + } + + @Override + public RetryResult retryBindingRecovery(RetryContext context) throws Exception { + return doRetry(bindingRecoveryRetryCondition, bindingRecoveryRetryOperation, context.binding(), context); + } + + @Override + public RetryResult retryConsumerRecovery(RetryContext context) throws Exception { + return doRetry(consumerRecoveryRetryCondition, consumerRecoveryRetryOperation, context.consumer(), context); + } + + protected RetryResult doRetry(BiPredicate condition, RetryOperation operation, T entity, RetryContext context) + throws Exception { + int attempts = 0; + Exception exception = context.exception(); + while (attempts < retryAttempts) { + if (condition.test(entity, exception)) { + backoffPolicy.backoff(attempts + 1); + try { + Object result = operation.call(context); + return new RetryResult( + entity, result == null ? null : result.toString() + ); + } catch (Exception e) { + exception = e; + attempts++; + continue; + } + } else { + throw exception; + } + } + throw context.exception(); + } + + public interface RetryOperation { + + T call(RetryContext context) throws Exception; + + default RetryOperation andThen(RetryOperation after) { + Objects.requireNonNull(after); + return (context) -> { + call(context); + return after.call(context); + }; + } + } +} diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RetryContext.java b/src/main/java/com/rabbitmq/client/impl/recovery/RetryContext.java new file mode 100644 index 0000000000..a9bdc05e5f --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RetryContext.java @@ -0,0 +1,99 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl.recovery; + +/** + * The context of a topology recovery retry operation. + * + * @since 5.4.0 + */ +public class RetryContext { + + private final RecordedEntity entity; + + private final Exception exception; + + private final AutorecoveringConnection connection; + + public RetryContext(RecordedEntity entity, Exception exception, AutorecoveringConnection connection) { + this.entity = entity; + this.exception = exception; + this.connection = connection; + } + + /** + * The underlying connection. + * + * @return + */ + public AutorecoveringConnection connection() { + return connection; + } + + /** + * The exception that triggered the retry attempt. + * + * @return + */ + public Exception exception() { + return exception; + } + + /** + * The to-be-recovered entity. + * + * @return + */ + public RecordedEntity entity() { + return entity; + } + + /** + * The to-be-recovered entity as a queue. + * + * @return + */ + public RecordedQueue queue() { + return (RecordedQueue) entity; + } + + /** + * The to-be-recovered entity as an exchange. + * + * @return + */ + public RecordedExchange exchange() { + return (RecordedExchange) entity; + } + + /** + * The to-be-recovered entity as a binding. + * + * @return + */ + public RecordedBinding binding() { + return (RecordedBinding) entity; + } + + /** + * The to-be-recovered entity as a consumer. + * + * @return + */ + public RecordedConsumer consumer() { + return (RecordedConsumer) entity; + } +} diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RetryHandler.java b/src/main/java/com/rabbitmq/client/impl/recovery/RetryHandler.java new file mode 100644 index 0000000000..5ed7f823f0 --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RetryHandler.java @@ -0,0 +1,62 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl.recovery; + +/** + * Contract to retry failed operations during topology recovery. + * Not all operations have to be retried, it's a decision of the + * underlying implementation. + * + * @since 5.4.0 + */ +public interface RetryHandler { + + /** + * Retry a failed queue recovery operation. + * + * @param context the context of the retry + * @return the result of the retry attempt + * @throws Exception if the retry fails + */ + RetryResult retryQueueRecovery(RetryContext context) throws Exception; + + /** + * Retry a failed exchange recovery operation. + * + * @param context the context of the retry + * @return the result of the retry attempt + * @throws Exception if the retry fails + */ + RetryResult retryExchangeRecovery(RetryContext context) throws Exception; + + /** + * Retry a failed binding recovery operation. + * + * @param context the context of the retry + * @return the result of the retry attempt + * @throws Exception if the retry fails + */ + RetryResult retryBindingRecovery(RetryContext context) throws Exception; + + /** + * Retry a failed consumer recovery operation. + * + * @param context the context of the retry + * @return the result of the retry attempt + * @throws Exception if the retry fails + */ + RetryResult retryConsumerRecovery(RetryContext context) throws Exception; +} diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RetryResult.java b/src/main/java/com/rabbitmq/client/impl/recovery/RetryResult.java new file mode 100644 index 0000000000..c4797c39bf --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RetryResult.java @@ -0,0 +1,57 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl.recovery; + +/** + * The retry of a retried topology recovery operation. + * + * @since 5.4.0 + */ +public class RetryResult { + + /** + * The entity to recover. + */ + private final RecordedEntity recordedEntity; + + /** + * The result of the recovery operation. + * E.g. a consumer tag when recovering a consumer. + */ + private final Object result; + + public RetryResult(RecordedEntity recordedEntity, Object result) { + this.recordedEntity = recordedEntity; + this.result = result; + } + + /** + * The entity to recover. + * + * @return + */ + public RecordedEntity getRecordedEntity() { + return recordedEntity; + } + + /** + * The result of the recovery operation. + * E.g. a consumer tag when recovering a consumer. + */ + public Object getResult() { + return result; + } +} diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java new file mode 100644 index 0000000000..07141b43e5 --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java @@ -0,0 +1,115 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl.recovery; + +import java.util.function.BiPredicate; + +/** + * Builder to ease creation of {@link DefaultRetryHandler} instances. + *

+ * Just override what you need. By default, retry conditions don't trigger retry, + * retry operations are no-op, the number of retry attempts is 1, and the backoff + * policy doesn't wait at all. + * + * @see DefaultRetryHandler + * @see TopologyRecoveryRetryLogic + * @since 5.4.0 + */ +public class TopologyRecoveryRetryHandlerBuilder { + + private BiPredicate queueRecoveryRetryCondition = (q, e) -> false; + private BiPredicate exchangeRecoveryRetryCondition = (ex, e) -> false; + private BiPredicate bindingRecoveryRetryCondition = (b, e) -> false; + private BiPredicate consumerRecoveryRetryCondition = (c, e) -> false; + + private DefaultRetryHandler.RetryOperation queueRecoveryRetryOperation = context -> null; + private DefaultRetryHandler.RetryOperation exchangeRecoveryRetryOperation = context -> null; + private DefaultRetryHandler.RetryOperation bindingRecoveryRetryOperation = context -> null; + private DefaultRetryHandler.RetryOperation consumerRecoveryRetryOperation = context -> null; + + private int retryAttempts = 1; + + private BackoffPolicy backoffPolicy = nbAttempts -> { + }; + + public static TopologyRecoveryRetryHandlerBuilder builder() { + return new TopologyRecoveryRetryHandlerBuilder(); + } + + public TopologyRecoveryRetryHandlerBuilder queueRecoveryRetryCondition( + BiPredicate queueRecoveryRetryCondition) { + this.queueRecoveryRetryCondition = queueRecoveryRetryCondition; + return this; + } + + public TopologyRecoveryRetryHandlerBuilder exchangeRecoveryRetryCondition( + BiPredicate exchangeRecoveryRetryCondition) { + this.exchangeRecoveryRetryCondition = exchangeRecoveryRetryCondition; + return this; + } + + public TopologyRecoveryRetryHandlerBuilder bindingRecoveryRetryCondition( + BiPredicate bindingRecoveryRetryCondition) { + this.bindingRecoveryRetryCondition = bindingRecoveryRetryCondition; + return this; + } + + public TopologyRecoveryRetryHandlerBuilder consumerRecoveryRetryCondition( + BiPredicate consumerRecoveryRetryCondition) { + this.consumerRecoveryRetryCondition = consumerRecoveryRetryCondition; + return this; + } + + public TopologyRecoveryRetryHandlerBuilder queueRecoveryRetryOperation(DefaultRetryHandler.RetryOperation queueRecoveryRetryOperation) { + this.queueRecoveryRetryOperation = queueRecoveryRetryOperation; + return this; + } + + public TopologyRecoveryRetryHandlerBuilder exchangeRecoveryRetryOperation(DefaultRetryHandler.RetryOperation exchangeRecoveryRetryOperation) { + this.exchangeRecoveryRetryOperation = exchangeRecoveryRetryOperation; + return this; + } + + public TopologyRecoveryRetryHandlerBuilder bindingRecoveryRetryOperation(DefaultRetryHandler.RetryOperation bindingRecoveryRetryOperation) { + this.bindingRecoveryRetryOperation = bindingRecoveryRetryOperation; + return this; + } + + public TopologyRecoveryRetryHandlerBuilder consumerRecoveryRetryOperation(DefaultRetryHandler.RetryOperation consumerRecoveryRetryOperation) { + this.consumerRecoveryRetryOperation = consumerRecoveryRetryOperation; + return this; + } + + public TopologyRecoveryRetryHandlerBuilder backoffPolicy(BackoffPolicy backoffPolicy) { + this.backoffPolicy = backoffPolicy; + return this; + } + + public TopologyRecoveryRetryHandlerBuilder retryAttempts(int retryAttempts) { + this.retryAttempts = retryAttempts; + return this; + } + + public RetryHandler build() { + return new DefaultRetryHandler( + queueRecoveryRetryCondition, exchangeRecoveryRetryCondition, + bindingRecoveryRetryCondition, consumerRecoveryRetryCondition, + queueRecoveryRetryOperation, exchangeRecoveryRetryOperation, + bindingRecoveryRetryOperation, consumerRecoveryRetryOperation, + retryAttempts, + backoffPolicy); + } +} diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java new file mode 100644 index 0000000000..8e6e16a790 --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java @@ -0,0 +1,85 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl.recovery; + +import com.rabbitmq.client.AMQP; +import com.rabbitmq.client.ShutdownSignalException; + +import java.util.function.Predicate; + +/** + * Useful ready-to-use conditions and operations for {@link DefaultRetryHandler}. + * They're composed and used with the {@link TopologyRecoveryRetryHandlerBuilder}. + * + * @see DefaultRetryHandler + * @see RetryHandler + * @see TopologyRecoveryRetryHandlerBuilder + * @since 5.4.0 + */ +public abstract class TopologyRecoveryRetryLogic { + + public static final Predicate CHANNEL_CLOSED_NOT_FOUND = e -> { + if (e.getCause() instanceof ShutdownSignalException) { + ShutdownSignalException cause = (ShutdownSignalException) e.getCause(); + if (cause.getReason() instanceof AMQP.Channel.Close) { + return ((AMQP.Channel.Close) cause.getReason()).getReplyCode() == 404; + } + } + return false; + }; + + public static final DefaultRetryHandler.RetryOperation RECOVER_CHANNEL = context -> { + if (!context.entity().getChannel().isOpen()) { + context.connection().recoverChannel(context.entity().getChannel()); + } + return null; + }; + + public static final DefaultRetryHandler.RetryOperation RECOVER_BINDING_QUEUE = context -> { + if (context.entity() instanceof RecordedQueueBinding) { + RecordedBinding binding = context.binding(); + AutorecoveringConnection connection = context.connection(); + RecordedQueue recordedQueue = connection.getRecordedQueues().get(binding.getDestination()); + if (recordedQueue != null) { + connection.recoverQueue( + recordedQueue.getName(), recordedQueue, false + ); + } + } + return null; + }; + + public static final DefaultRetryHandler.RetryOperation RECOVER_BINDING = context -> { + context.binding().recover(); + return null; + }; + + public static final DefaultRetryHandler.RetryOperation RECOVER_CONSUMER_QUEUE = context -> { + if (context.entity() instanceof RecordedConsumer) { + RecordedConsumer consumer = context.consumer(); + AutorecoveringConnection connection = context.connection(); + RecordedQueue recordedQueue = connection.getRecordedQueues().get(consumer.getQueue()); + if (recordedQueue != null) { + connection.recoverQueue( + recordedQueue.getName(), recordedQueue, false + ); + } + } + return null; + }; + + public static final DefaultRetryHandler.RetryOperation RECOVER_CONSUMER = context -> context.consumer().recover(); +} diff --git a/src/test/java/com/rabbitmq/client/test/ClientTests.java b/src/test/java/com/rabbitmq/client/test/ClientTests.java index 3747c71be9..9c2994b671 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientTests.java +++ b/src/test/java/com/rabbitmq/client/test/ClientTests.java @@ -62,7 +62,8 @@ StrictExceptionHandlerTest.class, NoAutoRecoveryWhenTcpWindowIsFullTest.class, JsonRpcTest.class, - AddressTest.class + AddressTest.class, + DefaultRetryHandlerTest.class }) public class ClientTests { diff --git a/src/test/java/com/rabbitmq/client/test/DefaultRetryHandlerTest.java b/src/test/java/com/rabbitmq/client/test/DefaultRetryHandlerTest.java new file mode 100644 index 0000000000..cc105304a7 --- /dev/null +++ b/src/test/java/com/rabbitmq/client/test/DefaultRetryHandlerTest.java @@ -0,0 +1,257 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.test; + +import com.rabbitmq.client.impl.recovery.BackoffPolicy; +import com.rabbitmq.client.impl.recovery.DefaultRetryHandler; +import com.rabbitmq.client.impl.recovery.RecordedBinding; +import com.rabbitmq.client.impl.recovery.RecordedConsumer; +import com.rabbitmq.client.impl.recovery.RecordedExchange; +import com.rabbitmq.client.impl.recovery.RecordedQueue; +import com.rabbitmq.client.impl.recovery.RetryContext; +import com.rabbitmq.client.impl.recovery.RetryHandler; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.verification.VerificationMode; + +import java.util.concurrent.Callable; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.BiPredicate; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.intThat; +import static org.mockito.ArgumentMatchers.nullable; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.mockito.MockitoAnnotations.initMocks; + +/** + * + */ +public class DefaultRetryHandlerTest { + + RetryHandler handler; + + @Mock + BiPredicate queueRecoveryRetryCondition; + @Mock + BiPredicate exchangeRecoveryRetryCondition; + @Mock + BiPredicate bindingRecoveryRetryCondition; + @Mock + BiPredicate consumerRecoveryRetryCondition; + + @Mock + DefaultRetryHandler.RetryOperation queueRecoveryRetryOperation; + @Mock + DefaultRetryHandler.RetryOperation exchangeRecoveryRetryOperation; + @Mock + DefaultRetryHandler.RetryOperation bindingRecoveryRetryOperation; + @Mock + DefaultRetryHandler.RetryOperation consumerRecoveryRetryOperation; + + @Mock + BackoffPolicy backoffPolicy; + + @Before + public void init() { + initMocks(this); + } + + @Test + public void shouldNotRetryWhenConditionReturnsFalse() throws Exception { + conditionsReturn(false); + handler = handler(); + assertExceptionIsThrown( + "No retry, initial exception should have been re-thrown", + () -> handler.retryQueueRecovery(retryContext()) + ); + assertExceptionIsThrown( + "No retry, initial exception should have been re-thrown", + () -> handler.retryExchangeRecovery(retryContext()) + ); + assertExceptionIsThrown( + "No retry, initial exception should have been re-thrown", + () -> handler.retryBindingRecovery(retryContext()) + ); + assertExceptionIsThrown( + "No retry, initial exception should have been re-thrown", + () -> handler.retryConsumerRecovery(retryContext()) + ); + verifyConditionsInvocation(times(1)); + verifyOperationsInvocation(never()); + verify(backoffPolicy, never()).backoff(anyInt()); + } + + @Test + public void shouldReturnOperationResultInRetryResultWhenRetrying() throws Exception { + conditionsReturn(true); + when(queueRecoveryRetryOperation.call(any(RetryContext.class))).thenReturn("queue"); + when(exchangeRecoveryRetryOperation.call(any(RetryContext.class))).thenReturn("exchange"); + when(bindingRecoveryRetryOperation.call(any(RetryContext.class))).thenReturn("binding"); + when(consumerRecoveryRetryOperation.call(any(RetryContext.class))).thenReturn("consumer"); + handler = handler(); + assertEquals( + "queue", + handler.retryQueueRecovery(retryContext()).getResult() + ); + assertEquals( + "exchange", + handler.retryExchangeRecovery(retryContext()).getResult() + ); + assertEquals( + "binding", + handler.retryBindingRecovery(retryContext()).getResult() + ); + assertEquals( + "consumer", + handler.retryConsumerRecovery(retryContext()).getResult() + ); + verifyConditionsInvocation(times(1)); + verifyOperationsInvocation(times(1)); + verify(backoffPolicy, times(1 * 4)).backoff(1); + } + + @Test + public void shouldRetryWhenOperationFailsAndConditionIsTrue() throws Exception { + conditionsReturn(true); + when(queueRecoveryRetryOperation.call(any(RetryContext.class))) + .thenThrow(new Exception()).thenReturn("queue"); + when(exchangeRecoveryRetryOperation.call(any(RetryContext.class))) + .thenThrow(new Exception()).thenReturn("exchange"); + when(bindingRecoveryRetryOperation.call(any(RetryContext.class))) + .thenThrow(new Exception()).thenReturn("binding"); + when(consumerRecoveryRetryOperation.call(any(RetryContext.class))) + .thenThrow(new Exception()).thenReturn("consumer"); + handler = handler(2); + assertEquals( + "queue", + handler.retryQueueRecovery(retryContext()).getResult() + ); + assertEquals( + "exchange", + handler.retryExchangeRecovery(retryContext()).getResult() + ); + assertEquals( + "binding", + handler.retryBindingRecovery(retryContext()).getResult() + ); + assertEquals( + "consumer", + handler.retryConsumerRecovery(retryContext()).getResult() + ); + verifyConditionsInvocation(times(2)); + verifyOperationsInvocation(times(2)); + checkBackoffSequence(1, 2, 1, 2, 1, 2, 1, 2); + } + + @Test + public void shouldThrowExceptionWhenRetryAttemptsIsExceeded() throws Exception { + conditionsReturn(true); + when(queueRecoveryRetryOperation.call(any(RetryContext.class))) + .thenThrow(new Exception()); + when(exchangeRecoveryRetryOperation.call(any(RetryContext.class))) + .thenThrow(new Exception()); + when(bindingRecoveryRetryOperation.call(any(RetryContext.class))) + .thenThrow(new Exception()); + when(consumerRecoveryRetryOperation.call(any(RetryContext.class))) + .thenThrow(new Exception()); + handler = handler(3); + assertExceptionIsThrown( + "Retry exhausted, an exception should have been thrown", + () -> handler.retryQueueRecovery(retryContext()) + ); + assertExceptionIsThrown( + "Retry exhausted, an exception should have been thrown", + () -> handler.retryExchangeRecovery(retryContext()) + ); + assertExceptionIsThrown( + "Retry exhausted, an exception should have been thrown", + () -> handler.retryBindingRecovery(retryContext()) + ); + assertExceptionIsThrown( + "Retry exhausted, an exception should have been thrown", + () -> handler.retryConsumerRecovery(retryContext()) + ); + verifyConditionsInvocation(times(3)); + verifyOperationsInvocation(times(3)); + checkBackoffSequence(1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3); + } + + private void assertExceptionIsThrown(String message, Callable action) { + try { + action.call(); + fail(message); + } catch (Exception e) { + } + } + + private void conditionsReturn(boolean shouldRetry) { + when(queueRecoveryRetryCondition.test(nullable(RecordedQueue.class), nullable(Exception.class))) + .thenReturn(shouldRetry); + when(exchangeRecoveryRetryCondition.test(nullable(RecordedExchange.class), nullable(Exception.class))) + .thenReturn(shouldRetry); + when(bindingRecoveryRetryCondition.test(nullable(RecordedBinding.class), nullable(Exception.class))) + .thenReturn(shouldRetry); + when(consumerRecoveryRetryCondition.test(nullable(RecordedConsumer.class), nullable(Exception.class))) + .thenReturn(shouldRetry); + } + + private void verifyConditionsInvocation(VerificationMode mode) { + verify(queueRecoveryRetryCondition, mode).test(nullable(RecordedQueue.class), any(Exception.class)); + verify(exchangeRecoveryRetryCondition, mode).test(nullable(RecordedExchange.class), any(Exception.class)); + verify(bindingRecoveryRetryCondition, mode).test(nullable(RecordedBinding.class), any(Exception.class)); + verify(consumerRecoveryRetryCondition, mode).test(nullable(RecordedConsumer.class), any(Exception.class)); + } + + private void verifyOperationsInvocation(VerificationMode mode) throws Exception { + verify(queueRecoveryRetryOperation, mode).call(any(RetryContext.class)); + verify(exchangeRecoveryRetryOperation, mode).call(any(RetryContext.class)); + verify(bindingRecoveryRetryOperation, mode).call(any(RetryContext.class)); + verify(consumerRecoveryRetryOperation, mode).call(any(RetryContext.class)); + } + + private RetryHandler handler() { + return handler(1); + } + + private RetryHandler handler(int retryAttempts) { + return new DefaultRetryHandler( + queueRecoveryRetryCondition, exchangeRecoveryRetryCondition, + bindingRecoveryRetryCondition, consumerRecoveryRetryCondition, + queueRecoveryRetryOperation, exchangeRecoveryRetryOperation, + bindingRecoveryRetryOperation, consumerRecoveryRetryOperation, + retryAttempts, + backoffPolicy); + } + + private RetryContext retryContext() { + return new RetryContext(null, new Exception(), null); + } + + private void checkBackoffSequence(int... sequence) throws InterruptedException { + AtomicInteger count = new AtomicInteger(0); + verify(backoffPolicy, times(sequence.length)) + // for some reason Mockito calls the matchers twice as many times as the target method + .backoff(intThat(i -> i == sequence[count.getAndIncrement() % sequence.length])); + } +} diff --git a/src/test/java/com/rabbitmq/client/test/TestUtils.java b/src/test/java/com/rabbitmq/client/test/TestUtils.java index 644f3a1707..c44e8b26a4 100644 --- a/src/test/java/com/rabbitmq/client/test/TestUtils.java +++ b/src/test/java/com/rabbitmq/client/test/TestUtils.java @@ -15,11 +15,28 @@ package com.rabbitmq.client.test; +import com.rabbitmq.client.AMQP; +import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; import com.rabbitmq.client.ConnectionFactory; +import com.rabbitmq.client.DefaultConsumer; +import com.rabbitmq.client.Envelope; +import com.rabbitmq.client.Recoverable; +import com.rabbitmq.client.RecoverableConnection; +import com.rabbitmq.client.RecoveryListener; +import com.rabbitmq.client.ShutdownSignalException; +import com.rabbitmq.client.impl.NetworkConnection; +import com.rabbitmq.client.impl.recovery.AutorecoveringConnection; +import com.rabbitmq.tools.Host; import org.slf4j.LoggerFactory; import java.io.IOException; +import java.util.concurrent.Callable; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +import static org.junit.Assert.assertTrue; public class TestUtils { @@ -27,7 +44,7 @@ public class TestUtils { public static ConnectionFactory connectionFactory() { ConnectionFactory connectionFactory = new ConnectionFactory(); - if(USE_NIO) { + if (USE_NIO) { connectionFactory.useNio(); } else { connectionFactory.useBlockingIo(); @@ -36,7 +53,7 @@ public static ConnectionFactory connectionFactory() { } public static void close(Connection connection) { - if(connection != null) { + if (connection != null) { try { connection.close(); } catch (IOException e) { @@ -66,12 +83,108 @@ public static boolean isVersion37orLater(Connection connection) { LoggerFactory.getLogger(TestUtils.class).warn("Unable to parse broker version {}", currentVersion, e); throw e; } + } + + public static boolean sendAndConsumeMessage(String exchange, String routingKey, String queue, Connection c) + throws IOException, TimeoutException, InterruptedException { + Channel ch = c.createChannel(); + try { + ch.confirmSelect(); + final CountDownLatch latch = new CountDownLatch(1); + ch.basicConsume(queue, true, new DefaultConsumer(ch) { + @Override + public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { + latch.countDown(); + } + }); + ch.basicPublish(exchange, routingKey, null, "".getBytes()); + ch.waitForConfirmsOrDie(5000); + return latch.await(5, TimeUnit.SECONDS); + } finally { + if (ch != null && ch.isOpen()) { + ch.close(); + } + } + } + + public static boolean resourceExists(Callable callback) throws Exception { + Channel declarePassiveChannel = null; + try { + declarePassiveChannel = callback.call(); + return true; + } catch (IOException e) { + if (e.getCause() instanceof ShutdownSignalException) { + ShutdownSignalException cause = (ShutdownSignalException) e.getCause(); + if (cause.getReason() instanceof AMQP.Channel.Close) { + if (((AMQP.Channel.Close) cause.getReason()).getReplyCode() == 404) { + return false; + } else { + throw e; + } + } + return false; + } else { + throw e; + } + } finally { + if (declarePassiveChannel != null && declarePassiveChannel.isOpen()) { + declarePassiveChannel.close(); + } + } + } + + public static boolean queueExists(final String queue, final Connection connection) throws Exception { + return resourceExists(() -> { + Channel channel = connection.createChannel(); + channel.queueDeclarePassive(queue); + return channel; + }); + } + + public static boolean exchangeExists(final String exchange, final Connection connection) throws Exception { + return resourceExists(() -> { + Channel channel = connection.createChannel(); + channel.exchangeDeclarePassive(exchange); + return channel; + }); + } + + public static void closeAndWaitForRecovery(RecoverableConnection connection) throws IOException, InterruptedException { + CountDownLatch latch = prepareForRecovery(connection); + Host.closeConnection((NetworkConnection) connection); + wait(latch); + } + + public static void closeAllConnectionsAndWaitForRecovery(Connection connection) throws IOException, InterruptedException { + CountDownLatch latch = prepareForRecovery(connection); + Host.closeAllConnections(); + wait(latch); + } + + public static CountDownLatch prepareForRecovery(Connection conn) { + final CountDownLatch latch = new CountDownLatch(1); + ((AutorecoveringConnection) conn).addRecoveryListener(new RecoveryListener() { + + @Override + public void handleRecovery(Recoverable recoverable) { + latch.countDown(); + } + + @Override + public void handleRecoveryStarted(Recoverable recoverable) { + // No-op + } + }); + return latch; + } + + private static void wait(CountDownLatch latch) throws InterruptedException { + assertTrue(latch.await(90, TimeUnit.SECONDS)); } /** * http://stackoverflow.com/questions/6701948/efficient-way-to-compare-version-strings-in-java - * */ static int versionCompare(String str1, String str2) { String[] vals1 = str1.split("\\."); @@ -90,5 +203,4 @@ static int versionCompare(String str1, String str2) { // e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4" return Integer.signum(vals1.length - vals2.length); } - } diff --git a/src/test/java/com/rabbitmq/client/test/functional/ConnectionRecovery.java b/src/test/java/com/rabbitmq/client/test/functional/ConnectionRecovery.java index a89bb16995..04cf8b04d2 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ConnectionRecovery.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ConnectionRecovery.java @@ -39,6 +39,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; +import static com.rabbitmq.client.test.TestUtils.prepareForRecovery; import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.is; import static org.junit.Assert.*; @@ -62,7 +63,7 @@ public class ConnectionRecovery extends BrokerTestCase { try { assertTrue(c.isOpen()); assertEquals(connectionName, c.getClientProvidedName()); - closeAndWaitForRecovery(c); + TestUtils.closeAndWaitForRecovery(c); assertTrue(c.isOpen()); assertEquals(connectionName, c.getClientProvidedName()); } finally { @@ -82,7 +83,7 @@ public class ConnectionRecovery extends BrokerTestCase { RecoverableConnection c = newRecoveringConnection(addresses); try { assertTrue(c.isOpen()); - closeAndWaitForRecovery(c); + TestUtils.closeAndWaitForRecovery(c); assertTrue(c.isOpen()); } finally { c.abort(); @@ -98,7 +99,7 @@ public class ConnectionRecovery extends BrokerTestCase { RecoverableConnection c = newRecoveringConnection(addresses); try { assertTrue(c.isOpen()); - closeAndWaitForRecovery(c); + TestUtils.closeAndWaitForRecovery(c); assertTrue(c.isOpen()); } finally { c.abort(); @@ -157,7 +158,7 @@ public String getPassword() { assertThat(usernameRequested.get(), is(1)); assertThat(passwordRequested.get(), is(1)); - closeAndWaitForRecovery(c); + TestUtils.closeAndWaitForRecovery(c); assertTrue(c.isOpen()); // username is requested in AMQConnection#toString, so it can be accessed at any time assertThat(usernameRequested.get(), greaterThanOrEqualTo(2)); @@ -804,7 +805,7 @@ public void handleDelivery(String consumerTag, Connection testConnection = connectionFactory.newConnection(); try { assertTrue(testConnection.isOpen()); - closeAndWaitForRecovery((RecoverableConnection) testConnection); + TestUtils.closeAndWaitForRecovery((RecoverableConnection) testConnection); assertTrue(testConnection.isOpen()); } finally { connection.close(); @@ -851,7 +852,7 @@ public void handleDelivery(String consumerTag, Envelope envelope, BasicPropertie } } // now do recovery - closeAndWaitForRecovery(testConnection); + TestUtils.closeAndWaitForRecovery(testConnection); // verify channels & topology recovered by publishing a message to each for (int i=0; i < channelCount; i++) { @@ -935,21 +936,6 @@ private static void expectExchangeRecovery(Channel ch, String x) throws IOExcept ch.exchangeDeclarePassive(x); } - private static CountDownLatch prepareForRecovery(Connection conn) { - final CountDownLatch latch = new CountDownLatch(1); - ((AutorecoveringConnection)conn).addRecoveryListener(new RecoveryListener() { - @Override - public void handleRecovery(Recoverable recoverable) { - latch.countDown(); - } - @Override - public void handleRecoveryStarted(Recoverable recoverable) { - // No-op - } - }); - return latch; - } - private static CountDownLatch prepareForShutdown(Connection conn) { final CountDownLatch latch = new CountDownLatch(1); conn.addShutdownListener(new ShutdownListener() { @@ -962,13 +948,7 @@ public void shutdownCompleted(ShutdownSignalException cause) { } private void closeAndWaitForRecovery() throws IOException, InterruptedException { - closeAndWaitForRecovery((AutorecoveringConnection)this.connection); - } - - private static void closeAndWaitForRecovery(RecoverableConnection connection) throws IOException, InterruptedException { - CountDownLatch latch = prepareForRecovery(connection); - Host.closeConnection((NetworkConnection) connection); - wait(latch); + TestUtils.closeAndWaitForRecovery((AutorecoveringConnection)this.connection); } private void restartPrimaryAndWaitForRecovery() throws IOException, InterruptedException { diff --git a/src/test/java/com/rabbitmq/client/test/functional/FunctionalTests.java b/src/test/java/com/rabbitmq/client/test/functional/FunctionalTests.java index aeadb303dd..fb48f29585 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/FunctionalTests.java +++ b/src/test/java/com/rabbitmq/client/test/functional/FunctionalTests.java @@ -78,7 +78,8 @@ Nack.class, ExceptionMessages.class, Metrics.class, - TopologyRecoveryFiltering.class + TopologyRecoveryFiltering.class, + TopologyRecoveryRetry.class }) public class FunctionalTests { diff --git a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryFiltering.java b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryFiltering.java index 480075258f..3eb9687eea 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryFiltering.java +++ b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryFiltering.java @@ -21,12 +21,7 @@ import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.DefaultConsumer; import com.rabbitmq.client.Envelope; -import com.rabbitmq.client.Recoverable; import com.rabbitmq.client.RecoverableConnection; -import com.rabbitmq.client.RecoveryListener; -import com.rabbitmq.client.ShutdownSignalException; -import com.rabbitmq.client.impl.NetworkConnection; -import com.rabbitmq.client.impl.recovery.AutorecoveringConnection; import com.rabbitmq.client.impl.recovery.RecordedBinding; import com.rabbitmq.client.impl.recovery.RecordedConsumer; import com.rabbitmq.client.impl.recovery.RecordedExchange; @@ -34,16 +29,18 @@ import com.rabbitmq.client.impl.recovery.TopologyRecoveryFilter; import com.rabbitmq.client.test.BrokerTestCase; import com.rabbitmq.client.test.TestUtils; -import com.rabbitmq.tools.Host; import org.junit.Test; import java.io.IOException; -import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; +import static com.rabbitmq.client.test.TestUtils.closeAndWaitForRecovery; +import static com.rabbitmq.client.test.TestUtils.exchangeExists; +import static com.rabbitmq.client.test.TestUtils.queueExists; +import static com.rabbitmq.client.test.TestUtils.sendAndConsumeMessage; import static org.awaitility.Awaitility.waitAtMost; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertFalse; @@ -62,98 +59,6 @@ public class TopologyRecoveryFiltering extends BrokerTestCase { }; Connection c; - private static boolean sendAndConsumeMessage(String exchange, String routingKey, String queue, Connection c) - throws IOException, TimeoutException, InterruptedException { - Channel ch = c.createChannel(); - try { - ch.confirmSelect(); - final CountDownLatch latch = new CountDownLatch(1); - ch.basicConsume(queue, true, new DefaultConsumer(ch) { - - @Override - public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { - latch.countDown(); - } - }); - ch.basicPublish(exchange, routingKey, null, "".getBytes()); - ch.waitForConfirmsOrDie(5000); - return latch.await(5, TimeUnit.SECONDS); - } finally { - if (ch != null && ch.isOpen()) { - ch.close(); - } - } - } - - private static boolean resourceExists(Callable callback) throws Exception { - Channel declarePassiveChannel = null; - try { - declarePassiveChannel = callback.call(); - return true; - } catch (IOException e) { - if (e.getCause() instanceof ShutdownSignalException) { - ShutdownSignalException cause = (ShutdownSignalException) e.getCause(); - if (cause.getReason() instanceof AMQP.Channel.Close) { - if (((AMQP.Channel.Close) cause.getReason()).getReplyCode() == 404) { - return false; - } else { - throw e; - } - } - return false; - } else { - throw e; - } - } finally { - if (declarePassiveChannel != null && declarePassiveChannel.isOpen()) { - declarePassiveChannel.close(); - } - } - } - - private static boolean queueExists(final String queue, final Connection connection) throws Exception { - return resourceExists(() -> { - Channel channel = connection.createChannel(); - channel.queueDeclarePassive(queue); - return channel; - }); - } - - private static boolean exchangeExists(final String exchange, final Connection connection) throws Exception { - return resourceExists(() -> { - Channel channel = connection.createChannel(); - channel.exchangeDeclarePassive(exchange); - return channel; - }); - } - - private static void closeAndWaitForRecovery(RecoverableConnection connection) throws IOException, InterruptedException { - CountDownLatch latch = prepareForRecovery(connection); - Host.closeConnection((NetworkConnection) connection); - wait(latch); - } - - private static CountDownLatch prepareForRecovery(Connection conn) { - final CountDownLatch latch = new CountDownLatch(1); - ((AutorecoveringConnection) conn).addRecoveryListener(new RecoveryListener() { - - @Override - public void handleRecovery(Recoverable recoverable) { - latch.countDown(); - } - - @Override - public void handleRecoveryStarted(Recoverable recoverable) { - // No-op - } - }); - return latch; - } - - private static void wait(CountDownLatch latch) throws InterruptedException { - assertTrue(latch.await(20, TimeUnit.SECONDS)); - } - @Override protected ConnectionFactory newConnectionFactory() { ConnectionFactory connectionFactory = TestUtils.connectionFactory(); diff --git a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java new file mode 100644 index 0000000000..4f8ab6054a --- /dev/null +++ b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java @@ -0,0 +1,70 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.test.functional; + +import com.rabbitmq.client.ConnectionFactory; +import com.rabbitmq.client.DefaultConsumer; +import com.rabbitmq.client.test.BrokerTestCase; +import com.rabbitmq.client.test.TestUtils; +import org.junit.Test; + +import java.util.HashMap; + +import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryHandlerBuilder.builder; +import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryLogic.CHANNEL_CLOSED_NOT_FOUND; +import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryLogic.RECOVER_BINDING; +import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryLogic.RECOVER_BINDING_QUEUE; +import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryLogic.RECOVER_CHANNEL; +import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryLogic.RECOVER_CONSUMER; +import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryLogic.RECOVER_CONSUMER_QUEUE; +import static com.rabbitmq.client.test.TestUtils.closeAllConnectionsAndWaitForRecovery; +import static org.junit.Assert.assertTrue; + +/** + * + */ +public class TopologyRecoveryRetry extends BrokerTestCase { + + @Test + public void topologyRecoveryRetry() throws Exception { + int nbQueues = 2000; + String prefix = "topology-recovery-retry-" + System.currentTimeMillis(); + for (int i = 0; i < nbQueues; i++) { + String queue = prefix + i; + channel.queueDeclare(queue, false, false, true, new HashMap<>()); + channel.queueBind(queue, "amq.direct", queue); + channel.basicConsume(queue, true, new DefaultConsumer(channel)); + } + + closeAllConnectionsAndWaitForRecovery(this.connection); + + assertTrue(channel.isOpen()); + } + + @Override + protected ConnectionFactory newConnectionFactory() { + ConnectionFactory connectionFactory = TestUtils.connectionFactory(); + connectionFactory.setTopologyRecoveryRetryHandler( + builder().bindingRecoveryRetryCondition((b, e) -> CHANNEL_CLOSED_NOT_FOUND.test(e)) + .consumerRecoveryRetryCondition((b, e) -> CHANNEL_CLOSED_NOT_FOUND.test(e)) + .bindingRecoveryRetryOperation(RECOVER_CHANNEL.andThen(RECOVER_BINDING_QUEUE).andThen(RECOVER_BINDING)) + .consumerRecoveryRetryOperation(RECOVER_CHANNEL.andThen(RECOVER_CONSUMER_QUEUE.andThen(RECOVER_CONSUMER))) + .build() + ); + connectionFactory.setNetworkRecoveryInterval(1000); + return connectionFactory; + } +} diff --git a/src/test/java/com/rabbitmq/tools/Host.java b/src/test/java/com/rabbitmq/tools/Host.java index 5924e5931d..c919d78621 100644 --- a/src/test/java/com/rabbitmq/tools/Host.java +++ b/src/test/java/com/rabbitmq/tools/Host.java @@ -169,6 +169,10 @@ public static void closeConnection(String pid) throws IOException { rabbitmqctl("close_connection '" + pid + "' 'Closed via rabbitmqctl'"); } + public static void closeAllConnections() throws IOException { + rabbitmqctl("close_all_connections 'Closed via rabbitmqctl'"); + } + public static void closeConnection(NetworkConnection c) throws IOException { Host.ConnectionInfo ci = findConnectionInfoFor(Host.listConnections(), c); closeConnection(ci.getPid()); From 2a784544fd49b6faaf1719a9880ccf11d1552b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 10 Aug 2018 09:16:16 +0200 Subject: [PATCH 002/328] Retry twice in topology recovery retry Instead of 1 by default. References #387 (cherry picked from commit 917606253931ee515c9beb55349a35929eadc82e) --- .../impl/recovery/TopologyRecoveryRetryHandlerBuilder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java index 07141b43e5..9ef35677df 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java @@ -21,7 +21,7 @@ * Builder to ease creation of {@link DefaultRetryHandler} instances. *

* Just override what you need. By default, retry conditions don't trigger retry, - * retry operations are no-op, the number of retry attempts is 1, and the backoff + * retry operations are no-op, the number of retry attempts is 2, and the backoff * policy doesn't wait at all. * * @see DefaultRetryHandler @@ -40,7 +40,7 @@ public class TopologyRecoveryRetryHandlerBuilder { private DefaultRetryHandler.RetryOperation bindingRecoveryRetryOperation = context -> null; private DefaultRetryHandler.RetryOperation consumerRecoveryRetryOperation = context -> null; - private int retryAttempts = 1; + private int retryAttempts = 2; private BackoffPolicy backoffPolicy = nbAttempts -> { }; From f8b15528ad9fa763a4ca813454c9c42227fe87be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 10 Aug 2018 11:26:13 +0200 Subject: [PATCH 003/328] Make retry condition more tolerant with wildcards References #387 (cherry picked from commit 97114065b8fe15508aa4e42dbd86d77c2dda6498) --- .../impl/recovery/DefaultRetryHandler.java | 31 ++++++++++--------- .../TopologyRecoveryRetryHandlerBuilder.java | 16 +++++----- .../recovery/TopologyRecoveryRetryLogic.java | 7 +++-- .../functional/TopologyRecoveryRetry.java | 4 +-- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java b/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java index 8c9b1df3fd..350eb8fa8f 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java @@ -35,10 +35,10 @@ */ public class DefaultRetryHandler implements RetryHandler { - private final BiPredicate queueRecoveryRetryCondition; - private final BiPredicate exchangeRecoveryRetryCondition; - private final BiPredicate bindingRecoveryRetryCondition; - private final BiPredicate consumerRecoveryRetryCondition; + private final BiPredicate queueRecoveryRetryCondition; + private final BiPredicate exchangeRecoveryRetryCondition; + private final BiPredicate bindingRecoveryRetryCondition; + private final BiPredicate consumerRecoveryRetryCondition; private final RetryOperation queueRecoveryRetryOperation; private final RetryOperation exchangeRecoveryRetryOperation; @@ -49,10 +49,10 @@ public class DefaultRetryHandler implements RetryHandler { private final BackoffPolicy backoffPolicy; - public DefaultRetryHandler(BiPredicate queueRecoveryRetryCondition, - BiPredicate exchangeRecoveryRetryCondition, - BiPredicate bindingRecoveryRetryCondition, - BiPredicate consumerRecoveryRetryCondition, + public DefaultRetryHandler(BiPredicate queueRecoveryRetryCondition, + BiPredicate exchangeRecoveryRetryCondition, + BiPredicate bindingRecoveryRetryCondition, + BiPredicate consumerRecoveryRetryCondition, RetryOperation queueRecoveryRetryOperation, RetryOperation exchangeRecoveryRetryOperation, RetryOperation bindingRecoveryRetryOperation, @@ -72,27 +72,31 @@ public DefaultRetryHandler(BiPredicate queueRecoveryRe this.retryAttempts = retryAttempts; } + @SuppressWarnings("unchecked") @Override public RetryResult retryQueueRecovery(RetryContext context) throws Exception { - return doRetry(queueRecoveryRetryCondition, queueRecoveryRetryOperation, context.queue(), context); + return doRetry((BiPredicate) queueRecoveryRetryCondition, queueRecoveryRetryOperation, context.queue(), context); } + @SuppressWarnings("unchecked") @Override public RetryResult retryExchangeRecovery(RetryContext context) throws Exception { - return doRetry(exchangeRecoveryRetryCondition, exchangeRecoveryRetryOperation, context.exchange(), context); + return doRetry((BiPredicate) exchangeRecoveryRetryCondition, exchangeRecoveryRetryOperation, context.exchange(), context); } + @SuppressWarnings("unchecked") @Override public RetryResult retryBindingRecovery(RetryContext context) throws Exception { - return doRetry(bindingRecoveryRetryCondition, bindingRecoveryRetryOperation, context.binding(), context); + return doRetry((BiPredicate) bindingRecoveryRetryCondition, bindingRecoveryRetryOperation, context.binding(), context); } + @SuppressWarnings("unchecked") @Override public RetryResult retryConsumerRecovery(RetryContext context) throws Exception { - return doRetry(consumerRecoveryRetryCondition, consumerRecoveryRetryOperation, context.consumer(), context); + return doRetry((BiPredicate) consumerRecoveryRetryCondition, consumerRecoveryRetryOperation, context.consumer(), context); } - protected RetryResult doRetry(BiPredicate condition, RetryOperation operation, T entity, RetryContext context) + protected RetryResult doRetry(BiPredicate condition, RetryOperation operation, RecordedEntity entity, RetryContext context) throws Exception { int attempts = 0; Exception exception = context.exception(); @@ -107,7 +111,6 @@ protected RetryResult doRetry(BiPredicate queueRecoveryRetryCondition = (q, e) -> false; - private BiPredicate exchangeRecoveryRetryCondition = (ex, e) -> false; - private BiPredicate bindingRecoveryRetryCondition = (b, e) -> false; - private BiPredicate consumerRecoveryRetryCondition = (c, e) -> false; + private BiPredicate queueRecoveryRetryCondition = (q, e) -> false; + private BiPredicate exchangeRecoveryRetryCondition = (ex, e) -> false; + private BiPredicate bindingRecoveryRetryCondition = (b, e) -> false; + private BiPredicate consumerRecoveryRetryCondition = (c, e) -> false; private DefaultRetryHandler.RetryOperation queueRecoveryRetryOperation = context -> null; private DefaultRetryHandler.RetryOperation exchangeRecoveryRetryOperation = context -> null; @@ -50,25 +50,25 @@ public static TopologyRecoveryRetryHandlerBuilder builder() { } public TopologyRecoveryRetryHandlerBuilder queueRecoveryRetryCondition( - BiPredicate queueRecoveryRetryCondition) { + BiPredicate queueRecoveryRetryCondition) { this.queueRecoveryRetryCondition = queueRecoveryRetryCondition; return this; } public TopologyRecoveryRetryHandlerBuilder exchangeRecoveryRetryCondition( - BiPredicate exchangeRecoveryRetryCondition) { + BiPredicate exchangeRecoveryRetryCondition) { this.exchangeRecoveryRetryCondition = exchangeRecoveryRetryCondition; return this; } public TopologyRecoveryRetryHandlerBuilder bindingRecoveryRetryCondition( - BiPredicate bindingRecoveryRetryCondition) { + BiPredicate bindingRecoveryRetryCondition) { this.bindingRecoveryRetryCondition = bindingRecoveryRetryCondition; return this; } public TopologyRecoveryRetryHandlerBuilder consumerRecoveryRetryCondition( - BiPredicate consumerRecoveryRetryCondition) { + BiPredicate consumerRecoveryRetryCondition) { this.consumerRecoveryRetryCondition = consumerRecoveryRetryCondition; return this; } diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java index 8e6e16a790..582475b702 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java @@ -18,6 +18,7 @@ import com.rabbitmq.client.AMQP; import com.rabbitmq.client.ShutdownSignalException; +import java.util.function.BiPredicate; import java.util.function.Predicate; /** @@ -31,9 +32,9 @@ */ public abstract class TopologyRecoveryRetryLogic { - public static final Predicate CHANNEL_CLOSED_NOT_FOUND = e -> { - if (e.getCause() instanceof ShutdownSignalException) { - ShutdownSignalException cause = (ShutdownSignalException) e.getCause(); + public static final BiPredicate CHANNEL_CLOSED_NOT_FOUND = (entity, ex) -> { + if (ex.getCause() instanceof ShutdownSignalException) { + ShutdownSignalException cause = (ShutdownSignalException) ex.getCause(); if (cause.getReason() instanceof AMQP.Channel.Close) { return ((AMQP.Channel.Close) cause.getReason()).getReplyCode() == 404; } diff --git a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java index 4f8ab6054a..49819ce8d3 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java +++ b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java @@ -58,8 +58,8 @@ public void topologyRecoveryRetry() throws Exception { protected ConnectionFactory newConnectionFactory() { ConnectionFactory connectionFactory = TestUtils.connectionFactory(); connectionFactory.setTopologyRecoveryRetryHandler( - builder().bindingRecoveryRetryCondition((b, e) -> CHANNEL_CLOSED_NOT_FOUND.test(e)) - .consumerRecoveryRetryCondition((b, e) -> CHANNEL_CLOSED_NOT_FOUND.test(e)) + builder().bindingRecoveryRetryCondition(CHANNEL_CLOSED_NOT_FOUND) + .consumerRecoveryRetryCondition(CHANNEL_CLOSED_NOT_FOUND) .bindingRecoveryRetryOperation(RECOVER_CHANNEL.andThen(RECOVER_BINDING_QUEUE).andThen(RECOVER_BINDING)) .consumerRecoveryRetryOperation(RECOVER_CHANNEL.andThen(RECOVER_CONSUMER_QUEUE.andThen(RECOVER_CONSUMER))) .build() From 514f9bddf0badbfbf27b51f45ec5418d873315e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 10 Aug 2018 11:50:37 +0200 Subject: [PATCH 004/328] Set release version to 5.4.0.M1 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index 3b0c3ec1b0..5a62e85797 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,2 +1,2 @@ -RELEASE_VERSION="5.4.0.RC1" +RELEASE_VERSION="5.4.0.M1" DEVELOPMENT_VERSION="5.4.0-SNAPSHOT" From 12bd625216f1d12f7b9a0ca886586e4d6b202448 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 10 Aug 2018 11:43:26 +0000 Subject: [PATCH 005/328] [maven-release-plugin] prepare release v5.4.0.M1 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index b26766262b..60f6a45297 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.4.0-SNAPSHOT + 5.4.0.M1 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.4.0.M1 From 26a8dae5d135b1b846d3fa7ffb8bf3093f2c8ffb Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 10 Aug 2018 11:43:31 +0000 Subject: [PATCH 006/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 60f6a45297..b26766262b 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.4.0.M1 + 5.4.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.4.0.M1 + HEAD From f4978bc66473ae0afdce144603d2c419b99a2fa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 13 Aug 2018 10:53:36 +0200 Subject: [PATCH 007/328] Polish recovery retry Add log in default retry handler, add operation to recover all the bindings of a queue (useful when the recovery of a consumer fails because isn't found), make AutorecoveringConnection#recoverConsumer and AutorecoveringConnection#recoverQueue public as they contain useful logic that some client code should be able to use, and declared a pre-configured retry handler for the deleted queue case. References #387 (cherry picked from commit 2b8d257ddd2a87d98aa74bd6da9f49f8c7b25782) --- .../recovery/AutorecoveringConnection.java | 8 ++- .../impl/recovery/DefaultRetryHandler.java | 10 ++++ .../recovery/TopologyRecoveryRetryLogic.java | 50 +++++++++++++++++++ .../functional/TopologyRecoveryRetry.java | 16 +----- 4 files changed, 68 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java index c3e66e0d2f..c200c8fd59 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java @@ -709,7 +709,7 @@ private void recoverExchange(RecordedExchange x, boolean retry) { } - void recoverQueue(final String oldName, RecordedQueue q, boolean retry) { + public void recoverQueue(final String oldName, RecordedQueue q, boolean retry) { try { if (topologyRecoveryFilter.filterQueue(q)) { LOGGER.debug("Recovering {}", q); @@ -774,7 +774,7 @@ private void recoverBinding(RecordedBinding b, boolean retry) { } } - private void recoverConsumer(final String tag, RecordedConsumer consumer, boolean retry) { + public void recoverConsumer(final String tag, RecordedConsumer consumer, boolean retry) { try { if (this.topologyRecoveryFilter.filterConsumer(consumer)) { LOGGER.debug("Recovering {}", consumer); @@ -1087,6 +1087,10 @@ public Map getRecordedExchanges() { return recordedExchanges; } + public List getRecordedBindings() { + return recordedBindings; + } + @Override public String toString() { return this.delegate.toString(); diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java b/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java index 350eb8fa8f..98978eb6d1 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java @@ -15,6 +15,9 @@ package com.rabbitmq.client.impl.recovery; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.Objects; import java.util.function.BiPredicate; @@ -35,6 +38,8 @@ */ public class DefaultRetryHandler implements RetryHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(DefaultRetryHandler.class); + private final BiPredicate queueRecoveryRetryCondition; private final BiPredicate exchangeRecoveryRetryCondition; private final BiPredicate bindingRecoveryRetryCondition; @@ -98,6 +103,7 @@ public RetryResult retryConsumerRecovery(RetryContext context) throws Exception protected RetryResult doRetry(BiPredicate condition, RetryOperation operation, RecordedEntity entity, RetryContext context) throws Exception { + log(entity, context.exception()); int attempts = 0; Exception exception = context.exception(); while (attempts < retryAttempts) { @@ -119,6 +125,10 @@ protected RetryResult doRetry(BiPredicate condition, throw context.exception(); } + protected void log(RecordedEntity entity, Exception exception) { + LOGGER.info("Error while recovering {}, retrying with {} attempt(s).", entity, retryAttempts, exception); + } + public interface RetryOperation { T call(RetryContext context) throws Exception; diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java index 582475b702..9d8d2be9a5 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java @@ -18,9 +18,12 @@ import com.rabbitmq.client.AMQP; import com.rabbitmq.client.ShutdownSignalException; +import java.util.List; import java.util.function.BiPredicate; import java.util.function.Predicate; +import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryHandlerBuilder.builder; + /** * Useful ready-to-use conditions and operations for {@link DefaultRetryHandler}. * They're composed and used with the {@link TopologyRecoveryRetryHandlerBuilder}. @@ -32,6 +35,9 @@ */ public abstract class TopologyRecoveryRetryLogic { + /** + * Channel has been closed because of a resource that doesn't exist. + */ public static final BiPredicate CHANNEL_CLOSED_NOT_FOUND = (entity, ex) -> { if (ex.getCause() instanceof ShutdownSignalException) { ShutdownSignalException cause = (ShutdownSignalException) ex.getCause(); @@ -42,6 +48,9 @@ public abstract class TopologyRecoveryRetryLogic { return false; }; + /** + * Recover a channel. + */ public static final DefaultRetryHandler.RetryOperation RECOVER_CHANNEL = context -> { if (!context.entity().getChannel().isOpen()) { context.connection().recoverChannel(context.entity().getChannel()); @@ -49,6 +58,9 @@ public abstract class TopologyRecoveryRetryLogic { return null; }; + /** + * Recover the destination queue of a binding. + */ public static final DefaultRetryHandler.RetryOperation RECOVER_BINDING_QUEUE = context -> { if (context.entity() instanceof RecordedQueueBinding) { RecordedBinding binding = context.binding(); @@ -63,11 +75,17 @@ public abstract class TopologyRecoveryRetryLogic { return null; }; + /** + * Recover a binding. + */ public static final DefaultRetryHandler.RetryOperation RECOVER_BINDING = context -> { context.binding().recover(); return null; }; + /** + * Recover the queue of a consumer. + */ public static final DefaultRetryHandler.RetryOperation RECOVER_CONSUMER_QUEUE = context -> { if (context.entity() instanceof RecordedConsumer) { RecordedConsumer consumer = context.consumer(); @@ -82,5 +100,37 @@ public abstract class TopologyRecoveryRetryLogic { return null; }; + /** + * Recover all the bindings of the queue of a consumer. + */ + public static final DefaultRetryHandler.RetryOperation RECOVER_CONSUMER_QUEUE_BINDINGS = context -> { + if (context.entity() instanceof RecordedConsumer) { + String queue = context.consumer().getQueue(); + for (RecordedBinding recordedBinding : context.connection().getRecordedBindings()) { + if (recordedBinding instanceof RecordedQueueBinding && queue.equals(recordedBinding.getDestination())) { + recordedBinding.recover(); + } + } + } + return null; + }; + + /** + * Recover a consumer. + */ public static final DefaultRetryHandler.RetryOperation RECOVER_CONSUMER = context -> context.consumer().recover(); + + /** + * Pre-configured {@link DefaultRetryHandler} that retries recovery of bindings and consumers + * when their respective queue is not found. + * This retry handler can be useful for long recovery processes, whereby auto-delete queues + * can be deleted between queue recovery and binding/consumer recovery. + */ + public static final RetryHandler RETRY_ON_QUEUE_NOT_FOUND_RETRY_HANDLER = builder() + .bindingRecoveryRetryCondition(CHANNEL_CLOSED_NOT_FOUND) + .consumerRecoveryRetryCondition(CHANNEL_CLOSED_NOT_FOUND) + .bindingRecoveryRetryOperation(RECOVER_CHANNEL.andThen(RECOVER_BINDING_QUEUE).andThen(RECOVER_BINDING)) + .consumerRecoveryRetryOperation(RECOVER_CHANNEL.andThen(RECOVER_CONSUMER_QUEUE.andThen(RECOVER_CONSUMER) + .andThen(RECOVER_CONSUMER_QUEUE_BINDINGS))) + .build(); } diff --git a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java index 49819ce8d3..71277c9826 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java +++ b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java @@ -23,13 +23,7 @@ import java.util.HashMap; -import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryHandlerBuilder.builder; -import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryLogic.CHANNEL_CLOSED_NOT_FOUND; -import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryLogic.RECOVER_BINDING; -import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryLogic.RECOVER_BINDING_QUEUE; -import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryLogic.RECOVER_CHANNEL; -import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryLogic.RECOVER_CONSUMER; -import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryLogic.RECOVER_CONSUMER_QUEUE; +import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryLogic.RETRY_ON_QUEUE_NOT_FOUND_RETRY_HANDLER; import static com.rabbitmq.client.test.TestUtils.closeAllConnectionsAndWaitForRecovery; import static org.junit.Assert.assertTrue; @@ -57,13 +51,7 @@ public void topologyRecoveryRetry() throws Exception { @Override protected ConnectionFactory newConnectionFactory() { ConnectionFactory connectionFactory = TestUtils.connectionFactory(); - connectionFactory.setTopologyRecoveryRetryHandler( - builder().bindingRecoveryRetryCondition(CHANNEL_CLOSED_NOT_FOUND) - .consumerRecoveryRetryCondition(CHANNEL_CLOSED_NOT_FOUND) - .bindingRecoveryRetryOperation(RECOVER_CHANNEL.andThen(RECOVER_BINDING_QUEUE).andThen(RECOVER_BINDING)) - .consumerRecoveryRetryOperation(RECOVER_CHANNEL.andThen(RECOVER_CONSUMER_QUEUE.andThen(RECOVER_CONSUMER))) - .build() - ); + connectionFactory.setTopologyRecoveryRetryHandler(RETRY_ON_QUEUE_NOT_FOUND_RETRY_HANDLER); connectionFactory.setNetworkRecoveryInterval(1000); return connectionFactory; } From 11b24403d79d3c8bc30a4ac76fa9e1a038d798a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 14 Aug 2018 15:25:10 +0200 Subject: [PATCH 008/328] Add dedicated executor to close connection in NIO mode When sharing the same executor for NIO and connection closing, all the threads of the pool can be busy recovering connections, leaving no thread left for IO. This commit add a new executor service to the NIO mode to submit all the connection closing to. This is useful when an application maintains dozens or hundreds of connections and suffers massive connection lost. Hundreds of connection closing tasks can be submitted very quickly, so controlling the number of threads and leaving some threads available for IO is critical. If an application maintain just a few connections and can deal with the creation of a few threads, using the new executor isn't necessary. Fixes #380 (cherry picked from commit 0a7e7e563db93e9e886a3bfd3c0e3cf7840e6a74) --- .../com/rabbitmq/client/impl/nio/NioLoop.java | 19 ++-- .../rabbitmq/client/impl/nio/NioParams.java | 45 ++++++++- .../com/rabbitmq/client/test/ClientTests.java | 3 +- .../test/NioDeadlockOnConnectionClosing.java | 98 +++++++++++++++++++ .../com/rabbitmq/client/test/TestUtils.java | 40 +++++--- 5 files changed, 176 insertions(+), 29 deletions(-) create mode 100644 src/test/java/com/rabbitmq/client/test/NioDeadlockOnConnectionClosing.java diff --git a/src/main/java/com/rabbitmq/client/impl/nio/NioLoop.java b/src/main/java/com/rabbitmq/client/impl/nio/NioLoop.java index d4ce97dde6..6e1c1f6352 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/NioLoop.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/NioLoop.java @@ -41,9 +41,12 @@ public class NioLoop implements Runnable { private final NioParams nioParams; + private final ExecutorService connectionShutdownExecutor; + public NioLoop(NioParams nioParams, NioLoopContext loopContext) { this.nioParams = nioParams; this.context = loopContext; + this.connectionShutdownExecutor = nioParams.getConnectionShutdownExecutor(); } @Override @@ -283,19 +286,15 @@ protected void dispatchIoErrorToConnection(final SocketChannelFrameHandlerState } protected void dispatchShutdownToConnection(final SocketChannelFrameHandlerState state) { - Runnable shutdown = new Runnable() { - - @Override - public void run() { - state.getConnection().doFinalShutdown(); - } - }; - if (executorService() == null) { + Runnable shutdown = () -> state.getConnection().doFinalShutdown(); + if (this.connectionShutdownExecutor != null) { + connectionShutdownExecutor.execute(shutdown); + } else if (executorService() != null) { + executorService().execute(shutdown); + } else { String name = "rabbitmq-connection-shutdown-" + state.getConnection(); Thread shutdownThread = Environment.newThread(threadFactory(), shutdown, name); shutdownThread.start(); - } else { - executorService().submit(shutdown); } } diff --git a/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java b/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java index 0dbe627808..6652a7843f 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java @@ -55,10 +55,10 @@ public class NioParams { private SocketChannelConfigurator socketChannelConfigurator = new DefaultSocketChannelConfigurator(); /** the hook to configure the SSL engine before the connection is open */ - private SslEngineConfigurator sslEngineConfigurator = new SslEngineConfigurator() { - @Override - public void configure(SSLEngine sslEngine) throws IOException { } - }; + private SslEngineConfigurator sslEngineConfigurator = sslEngine -> { }; + + /** the executor service used for connection shutdown */ + private ExecutorService connectionShutdownExecutor; public NioParams() { } @@ -72,6 +72,7 @@ public NioParams(NioParams nioParams) { setNioExecutor(nioParams.getNioExecutor()); setThreadFactory(nioParams.getThreadFactory()); setSslEngineConfigurator(nioParams.getSslEngineConfigurator()); + setConnectionShutdownExecutor(nioParams.getConnectionShutdownExecutor()); } public int getReadByteBufferSize() { @@ -186,6 +187,9 @@ public ExecutorService getNioExecutor() { * number of requested IO threads, plus a few more, as it's also * used to dispatch the shutdown of connections. * + * Connection shutdown can also be handled by a dedicated {@link ExecutorService}, + * see {@link #setConnectionShutdownExecutor(ExecutorService)}. + * * It's developer's responsibility to shut down the executor * when it is no longer needed. * @@ -195,6 +199,7 @@ public ExecutorService getNioExecutor() { * @return this {@link NioParams} instance * @see NioParams#setNbIoThreads(int) * @see NioParams#setThreadFactory(ThreadFactory) + * @see NioParams#setConnectionShutdownExecutor(ExecutorService) */ public NioParams setNioExecutor(ExecutorService nioExecutor) { this.nioExecutor = nioExecutor; @@ -275,4 +280,36 @@ public void setSslEngineConfigurator(SslEngineConfigurator configurator) { public SslEngineConfigurator getSslEngineConfigurator() { return sslEngineConfigurator; } + + /** + * Set the {@link ExecutorService} used for connection shutdown. + * If not set, falls back to the NIO executor and then the thread factory. + * This executor service is useful when strict control of the number of threads + * is necessary, the application can experience the closing of several connections + * at once, and automatic recovery is enabled. In such cases, the connection recovery + * can take place in the same pool of threads as the NIO operations, which can + * create deadlocks (all the threads of the pool are busy recovering, and there's no + * thread left for NIO, so connections never recover). + *

+ * Note it's developer's responsibility to shut down the executor + * when it is no longer needed. + *

+ * Using the thread factory for such scenarios avoid the deadlocks, at the price + * of potentially creating many short-lived threads in case of massive connection lost. + *

+ * With both the NIO and connection shutdown executor services set and configured + * accordingly, the application can control reliably the number of threads used. + * + * @param connectionShutdownExecutor the executor service to use + * @return this {@link NioParams} instance + * @see NioParams#setNioExecutor(ExecutorService) + */ + public NioParams setConnectionShutdownExecutor(ExecutorService connectionShutdownExecutor) { + this.connectionShutdownExecutor = connectionShutdownExecutor; + return this; + } + + public ExecutorService getConnectionShutdownExecutor() { + return connectionShutdownExecutor; + } } diff --git a/src/test/java/com/rabbitmq/client/test/ClientTests.java b/src/test/java/com/rabbitmq/client/test/ClientTests.java index 9c2994b671..2b4c8ea04a 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientTests.java +++ b/src/test/java/com/rabbitmq/client/test/ClientTests.java @@ -63,7 +63,8 @@ NoAutoRecoveryWhenTcpWindowIsFullTest.class, JsonRpcTest.class, AddressTest.class, - DefaultRetryHandlerTest.class + DefaultRetryHandlerTest.class, + NioDeadlockOnConnectionClosing.class }) public class ClientTests { diff --git a/src/test/java/com/rabbitmq/client/test/NioDeadlockOnConnectionClosing.java b/src/test/java/com/rabbitmq/client/test/NioDeadlockOnConnectionClosing.java new file mode 100644 index 0000000000..78082344b1 --- /dev/null +++ b/src/test/java/com/rabbitmq/client/test/NioDeadlockOnConnectionClosing.java @@ -0,0 +1,98 @@ +// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.test; + +import com.rabbitmq.client.Connection; +import com.rabbitmq.client.ConnectionFactory; +import com.rabbitmq.client.impl.nio.NioParams; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +import static com.rabbitmq.client.test.TestUtils.closeAllConnectionsAndWaitForRecovery; +import static org.junit.Assert.assertTrue; + +/** + * + */ +public class NioDeadlockOnConnectionClosing { + + static final Logger LOGGER = LoggerFactory.getLogger(NioDeadlockOnConnectionClosing.class); + + ExecutorService nioExecutorService, connectionShutdownExecutorService; + ConnectionFactory cf; + List connections; + + @Before + public void setUp() { + nioExecutorService = Executors.newFixedThreadPool(2); + connectionShutdownExecutorService = Executors.newFixedThreadPool(2); + cf = TestUtils.connectionFactory(); + cf.setAutomaticRecoveryEnabled(true); + cf.useNio(); + cf.setNetworkRecoveryInterval(1000); + NioParams params = new NioParams() + .setNioExecutor(nioExecutorService) + .setConnectionShutdownExecutor(connectionShutdownExecutorService) + .setNbIoThreads(2); + cf.setNioParams(params); + connections = new ArrayList<>(); + } + + @After + public void tearDown() throws Exception { + for (Connection connection : connections) { + try { + connection.close(2000); + } catch (Exception e) { + LOGGER.warn("Error while closing test connection", e); + } + } + + shutdownExecutorService(nioExecutorService); + shutdownExecutorService(connectionShutdownExecutorService); + } + + private void shutdownExecutorService(ExecutorService executorService) throws InterruptedException { + if (executorService == null) { + return; + } + executorService.shutdown(); + boolean terminated = executorService.awaitTermination(5, TimeUnit.SECONDS); + if (!terminated) { + LOGGER.warn("Couldn't terminate executor after 5 seconds"); + } + } + + @Test + public void connectionClosing() throws Exception { + for (int i = 0; i < 10; i++) { + connections.add(cf.newConnection()); + } + closeAllConnectionsAndWaitForRecovery(connections); + for (Connection connection : connections) { + assertTrue(connection.isOpen()); + } + } +} diff --git a/src/test/java/com/rabbitmq/client/test/TestUtils.java b/src/test/java/com/rabbitmq/client/test/TestUtils.java index c44e8b26a4..5b0b7d0d7e 100644 --- a/src/test/java/com/rabbitmq/client/test/TestUtils.java +++ b/src/test/java/com/rabbitmq/client/test/TestUtils.java @@ -31,6 +31,8 @@ import org.slf4j.LoggerFactory; import java.io.IOException; +import java.util.Collection; +import java.util.Collections; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -156,26 +158,36 @@ public static void closeAndWaitForRecovery(RecoverableConnection connection) thr wait(latch); } - public static void closeAllConnectionsAndWaitForRecovery(Connection connection) throws IOException, InterruptedException { - CountDownLatch latch = prepareForRecovery(connection); + public static void closeAllConnectionsAndWaitForRecovery(Collection connections) throws IOException, InterruptedException { + CountDownLatch latch = prepareForRecovery(connections); Host.closeAllConnections(); wait(latch); } - public static CountDownLatch prepareForRecovery(Connection conn) { - final CountDownLatch latch = new CountDownLatch(1); - ((AutorecoveringConnection) conn).addRecoveryListener(new RecoveryListener() { + public static void closeAllConnectionsAndWaitForRecovery(Connection connection) throws IOException, InterruptedException { + closeAllConnectionsAndWaitForRecovery(Collections.singletonList(connection)); + } - @Override - public void handleRecovery(Recoverable recoverable) { - latch.countDown(); - } + public static CountDownLatch prepareForRecovery(Connection connection) { + return prepareForRecovery(Collections.singletonList(connection)); + } - @Override - public void handleRecoveryStarted(Recoverable recoverable) { - // No-op - } - }); + public static CountDownLatch prepareForRecovery(Collection connections) { + final CountDownLatch latch = new CountDownLatch(connections.size()); + for (Connection conn : connections) { + ((AutorecoveringConnection) conn).addRecoveryListener(new RecoveryListener() { + + @Override + public void handleRecovery(Recoverable recoverable) { + latch.countDown(); + } + + @Override + public void handleRecoveryStarted(Recoverable recoverable) { + // No-op + } + }); + } return latch; } From 0e38d5f8f1618bf9180674aef4c83b46fb9374fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 16 Aug 2018 11:30:28 +0200 Subject: [PATCH 009/328] Polish References #380 (cherry picked from commit dcf1f5cc097f1fc1d653d9cb2d6ec52fc7023cfe) --- .../rabbitmq/client/impl/nio/NioParams.java | 84 ++++++++++++------- 1 file changed, 54 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java b/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java index 6652a7843f..9f9da61795 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java @@ -20,44 +20,67 @@ import com.rabbitmq.client.SslEngineConfigurator; import javax.net.ssl.SSLEngine; -import java.io.IOException; import java.util.concurrent.ExecutorService; import java.util.concurrent.ThreadFactory; /** * Parameters used to configure the NIO mode of a {@link com.rabbitmq.client.ConnectionFactory}. + * * @since 4.0.0 */ public class NioParams { - /** size of the byte buffer used for inbound data */ + /** + * size of the byte buffer used for inbound data + */ private int readByteBufferSize = 32768; - /** size of the byte buffer used for outbound data */ + /** + * size of the byte buffer used for outbound data + */ private int writeByteBufferSize = 32768; - /** the max number of IO threads */ + /** + * the max number of IO threads + */ private int nbIoThreads = 1; - /** the timeout to enqueue outbound frames */ + /** + * the timeout to enqueue outbound frames + */ private int writeEnqueuingTimeoutInMs = 10 * 1000; - /** the capacity of the queue used for outbound frames */ + /** + * the capacity of the queue used for outbound frames + */ private int writeQueueCapacity = 10000; - /** the executor service used for IO threads and connections shutdown */ + /** + * the executor service used for IO threads and connections shutdown + */ private ExecutorService nioExecutor; - /** the thread factory used for IO threads and connections shutdown */ + /** + * the thread factory used for IO threads and connections shutdown + */ private ThreadFactory threadFactory; - /** the hook to configure the socket channel before it's open */ + /** + * the hook to configure the socket channel before it's open + */ private SocketChannelConfigurator socketChannelConfigurator = new DefaultSocketChannelConfigurator(); - /** the hook to configure the SSL engine before the connection is open */ - private SslEngineConfigurator sslEngineConfigurator = sslEngine -> { }; + /** + * the hook to configure the SSL engine before the connection is open + */ + private SslEngineConfigurator sslEngineConfigurator = sslEngine -> { + }; - /** the executor service used for connection shutdown */ + /** + * the executor service used for connection shutdown + * + * @since 5.4.0 + */ private ExecutorService connectionShutdownExecutor; public NioParams() { @@ -82,7 +105,7 @@ public int getReadByteBufferSize() { /** * Sets the size in byte of the read {@link java.nio.ByteBuffer} used in the NIO loop. * Default is 32768. - * + *

* This parameter isn't used when using SSL/TLS, where {@link java.nio.ByteBuffer} * size is set up according to the {@link javax.net.ssl.SSLSession} packet size. * @@ -104,7 +127,7 @@ public int getWriteByteBufferSize() { /** * Sets the size in byte of the write {@link java.nio.ByteBuffer} used in the NIO loop. * Default is 32768. - * + *

* This parameter isn't used when using SSL/TLS, where {@link java.nio.ByteBuffer} * size is set up according to the {@link javax.net.ssl.SSLSession} packet size. * @@ -131,7 +154,7 @@ public int getNbIoThreads() { * 10 connections have been created). * Once a connection is created, it's assigned to a thread/task and * all its IO activity is handled by this thread/task. - * + *

* When idle for a few seconds (i.e. without any connection to perform IO for), * a thread/task stops and is recreated if necessary. * @@ -155,14 +178,14 @@ public int getWriteEnqueuingTimeoutInMs() { * Every requests to the server is divided into frames * that are then queued in a {@link java.util.concurrent.BlockingQueue} before * being sent on the network by a IO thread. - * + *

* If the IO thread cannot cope with the frames dispatch, the * {@link java.util.concurrent.BlockingQueue} gets filled up and blocks * (blocking the calling thread by the same occasion). This timeout is the * time the {@link java.util.concurrent.BlockingQueue} will wait before * rejecting the outbound frame. The calling thread will then received * an exception. - * + *

* The appropriate value depends on the application scenarios: * rate of outbound data (published messages, acknowledgment, etc), network speed... * @@ -182,17 +205,17 @@ public ExecutorService getNioExecutor() { /** * Sets the {@link ExecutorService} to use for NIO threads/tasks. * Default is to use the thread factory. - * + *

* The {@link ExecutorService} should be able to run the * number of requested IO threads, plus a few more, as it's also * used to dispatch the shutdown of connections. - * + *

* Connection shutdown can also be handled by a dedicated {@link ExecutorService}, * see {@link #setConnectionShutdownExecutor(ExecutorService)}. - * + *

* It's developer's responsibility to shut down the executor * when it is no longer needed. - * + *

* The thread factory isn't used if an executor service is set up. * * @param nioExecutor {@link ExecutorService} used for IO threads and connection shutdown @@ -214,7 +237,7 @@ public ThreadFactory getThreadFactory() { * Sets the {@link ThreadFactory} to use for NIO threads/tasks. * Default is to use the {@link com.rabbitmq.client.ConnectionFactory}'s * {@link ThreadFactory}. - * + *

* The {@link ThreadFactory} is used to spawn the IO threads * and dispatch the shutdown of connections. * @@ -248,6 +271,10 @@ public NioParams setWriteQueueCapacity(int writeQueueCapacity) { return this; } + public SocketChannelConfigurator getSocketChannelConfigurator() { + return socketChannelConfigurator; + } + /** * Set the {@link java.nio.channels.SocketChannel} configurator. * This gets a chance to "configure" a socket channel @@ -260,8 +287,8 @@ public void setSocketChannelConfigurator(SocketChannelConfigurator configurator) this.socketChannelConfigurator = configurator; } - public SocketChannelConfigurator getSocketChannelConfigurator() { - return socketChannelConfigurator; + public SslEngineConfigurator getSslEngineConfigurator() { + return sslEngineConfigurator; } /** @@ -277,8 +304,8 @@ public void setSslEngineConfigurator(SslEngineConfigurator configurator) { this.sslEngineConfigurator = configurator; } - public SslEngineConfigurator getSslEngineConfigurator() { - return sslEngineConfigurator; + public ExecutorService getConnectionShutdownExecutor() { + return connectionShutdownExecutor; } /** @@ -303,13 +330,10 @@ public SslEngineConfigurator getSslEngineConfigurator() { * @param connectionShutdownExecutor the executor service to use * @return this {@link NioParams} instance * @see NioParams#setNioExecutor(ExecutorService) + * @since 5.4.0 */ public NioParams setConnectionShutdownExecutor(ExecutorService connectionShutdownExecutor) { this.connectionShutdownExecutor = connectionShutdownExecutor; return this; } - - public ExecutorService getConnectionShutdownExecutor() { - return connectionShutdownExecutor; - } } From 82c18e910d141984f159a081a7938a77d2689476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 16 Aug 2018 11:59:21 +0200 Subject: [PATCH 010/328] Backport publishing metrics to 5.x Fixes #374 --- .../com/rabbitmq/client/MetricsCollector.java | 16 ++++++++++++---- .../client/impl/AbstractMetricsCollector.java | 6 +++--- .../client/impl/MicrometerMetricsCollector.java | 2 +- .../client/impl/StandardMetricsCollector.java | 2 +- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/MetricsCollector.java b/src/main/java/com/rabbitmq/client/MetricsCollector.java index 101948e6b9..31d4480423 100644 --- a/src/main/java/com/rabbitmq/client/MetricsCollector.java +++ b/src/main/java/com/rabbitmq/client/MetricsCollector.java @@ -36,13 +36,21 @@ public interface MetricsCollector { void basicPublish(Channel channel); - void basicPublishFailure(Channel channel, Throwable cause); + default void basicPublishFailure(Channel channel, Throwable cause) { - void basicPublishAck(Channel channel, long deliveryTag, boolean multiple); + } - void basicPublishNack(Channel channel, long deliveryTag, boolean multiple); + default void basicPublishAck(Channel channel, long deliveryTag, boolean multiple) { - void basicPublishUnrouted(Channel channel); + } + + default void basicPublishNack(Channel channel, long deliveryTag, boolean multiple) { + + } + + default void basicPublishUnrouted(Channel channel) { + + } void consumedMessage(Channel channel, long deliveryTag, boolean autoAck); diff --git a/src/main/java/com/rabbitmq/client/impl/AbstractMetricsCollector.java b/src/main/java/com/rabbitmq/client/impl/AbstractMetricsCollector.java index 99a5b7a138..435a794481 100644 --- a/src/main/java/com/rabbitmq/client/impl/AbstractMetricsCollector.java +++ b/src/main/java/com/rabbitmq/client/impl/AbstractMetricsCollector.java @@ -140,9 +140,9 @@ public void basicPublishNack(Channel channel, long deliveryTag, boolean multiple @Override public void basicPublishUnrouted(Channel channel) { try { - markPublishedMessageNotRouted(); + markPublishedMessageUnrouted(); } catch(Exception e) { - LOGGER.info("Error while computing metrics in markPublishedMessageNotRouted: " + e.getMessage()); + LOGGER.info("Error while computing metrics in markPublishedMessageUnrouted: " + e.getMessage()); } } @@ -407,5 +407,5 @@ private ChannelState(Channel channel) { /** * Marks the event of a published message not being routed. */ - protected abstract void markPublishedMessageNotRouted(); + protected abstract void markPublishedMessageUnrouted(); } diff --git a/src/main/java/com/rabbitmq/client/impl/MicrometerMetricsCollector.java b/src/main/java/com/rabbitmq/client/impl/MicrometerMetricsCollector.java index ee17194538..17db75e9d9 100644 --- a/src/main/java/com/rabbitmq/client/impl/MicrometerMetricsCollector.java +++ b/src/main/java/com/rabbitmq/client/impl/MicrometerMetricsCollector.java @@ -148,7 +148,7 @@ protected void markMessagePublishNotAcknowledged() { } @Override - protected void markPublishedMessageNotRouted() { + protected void markPublishedMessageUnrouted() { unroutedPublishedMessages.increment(); } diff --git a/src/main/java/com/rabbitmq/client/impl/StandardMetricsCollector.java b/src/main/java/com/rabbitmq/client/impl/StandardMetricsCollector.java index 29240bcc48..ac5896c472 100644 --- a/src/main/java/com/rabbitmq/client/impl/StandardMetricsCollector.java +++ b/src/main/java/com/rabbitmq/client/impl/StandardMetricsCollector.java @@ -125,7 +125,7 @@ protected void markMessagePublishNotAcknowledged() { } @Override - protected void markPublishedMessageNotRouted() { + protected void markPublishedMessageUnrouted() { publishUnroutedMessages.mark(); } From 119a95796aa6e73cbb1bf2f1baacacc63e11e185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 13 Aug 2018 11:28:08 +0200 Subject: [PATCH 011/328] Introduce JsonRpcMapper abstract WIP References #378 (cherry picked from commit 0a3bed1ae57c308f806c476f1c89f951a41888ba) --- .../com/rabbitmq/tools/json/JSONUtil.java | 2 - .../tools/jsonrpc/DefaultJsonRpcMapper.java | 72 +++++++++++++++ .../rabbitmq/tools/jsonrpc/JsonRpcClient.java | 25 +++--- .../tools/jsonrpc/JsonRpcException.java | 35 ++++---- .../rabbitmq/tools/jsonrpc/JsonRpcMapper.java | 89 +++++++++++++++++++ .../rabbitmq/tools/jsonrpc/JsonRpcServer.java | 30 ++++--- .../tools/jsonrpc/ServiceDescription.java | 4 +- .../java/com/rabbitmq/client/JsonRpcTest.java | 63 ++++++++++--- 8 files changed, 263 insertions(+), 57 deletions(-) create mode 100644 src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java create mode 100644 src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java diff --git a/src/main/java/com/rabbitmq/tools/json/JSONUtil.java b/src/main/java/com/rabbitmq/tools/json/JSONUtil.java index 6050482f5e..c40727d6e8 100644 --- a/src/main/java/com/rabbitmq/tools/json/JSONUtil.java +++ b/src/main/java/com/rabbitmq/tools/json/JSONUtil.java @@ -61,7 +61,6 @@ public static Object fill(Object target, Map source, boolean use String name = prop.getName(); Method setter = prop.getWriteMethod(); if (setter != null && !Modifier.isStatic(setter.getModifiers())) { - //System.out.println(target + " " + name + " <- " + source.get(name)); setter.invoke(target, source.get(name)); } } @@ -74,7 +73,6 @@ public static Object fill(Object target, Map source, boolean use if (Modifier.isPublic(fieldMod) && !(Modifier.isFinal(fieldMod) || Modifier.isStatic(fieldMod))) { - //System.out.println(target + " " + field.getName() + " := " + source.get(field.getName())); try { field.set(target, source.get(field.getName())); } catch (IllegalArgumentException iae) { diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java b/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java new file mode 100644 index 0000000000..358284d650 --- /dev/null +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java @@ -0,0 +1,72 @@ +package com.rabbitmq.tools.jsonrpc; + +import com.rabbitmq.tools.json.JSONReader; +import com.rabbitmq.tools.json.JSONWriter; + +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; + +/** + * + */ +public class DefaultJsonRpcMapper implements JsonRpcMapper { + + @Override + public JsonRpcRequest parse(String requestBody, ServiceDescription description) { + Map request = (Map) new JSONReader().read(requestBody); + + return new JsonRpcRequest( + request.get("id"), request.get("version").toString(), request.get("method").toString(), + ((List) request.get("params")).toArray() + ); + } + + @Override + public JsonRpcResponse parse(String responseBody) { + Map map = (Map) (new JSONReader().read(responseBody)); + Map error; + JsonRpcException exception = null; + if (map.containsKey("error")) { + error = (Map) map.get("error"); + exception = new JsonRpcException( + new JSONWriter().write(error), + (String) error.get("name"), + error.get("code") == null ? 0 : (Integer) error.get("code"), + (String) error.get("message"), + error + ); + } + return new JsonRpcResponse(map, map.get("result"), map.get("error"), exception); + } + + @Override + public Object[] parameters(JsonRpcRequest request, Method method) { + Object[] parameters = request.getParameters(); + Object[] convertedParameters = new Object[parameters.length]; + Class[] parameterTypes = method.getParameterTypes(); + for (int i = 0; i < parameters.length; i++) { + convertedParameters[i] = convert(parameters[i], parameterTypes[i]); + } + return convertedParameters; + } + + @Override + public String write(Object input) { + return new JSONWriter().write(input); + } + + protected Object convert(Object input, Class expectedClass) { + return input; +// if (input == null || input.getClass().equals(expectedClass)) { +// return input; +// } +// System.err.println(input.getClass() + " " + expectedClass); +// if (Long.class.equals(expectedClass) && input instanceof Integer) { +// return Long.valueOf(((Integer) input).longValue()); +// } else if (long.class.equals(expectedClass) && input instanceof Integer) { +// return +// } +// return input; + } +} diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java index 31822da6d0..581e304f83 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java @@ -62,6 +62,8 @@ public class JsonRpcClient extends RpcClient implements InvocationHandler { /** Holds the JSON-RPC service description for this client. */ private ServiceDescription serviceDescription; + private final JsonRpcMapper mapper; + /** * Construct a new JsonRpcClient, passing the parameters through * to RpcClient's constructor. The service description record is @@ -72,6 +74,7 @@ public JsonRpcClient(Channel channel, String exchange, String routingKey, int ti throws IOException, JsonRpcException, TimeoutException { super(channel, exchange, routingKey, timeout); + this.mapper = new DefaultJsonRpcMapper(); retrieveServiceDescription(); } @@ -86,18 +89,14 @@ public JsonRpcClient(Channel channel, String exchange, String routingKey) * @return the result contained within the reply, if no exception is found * Throws JsonRpcException if the reply object contained an exception */ - public static Object checkReply(Map reply) + private Object checkReply(JsonRpcMapper.JsonRpcResponse reply) throws JsonRpcException { - if (reply.containsKey("error")) { - @SuppressWarnings("unchecked") - Map map = (Map) reply.get("error"); - // actually a Map - throw new JsonRpcException(map); - } + if (reply.getError() != null) { + throw reply.getException(); + } - Object result = reply.get("result"); - return result; + return reply.getResult(); } /** @@ -114,16 +113,16 @@ public Object call(String method, Object[] params) throws IOException, JsonRpcEx request.put("method", method); request.put("version", ServiceDescription.JSON_RPC_VERSION); request.put("params", (params == null) ? new Object[0] : params); - String requestStr = new JSONWriter().write(request); + String requestStr = mapper.write(request); try { String replyStr = this.stringCall(requestStr); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Reply string: {}", replyStr); } - @SuppressWarnings("unchecked") - Map map = (Map) (new JSONReader().read(replyStr)); - return checkReply(map); + JsonRpcMapper.JsonRpcResponse reply = mapper.parse(replyStr); + + return checkReply(reply); } catch(ShutdownSignalException ex) { throw new IOException(ex.getMessage()); // wrap, re-throw } diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java index cbefc4fb21..fafb9457d0 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java @@ -13,40 +13,43 @@ // If you have any questions regarding licensing, please contact us at // info@rabbitmq.com. - package com.rabbitmq.tools.jsonrpc; -import java.util.Map; - -import com.rabbitmq.tools.json.JSONWriter; - /** * Thrown when a JSON-RPC service indicates an error occurred during a call. */ public class JsonRpcException extends Exception { + /** * Default serialized version ID */ private static final long serialVersionUID = 1L; - /** Usually the constant string, "JSONRPCError" */ + /** + * Usually the constant string, "JSONRPCError" + */ public String name; - /** Error code */ + /** + * Error code + */ public int code; - /** Error message */ + /** + * Error message + */ public String message; - /** Error detail object - may not always be present or meaningful */ + /** + * Error detail object - may not always be present or meaningful + */ public Object error; public JsonRpcException() { // no work needed in default no-arg constructor } - public JsonRpcException(Map errorMap) { - super(new JSONWriter().write(errorMap)); - name = (String) errorMap.get("name"); - code = 0; - if (errorMap.get("code") != null) { code = ((Integer) errorMap.get("code")); } - message = (String) errorMap.get("message"); - error = errorMap.get("error"); + public JsonRpcException(String detailMessage, String name, int code, String message, Object error) { + super(detailMessage); + this.name = name; + this.code = code; + this.message = message; + this.error = error; } } diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java new file mode 100644 index 0000000000..d1e32b0492 --- /dev/null +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java @@ -0,0 +1,89 @@ +package com.rabbitmq.tools.jsonrpc; + +import java.lang.reflect.Method; + +/** + * + */ +public interface JsonRpcMapper { + + JsonRpcRequest parse(String requestBody, ServiceDescription description); + + JsonRpcResponse parse(String responseBody); + + Object[] parameters(JsonRpcRequest request, Method method); + + String write(Object input); + + class JsonRpcRequest { + + private final Object id; + private final String version; + private final String method; + private final Object[] parameters; + + public JsonRpcRequest(Object id, String version, String method, Object[] parameters) { + this.id = id; + this.version = version; + this.method = method; + this.parameters = parameters; + } + + public Object getId() { + return id; + } + + public String getVersion() { + return version; + } + + public String getMethod() { + return method; + } + + public Object[] getParameters() { + return parameters; + } + + public boolean isSystem() { + return method.startsWith("system."); + } + + public boolean isSystemDescribe() { + return "system.describe".equals(method); + } + + } + + class JsonRpcResponse { + + private final Object reply; + private final Object result; + private final Object error; + private final JsonRpcException exception; + + public JsonRpcResponse(Object reply, Object result, Object error, JsonRpcException exception) { + this.reply = reply; + this.result = result; + this.error = error; + this.exception = exception; + } + + public Object getReply() { + return reply; + } + + public Object getError() { + return error; + } + + public Object getResult() { + return result; + } + + public JsonRpcException getException() { + return exception; + } + } + +} diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java index 138f654b12..068fae1546 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java @@ -55,6 +55,8 @@ public class JsonRpcServer extends StringRpcServer { /** The instance backing this server. */ public Object interfaceInstance; + private final JsonRpcMapper mapper; + /** * Construct a server that talks to the outside world using the * given channel, and constructs a fresh temporary @@ -70,6 +72,7 @@ public JsonRpcServer(Channel channel, throws IOException { super(channel); + this.mapper = new DefaultJsonRpcMapper(); init(interfaceClass, interfaceInstance); } @@ -98,6 +101,7 @@ public JsonRpcServer(Channel channel, throws IOException { super(channel, queueName); + this.mapper = new DefaultJsonRpcMapper(); init(interfaceClass, interfaceInstance); } @@ -126,25 +130,24 @@ public String doCall(String requestBody) LOGGER.debug("Request: {}", requestBody); } try { - @SuppressWarnings("unchecked") - Map request = (Map) new JSONReader().read(requestBody); + JsonRpcMapper.JsonRpcRequest request = mapper.parse(requestBody, serviceDescription); if (request == null) { response = errorResponse(null, 400, "Bad Request", null); - } else if (!ServiceDescription.JSON_RPC_VERSION.equals(request.get("version"))) { + } else if (!ServiceDescription.JSON_RPC_VERSION.equals(request.getVersion())) { response = errorResponse(null, 505, "JSONRPC version not supported", null); } else { - id = request.get("id"); - method = (String) request.get("method"); - List parmList = (List) request.get("params"); - params = parmList.toArray(); - if (method.equals("system.describe")) { + id = request.getId(); + method = request.getMethod(); + params = request.getParameters(); + if (request.isSystemDescribe()) { response = resultResponse(id, serviceDescription); - } else if (method.startsWith("system.")) { + } else if (request.isSystem()) { response = errorResponse(id, 403, "System methods forbidden", null); } else { Object result; try { Method matchingMethod = matchingMethod(method, params); + params = mapper.parameters(request, matchingMethod); if (LOGGER.isDebugEnabled()) { Collection parametersValuesAndTypes = new ArrayList(); if (params != null) { @@ -197,7 +200,7 @@ public Method matchingMethod(String methodName, Object[] params) * ID given, using the code, message, and possible * (JSON-encodable) argument passed in. */ - public static String errorResponse(Object id, int code, String message, Object errorArg) { + private String errorResponse(Object id, int code, String message, Object errorArg) { Map err = new HashMap(); err.put("name", "JSONRPCError"); err.put("code", code); @@ -210,22 +213,21 @@ public static String errorResponse(Object id, int code, String message, Object e * Construct and encode a JSON-RPC success response for the * request ID given, using the result value passed in. */ - public static String resultResponse(Object id, Object result) { + private String resultResponse(Object id, Object result) { return response(id, "result", result); } /** * Private API - used by errorResponse and resultResponse. */ - public static String response(Object id, String label, Object value) { + private String response(Object id, String label, Object value) { Map resp = new HashMap(); resp.put("version", ServiceDescription.JSON_RPC_VERSION); if (id != null) { resp.put("id", id); } resp.put(label, value); - String respStr = new JSONWriter().write(resp); - //System.err.println(respStr); + String respStr = mapper.write(resp); return respStr; } diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java b/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java index 79d750278b..4cb6d3bf66 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java @@ -48,7 +48,7 @@ public ServiceDescription(Map rawServiceDescription) { } public ServiceDescription(Class klass) { - this.procedures = new HashMap(); + this.procedures = new HashMap<>(); for (Method m: klass.getMethods()) { ProcedureDescription proc = new ProcedureDescription(m); addProcedure(proc); @@ -66,7 +66,7 @@ public Collection getProcs() { /** Private API - used via reflection during parsing/loading */ public void setProcs(Collection> p) { - procedures = new HashMap(); + procedures = new HashMap<>(); for (Map pm: p) { ProcedureDescription proc = new ProcedureDescription(pm); addProcedure(proc); diff --git a/src/test/java/com/rabbitmq/client/JsonRpcTest.java b/src/test/java/com/rabbitmq/client/JsonRpcTest.java index b6f73c824e..f13b5b4036 100644 --- a/src/test/java/com/rabbitmq/client/JsonRpcTest.java +++ b/src/test/java/com/rabbitmq/client/JsonRpcTest.java @@ -44,15 +44,11 @@ public void init() throws Exception { serverChannel = serverConnection.createChannel(); serverChannel.queueDeclare(queue, false, false, false, null); server = new JsonRpcServer(serverChannel, queue, RpcService.class, new DefaultRpcservice()); - new Thread(new Runnable() { - - @Override - public void run() { - try { - server.mainloop(); - } catch (Exception e) { - // safe to ignore when loops ends/server is canceled - } + new Thread(() -> { + try { + server.mainloop(); + } catch (Exception e) { + // safe to ignore when loops ends/server is canceled } }).start(); client = new JsonRpcClient(clientChannel, "", queue, 1000); @@ -103,6 +99,23 @@ public void rpc() { } catch (UndeclaredThrowableException e) { // OK } + + try { + assertEquals("123", service.procedureIntegerToPojo(123).getStringProperty()); + fail("Complex return type not supported"); + } catch (ClassCastException e) { + // OK + } + + try { + Pojo pojo = new Pojo(); + pojo.setStringProperty("hello"); + assertEquals("hello", service.procedurePojoToString(pojo)); + fail("Complex type argument not supported"); + } catch (UndeclaredThrowableException e) { + // OK + } + } public interface RpcService { @@ -124,9 +137,14 @@ public interface RpcService { Long procedureLong(Long input); long procedurePrimitiveLong(long input); + + Pojo procedureIntegerToPojo(Integer id); + + String procedurePojoToString(Pojo pojo); + } - public class DefaultRpcservice implements RpcService { + public static class DefaultRpcservice implements RpcService { @Override public String procedureString(String input) { @@ -172,5 +190,30 @@ public Integer procedureLongToInteger(Long input) { public int procedurePrimitiveLongToInteger(long input) { return (int) input + 1; } + + @Override + public Pojo procedureIntegerToPojo(Integer id) { + Pojo pojo = new Pojo(); + pojo.setStringProperty(id.toString()); + return pojo; + } + + @Override + public String procedurePojoToString(Pojo pojo) { + return pojo.getStringProperty(); + } + } + + public static class Pojo { + + private String stringProperty; + + public String getStringProperty() { + return stringProperty; + } + + public void setStringProperty(String stringProperty) { + this.stringProperty = stringProperty; + } } } From 31a144e2a569d122a51066e33e21fcb787241076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 13 Aug 2018 18:10:02 +0200 Subject: [PATCH 012/328] Adding Jackson support in JSON RPC WIP References #378 (cherry picked from commit e28b34ad8094b47a7fa46112490d1308bf8418b9) --- pom.xml | 7 + .../tools/jsonrpc/DefaultJsonRpcMapper.java | 29 ++- .../tools/jsonrpc/JacksonJsonRpcMapper.java | 178 ++++++++++++++ .../rabbitmq/tools/jsonrpc/JsonRpcClient.java | 221 +++++++++--------- .../rabbitmq/tools/jsonrpc/JsonRpcMapper.java | 23 +- .../jsonrpc/JsonRpcMappingException.java | 26 +++ .../rabbitmq/tools/jsonrpc/JsonRpcServer.java | 30 ++- .../tools/jsonrpc/ProcedureDescription.java | 44 ++++ .../rabbitmq/client/AbstractJsonRpcTest.java | 202 ++++++++++++++++ .../com/rabbitmq/client/JacksonRpcTest.java | 64 +++++ .../java/com/rabbitmq/client/JsonRpcTest.java | 167 ++----------- .../com/rabbitmq/client/test/ClientTests.java | 2 + 12 files changed, 724 insertions(+), 269 deletions(-) create mode 100644 src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java create mode 100644 src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMappingException.java create mode 100644 src/test/java/com/rabbitmq/client/AbstractJsonRpcTest.java create mode 100644 src/test/java/com/rabbitmq/client/JacksonRpcTest.java diff --git a/pom.xml b/pom.xml index b26766262b..7104624064 100644 --- a/pom.xml +++ b/pom.xml @@ -57,6 +57,7 @@ 1.7.25 3.2.6 1.0.2 + 2.9.6 1.2.3 1.1 4.12 @@ -640,6 +641,12 @@ ${micrometer.version} true + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + true + commons-cli commons-cli diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java b/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java index 358284d650..c522d24767 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java @@ -1,3 +1,18 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + package com.rabbitmq.tools.jsonrpc; import com.rabbitmq.tools.json.JSONReader; @@ -23,7 +38,7 @@ public JsonRpcRequest parse(String requestBody, ServiceDescription description) } @Override - public JsonRpcResponse parse(String responseBody) { + public JsonRpcResponse parse(String responseBody, Class expectedType) { Map map = (Map) (new JSONReader().read(responseBody)); Map error; JsonRpcException exception = null; @@ -40,6 +55,12 @@ public JsonRpcResponse parse(String responseBody) { return new JsonRpcResponse(map, map.get("result"), map.get("error"), exception); } + @Override + public String write(Object input) { + return new JSONWriter().write(input); + } + + /* @Override public Object[] parameters(JsonRpcRequest request, Method method) { Object[] parameters = request.getParameters(); @@ -51,10 +72,7 @@ public Object[] parameters(JsonRpcRequest request, Method method) { return convertedParameters; } - @Override - public String write(Object input) { - return new JSONWriter().write(input); - } + protected Object convert(Object input, Class expectedClass) { return input; @@ -69,4 +87,5 @@ protected Object convert(Object input, Class expectedClass) { // } // return input; } + */ } diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java new file mode 100644 index 0000000000..0a19f53921 --- /dev/null +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java @@ -0,0 +1,178 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.tools.jsonrpc; + +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.TreeNode; +import com.fasterxml.jackson.databind.MappingJsonFactory; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ValueNode; +import com.rabbitmq.tools.json.JSONReader; +import com.rabbitmq.tools.json.JSONWriter; + +import java.io.IOException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * + */ +public class JacksonJsonRpcMapper implements JsonRpcMapper { + + private final ObjectMapper mapper; + + public JacksonJsonRpcMapper(ObjectMapper mapper) { + this.mapper = mapper; + } + + public JacksonJsonRpcMapper() { + this(new ObjectMapper()); + } + + @Override + public JsonRpcRequest parse(String requestBody, ServiceDescription description) { + JsonFactory jsonFactory = new MappingJsonFactory(); + String method = null, version = null; + final List parameters = new ArrayList<>(); + Object id = null; + try (JsonParser parser = jsonFactory.createParser(requestBody)) { + while (parser.nextToken() != null) { + JsonToken token = parser.currentToken(); + if (token == JsonToken.FIELD_NAME) { + String name = parser.currentName(); + token = parser.nextToken(); + if ("method".equals(name)) { + method = parser.getValueAsString(); + } else if ("id".equals(name)) { + // FIXME parse id, can be any type (handle only primitive and wrapper) + } else if ("version".equals(name)) { + version = parser.getValueAsString(); + } else if ("params".equals(name)) { + if (token == JsonToken.START_ARRAY) { + while (parser.nextToken() != JsonToken.END_ARRAY) { + parameters.add(parser.readValueAsTree()); + } + } else { + throw new IllegalStateException("Field params must be an array"); + } + } + } + } + } catch (IOException e) { + throw new JsonRpcMappingException("Error during JSON parsing", e); + } + + List convertedParameters = new ArrayList<>(parameters.size()); + if (!parameters.isEmpty()) { + ProcedureDescription proc = description.getProcedure(method, parameters.size()); + Method internalMethod = proc.internal_getMethod(); + for (int i = 0; i < internalMethod.getParameterCount(); i++) { + TreeNode parameterNode = parameters.get(i); + try { + Class parameterType = internalMethod.getParameterTypes()[i]; + Object value = convert(parameterNode, parameterType); + convertedParameters.add(value); + } catch (IOException e) { + throw new JsonRpcMappingException("Error during parameter conversion", e); + } + } + } + + return new JsonRpcRequest( + id, version, method, + convertedParameters.toArray() + ); + } + + protected Object convert(TreeNode node, Class expectedType) throws IOException { + Object value; + if (expectedType.isPrimitive()) { + ValueNode valueNode = (ValueNode) node; + if (expectedType == Boolean.TYPE) { + value = valueNode.booleanValue(); + } else if (expectedType == Character.TYPE) { + value = valueNode.textValue().charAt(0); + } else if (expectedType == Short.TYPE) { + value = valueNode.shortValue(); + } else if (expectedType == Integer.TYPE) { + value = valueNode.intValue(); + } else if (expectedType == Long.TYPE) { + value = valueNode.longValue(); + } else if (expectedType == Float.TYPE) { + value = valueNode.floatValue(); + } else if (expectedType == Double.TYPE) { + value = valueNode.doubleValue(); + } else { + throw new IllegalArgumentException("Primitive type not supported: " + expectedType); + } + } else { + value = mapper.readValue(node.traverse(), expectedType); + } + return value; + } + + @Override + public JsonRpcResponse parse(String responseBody, Class expectedReturnType) { + JsonFactory jsonFactory = new MappingJsonFactory(); + Object result = null; + try (JsonParser parser = jsonFactory.createParser(responseBody)) { + while (parser.nextToken() != null) { + JsonToken token = parser.currentToken(); + if (token == JsonToken.FIELD_NAME) { + String name = parser.currentName(); + parser.nextToken(); + if ("result".equals(name)) { + if (expectedReturnType == Void.TYPE) { + result = null; + } else { + result = convert(parser.readValueAsTree(), expectedReturnType); + } + } + } + } + } catch (IOException e) { + throw new JsonRpcMappingException("Error during JSON parsing", e); + } + Map map = (Map) (new JSONReader().read(responseBody)); + Map error; + JsonRpcException exception = null; + if (map.containsKey("error")) { + error = (Map) map.get("error"); + exception = new JsonRpcException( + new JSONWriter().write(error), + (String) error.get("name"), + error.get("code") == null ? 0 : (Integer) error.get("code"), + (String) error.get("message"), + error + ); + } + return new JsonRpcResponse(map, result, map.get("error"), exception); + } + + @Override + public String write(Object input) { + try { + return mapper.writeValueAsString(input); + } catch (JsonProcessingException e) { + throw new JsonRpcMappingException("Error during JSON serialization", e); + } + } +} diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java index 581e304f83..12032941f3 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java @@ -15,6 +15,13 @@ package com.rabbitmq.tools.jsonrpc; +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.RpcClient; +import com.rabbitmq.client.ShutdownSignalException; +import com.rabbitmq.tools.json.JSONReader; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.IOException; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; @@ -23,78 +30,106 @@ import java.util.Map; import java.util.concurrent.TimeoutException; -import com.rabbitmq.client.Channel; -import com.rabbitmq.client.RpcClient; -import com.rabbitmq.client.ShutdownSignalException; -import com.rabbitmq.tools.json.JSONReader; -import com.rabbitmq.tools.json.JSONWriter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - /** - JSON-RPC is a lightweight - RPC mechanism using JSON - as a data language for request and reply messages. It is - rapidly becoming a standard in web development, where it is - used to make RPC requests over HTTP. RabbitMQ provides an - AMQP transport binding for JSON-RPC in the form of the - JsonRpcClient class. - - JSON-RPC services are self-describing - each service is able - to list its supported procedures, and each procedure - describes its parameters and types. An instance of - JsonRpcClient retrieves its service description using the - standard system.describe procedure when it is - constructed, and uses the information to coerce parameter - types appropriately. A JSON service description is parsed - into instances of ServiceDescription. Client - code can access the service description by reading the - serviceDescription field of - JsonRpcClient instances. - - @see #call(String, Object[]) - @see #call(String[]) + * JSON-RPC is a lightweight + * RPC mechanism using JSON + * as a data language for request and reply messages. It is + * rapidly becoming a standard in web development, where it is + * used to make RPC requests over HTTP. RabbitMQ provides an + * AMQP transport binding for JSON-RPC in the form of the + * JsonRpcClient class. + *

+ * JSON-RPC services are self-describing - each service is able + * to list its supported procedures, and each procedure + * describes its parameters and types. An instance of + * JsonRpcClient retrieves its service description using the + * standard system.describe procedure when it is + * constructed, and uses the information to coerce parameter + * types appropriately. A JSON service description is parsed + * into instances of ServiceDescription. Client + * code can access the service description by reading the + * serviceDescription field of + * JsonRpcClient instances. + * + * @see #call(String, Object[]) + * @see #call(String[]) */ public class JsonRpcClient extends RpcClient implements InvocationHandler { private static final Logger LOGGER = LoggerFactory.getLogger(JsonRpcClient.class); - - /** Holds the JSON-RPC service description for this client. */ + private final JsonRpcMapper mapper; + /** + * Holds the JSON-RPC service description for this client. + */ private ServiceDescription serviceDescription; - private final JsonRpcMapper mapper; + /** + * Construct a new JsonRpcClient, passing the parameters through + * to RpcClient's constructor. The service description record is + * retrieved from the server during construction. + * + * @throws TimeoutException if a response is not received within the timeout specified, if any + */ + public JsonRpcClient(Channel channel, String exchange, String routingKey, int timeout, JsonRpcMapper mapper) + throws IOException, JsonRpcException, TimeoutException { + super(channel, exchange, routingKey, timeout); + this.mapper = mapper; + retrieveServiceDescription(); + } /** * Construct a new JsonRpcClient, passing the parameters through * to RpcClient's constructor. The service description record is * retrieved from the server during construction. + * * @throws TimeoutException if a response is not received within the timeout specified, if any */ public JsonRpcClient(Channel channel, String exchange, String routingKey, int timeout) - throws IOException, JsonRpcException, TimeoutException - { - super(channel, exchange, routingKey, timeout); - this.mapper = new DefaultJsonRpcMapper(); - retrieveServiceDescription(); + throws IOException, JsonRpcException, TimeoutException { + this(channel, exchange, routingKey, timeout, new DefaultJsonRpcMapper()); } public JsonRpcClient(Channel channel, String exchange, String routingKey) - throws IOException, JsonRpcException, TimeoutException - { + throws IOException, JsonRpcException, TimeoutException { this(channel, exchange, routingKey, RpcClient.NO_TIMEOUT); } + /** + * Private API - used by {@link #call(String[])} to ad-hoc convert + * strings into the required data types for a call. + */ + public static Object coerce(String val, String type) + throws NumberFormatException { + if ("bit".equals(type)) { + return Boolean.getBoolean(val) ? Boolean.TRUE : Boolean.FALSE; + } else if ("num".equals(type)) { + try { + return Integer.valueOf(val); + } catch (NumberFormatException nfe) { + return Double.valueOf(val); + } + } else if ("str".equals(type)) { + return val; + } else if ("arr".equals(type) || "obj".equals(type) || "any".equals(type)) { + return new JSONReader().read(val); + } else if ("nil".equals(type)) { + return null; + } else { + throw new IllegalArgumentException("Bad type: " + type); + } + } + /** * Private API - parses a JSON-RPC reply object, checking it for exceptions. + * * @return the result contained within the reply, if no exception is found * Throws JsonRpcException if the reply object contained an exception */ private Object checkReply(JsonRpcMapper.JsonRpcResponse reply) - throws JsonRpcException - { - if (reply.getError() != null) { - throw reply.getException(); - } + throws JsonRpcException { + if (reply.getError() != null) { + throw reply.getException(); + } return reply.getResult(); } @@ -102,31 +137,37 @@ private Object checkReply(JsonRpcMapper.JsonRpcResponse reply) /** * Public API - builds, encodes and sends a JSON-RPC request, and * waits for the response. + * * @return the result contained within the reply, if no exception is found * @throws JsonRpcException if the reply object contained an exception * @throws TimeoutException if a response is not received within the timeout specified, if any */ - public Object call(String method, Object[] params) throws IOException, JsonRpcException, TimeoutException - { - HashMap request = new HashMap(); + public Object call(String method, Object[] params) throws IOException, JsonRpcException, TimeoutException { + Map request = new HashMap(); request.put("id", null); request.put("method", method); request.put("version", ServiceDescription.JSON_RPC_VERSION); - request.put("params", (params == null) ? new Object[0] : params); + params = (params == null) ? new Object[0] : params; + request.put("params", params); String requestStr = mapper.write(request); try { String replyStr = this.stringCall(requestStr); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Reply string: {}", replyStr); } - - JsonRpcMapper.JsonRpcResponse reply = mapper.parse(replyStr); + Class expectedType; + if ("system.describe".equals(method) && params.length == 0) { + expectedType = Map.class; + } else { + ProcedureDescription proc = serviceDescription.getProcedure(method, params.length); + expectedType = proc.getReturnType(); + } + JsonRpcMapper.JsonRpcResponse reply = mapper.parse(replyStr, expectedType); return checkReply(reply); - } catch(ShutdownSignalException ex) { + } catch (ShutdownSignalException ex) { throw new IOException(ex.getMessage()); // wrap, re-throw } - } /** @@ -136,8 +177,7 @@ public Object call(String method, Object[] params) throws IOException, JsonRpcEx */ @Override public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable - { + throws Throwable { return call(method.getName(), args); } @@ -146,69 +186,42 @@ public Object invoke(Object proxy, Method method, Object[] args) */ @SuppressWarnings("unchecked") public T createProxy(Class klass) - throws IllegalArgumentException - { + throws IllegalArgumentException { return (T) Proxy.newProxyInstance(klass.getClassLoader(), - new Class[] { klass }, - this); - } - - /** - * Private API - used by {@link #call(String[])} to ad-hoc convert - * strings into the required data types for a call. - */ - public static Object coerce(String val, String type) - throws NumberFormatException - { - if ("bit".equals(type)) { - return Boolean.getBoolean(val) ? Boolean.TRUE : Boolean.FALSE; - } else if ("num".equals(type)) { - try { - return Integer.valueOf(val); - } catch (NumberFormatException nfe) { - return Double.valueOf(val); - } - } else if ("str".equals(type)) { - return val; - } else if ("arr".equals(type) || "obj".equals(type) || "any".equals(type)) { - return new JSONReader().read(val); - } else if ("nil".equals(type)) { - return null; - } else { - throw new IllegalArgumentException("Bad type: " + type); - } + new Class[] { klass }, + this); } /** - * Public API - as {@link #call(String,Object[])}, but takes the + * Public API - as {@link #call(String, Object[])}, but takes the * method name from the first entry in args, and the * parameters from subsequent entries. All parameter values are * passed through coerce() to attempt to make them the types the * server is expecting. + * * @return the result contained within the reply, if no exception is found - * @throws JsonRpcException if the reply object contained an exception + * @throws JsonRpcException if the reply object contained an exception * @throws NumberFormatException if a coercion failed - * @throws TimeoutException if a response is not received within the timeout specified, if any + * @throws TimeoutException if a response is not received within the timeout specified, if any * @see #coerce */ public Object call(String[] args) - throws NumberFormatException, IOException, JsonRpcException, TimeoutException - { - if (args.length == 0) { - throw new IllegalArgumentException("First string argument must be method name"); - } + throws NumberFormatException, IOException, JsonRpcException, TimeoutException { + if (args.length == 0) { + throw new IllegalArgumentException("First string argument must be method name"); + } - String method = args[0]; + String method = args[0]; int arity = args.length - 1; - ProcedureDescription proc = serviceDescription.getProcedure(method, arity); - ParameterDescription[] params = proc.getParams(); + ProcedureDescription proc = serviceDescription.getProcedure(method, arity); + ParameterDescription[] params = proc.getParams(); - Object[] actuals = new Object[arity]; - for (int count = 0; count < params.length; count++) { - actuals[count] = coerce(args[count + 1], params[count].type); - } + Object[] actuals = new Object[arity]; + for (int count = 0; count < params.length; count++) { + actuals[count] = coerce(args[count + 1], params[count].type); + } - return call(method, actuals); + return call(method, actuals); } /** @@ -216,7 +229,7 @@ public Object call(String[] args) * service loaded from the server itself at construction time. */ public ServiceDescription getServiceDescription() { - return serviceDescription; + return serviceDescription; } /** @@ -224,10 +237,10 @@ public ServiceDescription getServiceDescription() { * server, and parses and stores the resulting service description * in this object. * TODO: Avoid calling this from the constructor. + * * @throws TimeoutException if a response is not received within the timeout specified, if any */ - private void retrieveServiceDescription() throws IOException, JsonRpcException, TimeoutException - { + private void retrieveServiceDescription() throws IOException, JsonRpcException, TimeoutException { @SuppressWarnings("unchecked") Map rawServiceDescription = (Map) call("system.describe", null); serviceDescription = new ServiceDescription(rawServiceDescription); diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java index d1e32b0492..36f1ad72b2 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java @@ -1,6 +1,19 @@ -package com.rabbitmq.tools.jsonrpc; +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. -import java.lang.reflect.Method; +package com.rabbitmq.tools.jsonrpc; /** * @@ -9,9 +22,7 @@ public interface JsonRpcMapper { JsonRpcRequest parse(String requestBody, ServiceDescription description); - JsonRpcResponse parse(String responseBody); - - Object[] parameters(JsonRpcRequest request, Method method); + JsonRpcResponse parse(String responseBody, Class expectedType); String write(Object input); @@ -52,7 +63,6 @@ public boolean isSystem() { public boolean isSystemDescribe() { return "system.describe".equals(method); } - } class JsonRpcResponse { @@ -85,5 +95,4 @@ public JsonRpcException getException() { return exception; } } - } diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMappingException.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMappingException.java new file mode 100644 index 0000000000..633a1d79d7 --- /dev/null +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMappingException.java @@ -0,0 +1,26 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.tools.jsonrpc; + +/** + * + */ +public class JsonRpcMappingException extends RuntimeException { + + public JsonRpcMappingException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java index 068fae1546..922fe35b1c 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java @@ -57,6 +57,16 @@ public class JsonRpcServer extends StringRpcServer { private final JsonRpcMapper mapper; + public JsonRpcServer(Channel channel, + Class interfaceClass, + Object interfaceInstance, JsonRpcMapper mapper) + throws IOException + { + super(channel); + this.mapper = mapper; + init(interfaceClass, interfaceInstance); + } + /** * Construct a server that talks to the outside world using the * given channel, and constructs a fresh temporary @@ -71,9 +81,7 @@ public JsonRpcServer(Channel channel, Object interfaceInstance) throws IOException { - super(channel); - this.mapper = new DefaultJsonRpcMapper(); - init(interfaceClass, interfaceInstance); + this(channel, interfaceClass, interfaceInstance, new DefaultJsonRpcMapper()); } private void init(Class interfaceClass, Object interfaceInstance) @@ -83,6 +91,17 @@ private void init(Class interfaceClass, Object interfaceInstance) this.serviceDescription = new ServiceDescription(interfaceClass); } + public JsonRpcServer(Channel channel, + String queueName, + Class interfaceClass, + Object interfaceInstance, JsonRpcMapper mapper) + throws IOException + { + super(channel, queueName); + this.mapper = mapper; + init(interfaceClass, interfaceInstance); + } + /** * Construct a server that talks to the outside world using the * given channel and queue name. Our superclass, @@ -100,9 +119,7 @@ public JsonRpcServer(Channel channel, Object interfaceInstance) throws IOException { - super(channel, queueName); - this.mapper = new DefaultJsonRpcMapper(); - init(interfaceClass, interfaceInstance); + this(channel, queueName, interfaceClass, interfaceInstance, new DefaultJsonRpcMapper()); } /** @@ -147,7 +164,6 @@ public String doCall(String requestBody) Object result; try { Method matchingMethod = matchingMethod(method, params); - params = mapper.parameters(request, matchingMethod); if (LOGGER.isDebugEnabled()) { Collection parametersValuesAndTypes = new ArrayList(); if (params != null) { diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java b/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java index 57dcc39b05..714db1da96 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java @@ -39,6 +39,8 @@ public class ProcedureDescription { private ParameterDescription[] params; /** Return type for this procedure */ private String returnType; + private String javaReturnType; + private Class _javaReturnTypeAsClass; /** Reflected method object, used for service invocation */ private Method method; @@ -68,6 +70,7 @@ public ProcedureDescription(Method m) { params[i] = new ParameterDescription(i, parameterTypes[i]); } this.returnType = ParameterDescription.lookup(m.getReturnType()); + this.javaReturnType = m.getReturnType().getName(); } public ProcedureDescription() { @@ -82,6 +85,47 @@ public ProcedureDescription() { /** Private API - used to get the reflected method object, for servers */ public Method internal_getMethod() { return method; } + public String getJavaReturnType() { + return javaReturnType; + } + + public void setJavaReturnType(String javaReturnType) { + this.javaReturnType = javaReturnType; + this._javaReturnTypeAsClass = computeReturnTypeAsJavaClass(); + } + + public Class getReturnType() { + return _javaReturnTypeAsClass; + } + + private Class computeReturnTypeAsJavaClass() { + try { + if ("int".equals(javaReturnType)) { + return Integer.TYPE; + } else if ("double".equals(javaReturnType)) { + return Double.TYPE; + } else if ("long".equals(javaReturnType)) { + return Long.TYPE; + } else if ("boolean".equals(javaReturnType)) { + return Boolean.TYPE; + } else if ("char".equals(javaReturnType)) { + return Character.TYPE; + } else if ("byte".equals(javaReturnType)) { + return Byte.TYPE; + } else if ("short".equals(javaReturnType)) { + return Short.TYPE; + } else if ("float".equals(javaReturnType)) { + return Float.TYPE; + } else if ("void".equals(javaReturnType)) { + return Void.TYPE; + } else { + return Class.forName(javaReturnType); + } + } catch (ClassNotFoundException e) { + throw new IllegalStateException("Unable to load class: " + javaReturnType, e); + } + } + /** Gets an array of parameter descriptions for all this procedure's parameters */ public ParameterDescription[] internal_getParams() { return params; diff --git a/src/test/java/com/rabbitmq/client/AbstractJsonRpcTest.java b/src/test/java/com/rabbitmq/client/AbstractJsonRpcTest.java new file mode 100644 index 0000000000..555d4c0b24 --- /dev/null +++ b/src/test/java/com/rabbitmq/client/AbstractJsonRpcTest.java @@ -0,0 +1,202 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client; + +import com.rabbitmq.client.test.TestUtils; +import com.rabbitmq.tools.jsonrpc.JsonRpcClient; +import com.rabbitmq.tools.jsonrpc.JsonRpcMapper; +import com.rabbitmq.tools.jsonrpc.JsonRpcServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.lang.reflect.UndeclaredThrowableException; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public abstract class AbstractJsonRpcTest { + + Connection clientConnection, serverConnection; + Channel clientChannel, serverChannel; + String queue = "json.rpc.queue"; + JsonRpcServer server; + JsonRpcClient client; + RpcService service; + + abstract JsonRpcMapper createMapper(); + + @Before + public void init() throws Exception { + clientConnection = TestUtils.connectionFactory().newConnection(); + clientChannel = clientConnection.createChannel(); + serverConnection = TestUtils.connectionFactory().newConnection(); + serverChannel = serverConnection.createChannel(); + serverChannel.queueDeclare(queue, false, false, false, null); + server = new JsonRpcServer(serverChannel, queue, RpcService.class, new DefaultRpcservice(), createMapper()); + new Thread(() -> { + try { + server.mainloop(); + } catch (Exception e) { + // safe to ignore when loops ends/server is canceled + } + }).start(); + client = new JsonRpcClient(clientChannel, "", queue, 1000, createMapper()); + service = client.createProxy(RpcService.class); + } + + @After + public void tearDown() throws Exception { + if (server != null) { + server.terminateMainloop(); + } + if (client != null) { + client.close(); + } + if (serverChannel != null) { + serverChannel.queueDelete(queue); + } + clientConnection.close(); + serverConnection.close(); + } + + public interface RpcService { + + boolean procedurePrimitiveBoolean(boolean input); + + Boolean procedureBoolean(Boolean input); + + String procedureString(String input); + + String procedureStringString(String input1, String input2); + + int procedurePrimitiveInteger(int input); + + Integer procedureInteger(Integer input); + + Double procedureDouble(Double input); + + double procedurePrimitiveDouble(double input); + + Integer procedureLongToInteger(Long input); + + int procedurePrimitiveLongToInteger(long input); + + Long procedureLong(Long input); + + long procedurePrimitiveLong(long input); + + Pojo procedureIntegerToPojo(Integer id); + + String procedurePojoToString(Pojo pojo); + + void procedureException(); + + } + + public static class DefaultRpcservice implements RpcService { + + @Override + public boolean procedurePrimitiveBoolean(boolean input) { + return !input; + } + + @Override + public Boolean procedureBoolean(Boolean input) { + return Boolean.valueOf(!input.booleanValue()); + } + + @Override + public String procedureString(String input) { + return input + 1; + } + + @Override + public String procedureStringString(String input1, String input2) { + return input1 + input2; + } + + @Override + public int procedurePrimitiveInteger(int input) { + return input + 1; + } + + @Override + public Integer procedureInteger(Integer input) { + return input + 1; + } + + @Override + public Long procedureLong(Long input) { + return input + 1; + } + + @Override + public long procedurePrimitiveLong(long input) { + return input + 1L; + } + + @Override + public Double procedureDouble(Double input) { + return input + 1; + } + + @Override + public double procedurePrimitiveDouble(double input) { + return input + 1; + } + + @Override + public Integer procedureLongToInteger(Long input) { + return (int) (input + 1); + } + + @Override + public int procedurePrimitiveLongToInteger(long input) { + return (int) input + 1; + } + + @Override + public Pojo procedureIntegerToPojo(Integer id) { + Pojo pojo = new Pojo(); + pojo.setStringProperty(id.toString()); + return pojo; + } + + @Override + public String procedurePojoToString(Pojo pojo) { + return pojo.getStringProperty(); + } + + @Override + public void procedureException() { + throw new RuntimeException(); + } + } + + public static class Pojo { + + private String stringProperty; + + public String getStringProperty() { + return stringProperty; + } + + public void setStringProperty(String stringProperty) { + this.stringProperty = stringProperty; + } + } +} diff --git a/src/test/java/com/rabbitmq/client/JacksonRpcTest.java b/src/test/java/com/rabbitmq/client/JacksonRpcTest.java new file mode 100644 index 0000000000..ba95efef98 --- /dev/null +++ b/src/test/java/com/rabbitmq/client/JacksonRpcTest.java @@ -0,0 +1,64 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client; + +import com.rabbitmq.tools.jsonrpc.JacksonJsonRpcMapper; +import com.rabbitmq.tools.jsonrpc.JsonRpcException; +import com.rabbitmq.tools.jsonrpc.JsonRpcMapper; +import org.junit.Test; + +import java.lang.reflect.UndeclaredThrowableException; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class JacksonRpcTest extends AbstractJsonRpcTest { + + @Override + JsonRpcMapper createMapper() { + return new JacksonJsonRpcMapper(); + } + + @Test + public void rpc() { + assertFalse(service.procedurePrimitiveBoolean(true)); + assertFalse(service.procedureBoolean(Boolean.TRUE).booleanValue()); + assertEquals("hello1", service.procedureString("hello")); + assertEquals("hello1hello2", service.procedureStringString("hello1", "hello2")); + assertEquals(2, service.procedureInteger(1).intValue()); + assertEquals(2, service.procedurePrimitiveInteger(1)); + assertEquals(2, service.procedureDouble(1.0).intValue()); + assertEquals(2, (int) service.procedurePrimitiveDouble(1.0)); + assertEquals(2, (int) service.procedureLongToInteger(1L)); + assertEquals(2, service.procedurePrimitiveLongToInteger(1L)); + assertEquals(2, service.procedurePrimitiveLong(1L)); + assertEquals(2, service.procedureLong(1L).longValue()); + assertEquals("123", service.procedureIntegerToPojo(123).getStringProperty()); + + Pojo pojo = new Pojo(); + pojo.setStringProperty("hello"); + assertEquals("hello", service.procedurePojoToString(pojo)); + + try { + service.procedureException(); + fail("Remote procedure throwing exception, an exception should have been thrown"); + } catch (UndeclaredThrowableException e) { + assertTrue(e.getCause() instanceof JsonRpcException); + } + } +} diff --git a/src/test/java/com/rabbitmq/client/JsonRpcTest.java b/src/test/java/com/rabbitmq/client/JsonRpcTest.java index f13b5b4036..a4a18f9693 100644 --- a/src/test/java/com/rabbitmq/client/JsonRpcTest.java +++ b/src/test/java/com/rabbitmq/client/JsonRpcTest.java @@ -15,69 +15,44 @@ package com.rabbitmq.client; -import com.rabbitmq.client.test.TestUtils; -import com.rabbitmq.tools.jsonrpc.JsonRpcClient; -import com.rabbitmq.tools.jsonrpc.JsonRpcServer; -import org.junit.After; -import org.junit.Before; +import com.rabbitmq.tools.jsonrpc.DefaultJsonRpcMapper; +import com.rabbitmq.tools.jsonrpc.JacksonJsonRpcMapper; +import com.rabbitmq.tools.jsonrpc.JsonRpcException; +import com.rabbitmq.tools.jsonrpc.JsonRpcMapper; import org.junit.Test; import java.lang.reflect.UndeclaredThrowableException; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -public class JsonRpcTest { +public class JsonRpcTest extends AbstractJsonRpcTest { - Connection clientConnection, serverConnection; - Channel clientChannel, serverChannel; - String queue = "json.rpc.queue"; - JsonRpcServer server; - JsonRpcClient client; - RpcService service; - - @Before - public void init() throws Exception { - clientConnection = TestUtils.connectionFactory().newConnection(); - clientChannel = clientConnection.createChannel(); - serverConnection = TestUtils.connectionFactory().newConnection(); - serverChannel = serverConnection.createChannel(); - serverChannel.queueDeclare(queue, false, false, false, null); - server = new JsonRpcServer(serverChannel, queue, RpcService.class, new DefaultRpcservice()); - new Thread(() -> { - try { - server.mainloop(); - } catch (Exception e) { - // safe to ignore when loops ends/server is canceled - } - }).start(); - client = new JsonRpcClient(clientChannel, "", queue, 1000); - service = client.createProxy(RpcService.class); - } - - @After - public void tearDown() throws Exception { - if (server != null) { - server.terminateMainloop(); - } - if (client != null) { - client.close(); - } - if (serverChannel != null) { - serverChannel.queueDelete(queue); - } - clientConnection.close(); - serverConnection.close(); + @Override + JsonRpcMapper createMapper() { + return new DefaultJsonRpcMapper(); } @Test public void rpc() { + assertFalse(service.procedurePrimitiveBoolean(true)); + assertFalse(service.procedureBoolean(Boolean.TRUE).booleanValue()); assertEquals("hello1", service.procedureString("hello")); assertEquals(2, service.procedureInteger(1).intValue()); assertEquals(2, service.procedurePrimitiveInteger(1)); assertEquals(2, service.procedureDouble(1.0).intValue()); assertEquals(2, (int) service.procedurePrimitiveDouble(1.0)); + try { + service.procedureException(); + fail("Remote procedure throwing exception, an exception should have been thrown"); + } catch (UndeclaredThrowableException e) { + assertTrue(e.getCause() instanceof JsonRpcException); + } + + try { assertEquals(2, (int) service.procedureLongToInteger(1L)); fail("Long argument isn't supported"); @@ -115,105 +90,5 @@ public void rpc() { } catch (UndeclaredThrowableException e) { // OK } - - } - - public interface RpcService { - - String procedureString(String input); - - int procedurePrimitiveInteger(int input); - - Integer procedureInteger(Integer input); - - Double procedureDouble(Double input); - - double procedurePrimitiveDouble(double input); - - Integer procedureLongToInteger(Long input); - - int procedurePrimitiveLongToInteger(long input); - - Long procedureLong(Long input); - - long procedurePrimitiveLong(long input); - - Pojo procedureIntegerToPojo(Integer id); - - String procedurePojoToString(Pojo pojo); - - } - - public static class DefaultRpcservice implements RpcService { - - @Override - public String procedureString(String input) { - return input + 1; - } - - @Override - public int procedurePrimitiveInteger(int input) { - return input + 1; - } - - @Override - public Integer procedureInteger(Integer input) { - return input + 1; - } - - @Override - public Long procedureLong(Long input) { - return input + 1; - } - - @Override - public long procedurePrimitiveLong(long input) { - return input + 1L; - } - - @Override - public Double procedureDouble(Double input) { - return input + 1; - } - - @Override - public double procedurePrimitiveDouble(double input) { - return input + 1; - } - - @Override - public Integer procedureLongToInteger(Long input) { - return (int) (input + 1); - } - - @Override - public int procedurePrimitiveLongToInteger(long input) { - return (int) input + 1; - } - - @Override - public Pojo procedureIntegerToPojo(Integer id) { - Pojo pojo = new Pojo(); - pojo.setStringProperty(id.toString()); - return pojo; - } - - @Override - public String procedurePojoToString(Pojo pojo) { - return pojo.getStringProperty(); - } - } - - public static class Pojo { - - private String stringProperty; - - public String getStringProperty() { - return stringProperty; - } - - public void setStringProperty(String stringProperty) { - this.stringProperty = stringProperty; - } } -} +} \ No newline at end of file diff --git a/src/test/java/com/rabbitmq/client/test/ClientTests.java b/src/test/java/com/rabbitmq/client/test/ClientTests.java index 2b4c8ea04a..1224dea66e 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientTests.java +++ b/src/test/java/com/rabbitmq/client/test/ClientTests.java @@ -16,6 +16,7 @@ package com.rabbitmq.client.test; +import com.rabbitmq.client.JacksonRpcTest; import com.rabbitmq.client.JsonRpcTest; import com.rabbitmq.utility.IntAllocatorTests; import org.junit.runner.RunWith; @@ -62,6 +63,7 @@ StrictExceptionHandlerTest.class, NoAutoRecoveryWhenTcpWindowIsFullTest.class, JsonRpcTest.class, + JacksonRpcTest.class, AddressTest.class, DefaultRetryHandlerTest.class, NioDeadlockOnConnectionClosing.class From 06c5152b3960b5ab44106019a76d02a321bb13db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 14 Aug 2018 10:13:12 +0200 Subject: [PATCH 013/328] Add JSON abstraction for JSON RPC support [#159302201] Fixes #378 (cherry picked from commit 01f10d6cf7c55167f40c7f82fe8459341c4e93f2) --- .../com/rabbitmq/tools/json/JSONReader.java | 5 + .../rabbitmq/tools/json/JSONSerializable.java | 4 + .../com/rabbitmq/tools/json/JSONUtil.java | 79 ++++++------ .../com/rabbitmq/tools/json/JSONWriter.java | 4 + .../tools/jsonrpc/DefaultJsonRpcMapper.java | 45 ++----- .../tools/jsonrpc/JacksonJsonRpcMapper.java | 112 +++++++++++------- .../rabbitmq/tools/jsonrpc/JsonRpcClient.java | 5 + .../rabbitmq/tools/jsonrpc/JsonRpcMapper.java | 31 +++-- .../jsonrpc/JsonRpcMappingException.java | 1 + .../rabbitmq/tools/jsonrpc/JsonRpcServer.java | 100 ++++++++-------- .../rabbitmq/client/AbstractJsonRpcTest.java | 19 ++- ...onRpcTest.java => DefaultJsonRpcTest.java} | 5 +- ...onRpcTest.java => JacksonJsonRpcTest.java} | 17 ++- .../com/rabbitmq/client/test/ClientTests.java | 8 +- 14 files changed, 246 insertions(+), 189 deletions(-) rename src/test/java/com/rabbitmq/client/{JsonRpcTest.java => DefaultJsonRpcTest.java} (96%) rename src/test/java/com/rabbitmq/client/{JacksonRpcTest.java => JacksonJsonRpcTest.java} (80%) diff --git a/src/main/java/com/rabbitmq/tools/json/JSONReader.java b/src/main/java/com/rabbitmq/tools/json/JSONReader.java index 6c9420767e..fa4c43643d 100644 --- a/src/main/java/com/rabbitmq/tools/json/JSONReader.java +++ b/src/main/java/com/rabbitmq/tools/json/JSONReader.java @@ -44,6 +44,11 @@ import java.util.List; import java.util.Map; +/** + * Will be removed in 6.0 + * + * @deprecated Use a third-party JSON library, e.g. Jackson or GJSON + */ public class JSONReader { private static final Object OBJECT_END = new Object(); diff --git a/src/main/java/com/rabbitmq/tools/json/JSONSerializable.java b/src/main/java/com/rabbitmq/tools/json/JSONSerializable.java index 1cb1b0a77e..f453de5038 100644 --- a/src/main/java/com/rabbitmq/tools/json/JSONSerializable.java +++ b/src/main/java/com/rabbitmq/tools/json/JSONSerializable.java @@ -18,6 +18,10 @@ /** * Interface for classes that wish to control their own serialization. + * + * Will be removed in 6.0 + * + * @deprecated Use a third-party JSON library, e.g. Jackson or GJSON */ public interface JSONSerializable { /** diff --git a/src/main/java/com/rabbitmq/tools/json/JSONUtil.java b/src/main/java/com/rabbitmq/tools/json/JSONUtil.java index c40727d6e8..c024e142c8 100644 --- a/src/main/java/com/rabbitmq/tools/json/JSONUtil.java +++ b/src/main/java/com/rabbitmq/tools/json/JSONUtil.java @@ -13,7 +13,6 @@ // If you have any questions regarding licensing, please contact us at // info@rabbitmq.com. - package com.rabbitmq.tools.json; import org.slf4j.Logger; @@ -34,15 +33,15 @@ */ public class JSONUtil { - private static final Logger LOGGER = LoggerFactory.getLogger(JSONUtil.class); + private static final Logger LOGGER = LoggerFactory.getLogger(JSONUtil.class); + /** * Uses reflection to fill public fields and Bean properties of * the target object from the source Map. */ public static Object fill(Object target, Map source) - throws IntrospectionException, IllegalAccessException, InvocationTargetException - { - return fill(target, source, true); + throws IntrospectionException, IllegalAccessException, InvocationTargetException { + return fill(target, source, true); } /** @@ -50,38 +49,36 @@ public static Object fill(Object target, Map source) * properties of the target object from the source Map. */ public static Object fill(Object target, Map source, boolean useProperties) - throws IntrospectionException, IllegalAccessException, InvocationTargetException - { - if (useProperties) { - BeanInfo info = Introspector.getBeanInfo(target.getClass()); + throws IntrospectionException, IllegalAccessException, InvocationTargetException { + if (useProperties) { + BeanInfo info = Introspector.getBeanInfo(target.getClass()); - PropertyDescriptor[] props = info.getPropertyDescriptors(); - for (int i = 0; i < props.length; ++i) { - PropertyDescriptor prop = props[i]; - String name = prop.getName(); - Method setter = prop.getWriteMethod(); - if (setter != null && !Modifier.isStatic(setter.getModifiers())) { - setter.invoke(target, source.get(name)); - } - } - } + PropertyDescriptor[] props = info.getPropertyDescriptors(); + for (int i = 0; i < props.length; ++i) { + PropertyDescriptor prop = props[i]; + String name = prop.getName(); + Method setter = prop.getWriteMethod(); + if (setter != null && !Modifier.isStatic(setter.getModifiers())) { + setter.invoke(target, source.get(name)); + } + } + } - Field[] ff = target.getClass().getDeclaredFields(); - for (int i = 0; i < ff.length; ++i) { - Field field = ff[i]; + Field[] ff = target.getClass().getDeclaredFields(); + for (int i = 0; i < ff.length; ++i) { + Field field = ff[i]; int fieldMod = field.getModifiers(); - if (Modifier.isPublic(fieldMod) && !(Modifier.isFinal(fieldMod) || - Modifier.isStatic(fieldMod))) - { - try { - field.set(target, source.get(field.getName())); - } catch (IllegalArgumentException iae) { - // no special error processing required + if (Modifier.isPublic(fieldMod) && !(Modifier.isFinal(fieldMod) || + Modifier.isStatic(fieldMod))) { + try { + field.set(target, source.get(field.getName())); + } catch (IllegalArgumentException iae) { + // no special error processing required } - } - } + } + } - return target; + return target; } /** @@ -90,14 +87,14 @@ public static Object fill(Object target, Map source, boolean use * source Map. */ public static void tryFill(Object target, Map source) { - try { - fill(target, source); - } catch (IntrospectionException ie) { - LOGGER.error("Error in tryFill", ie); - } catch (IllegalAccessException iae) { - LOGGER.error("Error in tryFill", iae); - } catch (InvocationTargetException ite) { - LOGGER.error("Error in tryFill", ite); - } + try { + fill(target, source); + } catch (IntrospectionException ie) { + LOGGER.error("Error in tryFill", ie); + } catch (IllegalAccessException iae) { + LOGGER.error("Error in tryFill", iae); + } catch (InvocationTargetException ite) { + LOGGER.error("Error in tryFill", ite); + } } } diff --git a/src/main/java/com/rabbitmq/tools/json/JSONWriter.java b/src/main/java/com/rabbitmq/tools/json/JSONWriter.java index 4a7f78c7f0..eb82cc7751 100644 --- a/src/main/java/com/rabbitmq/tools/json/JSONWriter.java +++ b/src/main/java/com/rabbitmq/tools/json/JSONWriter.java @@ -53,6 +53,10 @@ import java.util.Map; import java.util.Set; +/** + * Will be removed in 6.0 + * @deprecated Use a third-party JSON library, e.g. Jackson or GJSON + */ public class JSONWriter { private boolean indentMode = false; private int indentLevel = 0; diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java b/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java index c522d24767..db6cda0b6d 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java @@ -18,19 +18,27 @@ import com.rabbitmq.tools.json.JSONReader; import com.rabbitmq.tools.json.JSONWriter; -import java.lang.reflect.Method; import java.util.List; import java.util.Map; /** + * Simple {@link JsonRpcMapper} based on homegrown JSON utilities. + * Handles integers, doubles, strings, booleans, and arrays of those types. + *

+ * For a more comprehensive set of features, use {@link JacksonJsonRpcMapper}. + *

+ * Will be removed in 6.0 * + * @see JsonRpcMapper + * @see JacksonJsonRpcMapper + * @since 5.4.0 + * @deprecated use {@link JacksonJsonRpcMapper} instead */ public class DefaultJsonRpcMapper implements JsonRpcMapper { @Override public JsonRpcRequest parse(String requestBody, ServiceDescription description) { - Map request = (Map) new JSONReader().read(requestBody); - + Map request = (Map) new JSONReader().read(requestBody); return new JsonRpcRequest( request.get("id"), request.get("version").toString(), request.get("method").toString(), ((List) request.get("params")).toArray() @@ -52,40 +60,11 @@ public JsonRpcResponse parse(String responseBody, Class expectedType) { error ); } - return new JsonRpcResponse(map, map.get("result"), map.get("error"), exception); + return new JsonRpcResponse(map.get("result"), map.get("error"), exception); } @Override public String write(Object input) { return new JSONWriter().write(input); } - - /* - @Override - public Object[] parameters(JsonRpcRequest request, Method method) { - Object[] parameters = request.getParameters(); - Object[] convertedParameters = new Object[parameters.length]; - Class[] parameterTypes = method.getParameterTypes(); - for (int i = 0; i < parameters.length; i++) { - convertedParameters[i] = convert(parameters[i], parameterTypes[i]); - } - return convertedParameters; - } - - - - protected Object convert(Object input, Class expectedClass) { - return input; -// if (input == null || input.getClass().equals(expectedClass)) { -// return input; -// } -// System.err.println(input.getClass() + " " + expectedClass); -// if (Long.class.equals(expectedClass) && input instanceof Integer) { -// return Long.valueOf(((Integer) input).longValue()); -// } else if (long.class.equals(expectedClass) && input instanceof Integer) { -// return -// } -// return input; - } - */ } diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java index 0a19f53921..9cb5411b25 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java @@ -23,8 +23,8 @@ import com.fasterxml.jackson.databind.MappingJsonFactory; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ValueNode; -import com.rabbitmq.tools.json.JSONReader; -import com.rabbitmq.tools.json.JSONWriter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.lang.reflect.Method; @@ -33,10 +33,16 @@ import java.util.Map; /** + * {@link JsonRpcMapper} based on Jackson. + * Uses the streaming and databind modules. * + * @see JsonRpcMapper + * @since 5.4.0 */ public class JacksonJsonRpcMapper implements JsonRpcMapper { + private static final Logger LOGGER = LoggerFactory.getLogger(JacksonJsonRpcMapper.class); + private final ObjectMapper mapper; public JacksonJsonRpcMapper(ObjectMapper mapper) { @@ -62,7 +68,21 @@ public JsonRpcRequest parse(String requestBody, ServiceDescription description) if ("method".equals(name)) { method = parser.getValueAsString(); } else if ("id".equals(name)) { - // FIXME parse id, can be any type (handle only primitive and wrapper) + TreeNode node = parser.readValueAsTree(); + if (node instanceof ValueNode) { + ValueNode idNode = (ValueNode) node; + if (idNode.isNull()) { + id = null; + } else if (idNode.isTextual()) { + id = idNode.asText(); + } else if (idNode.isNumber()) { + id = Long.valueOf(idNode.asLong()); + } else { + LOGGER.warn("ID type not null, text, or number {}, ignoring", idNode); + } + } else { + LOGGER.warn("ID not a scalar value {}, ignoring", node); + } } else if ("version".equals(name)) { version = parser.getValueAsString(); } else if ("params".equals(name)) { @@ -80,6 +100,10 @@ public JsonRpcRequest parse(String requestBody, ServiceDescription description) throw new JsonRpcMappingException("Error during JSON parsing", e); } + if (method == null) { + throw new IllegalArgumentException("Could not find method to invoke in request"); + } + List convertedParameters = new ArrayList<>(parameters.size()); if (!parameters.isEmpty()) { ProcedureDescription proc = description.getProcedure(method, parameters.size()); @@ -102,69 +126,40 @@ public JsonRpcRequest parse(String requestBody, ServiceDescription description) ); } - protected Object convert(TreeNode node, Class expectedType) throws IOException { - Object value; - if (expectedType.isPrimitive()) { - ValueNode valueNode = (ValueNode) node; - if (expectedType == Boolean.TYPE) { - value = valueNode.booleanValue(); - } else if (expectedType == Character.TYPE) { - value = valueNode.textValue().charAt(0); - } else if (expectedType == Short.TYPE) { - value = valueNode.shortValue(); - } else if (expectedType == Integer.TYPE) { - value = valueNode.intValue(); - } else if (expectedType == Long.TYPE) { - value = valueNode.longValue(); - } else if (expectedType == Float.TYPE) { - value = valueNode.floatValue(); - } else if (expectedType == Double.TYPE) { - value = valueNode.doubleValue(); - } else { - throw new IllegalArgumentException("Primitive type not supported: " + expectedType); - } - } else { - value = mapper.readValue(node.traverse(), expectedType); - } - return value; - } - @Override public JsonRpcResponse parse(String responseBody, Class expectedReturnType) { JsonFactory jsonFactory = new MappingJsonFactory(); Object result = null; + JsonRpcException exception = null; + Map errorMap = null; try (JsonParser parser = jsonFactory.createParser(responseBody)) { while (parser.nextToken() != null) { JsonToken token = parser.currentToken(); if (token == JsonToken.FIELD_NAME) { String name = parser.currentName(); - parser.nextToken(); if ("result".equals(name)) { + parser.nextToken(); if (expectedReturnType == Void.TYPE) { result = null; } else { result = convert(parser.readValueAsTree(), expectedReturnType); } + } else if ("error".equals(name)) { + errorMap = (Map) convert(parser.readValueAsTree(), Map.class); + exception = new JsonRpcException( + errorMap.toString(), + (String) errorMap.get("name"), + errorMap.get("code") == null ? 0 : (Integer) errorMap.get("code"), + (String) errorMap.get("message"), + errorMap + ); } } } } catch (IOException e) { throw new JsonRpcMappingException("Error during JSON parsing", e); } - Map map = (Map) (new JSONReader().read(responseBody)); - Map error; - JsonRpcException exception = null; - if (map.containsKey("error")) { - error = (Map) map.get("error"); - exception = new JsonRpcException( - new JSONWriter().write(error), - (String) error.get("name"), - error.get("code") == null ? 0 : (Integer) error.get("code"), - (String) error.get("message"), - error - ); - } - return new JsonRpcResponse(map, result, map.get("error"), exception); + return new JsonRpcResponse(result, errorMap, exception); } @Override @@ -175,4 +170,31 @@ public String write(Object input) { throw new JsonRpcMappingException("Error during JSON serialization", e); } } + + protected Object convert(TreeNode node, Class expectedType) throws IOException { + Object value; + if (expectedType.isPrimitive()) { + ValueNode valueNode = (ValueNode) node; + if (expectedType == Boolean.TYPE) { + value = valueNode.booleanValue(); + } else if (expectedType == Character.TYPE) { + value = valueNode.textValue().charAt(0); + } else if (expectedType == Short.TYPE) { + value = valueNode.shortValue(); + } else if (expectedType == Integer.TYPE) { + value = valueNode.intValue(); + } else if (expectedType == Long.TYPE) { + value = valueNode.longValue(); + } else if (expectedType == Float.TYPE) { + value = valueNode.floatValue(); + } else if (expectedType == Double.TYPE) { + value = valueNode.doubleValue(); + } else { + throw new IllegalArgumentException("Primitive type not supported: " + expectedType); + } + } else { + value = mapper.readValue(node.traverse(), expectedType); + } + return value; + } } diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java index 12032941f3..f64b9f47f0 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java @@ -50,9 +50,14 @@ * code can access the service description by reading the * serviceDescription field of * JsonRpcClient instances. + *

+ * {@link JsonRpcClient} delegates JSON parsing and generating to + * a {@link JsonRpcMapper}. * * @see #call(String, Object[]) * @see #call(String[]) + * @see JsonRpcMapper + * @see JacksonJsonRpcMapper */ public class JsonRpcClient extends RpcClient implements InvocationHandler { diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java index 36f1ad72b2..fdad5e1960 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java @@ -16,14 +16,37 @@ package com.rabbitmq.tools.jsonrpc; /** + * Abstraction to handle JSON parsing and generation. + * Used by {@link JsonRpcServer} and {@link JsonRpcClient}. * + * @since 5.4.0 */ public interface JsonRpcMapper { + /** + * Parses a JSON RPC request. + * The {@link ServiceDescription} can be used + * to look up the invoked procedure and learn about + * its signature. + * @param requestBody + * @param description + * @return + */ JsonRpcRequest parse(String requestBody, ServiceDescription description); + /** + * Parses a JSON RPC response. + * @param responseBody + * @param expectedType + * @return + */ JsonRpcResponse parse(String responseBody, Class expectedType); + /** + * Serialize an object into JSON. + * @param input + * @return + */ String write(Object input); class JsonRpcRequest { @@ -67,22 +90,16 @@ public boolean isSystemDescribe() { class JsonRpcResponse { - private final Object reply; private final Object result; private final Object error; private final JsonRpcException exception; - public JsonRpcResponse(Object reply, Object result, Object error, JsonRpcException exception) { - this.reply = reply; + public JsonRpcResponse(Object result, Object error, JsonRpcException exception) { this.result = result; this.error = error; this.exception = exception; } - public Object getReply() { - return reply; - } - public Object getError() { return error; } diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMappingException.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMappingException.java index 633a1d79d7..03a7d12b91 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMappingException.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMappingException.java @@ -17,6 +17,7 @@ /** * + * @since 5.4.0 */ public class JsonRpcMappingException extends RuntimeException { diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java index 922fe35b1c..723664c3b5 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java @@ -13,55 +13,59 @@ // If you have any questions regarding licensing, please contact us at // info@rabbitmq.com. - package com.rabbitmq.tools.jsonrpc; +import com.rabbitmq.client.AMQP; +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.StringRpcServer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.IOException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; -import java.util.List; import java.util.Map; -import com.rabbitmq.client.AMQP; -import com.rabbitmq.client.Channel; -import com.rabbitmq.client.StringRpcServer; -import com.rabbitmq.tools.json.JSONReader; -import com.rabbitmq.tools.json.JSONWriter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - /** * JSON-RPC Server class. - * + *

* Given a Java {@link Class}, representing an interface, and an * implementation of that interface, JsonRpcServer will reflect on the * class to construct the {@link ServiceDescription}, and will route * incoming requests for methods on the interface to the * implementation object while the mainloop() is running. + *

+ * {@link JsonRpcServer} delegates JSON parsing and generating to + * a {@link JsonRpcMapper}. * * @see com.rabbitmq.client.RpcServer * @see JsonRpcClient + * @see JsonRpcMapper + * @see JacksonJsonRpcMapper */ public class JsonRpcServer extends StringRpcServer { private static final Logger LOGGER = LoggerFactory.getLogger(JsonRpcServer.class); - - /** Holds the JSON-RPC service description for this client. */ + private final JsonRpcMapper mapper; + /** + * Holds the JSON-RPC service description for this client. + */ public ServiceDescription serviceDescription; - /** The interface this server implements. */ + /** + * The interface this server implements. + */ public Class interfaceClass; - /** The instance backing this server. */ + /** + * The instance backing this server. + */ public Object interfaceInstance; - private final JsonRpcMapper mapper; - public JsonRpcServer(Channel channel, Class interfaceClass, Object interfaceInstance, JsonRpcMapper mapper) - throws IOException - { + throws IOException { super(channel); this.mapper = mapper; init(interfaceClass, interfaceInstance); @@ -71,32 +75,24 @@ public JsonRpcServer(Channel channel, * Construct a server that talks to the outside world using the * given channel, and constructs a fresh temporary * queue. Use getQueueName() to discover the created queue name. - * @param channel AMQP channel to use - * @param interfaceClass Java interface that this server is exposing to the world + * + * @param channel AMQP channel to use + * @param interfaceClass Java interface that this server is exposing to the world * @param interfaceInstance Java instance (of interfaceClass) that is being exposed * @throws IOException if something goes wrong during an AMQP operation */ public JsonRpcServer(Channel channel, - Class interfaceClass, - Object interfaceInstance) - throws IOException - { + Class interfaceClass, + Object interfaceInstance) + throws IOException { this(channel, interfaceClass, interfaceInstance, new DefaultJsonRpcMapper()); } - private void init(Class interfaceClass, Object interfaceInstance) - { - this.interfaceClass = interfaceClass; - this.interfaceInstance = interfaceInstance; - this.serviceDescription = new ServiceDescription(interfaceClass); - } - public JsonRpcServer(Channel channel, String queueName, Class interfaceClass, Object interfaceInstance, JsonRpcMapper mapper) - throws IOException - { + throws IOException { super(channel, queueName); this.mapper = mapper; init(interfaceClass, interfaceInstance); @@ -107,38 +103,43 @@ public JsonRpcServer(Channel channel, * given channel and queue name. Our superclass, * RpcServer, expects the queue to exist at the time of * construction. - * @param channel AMQP channel to use - * @param queueName AMQP queue name to listen for requests on - * @param interfaceClass Java interface that this server is exposing to the world + * + * @param channel AMQP channel to use + * @param queueName AMQP queue name to listen for requests on + * @param interfaceClass Java interface that this server is exposing to the world * @param interfaceInstance Java instance (of interfaceClass) that is being exposed * @throws IOException if something goes wrong during an AMQP operation */ public JsonRpcServer(Channel channel, - String queueName, - Class interfaceClass, - Object interfaceInstance) - throws IOException - { + String queueName, + Class interfaceClass, + Object interfaceInstance) + throws IOException { this(channel, queueName, interfaceClass, interfaceInstance, new DefaultJsonRpcMapper()); } + private void init(Class interfaceClass, Object interfaceInstance) { + this.interfaceClass = interfaceClass; + this.interfaceInstance = interfaceInstance; + this.serviceDescription = new ServiceDescription(interfaceClass); + } + /** * Override our superclass' method, dispatching to doCall. */ @Override - public String handleStringCall(String requestBody, AMQP.BasicProperties replyProperties) - { + public String handleStringCall(String requestBody, AMQP.BasicProperties replyProperties) { String replyBody = doCall(requestBody); return replyBody; } /** * Runs a single JSON-RPC request. + * * @param requestBody the JSON-RPC request string (a JSON encoded value) * @return a JSON-RPC response string (a JSON encoded value) */ - public String doCall(String requestBody) - { + public String doCall(String requestBody) { Object id; String method; Object[] params; @@ -188,7 +189,7 @@ public String doCall(String requestBody) } } catch (ClassCastException cce) { // Bogus request! - response = errorResponse(null, 400, "Bad Request", null); + response = errorResponse(null, 400, "Bad Request", null); } if (LOGGER.isDebugEnabled()) { @@ -200,13 +201,12 @@ public String doCall(String requestBody) /** * Retrieves the best matching method for the given method name and parameters. - * + *

* Subclasses may override this if they have specialised * dispatching requirements, so long as they continue to honour * their ServiceDescription. */ - public Method matchingMethod(String methodName, Object[] params) - { + public Method matchingMethod(String methodName, Object[] params) { ProcedureDescription proc = serviceDescription.getProcedure(methodName, params.length); return proc.internal_getMethod(); } diff --git a/src/test/java/com/rabbitmq/client/AbstractJsonRpcTest.java b/src/test/java/com/rabbitmq/client/AbstractJsonRpcTest.java index 555d4c0b24..079dcf00a7 100644 --- a/src/test/java/com/rabbitmq/client/AbstractJsonRpcTest.java +++ b/src/test/java/com/rabbitmq/client/AbstractJsonRpcTest.java @@ -21,12 +21,8 @@ import com.rabbitmq.tools.jsonrpc.JsonRpcServer; import org.junit.After; import org.junit.Before; -import org.junit.Test; -import java.lang.reflect.UndeclaredThrowableException; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import java.util.Date; public abstract class AbstractJsonRpcTest { @@ -105,6 +101,9 @@ public interface RpcService { void procedureException(); + void procedureNoArgumentVoid(); + + Date procedureDateDate(Date date); } public static class DefaultRpcservice implements RpcService { @@ -185,6 +184,16 @@ public String procedurePojoToString(Pojo pojo) { public void procedureException() { throw new RuntimeException(); } + + @Override + public void procedureNoArgumentVoid() { + + } + + @Override + public Date procedureDateDate(Date date) { + return date; + } } public static class Pojo { diff --git a/src/test/java/com/rabbitmq/client/JsonRpcTest.java b/src/test/java/com/rabbitmq/client/DefaultJsonRpcTest.java similarity index 96% rename from src/test/java/com/rabbitmq/client/JsonRpcTest.java rename to src/test/java/com/rabbitmq/client/DefaultJsonRpcTest.java index a4a18f9693..049554d1d2 100644 --- a/src/test/java/com/rabbitmq/client/JsonRpcTest.java +++ b/src/test/java/com/rabbitmq/client/DefaultJsonRpcTest.java @@ -16,7 +16,6 @@ package com.rabbitmq.client; import com.rabbitmq.tools.jsonrpc.DefaultJsonRpcMapper; -import com.rabbitmq.tools.jsonrpc.JacksonJsonRpcMapper; import com.rabbitmq.tools.jsonrpc.JsonRpcException; import com.rabbitmq.tools.jsonrpc.JsonRpcMapper; import org.junit.Test; @@ -28,7 +27,7 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -public class JsonRpcTest extends AbstractJsonRpcTest { +public class DefaultJsonRpcTest extends AbstractJsonRpcTest { @Override JsonRpcMapper createMapper() { @@ -44,6 +43,7 @@ public void rpc() { assertEquals(2, service.procedurePrimitiveInteger(1)); assertEquals(2, service.procedureDouble(1.0).intValue()); assertEquals(2, (int) service.procedurePrimitiveDouble(1.0)); + service.procedureNoArgumentVoid(); try { service.procedureException(); @@ -52,7 +52,6 @@ public void rpc() { assertTrue(e.getCause() instanceof JsonRpcException); } - try { assertEquals(2, (int) service.procedureLongToInteger(1L)); fail("Long argument isn't supported"); diff --git a/src/test/java/com/rabbitmq/client/JacksonRpcTest.java b/src/test/java/com/rabbitmq/client/JacksonJsonRpcTest.java similarity index 80% rename from src/test/java/com/rabbitmq/client/JacksonRpcTest.java rename to src/test/java/com/rabbitmq/client/JacksonJsonRpcTest.java index ba95efef98..6ccb2c4751 100644 --- a/src/test/java/com/rabbitmq/client/JacksonRpcTest.java +++ b/src/test/java/com/rabbitmq/client/JacksonJsonRpcTest.java @@ -21,13 +21,15 @@ import org.junit.Test; import java.lang.reflect.UndeclaredThrowableException; +import java.util.Calendar; +import java.util.Date; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -public class JacksonRpcTest extends AbstractJsonRpcTest { +public class JacksonJsonRpcTest extends AbstractJsonRpcTest { @Override JsonRpcMapper createMapper() { @@ -49,6 +51,19 @@ public void rpc() { assertEquals(2, service.procedurePrimitiveLong(1L)); assertEquals(2, service.procedureLong(1L).longValue()); assertEquals("123", service.procedureIntegerToPojo(123).getStringProperty()); + service.procedureNoArgumentVoid(); + + Calendar calendar = Calendar.getInstance(); + Date date = calendar.getTime(); + Date returnedDate = service.procedureDateDate(date); + assertEquals(date.getTime(), returnedDate.getTime()); + + try { + service.procedureException(); + fail("Remote procedure throwing exception, an exception should have been thrown"); + } catch (UndeclaredThrowableException e) { + assertTrue(e.getCause() instanceof JsonRpcException); + } Pojo pojo = new Pojo(); pojo.setStringProperty("hello"); diff --git a/src/test/java/com/rabbitmq/client/test/ClientTests.java b/src/test/java/com/rabbitmq/client/test/ClientTests.java index 1224dea66e..7655f43d13 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientTests.java +++ b/src/test/java/com/rabbitmq/client/test/ClientTests.java @@ -16,8 +16,8 @@ package com.rabbitmq.client.test; -import com.rabbitmq.client.JacksonRpcTest; -import com.rabbitmq.client.JsonRpcTest; +import com.rabbitmq.client.JacksonJsonRpcTest; +import com.rabbitmq.client.DefaultJsonRpcTest; import com.rabbitmq.utility.IntAllocatorTests; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -62,8 +62,8 @@ TestUtilsTest.class, StrictExceptionHandlerTest.class, NoAutoRecoveryWhenTcpWindowIsFullTest.class, - JsonRpcTest.class, - JacksonRpcTest.class, + DefaultJsonRpcTest.class, + JacksonJsonRpcTest.class, AddressTest.class, DefaultRetryHandlerTest.class, NioDeadlockOnConnectionClosing.class From 6fecb1cf7c003bbf93423e2735af185191cf5894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 14 Aug 2018 10:35:26 +0200 Subject: [PATCH 014/328] Polish JSON RPC support References #378 (cherry picked from commit d79a8b06d209e62d21c08e041d89c14261fc56f8) --- src/main/java/com/rabbitmq/tools/json/JSONReader.java | 2 +- .../java/com/rabbitmq/tools/json/JSONSerializable.java | 2 +- src/main/java/com/rabbitmq/tools/json/JSONWriter.java | 2 +- .../com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java | 2 ++ src/test/java/com/rabbitmq/client/JacksonJsonRpcTest.java | 7 ------- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/rabbitmq/tools/json/JSONReader.java b/src/main/java/com/rabbitmq/tools/json/JSONReader.java index fa4c43643d..14c690e6e2 100644 --- a/src/main/java/com/rabbitmq/tools/json/JSONReader.java +++ b/src/main/java/com/rabbitmq/tools/json/JSONReader.java @@ -47,7 +47,7 @@ /** * Will be removed in 6.0 * - * @deprecated Use a third-party JSON library, e.g. Jackson or GJSON + * @deprecated Use a third-party JSON library, e.g. Jackson or Gson */ public class JSONReader { diff --git a/src/main/java/com/rabbitmq/tools/json/JSONSerializable.java b/src/main/java/com/rabbitmq/tools/json/JSONSerializable.java index f453de5038..39f72d4ac2 100644 --- a/src/main/java/com/rabbitmq/tools/json/JSONSerializable.java +++ b/src/main/java/com/rabbitmq/tools/json/JSONSerializable.java @@ -21,7 +21,7 @@ * * Will be removed in 6.0 * - * @deprecated Use a third-party JSON library, e.g. Jackson or GJSON + * @deprecated Use a third-party JSON library, e.g. Jackson or Gson */ public interface JSONSerializable { /** diff --git a/src/main/java/com/rabbitmq/tools/json/JSONWriter.java b/src/main/java/com/rabbitmq/tools/json/JSONWriter.java index eb82cc7751..7101598040 100644 --- a/src/main/java/com/rabbitmq/tools/json/JSONWriter.java +++ b/src/main/java/com/rabbitmq/tools/json/JSONWriter.java @@ -55,7 +55,7 @@ /** * Will be removed in 6.0 - * @deprecated Use a third-party JSON library, e.g. Jackson or GJSON + * @deprecated Use a third-party JSON library, e.g. Jackson or Gson */ public class JSONWriter { private boolean indentMode = false; diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java b/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java index db6cda0b6d..b40789e380 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java @@ -38,6 +38,7 @@ public class DefaultJsonRpcMapper implements JsonRpcMapper { @Override public JsonRpcRequest parse(String requestBody, ServiceDescription description) { + @SuppressWarnings("unchecked") Map request = (Map) new JSONReader().read(requestBody); return new JsonRpcRequest( request.get("id"), request.get("version").toString(), request.get("method").toString(), @@ -47,6 +48,7 @@ public JsonRpcRequest parse(String requestBody, ServiceDescription description) @Override public JsonRpcResponse parse(String responseBody, Class expectedType) { + @SuppressWarnings("unchecked") Map map = (Map) (new JSONReader().read(responseBody)); Map error; JsonRpcException exception = null; diff --git a/src/test/java/com/rabbitmq/client/JacksonJsonRpcTest.java b/src/test/java/com/rabbitmq/client/JacksonJsonRpcTest.java index 6ccb2c4751..091ce44680 100644 --- a/src/test/java/com/rabbitmq/client/JacksonJsonRpcTest.java +++ b/src/test/java/com/rabbitmq/client/JacksonJsonRpcTest.java @@ -58,13 +58,6 @@ public void rpc() { Date returnedDate = service.procedureDateDate(date); assertEquals(date.getTime(), returnedDate.getTime()); - try { - service.procedureException(); - fail("Remote procedure throwing exception, an exception should have been thrown"); - } catch (UndeclaredThrowableException e) { - assertTrue(e.getCause() instanceof JsonRpcException); - } - Pojo pojo = new Pojo(); pojo.setStringProperty("hello"); assertEquals("hello", service.procedurePojoToString(pojo)); From de907f001ecce9460ba9d9997d4c56845b70c251 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 16 Aug 2018 11:03:25 +0200 Subject: [PATCH 015/328] Add equals and hashCode to generate classes Fixes #377 (cherry picked from commit 22ca4c8be29b0c235663db4c19291eacafe98f04) --- codegen.py | 48 +++++++ .../com/rabbitmq/client/test/ClientTests.java | 3 +- .../client/test/GeneratedClassesTest.java | 135 ++++++++++++++++++ 3 files changed, 185 insertions(+), 1 deletion(-) create mode 100644 src/test/java/com/rabbitmq/client/test/GeneratedClassesTest.java diff --git a/codegen.py b/codegen.py index 7ef06b4141..3a67ce435d 100755 --- a/codegen.py +++ b/codegen.py @@ -368,6 +368,9 @@ def printGetter(fieldType, fieldName): print(" public int getClassId() { return %i; }" % (c.index)) print(" public String getClassName() { return \"%s\"; }" % (c.name)) + if c.fields: + equalsHashCode(spec, c.fields, java_class_name(c.name), 'Properties', False) + printPropertiesBuilder(c) #accessor methods @@ -400,6 +403,49 @@ def printPropertiesClasses(): #-------------------------------------------------------------------------------- +def equalsHashCode(spec, fields, jClassName, classSuffix, usePrimitiveType): + print() + print() + print(" @Override") + print(" public boolean equals(Object o) {") + print(" if (this == o)") + print(" return true;") + print(" if (o == null || getClass() != o.getClass())") + print(" return false;") + print(" %s%s that = (%s%s) o;" % (jClassName, classSuffix, jClassName, classSuffix)) + + for f in fields: + (fType, fName) = (java_field_type(spec, f.domain), java_field_name(f.name)) + if usePrimitiveType and fType in javaScalarTypes: + print(" if (%s != that.%s)" % (fName, fName)) + else: + print(" if (%s != null ? !%s.equals(that.%s) : that.%s != null)" % (fName, fName, fName, fName)) + + print(" return false;") + + print(" return true;") + print(" }") + + print() + print(" @Override") + print(" public int hashCode() {") + print(" int result = 0;") + + for f in fields: + (fType, fName) = (java_field_type(spec, f.domain), java_field_name(f.name)) + if usePrimitiveType and fType in javaScalarTypes: + if fType == 'boolean': + print(" result = 31 * result + (%s ? 1 : 0);" % fName) + elif fType == 'long': + print(" result = 31 * result + (int) (%s ^ (%s >>> 32));" % (fName, fName)) + else: + print(" result = 31 * result + %s;" % fName) + else: + print(" result = 31 * result + (%s != null ? %s.hashCode() : 0);" % (fName, fName)) + + print(" return result;") + print(" }") + def genJavaImpl(spec): def printHeader(): printFileHeader() @@ -503,6 +549,8 @@ def write_arguments(): getters() constructors() others() + if m.arguments: + equalsHashCode(spec, m.arguments, java_class_name(m.name), '', True) argument_debug_string() write_arguments() diff --git a/src/test/java/com/rabbitmq/client/test/ClientTests.java b/src/test/java/com/rabbitmq/client/test/ClientTests.java index 7655f43d13..73a11f5af7 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientTests.java +++ b/src/test/java/com/rabbitmq/client/test/ClientTests.java @@ -66,7 +66,8 @@ JacksonJsonRpcTest.class, AddressTest.class, DefaultRetryHandlerTest.class, - NioDeadlockOnConnectionClosing.class + NioDeadlockOnConnectionClosing.class, + GeneratedClassesTest.class }) public class ClientTests { diff --git a/src/test/java/com/rabbitmq/client/test/GeneratedClassesTest.java b/src/test/java/com/rabbitmq/client/test/GeneratedClassesTest.java new file mode 100644 index 0000000000..e9dbcfca98 --- /dev/null +++ b/src/test/java/com/rabbitmq/client/test/GeneratedClassesTest.java @@ -0,0 +1,135 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.test; + +import com.rabbitmq.client.AMQP; +import com.rabbitmq.client.impl.AMQImpl; +import org.junit.Test; + +import java.util.Calendar; +import java.util.Date; + +import static java.util.Collections.singletonMap; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + +/** + * + */ +public class GeneratedClassesTest { + + @Test + public void amqpPropertiesEqualsHashCode() { + checkEquals( + new AMQP.BasicProperties.Builder().correlationId("one").build(), + new AMQP.BasicProperties.Builder().correlationId("one").build() + ); + checkNotEquals( + new AMQP.BasicProperties.Builder().correlationId("one").build(), + new AMQP.BasicProperties.Builder().correlationId("two").build() + ); + Date date = Calendar.getInstance().getTime(); + checkEquals( + new AMQP.BasicProperties.Builder() + .deliveryMode(1) + .headers(singletonMap("one", "two")) + .correlationId("123") + .expiration("later") + .priority(10) + .replyTo("me") + .contentType("text/plain") + .contentEncoding("UTF-8") + .userId("jdoe") + .appId("app1") + .clusterId("cluster1") + .messageId("message123") + .timestamp(date) + .type("type") + .build(), + new AMQP.BasicProperties.Builder() + .deliveryMode(1) + .headers(singletonMap("one", "two")) + .correlationId("123") + .expiration("later") + .priority(10) + .replyTo("me") + .contentType("text/plain") + .contentEncoding("UTF-8") + .userId("jdoe") + .appId("app1") + .clusterId("cluster1") + .messageId("message123") + .timestamp(date) + .type("type") + .build() + ); + checkNotEquals( + new AMQP.BasicProperties.Builder() + .deliveryMode(1) + .headers(singletonMap("one", "two")) + .correlationId("123") + .expiration("later") + .priority(10) + .replyTo("me") + .contentType("text/plain") + .contentEncoding("UTF-8") + .userId("jdoe") + .appId("app1") + .clusterId("cluster1") + .messageId("message123") + .timestamp(date) + .type("type") + .build(), + new AMQP.BasicProperties.Builder() + .deliveryMode(2) + .headers(singletonMap("one", "two")) + .correlationId("123") + .expiration("later") + .priority(10) + .replyTo("me") + .contentType("text/plain") + .contentEncoding("UTF-8") + .userId("jdoe") + .appId("app1") + .clusterId("cluster1") + .messageId("message123") + .timestamp(date) + .type("type") + .build() + ); + + } + + @Test public void amqImplEqualsHashCode() { + checkEquals( + new AMQImpl.Basic.Deliver("tag", 1L, false, "amq.direct","rk"), + new AMQImpl.Basic.Deliver("tag", 1L, false, "amq.direct","rk") + ); + checkNotEquals( + new AMQImpl.Basic.Deliver("tag", 1L, false, "amq.direct","rk"), + new AMQImpl.Basic.Deliver("tag", 2L, false, "amq.direct","rk") + ); + } + + private void checkEquals(Object o1, Object o2) { + assertEquals(o1, o2); + assertEquals(o1.hashCode(), o2.hashCode()); + } + + private void checkNotEquals(Object o1, Object o2) { + assertNotEquals(o1, o2); + } +} From e4b93e7016a88eb2df7148ea9c155cc9a92ddef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 17 Aug 2018 09:45:11 +0200 Subject: [PATCH 016/328] Set release version to 5.4.0.RC1 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index 5a62e85797..3b0c3ec1b0 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,2 +1,2 @@ -RELEASE_VERSION="5.4.0.M1" +RELEASE_VERSION="5.4.0.RC1" DEVELOPMENT_VERSION="5.4.0-SNAPSHOT" From 99b68a06d589883fb6ceaabba5da3c2df5f212cc Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 17 Aug 2018 07:52:32 +0000 Subject: [PATCH 017/328] [maven-release-plugin] prepare release v5.4.0.RC1 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 7104624064..890b70584f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.4.0-SNAPSHOT + 5.4.0.RC1 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.4.0.RC1 From 393704579ec12f84f1a104aea7181892841e8e9d Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 17 Aug 2018 07:52:37 +0000 Subject: [PATCH 018/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 890b70584f..7104624064 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.4.0.RC1 + 5.4.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.4.0.RC1 + HEAD From d4d3561e28d655919315cea93f1bb9f1f624cbfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 17 Aug 2018 09:58:13 +0200 Subject: [PATCH 019/328] Set release version to 5.4.0.RC2 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index 3b0c3ec1b0..56eb83cff6 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,2 +1,2 @@ -RELEASE_VERSION="5.4.0.RC1" +RELEASE_VERSION="5.4.0.RC2" DEVELOPMENT_VERSION="5.4.0-SNAPSHOT" From 3f079cf54c6960d759c32e0859760a5a7900adfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 17 Aug 2018 10:38:31 +0200 Subject: [PATCH 020/328] Deprecate methods in JSON RPC support References #378, #391 --- .../rabbitmq/tools/jsonrpc/JsonRpcClient.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java index f64b9f47f0..913cdc34b8 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java @@ -55,7 +55,6 @@ * a {@link JsonRpcMapper}. * * @see #call(String, Object[]) - * @see #call(String[]) * @see JsonRpcMapper * @see JacksonJsonRpcMapper */ @@ -102,7 +101,15 @@ public JsonRpcClient(Channel channel, String exchange, String routingKey) /** * Private API - used by {@link #call(String[])} to ad-hoc convert * strings into the required data types for a call. + * + * This method is deprecated because it uses homegrown JSON utilities + * that don't deal correctly with complex types. The {@link JacksonJsonRpcMapper} + * has been introduced to handle primitive and complex types, as well + * as primitive wrappers correctly. + * + * @deprecated This method will be removed in the next major version */ + @Deprecated public static Object coerce(String val, String type) throws NumberFormatException { if ("bit".equals(type)) { @@ -204,12 +211,19 @@ public T createProxy(Class klass) * passed through coerce() to attempt to make them the types the * server is expecting. * + * This method is deprecated because it uses homegrown JSON utilities + * that don't deal correctly with complex types. The {@link JacksonJsonRpcMapper} + * has been introduced to handle primitive and complex types, as well + * as primitive wrappers correctly. + * * @return the result contained within the reply, if no exception is found * @throws JsonRpcException if the reply object contained an exception * @throws NumberFormatException if a coercion failed * @throws TimeoutException if a response is not received within the timeout specified, if any * @see #coerce + * @deprecated This method will be removed in the next major version */ + @Deprecated public Object call(String[] args) throws NumberFormatException, IOException, JsonRpcException, TimeoutException { if (args.length == 0) { From d3f47373b8ef259c82a6be26c4845d999d4e12a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 21 Aug 2018 09:38:07 +0200 Subject: [PATCH 021/328] Reduce number of queues in topology recovery retry test To mitigate test failure in CI environment. (cherry picked from commit d20e9a0cb933f355cfbb33da713f4f849dfb85b6) --- .../rabbitmq/client/test/functional/TopologyRecoveryRetry.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java index 71277c9826..273ebe1544 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java +++ b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java @@ -34,7 +34,7 @@ public class TopologyRecoveryRetry extends BrokerTestCase { @Test public void topologyRecoveryRetry() throws Exception { - int nbQueues = 2000; + int nbQueues = 200; String prefix = "topology-recovery-retry-" + System.currentTimeMillis(); for (int i = 0; i < nbQueues; i++) { String queue = prefix + i; From 5394d209f2d5f4a20ffc36e15b9bc58612f18a5d Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Fri, 17 Aug 2018 15:36:35 +0300 Subject: [PATCH 022/328] Stronger language around ConnectionFactory methods that enable TLS with a permissive TrustManager Make it clear which methods are offered for convenience in development environments. (cherry picked from commit 149b6c7cb598146e03458197cb03d4a7659d517c) --- .../rabbitmq/client/ConnectionFactory.java | 48 ++++++++++++------- .../client/TrustEverythingTrustManager.java | 12 +++-- 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index 0816abdde3..279a015af7 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -653,12 +653,14 @@ public boolean isSSL(){ } /** - * Convenience method for setting up a SSL socket factory/engine, using - * the DEFAULT_SSL_PROTOCOL and a trusting TrustManager. - * Note the trust manager will trust every server certificate presented + * Convenience method for configuring TLS using + * the default set of TLS protocols and a trusting TrustManager. + * This setup is only suitable for development + * and QA environments. + * The trust manager will trust every server certificate presented * to it, this is convenient for local development but - * not recommended to use in production as it provides no protection - * against man-in-the-middle attacks. + * not recommended to use in production as it provides no protection + * against man-in-the-middle attacks. Prefer {@link #useSslProtocol(SSLContext)}. */ public void useSslProtocol() throws NoSuchAlgorithmException, KeyManagementException @@ -667,15 +669,19 @@ public void useSslProtocol() } /** - * Convenience method for setting up a SSL socket factory/engine, using - * the supplied protocol and a very trusting TrustManager. - * Note the trust manager will trust every server certificate presented + * Convenience method for configuring TLS using + * the supplied protocol and a very trusting TrustManager. This setup is only suitable for development + * and QA environments. + * The trust manager will trust every server certificate presented * to it, this is convenient for local development but - * not recommended to use in production as it provides no protection - * against man-in-the-middle attacks. + * not recommended to use in production as it provides no protection + * against man-in-the-middle attacks. + * + * Use {@link #useSslProtocol(SSLContext)} in production environments. * The produced {@link SSLContext} instance will be shared by all - * the connections created by this connection factory. Use - * {@link #setSslContextFactory(SslContextFactory)} for more flexibility. + * the connections created by this connection factory. + * + * Use {@link #setSslContextFactory(SslContextFactory)} for more flexibility. * @see #setSslContextFactory(SslContextFactory) */ public void useSslProtocol(String protocol) @@ -685,13 +691,18 @@ public void useSslProtocol(String protocol) } /** - * Convenience method for setting up an SSL socket factory/engine. - * Pass in the SSL protocol to use, e.g. "TLSv1" or "TLSv1.2". + * Convenience method for configuring TLS. + * Pass in the TLS protocol version to use, e.g. "TLSv1.2" or "TLSv1.1", and + * a desired {@link TrustManager}. + * + * * The produced {@link SSLContext} instance will be shared with all * the connections created by this connection factory. Use * {@link #setSslContextFactory(SslContextFactory)} for more flexibility. - * @param protocol SSL protocol to use. + * @param protocol the TLS protocol to use. + * @param trustManager the {@link TrustManager} implementation to use. * @see #setSslContextFactory(SslContextFactory) + * @see #useSslProtocol(SSLContext) */ public void useSslProtocol(String protocol, TrustManager trustManager) throws NoSuchAlgorithmException, KeyManagementException @@ -702,8 +713,11 @@ public void useSslProtocol(String protocol, TrustManager trustManager) } /** - * Convenience method for setting up an SSL socket socketFactory/engine. - * Pass in an initialized SSLContext. + * Sets up TLS with an initialized {@link SSLContext}. The caller is responsible + * for setting up the context with a {@link TrustManager} with suitable security guarantees, + * e.g. peer verification. + * + * * The {@link SSLContext} instance will be shared with all * the connections created by this connection factory. Use * {@link #setSslContextFactory(SslContextFactory)} for more flexibility. diff --git a/src/main/java/com/rabbitmq/client/TrustEverythingTrustManager.java b/src/main/java/com/rabbitmq/client/TrustEverythingTrustManager.java index d4f7e5dae6..7893eb7e16 100644 --- a/src/main/java/com/rabbitmq/client/TrustEverythingTrustManager.java +++ b/src/main/java/com/rabbitmq/client/TrustEverythingTrustManager.java @@ -22,16 +22,18 @@ import java.security.cert.X509Certificate; /** - * Convenience class providing a default implementation of javax.net.ssl.X509TrustManager. - * Trusts every single certificate presented to it. + * Convenience class providing a default implementation of {@link javax.net.ssl.X509TrustManager}. + * Trusts every single certificate presented to it. This implementation does not perform peer + * verification and provides no protection against Man-in-the-Middle (MITM) attacks and therefore + * only suitable for some development and QA environments. */ public class TrustEverythingTrustManager implements X509TrustManager { public TrustEverythingTrustManager() { LoggerFactory.getLogger(TrustEverythingTrustManager.class).warn( - "This trust manager trusts every certificate, effectively disabling peer verification. " + - "This is convenient for local development but prone to man-in-the-middle attacks. " + - "Please see http://www.rabbitmq.com/ssl.html#validating-cerficates to learn more about peer certificate validation." + "SECURITY ALERT: this trust manager trusts every certificate, effectively disabling peer verification. " + + "This is convenient for local development but offers no protection against man-in-the-middle attacks. " + + "Please see https://www.rabbitmq.com/ssl.html#validating-cerficates to learn more about peer certificate verification." ); } From 64611e7978e1f6f96fea14f949b953bae4ac74bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 24 Aug 2018 12:03:52 +0200 Subject: [PATCH 023/328] Update Mockito to run on Java 11 (cherry picked from commit dc3454f32c29b29ebdc663ccc91f4f23b82c777b) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7104624064..19350b6ff6 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 1.1 4.12 3.1.0 - 2.16.0 + 2.21.0 3.0.0 2.5.3 From 09a5334fa2bbf95b0b45306d36b176ea1455a02d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 20 Aug 2018 17:50:32 +0200 Subject: [PATCH 024/328] Add opt-in to enable server hostname verification Hostname verification isn't performed by default in the TLS handshake, this commit makes it easier to enable server hostname verification for both blocking and non-blocking IO modes. References #394 (cherry picked from commit fcc3dbb5f797e7e340b6ddc5c2faa2fc77a1c905) --- .../rabbitmq/client/ConnectionFactory.java | 52 +++++- .../client/SocketChannelConfigurator.java | 16 ++ .../client/SocketChannelConfigurators.java | 111 +++++++++++++ .../rabbitmq/client/SocketConfigurator.java | 20 +++ .../rabbitmq/client/SocketConfigurators.java | 153 ++++++++++++++++++ .../client/SslEngineConfigurator.java | 16 ++ .../client/SslEngineConfigurators.java | 116 +++++++++++++ .../rabbitmq/client/impl/nio/NioParams.java | 23 ++- .../ChannelRpcTimeoutIntegrationTest.java | 2 +- .../test/functional/UnexpectedFrames.java | 3 +- .../client/test/ssl/HostnameVerification.java | 104 ++++++++++++ .../test/ssl/NioTlsUnverifiedConnection.java | 7 +- .../rabbitmq/client/test/ssl/SSLTests.java | 3 +- .../client/test/ssl/UnverifiedConnection.java | 2 +- .../client/test/ssl/VerifiedConnection.java | 2 +- 15 files changed, 610 insertions(+), 20 deletions(-) create mode 100644 src/main/java/com/rabbitmq/client/SocketChannelConfigurators.java create mode 100644 src/main/java/com/rabbitmq/client/SocketConfigurators.java create mode 100644 src/main/java/com/rabbitmq/client/SslEngineConfigurators.java create mode 100644 src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index 279a015af7..e9af65a6b5 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -15,8 +15,6 @@ package com.rabbitmq.client; -import static java.util.concurrent.TimeUnit.*; - import com.rabbitmq.client.impl.AMQConnection; import com.rabbitmq.client.impl.ConnectionParams; import com.rabbitmq.client.impl.CredentialsProvider; @@ -32,6 +30,10 @@ import com.rabbitmq.client.impl.recovery.RetryHandler; import com.rabbitmq.client.impl.recovery.TopologyRecoveryFilter; +import javax.net.SocketFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; @@ -50,10 +52,8 @@ import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeoutException; import java.util.function.Predicate; -import javax.net.SocketFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSocketFactory; -import javax.net.ssl.TrustManager; + +import static java.util.concurrent.TimeUnit.MINUTES; /** * Convenience factory class to facilitate opening a {@link Connection} to a RabbitMQ node. @@ -132,7 +132,7 @@ public class ConnectionFactory implements Cloneable { // connections uses, see rabbitmq/rabbitmq-java-client#86 private ExecutorService shutdownExecutor; private ScheduledExecutorService heartbeatExecutor; - private SocketConfigurator socketConf = new DefaultSocketConfigurator(); + private SocketConfigurator socketConf = SocketConfigurators.defaultConfigurator(); private ExceptionHandler exceptionHandler = new DefaultExceptionHandler(); private CredentialsProvider credentialsProvider = new DefaultCredentialsProvider(DEFAULT_USER, DEFAULT_PASS); @@ -729,6 +729,44 @@ public void useSslProtocol(SSLContext context) { setSocketFactory(context.getSocketFactory()); } + /** + * Enable server hostname verification for TLS connections. + *

+ * This enables hostname verification regardless of the IO mode + * used (blocking or non-blocking IO). + *

+ * This can be called typically after setting the {@link SSLContext} + * with one of the useSslProtocol methods. + * + * @see NioParams#enableHostnameVerification() + * @see NioParams#setSslEngineConfigurator(SslEngineConfigurator) + * @see SslEngineConfigurators#ENABLE_HOSTNAME_VERIFICATION + * @see SocketConfigurators#ENABLE_HOSTNAME_VERIFICATION + * @see ConnectionFactory#useSslProtocol(String) + * @see ConnectionFactory#useSslProtocol(SSLContext) + * @see ConnectionFactory#useSslProtocol() + * @see ConnectionFactory#useSslProtocol(String, TrustManager) + */ + public void enableHostnameVerification() { + enableHostnameVerificationForNio(); + enableHostnameVerificationForBlockingIo(); + } + + protected void enableHostnameVerificationForNio() { + if (this.nioParams == null) { + this.nioParams = new NioParams(); + } + this.nioParams = this.nioParams.enableHostnameVerification(); + } + + protected void enableHostnameVerificationForBlockingIo() { + if (this.socketConf == null) { + this.socketConf = SocketConfigurators.builder().defaultConfigurator().enableHostnameVerification().build(); + } else { + this.socketConf = this.socketConf.andThen(SocketConfigurators.enableHostnameVerification()); + } + } + public static String computeDefaultTlsProcotol(String[] supportedProtocols) { if(supportedProtocols != null) { for (String supportedProtocol : supportedProtocols) { diff --git a/src/main/java/com/rabbitmq/client/SocketChannelConfigurator.java b/src/main/java/com/rabbitmq/client/SocketChannelConfigurator.java index 5aded698f9..ceb3a95a88 100644 --- a/src/main/java/com/rabbitmq/client/SocketChannelConfigurator.java +++ b/src/main/java/com/rabbitmq/client/SocketChannelConfigurator.java @@ -17,7 +17,9 @@ import java.io.IOException; import java.nio.channels.SocketChannel; +import java.util.Objects; +@FunctionalInterface public interface SocketChannelConfigurator { /** @@ -26,4 +28,18 @@ public interface SocketChannelConfigurator { */ void configure(SocketChannel socketChannel) throws IOException; + /** + * Returns a composed configurator that performs, in sequence, this + * operation followed by the {@code after} operation. + * + * @param after the operation to perform after this operation + * @return a composed configurator that performs in sequence this + * operation followed by the {@code after} operation + * @throws NullPointerException if {@code after} is null + */ + default SocketChannelConfigurator andThen(SocketChannelConfigurator after) { + Objects.requireNonNull(after); + return t -> { configure(t); after.configure(t); }; + } + } diff --git a/src/main/java/com/rabbitmq/client/SocketChannelConfigurators.java b/src/main/java/com/rabbitmq/client/SocketChannelConfigurators.java new file mode 100644 index 0000000000..d6af09d7de --- /dev/null +++ b/src/main/java/com/rabbitmq/client/SocketChannelConfigurators.java @@ -0,0 +1,111 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client; + +/** + * Ready-to-use instances and builder for {@link SocketChannelConfigurator}. + *

+ * Note {@link SocketChannelConfigurator}s can be combined with + * {@link SocketChannelConfigurator#andThen(SocketChannelConfigurator)}. + * + * @since 5.5.0 + */ +public abstract class SocketChannelConfigurators { + + /** + * Disable Nagle's algorithm. + */ + public static final SocketChannelConfigurator DISABLE_NAGLE_ALGORITHM = + socketChannel -> SocketConfigurators.DISABLE_NAGLE_ALGORITHM.configure(socketChannel.socket()); + + /** + * Default {@link SocketChannelConfigurator} that disables Nagle's algorithm. + */ + public static final SocketChannelConfigurator DEFAULT = DISABLE_NAGLE_ALGORITHM; + + /** + * The default {@link SocketChannelConfigurator} that disables Nagle's algorithm. + * + * @return + */ + public static SocketChannelConfigurator defaultConfigurator() { + return DEFAULT; + } + + /** + * {@link SocketChannelConfigurator} that disables Nagle's algorithm. + * + * @return + */ + public static SocketChannelConfigurator disableNagleAlgorithm() { + return DISABLE_NAGLE_ALGORITHM; + } + + /** + * Builder to configure and creates a {@link SocketChannelConfigurator} instance. + * + * @return + */ + public static SocketChannelConfigurators.Builder builder() { + return new SocketChannelConfigurators.Builder(); + } + + public static class Builder { + + private SocketChannelConfigurator configurator = channel -> { + }; + + /** + * Set default configuration. + * + * @return + */ + public Builder defaultConfigurator() { + configurator = configurator.andThen(DEFAULT); + return this; + } + + /** + * Disable Nagle's Algorithm. + * + * @return + */ + public Builder disableNagleAlgorithm() { + configurator = configurator.andThen(DISABLE_NAGLE_ALGORITHM); + return this; + } + + /** + * Add an extra configuration step. + * + * @param extraConfiguration + * @return + */ + public Builder add(SocketChannelConfigurator extraConfiguration) { + configurator = configurator.andThen(extraConfiguration); + return this; + } + + /** + * Return the configured {@link SocketConfigurator}. + * + * @return + */ + public SocketChannelConfigurator build() { + return configurator; + } + } +} diff --git a/src/main/java/com/rabbitmq/client/SocketConfigurator.java b/src/main/java/com/rabbitmq/client/SocketConfigurator.java index 8896baf3e5..30c9ed4bab 100644 --- a/src/main/java/com/rabbitmq/client/SocketConfigurator.java +++ b/src/main/java/com/rabbitmq/client/SocketConfigurator.java @@ -17,11 +17,31 @@ import java.io.IOException; import java.net.Socket; +import java.util.Objects; +@FunctionalInterface public interface SocketConfigurator { + /** * Provides a hook to insert custom configuration of the sockets * used to connect to an AMQP server before they connect. */ void configure(Socket socket) throws IOException; + + /** + * Returns a composed configurator that performs, in sequence, this + * operation followed by the {@code after} operation. + * + * @param after the operation to perform after this operation + * @return a composed configurator that performs in sequence this + * operation followed by the {@code after} operation + * @throws NullPointerException if {@code after} is null + */ + default SocketConfigurator andThen(SocketConfigurator after) { + Objects.requireNonNull(after); + return t -> { + configure(t); + after.configure(t); + }; + } } diff --git a/src/main/java/com/rabbitmq/client/SocketConfigurators.java b/src/main/java/com/rabbitmq/client/SocketConfigurators.java new file mode 100644 index 0000000000..127bddeb34 --- /dev/null +++ b/src/main/java/com/rabbitmq/client/SocketConfigurators.java @@ -0,0 +1,153 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client; + +import javax.net.ssl.SSLParameters; +import javax.net.ssl.SSLSocket; + +/** + * Ready-to-use instances and builder for {@link SocketConfigurator}. + *

+ * Note {@link SocketConfigurator}s can be combined with + * {@link SocketConfigurator#andThen(SocketConfigurator)}. + * + * @since 5.5.0 + */ +public abstract class SocketConfigurators { + + /** + * Disable Nagle's algorithm. + */ + public static final SocketConfigurator DISABLE_NAGLE_ALGORITHM = socket -> socket.setTcpNoDelay(true); + + /** + * Default {@link SocketConfigurator} that disables Nagle's algorithm. + */ + public static final SocketConfigurator DEFAULT = DISABLE_NAGLE_ALGORITHM; + + /** + * Enable server hostname validation for TLS connections. + */ + public static final SocketConfigurator ENABLE_HOSTNAME_VERIFICATION = socket -> { + if (socket instanceof SSLSocket) { + SSLSocket sslSocket = (SSLSocket) socket; + SSLParameters sslParameters = enableHostnameVerification(sslSocket.getSSLParameters()); + sslSocket.setSSLParameters(sslParameters); + } + }; + + static final SSLParameters enableHostnameVerification(SSLParameters sslParameters) { + if (sslParameters == null) { + sslParameters = new SSLParameters(); + } + // It says HTTPS but works also for any TCP connection. + // It checks SAN (Subject Alternative Name) as well as CN. + sslParameters.setEndpointIdentificationAlgorithm("HTTPS"); + return sslParameters; + } + + /** + * The default {@link SocketConfigurator} that disables Nagle's algorithm. + * + * @return + */ + public static SocketConfigurator defaultConfigurator() { + return DEFAULT; + } + + /** + * {@link SocketConfigurator} that disables Nagle's algorithm. + * + * @return + */ + public static SocketConfigurator disableNagleAlgorithm() { + return DISABLE_NAGLE_ALGORITHM; + } + + /** + * {@link SocketConfigurator} that enable server hostname verification for TLS connections. + * + * @return + */ + public static SocketConfigurator enableHostnameVerification() { + return ENABLE_HOSTNAME_VERIFICATION; + } + + /** + * Builder to configure and creates a {@link SocketConfigurator} instance. + * + * @return + */ + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + + private SocketConfigurator configurator = socket -> { + }; + + /** + * Set default configuration. + * + * @return + */ + public Builder defaultConfigurator() { + configurator = configurator.andThen(DEFAULT); + return this; + } + + /** + * Disable Nagle's Algorithm. + * + * @return + */ + public Builder disableNagleAlgorithm() { + configurator = configurator.andThen(DISABLE_NAGLE_ALGORITHM); + return this; + } + + /** + * Enable server hostname verification for TLS connections. + * + * @return + */ + public Builder enableHostnameVerification() { + configurator = configurator.andThen(ENABLE_HOSTNAME_VERIFICATION); + return this; + } + + /** + * Add an extra configuration step. + * + * @param extraConfiguration + * @return + */ + public Builder add(SocketConfigurator extraConfiguration) { + configurator = configurator.andThen(extraConfiguration); + return this; + } + + /** + * Return the configured {@link SocketConfigurator}. + * + * @return + */ + public SocketConfigurator build() { + return configurator; + } + } +} diff --git a/src/main/java/com/rabbitmq/client/SslEngineConfigurator.java b/src/main/java/com/rabbitmq/client/SslEngineConfigurator.java index 7986d4b9d2..01b22c4c05 100644 --- a/src/main/java/com/rabbitmq/client/SslEngineConfigurator.java +++ b/src/main/java/com/rabbitmq/client/SslEngineConfigurator.java @@ -17,7 +17,9 @@ import javax.net.ssl.SSLEngine; import java.io.IOException; +import java.util.Objects; +@FunctionalInterface public interface SslEngineConfigurator { /** @@ -27,4 +29,18 @@ public interface SslEngineConfigurator { */ void configure(SSLEngine sslEngine) throws IOException; + /** + * Returns a composed configurator that performs, in sequence, this + * operation followed by the {@code after} operation. + * + * @param after the operation to perform after this operation + * @return a composed configurator that performs in sequence this + * operation followed by the {@code after} operation + * @throws NullPointerException if {@code after} is null + */ + default SslEngineConfigurator andThen(SslEngineConfigurator after) { + Objects.requireNonNull(after); + return t -> { configure(t); after.configure(t); }; + } + } diff --git a/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java b/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java new file mode 100644 index 0000000000..d84dfa304f --- /dev/null +++ b/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java @@ -0,0 +1,116 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client; + +import javax.net.ssl.SSLParameters; + +/** + * Ready-to-use instances and builder for {@link SslEngineConfigurator}s. + *

+ * Note {@link SslEngineConfigurator}s can be combined with + * {@link SslEngineConfigurator#andThen(SslEngineConfigurator)}. + * + * @since 5.5.0 + */ +public abstract class SslEngineConfigurators { + + /** + * Default {@link SslEngineConfigurator}, does nothing. + */ + public static SslEngineConfigurator DEFAULT = sslEngine -> { + }; + + /** + * {@link SslEngineConfigurator} that enables server hostname verification. + */ + public static SslEngineConfigurator ENABLE_HOSTNAME_VERIFICATION = sslEngine -> { + SSLParameters sslParameters = SocketConfigurators.enableHostnameVerification(sslEngine.getSSLParameters()); + sslEngine.setSSLParameters(sslParameters); + }; + + /** + * Default {@link SslEngineConfigurator}, does nothing. + * + * @return + */ + public static SslEngineConfigurator defaultConfigurator() { + return DEFAULT; + } + + /** + * {@link SslEngineConfigurator} that enables server hostname verification. + * + * @return + */ + public static SslEngineConfigurator enableHostnameVerification() { + return ENABLE_HOSTNAME_VERIFICATION; + } + + /** + * Builder to configure and creates a {@link SslEngineConfigurator} instance. + * + * @return + */ + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + + private SslEngineConfigurator configurator = channel -> { + }; + + /** + * Set default configuration (no op). + * + * @return + */ + public Builder defaultConfigurator() { + configurator = configurator.andThen(DEFAULT); + return this; + } + + /** + * Enables server hostname verification. + * + * @return + */ + public Builder enableHostnameVerification() { + configurator = configurator.andThen(ENABLE_HOSTNAME_VERIFICATION); + return this; + } + + /** + * Add extra configuration step. + * + * @param extraConfiguration + * @return + */ + public Builder add(SslEngineConfigurator extraConfiguration) { + configurator = configurator.andThen(extraConfiguration); + return this; + } + + /** + * Return the configured {@link SslEngineConfigurator}. + * + * @return + */ + public SslEngineConfigurator build() { + return configurator; + } + } +} diff --git a/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java b/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java index 9f9da61795..80b8624447 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java @@ -15,14 +15,16 @@ package com.rabbitmq.client.impl.nio; -import com.rabbitmq.client.DefaultSocketChannelConfigurator; import com.rabbitmq.client.SocketChannelConfigurator; +import com.rabbitmq.client.SocketChannelConfigurators; import com.rabbitmq.client.SslEngineConfigurator; import javax.net.ssl.SSLEngine; import java.util.concurrent.ExecutorService; import java.util.concurrent.ThreadFactory; +import static com.rabbitmq.client.SslEngineConfigurators.ENABLE_HOSTNAME_VERIFICATION; + /** * Parameters used to configure the NIO mode of a {@link com.rabbitmq.client.ConnectionFactory}. * @@ -68,7 +70,7 @@ public class NioParams { /** * the hook to configure the socket channel before it's open */ - private SocketChannelConfigurator socketChannelConfigurator = new DefaultSocketChannelConfigurator(); + private SocketChannelConfigurator socketChannelConfigurator = SocketChannelConfigurators.defaultConfigurator(); /** * the hook to configure the SSL engine before the connection is open @@ -94,10 +96,27 @@ public NioParams(NioParams nioParams) { setWriteQueueCapacity(nioParams.getWriteQueueCapacity()); setNioExecutor(nioParams.getNioExecutor()); setThreadFactory(nioParams.getThreadFactory()); + setSocketChannelConfigurator(nioParams.getSocketChannelConfigurator()); setSslEngineConfigurator(nioParams.getSslEngineConfigurator()); setConnectionShutdownExecutor(nioParams.getConnectionShutdownExecutor()); } + /** + * Enable server hostname verification for TLS connections. + * + * @return this {@link NioParams} instance + * @see NioParams#setSslEngineConfigurator(SslEngineConfigurator) + * @see com.rabbitmq.client.SslEngineConfigurators#ENABLE_HOSTNAME_VERIFICATION + */ + public NioParams enableHostnameVerification() { + if (this.sslEngineConfigurator == null) { + this.sslEngineConfigurator = ENABLE_HOSTNAME_VERIFICATION; + } else { + this.sslEngineConfigurator = this.sslEngineConfigurator.andThen(ENABLE_HOSTNAME_VERIFICATION); + } + return this; + } + public int getReadByteBufferSize() { return readByteBufferSize; } diff --git a/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java b/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java index 40d6a0ab5a..f880f617da 100644 --- a/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java +++ b/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java @@ -84,7 +84,7 @@ public void tearDown() throws Exception { private FrameHandler createFrameHandler() throws IOException { SocketFrameHandlerFactory socketFrameHandlerFactory = new SocketFrameHandlerFactory(ConnectionFactory.DEFAULT_CONNECTION_TIMEOUT, - SocketFactory.getDefault(), new DefaultSocketConfigurator(), false, null); + SocketFactory.getDefault(), SocketConfigurators.defaultConfigurator(), false, null); return socketFrameHandlerFactory.create(new Address("localhost"), null); } diff --git a/src/test/java/com/rabbitmq/client/test/functional/UnexpectedFrames.java b/src/test/java/com/rabbitmq/client/test/functional/UnexpectedFrames.java index 0ab8013969..698d8a8952 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/UnexpectedFrames.java +++ b/src/test/java/com/rabbitmq/client/test/functional/UnexpectedFrames.java @@ -18,6 +18,7 @@ import com.rabbitmq.client.AMQP; import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.DefaultSocketConfigurator; +import com.rabbitmq.client.SocketConfigurators; import com.rabbitmq.client.impl.*; import com.rabbitmq.client.impl.recovery.AutorecoveringConnection; import com.rabbitmq.client.test.BrokerTestCase; @@ -85,7 +86,7 @@ public ConfusedConnectionFactory() { private static class ConfusedFrameHandlerFactory extends SocketFrameHandlerFactory { private ConfusedFrameHandlerFactory() { - super(1000, SocketFactory.getDefault(), new DefaultSocketConfigurator(), false); + super(1000, SocketFactory.getDefault(), SocketConfigurators.defaultConfigurator(), false); } @Override public FrameHandler create(Socket sock) throws IOException { diff --git a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java new file mode 100644 index 0000000000..85f6f6735e --- /dev/null +++ b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java @@ -0,0 +1,104 @@ +// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.test.ssl; + +import com.rabbitmq.client.Address; +import com.rabbitmq.client.ConnectionFactory; +import com.rabbitmq.client.test.TestUtils; +import org.junit.Test; + +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLHandshakeException; +import javax.net.ssl.TrustManagerFactory; +import java.io.FileInputStream; +import java.io.IOException; +import java.security.KeyManagementException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import java.util.concurrent.TimeoutException; + +import static java.util.Collections.singletonList; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + +public class HostnameVerification extends UnverifiedConnection { + + public void openConnection() + throws IOException, TimeoutException { + try { + String keystorePath = System.getProperty("test-keystore.ca"); + assertNotNull(keystorePath); + String keystorePasswd = System.getProperty("test-keystore.password"); + assertNotNull(keystorePasswd); + char[] keystorePassword = keystorePasswd.toCharArray(); + + KeyStore tks = KeyStore.getInstance("JKS"); + tks.load(new FileInputStream(keystorePath), keystorePassword); + + TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); + tmf.init(tks); + + String p12Path = System.getProperty("test-client-cert.path"); + assertNotNull(p12Path); + String p12Passwd = System.getProperty("test-client-cert.password"); + assertNotNull(p12Passwd); + KeyStore ks = KeyStore.getInstance("PKCS12"); + char[] p12Password = p12Passwd.toCharArray(); + ks.load(new FileInputStream(p12Path), p12Password); + + KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); + kmf.init(ks, p12Password); + + SSLContext c = getSSLContext(); + c.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); + c.init(null, tmf.getTrustManagers(), null); + + connectionFactory = TestUtils.connectionFactory(); + connectionFactory.useSslProtocol(c); + connectionFactory.enableHostnameVerification(); + } catch (NoSuchAlgorithmException ex) { + throw new IOException(ex.toString()); + } catch (KeyManagementException ex) { + throw new IOException(ex.toString()); + } catch (KeyStoreException ex) { + throw new IOException(ex.toString()); + } catch (CertificateException ex) { + throw new IOException(ex.toString()); + } catch (UnrecoverableKeyException ex) { + throw new IOException(ex.toString()); + } + + try { + connection = connectionFactory.newConnection( + () -> singletonList(new Address("127.0.0.1", ConnectionFactory.DEFAULT_AMQP_OVER_SSL_PORT))); + fail("The server certificate isn't issued for 127.0.0.1, the TLS handshake should have failed"); + } catch (SSLHandshakeException ignored) { + } catch (IOException e) { + fail(); + } + } + + public void openChannel() { + } + + @Test + public void sSL() { + } +} diff --git a/src/test/java/com/rabbitmq/client/test/ssl/NioTlsUnverifiedConnection.java b/src/test/java/com/rabbitmq/client/test/ssl/NioTlsUnverifiedConnection.java index 7312658894..07ac30a901 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/NioTlsUnverifiedConnection.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/NioTlsUnverifiedConnection.java @@ -82,12 +82,7 @@ public void connectionGetConsume() throws Exception { connectionFactory.useSslProtocol(); NioParams nioParams = new NioParams(); final AtomicBoolean sslEngineHasBeenCalled = new AtomicBoolean(false); - nioParams.setSslEngineConfigurator(new SslEngineConfigurator() { - @Override - public void configure(SSLEngine sslEngine) throws IOException { - sslEngineHasBeenCalled.set(true); - } - }); + nioParams.setSslEngineConfigurator(sslEngine -> sslEngineHasBeenCalled.set(true)); connectionFactory.setNioParams(nioParams); diff --git a/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java b/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java index 21946066e6..679468a59f 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java @@ -32,7 +32,8 @@ VerifiedConnection.class, BadVerifiedConnection.class, ConnectionFactoryDefaultTlsVersion.class, - NioTlsUnverifiedConnection.class + NioTlsUnverifiedConnection.class, + HostnameVerification.class }) public class SSLTests { diff --git a/src/test/java/com/rabbitmq/client/test/ssl/UnverifiedConnection.java b/src/test/java/com/rabbitmq/client/test/ssl/UnverifiedConnection.java index 319ef82de9..6d65599b4c 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/UnverifiedConnection.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/UnverifiedConnection.java @@ -54,7 +54,7 @@ public void openConnection() } } if(connection == null) { - fail("Couldn't open TLS connection after 3 attemps"); + fail("Couldn't open TLS connection after 3 attempts"); } } diff --git a/src/test/java/com/rabbitmq/client/test/ssl/VerifiedConnection.java b/src/test/java/com/rabbitmq/client/test/ssl/VerifiedConnection.java index 3083e6e2f2..e662113085 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/VerifiedConnection.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/VerifiedConnection.java @@ -96,7 +96,7 @@ public void openConnection() } } if(connection == null) { - fail("Couldn't open TLS connection after 3 attemps"); + fail("Couldn't open TLS connection after 3 attempts"); } } } From ad47e5bfede4beb022ffe51cda6a86cabee1ee97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 22 Aug 2018 11:20:05 +0200 Subject: [PATCH 025/328] Test blocking IO and NIO in hostname verification test Not costly to test both IO modes and makes iterating easier. References #394 (cherry picked from commit 7da0fd3e0d25f027f3467594a39a1db9d9cadbcd) --- .../rabbitmq/client/test/BrokerTestCase.java | 14 +- .../com/rabbitmq/client/test/TestUtils.java | 19 +++ .../client/test/ssl/HostnameVerification.java | 136 +++++++++--------- 3 files changed, 91 insertions(+), 78 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java b/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java index 27ea0cbd0d..216cbb8e47 100644 --- a/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java +++ b/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java @@ -352,18 +352,6 @@ protected String generateExchangeName() { } protected SSLContext getSSLContext() throws NoSuchAlgorithmException { - SSLContext c = null; - - // pick the first protocol available, preferring TLSv1.2, then TLSv1, - // falling back to SSLv3 if running on an ancient/crippled JDK - for(String proto : Arrays.asList("TLSv1.2", "TLSv1", "SSLv3")) { - try { - c = SSLContext.getInstance(proto); - return c; - } catch (NoSuchAlgorithmException x) { - // keep trying - } - } - throw new NoSuchAlgorithmException(); + return TestUtils.getSSLContext(); } } diff --git a/src/test/java/com/rabbitmq/client/test/TestUtils.java b/src/test/java/com/rabbitmq/client/test/TestUtils.java index 5b0b7d0d7e..b6cb834773 100644 --- a/src/test/java/com/rabbitmq/client/test/TestUtils.java +++ b/src/test/java/com/rabbitmq/client/test/TestUtils.java @@ -30,7 +30,10 @@ import com.rabbitmq.tools.Host; import org.slf4j.LoggerFactory; +import javax.net.ssl.SSLContext; import java.io.IOException; +import java.security.NoSuchAlgorithmException; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.concurrent.Callable; @@ -64,6 +67,22 @@ public static void close(Connection connection) { } } + public static SSLContext getSSLContext() throws NoSuchAlgorithmException { + SSLContext c = null; + + // pick the first protocol available, preferring TLSv1.2, then TLSv1, + // falling back to SSLv3 if running on an ancient/crippled JDK + for(String proto : Arrays.asList("TLSv1.2", "TLSv1", "SSLv3")) { + try { + c = SSLContext.getInstance(proto); + return c; + } catch (NoSuchAlgorithmException x) { + // keep trying + } + } + throw new NoSuchAlgorithmException(); + } + public static boolean isVersion37orLater(Connection connection) { String currentVersion = null; try { diff --git a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java index 85f6f6735e..1194ad7363 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java @@ -18,87 +18,93 @@ import com.rabbitmq.client.Address; import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.test.TestUtils; +import org.junit.BeforeClass; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLHandshakeException; import javax.net.ssl.TrustManagerFactory; import java.io.FileInputStream; -import java.io.IOException; -import java.security.KeyManagementException; import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; -import java.util.concurrent.TimeoutException; +import java.util.function.Consumer; +import static com.rabbitmq.client.test.TestUtils.getSSLContext; import static java.util.Collections.singletonList; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; -public class HostnameVerification extends UnverifiedConnection { - - public void openConnection() - throws IOException, TimeoutException { - try { - String keystorePath = System.getProperty("test-keystore.ca"); - assertNotNull(keystorePath); - String keystorePasswd = System.getProperty("test-keystore.password"); - assertNotNull(keystorePasswd); - char[] keystorePassword = keystorePasswd.toCharArray(); - - KeyStore tks = KeyStore.getInstance("JKS"); - tks.load(new FileInputStream(keystorePath), keystorePassword); - - TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); - tmf.init(tks); - - String p12Path = System.getProperty("test-client-cert.path"); - assertNotNull(p12Path); - String p12Passwd = System.getProperty("test-client-cert.password"); - assertNotNull(p12Passwd); - KeyStore ks = KeyStore.getInstance("PKCS12"); - char[] p12Password = p12Passwd.toCharArray(); - ks.load(new FileInputStream(p12Path), p12Password); - - KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); - kmf.init(ks, p12Password); - - SSLContext c = getSSLContext(); - c.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); - c.init(null, tmf.getTrustManagers(), null); - - connectionFactory = TestUtils.connectionFactory(); - connectionFactory.useSslProtocol(c); - connectionFactory.enableHostnameVerification(); - } catch (NoSuchAlgorithmException ex) { - throw new IOException(ex.toString()); - } catch (KeyManagementException ex) { - throw new IOException(ex.toString()); - } catch (KeyStoreException ex) { - throw new IOException(ex.toString()); - } catch (CertificateException ex) { - throw new IOException(ex.toString()); - } catch (UnrecoverableKeyException ex) { - throw new IOException(ex.toString()); - } - - try { - connection = connectionFactory.newConnection( - () -> singletonList(new Address("127.0.0.1", ConnectionFactory.DEFAULT_AMQP_OVER_SSL_PORT))); - fail("The server certificate isn't issued for 127.0.0.1, the TLS handshake should have failed"); - } catch (SSLHandshakeException ignored) { - } catch (IOException e) { - fail(); - } +@RunWith(Parameterized.class) +public class HostnameVerification { + + static SSLContext sslContext; + @Parameterized.Parameter + public Consumer customizer; + + @Parameterized.Parameters + public static Object[] data() { + return new Object[] { + blockingIo(enableHostnameVerification()), + nio(enableHostnameVerification()), + }; + } + + private static Consumer blockingIo(final Consumer customizer) { + return connectionFactory -> { + connectionFactory.useBlockingIo(); + customizer.accept(connectionFactory); + }; } - public void openChannel() { + private static Consumer nio(final Consumer customizer) { + return connectionFactory -> { + connectionFactory.useNio(); + customizer.accept(connectionFactory); + }; + } + + private static Consumer enableHostnameVerification() { + return connectionFactory -> connectionFactory.enableHostnameVerification(); + } + + @BeforeClass + public static void initCrypto() throws Exception { + String keystorePath = System.getProperty("test-keystore.ca"); + assertNotNull(keystorePath); + String keystorePasswd = System.getProperty("test-keystore.password"); + assertNotNull(keystorePasswd); + char[] keystorePassword = keystorePasswd.toCharArray(); + + KeyStore tks = KeyStore.getInstance("JKS"); + tks.load(new FileInputStream(keystorePath), keystorePassword); + + TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); + tmf.init(tks); + + String p12Path = System.getProperty("test-client-cert.path"); + assertNotNull(p12Path); + String p12Passwd = System.getProperty("test-client-cert.password"); + assertNotNull(p12Passwd); + KeyStore ks = KeyStore.getInstance("PKCS12"); + char[] p12Password = p12Passwd.toCharArray(); + ks.load(new FileInputStream(p12Path), p12Password); + + KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); + kmf.init(ks, p12Password); + + sslContext = getSSLContext(); + sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); } - @Test - public void sSL() { + @Test(expected = SSLHandshakeException.class) + public void hostnameVerificationFailsBecauseCertificateNotIssuedForLoopbackInterface() throws Exception { + ConnectionFactory connectionFactory = TestUtils.connectionFactory(); + connectionFactory.useSslProtocol(sslContext); + customizer.accept(connectionFactory); + connectionFactory.newConnection( + () -> singletonList(new Address("127.0.0.1", ConnectionFactory.DEFAULT_AMQP_OVER_SSL_PORT))); + fail("The server certificate isn't issued for 127.0.0.1, the TLS handshake should have failed"); } } From 16daff14c03265f5362e5abd330f7838b6bd4a65 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Wed, 22 Aug 2018 19:01:37 +0300 Subject: [PATCH 026/328] One more test (cherry picked from commit 4abef1266eb7498c3add18732d59f1d185e6d0e2) --- .../client/test/ssl/HostnameVerification.java | 13 +++++++++++++ src/test/java/com/rabbitmq/tools/Host.java | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java index 1194ad7363..06ee47c0a9 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java @@ -16,8 +16,10 @@ package com.rabbitmq.client.test.ssl; import com.rabbitmq.client.Address; +import com.rabbitmq.client.Connection; import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.test.TestUtils; +import com.rabbitmq.tools.Host; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,6 +36,7 @@ import static com.rabbitmq.client.test.TestUtils.getSSLContext; import static java.util.Collections.singletonList; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @RunWith(Parameterized.class) @@ -107,4 +110,14 @@ public void hostnameVerificationFailsBecauseCertificateNotIssuedForLoopbackInter () -> singletonList(new Address("127.0.0.1", ConnectionFactory.DEFAULT_AMQP_OVER_SSL_PORT))); fail("The server certificate isn't issued for 127.0.0.1, the TLS handshake should have failed"); } + + public void hostnameVerificationSucceeds() throws Exception { + ConnectionFactory connectionFactory = TestUtils.connectionFactory(); + connectionFactory.useSslProtocol(sslContext); + customizer.accept(connectionFactory); + Connection conn = connectionFactory.newConnection( + () -> singletonList(new Address(Host.systemHostname(), ConnectionFactory.DEFAULT_AMQP_OVER_SSL_PORT))); + assertTrue(conn.isOpen()); + conn.close(); + } } diff --git a/src/test/java/com/rabbitmq/tools/Host.java b/src/test/java/com/rabbitmq/tools/Host.java index c919d78621..ba77e03f4c 100644 --- a/src/test/java/com/rabbitmq/tools/Host.java +++ b/src/test/java/com/rabbitmq/tools/Host.java @@ -120,6 +120,11 @@ public static Process invokeMakeTarget(String command) throws IOException { " " + command); } + public static String systemHostname() throws IOException { + Process process = executeCommandIgnoringErrors("hostname"); + return capture(process.getInputStream()); + } + public static String makeCommand() { return System.getProperty("make.bin", "make"); From 31bdd4745cf87a98e35af566bd415b765c9c89c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 24 Aug 2018 15:37:31 +0200 Subject: [PATCH 027/328] Add Javadoc @since 5.4.0 for hostname verification References #394 (cherry picked from commit b5079b4a1b965dcf2ef3e3ff28c0776eda0ce28b) --- .../java/com/rabbitmq/client/SocketChannelConfigurators.java | 2 +- src/main/java/com/rabbitmq/client/SocketConfigurators.java | 2 +- src/main/java/com/rabbitmq/client/SslEngineConfigurators.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/SocketChannelConfigurators.java b/src/main/java/com/rabbitmq/client/SocketChannelConfigurators.java index d6af09d7de..566d3ddc13 100644 --- a/src/main/java/com/rabbitmq/client/SocketChannelConfigurators.java +++ b/src/main/java/com/rabbitmq/client/SocketChannelConfigurators.java @@ -21,7 +21,7 @@ * Note {@link SocketChannelConfigurator}s can be combined with * {@link SocketChannelConfigurator#andThen(SocketChannelConfigurator)}. * - * @since 5.5.0 + * @since 5.4.0 */ public abstract class SocketChannelConfigurators { diff --git a/src/main/java/com/rabbitmq/client/SocketConfigurators.java b/src/main/java/com/rabbitmq/client/SocketConfigurators.java index 127bddeb34..551ad95ca9 100644 --- a/src/main/java/com/rabbitmq/client/SocketConfigurators.java +++ b/src/main/java/com/rabbitmq/client/SocketConfigurators.java @@ -24,7 +24,7 @@ * Note {@link SocketConfigurator}s can be combined with * {@link SocketConfigurator#andThen(SocketConfigurator)}. * - * @since 5.5.0 + * @since 5.4.0 */ public abstract class SocketConfigurators { diff --git a/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java b/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java index d84dfa304f..119bb0314f 100644 --- a/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java +++ b/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java @@ -23,7 +23,7 @@ * Note {@link SslEngineConfigurator}s can be combined with * {@link SslEngineConfigurator#andThen(SslEngineConfigurator)}. * - * @since 5.5.0 + * @since 5.4.0 */ public abstract class SslEngineConfigurators { From 82bf1c776780f683849e1eb8e711962737ac0b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 27 Aug 2018 09:08:29 +0200 Subject: [PATCH 028/328] Add @since 5.4.0 to ConnectionFactory#enableHostnameVerification References #394 (cherry picked from commit 9c8a12821fed8657c617f086be147a6a95a71812) --- src/main/java/com/rabbitmq/client/ConnectionFactory.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index e9af65a6b5..2f8b55d050 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -746,6 +746,7 @@ public void useSslProtocol(SSLContext context) { * @see ConnectionFactory#useSslProtocol(SSLContext) * @see ConnectionFactory#useSslProtocol() * @see ConnectionFactory#useSslProtocol(String, TrustManager) + * @since 5.4.0 */ public void enableHostnameVerification() { enableHostnameVerificationForNio(); From 02b21b60b136d8039b1815dd1ecffedfe1989c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 27 Aug 2018 09:39:37 +0200 Subject: [PATCH 029/328] Fix hostname verification successful test case The capture of the hostname command would add a \n at the end of the line and the hostname resolution would fail. References #384 (cherry picked from commit b8197cc9f1c8ecb085f1c2a5e2fe1060de01fbe5) --- .../rabbitmq/client/test/ssl/HostnameVerification.java | 9 +++++---- src/test/java/com/rabbitmq/tools/Host.java | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java index 06ee47c0a9..54f3e5b947 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java @@ -111,13 +111,14 @@ public void hostnameVerificationFailsBecauseCertificateNotIssuedForLoopbackInter fail("The server certificate isn't issued for 127.0.0.1, the TLS handshake should have failed"); } + @Test public void hostnameVerificationSucceeds() throws Exception { ConnectionFactory connectionFactory = TestUtils.connectionFactory(); connectionFactory.useSslProtocol(sslContext); customizer.accept(connectionFactory); - Connection conn = connectionFactory.newConnection( - () -> singletonList(new Address(Host.systemHostname(), ConnectionFactory.DEFAULT_AMQP_OVER_SSL_PORT))); - assertTrue(conn.isOpen()); - conn.close(); + try (Connection conn = connectionFactory.newConnection( + () -> singletonList(new Address(Host.systemHostname(), ConnectionFactory.DEFAULT_AMQP_OVER_SSL_PORT)))) { + assertTrue(conn.isOpen()); + } } } diff --git a/src/test/java/com/rabbitmq/tools/Host.java b/src/test/java/com/rabbitmq/tools/Host.java index ba77e03f4c..69b7bac729 100644 --- a/src/test/java/com/rabbitmq/tools/Host.java +++ b/src/test/java/com/rabbitmq/tools/Host.java @@ -122,7 +122,7 @@ public static Process invokeMakeTarget(String command) throws IOException { public static String systemHostname() throws IOException { Process process = executeCommandIgnoringErrors("hostname"); - return capture(process.getInputStream()); + return capture(process.getInputStream()).trim(); } public static String makeCommand() From 8dde8b59eae20eab1614ae8a0c87d2e08a5d954b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 27 Aug 2018 10:18:05 +0200 Subject: [PATCH 030/328] Disable DNS resolution when using TLS Fixes #400 --- .../rabbitmq/client/ConnectionFactory.java | 2 +- .../client/test/ConnectionFactoryTest.java | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index 2f8b55d050..e2bd6ef507 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -1219,7 +1219,7 @@ public Connection newConnection(ExecutorService executor, String connectionName) } protected AddressResolver createAddressResolver(List

addresses) { - if(addresses.size() == 1) { + if(addresses.size() == 1 && !isSSL()) { return new DnsRecordIpAddressResolver(addresses.get(0), isSSL()); } else { return new ListAddressResolver(addresses); diff --git a/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java b/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java index cc81cc13a2..8d6e94e416 100644 --- a/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java +++ b/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java @@ -16,22 +16,32 @@ package com.rabbitmq.client.test; import com.rabbitmq.client.Address; +import com.rabbitmq.client.AddressResolver; import com.rabbitmq.client.Connection; import com.rabbitmq.client.ConnectionFactory; +import com.rabbitmq.client.DnsRecordIpAddressResolver; +import com.rabbitmq.client.ListAddressResolver; import com.rabbitmq.client.MetricsCollector; import com.rabbitmq.client.impl.AMQConnection; import com.rabbitmq.client.impl.ConnectionParams; import com.rabbitmq.client.impl.CredentialsProvider; import com.rabbitmq.client.impl.FrameHandler; import com.rabbitmq.client.impl.FrameHandlerFactory; +import org.hamcrest.Matchers; +import org.junit.Assert; import org.junit.Test; import java.io.IOException; +import java.util.List; import java.util.Queue; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import static org.hamcrest.Matchers.allOf; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.Matchers.notNullValue; import static org.junit.Assert.*; import static org.mockito.Mockito.*; @@ -90,4 +100,53 @@ protected AMQConnection createConnection(ConnectionParams params, FrameHandler f assertTrue(createCalled.get()); } + @Test public void shouldUseDnsResolutionWhenOneAddressAndNoTls() throws Exception { + AMQConnection connection = mock(AMQConnection.class); + AtomicReference addressResolver = new AtomicReference<>(); + + ConnectionFactory connectionFactory = new ConnectionFactory() { + @Override + protected AMQConnection createConnection(ConnectionParams params, FrameHandler frameHandler, + MetricsCollector metricsCollector) { + return connection; + } + + @Override + protected AddressResolver createAddressResolver(List
addresses) { + addressResolver.set(super.createAddressResolver(addresses)); + return addressResolver.get(); + } + }; + + doNothing().when(connection).start(); + connectionFactory.newConnection(); + + assertThat(addressResolver.get(), allOf(notNullValue(), instanceOf(DnsRecordIpAddressResolver.class))); + } + + @Test public void shouldNotUseDnsResolutionWhenOneAddressAndNoTls() throws Exception { + AMQConnection connection = mock(AMQConnection.class); + AtomicReference addressResolver = new AtomicReference<>(); + + ConnectionFactory connectionFactory = new ConnectionFactory() { + @Override + protected AMQConnection createConnection(ConnectionParams params, FrameHandler frameHandler, + MetricsCollector metricsCollector) { + return connection; + } + + @Override + protected AddressResolver createAddressResolver(List
addresses) { + addressResolver.set(super.createAddressResolver(addresses)); + return addressResolver.get(); + } + }; + + doNothing().when(connection).start(); + connectionFactory.useSslProtocol(); + connectionFactory.newConnection(); + + assertThat(addressResolver.get(), allOf(notNullValue(), instanceOf(ListAddressResolver.class))); + } + } From 02164d71c33db72649aeb1c646f57b8fbfda00ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 27 Aug 2018 10:25:01 +0200 Subject: [PATCH 031/328] Fix test method name References #400 --- .../java/com/rabbitmq/client/test/ConnectionFactoryTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java b/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java index 8d6e94e416..4cf56ae7b6 100644 --- a/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java +++ b/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java @@ -124,7 +124,7 @@ protected AddressResolver createAddressResolver(List
addresses) { assertThat(addressResolver.get(), allOf(notNullValue(), instanceOf(DnsRecordIpAddressResolver.class))); } - @Test public void shouldNotUseDnsResolutionWhenOneAddressAndNoTls() throws Exception { + @Test public void shouldNotUseDnsResolutionWhenOneAddressAndTls() throws Exception { AMQConnection connection = mock(AMQConnection.class); AtomicReference addressResolver = new AtomicReference<>(); From b6b601d8192fa03bcced73442d2d41929583c9e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 28 Aug 2018 09:41:04 +0200 Subject: [PATCH 032/328] Use localhost for hostname verification test localhost is now part of the SAN of the generated server certificate, so the hostname verification succeeds. References #394 (cherry picked from commit f73b80ad4e93fd0ba6677be5aeadcd74779f1c98) --- .../java/com/rabbitmq/client/test/ssl/HostnameVerification.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java index 54f3e5b947..d7a3e407e3 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java @@ -117,7 +117,7 @@ public void hostnameVerificationSucceeds() throws Exception { connectionFactory.useSslProtocol(sslContext); customizer.accept(connectionFactory); try (Connection conn = connectionFactory.newConnection( - () -> singletonList(new Address(Host.systemHostname(), ConnectionFactory.DEFAULT_AMQP_OVER_SSL_PORT)))) { + () -> singletonList(new Address("localhost", ConnectionFactory.DEFAULT_AMQP_OVER_SSL_PORT)))) { assertTrue(conn.isOpen()); } } From d5672cb618f1d447b3184527f104b60084cabbdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 28 Aug 2018 09:47:51 +0200 Subject: [PATCH 033/328] Remove unused import in test (cherry picked from commit ab97c012e85329f5049ba18fa4fbdd15413cb6d5) --- .../java/com/rabbitmq/client/test/ssl/HostnameVerification.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java index d7a3e407e3..2ddef41aeb 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java @@ -19,7 +19,6 @@ import com.rabbitmq.client.Connection; import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.test.TestUtils; -import com.rabbitmq.tools.Host; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; From e43f14e28675fa4a650c5800766ce89465220415 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Tue, 28 Aug 2018 12:06:21 +0000 Subject: [PATCH 034/328] [maven-release-plugin] prepare release v5.4.0.RC2 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 19350b6ff6..82a507e476 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.4.0-SNAPSHOT + 5.4.0.RC2 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.4.0.RC2 From 387438ac816973aa0d782597e92d6dcd6ec5b1a7 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Tue, 28 Aug 2018 12:06:26 +0000 Subject: [PATCH 035/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 82a507e476..19350b6ff6 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.4.0.RC2 + 5.4.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.4.0.RC2 + HEAD From 8b8c58ae1bdb88027f6bdf37757fdadeeb245b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 28 Aug 2018 14:15:10 +0200 Subject: [PATCH 036/328] Set release version to 5.4.0.RC3 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index 56eb83cff6..70f633ccd8 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,2 +1,2 @@ -RELEASE_VERSION="5.4.0.RC2" +RELEASE_VERSION="5.4.0.RC3" DEVELOPMENT_VERSION="5.4.0-SNAPSHOT" From 9b5adbe3c2ae68e99defb3fc50199a5ce8bc474b Mon Sep 17 00:00:00 2001 From: Michael Dent Date: Tue, 28 Aug 2018 13:20:43 -0500 Subject: [PATCH 037/328] tweaks to recovery retry helper --- .../client/impl/recovery/DefaultRetryHandler.java | 8 ++++---- .../impl/recovery/TopologyRecoveryRetryLogic.java | 13 +++++-------- .../test/functional/TopologyRecoveryRetry.java | 2 +- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java b/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java index 98978eb6d1..9b151ccd25 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java @@ -103,11 +103,11 @@ public RetryResult retryConsumerRecovery(RetryContext context) throws Exception protected RetryResult doRetry(BiPredicate condition, RetryOperation operation, RecordedEntity entity, RetryContext context) throws Exception { - log(entity, context.exception()); int attempts = 0; Exception exception = context.exception(); while (attempts < retryAttempts) { if (condition.test(entity, exception)) { + log(entity, context.exception(), attempts); backoffPolicy.backoff(attempts + 1); try { Object result = operation.call(context); @@ -122,11 +122,11 @@ protected RetryResult doRetry(BiPredicate condition, throw exception; } } - throw context.exception(); + throw exception; } - protected void log(RecordedEntity entity, Exception exception) { - LOGGER.info("Error while recovering {}, retrying with {} attempt(s).", entity, retryAttempts, exception); + protected void log(RecordedEntity entity, Exception exception, int attempts) { + LOGGER.info("Error while recovering {}, retrying with {} more attempt(s).", entity, retryAttempts - attempts, exception); } public interface RetryOperation { diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java index 9d8d2be9a5..26db1f27a8 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java @@ -17,11 +17,9 @@ import com.rabbitmq.client.AMQP; import com.rabbitmq.client.ShutdownSignalException; +import com.rabbitmq.utility.Utility; -import java.util.List; import java.util.function.BiPredicate; -import java.util.function.Predicate; - import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryHandlerBuilder.builder; /** @@ -106,7 +104,7 @@ public abstract class TopologyRecoveryRetryLogic { public static final DefaultRetryHandler.RetryOperation RECOVER_CONSUMER_QUEUE_BINDINGS = context -> { if (context.entity() instanceof RecordedConsumer) { String queue = context.consumer().getQueue(); - for (RecordedBinding recordedBinding : context.connection().getRecordedBindings()) { + for (RecordedBinding recordedBinding : Utility.copy(context.connection().getRecordedBindings())) { if (recordedBinding instanceof RecordedQueueBinding && queue.equals(recordedBinding.getDestination())) { recordedBinding.recover(); } @@ -121,16 +119,15 @@ public abstract class TopologyRecoveryRetryLogic { public static final DefaultRetryHandler.RetryOperation RECOVER_CONSUMER = context -> context.consumer().recover(); /** - * Pre-configured {@link DefaultRetryHandler} that retries recovery of bindings and consumers + * Pre-configured {@link TopologyRecoveryRetryHandlerBuilder} that retries recovery of bindings and consumers * when their respective queue is not found. * This retry handler can be useful for long recovery processes, whereby auto-delete queues * can be deleted between queue recovery and binding/consumer recovery. */ - public static final RetryHandler RETRY_ON_QUEUE_NOT_FOUND_RETRY_HANDLER = builder() + public static final TopologyRecoveryRetryHandlerBuilder RETRY_ON_QUEUE_NOT_FOUND_RETRY_HANDLER = builder() .bindingRecoveryRetryCondition(CHANNEL_CLOSED_NOT_FOUND) .consumerRecoveryRetryCondition(CHANNEL_CLOSED_NOT_FOUND) .bindingRecoveryRetryOperation(RECOVER_CHANNEL.andThen(RECOVER_BINDING_QUEUE).andThen(RECOVER_BINDING)) .consumerRecoveryRetryOperation(RECOVER_CHANNEL.andThen(RECOVER_CONSUMER_QUEUE.andThen(RECOVER_CONSUMER) - .andThen(RECOVER_CONSUMER_QUEUE_BINDINGS))) - .build(); + .andThen(RECOVER_CONSUMER_QUEUE_BINDINGS))); } diff --git a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java index 71277c9826..ddfef8a823 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java +++ b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java @@ -51,7 +51,7 @@ public void topologyRecoveryRetry() throws Exception { @Override protected ConnectionFactory newConnectionFactory() { ConnectionFactory connectionFactory = TestUtils.connectionFactory(); - connectionFactory.setTopologyRecoveryRetryHandler(RETRY_ON_QUEUE_NOT_FOUND_RETRY_HANDLER); + connectionFactory.setTopologyRecoveryRetryHandler(RETRY_ON_QUEUE_NOT_FOUND_RETRY_HANDLER.build()); connectionFactory.setNetworkRecoveryInterval(1000); return connectionFactory; } From b88f7f587b5e15a7d20a8bf0d695440b1bcfae80 Mon Sep 17 00:00:00 2001 From: Michael Dent Date: Tue, 28 Aug 2018 13:42:15 -0500 Subject: [PATCH 038/328] was logging the wrong exception --- .../com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java b/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java index 9b151ccd25..ec9a86cbc8 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java @@ -107,7 +107,7 @@ protected RetryResult doRetry(BiPredicate condition, Exception exception = context.exception(); while (attempts < retryAttempts) { if (condition.test(entity, exception)) { - log(entity, context.exception(), attempts); + log(entity, exception, attempts); backoffPolicy.backoff(attempts + 1); try { Object result = operation.call(context); From de58023986e4b0cd3d66159b5f6835b7f518d6f6 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Wed, 29 Aug 2018 09:19:53 +0000 Subject: [PATCH 039/328] [maven-release-plugin] prepare release v5.4.0.RC3 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 19350b6ff6..9597e0ca2e 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.4.0-SNAPSHOT + 5.4.0.RC3 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.4.0.RC3 From 6e51a3775a0dc404f8808bea4ecabdd58b76e4f9 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Wed, 29 Aug 2018 09:19:59 +0000 Subject: [PATCH 040/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 9597e0ca2e..19350b6ff6 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.4.0.RC3 + 5.4.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.4.0.RC3 + HEAD From 714c8781872cc3f3cc271e826d059542e9fce7b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 29 Aug 2018 11:37:20 +0200 Subject: [PATCH 041/328] Set release version to 5.4.0.RC4 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index 70f633ccd8..84c22280ae 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,2 +1,2 @@ -RELEASE_VERSION="5.4.0.RC3" +RELEASE_VERSION="5.4.0.RC4" DEVELOPMENT_VERSION="5.4.0-SNAPSHOT" From b8f04408e71f4a9007f254719ef984170175ffa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 31 Aug 2018 11:20:19 +0200 Subject: [PATCH 042/328] Set release version to 5.4.0 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index 84c22280ae..a74fd487b8 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,2 +1,2 @@ -RELEASE_VERSION="5.4.0.RC4" +RELEASE_VERSION="5.4.0" DEVELOPMENT_VERSION="5.4.0-SNAPSHOT" From b18bcab2b743d002465e2fa709a3787ac8dce767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 31 Aug 2018 11:20:45 +0200 Subject: [PATCH 043/328] Update snapshot version in release file --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index a74fd487b8..914629c9f6 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,2 +1,2 @@ RELEASE_VERSION="5.4.0" -DEVELOPMENT_VERSION="5.4.0-SNAPSHOT" +DEVELOPMENT_VERSION="5.4.1-SNAPSHOT" From 7f527b51a12f7905215a6be008ba9baca660ede2 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 31 Aug 2018 09:33:54 +0000 Subject: [PATCH 044/328] [maven-release-plugin] prepare release v5.4.0 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 19350b6ff6..f3a2d19102 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.4.0-SNAPSHOT + 5.4.0 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.4.0 From a561f5bd966ab27a6c63e07d1c67db1dc3806f6f Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 31 Aug 2018 09:33:59 +0000 Subject: [PATCH 045/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index f3a2d19102..c2f738d501 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.4.0 + 5.4.1-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.4.0 + HEAD From 0163e581dc6e110805acedd79130a5dcfe76d2b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 31 Aug 2018 11:46:45 +0200 Subject: [PATCH 046/328] Set release version to 5.5.0.RC1 --- pom.xml | 2 +- release-versions.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index c2f738d501..8eb7a5f61d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.4.1-SNAPSHOT + 5.5.0-SNAPSHOT jar RabbitMQ Java Client diff --git a/release-versions.txt b/release-versions.txt index 914629c9f6..bf45e0f32c 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,2 +1,2 @@ -RELEASE_VERSION="5.4.0" -DEVELOPMENT_VERSION="5.4.1-SNAPSHOT" +RELEASE_VERSION="5.5.0.RC1" +DEVELOPMENT_VERSION="5.5.0-SNAPSHOT" From a57adf1dd260813a12cd3695d072bfa2371591d9 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Fri, 31 Aug 2018 17:03:44 +0200 Subject: [PATCH 047/328] Don't use an anchor in the message (they change too often) (cherry picked from commit 5dbb9de8784381601b8b7a9329c2c7d96ca01dd4) --- .../java/com/rabbitmq/client/TrustEverythingTrustManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/client/TrustEverythingTrustManager.java b/src/main/java/com/rabbitmq/client/TrustEverythingTrustManager.java index 7893eb7e16..544c74f1d8 100644 --- a/src/main/java/com/rabbitmq/client/TrustEverythingTrustManager.java +++ b/src/main/java/com/rabbitmq/client/TrustEverythingTrustManager.java @@ -33,7 +33,7 @@ public TrustEverythingTrustManager() { LoggerFactory.getLogger(TrustEverythingTrustManager.class).warn( "SECURITY ALERT: this trust manager trusts every certificate, effectively disabling peer verification. " + "This is convenient for local development but offers no protection against man-in-the-middle attacks. " + - "Please see https://www.rabbitmq.com/ssl.html#validating-cerficates to learn more about peer certificate verification." + "Please see https://www.rabbitmq.com/ssl.html to learn more about peer certificate verification." ); } From 441396a2382c61eca7042e99c811bd0df920596d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 28 Aug 2018 18:08:43 +0200 Subject: [PATCH 048/328] Use rabbitmqctl to manipulate alarms in tests Avoid using make and depending on the umbrella. (cherry picked from commit 9dc2a6a145d6cc0071772d9b6a3acb30076d7d1a) --- .../java/com/rabbitmq/client/test/BrokerTestCase.java | 10 +++++----- .../com/rabbitmq/client/test/server/MemoryAlarms.java | 9 ++------- src/test/java/com/rabbitmq/tools/Host.java | 8 ++++++++ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java b/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java index 216cbb8e47..b9ee4ecceb 100644 --- a/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java +++ b/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java @@ -320,17 +320,17 @@ protected void deleteQueues(String [] queues) throws IOException { } } - protected void clearAllResourceAlarms() throws IOException, InterruptedException { + protected void clearAllResourceAlarms() throws IOException { clearResourceAlarm("memory"); clearResourceAlarm("disk"); } - protected void setResourceAlarm(String source) throws IOException, InterruptedException { - Host.invokeMakeTarget("set-resource-alarm SOURCE=" + source); + protected void setResourceAlarm(String source) throws IOException { + Host.setResourceAlarm(source); } - protected void clearResourceAlarm(String source) throws IOException, InterruptedException { - Host.invokeMakeTarget("clear-resource-alarm SOURCE=" + source); + protected void clearResourceAlarm(String source) throws IOException { + Host.clearResourceAlarm(source); } protected void block() throws IOException, InterruptedException { diff --git a/src/test/java/com/rabbitmq/client/test/server/MemoryAlarms.java b/src/test/java/com/rabbitmq/client/test/server/MemoryAlarms.java index 998fecd987..76a092d868 100644 --- a/src/test/java/com/rabbitmq/client/test/server/MemoryAlarms.java +++ b/src/test/java/com/rabbitmq/client/test/server/MemoryAlarms.java @@ -47,6 +47,7 @@ public void setUp() throws IOException, TimeoutException { @Override public void tearDown() throws IOException, TimeoutException { + clearAllResourceAlarms(); if (channel2 != null) { channel2.abort(); channel2 = null; @@ -66,13 +67,7 @@ protected void createResources() throws IOException { @Override protected void releaseResources() throws IOException { - try { - clearAllResourceAlarms(); - } catch (InterruptedException e) { - e.printStackTrace(); - } finally { - channel.queueDelete(Q); - } + channel.queueDelete(Q); } @Test public void flowControl() throws IOException, InterruptedException { diff --git a/src/test/java/com/rabbitmq/tools/Host.java b/src/test/java/com/rabbitmq/tools/Host.java index 69b7bac729..1cae40f9b7 100644 --- a/src/test/java/com/rabbitmq/tools/Host.java +++ b/src/test/java/com/rabbitmq/tools/Host.java @@ -109,6 +109,14 @@ public static Process rabbitmqctlIgnoreErrors(String command) throws IOException " " + command); } + public static void setResourceAlarm(String source) throws IOException { + rabbitmqctl("eval 'rabbit_alarm:set_alarm({{resource_limit, " + source + ", node()}, []}).'"); + } + + public static void clearResourceAlarm(String source) throws IOException { + rabbitmqctl("eval 'rabbit_alarm:clear_alarm({resource_limit, " + source + ", node()}).'"); + } + public static Process invokeMakeTarget(String command) throws IOException { File rabbitmqctl = new File(rabbitmqctlCommand()); return executeCommand(makeCommand() + From b55534a5ad1f8e8b035a2d3a17b64acd77b5c82c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 30 Aug 2018 11:57:59 +0200 Subject: [PATCH 049/328] Use rabbitmqctl to start/stop rabbit application on node Instead of using make. This way only HA tests need make to run. (cherry picked from commit 9177ae2bef4fe0c5f0e1be442793fdd7560f132e) --- .../rabbitmq/client/test/BrokerTestCase.java | 4 +-- .../server/DeadLetterExchangeDurable.java | 4 +-- src/test/java/com/rabbitmq/tools/Host.java | 34 +++++++++++++++++-- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java b/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java index b9ee4ecceb..1a00ca8c1b 100644 --- a/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java +++ b/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java @@ -143,8 +143,8 @@ protected void restart() protected void bareRestart() throws IOException { - Host.invokeMakeTarget( - "stop-rabbit-on-node start-rabbit-on-node"); + Host.stopRabbitOnNode(); + Host.startRabbitOnNode(); } public void openConnection() diff --git a/src/test/java/com/rabbitmq/client/test/server/DeadLetterExchangeDurable.java b/src/test/java/com/rabbitmq/client/test/server/DeadLetterExchangeDurable.java index 3973521128..c6c4e85c91 100644 --- a/src/test/java/com/rabbitmq/client/test/server/DeadLetterExchangeDurable.java +++ b/src/test/java/com/rabbitmq/client/test/server/DeadLetterExchangeDurable.java @@ -58,9 +58,9 @@ protected void releaseResources() throws IOException { } closeConnection(); - Host.invokeMakeTarget("stop-rabbit-on-node"); + Host.stopRabbitOnNode(); Thread.sleep(5000); - Host.invokeMakeTarget("start-rabbit-on-node"); + Host.startRabbitOnNode(); openConnection(); openChannel(); diff --git a/src/test/java/com/rabbitmq/tools/Host.java b/src/test/java/com/rabbitmq/tools/Host.java index 1cae40f9b7..4c995a1e1f 100644 --- a/src/test/java/com/rabbitmq/tools/Host.java +++ b/src/test/java/com/rabbitmq/tools/Host.java @@ -24,7 +24,10 @@ import java.util.ArrayList; import java.util.List; +import com.rabbitmq.client.Connection; +import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.impl.NetworkConnection; +import com.rabbitmq.client.test.TestUtils; public class Host { @@ -128,9 +131,34 @@ public static Process invokeMakeTarget(String command) throws IOException { " " + command); } - public static String systemHostname() throws IOException { - Process process = executeCommandIgnoringErrors("hostname"); - return capture(process.getInputStream()).trim(); + public static void startRabbitOnNode() throws IOException { + rabbitmqctl("eval 'rabbit:start().'"); + tryConnectFor(10_000); + } + + public static void stopRabbitOnNode() throws IOException { + rabbitmqctl("eval 'rabbit:stop().'"); + } + + public static void tryConnectFor(int timeoutInMs) throws IOException { + int waitTime = 100; + int totalWaitTime = 0; + while (totalWaitTime <= timeoutInMs) { + try { + Thread.sleep(waitTime); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + totalWaitTime += waitTime; + ConnectionFactory connectionFactory = TestUtils.connectionFactory(); + try (Connection ignored = connectionFactory.newConnection()) { + return; + + } catch (Exception e) { + // retrying + } + } + throw new IOException("Could not connect to broker for " + timeoutInMs + " ms"); } public static String makeCommand() From 7b25dc5d442197c00e3835481b67b489b985f565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 30 Aug 2018 16:51:26 +0200 Subject: [PATCH 050/328] Use rabbitmqctl start_app/stop_app and not eval (cherry picked from commit 8394418ebabeff84156c10eb1ac0b7f6dfbcc400) --- .../com/rabbitmq/client/test/ssl/HostnameVerification.java | 1 + src/test/java/com/rabbitmq/tools/Host.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java index 2ddef41aeb..9355fdddcb 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java @@ -89,6 +89,7 @@ public static void initCrypto() throws Exception { assertNotNull(p12Path); String p12Passwd = System.getProperty("test-client-cert.password"); assertNotNull(p12Passwd); +System.out.println(p12Passwd); KeyStore ks = KeyStore.getInstance("PKCS12"); char[] p12Password = p12Passwd.toCharArray(); ks.load(new FileInputStream(p12Path), p12Password); diff --git a/src/test/java/com/rabbitmq/tools/Host.java b/src/test/java/com/rabbitmq/tools/Host.java index 4c995a1e1f..b1fccf26a9 100644 --- a/src/test/java/com/rabbitmq/tools/Host.java +++ b/src/test/java/com/rabbitmq/tools/Host.java @@ -132,12 +132,12 @@ public static Process invokeMakeTarget(String command) throws IOException { } public static void startRabbitOnNode() throws IOException { - rabbitmqctl("eval 'rabbit:start().'"); + rabbitmqctl("start_app"); tryConnectFor(10_000); } public static void stopRabbitOnNode() throws IOException { - rabbitmqctl("eval 'rabbit:stop().'"); + rabbitmqctl("stop_app"); } public static void tryConnectFor(int timeoutInMs) throws IOException { From 00ae7858492cd6e1629f045ceccd27c72264accd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 7 Sep 2018 09:13:21 +0200 Subject: [PATCH 051/328] Bump Maven to 3.5.4 --- .mvn/wrapper/maven-wrapper.properties | 2 +- .../java/com/rabbitmq/client/test/ssl/HostnameVerification.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index b573bb50d5..6c8c0e080f 100755 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip diff --git a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java index 9355fdddcb..71b6a497f9 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java @@ -89,7 +89,7 @@ public static void initCrypto() throws Exception { assertNotNull(p12Path); String p12Passwd = System.getProperty("test-client-cert.password"); assertNotNull(p12Passwd); -System.out.println(p12Passwd); + KeyStore ks = KeyStore.getInstance("PKCS12"); char[] p12Password = p12Passwd.toCharArray(); ks.load(new FileInputStream(p12Path), p12Password); From 5691a602f29fd1ccaa5592bfe5e6be28dadbf46c Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Wed, 19 Sep 2018 18:22:13 +0200 Subject: [PATCH 052/328] Only compare header size vs. max allowed frame size if the latter is limited Closes #407, references #362. [#160628331] (cherry picked from commit 73e353026dc235dfc63a9a633b5576b7d62357d6) --- .../com/rabbitmq/client/impl/AMQCommand.java | 10 +++--- .../client/test/functional/FrameMax.java | 35 +++++++++++++++++-- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/AMQCommand.java b/src/main/java/com/rabbitmq/client/impl/AMQCommand.java index e4457076c9..929eaa3804 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQCommand.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQCommand.java @@ -107,12 +107,12 @@ public void transmit(AMQChannel channel) throws IOException { Frame headerFrame = this.assembler.getContentHeader().toFrame(channelNumber, body.length); int frameMax = connection.getFrameMax(); - int bodyPayloadMax = (frameMax == 0) ? body.length : frameMax - - EMPTY_FRAME_SIZE; + boolean cappedFrameMax = frameMax > 0; + int bodyPayloadMax = cappedFrameMax ? frameMax - EMPTY_FRAME_SIZE : body.length; - if (headerFrame.size() > frameMax) { - throw new IllegalArgumentException("Content headers exceeded max frame size: " + - headerFrame.size() + " > " + frameMax); + if (cappedFrameMax && headerFrame.size() > frameMax) { + String msg = String.format("Content headers exceeded max frame size: %d > %d", headerFrame.size(), frameMax); + throw new IllegalArgumentException(msg); } connection.writeFrame(m.toFrame(channelNumber)); connection.writeFrame(headerFrame); diff --git a/src/test/java/com/rabbitmq/client/test/functional/FrameMax.java b/src/test/java/com/rabbitmq/client/test/functional/FrameMax.java index 07d7eb9d9f..303d01e00d 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/FrameMax.java +++ b/src/test/java/com/rabbitmq/client/test/functional/FrameMax.java @@ -30,6 +30,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeoutException; +import com.rabbitmq.client.impl.AMQBasicProperties; import com.rabbitmq.client.test.TestUtils; import org.junit.Test; @@ -104,9 +105,10 @@ public FrameMax() { closeChannel(); closeConnection(); ConnectionFactory cf = new GenerousConnectionFactory(); + cf.setRequestedFrameMax(8192); connection = cf.newConnection(); openChannel(); - basicPublishVolatile(new byte[connection.getFrameMax()], "void"); + basicPublishVolatile(new byte[connection.getFrameMax() * 2], "void"); expectError(AMQP.FRAME_ERROR); } @@ -123,7 +125,9 @@ public FrameMax() { // create headers with zero-length value to calculate maximum header value size before exceeding frame_max headers.put(headerName, LongStringHelper.asLongString(new byte[0])); - AMQP.BasicProperties properties = new AMQP.BasicProperties.Builder().headers(headers).build(); + AMQP.BasicProperties properties = new AMQP.BasicProperties.Builder() + .headers(headers) + .build(); Frame minimalHeaderFrame = properties.toFrame(0, 0); int maxHeaderValueSize = FRAME_MAX - minimalHeaderFrame.size(); @@ -151,6 +155,33 @@ public FrameMax() { } + // see rabbitmq/rabbitmq-java-client#407 + @Test public void unlimitedFrameMaxWithHeaders() + throws IOException, TimeoutException { + closeChannel(); + closeConnection(); + ConnectionFactory cf = newConnectionFactory(); + cf.setRequestedFrameMax(0); + connection = cf.newConnection(); + openChannel(); + + Map headers = new HashMap(); + headers.put("h1", LongStringHelper.asLongString(new byte[250])); + headers.put("h1", LongStringHelper.asLongString(new byte[500])); + headers.put("h1", LongStringHelper.asLongString(new byte[750])); + headers.put("h1", LongStringHelper.asLongString(new byte[5000])); + headers.put("h1", LongStringHelper.asLongString(new byte[50000])); + AMQP.BasicProperties properties = new AMQP.BasicProperties.Builder() + .headers(headers) + .build(); + basicPublishVolatile(new byte[500000], "", "", properties); + } + + @Override + protected boolean isAutomaticRecoveryEnabled() { + return false; + } + /* ConnectionFactory that uses MyFrameHandler rather than * SocketFrameHandler. */ private static class MyConnectionFactory extends ConnectionFactory { From 3427adbfe54b1c8b0b770d22117b0b88ad074366 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Wed, 26 Sep 2018 14:02:55 +0300 Subject: [PATCH 053/328] Change default exponential backoff sequence to not start with zero Recovery delay was a connection recovery feature from day 1 for a reason: * In practice connection recovery often won't succeed the first time because network failures don't always go away in milliseconds. * There's a natural race condition between server state changes (cleanup of queues and such) and the operations a recovered connection will perform potentially on entities *with the same identifier* (e.g. name) Initial delay avoids a lot of scenarios that stem from the above race condition and can waste a lot of time for operators, developers and the RabbitMQ core team. References #307. (cherry picked from commit 60eb44d2baf7fbe4da36cee5978855cc0a068061) --- .../rabbitmq/client/RecoveryDelayHandler.java | 9 +++--- .../client/test/RecoveryDelayHandlerTest.java | 30 +++++++++---------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/RecoveryDelayHandler.java b/src/main/java/com/rabbitmq/client/RecoveryDelayHandler.java index 045c11045c..524d3c1786 100644 --- a/src/main/java/com/rabbitmq/client/RecoveryDelayHandler.java +++ b/src/main/java/com/rabbitmq/client/RecoveryDelayHandler.java @@ -67,10 +67,10 @@ class ExponentialBackoffDelayHandler implements RecoveryDelayHandler { private final List sequence; /** - * Default Constructor. Uses the fibonacci sequence: {0, 1000, 1000, 2000, 3000, 5000, 8000, 13000, 21000}. + * Default Constructor. Uses the following sequence: 2000, 3000, 5000, 8000, 13000, 21000, 34000 */ public ExponentialBackoffDelayHandler() { - sequence = Arrays.asList(0L, 1000L, 1000L, 2000L, 3000L, 5000L, 8000L, 13000L, 21000L); + sequence = Arrays.asList(2000L, 3000L, 5000L, 8000L, 13000L, 21000L, 34000L); } /** @@ -88,7 +88,8 @@ public ExponentialBackoffDelayHandler(final List sequence) { @Override public long getDelay(int recoveryAttempts) { - return sequence.get(recoveryAttempts >= sequence.size() ? sequence.size() - 1 : recoveryAttempts); + int index = recoveryAttempts >= sequence.size() ? sequence.size() - 1 : recoveryAttempts; + return sequence.get(index); } } -} \ No newline at end of file +} diff --git a/src/test/java/com/rabbitmq/client/test/RecoveryDelayHandlerTest.java b/src/test/java/com/rabbitmq/client/test/RecoveryDelayHandlerTest.java index b73870784c..1b988251f3 100644 --- a/src/test/java/com/rabbitmq/client/test/RecoveryDelayHandlerTest.java +++ b/src/test/java/com/rabbitmq/client/test/RecoveryDelayHandlerTest.java @@ -37,23 +37,23 @@ public void testDefaultRecoveryDelayHandler() { } @Test - public void testExponentialBackoffDelayHandler_default() { + public void testExponentialBackoffDelayHandlerDefaults() { final RecoveryDelayHandler handler = new ExponentialBackoffDelayHandler(); - assertEquals(0, handler.getDelay(0)); - assertEquals(1000L, handler.getDelay(1)); - assertEquals(1000L, handler.getDelay(2)); - assertEquals(2000L, handler.getDelay(3)); - assertEquals(3000L, handler.getDelay(4)); - assertEquals(5000L, handler.getDelay(5)); - assertEquals(8000L, handler.getDelay(6)); - assertEquals(13000L, handler.getDelay(7)); - assertEquals(21000L, handler.getDelay(8)); - assertEquals(21000L, handler.getDelay(9)); - assertEquals(21000L, handler.getDelay(Integer.MAX_VALUE)); + assertEquals(2000L, handler.getDelay(0)); + assertEquals(3000L, handler.getDelay(1)); + assertEquals(5000L, handler.getDelay(2)); + assertEquals(8000L, handler.getDelay(3)); + assertEquals(13000L, handler.getDelay(4)); + assertEquals(21000L, handler.getDelay(5)); + assertEquals(34000L, handler.getDelay(6)); + assertEquals(34000L, handler.getDelay(7)); + assertEquals(34000L, handler.getDelay(8)); + assertEquals(34000L, handler.getDelay(9)); + assertEquals(34000L, handler.getDelay(Integer.MAX_VALUE)); } @Test - public void testExponentialBackoffDelayHandler_sequence() { + public void testExponentialBackoffDelayHandlerSequence() { final RecoveryDelayHandler handler = new ExponentialBackoffDelayHandler(Arrays.asList(1L, 2L)); assertEquals(1, handler.getDelay(0)); assertEquals(2, handler.getDelay(1)); @@ -62,12 +62,12 @@ public void testExponentialBackoffDelayHandler_sequence() { } @Test(expected=IllegalArgumentException.class) - public void testExponentialBackoffDelayHandler_sequence_null() { + public void testExponentialBackoffDelayHandlerWithNullSequence() { new ExponentialBackoffDelayHandler(null); } @Test(expected=IllegalArgumentException.class) - public void testExponentialBackoffDelayHandler_sequence_empty() { + public void testExponentialBackoffDelayHandlerWithEmptySequence() { new ExponentialBackoffDelayHandler(Collections.emptyList()); } } From f7b34e9ac2ed33ec953e7b6ca6c7f0a1dbf7561b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 4 Oct 2018 17:22:12 +0200 Subject: [PATCH 054/328] Use PackageCloud to deploy milestones [#160253747] (cherry picked from commit b58358b1432fea4db6711b48c1e8c1a2cf11f760) --- pom.xml | 46 +++++++++++++++++++++++++--- src/main/scripts/sanity-check.groovy | 2 +- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 8eb7a5f61d..f17917fadb 100644 --- a/pom.xml +++ b/pom.xml @@ -79,6 +79,8 @@ 1.6 3.0.2 3.2.0 + 0.0.6 + 1.8 milestone @@ -593,6 +595,36 @@ + + net.nicoulaj.maven.plugins + checksum-maven-plugin + ${checksum.maven.plugin.version} + + + sign-artifacts + package + + files + + + + + ${project.build.directory} + + *.jar + *.pom + + + + + MD5 + SHA-1 + + + + + + org.apache.maven.plugins maven-gpg-plugin @@ -614,9 +646,8 @@ - bintray-rabbitmq-maven-milestones - rabbitmq-maven-milestones - https://api.bintray.com/maven/rabbitmq/maven-milestones/com.rabbitmq:amqp-client/;publish=1 + packagecloud-rabbitmq-maven-milestones + packagecloud+https://packagecloud.io/rabbitmq/maven-milestones @@ -942,6 +973,13 @@ + + + io.packagecloud.maven.wagon + maven-packagecloud-wagon + ${maven.packagecloud.wagon.version} + + diff --git a/src/main/scripts/sanity-check.groovy b/src/main/scripts/sanity-check.groovy index e1c9d48686..4447359a9c 100644 --- a/src/main/scripts/sanity-check.groovy +++ b/src/main/scripts/sanity-check.groovy @@ -1,5 +1,5 @@ @GrabResolver(name = 'rabbitmq-bintray', root = 'http://dl.bintray.com/rabbitmq/maven') -@GrabResolver(name = 'rabbitmq-bintray-milestones', root = 'http://dl.bintray.com/rabbitmq/maven-milestones') +@GrabResolver(name = 'rabbitmq-packagecloud-milestones', root = 'https://packagecloud.io/rabbitmq/maven-milestones/maven2') @Grab(group = 'com.rabbitmq', module = 'amqp-client', version = "${version}") @Grab(group = 'org.slf4j', module = 'slf4j-simple', version = '1.7.25') import com.rabbitmq.client.AMQP From 1a8ffed1383edecf9a329b1462f21554ae153d03 Mon Sep 17 00:00:00 2001 From: Casper Mout Date: Mon, 20 Aug 2018 13:26:38 +0200 Subject: [PATCH 055/328] Handle realTag = 0 in RecoveryAwareChannelN (cherry picked from commit 2e6bf274f04a06299a484daff3f666c00be15ffd) --- .../impl/recovery/RecoveryAwareChannelN.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelN.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelN.java index d910da496c..faaa095bf6 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelN.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelN.java @@ -84,21 +84,27 @@ private AMQImpl.Basic.Deliver offsetDeliveryTag(AMQImpl.Basic.Deliver method) { @Override public void basicAck(long deliveryTag, boolean multiple) throws IOException { long realTag = deliveryTag - activeDeliveryTagOffset; - // 0 tag means ack all when multiple is set - if (realTag > 0 || (multiple && realTag == 0)) { - transmit(new Basic.Ack(realTag, multiple)); - metricsCollector.basicAck(this, deliveryTag, multiple); + if(multiple && deliveryTag == 0) { + // 0 tag means ack all when multiple is set + realTag = 0; + } else if(realTag <= 0) { + return; } + transmit(new Basic.Ack(realTag, multiple)); + metricsCollector.basicAck(this, deliveryTag, multiple); } @Override public void basicNack(long deliveryTag, boolean multiple, boolean requeue) throws IOException { long realTag = deliveryTag - activeDeliveryTagOffset; - // 0 tag means nack all when multiple is set - if (realTag > 0 || (multiple && realTag == 0)) { - transmit(new Basic.Nack(realTag, multiple, requeue)); - metricsCollector.basicNack(this, deliveryTag); + if(multiple && deliveryTag == 0) { + // 0 tag means nack all when multiple is set + realTag = 0; + } else if(realTag <= 0) { + return; } + transmit(new Basic.Nack(realTag, multiple, requeue)); + metricsCollector.basicNack(this, deliveryTag); } @Override From 9fbdb6dcf845386bc99ccb7ba26f78ea5b45ece6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 9 Oct 2018 15:51:57 +0200 Subject: [PATCH 056/328] Add Javadoc option on Java 11 to avoid 404 (cherry picked from commit 3c57eb9a3d37551fcd3adcaef03204b49cb5596d) --- pom.xml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f17917fadb..40d6bbe109 100644 --- a/pom.xml +++ b/pom.xml @@ -64,7 +64,7 @@ 3.1.0 2.21.0 - 3.0.0 + 3.0.1 2.5.3 2.3 3.0.2 @@ -177,6 +177,20 @@ + + + javadoc-no-module-dir-java-11 + + [11,) + + + --no-module-directories + + + + -Djdk.net.URLClassPath.disableClassPathURLCheck=true @@ -473,6 +478,11 @@ true + + -Djdk.net.URLClassPath.disableClassPathURLCheck=true From 7168133a0cde402d0d1fd81e009d2947b8c129f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 28 Nov 2018 16:42:29 +0100 Subject: [PATCH 076/328] Fix test to run without broker in the background (cherry picked from commit c4ec981835267e6d9ea6b804b0b5a400e9f56735) --- .../client/test/ConnectionFactoryTest.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java b/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java index 4cf56ae7b6..cccabd243e 100644 --- a/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java +++ b/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java @@ -62,7 +62,7 @@ protected AMQConnection createConnection(ConnectionParams params, FrameHandler f } @Override - protected synchronized FrameHandlerFactory createFrameHandlerFactory() throws IOException { + protected synchronized FrameHandlerFactory createFrameHandlerFactory() { return mock(FrameHandlerFactory.class); } }; @@ -89,6 +89,11 @@ protected AMQConnection createConnection(ConnectionParams params, FrameHandler f createCalled.set(true); return connection; } + + @Override + protected synchronized FrameHandlerFactory createFrameHandlerFactory() { + return mock(FrameHandlerFactory.class); + } }; connectionFactory.setCredentialsProvider(provider); connectionFactory.setAutomaticRecoveryEnabled(false); @@ -116,7 +121,14 @@ protected AddressResolver createAddressResolver(List
addresses) { addressResolver.set(super.createAddressResolver(addresses)); return addressResolver.get(); } + + @Override + protected synchronized FrameHandlerFactory createFrameHandlerFactory() { + return mock(FrameHandlerFactory.class); + } }; + // connection recovery makes the creation path more complex + connectionFactory.setAutomaticRecoveryEnabled(false); doNothing().when(connection).start(); connectionFactory.newConnection(); @@ -140,7 +152,14 @@ protected AddressResolver createAddressResolver(List
addresses) { addressResolver.set(super.createAddressResolver(addresses)); return addressResolver.get(); } + + @Override + protected synchronized FrameHandlerFactory createFrameHandlerFactory() { + return mock(FrameHandlerFactory.class); + } }; + // connection recovery makes the creation path more complex + connectionFactory.setAutomaticRecoveryEnabled(false); doNothing().when(connection).start(); connectionFactory.useSslProtocol(); From b47f17c4717993b342b46d6d2d5d7ffa54fd55d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 27 Nov 2018 17:50:58 +0100 Subject: [PATCH 077/328] Record recoverable entities in RPC channel methods [#162201529] Fixes #425 (cherry picked from commit f5601080a088e6c8e8b109be98b484ba559a25e8) --- .../impl/recovery/AutorecoveringChannel.java | 127 +++++++-- .../com/rabbitmq/client/test/ClientTests.java | 3 +- .../client/test/RpcTopologyRecordingTest.java | 242 ++++++++++++++++++ 3 files changed, 353 insertions(+), 19 deletions(-) create mode 100644 src/test/java/com/rabbitmq/client/test/RpcTopologyRecordingTest.java diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java index 402a6b82ea..10081fcf02 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java @@ -16,7 +16,9 @@ package com.rabbitmq.client.impl.recovery; import com.rabbitmq.client.*; -import com.rabbitmq.client.RecoverableChannel; +import com.rabbitmq.client.impl.AMQCommand; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.*; @@ -31,6 +33,9 @@ * @since 3.3.0 */ public class AutorecoveringChannel implements RecoverableChannel { + + private static final Logger LOGGER = LoggerFactory.getLogger(AutorecoveringChannel.class); + private volatile RecoveryAwareChannelN delegate; private volatile AutorecoveringConnection connection; private final List shutdownHooks = new CopyOnWriteArrayList(); @@ -235,12 +240,7 @@ public AMQP.Exchange.DeclareOk exchangeDeclare(String exchange, BuiltinExchangeT @Override public AMQP.Exchange.DeclareOk exchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete, boolean internal, Map arguments) throws IOException { final AMQP.Exchange.DeclareOk ok = delegate.exchangeDeclare(exchange, type, durable, autoDelete, internal, arguments); - RecordedExchange x = new RecordedExchange(this, exchange). - type(type). - durable(durable). - autoDelete(autoDelete). - arguments(arguments); - recordExchange(exchange, x); + recordExchange(ok, exchange, type, durable, autoDelete, arguments); return ok; } @@ -331,15 +331,7 @@ public AMQP.Queue.DeclareOk queueDeclare() throws IOException { @Override public AMQP.Queue.DeclareOk queueDeclare(String queue, boolean durable, boolean exclusive, boolean autoDelete, Map arguments) throws IOException { final AMQP.Queue.DeclareOk ok = delegate.queueDeclare(queue, durable, exclusive, autoDelete, arguments); - RecordedQueue q = new RecordedQueue(this, ok.getQueue()). - durable(durable). - exclusive(exclusive). - autoDelete(autoDelete). - arguments(arguments); - if (queue.equals(RecordedQueue.EMPTY_STRING)) { - q.serverNamed(true); - } - recordQueue(ok, q); + recordQueue(ok, queue, durable, exclusive, autoDelete, arguments); return ok; } @@ -714,7 +706,10 @@ public void asyncRpc(Method method) throws IOException { @Override public Command rpc(Method method) throws IOException { - return delegate.rpc(method); + recordOnRpcRequest(method); + AMQCommand response = delegate.rpc(method); + recordOnRpcResponse(response.getMethod(), method); + return response; } /** @@ -840,6 +835,18 @@ private boolean deleteRecordedExchangeBinding(String destination, String source, return this.connection.deleteRecordedExchangeBinding(this, destination, source, routingKey, arguments); } + private void recordQueue(AMQP.Queue.DeclareOk ok, String queue, boolean durable, boolean exclusive, boolean autoDelete, Map arguments) { + RecordedQueue q = new RecordedQueue(this, ok.getQueue()). + durable(durable). + exclusive(exclusive). + autoDelete(autoDelete). + arguments(arguments); + if (queue.equals(RecordedQueue.EMPTY_STRING)) { + q.serverNamed(true); + } + recordQueue(ok, q); + } + private void recordQueue(AMQP.Queue.DeclareOk ok, RecordedQueue q) { this.connection.recordQueue(ok, q); } @@ -852,6 +859,15 @@ private void deleteRecordedQueue(String queue) { this.connection.deleteRecordedQueue(queue); } + private void recordExchange(AMQP.Exchange.DeclareOk ok, String exchange, String type, boolean durable, boolean autoDelete, Map arguments) { + RecordedExchange x = new RecordedExchange(this, exchange). + type(type). + durable(durable). + autoDelete(autoDelete). + arguments(arguments); + recordExchange(exchange, x); + } + private void recordExchange(String exchange, RecordedExchange x) { this.connection.recordExchange(exchange, x); } @@ -898,7 +914,82 @@ void updateConsumerTag(String tag, String newTag) { @Override public CompletableFuture asyncCompletableRpc(Method method) throws IOException { - return this.delegate.asyncCompletableRpc(method); + recordOnRpcRequest(method); + CompletableFuture future = this.delegate.asyncCompletableRpc(method); + future.thenAccept(command -> { + if (command != null) { + recordOnRpcResponse(command.getMethod(), method); + } + }); + return future; + } + + private void recordOnRpcRequest(Method method) { + if (method instanceof AMQP.Queue.Delete) { + deleteRecordedQueue(((AMQP.Queue.Delete) method).getQueue()); + } else if (method instanceof AMQP.Exchange.Delete) { + deleteRecordedExchange(((AMQP.Exchange.Delete) method).getExchange()); + } else if (method instanceof AMQP.Queue.Unbind) { + AMQP.Queue.Unbind unbind = (AMQP.Queue.Unbind) method; + deleteRecordedQueueBinding( + unbind.getQueue(), unbind.getExchange(), + unbind.getRoutingKey(), unbind.getArguments() + ); + this.maybeDeleteRecordedAutoDeleteExchange(unbind.getExchange()); + } else if (method instanceof AMQP.Exchange.Unbind) { + AMQP.Exchange.Unbind unbind = (AMQP.Exchange.Unbind) method; + deleteRecordedExchangeBinding( + unbind.getDestination(), unbind.getSource(), + unbind.getRoutingKey(), unbind.getArguments() + ); + this.maybeDeleteRecordedAutoDeleteExchange(unbind.getSource()); + } + } + + private void recordOnRpcResponse(Method response, Method request) { + if (response instanceof AMQP.Queue.DeclareOk) { + if (request instanceof AMQP.Queue.Declare) { + AMQP.Queue.DeclareOk ok = (AMQP.Queue.DeclareOk) response; + AMQP.Queue.Declare declare = (AMQP.Queue.Declare) request; + recordQueue( + ok, declare.getQueue(), + declare.getDurable(), declare.getExclusive(), declare.getAutoDelete(), + declare.getArguments() + ); + } else { + LOGGER.warn("RPC response {} and RPC request {} not compatible, topology not recorded.", + response.getClass(), request.getClass()); + } + } else if (response instanceof AMQP.Exchange.DeclareOk) { + if (request instanceof AMQP.Exchange.Declare) { + AMQP.Exchange.DeclareOk ok = (AMQP.Exchange.DeclareOk) response; + AMQP.Exchange.Declare declare = (AMQP.Exchange.Declare) request; + recordExchange( + ok, declare.getExchange(), declare.getType(), + declare.getDurable(), declare.getAutoDelete(), + declare.getArguments() + ); + } else { + LOGGER.warn("RPC response {} and RPC request {} not compatible, topology not recorded.", + response.getClass(), request.getClass()); + } + } else if (response instanceof AMQP.Queue.BindOk) { + if (request instanceof AMQP.Queue.Bind) { + AMQP.Queue.Bind bind = (AMQP.Queue.Bind) request; + recordQueueBinding(bind.getQueue(), bind.getExchange(), bind.getRoutingKey(), bind.getArguments()); + } else { + LOGGER.warn("RPC response {} and RPC request {} not compatible, topology not recorded.", + response.getClass(), request.getClass()); + } + } else if (response instanceof AMQP.Exchange.BindOk) { + if (request instanceof AMQP.Exchange.Bind) { + AMQP.Exchange.Bind bind = (AMQP.Exchange.Bind) request; + recordExchangeBinding(bind.getDestination(), bind.getSource(), bind.getRoutingKey(), bind.getArguments()); + } else { + LOGGER.warn("RPC response {} and RPC request {} not compatible, topology not recorded.", + response.getClass(), request.getClass()); + } + } } @Override diff --git a/src/test/java/com/rabbitmq/client/test/ClientTests.java b/src/test/java/com/rabbitmq/client/test/ClientTests.java index 73a11f5af7..f16e2483c9 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientTests.java +++ b/src/test/java/com/rabbitmq/client/test/ClientTests.java @@ -67,7 +67,8 @@ AddressTest.class, DefaultRetryHandlerTest.class, NioDeadlockOnConnectionClosing.class, - GeneratedClassesTest.class + GeneratedClassesTest.class, + RpcTopologyRecordingTest.class }) public class ClientTests { diff --git a/src/test/java/com/rabbitmq/client/test/RpcTopologyRecordingTest.java b/src/test/java/com/rabbitmq/client/test/RpcTopologyRecordingTest.java new file mode 100644 index 0000000000..a04baa4682 --- /dev/null +++ b/src/test/java/com/rabbitmq/client/test/RpcTopologyRecordingTest.java @@ -0,0 +1,242 @@ +// Copyright (c) 2018-Present Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.test; + +import com.rabbitmq.client.*; +import com.rabbitmq.client.impl.AMQImpl; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import java.io.IOException; +import java.util.UUID; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicReference; + +import static com.rabbitmq.client.test.TestUtils.closeAndWaitForRecovery; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +@RunWith(Parameterized.class) +public class RpcTopologyRecordingTest extends BrokerTestCase { + + @Parameterized.Parameter + public RpcCall rpcCall; + String exchange, queue, routingKey; + String exchange2, queue2, routingKey2; + + @Parameterized.Parameters + public static Object[] data() { + return new Object[]{ + (RpcCall) (channel, method) -> channel.asyncCompletableRpc(method).get(5, TimeUnit.SECONDS), + (RpcCall) (channel, method) -> channel.rpc(method) + }; + } + + @Override + protected ConnectionFactory newConnectionFactory() { + ConnectionFactory connectionFactory = super.newConnectionFactory(); + connectionFactory.setNetworkRecoveryInterval(2); + return connectionFactory; + } + + @Before + public void init() { + queue = UUID.randomUUID().toString(); + exchange = UUID.randomUUID().toString(); + routingKey = UUID.randomUUID().toString(); + queue2 = "e2e-" + UUID.randomUUID().toString(); + exchange2 = "e2e-" + UUID.randomUUID().toString(); + routingKey2 = "e2e-" + UUID.randomUUID().toString(); + } + + @After + public void tearDown() throws IOException { + channel.exchangeDelete(exchange); + channel.exchangeDelete(exchange2); + } + + @Test + public void topologyRecovery() throws Exception { + createTopology(); + + AtomicReference latch = new AtomicReference<>(new CountDownLatch(2)); + DeliverCallback countDown = (ctag, message) -> latch.get().countDown(); + channel.basicConsume(queue, countDown, consumerTag -> { + }); + channel.basicConsume(queue2, countDown, consumerTag -> { + }); + + channel.basicPublish(exchange, routingKey, null, "".getBytes()); + channel.basicPublish(exchange, routingKey2, null, "".getBytes()); + + assertTrue(latch.get().await(5, TimeUnit.SECONDS)); + + latch.set(new CountDownLatch(2)); + + closeAndWaitForRecovery((RecoverableConnection) connection); + + channel.basicPublish(exchange, routingKey, null, "".getBytes()); + channel.basicPublish(exchange, routingKey2, null, "".getBytes()); + assertTrue(latch.get().await(5, TimeUnit.SECONDS)); + } + + @Test + public void deletionAreProperlyRecorded() throws Exception { + createTopology(); + + AtomicReference latch = new AtomicReference<>(new CountDownLatch(2)); + DeliverCallback countDown = (ctag, message) -> latch.get().countDown(); + String ctag1 = channel.basicConsume(queue, countDown, consumerTag -> { + }); + String ctag2 = channel.basicConsume(queue2, countDown, consumerTag -> { + }); + + channel.basicPublish(exchange, routingKey, null, "".getBytes()); + channel.basicPublish(exchange, routingKey2, null, "".getBytes()); + + assertTrue(latch.get().await(5, TimeUnit.SECONDS)); + + channel.basicCancel(ctag1); + channel.basicCancel(ctag2); + + rpcCall.call(channel, new AMQImpl.Exchange.Delete.Builder().exchange(exchange).build()); + rpcCall.call(channel, new AMQImpl.Exchange.Delete.Builder().exchange(exchange2).build()); + rpcCall.call(channel, new AMQImpl.Queue.Delete.Builder().queue(queue).build()); + rpcCall.call(channel, new AMQImpl.Queue.Delete.Builder().queue(queue2).build()); + + + latch.set(new CountDownLatch(2)); + + closeAndWaitForRecovery((RecoverableConnection) connection); + + assertFalse(queueExists(queue)); + assertFalse(queueExists(queue2)); + assertFalse(exchangeExists(exchange)); + assertFalse(exchangeExists(exchange2)); + } + + boolean queueExists(String queue) throws TimeoutException { + try (Channel ch = connection.createChannel()) { + ch.queueDeclarePassive(queue); + return true; + } catch (IOException e) { + return false; + } + } + + boolean exchangeExists(String exchange) throws TimeoutException { + try (Channel ch = connection.createChannel()) { + ch.exchangeDeclarePassive(exchange); + return true; + } catch (IOException e) { + return false; + } + } + + @Test + public void bindingDeletionAreProperlyRecorded() throws Exception { + createTopology(); + + AtomicReference latch = new AtomicReference<>(new CountDownLatch(2)); + DeliverCallback countDown = (ctag, message) -> latch.get().countDown(); + channel.basicConsume(queue, countDown, consumerTag -> { + }); + channel.basicConsume(queue2, countDown, consumerTag -> { + }); + + channel.basicPublish(exchange, routingKey, null, "".getBytes()); + channel.basicPublish(exchange, routingKey2, null, "".getBytes()); + + assertTrue(latch.get().await(5, TimeUnit.SECONDS)); + + unbind(); + + latch.set(new CountDownLatch(2)); + + closeAndWaitForRecovery((RecoverableConnection) connection); + + channel.basicPublish(exchange, routingKey, null, "".getBytes()); + channel.basicPublish(exchange, routingKey2, null, "".getBytes()); + assertFalse(latch.get().await(2, TimeUnit.SECONDS)); + } + + private void createTopology() throws Exception { + createAndBind(exchange, queue, routingKey); + createAndBind(exchange2, queue2, routingKey2); + rpcCall.call(channel, new AMQImpl.Exchange.Bind.Builder() + .source(exchange) + .destination(exchange2) + .routingKey(routingKey2) + .arguments(null) + .build()); + } + + private void createAndBind(String e, String q, String rk) throws Exception { + rpcCall.call(channel, new AMQImpl.Queue.Declare.Builder() + .queue(q) + .durable(false) + .exclusive(true) + .autoDelete(false) + .arguments(null) + .build()); + rpcCall.call(channel, new AMQImpl.Exchange.Declare.Builder() + .exchange(e) + .type("direct") + .durable(false) + .autoDelete(false) + .arguments(null) + .build()); + rpcCall.call(channel, new AMQImpl.Queue.Bind.Builder() + .queue(q) + .exchange(e) + .routingKey(rk) + .arguments(null) + .build()); + } + + private void unbind() throws Exception { + rpcCall.call(channel, new AMQImpl.Queue.Unbind.Builder() + .exchange(exchange) + .queue(queue) + .routingKey(routingKey).build() + ); + + rpcCall.call(channel, new AMQImpl.Queue.Unbind.Builder() + .exchange(exchange2) + .queue(queue2) + .routingKey(routingKey2).build() + ); + + rpcCall.call(channel, new AMQImpl.Exchange.Unbind.Builder() + .source(exchange) + .destination(exchange2) + .routingKey(routingKey2).build() + ); + } + + @FunctionalInterface + interface RpcCall { + + void call(Channel channel, Method method) throws Exception; + + } + +} From 7343fd2b514efc90e2a009c84b7ddc405f0578f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 5 Dec 2018 09:11:00 +0100 Subject: [PATCH 078/328] Increase expiry epsilon in dead letter test (cherry picked from commit 6c3e72d35d396730be75dd25039d2a2bf0b307c4) --- .../com/rabbitmq/client/test/functional/DeadLetterExchange.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java b/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java index 56ef879fe3..cfaff5f47d 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java +++ b/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java @@ -573,7 +573,7 @@ private void sleep(long millis) { publication time + TTL + latency */ private void checkPromptArrival(AccumulatingMessageConsumer c, int count, long latency) throws Exception { - long epsilon = TTL / 10; + long epsilon = TTL / 5; for (int i = 0; i < count; i++) { byte[] body = c.nextDelivery(TTL + TTL + latency + epsilon); assertNotNull("message #" + i + " did not expire", body); From 2c96753eec36ca9ba8005ba0c6f56790e61df9ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 4 Dec 2018 18:01:25 +0100 Subject: [PATCH 079/328] Fix some Sonar warnings (cherry picked from commit 1c3cf6af2ae24af93d97a2036d6e1e092d713d13) --- pom.xml | 11 +++++++++++ .../java/com/rabbitmq/client/ConnectionFactory.java | 2 +- .../com/rabbitmq/client/impl/nio/FrameBuilder.java | 4 ++-- .../impl/nio/SocketChannelFrameHandlerFactory.java | 6 ++++-- .../client/impl/recovery/AutorecoveringChannel.java | 2 +- .../impl/recovery/AutorecoveringConnection.java | 2 +- src/main/java/com/rabbitmq/utility/BlockingCell.java | 2 +- 7 files changed, 21 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 618e24f9fb..900f0ced38 100644 --- a/pom.xml +++ b/pom.xml @@ -744,6 +744,17 @@ + + + + + org.sonarsource.scanner.maven + sonar-maven-plugin + 3.5.0.1254 + + + + diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index e23325d18f..0d07297549 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -1099,7 +1099,7 @@ public Connection newConnection(ExecutorService executor, AddressResolver addres if (isAutomaticRecoveryEnabled()) { // see com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory#newConnection - AutorecoveringConnection conn = new AutorecoveringConnection(params, fhFactory, addressResolver, metricsCollector); + AutorecoveringConnection conn = new AutorecoveringConnection(params, fhFactory, addressResolver, metricsCollector); //NOSONAR conn.init(); return conn; diff --git a/src/main/java/com/rabbitmq/client/impl/nio/FrameBuilder.java b/src/main/java/com/rabbitmq/client/impl/nio/FrameBuilder.java index 56bbf28669..5bb867899f 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/FrameBuilder.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/FrameBuilder.java @@ -80,7 +80,7 @@ public Frame readFrame() throws IOException { frameBuffer[0] = readFromBuffer(); } else if (bytesRead == 2) { // channel 2/2 - frameChannel = (frameBuffer[0] << 8) + (readFromBuffer() << 0); + frameChannel = (frameBuffer[0] << 8) + readFromBuffer(); } else if (bytesRead == 3) { // payload size 1/4 frameBuffer[0] = readFromBuffer(); @@ -92,7 +92,7 @@ public Frame readFrame() throws IOException { frameBuffer[2] = readFromBuffer(); } else if (bytesRead == 6) { // payload size 4/4 - int framePayloadSize = ((frameBuffer[0] << 24) + (frameBuffer[1] << 16) + (frameBuffer[2] << 8) + (readFromBuffer() << 0)); + int framePayloadSize = (frameBuffer[0] << 24) + (frameBuffer[1] << 16) + (frameBuffer[2] << 8) + readFromBuffer(); framePayload = new byte[framePayloadSize]; } else if (bytesRead >= PAYLOAD_OFFSET && bytesRead < framePayload.length + PAYLOAD_OFFSET) { framePayload[bytesRead - PAYLOAD_OFFSET] = (byte) readFromBuffer(); diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java index f900325ed4..cb4d544a33 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java @@ -78,7 +78,7 @@ public FrameHandler create(Address addr, String connectionName) throws IOExcepti } SocketAddress address = new InetSocketAddress(addr.getHost(), portNumber); - channel = SocketChannel.open(); + channel = SocketChannel.open(); //NOSONAR channel.configureBlocking(true); if(nioParams.getSocketChannelConfigurator() != null) { nioParams.getSocketChannelConfigurator().configure(channel); @@ -122,7 +122,9 @@ public FrameHandler create(Address addr, String connectionName) throws IOExcepti if(sslEngine != null && channel != null) { SslEngineHelper.close(channel, sslEngine); } - channel.close(); + if (channel != null) { + channel.close(); + } } catch(IOException closingException) { // ignore } diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java index 10081fcf02..1df7822f2c 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java @@ -761,7 +761,7 @@ public void automaticallyRecover(AutorecoveringConnection connection, Connection this.connection = connection; final RecoveryAwareChannelN newChannel = (RecoveryAwareChannelN) connDelegate.createChannel(this.getChannelNumber()); - if (newChannel == null) + if (newChannel == null) //NOSONAR throw new IOException("Failed to create new channel for channel number=" + this.getChannelNumber() + " during recovery"); newChannel.inheritOffsetFrom(defunctChannel); this.delegate = newChannel; diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java index c200c8fd59..ae3659bbfb 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java @@ -163,7 +163,7 @@ public void init() throws IOException, TimeoutException { @Override public Channel createChannel() throws IOException { RecoveryAwareChannelN ch = (RecoveryAwareChannelN) delegate.createChannel(); - if (ch == null) { + if (ch == null) { //NOSONAR return null; } else { return this.wrapChannel(ch); diff --git a/src/main/java/com/rabbitmq/utility/BlockingCell.java b/src/main/java/com/rabbitmq/utility/BlockingCell.java index 2a7d6fb256..7fc8ec5641 100644 --- a/src/main/java/com/rabbitmq/utility/BlockingCell.java +++ b/src/main/java/com/rabbitmq/utility/BlockingCell.java @@ -28,7 +28,7 @@ public class BlockingCell { /** Will be null until a value is supplied, and possibly still then. */ private T _value; - private static final long NANOS_IN_MILLI = 1000 * 1000; + private static final long NANOS_IN_MILLI = 1000L * 1000L; private static final long INFINITY = -1; From 18b15bb1c30add08e6f870dc6b3ff6d87f4f4542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 5 Dec 2018 09:38:40 +0100 Subject: [PATCH 080/328] Stop RpcServer when its thread is interrupted Fixes #428 (cherry picked from commit 07b86cafc698eda8032e02a6880a4f558690f81b) --- .../java/com/rabbitmq/client/RpcServer.java | 5 +++- .../com/rabbitmq/client/test/RpcTest.java | 25 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/client/RpcServer.java b/src/main/java/com/rabbitmq/client/RpcServer.java index 581c2d8384..457e5f6679 100644 --- a/src/main/java/com/rabbitmq/client/RpcServer.java +++ b/src/main/java/com/rabbitmq/client/RpcServer.java @@ -96,7 +96,8 @@ protected RpcConsumer setupConsumer() * Public API - main server loop. Call this to begin processing * requests. Request processing will continue until the Channel * (or its underlying Connection) is shut down, or until - * terminateMainloop() is called. + * terminateMainloop() is called, or until the thread running the loop + * is interrupted. * * Note that if the mainloop is blocked waiting for a request, the * termination flag is not checked until a request is received, so @@ -114,6 +115,8 @@ public ShutdownSignalException mainloop() try { request = _consumer.nextDelivery(); } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + _mainloopRunning = false; continue; } processRequest(request); diff --git a/src/test/java/com/rabbitmq/client/test/RpcTest.java b/src/test/java/com/rabbitmq/client/test/RpcTest.java index b107711b0d..0c05f761e2 100644 --- a/src/test/java/com/rabbitmq/client/test/RpcTest.java +++ b/src/test/java/com/rabbitmq/client/test/RpcTest.java @@ -24,6 +24,8 @@ import com.rabbitmq.client.impl.recovery.RecordedQueue; import com.rabbitmq.client.impl.recovery.TopologyRecoveryFilter; import com.rabbitmq.tools.Host; +import org.awaitility.Awaitility; +import org.awaitility.Duration; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -37,6 +39,7 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; +import static org.awaitility.Awaitility.waitAtMost; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -281,6 +284,28 @@ public void handleRecoveryStarted(Recoverable recoverable) { } } + @Test public void interruptingServerThreadShouldStopIt() throws Exception { + rpcServer = new TestRpcServer(serverChannel, queue); + Thread serverThread = new Thread(() -> { + try { + rpcServer.mainloop(); + } catch (Exception e) { + // safe to ignore when loops ends/server is canceled + } + }); + serverThread.start(); + RpcClient client = new RpcClient(new RpcClientParams() + .channel(clientChannel).exchange("").routingKey(queue).timeout(1000)); + RpcClient.Response response = client.doCall(null, "hello".getBytes()); + assertEquals("*** hello ***", new String(response.getBody())); + + serverThread.interrupt(); + + waitAtMost(Duration.ONE_SECOND).until(() -> !serverThread.isAlive()) ; + + client.close(); + } + private static class TestRpcServer extends RpcServer { public TestRpcServer(Channel channel, String queueName) throws IOException { From 04badb406f455a5dd6e6bbe85966eafe190ddb97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 5 Dec 2018 10:08:57 +0100 Subject: [PATCH 081/328] Fix some Sonar warnings (cherry picked from commit c176ff96b3fdff1f46472fe533201c275682b04a) --- src/main/java/com/rabbitmq/client/ConnectionFactory.java | 2 +- src/main/java/com/rabbitmq/client/impl/AMQChannel.java | 4 +++- src/main/java/com/rabbitmq/client/impl/WorkPool.java | 2 +- .../client/impl/nio/SocketChannelFrameHandlerFactory.java | 2 +- .../client/impl/nio/SocketChannelFrameHandlerState.java | 1 + .../java/com/rabbitmq/client/impl/nio/SslEngineHelper.java | 2 +- .../rabbitmq/client/impl/recovery/AutorecoveringChannel.java | 2 +- .../client/impl/recovery/AutorecoveringConnection.java | 4 ++-- 8 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index 0d07297549..e23325d18f 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -1099,7 +1099,7 @@ public Connection newConnection(ExecutorService executor, AddressResolver addres if (isAutomaticRecoveryEnabled()) { // see com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory#newConnection - AutorecoveringConnection conn = new AutorecoveringConnection(params, fhFactory, addressResolver, metricsCollector); //NOSONAR + AutorecoveringConnection conn = new AutorecoveringConnection(params, fhFactory, addressResolver, metricsCollector); conn.init(); return conn; diff --git a/src/main/java/com/rabbitmq/client/impl/AMQChannel.java b/src/main/java/com/rabbitmq/client/impl/AMQChannel.java index b9810f67e5..985f89cf4d 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQChannel.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQChannel.java @@ -440,7 +440,9 @@ public void quiescingTransmit(AMQCommand c) throws IOException { while (_blockContent) { try { _channelMutex.wait(); - } catch (InterruptedException ignored) {} + } catch (InterruptedException ignored) { + Thread.currentThread().interrupt(); + } // This is to catch a situation when the thread wakes up during // shutdown. Currently, no command that has content is allowed diff --git a/src/main/java/com/rabbitmq/client/impl/WorkPool.java b/src/main/java/com/rabbitmq/client/impl/WorkPool.java index ea2111b320..dfccd33acf 100644 --- a/src/main/java/com/rabbitmq/client/impl/WorkPool.java +++ b/src/main/java/com/rabbitmq/client/impl/WorkPool.java @@ -74,7 +74,7 @@ public WorkPool(final int queueingTimeout) { throw new WorkPoolFullException("Could not enqueue in work pool after " + queueingTimeout + " ms."); } } catch (InterruptedException e) { - Thread.currentThread(); + Thread.currentThread().interrupt(); } }; } else { diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java index cb4d544a33..3bf0953063 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java @@ -78,7 +78,7 @@ public FrameHandler create(Address addr, String connectionName) throws IOExcepti } SocketAddress address = new InetSocketAddress(addr.getHost(), portNumber); - channel = SocketChannel.open(); //NOSONAR + channel = SocketChannel.open(); channel.configureBlocking(true); if(nioParams.getSocketChannelConfigurator() != null) { nioParams.getSocketChannelConfigurator().configure(channel); diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerState.java b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerState.java index 513280a72d..bea18489c7 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerState.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerState.java @@ -137,6 +137,7 @@ private void sendWriteRequest(WriteRequest writeRequest) throws IOException { } } catch (InterruptedException e) { LOGGER.warn("Thread interrupted during enqueuing frame in write queue"); + Thread.currentThread().interrupt(); } } diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SslEngineHelper.java b/src/main/java/com/rabbitmq/client/impl/nio/SslEngineHelper.java index 7bfaa26d1e..c4b8a33c26 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SslEngineHelper.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SslEngineHelper.java @@ -113,7 +113,7 @@ private static int retryRead(ReadableByteChannel channel, ByteBuffer buffer) thr try { Thread.sleep(100L); } catch (InterruptedException e) { - // ignore + Thread.currentThread().interrupt(); } read = NioHelper.read(channel, buffer); if(read > 0) { diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java index 1df7822f2c..10081fcf02 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java @@ -761,7 +761,7 @@ public void automaticallyRecover(AutorecoveringConnection connection, Connection this.connection = connection; final RecoveryAwareChannelN newChannel = (RecoveryAwareChannelN) connDelegate.createChannel(this.getChannelNumber()); - if (newChannel == null) //NOSONAR + if (newChannel == null) throw new IOException("Failed to create new channel for channel number=" + this.getChannelNumber() + " during recovery"); newChannel.inheritOffsetFrom(defunctChannel); this.delegate = newChannel; diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java index ae3659bbfb..4c52fa52fb 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java @@ -163,7 +163,7 @@ public void init() throws IOException, TimeoutException { @Override public Channel createChannel() throws IOException { RecoveryAwareChannelN ch = (RecoveryAwareChannelN) delegate.createChannel(); - if (ch == null) { //NOSONAR + if (ch == null) { return null; } else { return this.wrapChannel(ch); @@ -559,7 +559,7 @@ public void removeConsumerRecoveryListener(ConsumerRecoveryListener listener) { } private synchronized void beginAutomaticRecovery() throws InterruptedException { - Thread.sleep(this.params.getRecoveryDelayHandler().getDelay(0)); + this.wait(this.params.getRecoveryDelayHandler().getDelay(0)); this.notifyRecoveryListenersStarted(); From ced9e7a862e3d61016c3d480e9394cc8eb56ce75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 6 Dec 2018 09:51:10 +0100 Subject: [PATCH 082/328] Fix some Sonar warnings (cherry picked from commit 36d12f887c34f99afb19326458d0b25f50949cd0) --- .../java/com/rabbitmq/client/ConnectionFactory.java | 4 +++- .../rabbitmq/client/ConnectionFactoryConfigurator.java | 2 +- .../com/rabbitmq/client/SslEngineConfigurators.java | 4 ++-- src/main/java/com/rabbitmq/client/impl/AMQChannel.java | 5 +++-- .../java/com/rabbitmq/client/impl/ChannelManager.java | 10 ++++++++-- .../client/impl/ContentHeaderPropertyReader.java | 4 ++-- .../client/impl/ContentHeaderPropertyWriter.java | 4 ++-- .../impl/nio/SocketChannelFrameHandlerFactory.java | 5 ++++- .../client/impl/recovery/AutorecoveringChannel.java | 3 ++- .../client/impl/recovery/AutorecoveringConnection.java | 7 +++++-- src/main/java/com/rabbitmq/utility/Utility.java | 6 ++++-- 11 files changed, 36 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index e23325d18f..4dba1db7df 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -1099,7 +1099,9 @@ public Connection newConnection(ExecutorService executor, AddressResolver addres if (isAutomaticRecoveryEnabled()) { // see com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory#newConnection - AutorecoveringConnection conn = new AutorecoveringConnection(params, fhFactory, addressResolver, metricsCollector); + // No Sonar: no need to close this resource because we're the one that creates it + // and hands it over to the user + AutorecoveringConnection conn = new AutorecoveringConnection(params, fhFactory, addressResolver, metricsCollector); //NOSONAR conn.init(); return conn; diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactoryConfigurator.java b/src/main/java/com/rabbitmq/client/ConnectionFactoryConfigurator.java index 2052e4da1c..694b7626a8 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactoryConfigurator.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactoryConfigurator.java @@ -54,7 +54,7 @@ public class ConnectionFactoryConfigurator { public static final String DEFAULT_PREFIX = "rabbitmq."; public static final String USERNAME = "username"; - public static final String PASSWORD = "password"; + public static final String PASSWORD = "password"; //NOSONAR public static final String VIRTUAL_HOST = "virtual.host"; public static final String HOST = "host"; public static final String PORT = "port"; diff --git a/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java b/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java index 119bb0314f..44c2e16f70 100644 --- a/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java +++ b/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java @@ -30,13 +30,13 @@ public abstract class SslEngineConfigurators { /** * Default {@link SslEngineConfigurator}, does nothing. */ - public static SslEngineConfigurator DEFAULT = sslEngine -> { + public static final SslEngineConfigurator DEFAULT = sslEngine -> { }; /** * {@link SslEngineConfigurator} that enables server hostname verification. */ - public static SslEngineConfigurator ENABLE_HOSTNAME_VERIFICATION = sslEngine -> { + public static final SslEngineConfigurator ENABLE_HOSTNAME_VERIFICATION = sslEngine -> { SSLParameters sslParameters = SocketConfigurators.enableHostnameVerification(sslEngine.getSSLParameters()); sslEngine.setSSLParameters(sslParameters); }; diff --git a/src/main/java/com/rabbitmq/client/impl/AMQChannel.java b/src/main/java/com/rabbitmq/client/impl/AMQChannel.java index 985f89cf4d..3cdcf8c50f 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQChannel.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQChannel.java @@ -68,7 +68,7 @@ public abstract class AMQChannel extends ShutdownNotifierComponent { private RpcWrapper _activeRpc = null; /** Whether transmission of content-bearing methods should be blocked */ - public volatile boolean _blockContent = false; + protected volatile boolean _blockContent = false; /** Timeout for RPC calls */ protected final int _rpcTimeout; @@ -218,8 +218,9 @@ private void doEnqueueRpc(Supplier rpcWrapperSupplier) { while (_activeRpc != null) { try { _channelMutex.wait(); - } catch (InterruptedException e) { + } catch (InterruptedException e) { //NOSONAR waitClearedInterruptStatus = true; + // No Sonar: we re-interrupt the thread later } } if (waitClearedInterruptStatus) { diff --git a/src/main/java/com/rabbitmq/client/impl/ChannelManager.java b/src/main/java/com/rabbitmq/client/impl/ChannelManager.java index 53fedee158..73b78f71b4 100644 --- a/src/main/java/com/rabbitmq/client/impl/ChannelManager.java +++ b/src/main/java/com/rabbitmq/client/impl/ChannelManager.java @@ -143,8 +143,14 @@ public void run() { for (CountDownLatch latch : sdSet) { try { int shutdownTimeout = ssWorkService.getShutdownTimeout(); - if (shutdownTimeout == 0) latch.await(); - else latch.await(shutdownTimeout, TimeUnit.MILLISECONDS); + if (shutdownTimeout == 0) { + latch.await(); + } else { + boolean completed = latch.await(shutdownTimeout, TimeUnit.MILLISECONDS); + if (!completed) { + LOGGER.warn("Consumer dispatcher for channel didn't shutdown after waiting for {} ms", shutdownTimeout); + } + } } catch (Throwable e) { /*ignored*/ } diff --git a/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyReader.java b/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyReader.java index 42e2d964ea..ca1a13411e 100644 --- a/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyReader.java +++ b/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyReader.java @@ -34,10 +34,10 @@ public class ContentHeaderPropertyReader { private final ValueReader in; /** Current field flag word */ - public int flagWord; + private int flagWord; /** Current flag position counter */ - public int bitCount; + private int bitCount; /** * Protected API - Constructs a reader from the given input stream diff --git a/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyWriter.java b/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyWriter.java index 1d22f9daa2..ad6211ab6d 100644 --- a/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyWriter.java +++ b/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyWriter.java @@ -33,10 +33,10 @@ public class ContentHeaderPropertyWriter { private final ValueWriter out; /** Current flags word being accumulated */ - public int flagWord; + private int flagWord; /** Position within current flags word */ - public int bitCount; + private int bitCount; /** * Constructs a fresh ContentHeaderPropertyWriter. diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java index 3bf0953063..c9e1ffb202 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java @@ -78,7 +78,10 @@ public FrameHandler create(Address addr, String connectionName) throws IOExcepti } SocketAddress address = new InetSocketAddress(addr.getHost(), portNumber); - channel = SocketChannel.open(); + // No Sonar: the channel is closed in case of error and it cannot + // be closed here because it's part of the state of the connection + // to be returned. + channel = SocketChannel.open(); //NOSONAR channel.configureBlocking(true); if(nioParams.getSocketChannelConfigurator() != null) { nioParams.getSocketChannelConfigurator().configure(channel); diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java index 10081fcf02..e74170d247 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java @@ -761,7 +761,8 @@ public void automaticallyRecover(AutorecoveringConnection connection, Connection this.connection = connection; final RecoveryAwareChannelN newChannel = (RecoveryAwareChannelN) connDelegate.createChannel(this.getChannelNumber()); - if (newChannel == null) + // No Sonar: the channel could be null + if (newChannel == null) //NOSONAR throw new IOException("Failed to create new channel for channel number=" + this.getChannelNumber() + " during recovery"); newChannel.inheritOffsetFrom(defunctChannel); this.delegate = newChannel; diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java index 4c52fa52fb..bfd2336a5b 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java @@ -163,7 +163,8 @@ public void init() throws IOException, TimeoutException { @Override public Channel createChannel() throws IOException { RecoveryAwareChannelN ch = (RecoveryAwareChannelN) delegate.createChannel(); - if (ch == null) { + // No Sonar: the channel could be null + if (ch == null) { //NOSONAR return null; } else { return this.wrapChannel(ch); @@ -599,7 +600,9 @@ private RecoveryAwareAMQConnection recoverConnection() throws InterruptedExcepti while (!manuallyClosed) { try { attempts++; - RecoveryAwareAMQConnection newConn = this.cf.newConnection(); + // No Sonar: no need to close this resource because we're the one that creates it + // and hands it over to the user + RecoveryAwareAMQConnection newConn = this.cf.newConnection(); //NOSONAR synchronized(recoveryLock) { if (!manuallyClosed) { // This is the standard case. diff --git a/src/main/java/com/rabbitmq/utility/Utility.java b/src/main/java/com/rabbitmq/utility/Utility.java index 62af79a5f8..d345717fc4 100644 --- a/src/main/java/com/rabbitmq/utility/Utility.java +++ b/src/main/java/com/rabbitmq/utility/Utility.java @@ -100,7 +100,8 @@ public static String makeStackTrace(Throwable throwable) { * @return ArrayList copy of the list */ public static List copy(final List list) { - synchronized (list) { + // No Sonar: this very list instance can be synchronized in other places of its owning class + synchronized (list) { //NOSONAR return new ArrayList(list); } } @@ -114,7 +115,8 @@ public static List copy(final List list) { * @return LinkedHashMap copy of the map */ public static Map copy(final Map map) { - synchronized (map) { + // No Sonar: this very map instance can be synchronized in other places of its owning class + synchronized (map) { //NOSONAR return new LinkedHashMap(map); } } From e730cd87603f30590d82a25cbc6f76c2a7cf884d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 6 Dec 2018 09:51:31 +0100 Subject: [PATCH 083/328] Make properties private in JSON RPC classes Accessors are now provided instead. Fixes #429 (cherry picked from commit 57d4fff6ac2693819ab451c60fe4bf17ad71a773) --- .../tools/jsonrpc/JsonRpcException.java | 25 ++++++++++++--- .../rabbitmq/tools/jsonrpc/JsonRpcServer.java | 12 +++---- .../tools/jsonrpc/ParameterDescription.java | 12 +++++-- .../tools/jsonrpc/ProcedureDescription.java | 24 +++++++++++--- .../tools/jsonrpc/ServiceDescription.java | 32 +++++++++++++++---- 5 files changed, 82 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java index fafb9457d0..7a58e5ff56 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java @@ -27,19 +27,19 @@ public class JsonRpcException extends Exception { /** * Usually the constant string, "JSONRPCError" */ - public String name; + private String name; /** * Error code */ - public int code; + private int code; /** * Error message */ - public String message; + private String message; /** * Error detail object - may not always be present or meaningful */ - public Object error; + private Object error; public JsonRpcException() { // no work needed in default no-arg constructor @@ -52,4 +52,21 @@ public JsonRpcException(String detailMessage, String name, int code, String mess this.message = message; this.error = error; } + + public String getName() { + return name; + } + + public int getCode() { + return code; + } + + @Override + public String getMessage() { + return message; + } + + public Object getError() { + return error; + } } diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java index 723664c3b5..61a3796647 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java @@ -52,15 +52,11 @@ public class JsonRpcServer extends StringRpcServer { /** * Holds the JSON-RPC service description for this client. */ - public ServiceDescription serviceDescription; - /** - * The interface this server implements. - */ - public Class interfaceClass; + private ServiceDescription serviceDescription; /** * The instance backing this server. */ - public Object interfaceInstance; + private Object interfaceInstance; public JsonRpcServer(Channel channel, Class interfaceClass, @@ -119,7 +115,9 @@ public JsonRpcServer(Channel channel, } private void init(Class interfaceClass, Object interfaceInstance) { - this.interfaceClass = interfaceClass; + /** + * The interface this server implements. + */ this.interfaceInstance = interfaceInstance; this.serviceDescription = new ServiceDescription(interfaceClass); } diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/ParameterDescription.java b/src/main/java/com/rabbitmq/tools/jsonrpc/ParameterDescription.java index 4046c61602..c0fc274947 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/ParameterDescription.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/ParameterDescription.java @@ -26,12 +26,12 @@ */ public class ParameterDescription { /** The parameter name. */ - public String name; + private String name; /** * The parameter type - one of "bit", "num", "str", "arr", * "obj", "any" or "nil". */ - public String type; + private String type; public ParameterDescription() { // Nothing to do here. @@ -57,4 +57,12 @@ public static String lookup(Class c) { if (Collection.class.isAssignableFrom(c)) return "arr"; return "any"; } + + public String getName() { + return name; + } + + public String getType() { + return type; + } } diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java b/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java index 714db1da96..0f66a8406e 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java @@ -27,13 +27,13 @@ */ public class ProcedureDescription { /** Procedure name */ - public String name; + private String name; /** Human-readable procedure summary */ - public String summary; + private String summary; /** Human-readable instructions for how to get information on the procedure's operation */ - public String help; + private String help; /** True if this procedure is idempotent, that is, can be accessed via HTTP GET */ - public boolean idempotent; + private boolean idempotent; /** Descriptions of parameters for this procedure */ private ParameterDescription[] params; @@ -139,4 +139,20 @@ public int arity() { public ParameterDescription[] getParams() { return params; } + + public String getName() { + return name; + } + + public String getSummary() { + return summary; + } + + public String getHelp() { + return help; + } + + public boolean isIdempotent() { + return idempotent; + } } diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java b/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java index 4cb6d3bf66..6e0092049b 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java @@ -30,15 +30,15 @@ public class ServiceDescription { public static final String JSON_RPC_VERSION = "1.1"; /** The service name */ - public String name; + private String name; /** ID for the service */ - public String id; + private String id; /** Version of the service */ - public String version; + private String version; /** Human-readable summary for the service */ - public String summary; + private String summary; /** Human-readable instructions for how to get information on the service's operation */ - public String help; + private String help; /** Map from procedure name to {@link ProcedureDescription} */ private Map procedures; @@ -75,7 +75,7 @@ public void setProcs(Collection> p) { /** Private API - used during initialization */ private void addProcedure(ProcedureDescription proc) { - procedures.put(proc.name + "/" + proc.arity(), proc); + procedures.put(proc.getName() + "/" + proc.arity(), proc); } /** @@ -91,4 +91,24 @@ public ProcedureDescription getProcedure(String newname, int arity) { } return proc; } + + public String getName() { + return name; + } + + public String getId() { + return id; + } + + public String getVersion() { + return version; + } + + public String getSummary() { + return summary; + } + + public String getHelp() { + return help; + } } From 906242239e7842eeeb1b6fe872aa753d54dad290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 6 Dec 2018 11:20:43 +0100 Subject: [PATCH 084/328] Add setters to JSON RPC classes When appropriate. Some properties are accessed with reflection and making them private makes those reflection calls fail. References #429 (cherry picked from commit 0168ce9ffab7a2884cbc2b11837a65724851f61e) --- .../tools/jsonrpc/JsonRpcException.java | 13 +++++++----- .../tools/jsonrpc/ParameterDescription.java | 8 ++++++++ .../tools/jsonrpc/ProcedureDescription.java | 16 +++++++++++++++ .../tools/jsonrpc/ServiceDescription.java | 20 +++++++++++++++++++ 4 files changed, 52 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java index 7a58e5ff56..18c0e93b84 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java @@ -27,22 +27,25 @@ public class JsonRpcException extends Exception { /** * Usually the constant string, "JSONRPCError" */ - private String name; + private final String name; /** * Error code */ - private int code; + private final int code; /** * Error message */ - private String message; + private final String message; /** * Error detail object - may not always be present or meaningful */ - private Object error; + private final Object error; public JsonRpcException() { - // no work needed in default no-arg constructor + this.name = null; + this.code = -1; + this.message = null; + this.error = null; } public JsonRpcException(String detailMessage, String name, int code, String message, Object error) { diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/ParameterDescription.java b/src/main/java/com/rabbitmq/tools/jsonrpc/ParameterDescription.java index c0fc274947..97fb9d0d01 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/ParameterDescription.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/ParameterDescription.java @@ -65,4 +65,12 @@ public String getName() { public String getType() { return type; } + + public void setName(String name) { + this.name = name; + } + + public void setType(String type) { + this.type = type; + } } diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java b/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java index 0f66a8406e..db637d1c38 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java @@ -155,4 +155,20 @@ public String getHelp() { public boolean isIdempotent() { return idempotent; } + + public void setName(String name) { + this.name = name; + } + + public void setSummary(String summary) { + this.summary = summary; + } + + public void setHelp(String help) { + this.help = help; + } + + public void setIdempotent(boolean idempotent) { + this.idempotent = idempotent; + } } diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java b/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java index 6e0092049b..a42a1b2f1d 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java @@ -111,4 +111,24 @@ public String getSummary() { public String getHelp() { return help; } + + public void setName(String name) { + this.name = name; + } + + public void setId(String id) { + this.id = id; + } + + public void setVersion(String version) { + this.version = version; + } + + public void setSummary(String summary) { + this.summary = summary; + } + + public void setHelp(String help) { + this.help = help; + } } From 52588f239aac44584b7f37141f09d34b1dbbfec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 6 Dec 2018 14:23:34 +0100 Subject: [PATCH 085/328] Use getter instead of property References #429 --- src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java index 23bb51764f..d23f56f0ff 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java @@ -262,7 +262,7 @@ public Object call(String[] args) Object[] actuals = new Object[arity]; for (int count = 0; count < params.length; count++) { - actuals[count] = coerce(args[count + 1], params[count].type); + actuals[count] = coerce(args[count + 1], params[count].getType()); } return call(method, actuals); From 2642c7d4cf0a11591b23e19dfe4127c87de93f62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 17 Dec 2018 16:08:31 +0100 Subject: [PATCH 086/328] Add Connection#openChannel to return Optional Fixes #431 (cherry picked from commit 018b3cd0cbb74d34e0c1364192d73a068168585d) --- .../java/com/rabbitmq/client/Connection.java | 43 ++++++ .../com/rabbitmq/client/test/ClientTests.java | 3 +- .../rabbitmq/client/test/ConnectionTest.java | 127 ++++++++++++++++++ 3 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 src/test/java/com/rabbitmq/client/test/ConnectionTest.java diff --git a/src/main/java/com/rabbitmq/client/Connection.java b/src/main/java/com/rabbitmq/client/Connection.java index be651e48ae..3bde680075 100644 --- a/src/main/java/com/rabbitmq/client/Connection.java +++ b/src/main/java/com/rabbitmq/client/Connection.java @@ -19,6 +19,7 @@ import java.io.IOException; import java.net.InetAddress; import java.util.Map; +import java.util.Optional; import java.util.concurrent.ExecutorService; /** @@ -117,6 +118,9 @@ public interface Connection extends ShutdownNotifier, Closeable { // rename to A * Create a new channel, using an internally allocated channel number. * If automatic connection recovery * is enabled, the channel returned by this method will be {@link Recoverable}. + *

+ * Use {@link #openChannel()} if you want to use an {@link Optional} to deal + * with a {@null} value. * * @return a new channel descriptor, or null if none is available * @throws IOException if an I/O problem is encountered @@ -125,12 +129,51 @@ public interface Connection extends ShutdownNotifier, Closeable { // rename to A /** * Create a new channel, using the specified channel number if possible. + *

+ * Use {@link #openChannel(int)} if you want to use an {@link Optional} to deal + * with a {@null} value. + * * @param channelNumber the channel number to allocate * @return a new channel descriptor, or null if this channel number is already in use * @throws IOException if an I/O problem is encountered */ Channel createChannel(int channelNumber) throws IOException; + /** + * Create a new channel wrapped in an {@link Optional}. + * The channel number is allocated internally. + *

+ * If automatic connection recovery + * is enabled, the channel returned by this method will be {@link Recoverable}. + *

+ * Use {@link #createChannel()} to return directly a {@link Channel} or {@code null}. + * + * @return an {@link Optional} containing the channel; + * never {@code null} but potentially empty if no channel is available + * @throws IOException if an I/O problem is encountered + * @see #createChannel() + * @since 5.6.0 + */ + default Optional openChannel() throws IOException { + return Optional.ofNullable(createChannel()); + } + + /** + * Create a new channel, using the specified channel number if possible. + *

+ * Use {@link #createChannel(int)} to return directly a {@link Channel} or {@code null}. + * + * @param channelNumber the channel number to allocate + * @return an {@link Optional} containing the channel, + * never {@code null} but potentially empty if this channel number is already in use + * @throws IOException if an I/O problem is encountered + * @see #createChannel(int) + * @since 5.6.0 + */ + default Optional openChannel(int channelNumber) throws IOException { + return Optional.ofNullable(createChannel(channelNumber)); + } + /** * Close this connection and all its channels * with the {@link com.rabbitmq.client.AMQP#REPLY_SUCCESS} close code diff --git a/src/test/java/com/rabbitmq/client/test/ClientTests.java b/src/test/java/com/rabbitmq/client/test/ClientTests.java index f16e2483c9..998743d46b 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientTests.java +++ b/src/test/java/com/rabbitmq/client/test/ClientTests.java @@ -68,7 +68,8 @@ DefaultRetryHandlerTest.class, NioDeadlockOnConnectionClosing.class, GeneratedClassesTest.class, - RpcTopologyRecordingTest.class + RpcTopologyRecordingTest.class, + ConnectionTest.class }) public class ClientTests { diff --git a/src/test/java/com/rabbitmq/client/test/ConnectionTest.java b/src/test/java/com/rabbitmq/client/test/ConnectionTest.java new file mode 100644 index 0000000000..36c1347b68 --- /dev/null +++ b/src/test/java/com/rabbitmq/client/test/ConnectionTest.java @@ -0,0 +1,127 @@ +// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.test; + +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.Connection; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.mockito.Mock; +import org.mockito.stubbing.OngoingStubbing; + +import java.io.IOException; +import java.util.NoSuchElementException; +import java.util.Optional; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.mockito.MockitoAnnotations.initMocks; + +@RunWith(Parameterized.class) +public class ConnectionTest { + + @Parameterized.Parameter + public TestConfigurator configurator; + @Mock + Connection c = mock(Connection.class); + @Mock + Channel ch = mock(Channel.class); + + @Parameterized.Parameters + public static Object[] configurators() { + return new Object[]{new NotNumberedChannelCreationCallback(), new NumberedChannelCreationCallback()}; + } + + @Before + public void init() { + initMocks(this); + } + + @Test + public void openChannelWithNonNullChannelShouldReturnNonEmptyOptional() throws Exception { + configurator.mockAndWhenChannel(c).thenReturn(ch); + configurator.mockAndWhenOptional(c).thenCallRealMethod(); + Optional optional = configurator.open(c); + assertTrue(optional.isPresent()); + assertSame(ch, optional.get()); + } + + @Test(expected = NoSuchElementException.class) + public void openChannelWithNullChannelShouldReturnEmptyOptional() throws Exception { + configurator.mockAndWhenChannel(c).thenReturn(null); + configurator.mockAndWhenOptional(c).thenCallRealMethod(); + Optional optional = configurator.open(c); + assertFalse(optional.isPresent()); + optional.get(); + } + + @Test(expected = IOException.class) + public void openChannelShouldPropagateIoException() throws Exception { + configurator.mockAndWhenChannel(c).thenThrow(IOException.class); + configurator.mockAndWhenOptional(c).thenCallRealMethod(); + configurator.open(c); + } + + interface TestConfigurator { + + OngoingStubbing mockAndWhenChannel(Connection c) throws IOException; + + OngoingStubbing> mockAndWhenOptional(Connection c) throws IOException; + + Optional open(Connection c) throws IOException; + + } + + static class NotNumberedChannelCreationCallback implements TestConfigurator { + + @Override + public OngoingStubbing mockAndWhenChannel(Connection c) throws IOException { + return when(c.createChannel()); + } + + @Override + public OngoingStubbing> mockAndWhenOptional(Connection c) throws IOException { + return when(c.openChannel()); + } + + @Override + public Optional open(Connection c) throws IOException { + return c.openChannel(); + } + } + + static class NumberedChannelCreationCallback implements TestConfigurator { + + @Override + public OngoingStubbing mockAndWhenChannel(Connection c) throws IOException { + return when(c.createChannel(1)); + } + + @Override + public OngoingStubbing> mockAndWhenOptional(Connection c) throws IOException { + return when(c.openChannel(1)); + } + + @Override + public Optional open(Connection c) throws IOException { + return c.openChannel(1); + } + } + +} From 9ef2cf8ece6b63a1010b54ebad996b823c55efbf Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Wed, 26 Dec 2018 07:35:55 -0500 Subject: [PATCH 087/328] Fix warnings in ClientVersion when amqp-client is relocated (cherry picked from commit 3f25e9f13f838fcd1547e8d1d97ff5d931630d81) --- .../com/rabbitmq/client/impl/ClientVersion.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/ClientVersion.java b/src/main/java/com/rabbitmq/client/impl/ClientVersion.java index 15c6dc6e0a..66dc662b73 100644 --- a/src/main/java/com/rabbitmq/client/impl/ClientVersion.java +++ b/src/main/java/com/rabbitmq/client/impl/ClientVersion.java @@ -28,6 +28,11 @@ public class ClientVersion { private static final Logger LOGGER = LoggerFactory.getLogger(ClientVersion.class); + // We store the version property in an unusual way because relocating the package can rewrite the key in the property + // file, which results in spurious warnings being emitted at start-up. + private static final char[] VERSION_PROPERTY = new char[] {'c', 'o', 'm', '.', 'r', 'a', 'b', 'b', 'i', 't', 'm', 'q', '.', + 'c', 'l', 'i', 'e', 'n', 't', '.', 'v', 'e', 'r', 's', 'i', 'o', 'n'}; + public static final String VERSION; static { @@ -56,10 +61,12 @@ private static final String getVersionFromPropertyFile() throws Exception { inputStream.close(); } } - if (version.getProperty("com.rabbitmq.client.version") == null) { - throw new IllegalStateException("Coulnd't find version property in property file"); + String propertyName = new String(VERSION_PROPERTY); + String versionProperty = version.getProperty(propertyName); + if (versionProperty == null) { + throw new IllegalStateException("Couldn't find version property in property file"); } - return version.getProperty("com.rabbitmq.client.version"); + return versionProperty; } private static final String getVersionFromPackage() { From 23ed9cde9b7974dc4f33e4356e568a97838ec754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 2 Jan 2019 15:54:14 +0100 Subject: [PATCH 088/328] Add link to issue in comment References #436 (cherry picked from commit 4f692fe2e2c00cb0e00a2783edef011a8f9be66e) --- src/main/java/com/rabbitmq/client/impl/ClientVersion.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/rabbitmq/client/impl/ClientVersion.java b/src/main/java/com/rabbitmq/client/impl/ClientVersion.java index 66dc662b73..dcda1072cd 100644 --- a/src/main/java/com/rabbitmq/client/impl/ClientVersion.java +++ b/src/main/java/com/rabbitmq/client/impl/ClientVersion.java @@ -30,6 +30,7 @@ public class ClientVersion { // We store the version property in an unusual way because relocating the package can rewrite the key in the property // file, which results in spurious warnings being emitted at start-up. + // see https://github.com/rabbitmq/rabbitmq-java-client/issues/436 private static final char[] VERSION_PROPERTY = new char[] {'c', 'o', 'm', '.', 'r', 'a', 'b', 'b', 'i', 't', 'm', 'q', '.', 'c', 'l', 'i', 'e', 'n', 't', '.', 'v', 'e', 'r', 's', 'i', 'o', 'n'}; From 1a7ff5e9d58cbc8d66f4079a78ed21279c7d170b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 4 Jan 2019 14:29:02 +0100 Subject: [PATCH 089/328] Bump Maven to 3.6.0 (cherry picked from commit cf65f5d1e9d29d4f959ad363a24513fb668bec4b) --- .mvn/wrapper/maven-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 6c8c0e080f..a3f9f18723 100755 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip From 5508d2cdb34e4b158b186a14054dda37a05f3d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 7 Jan 2019 09:32:54 +0100 Subject: [PATCH 090/328] Remove performance test These tests are no longer used and do not belong here. They also depend on an old version of commons-cli with some bugs and vulnerabilities. Fixes #438 (cherry picked from commit c3caa3d7a6c51f21650da6f32f6b7a0e5ed991b5) --- pom.xml | 7 - .../client/test/performance/CLIHelper.java | 81 ---- .../client/test/performance/QosScaling.java | 149 ------- .../test/performance/ScalabilityTest.java | 366 ------------------ .../test/performance/StressManagement.java | 116 ------ 5 files changed, 719 deletions(-) delete mode 100644 src/test/java/com/rabbitmq/client/test/performance/CLIHelper.java delete mode 100644 src/test/java/com/rabbitmq/client/test/performance/QosScaling.java delete mode 100644 src/test/java/com/rabbitmq/client/test/performance/ScalabilityTest.java delete mode 100644 src/test/java/com/rabbitmq/client/test/performance/StressManagement.java diff --git a/pom.xml b/pom.xml index 900f0ced38..f43a4abace 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,6 @@ 1.0.2 2.9.6 1.2.3 - 1.1 4.12 3.1.0 2.21.0 @@ -705,12 +704,6 @@ ${jackson.version} true - - commons-cli - commons-cli - ${commons-cli.version} - test - junit junit diff --git a/src/test/java/com/rabbitmq/client/test/performance/CLIHelper.java b/src/test/java/com/rabbitmq/client/test/performance/CLIHelper.java deleted file mode 100644 index 7b316efd7d..0000000000 --- a/src/test/java/com/rabbitmq/client/test/performance/CLIHelper.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. -// -// This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 -// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see -// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, -// please see LICENSE-APACHE2. -// -// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, -// either express or implied. See the LICENSE file for specific language governing -// rights and limitations of this software. -// -// If you have any questions regarding licensing, please contact us at -// info@rabbitmq.com. - - -package com.rabbitmq.client.test.performance; - -import java.util.Iterator; - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.CommandLineParser; -import org.apache.commons.cli.GnuParser; -import org.apache.commons.cli.HelpFormatter; -import org.apache.commons.cli.Option; -import org.apache.commons.cli.Options; -import org.apache.commons.cli.ParseException; - -/** - * Super class for handling repetative CLI stuff - */ -public class CLIHelper { - - private final Options options = new Options(); - - public static CLIHelper defaultHelper() { - Options opts = new Options(); - opts.addOption(new Option( "help", "print this message")); - opts.addOption(new Option("h", "host", true, "broker host")); - opts.addOption(new Option("p", "port", true, "broker port")); - return new CLIHelper(opts); - } - - public CLIHelper(Options opts) { - Iterator it = opts.getOptions().iterator(); - while (it.hasNext()) { - options.addOption((Option) it.next()); - } - } - - public void addOption(Option option) { - options.addOption(option); - } - - public CommandLine parseCommandLine(String [] args) { - CommandLineParser parser = new GnuParser(); - CommandLine commandLine = null; - try { - commandLine = parser.parse(options, args); - } - catch (ParseException e) { - printHelp(options); - throw new RuntimeException("Parsing failed. Reason: " + e.getMessage()); - } - - if (commandLine.hasOption("help")) { - printHelp(options); - return null; - } - return commandLine; - } - - public void printHelp(Options options) { - HelpFormatter formatter = new HelpFormatter(); - formatter.printHelp(getClass().getSimpleName(), options); - } - - public static int getOptionValue(CommandLine cmd, String s, int i) { - return Integer.parseInt(cmd.getOptionValue(s, i + "")); - } -} diff --git a/src/test/java/com/rabbitmq/client/test/performance/QosScaling.java b/src/test/java/com/rabbitmq/client/test/performance/QosScaling.java deleted file mode 100644 index 8e70d9f62b..0000000000 --- a/src/test/java/com/rabbitmq/client/test/performance/QosScaling.java +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. -// -// This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 -// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see -// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, -// please see LICENSE-APACHE2. -// -// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, -// either express or implied. See the LICENSE file for specific language governing -// rights and limitations of this software. -// -// If you have any questions regarding licensing, please contact us at -// info@rabbitmq.com. - - -package com.rabbitmq.client.test.performance; - -import com.rabbitmq.client.AMQP; -import com.rabbitmq.client.Channel; -import com.rabbitmq.client.Connection; -import com.rabbitmq.client.ConnectionFactory; -import com.rabbitmq.client.QueueingConsumer; - -import com.rabbitmq.client.test.TestUtils; -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.Option; - -import java.io.IOException; -import java.util.List; -import java.util.ArrayList; -import java.util.concurrent.TimeoutException; - -public class QosScaling { - - protected static class Parameters { - final String host; - final int port; - final int messageCount; - final int queueCount; - final int emptyCount; - - public static CommandLine parseCommandLine(String[] args) { - CLIHelper helper = CLIHelper.defaultHelper(); - helper.addOption(new Option("n", "messages", true, "number of messages to send")); - helper.addOption(new Option("q", "queues", true, "number of queues to route messages to")); - helper.addOption(new Option("e", "empty", true, "number of queues to leave empty")); - return helper.parseCommandLine(args); - } - - public Parameters(CommandLine cmd) { - host = cmd.getOptionValue("h", "localhost"); - port = CLIHelper.getOptionValue(cmd, "p", AMQP.PROTOCOL.PORT); - messageCount = CLIHelper.getOptionValue(cmd, "n", 2000); - queueCount = CLIHelper.getOptionValue(cmd, "q", 100); - emptyCount = CLIHelper.getOptionValue(cmd, "e", 0); - } - - public String toString() { - StringBuilder b = new StringBuilder(); - b.append("host=" + host); - b.append(",port=" + port); - b.append(",messages=" + messageCount); - b.append(",queues=" + queueCount); - b.append(",empty=" + emptyCount); - return b.toString(); - } - - } - - protected final Parameters params; - protected final ConnectionFactory connectionFactory = TestUtils.connectionFactory(); - protected Connection connection; - protected Channel channel; - - public QosScaling(Parameters p) { - params = p; - } - - protected List consume(QueueingConsumer c) throws IOException { - for (int i = 0; i < params.emptyCount; i++) { - String queue = channel.queueDeclare().getQueue(); - channel.basicConsume(queue, false, c); - } - List queues = new ArrayList(); - for (int i = 0; i < params.queueCount; i++) { - String queue = channel.queueDeclare().getQueue(); - channel.basicConsume(queue, false, c); - queues.add(queue); - } - return queues; - } - - protected void publish(List queues) throws IOException { - byte[] body = "".getBytes(); - int messagesPerQueue = params.messageCount / queues.size(); - for (String queue : queues) { - for (int i = 0; i < messagesPerQueue; i++) { - channel.basicPublish("", queue, null, body); - } - } - //ensure that all the messages have reached the queues - for (String queue : queues) { - channel.queueDeclarePassive(queue); - } - } - - protected long drain(QueueingConsumer c) throws IOException { - long start = System.nanoTime(); - try { - for (int i = 0; i < params.messageCount; i++) { - long tag = c.nextDelivery().getEnvelope().getDeliveryTag(); - channel.basicAck(tag, false); - } - } catch (InterruptedException e) { - IOException ioe = new IOException(); - ioe.initCause(e); - throw ioe; - } - long finish = System.nanoTime(); - return finish - start; - } - - public long run() throws IOException, TimeoutException { - connectionFactory.setHost(params.host); - connectionFactory.setPort(params.port); - connection = connectionFactory.newConnection(); - channel = connection.createChannel(); - channel.basicQos(1); - QueueingConsumer consumer = new QueueingConsumer(channel); - try { - publish(consume(consumer)); - return drain(consumer); - } finally { - connection.abort(); - } - } - - public static void main(String[] args) throws Exception { - CommandLine cmd = Parameters.parseCommandLine(args); - if (cmd == null) return; - Parameters params = new Parameters(cmd); - System.out.print(params.toString()); - QosScaling test = new QosScaling(params); - long result = test.run(); - System.out.println(" -> " + result / 1000000 + "ms"); - } - -} diff --git a/src/test/java/com/rabbitmq/client/test/performance/ScalabilityTest.java b/src/test/java/com/rabbitmq/client/test/performance/ScalabilityTest.java deleted file mode 100644 index 5445ffcb05..0000000000 --- a/src/test/java/com/rabbitmq/client/test/performance/ScalabilityTest.java +++ /dev/null @@ -1,366 +0,0 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. -// -// This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 -// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see -// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, -// please see LICENSE-APACHE2. -// -// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, -// either express or implied. See the LICENSE file for specific language governing -// rights and limitations of this software. -// -// If you have any questions regarding licensing, please contact us at -// info@rabbitmq.com. - - -package com.rabbitmq.client.test.performance; - -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.text.DecimalFormat; -import java.text.NumberFormat; -import java.util.Random; -import java.util.Stack; -import java.util.UUID; -import java.util.Vector; -import java.util.concurrent.CountDownLatch; - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.Option; - -import com.rabbitmq.client.AMQP; -import com.rabbitmq.client.Channel; -import com.rabbitmq.client.Connection; -import com.rabbitmq.client.ConnectionFactory; -import com.rabbitmq.client.MessageProperties; -import com.rabbitmq.client.ReturnListener; - -/** - * This tests the scalability of the routing tables in two aspects: - * - * 1. The rate of creation and deletion for a fixed level of bindings - * per queue accross varying amounts of queues; - * - * 2. The rate of publishing n messages to an exchange with a fixed - * amount of bindings per queue accross varying amounts of queues. - */ -public class ScalabilityTest { - - private static class Parameters { - String host; - int port; - int messageCount; - int base, maxQueueExp, maxBindingExp, maxExp; - String filePrefix; - - } - - private abstract static class Measurements { - - protected final long[] times; - private final long start; - - public Measurements(final int count) { - times = new long[count]; - start = System.nanoTime(); - } - - public void addDataPoint(final int i) { - times[i] = System.nanoTime() - start; - } - - abstract public float[] analyse(final int base); - - protected static float[] calcOpTimes(final int base, final long[] t) { - float[] r = new float[t.length]; - for (int i = 0; i < t.length; i ++) { - final int amount = pow(base, i); - r[i] = t[i] / (float) amount / 1000; - } - - return r; - } - - } - - private static class CreationMeasurements extends Measurements { - - public CreationMeasurements(final int count) { - super(count); - } - - public float[] analyse(final int base) { - return calcOpTimes(base, times); - } - - } - - private static class DeletionMeasurements extends Measurements { - - public DeletionMeasurements(final int count) { - super(count); - } - - public float[] analyse(final int base) { - final long tmp[] = new long[times.length]; - final long totalTime = times[0]; - int i; - for (i = 0; i < times.length - 1; i++) { - tmp[i] = totalTime - times[i + 1]; - } - tmp[i] = totalTime; - - return calcOpTimes(base, tmp); - } - - } - - private static class Results { - - final float[][] creationTimes; - final float[][] deletionTimes; - final float[][] routingTimes; - - public Results(final int y) { - creationTimes = new float[y][]; - deletionTimes = new float[y][]; - routingTimes = new float[y][]; - } - - public void print(final int base, final String prefix) - throws IOException { - - PrintStream s; - s = open(prefix, "creation"); - print(s, base, creationTimes); - s.close(); - s = open(prefix, "deletion"); - print(s, base, deletionTimes); - s.close(); - s = open(prefix, "routing"); - print(s, base, transpose(routingTimes)); - s.close(); - } - - private static PrintStream open(final String prefix, - final String suffix) - throws IOException { - - return new PrintStream(new FileOutputStream(prefix + suffix + - ".dat")); - } - - private static void print(final PrintStream s, final int base, - final float[][] times) { - for (int y = 0; y < times.length; y++) { - s.println("# level " + pow(base, y)); - for (int x = 0; x < times[y].length; x++) { - s.println(pow(base, x) + " " + format.format(times[y][x])); - } - s.println(); - s.println(); - } - } - - private float[][] transpose(float[][] m) { - Vector> tmp = new Vector>(); - for (int i = 0; i < m[0].length; i++) { - tmp.addElement(new Vector()); - } - for (int i = 0; i < m.length; i++) { - for (int j = 0; j < m[i].length; j++) { - Vector v = tmp.get(j); - v.addElement(m[i][j]); - } - } - float[][] r = new float[tmp.size()][]; - for (int i = 0; i < tmp.size(); i++) { - Vector v = tmp.get(i); - float[] vr = new float[v.size()]; - for (int j = 0; j < v.size(); j++) { - vr[j] = v.get(j); - } - r[i] = vr; - } - return r; - } - } - - private static final NumberFormat format = new DecimalFormat("0.00"); - - private final Parameters params; - - public ScalabilityTest(Parameters p) { - params = p; - } - - public static void main(String[] args) throws Exception { - Parameters params = parseArgs(args); - if (params == null) return; - - ScalabilityTest test = new ScalabilityTest(params); - Results r = test.run(); - if (params.filePrefix != null) - r.print(params.base, params.filePrefix); - } - - - public Results run() throws Exception{ - Connection con = new ConnectionFactory(){{setHost(params.host); setPort(params.port);}}.newConnection(); - Channel channel = con.createChannel(); - - Results r = new Results(params.maxBindingExp); - - for (int y = 0; y < params.maxBindingExp; y++) { - - final int maxBindings = pow(params.base, y); - - String[] routingKeys = new String[maxBindings]; - for (int b = 0; b < maxBindings; b++) { - routingKeys[b] = UUID.randomUUID().toString(); - } - - Stack queues = new Stack(); - - int maxQueueExp = Math.min(params.maxQueueExp, params.maxExp - y); - - System.out.println("---------------------------------"); - System.out.println("| bindings = " + maxBindings + ", messages = " + params.messageCount); - - System.out.println("| Routing"); - - int q = 0; - - // create queues & bindings, time routing - Measurements creation = new CreationMeasurements(maxQueueExp); - float routingTimes[] = new float[maxQueueExp]; - for (int x = 0; x < maxQueueExp; x++) { - - final int maxQueues = pow(params.base, x); - - for (; q < maxQueues; q++) { - AMQP.Queue.DeclareOk ok = channel.queueDeclare(); - queues.push(ok.getQueue()); - for (int b = 0; b < maxBindings; b++) { - channel.queueBind(ok.getQueue(), "amq.direct", routingKeys[b]); - } - } - - creation.addDataPoint(x); - - float routingTime = timeRouting(channel, routingKeys); - routingTimes[x] = routingTime; - printTime(params.base, x, routingTime); - } - - r.routingTimes[y] = routingTimes; - float[] creationTimes = creation.analyse(params.base); - r.creationTimes[y] = creationTimes; - System.out.println("| Creating"); - printTimes(params.base, creationTimes); - - // delete queues & bindings - Measurements deletion = new DeletionMeasurements(maxQueueExp); - for (int x = maxQueueExp - 1; x >= 0; x--) { - - final int maxQueues = (x == 0) ? 0 : pow(params.base, x - 1); - - for (; q > maxQueues; q--) { - channel.queueDelete(queues.pop()); - } - - deletion.addDataPoint(x); - } - - float[] deletionTimes = deletion.analyse(params.base); - r.deletionTimes[y] = deletionTimes; - System.out.println("| Deleting"); - printTimes(params.base, deletionTimes); - } - - channel.close(); - con.close(); - - return r; - } - - private float timeRouting(Channel channel, String[] routingKeys) - throws IOException, InterruptedException { - - boolean mandatory = true; - boolean immdediate = true; - final CountDownLatch latch = new CountDownLatch(params.messageCount); - channel.addReturnListener(new ReturnListener() { - public void handleReturn(int replyCode, String replyText, - String exchange, String routingKey, - AMQP.BasicProperties properties, byte[] body) throws IOException { - latch.countDown(); - } - }); - - final long start = System.nanoTime(); - - // route some messages - Random r = new Random(); - int size = routingKeys.length; - for (int n = 0; n < params.messageCount; n ++) { - String key = routingKeys[r.nextInt(size)]; - channel.basicPublish("amq.direct", key, true, false, - MessageProperties.MINIMAL_BASIC, null); - } - - // wait for the returns to come back - latch.await(); - - // Compute the roundtrip time - final long finish = System.nanoTime(); - final long wallclock = finish - start; - return (params.messageCount == 0) ? (float)0.0 : wallclock / (float) params.messageCount / 1000; - } - - private static Parameters parseArgs(String [] args) { - CLIHelper helper = CLIHelper.defaultHelper(); - - helper.addOption(new Option("n", "messages", true, "number of messages to send")); - helper.addOption(new Option("b", "base", true, "base for exponential scaling")); - helper.addOption(new Option("x", "q-max-exp", true, "maximum queue count exponent")); - helper.addOption(new Option("y", "b-max-exp", true, "maximum per-queue binding count exponent")); - helper.addOption(new Option("c", "c-max-exp", true, "combined maximum exponent")); - helper.addOption(new Option("f", "file", true, "result files prefix; defaults to no file output")); - - CommandLine cmd = helper.parseCommandLine(args); - if (null == cmd) return null; - - Parameters params = new Parameters(); - params.host = cmd.getOptionValue("h", "0.0.0.0"); - params.port = CLIHelper.getOptionValue(cmd, "p", AMQP.PROTOCOL.PORT); - params.messageCount = CLIHelper.getOptionValue(cmd, "n", 100); - params.base = CLIHelper.getOptionValue(cmd, "b", 10); - params.maxQueueExp = CLIHelper.getOptionValue(cmd, "x", 4); - params.maxBindingExp = CLIHelper.getOptionValue(cmd, "y", 4); - params.maxExp = CLIHelper.getOptionValue(cmd, "c", Math.max(params.maxQueueExp, params.maxBindingExp)); - params.filePrefix = cmd.getOptionValue("f", null); - - return params; - } - - private static int pow(int x, int y) { - int r = 1; - for( int i = 0; i < y; i++ ) r *= x; - return r; - } - - private static void printTimes(int base, float[] times) { - for (int i = 0; i < times.length; i ++) { - printTime(base, i, times[i]); - } - } - - private static void printTime(int base, int exp, float v) { - System.out.println("| " + pow(base, exp) + - " -> " + format.format(v) + " us/op"); - } - -} diff --git a/src/test/java/com/rabbitmq/client/test/performance/StressManagement.java b/src/test/java/com/rabbitmq/client/test/performance/StressManagement.java deleted file mode 100644 index 32937c07ad..0000000000 --- a/src/test/java/com/rabbitmq/client/test/performance/StressManagement.java +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. -// -// This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 -// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see -// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, -// please see LICENSE-APACHE2. -// -// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, -// either express or implied. See the LICENSE file for specific language governing -// rights and limitations of this software. -// -// If you have any questions regarding licensing, please contact us at -// info@rabbitmq.com. - -package com.rabbitmq.client.test.performance; - -import com.rabbitmq.client.AMQP; -import com.rabbitmq.client.Channel; -import com.rabbitmq.client.Connection; -import com.rabbitmq.client.ConnectionFactory; -import com.rabbitmq.client.MessageProperties; -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.Option; - -import java.io.IOException; -import java.util.concurrent.TimeoutException; - -public class StressManagement { - protected static class Parameters { - final String host; - final int port; - final int queueCount; - final int channelCount; - - public static CommandLine parseCommandLine(String[] args) { - CLIHelper helper = CLIHelper.defaultHelper(); - helper.addOption(new Option("q", "queues", true, "number of queues")); - helper.addOption(new Option("c", "channels", true, "number of channels")); - return helper.parseCommandLine(args); - } - - public Parameters(CommandLine cmd) { - host = cmd.getOptionValue("h", "localhost"); - port = CLIHelper.getOptionValue(cmd, "p", AMQP.PROTOCOL.PORT); - queueCount = CLIHelper.getOptionValue(cmd, "q", 5000); - channelCount = CLIHelper.getOptionValue(cmd, "c", 100); - } - - public String toString() { - StringBuilder b = new StringBuilder(); - b.append("host=" + host); - b.append(",port=" + port); - b.append(",queues=" + queueCount); - b.append(",channels=" + channelCount); - return b.toString(); - } - - } - - protected final Parameters params; - protected final ConnectionFactory connectionFactory = - new ConnectionFactory(); - protected Connection connection; - protected Channel publishChannel; - protected Channel[] channels; - - public StressManagement(Parameters p) { - params = p; - } - - public long run() throws IOException, TimeoutException { - connectionFactory.setHost(params.host); - connectionFactory.setPort(params.port); - connection = connectionFactory.newConnection(); - publishChannel = connection.createChannel(); - - System.out.println("Declaring..."); - - channels = new Channel[params.channelCount]; - for (int i = 0; i < params.channelCount; i++) { - channels[i] = connection.createChannel(); - } - - for (int i = 0; i < params.queueCount; i++) { - publishChannel.queueDeclare("queue-" + i, false, true, false, null); - publishChannel.queueBind("queue-" + i, "amq.fanout", ""); - } - - System.out.println("Declaration complete, running..."); - - while (true) { - for (int i = 0; i < params.channelCount; i++) { - publishChannel.basicPublish("amq.fanout", "", MessageProperties.BASIC, "".getBytes()); - for (int j = 0; j < params.queueCount; j++) { - while (channels[i].basicGet("queue-" + j, true) == null) { - try { - Thread.sleep(10); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - } - } - } - } - } - - public static void main(String[] args) throws Exception { - CommandLine cmd = Parameters.parseCommandLine(args); - if (cmd == null) return; - Parameters params = new Parameters(cmd); - System.out.println(params.toString()); - StressManagement test = new StressManagement(params); - test.run(); - } -} From abcefaff0cc870f685485991e6b0756ff866d8df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 14 Jan 2019 17:47:08 +0100 Subject: [PATCH 091/328] Set current year in copyright (cherry picked from commit 618bdb841219bddd0a7b679b80269fc511f7e4a6) --- src/main/java/com/rabbitmq/client/impl/AMQConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java index 25b18d0750..d65008d96a 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java @@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicBoolean; final class Copyright { - final static String COPYRIGHT="Copyright (c) 2007-2018 Pivotal Software, Inc."; + final static String COPYRIGHT="Copyright (c) 2007-2019 Pivotal Software, Inc."; final static String LICENSE="Licensed under the MPL. See http://www.rabbitmq.com/"; } From eed81cb2023f04c2094b4a243b295b8c635a5607 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Thu, 17 Jan 2019 18:50:07 +0300 Subject: [PATCH 092/328] Bump Jackson dependency to 2.9.8 Addresses a number of CVEs that affect versions from 2.9.0 through 2.9.7, inclusive. (cherry picked from commit 13c786d497bbad29fc3b23c7ce9735c786004da1) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f43a4abace..e5d62dff82 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ 1.7.25 3.2.6 1.0.2 - 2.9.6 + 2.9.8 1.2.3 4.12 3.1.0 From 16e3848807fee91af5ec8a78d6cefa455dabf0f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 22 Jan 2019 15:19:15 +0100 Subject: [PATCH 093/328] Fix Mockito test on Java 13 (cherry picked from commit 7865c1032f93e3a3761aa28ccb4dee99fc711e24) --- pom.xml | 4 ++-- .../com/rabbitmq/client/test/ConnectionTest.java | 7 ++++++- src/test/resources/log4j2-test.properties | 12 ++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 src/test/resources/log4j2-test.properties diff --git a/pom.xml b/pom.xml index e5d62dff82..55e8367b79 100644 --- a/pom.xml +++ b/pom.xml @@ -60,8 +60,8 @@ 2.9.8 1.2.3 4.12 - 3.1.0 - 2.21.0 + 3.1.5 + 2.23.4 3.0.1 2.5.3 diff --git a/src/test/java/com/rabbitmq/client/test/ConnectionTest.java b/src/test/java/com/rabbitmq/client/test/ConnectionTest.java index 36c1347b68..85dc789130 100644 --- a/src/test/java/com/rabbitmq/client/test/ConnectionTest.java +++ b/src/test/java/com/rabbitmq/client/test/ConnectionTest.java @@ -39,7 +39,7 @@ public class ConnectionTest { @Parameterized.Parameter public TestConfigurator configurator; @Mock - Connection c = mock(Connection.class); + MyConnection c = mock(MyConnection.class); @Mock Channel ch = mock(Channel.class); @@ -124,4 +124,9 @@ public Optional open(Connection c) throws IOException { } } + // trick to make Mockito call the optional method defined in the interface + static abstract class MyConnection implements Connection { + + } + } diff --git a/src/test/resources/log4j2-test.properties b/src/test/resources/log4j2-test.properties new file mode 100644 index 0000000000..b7e0a68699 --- /dev/null +++ b/src/test/resources/log4j2-test.properties @@ -0,0 +1,12 @@ +status = error +dest = err +name = PropertiesConfig + +appender.console.type = Console +appender.console.name = STDOUT +appender.console.layout.type = PatternLayout +appender.console.layout.pattern = %m%n + +logger.com.rabbitmq.level = info +rootLogger.level = error +rootLogger.appenderRef.stdout.ref = STDOUT \ No newline at end of file From ef34291536e8f11582ff6b36afc63310e88af834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 22 Jan 2019 15:21:08 +0100 Subject: [PATCH 094/328] Bump test dependencies (cherry picked from commit 46ef9bd756528a99403497f5b22dbe11b275f8db) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 55e8367b79..b04ee5a37f 100644 --- a/pom.xml +++ b/pom.xml @@ -73,8 +73,8 @@ 1.5 1.12 3.6.1 - 2.19.1 - 2.19.1 + 2.22.1 + 2.22.1 1.6 3.0.2 3.2.0 From 5c602ee882abbffdc3ae3be5b2862570ff376900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 22 Jan 2019 15:26:25 +0100 Subject: [PATCH 095/328] Bump Micrometer to 1.1.2 and Metrics to 4.0.5 (cherry picked from commit b3ef95b0dcd57d7e42454ab5f41663818ca57f21) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index b04ee5a37f..6c442ddf64 100644 --- a/pom.xml +++ b/pom.xml @@ -55,8 +55,8 @@ UTF-8 1.7.25 - 3.2.6 - 1.0.2 + 4.0.5 + 1.1.2 2.9.8 1.2.3 4.12 From d7aad18013cdb37bba60675b6e4dc23cdce885e6 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Wed, 23 Jan 2019 09:57:05 +0000 Subject: [PATCH 096/328] [maven-release-plugin] prepare release v5.6.0.RC1 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 6c442ddf64..320a029f0d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.6.0-SNAPSHOT + 5.6.0.RC1 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.6.0.RC1 From 93d001a42567b5bacb79cacfb4c5b1477ff11be1 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Wed, 23 Jan 2019 09:57:12 +0000 Subject: [PATCH 097/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 320a029f0d..6c442ddf64 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.6.0.RC1 + 5.6.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.6.0.RC1 + HEAD From 2f864fbcfa020bc7c25a79da653d5ee288eadddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 23 Jan 2019 11:08:43 +0100 Subject: [PATCH 098/328] Set release version to 5.6.0.RC2 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index 5d615855c5..cd28c46dcd 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,2 +1,2 @@ -RELEASE_VERSION="5.6.0.RC1" +RELEASE_VERSION="5.6.0.RC2" DEVELOPMENT_VERSION="5.6.0-SNAPSHOT" From ca0835505861f0c0edc7c3588cbfd5b5bd69c19c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 25 Jan 2019 09:17:36 +0100 Subject: [PATCH 099/328] Set release version to 5.6.0 --- release-versions.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release-versions.txt b/release-versions.txt index cd28c46dcd..4058557c01 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,2 +1,2 @@ -RELEASE_VERSION="5.6.0.RC2" -DEVELOPMENT_VERSION="5.6.0-SNAPSHOT" +RELEASE_VERSION="5.6.0" +DEVELOPMENT_VERSION="5.6.1-SNAPSHOT" From b72aa53f2684c5034b0104e3402788c3b20bd68a Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 25 Jan 2019 08:19:50 +0000 Subject: [PATCH 100/328] [maven-release-plugin] prepare release v5.6.0 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 6c442ddf64..407c6c5593 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.6.0-SNAPSHOT + 5.6.0 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.6.0 From 152bf81438faf980070257316675651cc7a35aab Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 25 Jan 2019 08:19:55 +0000 Subject: [PATCH 101/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 407c6c5593..8fa0ca4777 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.6.0 + 5.6.1-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.6.0 + HEAD From 385342459d4228803334ea22367df89f8ef8cbd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 25 Jan 2019 09:24:52 +0100 Subject: [PATCH 102/328] Set release version to 5.7.0.RC1 --- pom.xml | 2 +- release-versions.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 8fa0ca4777..e165d34bde 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.6.1-SNAPSHOT + 5.7.0-SNAPSHOT jar RabbitMQ Java Client diff --git a/release-versions.txt b/release-versions.txt index 4058557c01..94a66eae2b 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,2 +1,2 @@ -RELEASE_VERSION="5.6.0" -DEVELOPMENT_VERSION="5.6.1-SNAPSHOT" +RELEASE_VERSION="5.7.0.RC1" +DEVELOPMENT_VERSION="5.7.0-SNAPSHOT" From 68d55d19fb1906e87b2aa3a82b88dc0b7140476b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 25 Jan 2019 09:55:41 +0100 Subject: [PATCH 103/328] Fix Javadoc Fix a broken reference to a method, add 8 to fix build on Java 11, replace package.html by package-info.java. (cherry picked from commit 7abd20c8bfa3be9182c1bc869f488e9eb0f90d14) --- pom.xml | 4 ++++ src/main/java/com/rabbitmq/client/RpcClientParams.java | 2 +- .../com/rabbitmq/client/impl/nio/package-info.java | 4 ++++ .../java/com/rabbitmq/client/impl/package-info.java | 4 ++++ src/main/java/com/rabbitmq/client/impl/package.html | 9 --------- .../rabbitmq/client/impl/recovery/package-info.java | 4 ++++ src/main/java/com/rabbitmq/client/package-info.java | 5 +++++ src/main/java/com/rabbitmq/client/package.html | 10 ---------- .../java/com/rabbitmq/tools/json/package-info.java | 4 ++++ src/main/java/com/rabbitmq/tools/json/package.html | 9 --------- .../java/com/rabbitmq/tools/jsonrpc/package-info.java | 4 ++++ src/main/java/com/rabbitmq/tools/jsonrpc/package.html | 9 --------- src/main/java/com/rabbitmq/tools/package-info.java | 4 ++++ src/main/java/com/rabbitmq/tools/package.html | 9 --------- src/main/java/com/rabbitmq/utility/package-info.java | 4 ++++ src/main/java/com/rabbitmq/utility/package.html | 9 --------- 16 files changed, 38 insertions(+), 56 deletions(-) create mode 100644 src/main/java/com/rabbitmq/client/impl/nio/package-info.java create mode 100644 src/main/java/com/rabbitmq/client/impl/package-info.java delete mode 100644 src/main/java/com/rabbitmq/client/impl/package.html create mode 100644 src/main/java/com/rabbitmq/client/impl/recovery/package-info.java create mode 100644 src/main/java/com/rabbitmq/client/package-info.java delete mode 100644 src/main/java/com/rabbitmq/client/package.html create mode 100644 src/main/java/com/rabbitmq/tools/json/package-info.java delete mode 100644 src/main/java/com/rabbitmq/tools/json/package.html create mode 100644 src/main/java/com/rabbitmq/tools/jsonrpc/package-info.java delete mode 100644 src/main/java/com/rabbitmq/tools/jsonrpc/package.html create mode 100644 src/main/java/com/rabbitmq/tools/package-info.java delete mode 100644 src/main/java/com/rabbitmq/tools/package.html create mode 100644 src/main/java/com/rabbitmq/utility/package-info.java delete mode 100644 src/main/java/com/rabbitmq/utility/package.html diff --git a/pom.xml b/pom.xml index e165d34bde..0fe97c7b4d 100644 --- a/pom.xml +++ b/pom.xml @@ -504,6 +504,7 @@ ${javadoc.opts} ${javadoc.joption} true + 8 @@ -557,6 +558,7 @@ ${javadoc.opts} ${javadoc.joption} true + 8 @@ -611,6 +613,7 @@ ${javadoc.opts} ${javadoc.joption} true + 8 @@ -1001,6 +1004,7 @@ ${javadoc.opts} ${javadoc.joption} true + 8 diff --git a/src/main/java/com/rabbitmq/client/RpcClientParams.java b/src/main/java/com/rabbitmq/client/RpcClientParams.java index 0831ebb4b3..ce046a6cb6 100644 --- a/src/main/java/com/rabbitmq/client/RpcClientParams.java +++ b/src/main/java/com/rabbitmq/client/RpcClientParams.java @@ -146,7 +146,7 @@ public RpcClientParams timeout(int timeout) { * * @param useMandatory * @return - * @see #replyHandler(Function) + * @see #replyHandler(RpcClient.RpcClientReplyHandler) */ public RpcClientParams useMandatory(boolean useMandatory) { this.useMandatory = useMandatory; diff --git a/src/main/java/com/rabbitmq/client/impl/nio/package-info.java b/src/main/java/com/rabbitmq/client/impl/nio/package-info.java new file mode 100644 index 0000000000..9d6f23e3cb --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/nio/package-info.java @@ -0,0 +1,4 @@ +/** + * NIO network connector. + */ +package com.rabbitmq.client.impl.nio; \ No newline at end of file diff --git a/src/main/java/com/rabbitmq/client/impl/package-info.java b/src/main/java/com/rabbitmq/client/impl/package-info.java new file mode 100644 index 0000000000..4b22e82833 --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/package-info.java @@ -0,0 +1,4 @@ +/** + * Implementations of interfaces specified in the client API, and their supporting classes. + */ +package com.rabbitmq.client.impl; \ No newline at end of file diff --git a/src/main/java/com/rabbitmq/client/impl/package.html b/src/main/java/com/rabbitmq/client/impl/package.html deleted file mode 100644 index 20ff0ce857..0000000000 --- a/src/main/java/com/rabbitmq/client/impl/package.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - - -Implementations of interfaces specified in the client API, and their supporting classes. - - - diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/package-info.java b/src/main/java/com/rabbitmq/client/impl/recovery/package-info.java new file mode 100644 index 0000000000..d1432bdcf6 --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/recovery/package-info.java @@ -0,0 +1,4 @@ +/** + * Implementation of connection and topology recovery. + */ +package com.rabbitmq.client.impl.recovery; \ No newline at end of file diff --git a/src/main/java/com/rabbitmq/client/package-info.java b/src/main/java/com/rabbitmq/client/package-info.java new file mode 100644 index 0000000000..c231093c21 --- /dev/null +++ b/src/main/java/com/rabbitmq/client/package-info.java @@ -0,0 +1,5 @@ +/** + * The client API proper: classes and interfaces representing the AMQP + * connections, channels, and wire-protocol framing descriptors. + */ +package com.rabbitmq.client; \ No newline at end of file diff --git a/src/main/java/com/rabbitmq/client/package.html b/src/main/java/com/rabbitmq/client/package.html deleted file mode 100644 index 3a190d8770..0000000000 --- a/src/main/java/com/rabbitmq/client/package.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - -The client API proper: classes and interfaces representing the AMQP -connections, channels, and wire-protocol framing descriptors. - - - diff --git a/src/main/java/com/rabbitmq/tools/json/package-info.java b/src/main/java/com/rabbitmq/tools/json/package-info.java new file mode 100644 index 0000000000..0a7d76e65f --- /dev/null +++ b/src/main/java/com/rabbitmq/tools/json/package-info.java @@ -0,0 +1,4 @@ +/** + * JSON reader/writer and utility classes. + */ +package com.rabbitmq.tools.json; \ No newline at end of file diff --git a/src/main/java/com/rabbitmq/tools/json/package.html b/src/main/java/com/rabbitmq/tools/json/package.html deleted file mode 100644 index 625fed317f..0000000000 --- a/src/main/java/com/rabbitmq/tools/json/package.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - - -JSON reader/writer and utility classes. - - - diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/package-info.java b/src/main/java/com/rabbitmq/tools/jsonrpc/package-info.java new file mode 100644 index 0000000000..4cc7826c55 --- /dev/null +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/package-info.java @@ -0,0 +1,4 @@ +/** + * JSON-RPC client and server classes for supporting JSON-RPC over an AMQP transport. + */ +package com.rabbitmq.tools.jsonrpc; \ No newline at end of file diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/package.html b/src/main/java/com/rabbitmq/tools/jsonrpc/package.html deleted file mode 100644 index 04a156cced..0000000000 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/package.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - - -JSON-RPC client and server classes for supporting JSON-RPC over an AMQP transport. - - - diff --git a/src/main/java/com/rabbitmq/tools/package-info.java b/src/main/java/com/rabbitmq/tools/package-info.java new file mode 100644 index 0000000000..2b8be98550 --- /dev/null +++ b/src/main/java/com/rabbitmq/tools/package-info.java @@ -0,0 +1,4 @@ +/** + * Non-core utilities and administration tools. + */ +package com.rabbitmq.tools; \ No newline at end of file diff --git a/src/main/java/com/rabbitmq/tools/package.html b/src/main/java/com/rabbitmq/tools/package.html deleted file mode 100644 index d9972631c5..0000000000 --- a/src/main/java/com/rabbitmq/tools/package.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - - -Non-core utilities and administration tools. - - - diff --git a/src/main/java/com/rabbitmq/utility/package-info.java b/src/main/java/com/rabbitmq/utility/package-info.java new file mode 100644 index 0000000000..9ae72725af --- /dev/null +++ b/src/main/java/com/rabbitmq/utility/package-info.java @@ -0,0 +1,4 @@ +/** + * Utility package of helper classes, mostly used in the implementation code. + */ +package com.rabbitmq.utility; \ No newline at end of file diff --git a/src/main/java/com/rabbitmq/utility/package.html b/src/main/java/com/rabbitmq/utility/package.html deleted file mode 100644 index 6a0ca1e0d0..0000000000 --- a/src/main/java/com/rabbitmq/utility/package.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - - -Utility package of helper classes, mostly used in the implementation code. - - - From 9335d456400fd4e957733c952cef05a984da67d5 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Tue, 12 Feb 2019 00:36:10 -0500 Subject: [PATCH 104/328] spelling: concurrency (cherry picked from commit 434ee8b726a084ff858ffee469415d94c4aa057f) --- src/main/java/com/rabbitmq/utility/IntAllocator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/utility/IntAllocator.java b/src/main/java/com/rabbitmq/utility/IntAllocator.java index b0f25075b7..6032a4dcc8 100644 --- a/src/main/java/com/rabbitmq/utility/IntAllocator.java +++ b/src/main/java/com/rabbitmq/utility/IntAllocator.java @@ -23,7 +23,7 @@ * {@link BitSet} representation of the free integers. *

* - *

Concurrecy Semantics:

+ *

Concurrency Semantics:

* This class is not thread safe. * *

Implementation notes:

From 226b3323b404dd64063385804e32c11abce0a264 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Tue, 12 Feb 2019 00:36:26 -0500 Subject: [PATCH 105/328] spelling: connection (cherry picked from commit fe751963719d122567d31ac9014f839356023a56) --- src/main/java/com/rabbitmq/client/impl/ChannelN.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/client/impl/ChannelN.java b/src/main/java/com/rabbitmq/client/impl/ChannelN.java index 17bee9ffe7..aea0ee7a4b 100644 --- a/src/main/java/com/rabbitmq/client/impl/ChannelN.java +++ b/src/main/java/com/rabbitmq/client/impl/ChannelN.java @@ -602,7 +602,7 @@ public AMQCommand transformReply(AMQCommand command) { boolean notify = false; try { // Synchronize the block below to avoid race conditions in case - // connnection wants to send Connection-CloseOK + // connection wants to send Connection-CloseOK synchronized (_channelMutex) { startProcessShutdownSignal(signal, !initiatedByApplication, true); quiescingRpc(reason, k); From e597202213b500a04344bb75a56e0f06bd85de39 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Tue, 12 Feb 2019 00:41:49 -0500 Subject: [PATCH 106/328] spelling: exchange (cherry picked from commit 74a7b39295238400b5c7182c5cba06c6fb546cf1) --- .../rabbitmq/client/test/functional/AlternateExchange.java | 2 +- .../com/rabbitmq/client/test/functional/BindingLifecycle.java | 2 +- .../rabbitmq/client/test/server/DurableBindingLifecycle.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/functional/AlternateExchange.java b/src/test/java/com/rabbitmq/client/test/functional/AlternateExchange.java index b408cffca0..242e95032b 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/AlternateExchange.java +++ b/src/test/java/com/rabbitmq/client/test/functional/AlternateExchange.java @@ -96,7 +96,7 @@ public void handleReturn(int replyCode, * * @param name the name of the exchange to be created, and queue * to be bound - * @param ae the name of the alternate-exchage + * @param ae the name of the alternate-exchange */ protected void setupRouting(String name, String ae) throws IOException { Map args = new HashMap(); diff --git a/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycle.java b/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycle.java index 0090d40a45..363bfaebf1 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycle.java +++ b/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycle.java @@ -153,7 +153,7 @@ public class BindingLifecycle extends BindingLifecycleBase { * The unsubscribe should cause the queue to auto_delete, which in * turn should cause the exchange to auto_delete. * - * Then re-declare the queue again and try to rebind it to the same exhange. + * Then re-declare the queue again and try to rebind it to the same exchange. * * Because the exchange has been auto-deleted, the bind operation * should fail. diff --git a/src/test/java/com/rabbitmq/client/test/server/DurableBindingLifecycle.java b/src/test/java/com/rabbitmq/client/test/server/DurableBindingLifecycle.java index 4c4b6fd910..644c21d11a 100644 --- a/src/test/java/com/rabbitmq/client/test/server/DurableBindingLifecycle.java +++ b/src/test/java/com/rabbitmq/client/test/server/DurableBindingLifecycle.java @@ -85,9 +85,9 @@ private void restartPrimary() throws IOException, TimeoutException { /** * This tests whether the bindings attached to a durable exchange - * are correctly blown away when the exhange is nuked. + * are correctly blown away when the exchange is nuked. * - * This complements a unit test for testing non-durable exhanges. + * This complements a unit test for testing non-durable exchanges. * In that case, an exchange is deleted and you expect any * bindings hanging to it to be deleted as well. To verify this, * the exchange is deleted and then recreated. From 6568467fdb1cf9de92e417f3692902f45e83024e Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Tue, 12 Feb 2019 00:42:02 -0500 Subject: [PATCH 107/328] spelling: execute (cherry picked from commit a24af9c6c158c8f0a062e1505dbfb79adc012a1d) --- src/main/java/com/rabbitmq/client/impl/AMQConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java index d65008d96a..48949b4ca4 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java @@ -851,7 +851,7 @@ public void handleConnectionClose(Command closeCommand) { SocketCloseWait scw = new SocketCloseWait(sse); // if shutdown executor is configured, use it. Otherwise - // execut socket close monitor the old fashioned way. + // execute socket close monitor the old fashioned way. // see rabbitmq/rabbitmq-java-client#91 if(shutdownExecutor != null) { shutdownExecutor.execute(scw); From 03ec30edfbfb71ac3d9ec7a656b96f2c3e859fc8 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Tue, 12 Feb 2019 00:43:30 -0500 Subject: [PATCH 108/328] spelling: fulfill (cherry picked from commit 2cb02675e2cca0fcebc548d50d64fbc926ddbb12) --- RUNNING_TESTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RUNNING_TESTS.md b/RUNNING_TESTS.md index a449a0d099..a6da665d52 100644 --- a/RUNNING_TESTS.md +++ b/RUNNING_TESTS.md @@ -21,7 +21,7 @@ can control the running node. `./mvnw verify` will start those nodes with the appropriate configuration. -To easily fullfil all those requirements, you should use `make deps` to +To easily fulfill all those requirements, you should use `make deps` to fetch the dependencies in the `deps` directory. You then run Maven with the `deps.dir` property set like this: From ebfd620a729cb6ce18c00d9cb5ff969aaeedb68f Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Tue, 12 Feb 2019 00:47:56 -0500 Subject: [PATCH 109/328] spelling: omitted (cherry picked from commit 2f684a878bd521be00a98987f5837972865e16ea) --- src/main/java/com/rabbitmq/client/ConnectionFactory.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index 4dba1db7df..c5433571c7 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -307,7 +307,7 @@ public void setVirtualHost(String virtualHost) { /** * Convenience method for setting the fields in an AMQP URI: host, * port, username, password and virtual host. If any part of the - * URI is ommited, the ConnectionFactory's corresponding variable + * URI is omitted, the ConnectionFactory's corresponding variable * is left unchanged. * @param uri is the AMQP URI containing the data */ @@ -366,7 +366,7 @@ public void setUri(URI uri) /** * Convenience method for setting the fields in an AMQP URI: host, * port, username, password and virtual host. If any part of the - * URI is ommited, the ConnectionFactory's corresponding variable + * URI is omitted, the ConnectionFactory's corresponding variable * is left unchanged. Note that not all valid AMQP URIs are * accepted; in particular, the hostname must be given if the * port, username or password are given, and escapes in the From e4670da93e9118110ab166ea30659a68e4c9d7cb Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Tue, 12 Feb 2019 23:29:24 -0500 Subject: [PATCH 110/328] spelling: protocol (cherry picked from commit a810eba969c41c068abc8b8fe4dddc34a1936ef0) --- src/main/java/com/rabbitmq/client/ConnectionFactory.java | 4 ++-- .../com/rabbitmq/client/test/SslContextFactoryTest.java | 2 +- .../client/test/ssl/ConnectionFactoryDefaultTlsVersion.java | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index c5433571c7..12eccb007d 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -674,7 +674,7 @@ public boolean isSSL(){ public void useSslProtocol() throws NoSuchAlgorithmException, KeyManagementException { - useSslProtocol(computeDefaultTlsProcotol(SSLContext.getDefault().getSupportedSSLParameters().getProtocols())); + useSslProtocol(computeDefaultTlsProtocol(SSLContext.getDefault().getSupportedSSLParameters().getProtocols())); } /** @@ -777,7 +777,7 @@ protected void enableHostnameVerificationForBlockingIo() { } } - public static String computeDefaultTlsProcotol(String[] supportedProtocols) { + public static String computeDefaultTlsProtocol(String[] supportedProtocols) { if(supportedProtocols != null) { for (String supportedProtocol : supportedProtocols) { if(PREFERRED_TLS_PROTOCOL.equalsIgnoreCase(supportedProtocol)) { diff --git a/src/test/java/com/rabbitmq/client/test/SslContextFactoryTest.java b/src/test/java/com/rabbitmq/client/test/SslContextFactoryTest.java index 68ed763cd0..ed930c111e 100644 --- a/src/test/java/com/rabbitmq/client/test/SslContextFactoryTest.java +++ b/src/test/java/com/rabbitmq/client/test/SslContextFactoryTest.java @@ -129,7 +129,7 @@ private SslContextFactory sslContextFactory() throws Exception { } private String tlsProtocol() throws NoSuchAlgorithmException { - return ConnectionFactory.computeDefaultTlsProcotol(SSLContext.getDefault().getSupportedSSLParameters().getProtocols()); + return ConnectionFactory.computeDefaultTlsProtocol(SSLContext.getDefault().getSupportedSSLParameters().getProtocols()); } private static class TrustNothingTrustManager implements X509TrustManager { diff --git a/src/test/java/com/rabbitmq/client/test/ssl/ConnectionFactoryDefaultTlsVersion.java b/src/test/java/com/rabbitmq/client/test/ssl/ConnectionFactoryDefaultTlsVersion.java index 095c2cbb49..9d6546572b 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/ConnectionFactoryDefaultTlsVersion.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/ConnectionFactoryDefaultTlsVersion.java @@ -24,19 +24,19 @@ public class ConnectionFactoryDefaultTlsVersion { @Test public void defaultTlsVersionJdk16ShouldTakeFallback() { String [] supportedProtocols = {"SSLv2Hello", "SSLv3", "TLSv1"}; - String tlsProtocol = ConnectionFactory.computeDefaultTlsProcotol(supportedProtocols); + String tlsProtocol = ConnectionFactory.computeDefaultTlsProtocol(supportedProtocols); Assert.assertEquals("TLSv1",tlsProtocol); } @Test public void defaultTlsVersionJdk17ShouldTakePrefered() { String [] supportedProtocols = {"SSLv2Hello", "SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"}; - String tlsProtocol = ConnectionFactory.computeDefaultTlsProcotol(supportedProtocols); + String tlsProtocol = ConnectionFactory.computeDefaultTlsProtocol(supportedProtocols); Assert.assertEquals("TLSv1.2",tlsProtocol); } @Test public void defaultTlsVersionJdk18ShouldTakePrefered() { String [] supportedProtocols = {"SSLv2Hello", "SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"}; - String tlsProtocol = ConnectionFactory.computeDefaultTlsProcotol(supportedProtocols); + String tlsProtocol = ConnectionFactory.computeDefaultTlsProtocol(supportedProtocols); Assert.assertEquals("TLSv1.2",tlsProtocol); } From d66c8e60ced1b7d47564e2bcf87bf9c37329286c Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Tue, 12 Feb 2019 23:30:18 -0500 Subject: [PATCH 111/328] spelling: receive (cherry picked from commit 8c8bdd30aafcd82c6fa76db32e7d2bcac35a975a) --- .../com/rabbitmq/client/test/functional/BindingLifecycle.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycle.java b/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycle.java index 363bfaebf1..0223c4c878 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycle.java +++ b/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycle.java @@ -49,7 +49,7 @@ public class BindingLifecycle extends BindingLifecycleBase { Binding binding = setupExchangeBindings(false); channel.basicPublish(binding.x, binding.k, null, payload); - // Purge the queue, and test that we don't recieve a message + // Purge the queue, and test that we don't receive a message channel.queuePurge(binding.q); GetResponse response = channel.basicGet(binding.q, true); From 6bb5fcb8ed21a2ce46a1c0e8f42369b33503ced3 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Tue, 12 Feb 2019 23:31:36 -0500 Subject: [PATCH 112/328] spelling: targeting (cherry picked from commit 9658f446e8a2e6094ac0265581e2471a7720fb1d) --- .../java/com/rabbitmq/client/impl/MethodArgumentWriter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/client/impl/MethodArgumentWriter.java b/src/main/java/com/rabbitmq/client/impl/MethodArgumentWriter.java index 139f9eb5ea..db2005d32f 100644 --- a/src/main/java/com/rabbitmq/client/impl/MethodArgumentWriter.java +++ b/src/main/java/com/rabbitmq/client/impl/MethodArgumentWriter.java @@ -38,7 +38,7 @@ public class MethodArgumentWriter private int bitMask; /** - * Constructs a MethodArgumentWriter targetting the given DataOutputStream. + * Constructs a MethodArgumentWriter targeting the given DataOutputStream. */ public MethodArgumentWriter(ValueWriter out) { From 0cec53957204076038fbbf1afef25e0ce78c75fc Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Tue, 12 Feb 2019 23:32:05 -0500 Subject: [PATCH 113/328] spelling: topology (cherry picked from commit cce132bfe822c61898a8532a58651e92a9b98565) --- .../rabbitmq/client/impl/recovery/AutorecoveringConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java index bfd2336a5b..379961971c 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java @@ -681,7 +681,7 @@ private void recoverTopology(final ExecutorService executor) { recoverEntitiesAsynchronously(executor, Utility.copy(recordedBindings)); recoverEntitiesAsynchronously(executor, Utility.copy(consumers).values()); } catch (final Exception cause) { - final String message = "Caught an exception while recovering toplogy: " + cause.getMessage(); + final String message = "Caught an exception while recovering topology: " + cause.getMessage(); final TopologyRecoveryException e = new TopologyRecoveryException(message, cause); getExceptionHandler().handleTopologyRecoveryException(delegate, null, e); } From b8cb98bb4d42f38f764debe979213f0f3ef17178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 11 Feb 2019 18:07:38 +0100 Subject: [PATCH 114/328] Improve logging for TLS connections [#163862785] Fixes #441 (cherry picked from commit 7cc840078a35c2d73de0145c49fe553f2ca7595b) --- pom.xml | 7 + .../client/impl/SocketFrameHandler.java | 24 +- .../com/rabbitmq/client/impl/TlsUtils.java | 229 ++++++++++++++++++ .../nio/SocketChannelFrameHandlerFactory.java | 19 +- .../com/rabbitmq/client/test/ClientTests.java | 3 +- .../rabbitmq/client/test/TlsUtilsTest.java | 123 ++++++++++ .../rabbitmq/client/test/ssl/SSLTests.java | 3 +- .../client/test/ssl/TlsConnectionLogging.java | 71 ++++++ 8 files changed, 472 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/rabbitmq/client/impl/TlsUtils.java create mode 100644 src/test/java/com/rabbitmq/client/test/TlsUtilsTest.java create mode 100644 src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java diff --git a/pom.xml b/pom.xml index 0fe97c7b4d..b4b6cd3d46 100644 --- a/pom.xml +++ b/pom.xml @@ -62,6 +62,7 @@ 4.12 3.1.5 2.23.4 + 3.11.1 3.0.1 2.5.3 @@ -731,6 +732,12 @@ ${mockito.version} test + + org.assertj + assertj-core + ${assert4j.version} + test + org.hamcrest hamcrest-library diff --git a/src/main/java/com/rabbitmq/client/impl/SocketFrameHandler.java b/src/main/java/com/rabbitmq/client/impl/SocketFrameHandler.java index bbe76e0684..02cc9a2d2d 100644 --- a/src/main/java/com/rabbitmq/client/impl/SocketFrameHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/SocketFrameHandler.java @@ -16,7 +16,11 @@ package com.rabbitmq.client.impl; import com.rabbitmq.client.AMQP; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import javax.net.ssl.SSLHandshakeException; +import javax.net.ssl.SSLSocket; import java.io.*; import java.net.InetAddress; import java.net.Socket; @@ -31,6 +35,9 @@ */ public class SocketFrameHandler implements FrameHandler { + + private static final Logger LOGGER = LoggerFactory.getLogger(SocketFrameHandler.class); + /** The underlying socket */ private final Socket _socket; @@ -122,7 +129,12 @@ public void sendHeader(int major, int minor) throws IOException { _outputStream.write(1); _outputStream.write(major); _outputStream.write(minor); - _outputStream.flush(); + try { + _outputStream.flush(); + } catch (SSLHandshakeException e) { + LOGGER.error("TLS connection failed: {}", e.getMessage()); + throw e; + } } } @@ -144,13 +156,21 @@ public void sendHeader(int major, int minor, int revision) throws IOException { _outputStream.write(major); _outputStream.write(minor); _outputStream.write(revision); - _outputStream.flush(); + try { + _outputStream.flush(); + } catch (SSLHandshakeException e) { + LOGGER.error("TLS connection failed: {}", e.getMessage()); + throw e; + } } } @Override public void sendHeader() throws IOException { sendHeader(AMQP.PROTOCOL.MAJOR, AMQP.PROTOCOL.MINOR, AMQP.PROTOCOL.REVISION); + if (this._socket instanceof SSLSocket) { + TlsUtils.logPeerCertificateInfo(((SSLSocket) this._socket).getSession()); + } } @Override diff --git a/src/main/java/com/rabbitmq/client/impl/TlsUtils.java b/src/main/java/com/rabbitmq/client/impl/TlsUtils.java new file mode 100644 index 0000000000..b517e51d6c --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/TlsUtils.java @@ -0,0 +1,229 @@ +// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.net.ssl.SSLSession; +import java.security.cert.Certificate; +import java.security.cert.CertificateParsingException; +import java.security.cert.X509Certificate; +import java.util.*; +import java.util.function.BiFunction; +import java.util.stream.Collectors; + +/** + * Utility to extract information from X509 certificates. + * + * @since 5.7.0 + */ +public class TlsUtils { + + private static final Logger LOGGER = LoggerFactory.getLogger(TlsUtils.class); + private static final List KEY_USAGE = Collections.unmodifiableList(Arrays.asList( + "digitalSignature", "nonRepudiation", "keyEncipherment", + "dataEncipherment", "keyAgreement", "keyCertSign", + "cRLSign", "encipherOnly", "decipherOnly" + )); + private static final Map EXTENDED_KEY_USAGE = Collections.unmodifiableMap(new HashMap() {{ + put("1.3.6.1.5.5.7.3.1", "TLS Web server authentication"); + put("1.3.6.1.5.5.7.3.2", "TLS Web client authentication"); + put("1.3.6.1.5.5.7.3.3", "Signing of downloadable executable code"); + put("1.3.6.1.5.5.7.3.4", "E-mail protection"); + put("1.3.6.1.5.5.7.3.8", "Binding the hash of an object to a time from an agreed-upon time"); + }}); + private static String PARSING_ERROR = ""; + private static final Map> EXTENSIONS = Collections.unmodifiableMap( + new HashMap>() {{ + put("2.5.29.14", (v, c) -> "SubjectKeyIdentifier = " + octetStringHexDump(v)); + put("2.5.29.15", (v, c) -> "KeyUsage = " + keyUsageBitString(c.getKeyUsage(), v)); + put("2.5.29.16", (v, c) -> "PrivateKeyUsage = " + hexDump(0, v)); + put("2.5.29.17", (v, c) -> { + try { + return "SubjectAlternativeName = " + sans(c, "/"); + } catch (CertificateParsingException e) { + return "SubjectAlternativeName = " + PARSING_ERROR; + } + }); + put("2.5.29.18", (v, c) -> "IssuerAlternativeName = " + hexDump(0, v)); + put("2.5.29.19", (v, c) -> "BasicConstraints = " + basicConstraints(v)); + put("2.5.29.30", (v, c) -> "NameConstraints = " + hexDump(0, v)); + put("2.5.29.33", (v, c) -> "PolicyMappings = " + hexDump(0, v)); + put("2.5.29.35", (v, c) -> "AuthorityKeyIdentifier = " + authorityKeyIdentifier(v)); + put("2.5.29.36", (v, c) -> "PolicyConstraints = " + hexDump(0, v)); + put("2.5.29.37", (v, c) -> "ExtendedKeyUsage = " + extendedKeyUsage(v, c)); + }}); + + /** + * Log details on peer certificate and certification chain. + *

+ * The log level is debug. Common X509 extensions are displayed in a best-effort + * fashion, a hexadecimal dump is made for less commonly used extensions. + * + * @param session the {@link SSLSession} to extract the certificates from + */ + public static void logPeerCertificateInfo(SSLSession session) { + if (LOGGER.isDebugEnabled()) { + try { + Certificate[] peerCertificates = session.getPeerCertificates(); + if (peerCertificates != null && peerCertificates.length > 0) { + LOGGER.debug(peerCertificateInfo(peerCertificates[0], "Peer's leaf certificate")); + for (int i = 1; i < peerCertificates.length; i++) { + LOGGER.debug(peerCertificateInfo(peerCertificates[i], "Peer's certificate chain entry")); + } + } + } catch (Exception e) { + LOGGER.debug("Error while logging peer certificate info: {}", e.getMessage()); + } + } + } + + /** + * Get a string representation of certificate info. + * + * @param certificate the certificate to analyze + * @param prefix the line prefix + * @return information about the certificate + */ + public static String peerCertificateInfo(Certificate certificate, String prefix) { + X509Certificate c = (X509Certificate) certificate; + try { + return String.format("%s subject: %s, subject alternative names: %s, " + + "issuer: %s, not valid after: %s, X.509 usage extensions: %s", + prefix, c.getSubjectDN().getName(), sans(c, ","), c.getIssuerDN().getName(), + c.getNotAfter(), extensions(c)); + } catch (Exception e) { + return "Error while retrieving " + prefix + " certificate information"; + } + } + + private static String sans(X509Certificate c, String separator) throws CertificateParsingException { + return String.join(separator, Optional.ofNullable(c.getSubjectAlternativeNames()) + .orElse(new ArrayList<>()) + .stream() + .map(v -> v.toString()) + .collect(Collectors.toList())); + } + + /** + * Human-readable representation of an X509 certificate extension. + *

+ * Common extensions are supported in a best-effort fashion, less commonly + * used extensions are displayed as an hexadecimal dump. + *

+ * Extensions come encoded as a DER Octet String, which itself can contain + * other DER-encoded objects, making a comprehensive support in this utility + * impossible. + * + * @param oid extension OID + * @param derOctetString the extension value as a DER octet string + * @param certificate the certificate + * @return the OID and the value + * @see A Layman's Guide to a Subset of ASN.1, BER, and DER + * @see DER Encoding of ASN.1 Types + */ + public static String extensionPrettyPrint(String oid, byte[] derOctetString, X509Certificate certificate) { + try { + return EXTENSIONS.getOrDefault(oid, (v, c) -> oid + " = " + hexDump(0, derOctetString)) + .apply(derOctetString, certificate); + } catch (Exception e) { + return oid + " = " + PARSING_ERROR; + } + } + + private static String extensions(X509Certificate certificate) { + List extensions = new ArrayList<>(); + for (String oid : certificate.getCriticalExtensionOIDs()) { + extensions.add(extensionPrettyPrint(oid, certificate.getExtensionValue(oid), certificate) + " (critical)"); + } + for (String oid : certificate.getNonCriticalExtensionOIDs()) { + extensions.add(extensionPrettyPrint(oid, certificate.getExtensionValue(oid), certificate) + " (non-critical)"); + } + return String.join(", ", extensions); + } + + private static String octetStringHexDump(byte[] derOctetString) { + // this is an octet string in a octet string, [4 total_length 4 length ...] + if (derOctetString.length > 4 && derOctetString[0] == 4 && derOctetString[2] == 4) { + return hexDump(4, derOctetString); + } else { + return hexDump(0, derOctetString); + } + } + + private static String hexDump(int start, byte[] derOctetString) { + List hexs = new ArrayList<>(); + for (int i = start; i < derOctetString.length; i++) { + hexs.add(String.format("%02X", derOctetString[i])); + } + return String.join(":", hexs); + } + + private static String keyUsageBitString(boolean[] keyUsage, byte[] derOctetString) { + if (keyUsage != null) { + List usage = new ArrayList<>(); + for (int i = 0; i < keyUsage.length; i++) { + if (keyUsage[i]) { + usage.add(KEY_USAGE.get(i)); + } + } + return String.join("/", usage); + } else { + return hexDump(0, derOctetString); + } + } + + private static String basicConstraints(byte[] derOctetString) { + if (derOctetString.length == 4 && derOctetString[3] == 0) { + // e.g. 04:02:30:00 [octet_string length sequence size] + return "CA:FALSE"; + } else if (derOctetString.length >= 7 && derOctetString[2] == 48 && derOctetString[4] == 1) { + // e.g. 04:05:30:03:01:01:FF [octet_string length sequence boolean length boolean_value] + return "CA:" + (derOctetString[6] == 0 ? "FALSE" : "TRUE"); + } else { + return hexDump(0, derOctetString); + } + } + + private static String authorityKeyIdentifier(byte[] derOctetString) { + if (derOctetString.length == 26 && derOctetString[0] == 04) { + // e.g. 04:18:30:16:80:14:FB:D2:7C:63:DF:7F:D4:A4:8E:9A:20:43:F5:DC:75:6F:B6:D8:51:6F + // [octet_string length sequence ?? ?? key_length key] + return "keyid:" + hexDump(6, derOctetString); + } else { + return hexDump(0, derOctetString); + } + + } + + private static String extendedKeyUsage(byte[] derOctetString, X509Certificate certificate) { + List extendedKeyUsage = null; + try { + extendedKeyUsage = certificate.getExtendedKeyUsage(); + if (extendedKeyUsage == null) { + return hexDump(0, derOctetString); + } else { + return String.join("/", extendedKeyUsage.stream() + .map(oid -> EXTENDED_KEY_USAGE.getOrDefault(oid, oid)) + .collect(Collectors.toList())); + } + } catch (CertificateParsingException e) { + return PARSING_ERROR; + } + } + +} diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java index c9e1ffb202..784a5f80cd 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java @@ -20,10 +20,14 @@ import com.rabbitmq.client.SslContextFactory; import com.rabbitmq.client.impl.AbstractFrameHandlerFactory; import com.rabbitmq.client.impl.FrameHandler; +import com.rabbitmq.client.impl.TlsUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLException; +import javax.net.ssl.SSLHandshakeException; import java.io.IOException; import java.net.InetSocketAddress; import java.net.SocketAddress; @@ -39,6 +43,8 @@ */ public class SocketChannelFrameHandlerFactory extends AbstractFrameHandlerFactory { + private static final Logger LOGGER = LoggerFactory.getLogger(SocketChannelFrameHandler.class); + final NioParams nioParams; private final SslContextFactory sslContextFactory; @@ -91,10 +97,17 @@ public FrameHandler create(Address addr, String connectionName) throws IOExcepti if (ssl) { sslEngine.beginHandshake(); - boolean handshake = SslEngineHelper.doHandshake(channel, sslEngine); - if (!handshake) { - throw new SSLException("TLS handshake failed"); + try { + boolean handshake = SslEngineHelper.doHandshake(channel, sslEngine); + if (!handshake) { + LOGGER.error("TLS connection failed"); + throw new SSLException("TLS handshake failed"); + } + } catch (SSLHandshakeException e) { + LOGGER.error("TLS connection failed: {}", e.getMessage()); + throw e; } + TlsUtils.logPeerCertificateInfo(sslEngine.getSession()); } channel.configureBlocking(false); diff --git a/src/test/java/com/rabbitmq/client/test/ClientTests.java b/src/test/java/com/rabbitmq/client/test/ClientTests.java index 998743d46b..0db46be963 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientTests.java +++ b/src/test/java/com/rabbitmq/client/test/ClientTests.java @@ -69,7 +69,8 @@ NioDeadlockOnConnectionClosing.class, GeneratedClassesTest.class, RpcTopologyRecordingTest.class, - ConnectionTest.class + ConnectionTest.class, + TlsUtilsTest.class }) public class ClientTests { diff --git a/src/test/java/com/rabbitmq/client/test/TlsUtilsTest.java b/src/test/java/com/rabbitmq/client/test/TlsUtilsTest.java new file mode 100644 index 0000000000..e632e47282 --- /dev/null +++ b/src/test/java/com/rabbitmq/client/test/TlsUtilsTest.java @@ -0,0 +1,123 @@ +// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.test; + +import org.junit.Test; +import org.mockito.Mockito; + +import java.security.cert.CertificateParsingException; +import java.security.cert.X509Certificate; +import java.util.Arrays; + +import static com.rabbitmq.client.impl.TlsUtils.extensionPrettyPrint; +import static org.assertj.core.api.Assertions.assertThat; + +public class TlsUtilsTest { + + static final byte [] DOES_NOT_MATTER = new byte[0]; + + @Test + public void subjectKeyIdentifier() { + // https://www.alvestrand.no/objectid/2.5.29.14.html + byte[] derOctetString = new byte[]{ + 4, 22, 4, 20, -2, -87, -45, -120, 29, -126, -88, -17, 95, -39, -122, 23, 10, -62, -54, -82, 113, -121, -70, -121 + }; // 04:16:04:14:FE:A9:D3:88:1D:82:A8:EF:5F:D9:86:17:0A:C2:CA:AE:71:87:BA:87 + assertThat(extensionPrettyPrint("2.5.29.14", derOctetString, null)) + .isEqualTo("SubjectKeyIdentifier = FE:A9:D3:88:1D:82:A8:EF:5F:D9:86:17:0A:C2:CA:AE:71:87:BA:87"); + // change the 3rd byte to mimic it's not a octet string, the whole array should be then hex-dumped + derOctetString = new byte[]{ + 4, 22, 3, 20, -2, -87, -45, -120, 29, -126, -88, -17, 95, -39, -122, 23, 10, -62, -54, -82, 113, -121, -70, -121 + }; // 04:16:04:14:FE:A9:D3:88:1D:82:A8:EF:5F:D9:86:17:0A:C2:CA:AE:71:87:BA:87 + assertThat(extensionPrettyPrint("2.5.29.14", derOctetString, null)) + .isEqualTo("SubjectKeyIdentifier = 04:16:03:14:FE:A9:D3:88:1D:82:A8:EF:5F:D9:86:17:0A:C2:CA:AE:71:87:BA:87"); + } + + @Test public void keyUsage() { + // https://www.alvestrand.no/objectid/2.5.29.15.html + // http://javadoc.iaik.tugraz.at/iaik_jce/current/iaik/asn1/BIT_STRING.html + X509Certificate c = Mockito.mock(X509Certificate.class); + Mockito.when(c.getKeyUsage()) + .thenReturn(new boolean[] {true,false,true,false,false,false,false,false,false}) + .thenReturn(new boolean[] {false,false,false,false,false,true,true,false,false}) + .thenReturn(null); + assertThat(extensionPrettyPrint("2.5.29.15", DOES_NOT_MATTER, c)) + .isEqualTo("KeyUsage = digitalSignature/keyEncipherment"); + assertThat(extensionPrettyPrint("2.5.29.15", DOES_NOT_MATTER, c)) + .isEqualTo("KeyUsage = keyCertSign/cRLSign"); + // change the 3rd byte to mimic it's not a bit string, the whole array should be then hex-dumped + byte[] derOctetString = new byte[] { 4, 4, 3, 2, 1, 6}; // 04:04:03:02:01:06 => Certificate Sign, CRL Sign + assertThat(extensionPrettyPrint("2.5.29.15", derOctetString, c)) + .isEqualTo("KeyUsage = 04:04:03:02:01:06"); + } + + @Test public void basicConstraints() { + // https://www.alvestrand.no/objectid/2.5.29.19.html + byte [] derOctetString = new byte [] {0x04, 0x02, 0x30, 0x00}; + assertThat(extensionPrettyPrint("2.5.29.19", derOctetString, null)) + .isEqualTo("BasicConstraints = CA:FALSE"); + derOctetString = new byte [] {4, 5, 48, 3, 1, 1, -1}; // 04:05:30:03:01:01:FF + assertThat(extensionPrettyPrint("2.5.29.19", derOctetString, null)) + .isEqualTo("BasicConstraints = CA:TRUE"); + derOctetString = new byte [] {4, 5, 48, 3, 1, 1, 0}; // 04:05:30:03:01:01:00 + assertThat(extensionPrettyPrint("2.5.29.19", derOctetString, null)) + .isEqualTo("BasicConstraints = CA:FALSE"); + // change the 3rd to mimic it's not what the utils expects, the whole array should be hex-dump + derOctetString = new byte [] {4, 5, 4, 3, 1, 1, 0}; // 04:05:04:03:01:01:00 + assertThat(extensionPrettyPrint("2.5.29.19", derOctetString, null)) + .isEqualTo("BasicConstraints = 04:05:04:03:01:01:00"); + + } + + @Test public void authorityKeyIdentifier() { + // https://www.alvestrand.no/objectid/2.5.29.35.html + byte[] derOctetString = new byte[]{ + 4,24,48,22,-128,20,-5,-46,124,99,-33,127,-44,-92,-114,-102,32,67,-11,-36,117,111,-74,-40,81,111 + }; // 04:18:30:16:80:14:FB:D2:7C:63:DF:7F:D4:A4:8E:9A:20:43:F5:DC:75:6F:B6:D8:51:6F + assertThat(extensionPrettyPrint("2.5.29.35", derOctetString, null)) + .isEqualTo("AuthorityKeyIdentifier = keyid:FB:D2:7C:63:DF:7F:D4:A4:8E:9A:20:43:F5:DC:75:6F:B6:D8:51:6F"); + + // add a byte to mimic not-expected length, the whole array should be hex-dump + derOctetString = new byte[]{ + 4,24,48,22,-128,20,-5,-46,124,99,-33,127,-44,-92,-114,-102,32,67,-11,-36,117,111,-74,-40,81,111, -1 + }; // 04:18:30:16:80:14:FB:D2:7C:63:DF:7F:D4:A4:8E:9A:20:43:F5:DC:75:6F:B6:D8:51:6F + assertThat(extensionPrettyPrint("2.5.29.35", derOctetString, null)) + .isEqualTo("AuthorityKeyIdentifier = 04:18:30:16:80:14:FB:D2:7C:63:DF:7F:D4:A4:8E:9A:20:43:F5:DC:75:6F:B6:D8:51:6F:FF"); + } + + @Test public void extendedKeyUsage() throws CertificateParsingException { + // https://www.alvestrand.no/objectid/2.5.29.37.html + X509Certificate c = Mockito.mock(X509Certificate.class); + Mockito.when(c.getExtendedKeyUsage()) + .thenReturn(Arrays.asList("1.3.6.1.5.5.7.3.1")) + .thenReturn(Arrays.asList("1.3.6.1.5.5.7.3.1", "1.3.6.1.5.5.7.3.2")) + .thenReturn(Arrays.asList("1.3.6.1.5.5.7.3.unknown")) + .thenReturn(null) + .thenThrow(CertificateParsingException.class); + + assertThat(extensionPrettyPrint("2.5.29.37", DOES_NOT_MATTER, c)) + .isEqualTo("ExtendedKeyUsage = TLS Web server authentication"); + assertThat(extensionPrettyPrint("2.5.29.37", DOES_NOT_MATTER, c)) + .isEqualTo("ExtendedKeyUsage = TLS Web server authentication/TLS Web client authentication"); + assertThat(extensionPrettyPrint("2.5.29.37", DOES_NOT_MATTER, c)) + .isEqualTo("ExtendedKeyUsage = 1.3.6.1.5.5.7.3.unknown"); + byte [] derOctetString = new byte[] {0x04, 0x0C, 0x30, 0x0A, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01}; + assertThat(extensionPrettyPrint("2.5.29.37", derOctetString, c)) + .isEqualTo("ExtendedKeyUsage = 04:0C:30:0A:06:08:2B:06:01:05:05:07:03:01"); + assertThat(extensionPrettyPrint("2.5.29.37", DOES_NOT_MATTER, c)) + .isEqualTo("ExtendedKeyUsage = "); + } + +} diff --git a/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java b/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java index 679468a59f..88107b41fe 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java @@ -33,7 +33,8 @@ BadVerifiedConnection.class, ConnectionFactoryDefaultTlsVersion.class, NioTlsUnverifiedConnection.class, - HostnameVerification.class + HostnameVerification.class, + TlsConnectionLogging.class }) public class SSLTests { diff --git a/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java b/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java new file mode 100644 index 0000000000..12ec082a4d --- /dev/null +++ b/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java @@ -0,0 +1,71 @@ +// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.test.ssl; + +import com.rabbitmq.client.Connection; +import com.rabbitmq.client.ConnectionFactory; +import com.rabbitmq.client.impl.TlsUtils; +import com.rabbitmq.client.test.TestUtils; +import org.assertj.core.api.Assertions; +import org.junit.Test; + +import javax.net.ssl.*; +import java.security.cert.X509Certificate; +import java.util.concurrent.atomic.AtomicReference; + +import static org.junit.Assert.assertNotNull; + +public class TlsConnectionLogging { + + @Test + public void certificateInfoAreProperlyExtracted() throws Exception { + SSLContext sslContext = TestUtils.getSSLContext(); + sslContext.init(null, new TrustManager[]{new AlwaysTrustTrustManager()}, null); + ConnectionFactory connectionFactory = TestUtils.connectionFactory(); + connectionFactory.useSslProtocol(sslContext); + connectionFactory.useBlockingIo(); + AtomicReference socketCaptor = new AtomicReference<>(); + connectionFactory.setSocketConfigurator(socket -> socketCaptor.set((SSLSocket) socket)); + try (Connection ignored = connectionFactory.newConnection()) { + SSLSession session = socketCaptor.get().getSession(); + assertNotNull(session); + String info = TlsUtils.peerCertificateInfo(session.getPeerCertificates()[0], "some prefix"); + Assertions.assertThat(info).contains("some prefix") + .contains("CN=") + .contains("X.509 usage extensions") + .contains("KeyUsage"); + + } + } + + private static class AlwaysTrustTrustManager implements X509TrustManager { + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) { + + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) { + + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + return new X509Certificate[0]; + } + } + +} From ebb82edd848e270a7133ac9b771b24b933da7d42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 13 Feb 2019 10:59:38 +0100 Subject: [PATCH 115/328] Add NIO test case for TLS connection info logging [#163862785] References #441 (cherry picked from commit 106bade4917e47e39f334786836dfbd10674c5e7) --- .../client/test/ssl/TlsConnectionLogging.java | 39 +++++++++++++++++-- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java b/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java index 12ec082a4d..363d749dde 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java @@ -18,29 +18,60 @@ import com.rabbitmq.client.Connection; import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.impl.TlsUtils; +import com.rabbitmq.client.impl.nio.NioParams; import com.rabbitmq.client.test.TestUtils; import org.assertj.core.api.Assertions; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; import javax.net.ssl.*; import java.security.cert.X509Certificate; import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Function; +import java.util.function.Supplier; import static org.junit.Assert.assertNotNull; +@RunWith(Parameterized.class) public class TlsConnectionLogging { + @Parameterized.Parameter + public Function> configurer; + + @Parameterized.Parameters + public static Object[] data() { + return new Object[]{blockingIo(), nio()}; + } + + public static Function> blockingIo() { + return connectionFactory -> { + connectionFactory.useBlockingIo(); + AtomicReference socketCaptor = new AtomicReference<>(); + connectionFactory.setSocketConfigurator(socket -> socketCaptor.set((SSLSocket) socket)); + return () -> socketCaptor.get().getSession(); + }; + } + + public static Function> nio() { + return connectionFactory -> { + connectionFactory.useNio(); + AtomicReference sslEngineCaptor = new AtomicReference<>(); + connectionFactory.setNioParams(new NioParams() + .setSslEngineConfigurator(sslEngine -> sslEngineCaptor.set(sslEngine))); + return () -> sslEngineCaptor.get().getSession(); + }; + } + @Test public void certificateInfoAreProperlyExtracted() throws Exception { SSLContext sslContext = TestUtils.getSSLContext(); sslContext.init(null, new TrustManager[]{new AlwaysTrustTrustManager()}, null); ConnectionFactory connectionFactory = TestUtils.connectionFactory(); connectionFactory.useSslProtocol(sslContext); - connectionFactory.useBlockingIo(); - AtomicReference socketCaptor = new AtomicReference<>(); - connectionFactory.setSocketConfigurator(socket -> socketCaptor.set((SSLSocket) socket)); + Supplier sslSessionSupplier = configurer.apply(connectionFactory); try (Connection ignored = connectionFactory.newConnection()) { - SSLSession session = socketCaptor.get().getSession(); + SSLSession session = sslSessionSupplier.get(); assertNotNull(session); String info = TlsUtils.peerCertificateInfo(session.getPeerCertificates()[0], "some prefix"); Assertions.assertThat(info).contains("some prefix") From f3a50edb95381f91894a19eeb2b4d1758bfa58be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 13 Feb 2019 11:03:54 +0100 Subject: [PATCH 116/328] Fix test with NioParams correct usage for this branch --- .../com/rabbitmq/client/test/ssl/TlsConnectionLogging.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java b/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java index 363d749dde..6eb865ea41 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java @@ -57,8 +57,9 @@ public static Function> nio() { return connectionFactory -> { connectionFactory.useNio(); AtomicReference sslEngineCaptor = new AtomicReference<>(); - connectionFactory.setNioParams(new NioParams() - .setSslEngineConfigurator(sslEngine -> sslEngineCaptor.set(sslEngine))); + NioParams nioParams = new NioParams(); + nioParams.setSslEngineConfigurator(sslEngine -> sslEngineCaptor.set(sslEngine)); + connectionFactory.setNioParams(nioParams); return () -> sslEngineCaptor.get().getSession(); }; } From ba0434e0bb44ffafc1302c0bb9d8390cc5a51c3c Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Thu, 28 Feb 2019 16:23:21 +0300 Subject: [PATCH 117/328] Update a few tests to explicitly delete queues Due to changes in [1] argument mismatch that involves the exclusive property can report a different channel exception (406 LOCKED). Since it has nothing to do with dead-lettering, switching to cleaning up queues manually and relying on their non-durability e.g. between CI runs is sufficient. Spotted by @acogoluegnes. 1. https://github.com/rabbitmq/rabbitmq-server/commit/bd46898b5923c92873f4b9ff0c3ac9df3cb0a1aa (cherry picked from commit dae7b13849a929d653c9bec62d782914e6644f8c) --- .../client/test/functional/DeadLetterExchange.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java b/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java index cfaff5f47d..e76e866bd2 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java +++ b/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java @@ -29,13 +29,13 @@ public class DeadLetterExchange extends BrokerTestCase { public static final String DLX = "dead.letter.exchange"; - public static final String DLX_ARG = "x-dead-letter-exchange"; - public static final String DLX_RK_ARG = "x-dead-letter-routing-key"; + private static final String DLX_ARG = "x-dead-letter-exchange"; + private static final String DLX_RK_ARG = "x-dead-letter-routing-key"; public static final String TEST_QUEUE_NAME = "test.queue.dead.letter"; public static final String DLQ = "queue.dlq"; - public static final String DLQ2 = "queue.dlq2"; + private static final String DLQ2 = "queue.dlq2"; public static final int MSG_COUNT = 10; - public static final int TTL = 1000; + private static final int TTL = 1000; @Override protected void createResources() throws IOException { @@ -48,6 +48,7 @@ protected void createResources() throws IOException { @Override protected void releaseResources() throws IOException { channel.exchangeDelete(DLX); + channel.queueDelete(TEST_QUEUE_NAME); } @Test public void declareQueueWithExistingDeadLetterExchange() @@ -614,7 +615,7 @@ private void declareQueue(String queue, Object deadLetterExchange, if (deadLetterRoutingKey != null) { args.put(DLX_RK_ARG, deadLetterRoutingKey); } - channel.queueDeclare(queue, false, true, false, args); + channel.queueDeclare(queue, false, false, false, args); } private void publishN(int n) throws IOException { From b6c5f8aaa0d5b03ca6e2c3039b35a9738f005b46 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Thu, 28 Feb 2019 16:29:48 +0300 Subject: [PATCH 118/328] Squash a few more IDEA warnings (cherry picked from commit 8fa6760f1b37abfa2b8dda9fa6a40b022dacc1bb) --- .../test/functional/DeadLetterExchange.java | 227 ++++++++---------- 1 file changed, 100 insertions(+), 127 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java b/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java index e76e866bd2..f78bd7a264 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java +++ b/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java @@ -77,9 +77,7 @@ protected void releaseResources() throws IOException { declareQueue(TEST_QUEUE_NAME, DLX, "routing_key", null); } - @Test public void declareQueueWithInvalidDeadLetterExchangeArg() - throws IOException - { + @Test public void declareQueueWithInvalidDeadLetterExchangeArg() { try { declareQueue(133); fail("x-dead-letter-exchange must be a valid exchange name"); @@ -101,9 +99,7 @@ protected void releaseResources() throws IOException { } } - @Test public void declareQueueWithInvalidDeadLetterRoutingKeyArg() - throws IOException - { + @Test public void declareQueueWithInvalidDeadLetterRoutingKeyArg() { try { declareQueue("foo", "amq.direct", 144, null); fail("x-dead-letter-routing-key must be a string"); @@ -125,11 +121,9 @@ protected void releaseResources() throws IOException { } } - @Test public void declareQueueWithRoutingKeyButNoDeadLetterExchange() - throws IOException - { + @Test public void declareQueueWithRoutingKeyButNoDeadLetterExchange() { try { - Map args = new HashMap(); + Map args = new HashMap<>(); args.put(DLX_RK_ARG, "foo"); channel.queueDeclare(randomQueueName(), false, true, false, args); @@ -139,11 +133,10 @@ protected void releaseResources() throws IOException { } } - @Test public void redeclareQueueWithRoutingKeyButNoDeadLetterExchange() - throws IOException, InterruptedException { + @Test public void redeclareQueueWithRoutingKeyButNoDeadLetterExchange() { try { String queueName = randomQueueName(); - Map args = new HashMap(); + Map args = new HashMap<>(); channel.queueDeclare(queueName, false, true, false, args); args.put(DLX_RK_ARG, "foo"); @@ -165,7 +158,7 @@ protected void releaseResources() throws IOException { } @Test public void deadLetterQueueTTLPromptExpiry() throws Exception { - Map args = new HashMap(); + Map args = new HashMap<>(); args.put("x-message-ttl", TTL); declareQueue(TEST_QUEUE_NAME, DLX, null, args); channel.queueBind(TEST_QUEUE_NAME, "amq.direct", "test"); @@ -205,7 +198,7 @@ protected void releaseResources() throws IOException { publishAt(start); basicGet(TEST_QUEUE_NAME); // publish a 2nd message and immediately fetch it in ack mode - publishAt(start + TTL * 1 / 2); + publishAt(start + TTL / 2); GetResponse r = channel.basicGet(TEST_QUEUE_NAME, false); // publish a 3rd message publishAt(start + TTL * 3 / 4); @@ -250,20 +243,17 @@ protected void releaseResources() throws IOException { // the DLQ *AND* should remain there, not getting removed after a subsequent // wait time > 100ms sleep(500); - consumeN(DLQ, 1, new WithResponse() { - @SuppressWarnings("unchecked") - public void process(GetResponse getResponse) { - assertNull(getResponse.getProps().getExpiration()); - Map headers = getResponse.getProps().getHeaders(); - assertNotNull(headers); - ArrayList death = (ArrayList)headers.get("x-death"); - assertNotNull(death); - assertDeathReason(death, 0, TEST_QUEUE_NAME, "expired"); - final Map deathHeader = - (Map)death.get(0); - assertEquals("100", deathHeader.get("original-expiration").toString()); - } - }); + consumeN(DLQ, 1, getResponse -> { + assertNull(getResponse.getProps().getExpiration()); + Map headers = getResponse.getProps().getHeaders(); + assertNotNull(headers); + ArrayList death = (ArrayList)headers.get("x-death"); + assertNotNull(death); + assertDeathReason(death, 0, TEST_QUEUE_NAME, "expired"); + final Map deathHeader = + (Map)death.get(0); + assertEquals("100", deathHeader.get("original-expiration").toString()); + }); } @Test public void deadLetterOnReject() throws Exception { @@ -315,23 +305,20 @@ public void process(GetResponse getResponse) { // There should now be two copies of each message on DLQ2: one // with one set of death headers, and another with two sets. - consumeN(DLQ2, MSG_COUNT*2, new WithResponse() { - @SuppressWarnings("unchecked") - public void process(GetResponse getResponse) { - Map headers = getResponse.getProps().getHeaders(); - assertNotNull(headers); - ArrayList death = (ArrayList)headers.get("x-death"); - assertNotNull(death); - if (death.size() == 1) { - assertDeathReason(death, 0, TEST_QUEUE_NAME, "expired"); - } else if (death.size() == 2) { - assertDeathReason(death, 0, DLQ, "expired"); - assertDeathReason(death, 1, TEST_QUEUE_NAME, "expired"); - } else { - fail("message was dead-lettered more times than expected"); - } - } - }); + consumeN(DLQ2, MSG_COUNT*2, getResponse -> { + Map headers = getResponse.getProps().getHeaders(); + assertNotNull(headers); + ArrayList death = (ArrayList)headers.get("x-death"); + assertNotNull(death); + if (death.size() == 1) { + assertDeathReason(death, 0, TEST_QUEUE_NAME, "expired"); + } else if (death.size() == 2) { + assertDeathReason(death, 0, DLQ, "expired"); + assertDeathReason(death, 1, TEST_QUEUE_NAME, "expired"); + } else { + fail("message was dead-lettered more times than expected"); + } + }); } @Test public void deadLetterSelf() throws Exception { @@ -379,9 +366,9 @@ public void handleDelivery(String consumerTag, Envelope envelope, channel.queueBind(DLQ, DLX, "test"); channel.queueBind(DLQ2, DLX, "test-other"); - Map headers = new HashMap(); - headers.put("CC", Arrays.asList("foo")); - headers.put("BCC", Arrays.asList("bar")); + Map headers = new HashMap<>(); + headers.put("CC", Collections.singletonList("foo")); + headers.put("BCC", Collections.singletonList("bar")); publishN(MSG_COUNT, (new AMQP.BasicProperties.Builder()) .headers(headers) @@ -390,27 +377,24 @@ public void handleDelivery(String consumerTag, Envelope envelope, sleep(100); consumeN(DLQ, 0, WithResponse.NULL); - consumeN(DLQ2, MSG_COUNT, new WithResponse() { - @SuppressWarnings("unchecked") - public void process(GetResponse getResponse) { - Map headers = getResponse.getProps().getHeaders(); - assertNotNull(headers); - assertNull(headers.get("CC")); - assertNull(headers.get("BCC")); - - ArrayList death = (ArrayList)headers.get("x-death"); - assertNotNull(death); - assertEquals(1, death.size()); - assertDeathReason(death, 0, TEST_QUEUE_NAME, - "expired", "amq.direct", - Arrays.asList("test", "foo")); - } - }); + consumeN(DLQ2, MSG_COUNT, getResponse -> { + Map headers1 = getResponse.getProps().getHeaders(); + assertNotNull(headers1); + assertNull(headers1.get("CC")); + assertNull(headers1.get("BCC")); + + ArrayList death = (ArrayList) headers1.get("x-death"); + assertNotNull(death); + assertEquals(1, death.size()); + assertDeathReason(death, 0, TEST_QUEUE_NAME, + "expired", "amq.direct", + Arrays.asList("test", "foo")); + }); } @SuppressWarnings("unchecked") @Test public void republish() throws Exception { - Map args = new HashMap(); + Map args = new HashMap<>(); args.put("x-message-ttl", 100); declareQueue(TEST_QUEUE_NAME, DLX, null, args); channel.queueBind(TEST_QUEUE_NAME, "amq.direct", "test"); @@ -430,10 +414,10 @@ public void process(GetResponse getResponse) { assertNotNull(death); assertEquals(1, death.size()); assertDeathReason(death, 0, TEST_QUEUE_NAME, "expired", "amq.direct", - Arrays.asList("test")); + Collections.singletonList("test")); // Make queue zero length - args = new HashMap(); + args = new HashMap<>(); args.put("x-max-length", 0); channel.queueDelete(TEST_QUEUE_NAME); declareQueue(TEST_QUEUE_NAME, DLX, null, args); @@ -457,9 +441,9 @@ public void process(GetResponse getResponse) { assertNotNull(death); assertEquals(2, death.size()); assertDeathReason(death, 0, TEST_QUEUE_NAME, "maxlen", "amq.direct", - Arrays.asList("test")); + Collections.singletonList("test")); assertDeathReason(death, 1, TEST_QUEUE_NAME, "expired", "amq.direct", - Arrays.asList("test")); + Collections.singletonList("test")); //Set invalid headers headers.put("x-death", "[I, am, not, array]"); @@ -478,26 +462,24 @@ public void process(GetResponse getResponse) { assertNotNull(death); assertEquals(1, death.size()); assertDeathReason(death, 0, TEST_QUEUE_NAME, "maxlen", "amq.direct", - Arrays.asList("test")); - - } - - public void rejectionTest(final boolean useNack) throws Exception { - deadLetterTest(new Callable() { - public Void call() throws Exception { - for (int x = 0; x < MSG_COUNT; x++) { - GetResponse getResponse = - channel.basicGet(TEST_QUEUE_NAME, false); - long tag = getResponse.getEnvelope().getDeliveryTag(); - if (useNack) { - channel.basicNack(tag, false, false); - } else { - channel.basicReject(tag, false); - } - } - return null; + Collections.singletonList("test")); + + } + + private void rejectionTest(final boolean useNack) throws Exception { + deadLetterTest((Callable) () -> { + for (int x = 0; x < MSG_COUNT; x++) { + GetResponse getResponse = + channel.basicGet(TEST_QUEUE_NAME, false); + long tag = getResponse.getEnvelope().getDeliveryTag(); + if (useNack) { + channel.basicNack(tag, false, false); + } else { + channel.basicReject(tag, false); } - }, null, "rejected"); + } + return null; + }, null, "rejected"); } private void deadLetterTest(final Runnable deathTrigger, @@ -505,12 +487,10 @@ private void deadLetterTest(final Runnable deathTrigger, String reason) throws Exception { - deadLetterTest(new Callable() { - public Object call() throws Exception { - deathTrigger.run(); - return null; - } - }, queueDeclareArgs, reason); + deadLetterTest(() -> { + deathTrigger.run(); + return null; + }, queueDeclareArgs, reason); } private void deadLetterTest(Callable deathTrigger, @@ -531,35 +511,30 @@ private void deadLetterTest(Callable deathTrigger, } public static void consume(final Channel channel, final String reason) throws IOException { - consumeN(channel, DLQ, MSG_COUNT, new WithResponse() { - @SuppressWarnings("unchecked") - public void process(GetResponse getResponse) { - Map headers = getResponse.getProps().getHeaders(); - assertNotNull(headers); - ArrayList death = (ArrayList) headers.get("x-death"); - assertNotNull(death); - // the following assertions shouldn't be checked on version lower than 3.7 - // as the headers are new in 3.7 - // see https://github.com/rabbitmq/rabbitmq-server/issues/1332 - if(TestUtils.isVersion37orLater(channel.getConnection())) { - assertNotNull(headers.get("x-first-death-queue")); - assertNotNull(headers.get("x-first-death-reason")); - assertNotNull(headers.get("x-first-death-exchange")); - } - assertEquals(1, death.size()); - assertDeathReason(death, 0, TEST_QUEUE_NAME, reason, - "amq.direct", - Arrays.asList("test")); + consumeN(channel, DLQ, MSG_COUNT, getResponse -> { + Map headers = getResponse.getProps().getHeaders(); + assertNotNull(headers); + ArrayList death = (ArrayList) headers.get("x-death"); + assertNotNull(death); + // the following assertions shouldn't be checked on version lower than 3.7 + // as the headers are new in 3.7 + // see https://github.com/rabbitmq/rabbitmq-server/issues/1332 + if(TestUtils.isVersion37orLater(channel.getConnection())) { + assertNotNull(headers.get("x-first-death-queue")); + assertNotNull(headers.get("x-first-death-reason")); + assertNotNull(headers.get("x-first-death-exchange")); } + assertEquals(1, death.size()); + assertDeathReason(death, 0, TEST_QUEUE_NAME, reason, + "amq.direct", + Collections.singletonList("test")); }); } private void ttlTest(final long ttl) throws Exception { Map args = new HashMap(); args.put("x-message-ttl", ttl); - deadLetterTest(new Runnable() { - public void run() { sleep(ttl + 1500); } - }, args, "expired"); + deadLetterTest(() -> sleep(ttl + 1500), args, "expired"); } private void sleep(long millis) { @@ -604,7 +579,7 @@ private void declareQueue(String queue, Object deadLetterExchange, throws IOException { if (args == null) { - args = new HashMap(); + args = new HashMap<>(); } if (ttl > 0){ @@ -674,7 +649,7 @@ private static void assertDeathReason(List death, int num, (Map)death.get(num); assertEquals(exchange, deathHeader.get("exchange").toString()); - List deathRKs = new ArrayList(); + List deathRKs = new ArrayList<>(); for (Object rk : (ArrayList)deathHeader.get("routing-keys")) { deathRKs.add(rk.toString()); } @@ -694,13 +669,11 @@ private static void assertDeathReason(List death, int num, assertEquals(reason, deathHeader.get("reason").toString()); } - private static interface WithResponse { - static final WithResponse NULL = new WithResponse() { - public void process(GetResponse getResponse) { - } - }; + private interface WithResponse { + WithResponse NULL = getResponse -> { + }; - public void process(GetResponse response); + void process(GetResponse response); } private static String randomQueueName() { @@ -709,9 +682,9 @@ private static String randomQueueName() { class AccumulatingMessageConsumer extends DefaultConsumer { - BlockingQueue messages = new LinkedBlockingQueue(); + BlockingQueue messages = new LinkedBlockingQueue<>(); - public AccumulatingMessageConsumer(Channel channel) { + AccumulatingMessageConsumer(Channel channel) { super(channel); } From 3242f7a3fff74f22c766528c2b16ddba869af3f8 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Thu, 28 Feb 2019 18:30:46 +0300 Subject: [PATCH 119/328] Update more tests to explicitly delete queues See dae7b13849a929d653c9bec62d782914e6644f8c for background. (cherry picked from commit 75042ec95794ac264426ff165c7d2abc0451aa69) --- .../client/test/functional/CcRoutes.java | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/functional/CcRoutes.java b/src/test/java/com/rabbitmq/client/test/functional/CcRoutes.java index 8d0136419c..942d4d2f66 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/CcRoutes.java +++ b/src/test/java/com/rabbitmq/client/test/functional/CcRoutes.java @@ -39,30 +39,38 @@ public class CcRoutes extends BrokerTestCase { static private final String[] queues = new String[]{"queue1", "queue2", "queue3"}; - protected final String exDirect = "direct_cc_exchange"; - protected final String exTopic = "topic_cc_exchange"; - protected BasicProperties.Builder propsBuilder; + private final String exDirect = "direct_cc_exchange"; + private final String exTopic = "topic_cc_exchange"; + private BasicProperties.Builder propsBuilder; protected Map headers; - protected List ccList; - protected List bccList; + private List ccList; + private List bccList; @Override public void setUp() throws IOException, TimeoutException { super.setUp(); propsBuilder = new BasicProperties.Builder(); - headers = new HashMap(); - ccList = new ArrayList(); - bccList = new ArrayList(); + headers = new HashMap<>(); + ccList = new ArrayList<>(); + bccList = new ArrayList<>(); } @Override protected void createResources() throws IOException, TimeoutException { super.createResources(); for (String q : queues) { - channel.queueDeclare(q, false, true, true, null); + channel.queueDeclare(q, false, false, true, null); } channel.exchangeDeclare(exDirect, "direct", false, true, null); channel.exchangeDeclare(exTopic, "topic", false, true, null); } + @Override + protected void releaseResources() throws IOException { + super.releaseResources(); + for (String q : queues) { + channel.queueDelete(q); + } + } + @Test public void ccList() throws IOException { ccList.add("queue2"); ccList.add("queue3"); From 082c2f9c79306cab174a23431cb41f54f6932c86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 1 Mar 2019 10:11:20 +0100 Subject: [PATCH 120/328] Change queue names between test methods To avoid collisions on slow environments like CI. (cherry picked from commit abb67a75c1614d54e071f6f1de01b85b5cc871eb) --- .../client/test/functional/CcRoutes.java | 68 +++++++++++-------- 1 file changed, 41 insertions(+), 27 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/functional/CcRoutes.java b/src/test/java/com/rabbitmq/client/test/functional/CcRoutes.java index 942d4d2f66..7e02faae15 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/CcRoutes.java +++ b/src/test/java/com/rabbitmq/client/test/functional/CcRoutes.java @@ -22,12 +22,10 @@ import static org.junit.Assert.fail; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.TimeoutException; +import java.util.stream.Collectors; +import java.util.stream.IntStream; import org.junit.Test; @@ -38,7 +36,7 @@ public class CcRoutes extends BrokerTestCase { - static private final String[] queues = new String[]{"queue1", "queue2", "queue3"}; + private String[] queues; private final String exDirect = "direct_cc_exchange"; private final String exTopic = "topic_cc_exchange"; private BasicProperties.Builder propsBuilder; @@ -56,6 +54,10 @@ public class CcRoutes extends BrokerTestCase { @Override protected void createResources() throws IOException, TimeoutException { super.createResources(); + queues = IntStream.range(1, 4) + .mapToObj(index -> CcRoutes.class.getSimpleName() + "." + UUID.randomUUID().toString()) + .collect(Collectors.toList()) + .toArray(new String[]{}); for (String q : queues) { channel.queueDeclare(q, false, false, true, null); } @@ -72,58 +74,58 @@ protected void releaseResources() throws IOException { } @Test public void ccList() throws IOException { - ccList.add("queue2"); - ccList.add("queue3"); - headerPublish("", "queue1", ccList, null); - expect(new String []{"queue1", "queue2", "queue3"}, true); + ccList.add(queue2()); + ccList.add(queue3()); + headerPublish("", queue1(), ccList, null); + expect(new String []{queue1(), queue2(), queue3()}, true); } @Test public void ccIgnoreEmptyAndInvalidRoutes() throws IOException { bccList.add("frob"); - headerPublish("", "queue1", ccList, bccList); - expect(new String []{"queue1"}, true); + headerPublish("", queue1(), ccList, bccList); + expect(new String []{queue1()}, true); } @Test public void bcc() throws IOException { - bccList.add("queue2"); - headerPublish("", "queue1", null, bccList); - expect(new String []{"queue1", "queue2"}, false); + bccList.add(queue2()); + headerPublish("", queue1(), null, bccList); + expect(new String []{queue1(), queue2()}, false); } @Test public void noDuplicates() throws IOException { - ccList.add("queue1"); - ccList.add("queue1"); - bccList.add("queue1"); - headerPublish("", "queue1", ccList, bccList); - expect(new String[] {"queue1"}, true); + ccList.add(queue1()); + ccList.add(queue1()); + bccList.add(queue1()); + headerPublish("", queue1(), ccList, bccList); + expect(new String[] {queue1()}, true); } @Test public void directExchangeWithoutBindings() throws IOException { - ccList.add("queue1"); - headerPublish(exDirect, "queue2", ccList, null); + ccList.add(queue1()); + headerPublish(exDirect, queue2(), ccList, null); expect(new String[] {}, true); } @Test public void topicExchange() throws IOException { ccList.add("routing_key"); - channel.queueBind("queue2", exTopic, "routing_key"); + channel.queueBind(queue2(), exTopic, "routing_key"); headerPublish(exTopic, "", ccList, null); - expect(new String[] {"queue2"}, true); + expect(new String[] {queue2()}, true); } @Test public void boundExchanges() throws IOException { ccList.add("routing_key1"); bccList.add("routing_key2"); channel.exchangeBind(exTopic, exDirect, "routing_key1"); - channel.queueBind("queue2", exTopic, "routing_key2"); + channel.queueBind(queue2(), exTopic, "routing_key2"); headerPublish(exDirect, "", ccList, bccList); - expect(new String[] {"queue2"}, true); + expect(new String[] {queue2()}, true); } @Test public void nonArray() throws IOException { headers.put("CC", 0); propsBuilder.headers(headers); - channel.basicPublish("", "queue1", propsBuilder.build(), new byte[0]); + channel.basicPublish("", queue1(), propsBuilder.build(), new byte[0]); try { expect(new String[] {}, false); fail(); @@ -161,4 +163,16 @@ private void expect(String[] expectedQueues, boolean usedCc) throws IOException } } } + + String queue1() { + return queues[0]; + } + + String queue2() { + return queues[1]; + } + + String queue3() { + return queues[2]; + } } From 74a93623c3cbbd2ecb5b8054643e4a359b60a306 Mon Sep 17 00:00:00 2001 From: Spring Operator Date: Tue, 12 Mar 2019 08:27:56 -0500 Subject: [PATCH 121/328] URL Cleanup This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener). # Fixed URLs ## Fixed Success These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended. * http://www.apache.org/licenses/LICENSE-2.0 migrated to: https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200). * http://www.apache.org/licenses/LICENSE-2.0.html migrated to: https://www.apache.org/licenses/LICENSE-2.0.html ([https](https://www.apache.org/licenses/LICENSE-2.0.html) result 200). * http://www.gnu.org/licenses/gpl-2.0.txt migrated to: https://www.gnu.org/licenses/gpl-2.0.txt ([https](https://www.gnu.org/licenses/gpl-2.0.txt) result 200). * http://www.rabbitmq.com migrated to: https://www.rabbitmq.com ([https](https://www.rabbitmq.com) result 200). * http://www.mozilla.org/MPL/MPL-1.1.txt migrated to: https://www.mozilla.org/MPL/MPL-1.1.txt ([https](https://www.mozilla.org/MPL/MPL-1.1.txt) result 301). # Ignored These URLs were intentionally ignored. * http://maven.apache.org/POM/4.0.0 * http://maven.apache.org/xsd/maven-4.0.0.xsd * http://www.w3.org/2001/XMLSchema-instance (cherry picked from commit ad3809c3ca3a188eb74bf3d5b69ffb4cda0d8996) --- mvnw | 2 +- mvnw.cmd | 2 +- pom.xml | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mvnw b/mvnw index e96ccd5fbb..4e574d9a02 100755 --- a/mvnw +++ b/mvnw @@ -8,7 +8,7 @@ # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an diff --git a/mvnw.cmd b/mvnw.cmd index 4f0b068a03..23ab056e29 100755 --- a/mvnw.cmd +++ b/mvnw.cmd @@ -7,7 +7,7 @@ @REM "License"); you may not use this file except in compliance @REM with the License. You may obtain a copy of the License at @REM -@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM https://www.apache.org/licenses/LICENSE-2.0 @REM @REM Unless required by applicable law or agreed to in writing, @REM software distributed under the License is distributed on an diff --git a/pom.xml b/pom.xml index b4b6cd3d46..7ee17b23e7 100644 --- a/pom.xml +++ b/pom.xml @@ -9,22 +9,22 @@ RabbitMQ Java Client The RabbitMQ Java client library allows Java applications to interface with RabbitMQ. - http://www.rabbitmq.com + https://www.rabbitmq.com ASL 2.0 - http://www.apache.org/licenses/LICENSE-2.0.html + https://www.apache.org/licenses/LICENSE-2.0.html repo GPL v2 - http://www.gnu.org/licenses/gpl-2.0.txt + https://www.gnu.org/licenses/gpl-2.0.txt repo MPL 1.1 - http://www.mozilla.org/MPL/MPL-1.1.txt + https://www.mozilla.org/MPL/MPL-1.1.txt repo @@ -47,7 +47,7 @@ Pivotal Software, Inc. - http://www.rabbitmq.com + https://www.rabbitmq.com From 69f3d3ca4cfe309230d094de9a7e80fb891a870f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 15 Mar 2019 09:49:27 +0100 Subject: [PATCH 122/328] Squash a few warnings in tests (cherry picked from commit 1bd2ea4508e6206fc84faa81c8158a276446b8f5) --- .../client/test/functional/DeadLetterExchange.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java b/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java index f78bd7a264..12e96cf4b8 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java +++ b/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java @@ -230,6 +230,7 @@ protected void releaseResources() throws IOException { consumeN(DLQ, MSG_COUNT, WithResponse.NULL); } + @SuppressWarnings("unchecked") @Test public void deadLetterPerMessageTTLRemoved() throws Exception { declareQueue(TEST_QUEUE_NAME, DLX, null, null, 1); channel.queueBind(TEST_QUEUE_NAME, "amq.direct", "test"); @@ -247,11 +248,10 @@ protected void releaseResources() throws IOException { assertNull(getResponse.getProps().getExpiration()); Map headers = getResponse.getProps().getHeaders(); assertNotNull(headers); - ArrayList death = (ArrayList)headers.get("x-death"); + ArrayList death = (ArrayList) headers.get("x-death"); assertNotNull(death); assertDeathReason(death, 0, TEST_QUEUE_NAME, "expired"); - final Map deathHeader = - (Map)death.get(0); + final Map deathHeader = (Map) death.get(0); assertEquals("100", deathHeader.get("original-expiration").toString()); }); } @@ -287,6 +287,7 @@ protected void releaseResources() throws IOException { publishN(MSG_COUNT); } + @SuppressWarnings("unchecked") @Test public void deadLetterTwice() throws Exception { declareQueue(TEST_QUEUE_NAME, DLX, null, null, 1); @@ -308,7 +309,7 @@ protected void releaseResources() throws IOException { consumeN(DLQ2, MSG_COUNT*2, getResponse -> { Map headers = getResponse.getProps().getHeaders(); assertNotNull(headers); - ArrayList death = (ArrayList)headers.get("x-death"); + ArrayList death = (ArrayList) headers.get("x-death"); assertNotNull(death); if (death.size() == 1) { assertDeathReason(death, 0, TEST_QUEUE_NAME, "expired"); @@ -357,6 +358,7 @@ public void handleDelivery(String consumerTag, Envelope envelope, assertTrue(latch.await(10, TimeUnit.SECONDS)); } + @SuppressWarnings("unchecked") @Test public void deadLetterNewRK() throws Exception { declareQueue(TEST_QUEUE_NAME, DLX, "test-other", null, 1); @@ -510,6 +512,7 @@ private void deadLetterTest(Callable deathTrigger, consume(channel, reason); } + @SuppressWarnings("unchecked") public static void consume(final Channel channel, final String reason) throws IOException { consumeN(channel, DLQ, MSG_COUNT, getResponse -> { Map headers = getResponse.getProps().getHeaders(); From b0a599c9137303088a3229aff222f2c413f095f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 15 Mar 2019 15:30:05 +0100 Subject: [PATCH 123/328] Track connections left open in tests (cherry picked from commit 329156821f7b5e023e1d422558503bfb03c3ba34) Conflicts: src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java --- .../client/test/AMQConnectionTest.java | 4 +-- .../client/test/BrokenFramesTest.java | 4 +-- .../rabbitmq/client/test/BrokerTestCase.java | 3 -- .../ChannelAsyncCompletableFutureTest.java | 13 +++---- .../ChannelRpcTimeoutIntegrationTest.java | 4 +-- .../client/test/ConnectionFactoryTest.java | 2 -- ...RecoveryAwareAMQConnectionFactoryTest.java | 1 - .../client/test/RpcTopologyRecordingTest.java | 12 +++---- .../com/rabbitmq/client/test/TestUtils.java | 6 ++++ .../test/functional/ConnectionOpen.java | 3 +- .../client/test/functional/Heartbeat.java | 17 ++++----- .../test/functional/UnexpectedFrames.java | 3 +- .../client/test/functional/UserIDHeader.java | 13 ++++--- .../client/test/server/BlockedConnection.java | 13 +++++-- .../test/server/ChannelLimitNegotiation.java | 10 ++++-- src/test/java/com/rabbitmq/tools/Host.java | 36 ++++++++++++++----- 16 files changed, 89 insertions(+), 55 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/AMQConnectionTest.java b/src/test/java/com/rabbitmq/client/test/AMQConnectionTest.java index ae8bc1e258..ece2e42e05 100644 --- a/src/test/java/com/rabbitmq/client/test/AMQConnectionTest.java +++ b/src/test/java/com/rabbitmq/client/test/AMQConnectionTest.java @@ -51,14 +51,14 @@ public class AMQConnectionTest { private ConnectionFactory factory; private MyExceptionHandler exceptionHandler; - @Before public void setUp() throws Exception { + @Before public void setUp() { _mockFrameHandler = new MockFrameHandler(); factory = TestUtils.connectionFactory(); exceptionHandler = new MyExceptionHandler(); factory.setExceptionHandler(exceptionHandler); } - @After public void tearDown() throws Exception { + @After public void tearDown() { factory = null; _mockFrameHandler = null; } diff --git a/src/test/java/com/rabbitmq/client/test/BrokenFramesTest.java b/src/test/java/com/rabbitmq/client/test/BrokenFramesTest.java index 1b499e9057..b9853a6731 100644 --- a/src/test/java/com/rabbitmq/client/test/BrokenFramesTest.java +++ b/src/test/java/com/rabbitmq/client/test/BrokenFramesTest.java @@ -42,12 +42,12 @@ public class BrokenFramesTest { private MyFrameHandler myFrameHandler; private ConnectionFactory factory; - @Before public void setUp() throws Exception { + @Before public void setUp() { myFrameHandler = new MyFrameHandler(); factory = TestUtils.connectionFactory(); } - @After public void tearDown() throws Exception { + @After public void tearDown() { factory = null; myFrameHandler = null; } diff --git a/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java b/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java index 1a00ca8c1b..2608c0ca2e 100644 --- a/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java +++ b/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java @@ -20,7 +20,6 @@ import com.rabbitmq.client.impl.nio.NioParams; import com.rabbitmq.tools.Host; import org.junit.After; -import org.junit.Assume; import org.junit.Before; import org.junit.Rule; import org.junit.rules.TestRule; @@ -32,7 +31,6 @@ import javax.net.ssl.SSLContext; import java.io.IOException; import java.security.NoSuchAlgorithmException; -import java.util.Arrays; import java.util.Map; import java.util.UUID; import java.util.concurrent.TimeoutException; @@ -184,7 +182,6 @@ public void checkShutdownSignal(int expectedCode, ShutdownSignalException sse) { Method method = sse.getReason(); channel = null; if (sse.isHardError()) { - connection = null; AMQP.Connection.Close closeMethod = (AMQP.Connection.Close) method; assertEquals(expectedCode, closeMethod.getReplyCode()); } else { diff --git a/src/test/java/com/rabbitmq/client/test/ChannelAsyncCompletableFutureTest.java b/src/test/java/com/rabbitmq/client/test/ChannelAsyncCompletableFutureTest.java index c94e17a7b0..c6e51f777f 100644 --- a/src/test/java/com/rabbitmq/client/test/ChannelAsyncCompletableFutureTest.java +++ b/src/test/java/com/rabbitmq/client/test/ChannelAsyncCompletableFutureTest.java @@ -25,10 +25,7 @@ import java.io.IOException; import java.util.UUID; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; +import java.util.concurrent.*; import static org.junit.Assert.assertTrue; @@ -39,13 +36,17 @@ public class ChannelAsyncCompletableFutureTest extends BrokerTestCase { String queue; String exchange; - @Before public void init() { + @Override + protected void createResources() throws IOException, TimeoutException { + super.createResources(); executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); queue = UUID.randomUUID().toString(); exchange = UUID.randomUUID().toString(); } - @After public void tearDown() throws IOException { + @Override + protected void releaseResources() throws IOException { + super.releaseResources(); executor.shutdownNow(); channel.queueDelete(queue); channel.exchangeDelete(exchange); diff --git a/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java b/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java index f880f617da..875d608d96 100644 --- a/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java +++ b/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java @@ -37,12 +37,12 @@ public class ChannelRpcTimeoutIntegrationTest { ConnectionFactory factory; @Before - public void setUp() throws Exception { + public void setUp() { factory = TestUtils.connectionFactory(); } @After - public void tearDown() throws Exception { + public void tearDown() { factory = null; } diff --git a/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java b/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java index cccabd243e..adca51336a 100644 --- a/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java +++ b/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java @@ -27,8 +27,6 @@ import com.rabbitmq.client.impl.CredentialsProvider; import com.rabbitmq.client.impl.FrameHandler; import com.rabbitmq.client.impl.FrameHandlerFactory; -import org.hamcrest.Matchers; -import org.junit.Assert; import org.junit.Test; import java.io.IOException; diff --git a/src/test/java/com/rabbitmq/client/test/RecoveryAwareAMQConnectionFactoryTest.java b/src/test/java/com/rabbitmq/client/test/RecoveryAwareAMQConnectionFactoryTest.java index 8f8354b2db..704c252bc0 100644 --- a/src/test/java/com/rabbitmq/client/test/RecoveryAwareAMQConnectionFactoryTest.java +++ b/src/test/java/com/rabbitmq/client/test/RecoveryAwareAMQConnectionFactoryTest.java @@ -28,7 +28,6 @@ import java.io.IOException; import java.util.Arrays; -import java.util.List; import java.util.Queue; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.TimeoutException; diff --git a/src/test/java/com/rabbitmq/client/test/RpcTopologyRecordingTest.java b/src/test/java/com/rabbitmq/client/test/RpcTopologyRecordingTest.java index a04baa4682..47c56b9953 100644 --- a/src/test/java/com/rabbitmq/client/test/RpcTopologyRecordingTest.java +++ b/src/test/java/com/rabbitmq/client/test/RpcTopologyRecordingTest.java @@ -17,8 +17,6 @@ import com.rabbitmq.client.*; import com.rabbitmq.client.impl.AMQImpl; -import org.junit.After; -import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -57,8 +55,9 @@ protected ConnectionFactory newConnectionFactory() { return connectionFactory; } - @Before - public void init() { + @Override + protected void createResources() throws IOException, TimeoutException { + super.createResources(); queue = UUID.randomUUID().toString(); exchange = UUID.randomUUID().toString(); routingKey = UUID.randomUUID().toString(); @@ -67,8 +66,9 @@ public void init() { routingKey2 = "e2e-" + UUID.randomUUID().toString(); } - @After - public void tearDown() throws IOException { + @Override + protected void releaseResources() throws IOException { + super.releaseResources(); channel.exchangeDelete(exchange); channel.exchangeDelete(exchange2); } diff --git a/src/test/java/com/rabbitmq/client/test/TestUtils.java b/src/test/java/com/rabbitmq/client/test/TestUtils.java index b6cb834773..adc5ffb759 100644 --- a/src/test/java/com/rabbitmq/client/test/TestUtils.java +++ b/src/test/java/com/rabbitmq/client/test/TestUtils.java @@ -67,6 +67,12 @@ public static void close(Connection connection) { } } + public static void abort(Connection connection) { + if (connection != null) { + connection.abort(); + } + } + public static SSLContext getSSLContext() throws NoSuchAlgorithmException { SSLContext c = null; diff --git a/src/test/java/com/rabbitmq/client/test/functional/ConnectionOpen.java b/src/test/java/com/rabbitmq/client/test/functional/ConnectionOpen.java index 5f4f1e88c6..91b6f18ba9 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ConnectionOpen.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ConnectionOpen.java @@ -43,13 +43,12 @@ */ public class ConnectionOpen { @Test public void correctProtocolHeader() throws IOException { - ConnectionFactory factory = TestUtils.connectionFactory(); SocketFrameHandler fh = new SocketFrameHandler(SocketFactory.getDefault().createSocket("localhost", AMQP.PROTOCOL.PORT)); fh.sendHeader(); AMQCommand command = new AMQCommand(); while (!command.handleFrame(fh.readFrame())) { } Method m = command.getMethod(); - // System.out.println(m.getClass()); + assertTrue("First command must be Connection.start", m instanceof AMQP.Connection.Start); AMQP.Connection.Start start = (AMQP.Connection.Start) m; diff --git a/src/test/java/com/rabbitmq/client/test/functional/Heartbeat.java b/src/test/java/com/rabbitmq/client/test/functional/Heartbeat.java index fe0f904103..14c58c60a0 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Heartbeat.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Heartbeat.java @@ -16,6 +16,7 @@ package com.rabbitmq.client.test.functional; +import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.impl.recovery.AutorecoveringConnection; import com.rabbitmq.client.test.BrokerTestCase; import org.junit.Test; @@ -26,19 +27,19 @@ public class Heartbeat extends BrokerTestCase { - public Heartbeat() - { - super(); - connectionFactory.setRequestedHeartbeat(1); + @Override + protected ConnectionFactory newConnectionFactory() { + ConnectionFactory cf = super.newConnectionFactory(); + cf.setRequestedHeartbeat(1); + return cf; } - @Test public void heartbeat() - throws IOException, InterruptedException - { + @Test + public void heartbeat() throws InterruptedException { assertEquals(1, connection.getHeartbeat()); Thread.sleep(3100); assertTrue(connection.isOpen()); - ((AutorecoveringConnection)connection).getDelegate().setHeartbeat(0); + ((AutorecoveringConnection) connection).getDelegate().setHeartbeat(0); assertEquals(0, connection.getHeartbeat()); Thread.sleep(3100); assertFalse(connection.isOpen()); diff --git a/src/test/java/com/rabbitmq/client/test/functional/UnexpectedFrames.java b/src/test/java/com/rabbitmq/client/test/functional/UnexpectedFrames.java index 698d8a8952..2599a7663c 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/UnexpectedFrames.java +++ b/src/test/java/com/rabbitmq/client/test/functional/UnexpectedFrames.java @@ -17,7 +17,6 @@ import com.rabbitmq.client.AMQP; import com.rabbitmq.client.ConnectionFactory; -import com.rabbitmq.client.DefaultSocketConfigurator; import com.rabbitmq.client.SocketConfigurators; import com.rabbitmq.client.impl.*; import com.rabbitmq.client.impl.recovery.AutorecoveringConnection; @@ -35,7 +34,7 @@ public class UnexpectedFrames extends BrokerTestCase { private interface Confuser { - public Frame confuse(Frame frame) throws IOException; + Frame confuse(Frame frame) throws IOException; } private static class ConfusedFrameHandler extends SocketFrameHandler { diff --git a/src/test/java/com/rabbitmq/client/test/functional/UserIDHeader.java b/src/test/java/com/rabbitmq/client/test/functional/UserIDHeader.java index e31bb64bb1..7d64fee7a7 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/UserIDHeader.java +++ b/src/test/java/com/rabbitmq/client/test/functional/UserIDHeader.java @@ -20,6 +20,8 @@ import java.io.IOException; import java.util.concurrent.TimeoutException; +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.Connection; import org.junit.Test; import com.rabbitmq.client.AMQP; @@ -48,17 +50,18 @@ public class UserIDHeader extends BrokerTestCase { @Test public void impersonatedUserId() throws IOException, TimeoutException { Host.rabbitmqctl("set_user_tags guest administrator impersonator"); - connection = null; - channel = null; - setUp(); - try { - publish(BAD); + try (Connection c = connectionFactory.newConnection()){ + publish(BAD, c.createChannel()); } finally { Host.rabbitmqctl("set_user_tags guest administrator"); } } private void publish(AMQP.BasicProperties properties) throws IOException { + publish(properties, this.channel); + } + + private void publish(AMQP.BasicProperties properties, Channel channel) throws IOException { channel.basicPublish("amq.fanout", "", properties, "".getBytes()); channel.queueDeclare(); // To flush the channel } diff --git a/src/test/java/com/rabbitmq/client/test/server/BlockedConnection.java b/src/test/java/com/rabbitmq/client/test/server/BlockedConnection.java index 1c75628ec7..61a84ae731 100644 --- a/src/test/java/com/rabbitmq/client/test/server/BlockedConnection.java +++ b/src/test/java/com/rabbitmq/client/test/server/BlockedConnection.java @@ -50,7 +50,12 @@ protected void releaseResources() throws IOException { block(); publish(connection); - assertTrue(latch.await(10, TimeUnit.SECONDS)); + try { + assertTrue(latch.await(10, TimeUnit.SECONDS)); + } finally { + TestUtils.abort(connection); + } + } // this test first triggers an alarm, then opens a @@ -62,7 +67,11 @@ protected void releaseResources() throws IOException { Connection connection = connection(latch); publish(connection); - assertTrue(latch.await(10, TimeUnit.SECONDS)); + try { + assertTrue(latch.await(10, TimeUnit.SECONDS)); + } finally { + TestUtils.abort(connection); + } } private Connection connection(final CountDownLatch latch) throws IOException, TimeoutException { diff --git a/src/test/java/com/rabbitmq/client/test/server/ChannelLimitNegotiation.java b/src/test/java/com/rabbitmq/client/test/server/ChannelLimitNegotiation.java index 6111e2660e..f6500b0677 100644 --- a/src/test/java/com/rabbitmq/client/test/server/ChannelLimitNegotiation.java +++ b/src/test/java/com/rabbitmq/client/test/server/ChannelLimitNegotiation.java @@ -42,6 +42,7 @@ import com.rabbitmq.tools.Host; public class ChannelLimitNegotiation extends BrokerTestCase { + class SpecialConnection extends AMQConnection { private final int channelMax; @@ -68,8 +69,9 @@ protected int negotiateChannelMax(int requestedChannelMax, int serverMax) { ConnectionFactory cf = TestUtils.connectionFactory(); cf.setRequestedChannelMax(n); - Connection conn = cf.newConnection(); - assertEquals(n, conn.getChannelMax()); + try (Connection conn = cf.newConnection()) { + assertEquals(n, conn.getChannelMax()); + } } @Test public void channelMaxGreaterThanServerValue() throws Exception { @@ -91,10 +93,11 @@ protected int negotiateChannelMax(int requestedChannelMax, int serverMax) { @Test public void openingTooManyChannels() throws Exception { int n = 48; + Connection conn = null; try { Host.rabbitmqctl("eval 'application:set_env(rabbit, channel_max, " + n + ").'"); ConnectionFactory cf = TestUtils.connectionFactory(); - Connection conn = cf.newConnection(); + conn = cf.newConnection(); assertEquals(n, conn.getChannelMax()); for (int i = 1; i <= n; i++) { @@ -118,6 +121,7 @@ public void shutdownCompleted(ShutdownSignalException cause) { } catch (IOException e) { checkShutdownSignal(530, e); } finally { + TestUtils.abort(conn); Host.rabbitmqctl("eval 'application:set_env(rabbit, channel_max, 0).'"); } } diff --git a/src/test/java/com/rabbitmq/tools/Host.java b/src/test/java/com/rabbitmq/tools/Host.java index 564d8f217c..0c9e7dbbf1 100644 --- a/src/test/java/com/rabbitmq/tools/Host.java +++ b/src/test/java/com/rabbitmq/tools/Host.java @@ -22,6 +22,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import com.rabbitmq.client.Connection; @@ -222,10 +223,12 @@ public static void closeConnection(NetworkConnection c) throws IOException { public static class ConnectionInfo { private final String pid; private final int peerPort; + private final String clientProperties; - public ConnectionInfo(String pid, int peerPort) { + public ConnectionInfo(String pid, int peerPort, String clientProperties) { this.pid = pid; this.peerPort = peerPort; + this.clientProperties = clientProperties; } public String getPid() { @@ -235,10 +238,23 @@ public String getPid() { public int getPeerPort() { return peerPort; } + + public String getClientProperties() { + return clientProperties; + } + + @Override + public String toString() { + return "ConnectionInfo{" + + "pid='" + pid + '\'' + + ", peerPort=" + peerPort + + ", clientProperties='" + clientProperties + '\'' + + '}'; + } } public static List listConnections() throws IOException { - String output = capture(rabbitmqctl("list_connections -q pid peer_port").getInputStream()); + String output = capture(rabbitmqctl("list_connections -q pid peer_port client_properties").getInputStream()); // output (header line presence depends on broker version): // pid peer_port // 58713 @@ -246,13 +262,15 @@ public static List listConnections() throws IOException { ArrayList result = new ArrayList(); for (String line : allLines) { - // line: 58713 - String[] columns = line.split("\t"); - // can be also header line, so ignoring NumberFormatException - try { - result.add(new ConnectionInfo(columns[0], Integer.valueOf(columns[1]))); - } catch (NumberFormatException e) { - // OK + if (line != null && !line.trim().isEmpty()) { + // line: 58713 + String[] columns = line.split("\t"); + // can be also header line, so ignoring NumberFormatException + try { + result.add(new ConnectionInfo(columns[0], Integer.valueOf(columns[1]), columns[2])); + } catch (NumberFormatException e) { + // OK + } } } return result; From 4c95c600cf9ed05993c53cff7028b610d4785f96 Mon Sep 17 00:00:00 2001 From: Spring Operator Date: Fri, 15 Mar 2019 21:11:26 -0500 Subject: [PATCH 124/328] URL Cleanup This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener). # Fixed URLs ## Fixed Success These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended. * http://maven.apache.org/xsd/maven-4.0.0.xsd with 1 occurrences migrated to: https://maven.apache.org/xsd/maven-4.0.0.xsd ([https](https://maven.apache.org/xsd/maven-4.0.0.xsd) result 200). # Ignored These URLs were intentionally ignored. * http://maven.apache.org/POM/4.0.0 with 2 occurrences * http://www.w3.org/2001/XMLSchema-instance with 1 occurrences --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7ee17b23e7..4da58c9d4f 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,5 @@ - + 4.0.0 com.rabbitmq From f2a61d71e1cf2286f661ed449372ed4dd30e6eea Mon Sep 17 00:00:00 2001 From: Spring Operator Date: Wed, 20 Mar 2019 03:16:18 -0500 Subject: [PATCH 125/328] URL Cleanup This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener). # HTTP URLs that Could Not Be Fixed These URLs were unable to be fixed. Please review them to see if they can be manually resolved. * http://javadoc.iaik.tugraz.at/iaik_jce/current/iaik/asn1/BIT_STRING.html (200) with 1 occurrences could not be migrated: ([https](https://javadoc.iaik.tugraz.at/iaik_jce/current/iaik/asn1/BIT_STRING.html) result NotSslRecordException). * http://luca.ntop.org/Teaching/Appunti/asn1.html (200) with 1 occurrences could not be migrated: ([https](https://luca.ntop.org/Teaching/Appunti/asn1.html) result SSLHandshakeException). # Fixed URLs ## Fixed Success These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended. * http://github.com/rabbitmq/ with 1 occurrences migrated to: https://github.com/rabbitmq/ ([https](https://github.com/rabbitmq/) result 200). * http://search.maven.org/ with 1 occurrences migrated to: https://search.maven.org/ ([https](https://search.maven.org/) result 200). * http://stackoverflow.com/questions/6701948/efficient-way-to-compare-version-strings-in-java with 1 occurrences migrated to: https://stackoverflow.com/questions/6701948/efficient-way-to-compare-version-strings-in-java ([https](https://stackoverflow.com/questions/6701948/efficient-way-to-compare-version-strings-in-java) result 200). * http://www.amqp.org/ with 1 occurrences migrated to: https://www.amqp.org/ ([https](https://www.amqp.org/) result 200). * http://www.apple.com/DTDs/PropertyList-1.0.dtd with 1 occurrences migrated to: https://www.apple.com/DTDs/PropertyList-1.0.dtd ([https](https://www.apple.com/DTDs/PropertyList-1.0.dtd) result 200). * http://www.json.org/ with 1 occurrences migrated to: https://www.json.org/ ([https](https://www.json.org/) result 200). * http://json-rpc.org (302) with 1 occurrences migrated to: https://www.jsonrpc.org/ ([https](https://json-rpc.org) result 200). * http://www.rabbitmq.com with 1 occurrences migrated to: https://www.rabbitmq.com ([https](https://www.rabbitmq.com) result 200). * http://www.rabbitmq.com/ with 1 occurrences migrated to: https://www.rabbitmq.com/ ([https](https://www.rabbitmq.com/) result 200). * http://www.rabbitmq.com/alarms.html with 6 occurrences migrated to: https://www.rabbitmq.com/alarms.html ([https](https://www.rabbitmq.com/alarms.html) result 200). * http://www.rabbitmq.com/api-guide.html with 33 occurrences migrated to: https://www.rabbitmq.com/api-guide.html ([https](https://www.rabbitmq.com/api-guide.html) result 200). * http://www.rabbitmq.com/build-java-client.html with 1 occurrences migrated to: https://www.rabbitmq.com/build-java-client.html ([https](https://www.rabbitmq.com/build-java-client.html) result 200). * http://www.rabbitmq.com/confirms.html with 1 occurrences migrated to: https://www.rabbitmq.com/confirms.html ([https](https://www.rabbitmq.com/confirms.html) result 200). * http://www.rabbitmq.com/getstarted.html with 2 occurrences migrated to: https://www.rabbitmq.com/getstarted.html ([https](https://www.rabbitmq.com/getstarted.html) result 200). * http://www.rabbitmq.com/specification.html with 1 occurrences migrated to: https://www.rabbitmq.com/specification.html ([https](https://www.rabbitmq.com/specification.html) result 200). * http://contributor-covenant.org with 1 occurrences migrated to: https://contributor-covenant.org ([https](https://contributor-covenant.org) result 301). * http://contributor-covenant.org/version/1/3/0/ with 1 occurrences migrated to: https://contributor-covenant.org/version/1/3/0/ ([https](https://contributor-covenant.org/version/1/3/0/) result 301). * http://rabbitmq.com/heartbeats.html with 1 occurrences migrated to: https://rabbitmq.com/heartbeats.html ([https](https://rabbitmq.com/heartbeats.html) result 301). * http://www.mozilla.org/MPL/ with 1 occurrences migrated to: https://www.mozilla.org/MPL/ ([https](https://www.mozilla.org/MPL/) result 301). * http://creativecommons.org/licenses/publicdomain with 1 occurrences migrated to: https://creativecommons.org/licenses/publicdomain ([https](https://creativecommons.org/licenses/publicdomain) result 302). (cherry picked from commit 489ebacc85cd0cd49aa3b6ec97e962009028c528) --- CODE_OF_CONDUCT.md | 4 +- LICENSE-MPL-RabbitMQ | 2 +- README.in | 2 +- README.md | 6 +- doc/channels/worktransition.graffle | 2 +- .../java/com/rabbitmq/client/Channel.java | 22 +++---- .../java/com/rabbitmq/client/Connection.java | 6 +- .../rabbitmq/client/ConnectionFactory.java | 58 +++++++++---------- src/main/java/com/rabbitmq/client/Method.java | 2 +- .../rabbitmq/client/impl/AMQConnection.java | 2 +- .../impl/VariableLinkedBlockingQueue.java | 2 +- .../rabbitmq/tools/jsonrpc/JsonRpcClient.java | 4 +- .../com/rabbitmq/client/test/AmqpUriTest.java | 2 +- .../com/rabbitmq/client/test/TestUtils.java | 2 +- 14 files changed, 58 insertions(+), 58 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 1f6ef1c576..08697906fd 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -40,5 +40,5 @@ appropriate to the circumstances. Maintainers are obligated to maintain confiden with regard to the reporter of an incident. This Code of Conduct is adapted from the -[Contributor Covenant](http://contributor-covenant.org), version 1.3.0, available at -[contributor-covenant.org/version/1/3/0/](http://contributor-covenant.org/version/1/3/0/) +[Contributor Covenant](https://contributor-covenant.org), version 1.3.0, available at +[contributor-covenant.org/version/1/3/0/](https://contributor-covenant.org/version/1/3/0/) diff --git a/LICENSE-MPL-RabbitMQ b/LICENSE-MPL-RabbitMQ index 02ee669400..b237a959b0 100644 --- a/LICENSE-MPL-RabbitMQ +++ b/LICENSE-MPL-RabbitMQ @@ -437,7 +437,7 @@ EXHIBIT A -Mozilla Public License. ``The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ + https://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the diff --git a/README.in b/README.in index e9ccd32f24..c00367a7ab 100644 --- a/README.in +++ b/README.in @@ -1,4 +1,4 @@ -Please see http://www.rabbitmq.com/build-java-client.html for build +Please see https://www.rabbitmq.com/build-java-client.html for build instructions. For your convenience, a text copy of these instructions is available diff --git a/README.md b/README.md index 47e7ae1d06..103c73d08d 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # RabbitMQ Java Client -This repository contains source code of the [RabbitMQ Java client](http://www.rabbitmq.com/api-guide.html). -The client is maintained by the [RabbitMQ team at Pivotal](http://github.com/rabbitmq/). +This repository contains source code of the [RabbitMQ Java client](https://www.rabbitmq.com/api-guide.html). +The client is maintained by the [RabbitMQ team at Pivotal](https://github.com/rabbitmq/). ## Dependency (Maven Artifact) -Maven artifacts are [released to Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3Acom.rabbitmq%20a%3Aamqp-client) +Maven artifacts are [released to Maven Central](https://search.maven.org/#search%7Cga%7C1%7Cg%3Acom.rabbitmq%20a%3Aamqp-client) via [RabbitMQ Maven repository on Bintray](https://bintray.com/rabbitmq/maven). There's also a [Maven repository with milestone releases](https://bintray.com/rabbitmq/maven-milestones). [Snapshots are available](https://oss.sonatype.org/content/repositories/snapshots/com/rabbitmq/amqp-client/) as well. diff --git a/doc/channels/worktransition.graffle b/doc/channels/worktransition.graffle index a8c2d6ce8e..a1feddfa7f 100644 --- a/doc/channels/worktransition.graffle +++ b/doc/channels/worktransition.graffle @@ -1,5 +1,5 @@ - + ActiveLayerIndex diff --git a/src/main/java/com/rabbitmq/client/Channel.java b/src/main/java/com/rabbitmq/client/Channel.java index 6279bf881f..c4312e041a 100644 --- a/src/main/java/com/rabbitmq/client/Channel.java +++ b/src/main/java/com/rabbitmq/client/Channel.java @@ -32,11 +32,11 @@ * this interface are part of the public API. * *

Tutorials

- * RabbitMQ tutorials demonstrate how + * RabbitMQ tutorials demonstrate how * key methods of this interface are used. * *

User Guide

- * See Java Client User Guide. + * See Java Client User Guide. * *

Concurrency Considerations

*

@@ -47,13 +47,13 @@ * multiple threads. While some operations on channels are safe to invoke * concurrently, some are not and will result in incorrect frame interleaving * on the wire. Sharing channels between threads will also interfere with - * Publisher Confirms. + * Publisher Confirms. * * As such, applications need to use a {@link Channel} per thread. *

* - * @see RabbitMQ tutorials - * @see RabbitMQ Java Client User Guide + * @see RabbitMQ tutorials + * @see RabbitMQ Java Client User Guide */ public interface Channel extends ShutdownNotifier, AutoCloseable { /** @@ -243,10 +243,10 @@ public interface Channel extends ShutdownNotifier, AutoCloseable { * protocol exception, which closes the channel. * * Invocations of Channel#basicPublish will eventually block if a - * resource-driven alarm is in effect. + * resource-driven alarm is in effect. * * @see com.rabbitmq.client.AMQP.Basic.Publish - * @see Resource-driven alarms + * @see Resource-driven alarms * @param exchange the exchange to publish the message to * @param routingKey the routing key * @param props other properties for the message - routing headers etc @@ -259,10 +259,10 @@ public interface Channel extends ShutdownNotifier, AutoCloseable { * Publish a message. * * Invocations of Channel#basicPublish will eventually block if a - * resource-driven alarm is in effect. + * resource-driven alarm is in effect. * * @see com.rabbitmq.client.AMQP.Basic.Publish - * @see Resource-driven alarms + * @see Resource-driven alarms * @param exchange the exchange to publish the message to * @param routingKey the routing key * @param mandatory true if the 'mandatory' flag is to be set @@ -280,10 +280,10 @@ void basicPublish(String exchange, String routingKey, boolean mandatory, BasicPr * protocol exception, which closes the channel. * * Invocations of Channel#basicPublish will eventually block if a - * resource-driven alarm is in effect. + * resource-driven alarm is in effect. * * @see com.rabbitmq.client.AMQP.Basic.Publish - * @see Resource-driven alarms + * @see Resource-driven alarms * @param exchange the exchange to publish the message to * @param routingKey the routing key * @param mandatory true if the 'mandatory' flag is to be set diff --git a/src/main/java/com/rabbitmq/client/Connection.java b/src/main/java/com/rabbitmq/client/Connection.java index 3bde680075..2b1c9281ee 100644 --- a/src/main/java/com/rabbitmq/client/Connection.java +++ b/src/main/java/com/rabbitmq/client/Connection.java @@ -23,7 +23,7 @@ import java.util.concurrent.ExecutorService; /** - * Public API: Interface to an AMQ connection. See the see the spec for details. + * Public API: Interface to an AMQ connection. See the see the spec for details. *

* To connect to a broker, fill in a {@link ConnectionFactory} and use a {@link ConnectionFactory} as follows: * @@ -116,7 +116,7 @@ public interface Connection extends ShutdownNotifier, Closeable { // rename to A /** * Create a new channel, using an internally allocated channel number. - * If automatic connection recovery + * If automatic connection recovery * is enabled, the channel returned by this method will be {@link Recoverable}. *

* Use {@link #openChannel()} if you want to use an {@link Optional} to deal @@ -143,7 +143,7 @@ public interface Connection extends ShutdownNotifier, Closeable { // rename to A * Create a new channel wrapped in an {@link Optional}. * The channel number is allocated internally. *

- * If automatic connection recovery + * If automatic connection recovery * is enabled, the channel returned by this method will be {@link Recoverable}. *

* Use {@link #createChannel()} to return directly a {@link Channel} or {@code null}. diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index 12eccb007d..547422de83 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -493,7 +493,7 @@ public int getShutdownTimeout() { * If server heartbeat timeout is configured to a non-zero value, this method can only be used * to lower the value; otherwise any value provided by the client will be used. * @param requestedHeartbeat the initially requested heartbeat timeout, in seconds; zero for none - * @see RabbitMQ Heartbeats Guide + * @see RabbitMQ Heartbeats Guide */ public void setRequestedHeartbeat(int requestedHeartbeat) { this.requestedHeartbeat = requestedHeartbeat; @@ -789,19 +789,19 @@ public static String computeDefaultTlsProtocol(String[] supportedProtocols) { } /** - * Returns true if automatic connection recovery + * Returns true if automatic connection recovery * is enabled, false otherwise * @return true if automatic connection recovery is enabled, false otherwise - * @see Automatic Recovery + * @see Automatic Recovery */ public boolean isAutomaticRecoveryEnabled() { return automaticRecovery; } /** - * Enables or disables automatic connection recovery. + * Enables or disables automatic connection recovery. * @param automaticRecovery if true, enables connection recovery - * @see Automatic Recovery + * @see Automatic Recovery */ public void setAutomaticRecoveryEnabled(boolean automaticRecovery) { this.automaticRecovery = automaticRecovery; @@ -810,7 +810,7 @@ public void setAutomaticRecoveryEnabled(boolean automaticRecovery) { /** * Returns true if topology recovery is enabled, false otherwise * @return true if topology recovery is enabled, false otherwise - * @see Automatic Recovery + * @see Automatic Recovery */ public boolean isTopologyRecoveryEnabled() { return topologyRecovery; @@ -819,7 +819,7 @@ public boolean isTopologyRecoveryEnabled() { /** * Enables or disables topology recovery * @param topologyRecovery if true, enables topology recovery - * @see Automatic Recovery + * @see Automatic Recovery */ public void setTopologyRecoveryEnabled(boolean topologyRecovery) { this.topologyRecovery = topologyRecovery; @@ -873,7 +873,7 @@ protected synchronized FrameHandlerFactory createFrameHandlerFactory() throws IO * Create a new broker connection, picking the first available address from * the list. * - * If automatic connection recovery + * If automatic connection recovery * is enabled, the connection returned by this method will be {@link Recoverable}. Future * reconnection attempts will pick a random accessible address from the provided list. * @@ -889,14 +889,14 @@ public Connection newConnection(Address[] addrs) throws IOException, TimeoutExce * Create a new broker connection, picking the first available address from * the list provided by the {@link AddressResolver}. * - * If automatic connection recovery + * If automatic connection recovery * is enabled, the connection returned by this method will be {@link Recoverable}. Future * reconnection attempts will pick a random accessible address provided by the {@link AddressResolver}. * * @param addressResolver discovery service to list potential addresses (hostname/port pairs) to connect to * @return an interface to the connection * @throws IOException if it encounters a problem - * @see Automatic Recovery + * @see Automatic Recovery */ public Connection newConnection(AddressResolver addressResolver) throws IOException, TimeoutException { return newConnection(this.sharedExecutor, addressResolver, null); @@ -907,7 +907,7 @@ public Connection newConnection(AddressResolver addressResolver) throws IOExcept * Create a new broker connection with a client-provided name, picking the first available address from * the list. * - * If automatic connection recovery + * If automatic connection recovery * is enabled, the connection returned by this method will be {@link Recoverable}. Future * reconnection attempts will pick a random accessible address from the provided list. * @@ -928,7 +928,7 @@ public Connection newConnection(Address[] addrs, String clientProvidedName) thro * Create a new broker connection, picking the first available address from * the list. * - * If automatic connection recovery + * If automatic connection recovery * is enabled, the connection returned by this method will be {@link Recoverable}. Future * reconnection attempts will pick a random accessible address from the provided list. * @@ -944,7 +944,7 @@ public Connection newConnection(List

addrs) throws IOException, Timeout * Create a new broker connection with a client-provided name, picking the first available address from * the list. * - * If automatic connection recovery + * If automatic connection recovery * is enabled, the connection returned by this method will be {@link Recoverable}. Future * reconnection attempts will pick a random accessible address from the provided list. * @@ -965,7 +965,7 @@ public Connection newConnection(List
addrs, String clientProvidedName) * Create a new broker connection, picking the first available address from * the list. * - * If automatic connection recovery + * If automatic connection recovery * is enabled, the connection returned by this method will be {@link Recoverable}. Future * reconnection attempts will pick a random accessible address from the provided list. * @@ -973,7 +973,7 @@ public Connection newConnection(List
addrs, String clientProvidedName) * @param addrs an array of known broker addresses (hostname/port pairs) to try in order * @return an interface to the connection * @throws java.io.IOException if it encounters a problem - * @see Automatic Recovery + * @see Automatic Recovery */ public Connection newConnection(ExecutorService executor, Address[] addrs) throws IOException, TimeoutException { return newConnection(executor, Arrays.asList(addrs), null); @@ -984,7 +984,7 @@ public Connection newConnection(ExecutorService executor, Address[] addrs) throw * Create a new broker connection with a client-provided name, picking the first available address from * the list. * - * If automatic connection recovery + * If automatic connection recovery * is enabled, the connection returned by this method will be {@link Recoverable}. Future * reconnection attempts will pick a random accessible address from the provided list. * @@ -997,7 +997,7 @@ public Connection newConnection(ExecutorService executor, Address[] addrs) throw * This value is supposed to be human-readable. * @return an interface to the connection * @throws java.io.IOException if it encounters a problem - * @see Automatic Recovery + * @see Automatic Recovery */ public Connection newConnection(ExecutorService executor, Address[] addrs, String clientProvidedName) throws IOException, TimeoutException { return newConnection(executor, Arrays.asList(addrs), clientProvidedName); @@ -1007,7 +1007,7 @@ public Connection newConnection(ExecutorService executor, Address[] addrs, Strin * Create a new broker connection, picking the first available address from * the list. * - * If automatic connection recovery + * If automatic connection recovery * is enabled, the connection returned by this method will be {@link Recoverable}. Future * reconnection attempts will pick a random accessible address from the provided list. * @@ -1015,7 +1015,7 @@ public Connection newConnection(ExecutorService executor, Address[] addrs, Strin * @param addrs a List of known broker addrs (hostname/port pairs) to try in order * @return an interface to the connection * @throws java.io.IOException if it encounters a problem - * @see Automatic Recovery + * @see Automatic Recovery */ public Connection newConnection(ExecutorService executor, List
addrs) throws IOException, TimeoutException { return newConnection(executor, addrs, null); @@ -1025,7 +1025,7 @@ public Connection newConnection(ExecutorService executor, List
addrs) t * Create a new broker connection, picking the first available address from * the list provided by the {@link AddressResolver}. * - * If automatic connection recovery + * If automatic connection recovery * is enabled, the connection returned by this method will be {@link Recoverable}. Future * reconnection attempts will pick a random accessible address provided by the {@link AddressResolver}. * @@ -1033,7 +1033,7 @@ public Connection newConnection(ExecutorService executor, List
addrs) t * @param addressResolver discovery service to list potential addresses (hostname/port pairs) to connect to * @return an interface to the connection * @throws java.io.IOException if it encounters a problem - * @see Automatic Recovery + * @see Automatic Recovery */ public Connection newConnection(ExecutorService executor, AddressResolver addressResolver) throws IOException, TimeoutException { return newConnection(executor, addressResolver, null); @@ -1043,7 +1043,7 @@ public Connection newConnection(ExecutorService executor, AddressResolver addres * Create a new broker connection with a client-provided name, picking the first available address from * the list. * - * If automatic connection recovery + * If automatic connection recovery * is enabled, the connection returned by this method will be {@link Recoverable}. Future * reconnection attempts will pick a random accessible address from the provided list. * @@ -1056,7 +1056,7 @@ public Connection newConnection(ExecutorService executor, AddressResolver addres * This value is supposed to be human-readable. * @return an interface to the connection * @throws java.io.IOException if it encounters a problem - * @see Automatic Recovery + * @see Automatic Recovery */ public Connection newConnection(ExecutorService executor, List
addrs, String clientProvidedName) throws IOException, TimeoutException { @@ -1067,7 +1067,7 @@ public Connection newConnection(ExecutorService executor, List
addrs, S * Create a new broker connection with a client-provided name, picking the first available address from * the list provided by the {@link AddressResolver}. * - * If automatic connection recovery + * If automatic connection recovery * is enabled, the connection returned by this method will be {@link Recoverable}. Future * reconnection attempts will pick a random accessible address provided by the {@link AddressResolver}. * @@ -1080,7 +1080,7 @@ public Connection newConnection(ExecutorService executor, List
addrs, S * This value is supposed to be human-readable. * @return an interface to the connection * @throws java.io.IOException if it encounters a problem - * @see Automatic Recovery + * @see Automatic Recovery */ public Connection newConnection(ExecutorService executor, AddressResolver addressResolver, String clientProvidedName) throws IOException, TimeoutException { @@ -1171,7 +1171,7 @@ protected AMQConnection createConnection(ConnectionParams params, FrameHandler f /** * Create a new broker connection. * - * If automatic connection recovery + * If automatic connection recovery * is enabled, the connection returned by this method will be {@link Recoverable}. Reconnection * attempts will always use the address configured on {@link ConnectionFactory}. * @@ -1185,7 +1185,7 @@ public Connection newConnection() throws IOException, TimeoutException { /** * Create a new broker connection. * - * If automatic connection recovery + * If automatic connection recovery * is enabled, the connection returned by this method will be {@link Recoverable}. Reconnection * attempts will always use the address configured on {@link ConnectionFactory}. * @@ -1201,7 +1201,7 @@ public Connection newConnection(String connectionName) throws IOException, Timeo /** * Create a new broker connection. * - * If automatic connection recovery + * If automatic connection recovery * is enabled, the connection returned by this method will be {@link Recoverable}. Reconnection * attempts will always use the address configured on {@link ConnectionFactory}. * @@ -1216,7 +1216,7 @@ public Connection newConnection(ExecutorService executor) throws IOException, Ti /** * Create a new broker connection. * - * If automatic connection recovery + * If automatic connection recovery * is enabled, the connection returned by this method will be {@link Recoverable}. Reconnection * attempts will always use the address configured on {@link ConnectionFactory}. * diff --git a/src/main/java/com/rabbitmq/client/Method.java b/src/main/java/com/rabbitmq/client/Method.java index 46afe1f459..393f64cc1b 100644 --- a/src/main/java/com/rabbitmq/client/Method.java +++ b/src/main/java/com/rabbitmq/client/Method.java @@ -18,7 +18,7 @@ /** * Public interface to objects representing an AMQP 0-9-1 method - * @see http://www.rabbitmq.com/specification.html. + * @see https://www.rabbitmq.com/specification.html. */ public interface Method { diff --git a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java index 48949b4ca4..e5a40ceee1 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java @@ -36,7 +36,7 @@ final class Copyright { final static String COPYRIGHT="Copyright (c) 2007-2019 Pivotal Software, Inc."; - final static String LICENSE="Licensed under the MPL. See http://www.rabbitmq.com/"; + final static String LICENSE="Licensed under the MPL. See https://www.rabbitmq.com/"; } /** diff --git a/src/main/java/com/rabbitmq/client/impl/VariableLinkedBlockingQueue.java b/src/main/java/com/rabbitmq/client/impl/VariableLinkedBlockingQueue.java index 3447b07e34..33b4303294 100644 --- a/src/main/java/com/rabbitmq/client/impl/VariableLinkedBlockingQueue.java +++ b/src/main/java/com/rabbitmq/client/impl/VariableLinkedBlockingQueue.java @@ -21,7 +21,7 @@ /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * https://creativecommons.org/licenses/publicdomain */ package com.rabbitmq.client.impl; diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java index d23f56f0ff..870eadd843 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java @@ -32,8 +32,8 @@ import java.util.concurrent.TimeoutException; /** - * JSON-RPC is a lightweight - * RPC mechanism using JSON + * JSON-RPC is a lightweight + * RPC mechanism using JSON * as a data language for request and reply messages. It is * rapidly becoming a standard in web development, where it is * used to make RPC requests over HTTP. RabbitMQ provides an diff --git a/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java b/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java index c99dc3eb7b..11cd5bf248 100644 --- a/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java +++ b/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java @@ -63,7 +63,7 @@ public class AmqpUriTest extends BrokerTestCase "user", "pass", "[::1]", 100, "/"); /* Various failure cases */ - parseFail("http://www.rabbitmq.com"); + parseFail("https://www.rabbitmq.com"); parseFail("amqp://foo[::1]"); parseFail("amqp://foo:[::1]"); parseFail("amqp://[::1]foo"); diff --git a/src/test/java/com/rabbitmq/client/test/TestUtils.java b/src/test/java/com/rabbitmq/client/test/TestUtils.java index adc5ffb759..b385c73fde 100644 --- a/src/test/java/com/rabbitmq/client/test/TestUtils.java +++ b/src/test/java/com/rabbitmq/client/test/TestUtils.java @@ -221,7 +221,7 @@ private static void wait(CountDownLatch latch) throws InterruptedException { } /** - * http://stackoverflow.com/questions/6701948/efficient-way-to-compare-version-strings-in-java + * https://stackoverflow.com/questions/6701948/efficient-way-to-compare-version-strings-in-java */ static int versionCompare(String str1, String str2) { String[] vals1 = str1.split("\\."); From eab59eb2d99226171d4e056887e1413f8368a093 Mon Sep 17 00:00:00 2001 From: Spring Operator Date: Thu, 21 Mar 2019 03:06:22 -0500 Subject: [PATCH 126/328] URL Cleanup This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener). # Fixed URLs ## Fixed Success These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended. * [ ] http://www.apache.org/licenses/ with 1 occurrences migrated to: https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200). * [ ] http://www.apache.org/licenses/LICENSE-2.0 with 3 occurrences migrated to: https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200). --- LICENSE-APACHE2 | 4 ++-- src/main/java/com/rabbitmq/tools/json/JSONReader.java | 2 +- src/main/java/com/rabbitmq/tools/json/JSONWriter.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/LICENSE-APACHE2 b/LICENSE-APACHE2 index d645695673..62589edd12 100644 --- a/LICENSE-APACHE2 +++ b/LICENSE-APACHE2 @@ -1,7 +1,7 @@ Apache License Version 2.0, January 2004 - http://www.apache.org/licenses/ + https://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION @@ -193,7 +193,7 @@ you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/main/java/com/rabbitmq/tools/json/JSONReader.java b/src/main/java/com/rabbitmq/tools/json/JSONReader.java index 14c690e6e2..5bd332c7bd 100644 --- a/src/main/java/com/rabbitmq/tools/json/JSONReader.java +++ b/src/main/java/com/rabbitmq/tools/json/JSONReader.java @@ -21,7 +21,7 @@ you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/main/java/com/rabbitmq/tools/json/JSONWriter.java b/src/main/java/com/rabbitmq/tools/json/JSONWriter.java index 7101598040..ec05322c34 100644 --- a/src/main/java/com/rabbitmq/tools/json/JSONWriter.java +++ b/src/main/java/com/rabbitmq/tools/json/JSONWriter.java @@ -21,7 +21,7 @@ you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, From 6081628163669bac39456c9fcf1dbc3c6692786d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 22 Mar 2019 10:36:14 +0100 Subject: [PATCH 127/328] Log warning when receiving basic.cancel for unknown consumer Fixes #525 (cherry picked from commit be13273f885a3078354879c36a3969f7e749358c) --- .../com/rabbitmq/client/impl/ChannelN.java | 2 + .../rabbitmq/client/test/ChannelNTest.java | 51 +++++++++++++++++++ .../com/rabbitmq/client/test/ClientTests.java | 3 +- 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/test/java/com/rabbitmq/client/test/ChannelNTest.java diff --git a/src/main/java/com/rabbitmq/client/impl/ChannelN.java b/src/main/java/com/rabbitmq/client/impl/ChannelN.java index aea0ee7a4b..43b8c4d823 100644 --- a/src/main/java/com/rabbitmq/client/impl/ChannelN.java +++ b/src/main/java/com/rabbitmq/client/impl/ChannelN.java @@ -402,6 +402,8 @@ private void releaseChannel() { consumerTag, "handleCancel"); } + } else { + LOGGER.warn("Could not cancel consumer with unknown tag {}", consumerTag); } return true; } else { diff --git a/src/test/java/com/rabbitmq/client/test/ChannelNTest.java b/src/test/java/com/rabbitmq/client/test/ChannelNTest.java new file mode 100644 index 0000000000..93ec20f15b --- /dev/null +++ b/src/test/java/com/rabbitmq/client/test/ChannelNTest.java @@ -0,0 +1,51 @@ +// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.test; + +import com.rabbitmq.client.Method; +import com.rabbitmq.client.impl.*; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class ChannelNTest { + + ConsumerWorkService consumerWorkService; + ExecutorService executorService; + + @Before public void init() { + executorService = Executors.newSingleThreadExecutor(); + consumerWorkService = new ConsumerWorkService(executorService, null, 1000, 1000); + } + + @After public void tearDown() { + consumerWorkService.shutdown(); + executorService.shutdownNow(); + } + + @Test + public void cancelUnknownConsumerDoesNotThrowException() throws Exception { + AMQConnection connection = Mockito.mock(AMQConnection.class); + ChannelN channel = new ChannelN(connection, 1, consumerWorkService); + Method method = new AMQImpl.Basic.Cancel.Builder().consumerTag("does-not-exist").build(); + channel.processAsync(new AMQCommand(method)); + } + +} diff --git a/src/test/java/com/rabbitmq/client/test/ClientTests.java b/src/test/java/com/rabbitmq/client/test/ClientTests.java index 0db46be963..4f4cb156eb 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientTests.java +++ b/src/test/java/com/rabbitmq/client/test/ClientTests.java @@ -70,7 +70,8 @@ GeneratedClassesTest.class, RpcTopologyRecordingTest.class, ConnectionTest.class, - TlsUtilsTest.class + TlsUtilsTest.class, + ChannelNTest.class }) public class ClientTests { From 365dd22a51a79ed40e7f45742a4eb71ecbfd44e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 22 Mar 2019 10:40:51 +0100 Subject: [PATCH 128/328] Add test for Channel#basicCancel with unknown consumer tag References #525, #528 (cherry picked from commit 261ffff32465b7710e2305d469b2bb5f6cb930ea) --- .../com/rabbitmq/client/test/ChannelNTest.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/ChannelNTest.java b/src/test/java/com/rabbitmq/client/test/ChannelNTest.java index 93ec20f15b..f6e85e686e 100644 --- a/src/test/java/com/rabbitmq/client/test/ChannelNTest.java +++ b/src/test/java/com/rabbitmq/client/test/ChannelNTest.java @@ -22,6 +22,7 @@ import org.junit.Test; import org.mockito.Mockito; +import java.io.IOException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -30,22 +31,31 @@ public class ChannelNTest { ConsumerWorkService consumerWorkService; ExecutorService executorService; - @Before public void init() { + @Before + public void init() { executorService = Executors.newSingleThreadExecutor(); consumerWorkService = new ConsumerWorkService(executorService, null, 1000, 1000); } - @After public void tearDown() { + @After + public void tearDown() { consumerWorkService.shutdown(); executorService.shutdownNow(); } @Test - public void cancelUnknownConsumerDoesNotThrowException() throws Exception { + public void serverBasicCancelForUnknownConsumerDoesNotThrowException() throws Exception { AMQConnection connection = Mockito.mock(AMQConnection.class); ChannelN channel = new ChannelN(connection, 1, consumerWorkService); Method method = new AMQImpl.Basic.Cancel.Builder().consumerTag("does-not-exist").build(); channel.processAsync(new AMQCommand(method)); } + @Test(expected = IOException.class) + public void callingBasicCancelForUnknownConsumerThrowsException() throws Exception { + AMQConnection connection = Mockito.mock(AMQConnection.class); + ChannelN channel = new ChannelN(connection, 1, consumerWorkService); + channel.basicCancel("does-not-exist"); + } + } From e49f66d6f0fad816feb33012a95d059cfdab2c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 22 Mar 2019 11:28:24 +0100 Subject: [PATCH 129/328] Add comment to explain decision tree References #525 (cherry picked from commit ad6968621409f31bb6967c324a82e90f2daba93a) --- src/main/java/com/rabbitmq/client/impl/ChannelN.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/rabbitmq/client/impl/ChannelN.java b/src/main/java/com/rabbitmq/client/impl/ChannelN.java index 43b8c4d823..5ab12bda20 100644 --- a/src/main/java/com/rabbitmq/client/impl/ChannelN.java +++ b/src/main/java/com/rabbitmq/client/impl/ChannelN.java @@ -386,6 +386,10 @@ private void releaseChannel() { Basic.Cancel m = (Basic.Cancel)method; String consumerTag = m.getConsumerTag(); Consumer callback = _consumers.remove(consumerTag); + // Not finding any matching consumer isn't necessarily an indication of an issue anywhere. + // Sometimes there's a natural race condition between consumer management on the server and client ends. + // E.g. Channel#basicCancel called just before a basic.cancel for the same consumer tag is received. + // See https://github.com/rabbitmq/rabbitmq-java-client/issues/525 if (callback == null) { callback = defaultConsumer; } From 953d255e4728b222e3f3fbc88b8db8a541d82933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 2 Apr 2019 14:18:47 +0200 Subject: [PATCH 130/328] Bump dependencies Fixes #607 (cherry picked from commit c06008605a4b718c5298ed8377dfb9e2e90dddf6) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 4da58c9d4f..0e9f1e2ddd 100644 --- a/pom.xml +++ b/pom.xml @@ -54,9 +54,9 @@ UTF-8 UTF-8 - 1.7.25 + 1.7.26 4.0.5 - 1.1.2 + 1.1.3 2.9.8 1.2.3 4.12 From bb8f6edf2f4c7fc3d9c805b91c32e59a58782e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 2 Apr 2019 14:23:06 +0200 Subject: [PATCH 131/328] Bump test dependencies (cherry picked from commit 941575654686a30418ce56e611087df5c11c4573) --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 0e9f1e2ddd..d731fe61c8 100644 --- a/pom.xml +++ b/pom.xml @@ -60,9 +60,9 @@ 2.9.8 1.2.3 4.12 - 3.1.5 - 2.23.4 - 3.11.1 + 3.1.6 + 2.25.1 + 3.12.2 3.0.1 2.5.3 @@ -735,7 +735,7 @@ org.assertj assertj-core - ${assert4j.version} + ${assertj.version} test From e79ed4d7491bc541e15c3e548ed77181778ff0b8 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Tue, 2 Apr 2019 14:00:30 +0000 Subject: [PATCH 132/328] [maven-release-plugin] prepare release v5.7.0.RC1 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index d731fe61c8..73ca672d08 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.7.0-SNAPSHOT + 5.7.0.RC1 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.7.0.RC1 From 9f2dffec12bcebcc41dc0d2a6d996df04661143a Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Tue, 2 Apr 2019 14:00:37 +0000 Subject: [PATCH 133/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 73ca672d08..d731fe61c8 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.7.0.RC1 + 5.7.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.7.0.RC1 + HEAD From 1928ce86a7c7da761003af4ee8fed89237b18938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 5 Apr 2019 10:19:26 +0200 Subject: [PATCH 134/328] Set release version to 5.7.0 --- release-versions.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release-versions.txt b/release-versions.txt index 94a66eae2b..3d73cfa347 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,2 +1,2 @@ -RELEASE_VERSION="5.7.0.RC1" -DEVELOPMENT_VERSION="5.7.0-SNAPSHOT" +RELEASE_VERSION="5.7.0" +DEVELOPMENT_VERSION="5.8.0-SNAPSHOT" From 57aa724ddd15ac376576894bd869d04b49e62451 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 5 Apr 2019 08:27:53 +0000 Subject: [PATCH 135/328] [maven-release-plugin] prepare release v5.7.0 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index d731fe61c8..539a45bc9c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.7.0-SNAPSHOT + 5.7.0 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.7.0 From 01f1900c2951a8001144efcc23b03c88bff7a8ae Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 5 Apr 2019 08:27:59 +0000 Subject: [PATCH 136/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 539a45bc9c..6db1d486d2 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.7.0 + 5.8.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.7.0 + HEAD From 9ef2462c9c4ba9b9e9c66a977380ed6eb3f48a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 24 Apr 2019 11:30:47 +0200 Subject: [PATCH 137/328] Bump Maven to 3.6.1 (cherry picked from commit 924617e7fea7f92d9b035fdebd1acd454275ee18) --- .mvn/wrapper/maven-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index a3f9f18723..a3ba20ec52 100755 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.1/apache-maven-3.6.1-bin.zip From d6a188ccec01d01e1f846f69b49d12baa51b6c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 24 Apr 2019 11:32:30 +0200 Subject: [PATCH 138/328] Set release version to 5.8.0.RC1 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index 3d73cfa347..34cae24ccc 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,2 +1,2 @@ -RELEASE_VERSION="5.7.0" +RELEASE_VERSION="5.8.0.RC1" DEVELOPMENT_VERSION="5.8.0-SNAPSHOT" From 54ed4207ad989cd3f2ad4a771e6568efbcc9f100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 14 May 2019 11:49:49 +0200 Subject: [PATCH 139/328] Use rabbitmqctl to command secondary node Not make. (cherry picked from commit 41635af2eccfb4b8c8616aa7e5423c774d38e579) --- .../client/test/functional/ClusteredTestBase.java | 9 +++++++-- .../client/test/server/DurableBindingLifecycle.java | 10 ++-------- src/test/java/com/rabbitmq/tools/Host.java | 6 +++++- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/functional/ClusteredTestBase.java b/src/test/java/com/rabbitmq/client/test/functional/ClusteredTestBase.java index c198db8bd0..6d1b430cf9 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ClusteredTestBase.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ClusteredTestBase.java @@ -124,10 +124,15 @@ public void closeConnection() throws IOException { } protected void stopSecondary() throws IOException { - Host.invokeMakeTarget("stop-rabbit-on-node RABBITMQ_NODENAME=\'" + Host.nodenameB() + "\'"); + Host.executeCommand(Host.rabbitmqctlCommand() + + " -n \'" + Host.nodenameB() + "\'" + + " stop_app"); } protected void startSecondary() throws IOException { - Host.invokeMakeTarget("start-rabbit-on-node RABBITMQ_NODENAME=\'" + Host.nodenameB() + "\'"); + Host.executeCommand(Host.rabbitmqctlCommand() + + " -n \'" + Host.nodenameB() + "\'" + + " start_app"); + Host.tryConnectFor(10_000, Host.node_portB() == null ? 5673 : Integer.valueOf(Host.node_portB())); } } diff --git a/src/test/java/com/rabbitmq/client/test/server/DurableBindingLifecycle.java b/src/test/java/com/rabbitmq/client/test/server/DurableBindingLifecycle.java index 644c21d11a..388a3ce7a5 100644 --- a/src/test/java/com/rabbitmq/client/test/server/DurableBindingLifecycle.java +++ b/src/test/java/com/rabbitmq/client/test/server/DurableBindingLifecycle.java @@ -26,7 +26,6 @@ import com.rabbitmq.client.GetResponse; import com.rabbitmq.client.test.functional.BindingLifecycleBase; -import com.rabbitmq.tools.Host; /** * This tests whether bindings are created and nuked properly. @@ -47,13 +46,8 @@ protected void restart() throws IOException, TimeoutException { alternateConnection = null; alternateChannel = null; - Host.invokeMakeTarget( - "stop-node" + - " start-background-broker" + - " RABBITMQ_NODENAME=\'" + Host.nodenameB() + "\'" + - " RABBITMQ_NODE_PORT=" + Host.node_portB() + - " RABBITMQ_CONFIG_FILE=\'" + Host.config_fileB() + "\'" - ); + stopSecondary(); + startSecondary(); } restartPrimary(); } diff --git a/src/test/java/com/rabbitmq/tools/Host.java b/src/test/java/com/rabbitmq/tools/Host.java index 0c9e7dbbf1..c30ec7fc6f 100644 --- a/src/test/java/com/rabbitmq/tools/Host.java +++ b/src/test/java/com/rabbitmq/tools/Host.java @@ -22,7 +22,6 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import com.rabbitmq.client.Connection; @@ -142,6 +141,10 @@ public static void stopRabbitOnNode() throws IOException { } public static void tryConnectFor(int timeoutInMs) throws IOException { + tryConnectFor(timeoutInMs, node_portA() == null ? 5672 : Integer.valueOf(node_portA())); + } + + public static void tryConnectFor(int timeoutInMs, int port) throws IOException { int waitTime = 100; int totalWaitTime = 0; while (totalWaitTime <= timeoutInMs) { @@ -152,6 +155,7 @@ public static void tryConnectFor(int timeoutInMs) throws IOException { } totalWaitTime += waitTime; ConnectionFactory connectionFactory = TestUtils.connectionFactory(); + connectionFactory.setPort(port); try (Connection ignored = connectionFactory.newConnection()) { return; From 346f6f2ee5751479288b3465ee5c148eb8f67011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 14 May 2019 12:49:00 +0200 Subject: [PATCH 140/328] Lower log level for tests (cherry picked from commit 58d5892db98074151925be1472e155abcc565dd6) --- src/test/resources/logback-test.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml index ee88f442c2..4bd2e37606 100644 --- a/src/test/resources/logback-test.xml +++ b/src/test/resources/logback-test.xml @@ -5,7 +5,7 @@ - + \ No newline at end of file From 87723e7c75bd34bbf02c53c9877a62b60f661722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 14 May 2019 13:33:38 +0200 Subject: [PATCH 141/328] Disable hanging test Need more investigation. (cherry picked from commit 8c523097feee7be0ad99082f8f6c3ccaf9ef8b05) --- src/test/java/com/rabbitmq/client/test/server/ServerTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/rabbitmq/client/test/server/ServerTests.java b/src/test/java/com/rabbitmq/client/test/server/ServerTests.java index bf8631a4b8..5028d9cd3c 100644 --- a/src/test/java/com/rabbitmq/client/test/server/ServerTests.java +++ b/src/test/java/com/rabbitmq/client/test/server/ServerTests.java @@ -26,7 +26,7 @@ Permissions.class, DurableBindingLifecycle.class, DeadLetterExchangeDurable.class, - EffectVisibilityCrossNodeTest.class, + //EffectVisibilityCrossNodeTest.class, ExclusiveQueueDurability.class, AbsentQueue.class, AlternateExchangeEquivalence.class, From 97ebf216cb32707c559876e6a5511c6f51d025f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 15 May 2019 13:03:14 +0200 Subject: [PATCH 142/328] Fix hanging test Make it less harsh and execute it in dedicated thread to avoid hanging. (cherry picked from commit 838cc5500eb1f1d25ef5591bbeb6d23455244d46) --- .../server/EffectVisibilityCrossNodeTest.java | 31 +++++++++++++------ .../client/test/server/ServerTests.java | 2 +- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/server/EffectVisibilityCrossNodeTest.java b/src/test/java/com/rabbitmq/client/test/server/EffectVisibilityCrossNodeTest.java index 78b2291781..cea5f368a1 100644 --- a/src/test/java/com/rabbitmq/client/test/server/EffectVisibilityCrossNodeTest.java +++ b/src/test/java/com/rabbitmq/client/test/server/EffectVisibilityCrossNodeTest.java @@ -18,6 +18,7 @@ import static org.junit.Assert.assertEquals; import java.io.IOException; +import java.util.concurrent.*; import org.junit.Test; @@ -46,20 +47,30 @@ protected void releaseResources() throws IOException { } private static final int QUEUES = 5; - private static final int BATCHES = 500; - private static final int MESSAGES_PER_BATCH = 10; + private static final int BATCHES = 100; + private static final int MESSAGES_PER_BATCH = 5; private static final byte[] msg = "".getBytes(); @Test public void effectVisibility() throws Exception { - - for (int i = 0; i < BATCHES; i++) { - for (int j = 0; j < MESSAGES_PER_BATCH; j++) { - channel.basicPublish("amq.fanout", "", null, msg); - } - for (int j = 0; j < queues.length ; j++) { - assertEquals(MESSAGES_PER_BATCH, channel.queuePurge(queues[j]).getMessageCount()); - } + ExecutorService executorService = Executors.newSingleThreadExecutor(); + try { + Future task = executorService.submit(() -> { + for (int i = 0; i < BATCHES; i++) { + Thread.sleep(10); // to avoid flow control for the connection + for (int j = 0; j < MESSAGES_PER_BATCH; j++) { + channel.basicPublish("amq.fanout", "", null, msg); + } + for (int j = 0; j < queues.length; j++) { + assertEquals(MESSAGES_PER_BATCH, channel.queuePurge(queues[j]).getMessageCount()); + } + } + return null; + }); + task.get(1, TimeUnit.MINUTES); + } finally { + executorService.shutdownNow(); + executorService.awaitTermination(1, TimeUnit.SECONDS); } } } diff --git a/src/test/java/com/rabbitmq/client/test/server/ServerTests.java b/src/test/java/com/rabbitmq/client/test/server/ServerTests.java index 5028d9cd3c..bf8631a4b8 100644 --- a/src/test/java/com/rabbitmq/client/test/server/ServerTests.java +++ b/src/test/java/com/rabbitmq/client/test/server/ServerTests.java @@ -26,7 +26,7 @@ Permissions.class, DurableBindingLifecycle.class, DeadLetterExchangeDurable.class, - //EffectVisibilityCrossNodeTest.class, + EffectVisibilityCrossNodeTest.class, ExclusiveQueueDurability.class, AbsentQueue.class, AlternateExchangeEquivalence.class, From 8188914543578b7279cd656c1070e20da85655a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 16 May 2019 10:31:26 +0200 Subject: [PATCH 143/328] Handle exception in NIO loop to avoid abrupt termination Fixes #611 (cherry picked from commit bd385248f8771ea5a7c11bedca8f05bed83c126f) --- src/main/java/com/rabbitmq/client/impl/nio/NioLoop.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/client/impl/nio/NioLoop.java b/src/main/java/com/rabbitmq/client/impl/nio/NioLoop.java index 44f438cf58..e153e721c8 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/NioLoop.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/NioLoop.java @@ -115,7 +115,14 @@ public void run() { registration = registrationIterator.next(); registrationIterator.remove(); int operations = registration.operations; - registration.state.getChannel().register(selector, operations, registration.state); + try { + if (registration.state.getChannel().isOpen()) { + registration.state.getChannel().register(selector, operations, registration.state); + } + } catch (Exception e) { + // can happen if the channel has been closed since the operation has been enqueued + LOGGER.info("Error while registering socket channel for read: {}", e.getMessage()); + } } if (select > 0) { From e3c68c3fba3fd4ec7780a80dc5c26b6ebfaa58c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 23 May 2019 16:46:16 +0100 Subject: [PATCH 144/328] Increase TTL in dead lettering tests Those fail sometimes on CI, increasing TTL can help on slow-ish environment. (cherry picked from commit 44c3ca20ddff2096d6062ce7d8acdf588d76a9f1) --- .../com/rabbitmq/client/test/functional/DeadLetterExchange.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java b/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java index 12e96cf4b8..6a7f97725e 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java +++ b/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java @@ -35,7 +35,7 @@ public class DeadLetterExchange extends BrokerTestCase { public static final String DLQ = "queue.dlq"; private static final String DLQ2 = "queue.dlq2"; public static final int MSG_COUNT = 10; - private static final int TTL = 1000; + private static final int TTL = 2000; @Override protected void createResources() throws IOException { From 23525b6f88d8d37bf630ed41f03164d0e8264156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 23 May 2019 16:55:32 +0100 Subject: [PATCH 145/328] Bump Jackson to 2.9.9 Fixes #612 (cherry picked from commit 767a19bdb798ad8d5a747edc562a9c1be55c9fb0) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6db1d486d2..1d4fc3a7be 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ 1.7.26 4.0.5 1.1.3 - 2.9.8 + 2.9.9 1.2.3 4.12 3.1.6 From 4191a84a8c5591e03e21fd219b519ad6399b1ac6 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Sun, 16 Jun 2019 22:58:01 +0300 Subject: [PATCH 146/328] Correct JavaDoc for a couple of methods Fixes #615. (cherry picked from commit d00d84fefd6f948972c05a8e658735bb5389a4cc) --- src/main/java/com/rabbitmq/client/Channel.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/Channel.java b/src/main/java/com/rabbitmq/client/Channel.java index c4312e041a..b1daa31100 100644 --- a/src/main/java/com/rabbitmq/client/Channel.java +++ b/src/main/java/com/rabbitmq/client/Channel.java @@ -1347,7 +1347,7 @@ void basicNack(long deliveryTag, boolean multiple, boolean requeue) /** * Returns the number of messages in a queue ready to be delivered * to consumers. This method assumes the queue exists. If it doesn't, - * an exception will be closed with an exception. + * the channels will be closed with an exception. * @param queue the name of the queue * @return the number of messages in ready state * @throws IOException Problem transmitting method. @@ -1357,7 +1357,7 @@ void basicNack(long deliveryTag, boolean multiple, boolean requeue) /** * Returns the number of consumers on a queue. * This method assumes the queue exists. If it doesn't, - * an exception will be closed with an exception. + * the channel will be closed with an exception. * @param queue the name of the queue * @return the number of consumers * @throws IOException Problem transmitting method. From 904c5b4c998573d5c0bafa7c0bbdc9ec75a64c32 Mon Sep 17 00:00:00 2001 From: Changlin Li Date: Thu, 27 Jun 2019 23:03:49 -0400 Subject: [PATCH 147/328] Change # of bits ValueWriter checks for BigDecimal Move from 32 to 31 because bitLength ignores the sign bit. (cherry picked from commit fe58bd6c1e399e30bcf8c55fa807bf2e739dd76a) --- src/main/java/com/rabbitmq/client/impl/ValueWriter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/client/impl/ValueWriter.java b/src/main/java/com/rabbitmq/client/impl/ValueWriter.java index 28d516dec4..ab65b95aeb 100644 --- a/src/main/java/com/rabbitmq/client/impl/ValueWriter.java +++ b/src/main/java/com/rabbitmq/client/impl/ValueWriter.java @@ -145,7 +145,9 @@ else if(value instanceof BigDecimal) { BigDecimal decimal = (BigDecimal)value; writeOctet(decimal.scale()); BigInteger unscaled = decimal.unscaledValue(); - if(unscaled.bitLength() > 32) /*Integer.SIZE in Java 1.5*/ + // We use 31 instead of 32 because bitLength ignores the sign bit, + // so e.g. new BigDecimal(Integer.MAX_VALUE) comes out to 31 bits. + if(unscaled.bitLength() > 31) /*Integer.SIZE in Java 1.5*/ throw new IllegalArgumentException ("BigDecimal too large to be encoded"); writeLong(decimal.unscaledValue().intValue()); From e3ceed7430996e404c57b114632b7d8d85a3903f Mon Sep 17 00:00:00 2001 From: Changlin Li Date: Thu, 27 Jun 2019 23:21:37 -0400 Subject: [PATCH 148/328] Add basic test case for fixing 617 (cherry picked from commit a4c5a1a23461a0335a3c10a473a64d1b4e7a9240) --- .../rabbitmq/client/impl/ValueWriterTest.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java diff --git a/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java b/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java new file mode 100644 index 0000000000..a0052939fb --- /dev/null +++ b/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java @@ -0,0 +1,30 @@ +package com.rabbitmq.client.impl; + +import org.junit.Test; + +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.math.BigDecimal; +import java.util.ArrayDeque; +import java.util.Queue; + +public class ValueWriterTest { + @Test(expected = IllegalArgumentException.class) public void writingOverlyLargeBigDecimalShouldFail() throws IOException { + Queue queue = new ArrayDeque<>(); + + OutputStream outputStream = new OutputStream() { + @Override + public void write(int b) { + queue.add((byte) b); + } + }; + + DataOutputStream dataOutputStream = new DataOutputStream(outputStream); + + ValueWriter valueWriter = new ValueWriter(dataOutputStream); + + valueWriter.writeFieldValue(new BigDecimal(Integer.MAX_VALUE).add(new BigDecimal(1))); + + } +} From e26c85879158992148d8f5a5ea0709125211b18c Mon Sep 17 00:00:00 2001 From: Changlin Li Date: Fri, 28 Jun 2019 01:21:25 -0400 Subject: [PATCH 149/328] Add additional fix for not checking scale The scale of a BigDecimal must also be checked because it must be a signed octet (cherry picked from commit ecb31ba94e8d03cea3f18dadf408e6cf2cb13129) --- .../com/rabbitmq/client/impl/ValueWriter.java | 6 +++++ .../rabbitmq/client/impl/ValueWriterTest.java | 22 ++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/client/impl/ValueWriter.java b/src/main/java/com/rabbitmq/client/impl/ValueWriter.java index ab65b95aeb..2510172a95 100644 --- a/src/main/java/com/rabbitmq/client/impl/ValueWriter.java +++ b/src/main/java/com/rabbitmq/client/impl/ValueWriter.java @@ -143,6 +143,12 @@ else if(value instanceof Integer) { else if(value instanceof BigDecimal) { writeOctet('D'); BigDecimal decimal = (BigDecimal)value; + // The scale must be an unsigned octet, therefore its values must + // be between 0 and 255 + if(decimal.scale() > 255 || decimal.scale() < 0) + throw new IllegalArgumentException + ("BigDecimal has too large of a scale to be encoded. " + + "The scale was: " + decimal.scale()); writeOctet(decimal.scale()); BigInteger unscaled = decimal.unscaledValue(); // We use 31 instead of 32 because bitLength ignores the sign bit, diff --git a/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java b/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java index a0052939fb..743a2cd043 100644 --- a/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java +++ b/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java @@ -6,11 +6,13 @@ import java.io.IOException; import java.io.OutputStream; import java.math.BigDecimal; +import java.math.BigInteger; import java.util.ArrayDeque; import java.util.Queue; public class ValueWriterTest { - @Test(expected = IllegalArgumentException.class) public void writingOverlyLargeBigDecimalShouldFail() throws IOException { + @Test(expected = IllegalArgumentException.class) public void writingOverlyLargeBigDecimalShouldFail() + throws IOException { Queue queue = new ArrayDeque<>(); OutputStream outputStream = new OutputStream() { @@ -27,4 +29,22 @@ public void write(int b) { valueWriter.writeFieldValue(new BigDecimal(Integer.MAX_VALUE).add(new BigDecimal(1))); } + + @Test(expected = IllegalArgumentException.class) public void writingOverlyLargeScaleInBigDecimalShouldFail() + throws IOException { + Queue queue = new ArrayDeque<>(); + + OutputStream outputStream = new OutputStream() { + @Override + public void write(int b) { + queue.add((byte) b); + } + }; + + DataOutputStream dataOutputStream = new DataOutputStream(outputStream); + + ValueWriter valueWriter = new ValueWriter(dataOutputStream); + + valueWriter.writeFieldValue(new BigDecimal(BigInteger.ONE, 500)); + } } From 693503ad985a0214d44a1be10ca09e233694f3ef Mon Sep 17 00:00:00 2001 From: Changlin Li Date: Fri, 28 Jun 2019 02:34:35 -0400 Subject: [PATCH 150/328] Remove redundant queues from tests They're not actually used at all during the test (cherry picked from commit 26e20c74cf247f13c9f58fa2e534f78365a7e142) --- src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java b/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java index 743a2cd043..681919103d 100644 --- a/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java +++ b/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java @@ -7,18 +7,14 @@ import java.io.OutputStream; import java.math.BigDecimal; import java.math.BigInteger; -import java.util.ArrayDeque; -import java.util.Queue; public class ValueWriterTest { @Test(expected = IllegalArgumentException.class) public void writingOverlyLargeBigDecimalShouldFail() throws IOException { - Queue queue = new ArrayDeque<>(); OutputStream outputStream = new OutputStream() { @Override public void write(int b) { - queue.add((byte) b); } }; @@ -32,12 +28,10 @@ public void write(int b) { @Test(expected = IllegalArgumentException.class) public void writingOverlyLargeScaleInBigDecimalShouldFail() throws IOException { - Queue queue = new ArrayDeque<>(); OutputStream outputStream = new OutputStream() { @Override public void write(int b) { - queue.add((byte) b); } }; From 2671fff53b14d54b1f8a63e205480dfa10b24d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 28 Jun 2019 10:25:09 +0200 Subject: [PATCH 151/328] Add a test to write/read BigDecimal References #617 (cherry picked from commit 02284ea050e5f9326f0cc362bcdcbae911ae7f20) Conflicts: src/test/java/com/rabbitmq/client/test/ClientTests.java --- .../com/rabbitmq/client/impl/ValueReader.java | 5 ++- .../com/rabbitmq/client/impl/ValueWriter.java | 2 +- .../rabbitmq/client/impl/ValueWriterTest.java | 44 ++++++++++++++++--- .../com/rabbitmq/client/test/ClientTests.java | 4 +- 4 files changed, 44 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/ValueReader.java b/src/main/java/com/rabbitmq/client/impl/ValueReader.java index 8cc639891b..8a9e860443 100644 --- a/src/main/java/com/rabbitmq/client/impl/ValueReader.java +++ b/src/main/java/com/rabbitmq/client/impl/ValueReader.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 @@ -153,7 +153,8 @@ private static Map readTable(DataInputStream in) return table; } - private static Object readFieldValue(DataInputStream in) + // package protected for testing + static Object readFieldValue(DataInputStream in) throws IOException { Object value = null; switch(in.readUnsignedByte()) { diff --git a/src/main/java/com/rabbitmq/client/impl/ValueWriter.java b/src/main/java/com/rabbitmq/client/impl/ValueWriter.java index 2510172a95..947c6a326d 100644 --- a/src/main/java/com/rabbitmq/client/impl/ValueWriter.java +++ b/src/main/java/com/rabbitmq/client/impl/ValueWriter.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java b/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java index 681919103d..76cbd0d6df 100644 --- a/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java +++ b/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java @@ -1,16 +1,33 @@ +// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + package com.rabbitmq.client.impl; import org.junit.Test; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.OutputStream; +import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; +import static org.assertj.core.api.Assertions.assertThat; + public class ValueWriterTest { - @Test(expected = IllegalArgumentException.class) public void writingOverlyLargeBigDecimalShouldFail() - throws IOException { + + @Test(expected = IllegalArgumentException.class) + public void writingOverlyLargeBigDecimalShouldFail() + throws IOException { OutputStream outputStream = new OutputStream() { @Override @@ -26,8 +43,9 @@ public void write(int b) { } - @Test(expected = IllegalArgumentException.class) public void writingOverlyLargeScaleInBigDecimalShouldFail() - throws IOException { + @Test(expected = IllegalArgumentException.class) + public void writingOverlyLargeScaleInBigDecimalShouldFail() + throws IOException { OutputStream outputStream = new OutputStream() { @Override @@ -41,4 +59,16 @@ public void write(int b) { valueWriter.writeFieldValue(new BigDecimal(BigInteger.ONE, 500)); } + + @Test + public void bigDecimalWrittenAndReadMatches() throws IOException { + BigDecimal value = new BigDecimal(BigInteger.valueOf(56), 3); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + DataOutputStream dataOutputStream = new DataOutputStream(outputStream); + ValueWriter valueWriter = new ValueWriter(dataOutputStream); + valueWriter.writeFieldValue(value); + + BigDecimal read = (BigDecimal) ValueReader.readFieldValue(new DataInputStream(new ByteArrayInputStream(outputStream.toByteArray()))); + assertThat(read).isEqualTo(value); + } } diff --git a/src/test/java/com/rabbitmq/client/test/ClientTests.java b/src/test/java/com/rabbitmq/client/test/ClientTests.java index 4f4cb156eb..db5c7cd179 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientTests.java +++ b/src/test/java/com/rabbitmq/client/test/ClientTests.java @@ -18,6 +18,7 @@ import com.rabbitmq.client.JacksonJsonRpcTest; import com.rabbitmq.client.DefaultJsonRpcTest; +import com.rabbitmq.client.impl.ValueWriterTest; import com.rabbitmq.utility.IntAllocatorTests; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -71,7 +72,8 @@ RpcTopologyRecordingTest.class, ConnectionTest.class, TlsUtilsTest.class, - ChannelNTest.class + ChannelNTest.class, + ValueWriterTest.class }) public class ClientTests { From 8ad972629e75217fa33f11e00c9cf3ffab4c267b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 28 Jun 2019 13:49:30 +0200 Subject: [PATCH 152/328] Fix comment in BigDecimal serialization References #617 (cherry picked from commit 4f90abd9602e4bc1d1fdc809696b2e542afa68ae) --- src/main/java/com/rabbitmq/client/impl/ValueWriter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/ValueWriter.java b/src/main/java/com/rabbitmq/client/impl/ValueWriter.java index 947c6a326d..0c997d1545 100644 --- a/src/main/java/com/rabbitmq/client/impl/ValueWriter.java +++ b/src/main/java/com/rabbitmq/client/impl/ValueWriter.java @@ -151,9 +151,9 @@ else if(value instanceof BigDecimal) { "The scale was: " + decimal.scale()); writeOctet(decimal.scale()); BigInteger unscaled = decimal.unscaledValue(); - // We use 31 instead of 32 because bitLength ignores the sign bit, + // We use 31 instead of 32 (Integer.SIZE) because bitLength ignores the sign bit, // so e.g. new BigDecimal(Integer.MAX_VALUE) comes out to 31 bits. - if(unscaled.bitLength() > 31) /*Integer.SIZE in Java 1.5*/ + if(unscaled.bitLength() > 31) throw new IllegalArgumentException ("BigDecimal too large to be encoded"); writeLong(decimal.unscaledValue().intValue()); From d5b0c4e55128f1286d1adb6cde94e6e926425169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 1 Jul 2019 14:30:19 +0200 Subject: [PATCH 153/328] Bump Micrometer and Metrics Fixes #619 (cherry picked from commit 0024b6a1070e074992aa495c2e3dee972f1e4cdc) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 1d4fc3a7be..b7f13a526c 100644 --- a/pom.xml +++ b/pom.xml @@ -55,8 +55,8 @@ UTF-8 1.7.26 - 4.0.5 - 1.1.3 + 4.1.0 + 1.2.0 2.9.9 1.2.3 4.12 From c5725eaa06b9f0eea60816612458c0d82b7643fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 1 Jul 2019 14:33:28 +0200 Subject: [PATCH 154/328] Bump Mockito (cherry picked from commit b872a46ec79a9b929246432314b53aa11db70ed8) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b7f13a526c..c28cd1042f 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ 1.2.3 4.12 3.1.6 - 2.25.1 + 2.28.2 3.12.2 3.0.1 From ad6a703b40bf0e177180bb4ddf63c32d71485115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 23 Jul 2019 11:04:11 +0200 Subject: [PATCH 155/328] Bump Jackson to 2.9.9.1 To address https://nvd.nist.gov/vuln/detail/CVE-2019-12814. Jackson is an optional dependency, necessary only when using JSON RPC. (cherry picked from commit ebddf5b43180e56e3077c439828dd2b53da91397) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c28cd1042f..2df45fc73d 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ 1.7.26 4.1.0 1.2.0 - 2.9.9 + 2.9.9.1 1.2.3 4.12 3.1.6 From 969c0a71bc49d4f1ad49aebf33eaf81b33b8bae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 23 Jul 2019 11:06:01 +0200 Subject: [PATCH 156/328] Bump Mockito to 3.0.0 (cherry picked from commit 9786a9e15ae590a63129f929abfb80eb21b40f38) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2df45fc73d..c242146ae0 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ 1.2.3 4.12 3.1.6 - 2.28.2 + 3.0.0 3.12.2 3.0.1 From 5d9573c9993aefbae1bfde0a85a05db5e68ae9d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 23 Jul 2019 15:59:49 +0200 Subject: [PATCH 157/328] Mention dependency management in JacksonJsonRpcMapper (cherry picked from commit cfdae67d9aee1c5bd105a78196baa0ae55a2bd39) --- .../tools/jsonrpc/JacksonJsonRpcMapper.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java index 2b8b349b70..7a5d77337b 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2019 Pivotal Software, Inc. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 @@ -15,11 +15,7 @@ package com.rabbitmq.tools.jsonrpc; -import com.fasterxml.jackson.core.JsonFactory; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.core.TreeNode; +import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.MappingJsonFactory; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ValueNode; @@ -34,7 +30,14 @@ /** * {@link JsonRpcMapper} based on Jackson. - * Uses the streaming and databind modules. + *

+ * Uses the streaming and databind modules. You need to add the appropriate dependency + * to the classpath if you want to use this class, as the RabbitMQ Java client + * library does not pull Jackson automatically when using a dependency management + * tool like Maven or Gradle. + *

+ * Make sure to use the latest version of the Jackson library, as the version used in the + * RabbitMQ Java client can be a little bit behind. * * @see JsonRpcMapper * @since 5.4.0 From 374d89fa4f5d604ecf775e014c77e0fe68d3eddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 13 Aug 2019 09:13:07 +0200 Subject: [PATCH 158/328] Bump Jackson to 2.9.9.3 (cherry picked from commit 9269ff67e9141935d315684a5f340ba6a3224df5) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c242146ae0..f4b6319cb5 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ 1.7.26 4.1.0 1.2.0 - 2.9.9.1 + 2.9.9.3 1.2.3 4.12 3.1.6 From b41d37997f52a301dc64d608d1fb102f18fc8b0b Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Thu, 29 Aug 2019 18:02:56 +0300 Subject: [PATCH 159/328] Merge pull request #623 from rabbitmq/rabbitmq-java-client-622-for-4.x Sanitise peer certificate values we log (cherry picked from commit af217ec157ec08b5148fd47257ae4bfa30011ea1) --- src/main/java/com/rabbitmq/client/impl/TlsUtils.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/TlsUtils.java b/src/main/java/com/rabbitmq/client/impl/TlsUtils.java index b517e51d6c..938c1ad9d4 100644 --- a/src/main/java/com/rabbitmq/client/impl/TlsUtils.java +++ b/src/main/java/com/rabbitmq/client/impl/TlsUtils.java @@ -104,8 +104,8 @@ public static String peerCertificateInfo(Certificate certificate, String prefix) try { return String.format("%s subject: %s, subject alternative names: %s, " + "issuer: %s, not valid after: %s, X.509 usage extensions: %s", - prefix, c.getSubjectDN().getName(), sans(c, ","), c.getIssuerDN().getName(), - c.getNotAfter(), extensions(c)); + stripCRLF(prefix), stripCRLF(c.getSubjectDN().getName()), stripCRLF(sans(c, ",")), stripCRLF(c.getIssuerDN().getName()), + c.getNotAfter(), stripCRLF(extensions(c))); } catch (Exception e) { return "Error while retrieving " + prefix + " certificate information"; } @@ -145,6 +145,14 @@ public static String extensionPrettyPrint(String oid, byte[] derOctetString, X50 } } + /** + * Strips carriage return (CR) and line feed (LF) characters to mitigate CWE-117. + * @return sanitised string value + */ + public static String stripCRLF(String value) { + return value.replaceAll("\r", "").replaceAll("\n", ""); + } + private static String extensions(X509Certificate certificate) { List extensions = new ArrayList<>(); for (String oid : certificate.getCriticalExtensionOIDs()) { From 67f991284a6040f41d2fe8be973ab15347f2bef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 21 Jun 2019 16:11:31 +0200 Subject: [PATCH 160/328] Add OAuth 2 credentials provider and refresh service WIP. (cherry picked from commit 4251459c7c397efb066e3c38d21ce122836a7794) Conflicts: src/test/java/com/rabbitmq/client/test/ClientTests.java --- pom.xml | 7 + .../rabbitmq/client/ConnectionFactory.java | 17 +- .../rabbitmq/client/impl/AMQConnection.java | 33 ++ .../client/impl/ConnectionParams.java | 10 + .../client/impl/CredentialsProvider.java | 55 +++- .../impl/CredentialsRefreshService.java | 73 +++++ .../impl/DefaultCredentialsProvider.java | 15 + .../DefaultCredentialsRefreshService.java | 307 ++++++++++++++++++ ...ntCredentialsGrantCredentialsProvider.java | 233 +++++++++++++ .../impl/OAuthTokenManagementException.java | 27 ++ .../client/RefreshCredentialsTest.java | 81 +++++ .../DefaultCredentialsRefreshServiceTest.java | 181 +++++++++++ ...edentialsGrantCredentialsProviderTest.java | 190 +++++++++++ .../com/rabbitmq/client/test/ClientTests.java | 8 +- .../com/rabbitmq/client/test/TestUtils.java | 9 + 15 files changed, 1234 insertions(+), 12 deletions(-) create mode 100644 src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java create mode 100644 src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java create mode 100644 src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java create mode 100644 src/main/java/com/rabbitmq/client/impl/OAuthTokenManagementException.java create mode 100644 src/test/java/com/rabbitmq/client/RefreshCredentialsTest.java create mode 100644 src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java create mode 100644 src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java diff --git a/pom.xml b/pom.xml index f4b6319cb5..d4523675c8 100644 --- a/pom.xml +++ b/pom.xml @@ -63,6 +63,7 @@ 3.1.6 3.0.0 3.12.2 + 9.4.19.v20190610 3.0.1 2.5.3 @@ -744,6 +745,12 @@ 1.3 test + + org.eclipse.jetty + jetty-servlet + ${jetty.version} + test + diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index 547422de83..0047d55245 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -15,15 +15,7 @@ package com.rabbitmq.client; -import com.rabbitmq.client.impl.AMQConnection; -import com.rabbitmq.client.impl.ConnectionParams; -import com.rabbitmq.client.impl.CredentialsProvider; -import com.rabbitmq.client.impl.DefaultCredentialsProvider; -import com.rabbitmq.client.impl.DefaultExceptionHandler; -import com.rabbitmq.client.impl.ErrorOnWriteListener; -import com.rabbitmq.client.impl.FrameHandler; -import com.rabbitmq.client.impl.FrameHandlerFactory; -import com.rabbitmq.client.impl.SocketFrameHandlerFactory; +import com.rabbitmq.client.impl.*; import com.rabbitmq.client.impl.nio.NioParams; import com.rabbitmq.client.impl.nio.SocketChannelFrameHandlerFactory; import com.rabbitmq.client.impl.recovery.AutorecoveringConnection; @@ -209,6 +201,8 @@ public class ConnectionFactory implements Cloneable { */ private TrafficListener trafficListener = TrafficListener.NO_OP; + private CredentialsRefreshService credentialsRefreshService; + /** @return the default host to use for connections */ public String getHost() { return host; @@ -854,6 +848,10 @@ public MetricsCollector getMetricsCollector() { return metricsCollector; } + public void setCredentialsRefreshService(CredentialsRefreshService credentialsRefreshService) { + this.credentialsRefreshService = credentialsRefreshService; + } + protected synchronized FrameHandlerFactory createFrameHandlerFactory() throws IOException { if(nio) { if(this.frameHandlerFactory == null) { @@ -1161,6 +1159,7 @@ public ConnectionParams params(ExecutorService consumerWorkServiceExecutor) { result.setConnectionRecoveryTriggeringCondition(connectionRecoveryTriggeringCondition); result.setTopologyRecoveryRetryHandler(topologyRecoveryRetryHandler); result.setTrafficListener(trafficListener); + result.setCredentialsRefreshService(credentialsRefreshService); return result; } diff --git a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java index e5a40ceee1..67c2c29afe 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java @@ -142,6 +142,7 @@ public static Map defaultClientProperties() { private final int channelRpcTimeout; private final boolean channelShouldCheckRpcResponseType; private final TrafficListener trafficListener; + private final CredentialsRefreshService credentialsRefreshService; /* State modified after start - all volatile */ @@ -239,6 +240,9 @@ public AMQConnection(ConnectionParams params, FrameHandler frameHandler, Metrics this.channelShouldCheckRpcResponseType = params.channelShouldCheckRpcResponseType(); this.trafficListener = params.getTrafficListener() == null ? TrafficListener.NO_OP : params.getTrafficListener(); + + this.credentialsRefreshService = params.getCredentialsRefreshService(); + this._channel0 = new AMQChannel(this, 0) { @Override public boolean processAsync(Command c) throws IOException { return getConnection().processControlCommand(c); @@ -336,6 +340,15 @@ public void start() String username = credentialsProvider.getUsername(); String password = credentialsProvider.getPassword(); + + if (credentialsProvider.getExpiration() != null) { + if (this.credentialsRefreshService.needRefresh(credentialsProvider.getExpiration())) { + credentialsProvider.refresh(); + username = credentialsProvider.getUsername(); + password = credentialsProvider.getPassword(); + } + } + LongString challenge = null; LongString response = sm.handleChallenge(null, username, password); @@ -413,6 +426,26 @@ public void start() throw AMQChannel.wrap(sse); } + if (this.credentialsProvider.getExpiration() != null) { + String registrationId = this.credentialsRefreshService.register(credentialsProvider, () -> { + // return false if connection is closed, so refresh service can get rid of this registration + if (!isOpen()) { + return false; + } + if (this._inConnectionNegotiation) { + // this should not happen + return true; + } + String refreshedPassword = credentialsProvider.getPassword(); + + // TODO send password to server with update-secret extension, using channel 0 + + return true; + }); + + addShutdownListener(sse -> this.credentialsRefreshService.unregister(this.credentialsProvider, registrationId)); + } + // We can now respond to errors having finished tailoring the connection this._inConnectionNegotiation = false; } diff --git a/src/main/java/com/rabbitmq/client/impl/ConnectionParams.java b/src/main/java/com/rabbitmq/client/impl/ConnectionParams.java index 849905e2a8..57a028783b 100644 --- a/src/main/java/com/rabbitmq/client/impl/ConnectionParams.java +++ b/src/main/java/com/rabbitmq/client/impl/ConnectionParams.java @@ -60,6 +60,8 @@ public class ConnectionParams { private TrafficListener trafficListener; + private CredentialsRefreshService credentialsRefreshService; + public ConnectionParams() {} public CredentialsProvider getCredentialsProvider() { @@ -277,4 +279,12 @@ public void setTrafficListener(TrafficListener trafficListener) { public TrafficListener getTrafficListener() { return trafficListener; } + + public void setCredentialsRefreshService(CredentialsRefreshService credentialsRefreshService) { + this.credentialsRefreshService = credentialsRefreshService; + } + + public CredentialsRefreshService getCredentialsRefreshService() { + return credentialsRefreshService; + } } diff --git a/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java index 1b1c308cd6..a7db53f8c3 100644 --- a/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java +++ b/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java @@ -1,16 +1,67 @@ +// Copyright (c) 2018-2019 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + package com.rabbitmq.client.impl; +import java.util.Date; + /** * Provider interface for establishing credentials for connecting to the broker. Especially useful - * for situations where credentials might change before a recovery takes place or where it is + * for situations where credentials might expire or change before a recovery takes place or where it is * convenient to plug in an outside custom implementation. * - * @since 4.5.0 + * @see CredentialsRefreshService + * @since 5.2.0 */ public interface CredentialsProvider { + /** + * Username to use for authentication + * + * @return username + */ String getUsername(); + /** + * Password/secret/token to use for authentication + * + * @return password/secret/token + */ String getPassword(); + /** + * The expiration date of the credentials, if any. + *

+ * If credentials do not expire, must return null. Default + * behavior is to return null, assuming credentials never + * expire. + * + * @return credentials expiration date + */ + default Date getExpiration() { + // no expiration by default + return null; + } + + /** + * Instructs the provider to refresh or renew credentials. + *

+ * Default behavior is no-op. + */ + default void refresh() { + // no need to refresh anything by default + } + } \ No newline at end of file diff --git a/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java b/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java new file mode 100644 index 0000000000..536c0dc0e0 --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java @@ -0,0 +1,73 @@ +// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl; + +import java.util.Date; +import java.util.concurrent.Callable; + +/** + * Provider interface to refresh credentials when appropriate + * and perform an operation once the credentials have been + * renewed. In the context of RabbitMQ, the operation consists + * in calling the update.secret AMQP extension + * to provide new valid credentials before the current ones + * expire. + *

+ * New connections are registered and implementations must perform + * credentials renewal when appropriate. Implementations + * must call a registered callback once credentials are renewed. + * + * @see CredentialsProvider + * @see DefaultCredentialsRefreshService + */ +public interface CredentialsRefreshService { + + /** + * Register a new entity that needs credentials renewal. + *

+ * The registered callback must return true if the action was + * performed correctly, throw an exception if something goes wrong, + * and return false if it became stale and wants to be unregistered. + *

+ * Implementations are free to automatically unregister an entity whose + * callback has failed a given number of times. + * + * @param credentialsProvider the credentials provider + * @param refreshAction the action to perform after credentials renewal + * @return a tracking ID for the registration + */ + String register(CredentialsProvider credentialsProvider, Callable refreshAction); + + /** + * Unregister the entity with the given registration ID. + *

+ * Its state is cleaned up and its registered callback will not be + * called again. + * + * @param credentialsProvider the credentials provider + * @param registrationId the registration ID + */ + void unregister(CredentialsProvider credentialsProvider, String registrationId); + + /** + * Provide a hint about whether credentials should be renewed. + * + * @param expiration + * @return true if credentials should be renewed, false otherwise + */ + boolean needRefresh(Date expiration); + +} diff --git a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsProvider.java index f743a14618..20cbbe3acc 100644 --- a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsProvider.java +++ b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsProvider.java @@ -1,3 +1,18 @@ +// Copyright (c) 2018-2019 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + package com.rabbitmq.client.impl; /** diff --git a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java new file mode 100644 index 0000000000..091948bb82 --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java @@ -0,0 +1,307 @@ +// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.time.Duration; +import java.util.Date; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Function; +import java.util.function.Supplier; + +/** + * Scheduling-based implementation of {@link CredentialsRefreshService}. + *

+ * This implementation keeps track of entities (typically AMQP connections) that need + * to renew credentials. Token renewal is scheduled based on token expiration, using + * a Function refreshDelayStrategy. Once credentials + * for a {@link CredentialsProvider} have been renewed, the callback registered + * by each entity/connection is performed. This callback typically propagates + * the new credentials in the entity state, e.g. sending the new password to the + * broker for AMQP connections. + */ +public class DefaultCredentialsRefreshService implements CredentialsRefreshService { + + private static final Logger LOGGER = LoggerFactory.getLogger(DefaultCredentialsRefreshService.class); + + private final ScheduledExecutorService scheduler; + + private final ConcurrentMap credentialsProviderStates = new ConcurrentHashMap<>(); + + private final boolean privateScheduler; + + private final Function refreshDelayStrategy; + + private final Function needRefreshStrategy; + + public DefaultCredentialsRefreshService(ScheduledExecutorService scheduler, Function refreshDelayStrategy, Function needRefreshStrategy) { + this.refreshDelayStrategy = refreshDelayStrategy; + this.needRefreshStrategy = needRefreshStrategy; + if (scheduler == null) { + this.scheduler = Executors.newScheduledThreadPool(1); + privateScheduler = true; + } else { + this.scheduler = scheduler; + privateScheduler = false; + } + } + + /** + * Delay before refresh is TTL - specified duration. + *

+ * E.g. if TTL is 60 seconds and specified duration is 20 seconds, refresh will + * be scheduled in 60 - 20 = 40 seconds. + * + * @param duration + * @return + */ + public static Function fixedDelayBeforeExpirationRefreshDelayStrategy(Duration duration) { + return new FixedDelayBeforeExpirationRefreshDelayStrategy(duration.toMillis()); + } + + /** + * Advise to refresh credentials if TTL <= limit. + * + * @param limitBeforeExpiration + * @return + */ + public static Function fixedTimeNeedRefreshStrategy(Duration limitBeforeExpiration) { + return new FixedTimeNeedRefreshStrategy(limitBeforeExpiration.toMillis()); + } + + // TODO add a delay refresh strategy that bases the time on a percentage of the TTL, use it as default with 80% TTL + + private static Runnable refresh(ScheduledExecutorService scheduler, CredentialsProviderState credentialsProviderState, + Function refreshDelayStrategy) { + return () -> { + LOGGER.debug("Refreshing token"); + credentialsProviderState.refresh(); + + Date expirationAfterRefresh = credentialsProviderState.credentialsProvider.getExpiration(); + long newDelay = refreshDelayStrategy.apply(expirationAfterRefresh); + + LOGGER.debug("Scheduling refresh in {} milliseconds", newDelay); + + ScheduledFuture scheduledFuture = scheduler.schedule(refresh(scheduler, credentialsProviderState, refreshDelayStrategy), newDelay, TimeUnit.MILLISECONDS); + credentialsProviderState.refreshTask.set(scheduledFuture); + }; + } + + @Override + public String register(CredentialsProvider credentialsProvider, Callable refreshAction) { + String registrationId = UUID.randomUUID().toString(); + LOGGER.debug("New registration {}", registrationId); + + Registration registration = new Registration(registrationId, refreshAction); + CredentialsProviderState credentialsProviderState = credentialsProviderStates.computeIfAbsent( + credentialsProvider, + credentialsProviderKey -> new CredentialsProviderState(credentialsProviderKey) + ); + + credentialsProviderState.add(registration); + + credentialsProviderState.maybeSetRefreshTask(() -> { + Date expiration = credentialsProvider.getExpiration(); + long delay = refreshDelayStrategy.apply(expiration); + LOGGER.debug("Scheduling refresh in {} milliseconds", delay); + return scheduler.schedule(refresh(scheduler, credentialsProviderState, refreshDelayStrategy), delay, TimeUnit.MILLISECONDS); + }); + + return registrationId; + } + + @Override + public void unregister(CredentialsProvider credentialsProvider, String registrationId) { + CredentialsProviderState credentialsProviderState = this.credentialsProviderStates.get(credentialsProvider); + if (credentialsProviderState != null) { + credentialsProviderState.unregister(registrationId); + } + } + + @Override + public boolean needRefresh(Date expiration) { + return this.needRefreshStrategy.apply(expiration); + } + + public void close() { + if (privateScheduler) { + scheduler.shutdownNow(); + } + } + + private static class FixedTimeNeedRefreshStrategy implements Function { + + private final long limitBeforeExpiration; + + private FixedTimeNeedRefreshStrategy(long limitBeforeExpiration) { + this.limitBeforeExpiration = limitBeforeExpiration; + } + + @Override + public Boolean apply(Date expiration) { + long ttl = expiration.getTime() - new Date().getTime(); + return ttl <= limitBeforeExpiration; + } + } + + private static class FixedDelayBeforeExpirationRefreshDelayStrategy implements Function { + + private final long delay; + + private FixedDelayBeforeExpirationRefreshDelayStrategy(long delay) { + this.delay = delay; + } + + @Override + public Long apply(Date expiration) { + long ttl = expiration.getTime() - new Date().getTime(); + long refreshTimeBeforeExpiration = ttl - delay; + if (refreshTimeBeforeExpiration < 0) { + return ttl; + } else { + return refreshTimeBeforeExpiration; + } + } + } + + static class Registration { + + private final Callable refreshAction; + + private final AtomicInteger errorHistory = new AtomicInteger(0); + + private final String id; + + Registration(String id, Callable refreshAction) { + this.refreshAction = refreshAction; + this.id = id; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Registration that = (Registration) o; + + return id.equals(that.id); + } + + @Override + public int hashCode() { + return id.hashCode(); + } + } + + /** + * State and refresh behavior for a {@link CredentialsProvider} and + * its registered entities. + */ + static class CredentialsProviderState { + + private final CredentialsProvider credentialsProvider; + + private final Map registrations = new ConcurrentHashMap<>(); + + private final AtomicReference> refreshTask = new AtomicReference<>(); + + private final AtomicBoolean refreshTaskSet = new AtomicBoolean(false); + + CredentialsProviderState(CredentialsProvider credentialsProvider) { + this.credentialsProvider = credentialsProvider; + } + + void add(Registration registration) { + this.registrations.put(registration.id, registration); + } + + void maybeSetRefreshTask(Supplier> scheduledFutureSupplier) { + if (refreshTaskSet.compareAndSet(false, true)) { + refreshTask.set(scheduledFutureSupplier.get()); + } + } + + void refresh() { + // FIXME check whether thread has been cancelled or not before refresh() and registratAction.call() + + // FIXME protect this call, or at least log some error + this.credentialsProvider.refresh(); + + Iterator iterator = registrations.values().iterator(); + while (iterator.hasNext()) { + Registration registration = iterator.next(); + // FIXME set a timeout on the call? (needs a separate thread) + try { + boolean refreshed = registration.refreshAction.call(); + if (!refreshed) { + LOGGER.debug("Registration did not refresh token"); + iterator.remove(); + } + registration.errorHistory.set(0); + } catch (Exception e) { + LOGGER.warn("Error while trying to refresh a connection token", e); + registration.errorHistory.incrementAndGet(); + if (registration.errorHistory.get() >= 5) { + registrations.remove(registration.id); + } + } + } + } + + void unregister(String registrationId) { + this.registrations.remove(registrationId); + } + } + + public static class DefaultCredentialsRefreshServiceBuilder { + + + private ScheduledExecutorService scheduler; + + private Function refreshDelayStrategy = fixedDelayBeforeExpirationRefreshDelayStrategy(Duration.ofSeconds(60)); + + private Function needRefreshStrategy = fixedTimeNeedRefreshStrategy(Duration.ofSeconds(60)); + + public DefaultCredentialsRefreshServiceBuilder scheduler(ScheduledThreadPoolExecutor scheduler) { + this.scheduler = scheduler; + return this; + } + + public DefaultCredentialsRefreshServiceBuilder refreshDelayStrategy(Function refreshDelayStrategy) { + this.refreshDelayStrategy = refreshDelayStrategy; + return this; + } + + public DefaultCredentialsRefreshServiceBuilder needRefreshStrategy(Function needRefreshStrategy) { + this.needRefreshStrategy = needRefreshStrategy; + return this; + } + + public DefaultCredentialsRefreshService build() { + return new DefaultCredentialsRefreshService(scheduler, refreshDelayStrategy, needRefreshStrategy); + } + + } + +} diff --git a/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java new file mode 100644 index 0000000000..ca3fb5c8a3 --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java @@ -0,0 +1,233 @@ +// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + + +public class OAuth2ClientCredentialsGrantCredentialsProvider implements CredentialsProvider { + + private static final Logger LOGGER = LoggerFactory.getLogger(OAuth2ClientCredentialsGrantCredentialsProvider.class); + + private static final String UTF_8_CHARSET = "UTF-8"; + private final String serverUri; // should be renamed to tokenEndpointUri? + private final String clientId; + private final String clientSecret; + private final String grantType; + // UAA specific, to distinguish between different users + private final String username, password; + + private final ObjectMapper objectMapper = new ObjectMapper(); + + private final String id; + + private final AtomicReference token = new AtomicReference<>(); + + private final Lock refreshLock = new ReentrantLock(); + private final AtomicReference latch = new AtomicReference<>(); + private AtomicBoolean refreshInProcess = new AtomicBoolean(false); + + public OAuth2ClientCredentialsGrantCredentialsProvider(String serverUri, String clientId, String clientSecret, String grantType, String username, String password) { + this.serverUri = serverUri; + this.clientId = clientId; + this.clientSecret = clientSecret; + this.grantType = grantType; + this.username = username; + this.password = password; + this.id = UUID.randomUUID().toString(); + } + + private static StringBuilder encode(StringBuilder builder, String name, String value) throws UnsupportedEncodingException { + if (value != null) { + if (builder.length() > 0) { + builder.append("&"); + } + builder.append(URLEncoder.encode(name, UTF_8_CHARSET)) + .append("=") + .append(URLEncoder.encode(value, UTF_8_CHARSET)); + } + return builder; + } + + private static String basicAuthentication(String username, String password) { + String credentials = username + ":" + password; + byte[] credentialsAsBytes = credentials.getBytes(StandardCharsets.ISO_8859_1); + byte[] encodedBytes = Base64.getEncoder().encode(credentialsAsBytes); + String encodedCredentials = new String(encodedBytes, StandardCharsets.ISO_8859_1); + return "Basic " + encodedCredentials; + } + + @Override + public String getUsername() { + return ""; + } + + @Override + public String getPassword() { + if (token.get() == null) { + refresh(); + } + return token.get().getAccess(); + } + + @Override + public Date getExpiration() { + if (token.get() == null) { + refresh(); + } + return token.get().getExpiration(); + } + + protected Token parseToken(String response) { + try { + Map map = objectMapper.readValue(response, Map.class); + int expiresIn = ((Number) map.get("expires_in")).intValue(); + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.SECOND, expiresIn); + return new Token(map.get("access_token").toString(), calendar.getTime()); + } catch (IOException e) { + throw new OAuthTokenManagementException("Error while parsing OAuth 2 token", e); + } + } + + @Override + public void refresh() { + // refresh should happen at once. Other calls wait for the refresh to finish and move on. + if (refreshLock.tryLock()) { + LOGGER.debug("Refreshing token"); + try { + latch.set(new CountDownLatch(1)); + refreshInProcess.set(true); + token.set(retrieveToken()); + LOGGER.debug("Token refreshed"); + } finally { + latch.get().countDown(); + refreshInProcess.set(false); + refreshLock.unlock(); + } + } else { + try { + LOGGER.debug("Waiting for token refresh to be finished"); + while (!refreshInProcess.get()) { + Thread.sleep(10); + } + latch.get().await(); + LOGGER.debug("Done waiting for token refresh"); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } + } + + protected Token retrieveToken() { + // FIXME handle TLS specific settings + try { + StringBuilder urlParameters = new StringBuilder(); + encode(urlParameters, "grant_type", grantType); + encode(urlParameters, "username", username); + encode(urlParameters, "password", password); + byte[] postData = urlParameters.toString().getBytes(StandardCharsets.UTF_8); + int postDataLength = postData.length; + URL url = new URL(serverUri); + // FIXME close connection? + // FIXME set timeout on request + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + conn.setDoOutput(true); + conn.setInstanceFollowRedirects(false); + conn.setRequestMethod("POST"); + conn.setRequestProperty("authorization", basicAuthentication(clientId, clientSecret)); + conn.setRequestProperty("content-type", "application/x-www-form-urlencoded"); + conn.setRequestProperty("charset", UTF_8_CHARSET); + conn.setRequestProperty("accept", "application/json"); + conn.setRequestProperty("content-length", Integer.toString(postDataLength)); + conn.setUseCaches(false); + try (DataOutputStream wr = new DataOutputStream(conn.getOutputStream())) { + wr.write(postData); + } + int responseCode = conn.getResponseCode(); + if (responseCode != 200) { + throw new OAuthTokenManagementException( + "HTTP request for token retrieval did not " + + "return 200 response code: " + responseCode + ); + } + + StringBuffer content = new StringBuffer(); + try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()))) { + String inputLine; + while ((inputLine = in.readLine()) != null) { + content.append(inputLine); + } + } + + // FIXME check result is json + + + return parseToken(content.toString()); + } catch (IOException e) { + throw new OAuthTokenManagementException("Error while retrieving OAuth 2 token", e); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + OAuth2ClientCredentialsGrantCredentialsProvider that = (OAuth2ClientCredentialsGrantCredentialsProvider) o; + + return id.equals(that.id); + } + + @Override + public int hashCode() { + return id.hashCode(); + } + + public static class Token { + + private final String access; + + private final Date expiration; + + public Token(String access, Date expiration) { + this.access = access; + this.expiration = expiration; + } + + public Date getExpiration() { + return expiration; + } + + public String getAccess() { + return access; + } + } +} diff --git a/src/main/java/com/rabbitmq/client/impl/OAuthTokenManagementException.java b/src/main/java/com/rabbitmq/client/impl/OAuthTokenManagementException.java new file mode 100644 index 0000000000..62db5e07a5 --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/OAuthTokenManagementException.java @@ -0,0 +1,27 @@ +// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl; + +public class OAuthTokenManagementException extends RuntimeException { + + public OAuthTokenManagementException(String message, Throwable cause) { + super(message, cause); + } + + public OAuthTokenManagementException(String message) { + super(message); + } +} diff --git a/src/test/java/com/rabbitmq/client/RefreshCredentialsTest.java b/src/test/java/com/rabbitmq/client/RefreshCredentialsTest.java new file mode 100644 index 0000000000..41fe348e28 --- /dev/null +++ b/src/test/java/com/rabbitmq/client/RefreshCredentialsTest.java @@ -0,0 +1,81 @@ +// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client; + +import com.rabbitmq.client.impl.DefaultCredentialsRefreshService; +import com.rabbitmq.client.impl.OAuth2ClientCredentialsGrantCredentialsProvider; +import com.rabbitmq.client.test.TestUtils; +import org.junit.Before; +import org.junit.Test; + +import java.time.Duration; +import java.util.Calendar; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import static org.assertj.core.api.Assertions.assertThat; + +public class RefreshCredentialsTest { + + DefaultCredentialsRefreshService refreshService; + + @Before + public void tearDown() { + if (refreshService != null) { + refreshService.close(); + } + } + + @Test + public void connectionAndRefreshCredentials() throws Exception { + ConnectionFactory cf = TestUtils.connectionFactory(); + CountDownLatch latch = new CountDownLatch(5); + // OAuth server is actually not used in this test, default RabbitMQ authentication backend is + OAuth2ClientCredentialsGrantCredentialsProvider provider = new OAuth2ClientCredentialsGrantCredentialsProvider( + "http://localhost:8080/uaa/oauth/token/", + "rabbit_client", "rabbit_secret", + "password", // UAA-specific, standard is client_credentials + "rabbit_super", "rabbit_super" // UAA-specific, to distinguish between RabbitMQ users + ) { + @Override + protected Token retrieveToken() { + latch.countDown(); + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.SECOND, 2); + return new Token("guest", calendar.getTime()); + } + + @Override + public String getUsername() { + return "guest"; + } + }; + cf.setCredentialsProvider(provider); + refreshService = new DefaultCredentialsRefreshService.DefaultCredentialsRefreshServiceBuilder() + .refreshDelayStrategy(DefaultCredentialsRefreshService.fixedDelayBeforeExpirationRefreshDelayStrategy(Duration.ofSeconds(1))) + .needRefreshStrategy(expiration -> false) + .build(); + cf.setCredentialsRefreshService(refreshService); + + try (Connection c = cf.newConnection()) { + Channel ch = c.createChannel(); + String queue = ch.queueDeclare().getQueue(); + TestUtils.sendAndConsumeMessage("", queue, queue, c); + assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue(); + } + } + +} diff --git a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java new file mode 100644 index 0000000000..66e59ba866 --- /dev/null +++ b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java @@ -0,0 +1,181 @@ +// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl; + +import org.junit.After; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.stubbing.Answer; + +import java.time.Duration; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.IntStream; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.*; + +@RunWith(MockitoJUnitRunner.class) +public class DefaultCredentialsRefreshServiceTest { + + @Mock + Callable refreshAction; + + @Mock + CredentialsProvider credentialsProvider; + + DefaultCredentialsRefreshService refreshService; + + @After + public void tearDown() { + if (refreshService != null) { + refreshService.close(); + } + } + + @Test + public void scheduling() throws Exception { + refreshService = new DefaultCredentialsRefreshService.DefaultCredentialsRefreshServiceBuilder() + .refreshDelayStrategy(DefaultCredentialsRefreshService.fixedDelayBeforeExpirationRefreshDelayStrategy(Duration.ofSeconds(2))) + .build(); + + AtomicInteger passwordSequence = new AtomicInteger(0); + when(credentialsProvider.getPassword()).thenAnswer( + (Answer) invocation -> "password-" + passwordSequence.get()); + when(credentialsProvider.getExpiration()).thenAnswer((Answer) invocation -> { + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.SECOND, 5); + return calendar.getTime(); + }); + doAnswer(invocation -> { + passwordSequence.incrementAndGet(); + return null; + }).when(credentialsProvider).refresh(); + + List passwords = new CopyOnWriteArrayList<>(); + CountDownLatch latch = new CountDownLatch(2 * 2); + refreshAction = () -> { + passwords.add(credentialsProvider.getPassword()); + latch.countDown(); + return true; + }; + refreshService.register(credentialsProvider, refreshAction); + refreshService.register(credentialsProvider, refreshAction); + assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue(); + assertThat(passwords).hasSize(4).containsExactlyInAnyOrder("password-1", "password-2", "password-1", "password-2"); + + AtomicInteger passwordSequence2 = new AtomicInteger(0); + CredentialsProvider credentialsProvider2 = mock(CredentialsProvider.class); + when(credentialsProvider2.getPassword()).thenAnswer((Answer) invocation -> "password2-" + passwordSequence2.get()); + when(credentialsProvider2.getExpiration()).thenAnswer((Answer) invocation -> { + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.SECOND, 4); + return calendar.getTime(); + }); + doAnswer(invocation -> { + passwordSequence2.incrementAndGet(); + return null; + }).when(credentialsProvider2).refresh(); + + + List passwords2 = new CopyOnWriteArrayList<>(); + CountDownLatch latch2 = new CountDownLatch(2 * 1); + refreshAction = () -> { + passwords2.add(credentialsProvider2.getPassword()); + latch2.countDown(); + return true; + }; + + refreshService.register(credentialsProvider2, refreshAction); + + assertThat(latch2.await(10, TimeUnit.SECONDS)).isTrue(); + assertThat(passwords2).hasSize(2).containsExactlyInAnyOrder( + "password2-1", "password2-2" + ); + assertThat(passwords).hasSizeGreaterThan(4); + + + } + + @Test + public void refreshActionIsCorrectlyRegisteredCalledAndCanceled() throws Exception { + DefaultCredentialsRefreshService.CredentialsProviderState state = new DefaultCredentialsRefreshService.CredentialsProviderState( + credentialsProvider + ); + when(refreshAction.call()).thenReturn(true); + state.add(new DefaultCredentialsRefreshService.Registration("1", refreshAction)); + + state.refresh(); + verify(credentialsProvider, times(1)).refresh(); + verify(refreshAction, times(1)).call(); + + state.refresh(); + verify(credentialsProvider, times(2)).refresh(); + verify(refreshAction, times(2)).call(); + + state.unregister("1"); + state.refresh(); + verify(credentialsProvider, times(3)).refresh(); + verify(refreshAction, times(2)).call(); + } + + @Test + public void refreshActionIsRemovedIfItReturnsFalse() throws Exception { + DefaultCredentialsRefreshService.CredentialsProviderState state = new DefaultCredentialsRefreshService.CredentialsProviderState( + credentialsProvider + ); + when(refreshAction.call()).thenReturn(false); + state.add(new DefaultCredentialsRefreshService.Registration("1", refreshAction)); + + state.refresh(); + verify(credentialsProvider, times(1)).refresh(); + verify(refreshAction, times(1)).call(); + + state.refresh(); + verify(credentialsProvider, times(2)).refresh(); + verify(refreshAction, times(1)).call(); + } + + @Test + public void refreshActionIsRemovedIfItErrorsTooMuch() throws Exception { + DefaultCredentialsRefreshService.CredentialsProviderState state = new DefaultCredentialsRefreshService.CredentialsProviderState( + credentialsProvider + ); + when(refreshAction.call()).thenThrow(RuntimeException.class); + state.add(new DefaultCredentialsRefreshService.Registration("1", refreshAction)); + + int callsCountBeforeCancellation = 5; + IntStream.range(0, callsCountBeforeCancellation).forEach(i -> { + state.refresh(); + }); + + verify(credentialsProvider, times(callsCountBeforeCancellation)).refresh(); + verify(refreshAction, times(callsCountBeforeCancellation)).call(); + + state.refresh(); + verify(credentialsProvider, times(callsCountBeforeCancellation + 1)).refresh(); + verify(refreshAction, times(callsCountBeforeCancellation)).call(); + } + +} diff --git a/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java b/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java new file mode 100644 index 0000000000..6e1908fee2 --- /dev/null +++ b/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java @@ -0,0 +1,190 @@ +// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl; + +import com.rabbitmq.client.test.TestUtils; +import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.Request; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.server.handler.AbstractHandler; +import org.eclipse.jetty.server.handler.ContextHandler; +import org.junit.After; +import org.junit.Test; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Calendar; +import java.util.Date; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.IntStream; + +import static org.assertj.core.api.Assertions.assertThat; + +public class OAuth2ClientCredentialsGrantCredentialsProviderTest { + + Server server; + + @After + public void tearDown() throws Exception { + if (server != null) { + server.stop(); + } + } + + @Test + public void getToken() throws Exception { + Server server = new Server(); + ServerConnector connector = new ServerConnector(server); + int port = TestUtils.randomNetworkPort(); + connector.setPort(port); + server.setConnectors(new Connector[]{connector}); + + AtomicReference httpMethod = new AtomicReference<>(); + AtomicReference contentType = new AtomicReference<>(); + AtomicReference authorization = new AtomicReference<>(); + AtomicReference accept = new AtomicReference<>(); + AtomicReference accessToken = new AtomicReference<>(); + + int expiresIn = 60; + + ContextHandler context = new ContextHandler(); + context.setContextPath("/uaa/oauth/token/"); + context.setHandler(new AbstractHandler() { + + @Override + public void handle(String s, Request request, HttpServletRequest httpServletRequest, HttpServletResponse response) + throws IOException { + + httpMethod.set(request.getMethod()); + contentType.set(request.getContentType()); + authorization.set(request.getHeader("authorization")); + accept.set(request.getHeader("accept")); + + accessToken.set(UUID.randomUUID().toString()); + String json = sampleJsonToken(accessToken.get(), expiresIn); + + response.setStatus(HttpServletResponse.SC_OK); + response.setContentLength(json.length()); + response.setContentType("application/json"); + + response.getWriter().print(json); + + request.setHandled(true); + + } + }); + + server.setHandler(context); + + server.setStopTimeout(1000); + server.start(); + + OAuth2ClientCredentialsGrantCredentialsProvider provider = new OAuth2ClientCredentialsGrantCredentialsProvider( + "http://localhost:" + port + "/uaa/oauth/token/", + "rabbit_client", "rabbit_secret", + "password", // UAA-specific, standard is client_credentials + "rabbit_super", "rabbit_super" // UAA-specific, to distinguish between RabbitMQ users + ); + + String password = provider.getPassword(); + + assertThat(password).isEqualTo(accessToken.get()); + assertThat(provider.getExpiration()).isBetween(offsetNow(expiresIn - 10), offsetNow(expiresIn + 10)); + + assertThat(httpMethod).hasValue("POST"); + assertThat(contentType).hasValue("application/x-www-form-urlencoded"); + assertThat(authorization).hasValue("Basic cmFiYml0X2NsaWVudDpyYWJiaXRfc2VjcmV0"); + assertThat(accept).hasValue("application/json"); + } + + @Test + public void refresh() throws Exception { + AtomicInteger retrieveTokenCallCount = new AtomicInteger(0); + OAuth2ClientCredentialsGrantCredentialsProvider provider = new OAuth2ClientCredentialsGrantCredentialsProvider( + "http://localhost:8080/uaa/oauth/token/", + "rabbit_client", "rabbit_secret", + "password", // UAA-specific, standard is client_credentials + "rabbit_super", "rabbit_super" // UAA-specific, to distinguish between RabbitMQ users + ) { + @Override + protected Token retrieveToken() { + retrieveTokenCallCount.incrementAndGet(); + try { + Thread.sleep(2000L); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + return new Token(UUID.randomUUID().toString(), new Date()); + } + }; + + Set passwords = ConcurrentHashMap.newKeySet(); + CountDownLatch latch = new CountDownLatch(5); + IntStream.range(0, 5).forEach(i -> new Thread(() -> { + passwords.add(provider.getPassword()); + latch.countDown(); + }).start()); + + assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue(); + + assertThat(retrieveTokenCallCount).hasValue(1); + assertThat(passwords).hasSize(1); + } + + @Test + public void parseToken() { + OAuth2ClientCredentialsGrantCredentialsProvider provider = new OAuth2ClientCredentialsGrantCredentialsProvider( + "http://localhost:8080/uaa/oauth/token", + "rabbit_client", "rabbit_secret", + "password", // UAA-specific, standard is client_credentials + "rabbit_super", "rabbit_super" // UAA-specific, to distinguish between RabbitMQ users + ); + + String accessToken = "18c1b1dfdda04382a8bcc14d077b71dd"; + int expiresIn = 43199; + String response = sampleJsonToken(accessToken, expiresIn); + + OAuth2ClientCredentialsGrantCredentialsProvider.Token token = provider.parseToken(response); + assertThat(token.getAccess()).isEqualTo("18c1b1dfdda04382a8bcc14d077b71dd"); + assertThat(token.getExpiration()).isBetween(offsetNow(expiresIn - 10), offsetNow(expiresIn + 1)); + } + + Date offsetNow(int seconds) { + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.SECOND, seconds); + return calendar.getTime(); + } + + String sampleJsonToken(String accessToken, int expiresIn) { + String json = "{\n" + + " \"access_token\" : \"{accessToken}\",\n" + + " \"token_type\" : \"bearer\",\n" + + " \"expires_in\" : {expiresIn},\n" + + " \"scope\" : \"clients.read emails.write scim.userids password.write idps.write notifications.write oauth.login scim.write critical_notifications.write\",\n" + + " \"jti\" : \"18c1b1dfdda04382a8bcc14d077b71dd\"\n" + + "}"; + return json.replace("{accessToken}", accessToken).replace("{expiresIn}", expiresIn + ""); + } + +} diff --git a/src/test/java/com/rabbitmq/client/test/ClientTests.java b/src/test/java/com/rabbitmq/client/test/ClientTests.java index db5c7cd179..713930153b 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientTests.java +++ b/src/test/java/com/rabbitmq/client/test/ClientTests.java @@ -19,6 +19,9 @@ import com.rabbitmq.client.JacksonJsonRpcTest; import com.rabbitmq.client.DefaultJsonRpcTest; import com.rabbitmq.client.impl.ValueWriterTest; +import com.rabbitmq.client.RefreshCredentialsTest; +import com.rabbitmq.client.impl.DefaultCredentialsRefreshServiceTest; +import com.rabbitmq.client.impl.OAuth2ClientCredentialsGrantCredentialsProviderTest; import com.rabbitmq.utility.IntAllocatorTests; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -73,7 +76,10 @@ ConnectionTest.class, TlsUtilsTest.class, ChannelNTest.class, - ValueWriterTest.class + ValueWriterTest.class, + DefaultCredentialsRefreshServiceTest.class, + OAuth2ClientCredentialsGrantCredentialsProviderTest.class, + RefreshCredentialsTest.class }) public class ClientTests { diff --git a/src/test/java/com/rabbitmq/client/test/TestUtils.java b/src/test/java/com/rabbitmq/client/test/TestUtils.java index b385c73fde..21b1f542ad 100644 --- a/src/test/java/com/rabbitmq/client/test/TestUtils.java +++ b/src/test/java/com/rabbitmq/client/test/TestUtils.java @@ -32,6 +32,7 @@ import javax.net.ssl.SSLContext; import java.io.IOException; +import java.net.ServerSocket; import java.security.NoSuchAlgorithmException; import java.util.Arrays; import java.util.Collection; @@ -240,4 +241,12 @@ static int versionCompare(String str1, String str2) { // e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4" return Integer.signum(vals1.length - vals2.length); } + + public static int randomNetworkPort() throws IOException { + ServerSocket socket = new ServerSocket(); + socket.bind(null); + int port = socket.getLocalPort(); + socket.close(); + return port; + } } From 116f57024be21d466b0edcbd463db92d0bc1be22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 24 Jun 2019 14:16:26 +0200 Subject: [PATCH 161/328] Create RefreshProtectedCredentialsProvider class To protect from several actual token retrievals to happen at the same time. This class is used in the OAuth 2 client credentials grant provider. Add also a builder to make the OAuth 2 provider easier to configure, add TLS settings and a test. (cherry picked from commit 5752e55404c771aa73f12df9b440fdb38e78ce11) Conflicts: src/test/java/com/rabbitmq/client/test/ClientTests.java --- pom.xml | 7 + ...ntCredentialsGrantCredentialsProvider.java | 186 +++++++++++------- .../RefreshProtectedCredentialsProvider.java | 113 +++++++++++ .../DefaultCredentialsRefreshServiceTest.java | 4 +- ...edentialsGrantCredentialsProviderTest.java | 176 ++++++++++++----- ...freshProtectedCredentialsProviderTest.java | 90 +++++++++ .../com/rabbitmq/client/test/ClientTests.java | 6 +- .../{ => test}/RefreshCredentialsTest.java | 45 +++-- 8 files changed, 495 insertions(+), 132 deletions(-) create mode 100644 src/main/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProvider.java create mode 100644 src/test/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProviderTest.java rename src/test/java/com/rabbitmq/client/{ => test}/RefreshCredentialsTest.java (69%) diff --git a/pom.xml b/pom.xml index d4523675c8..837802079d 100644 --- a/pom.xml +++ b/pom.xml @@ -64,6 +64,7 @@ 3.0.0 3.12.2 9.4.19.v20190610 + 1.61 3.0.1 2.5.3 @@ -751,6 +752,12 @@ ${jetty.version} test + + org.bouncycastle + bcpkix-jdk15on + ${bouncycastle.version} + test + diff --git a/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java index ca3fb5c8a3..0338fcedd6 100644 --- a/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java +++ b/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java @@ -16,51 +16,60 @@ package com.rabbitmq.client.impl; import com.fasterxml.jackson.databind.ObjectMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLSocketFactory; import java.io.*; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.util.*; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicReference; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; - -public class OAuth2ClientCredentialsGrantCredentialsProvider implements CredentialsProvider { - - private static final Logger LOGGER = LoggerFactory.getLogger(OAuth2ClientCredentialsGrantCredentialsProvider.class); +/** + * + * @see RefreshProtectedCredentialsProvider + */ +public class OAuth2ClientCredentialsGrantCredentialsProvider extends RefreshProtectedCredentialsProvider { private static final String UTF_8_CHARSET = "UTF-8"; - private final String serverUri; // should be renamed to tokenEndpointUri? + private final String tokenEndpointUri; private final String clientId; private final String clientSecret; private final String grantType; - // UAA specific, to distinguish between different users - private final String username, password; + + private final Map parameters; private final ObjectMapper objectMapper = new ObjectMapper(); private final String id; - private final AtomicReference token = new AtomicReference<>(); + private final HostnameVerifier hostnameVerifier; + private final SSLSocketFactory sslSocketFactory; + + public OAuth2ClientCredentialsGrantCredentialsProvider(String tokenEndpointUri, String clientId, String clientSecret, String grantType) { + this(tokenEndpointUri, clientId, clientSecret, grantType, new HashMap<>()); + } + + public OAuth2ClientCredentialsGrantCredentialsProvider(String tokenEndpointUri, String clientId, String clientSecret, String grantType, + HostnameVerifier hostnameVerifier, SSLSocketFactory sslSocketFactory) { + this(tokenEndpointUri, clientId, clientSecret, grantType, new HashMap<>(), hostnameVerifier, sslSocketFactory); + } - private final Lock refreshLock = new ReentrantLock(); - private final AtomicReference latch = new AtomicReference<>(); - private AtomicBoolean refreshInProcess = new AtomicBoolean(false); + public OAuth2ClientCredentialsGrantCredentialsProvider(String tokenEndpointUri, String clientId, String clientSecret, String grantType, Map parameters) { + this(tokenEndpointUri, clientId, clientSecret, grantType, parameters, null, null); + } - public OAuth2ClientCredentialsGrantCredentialsProvider(String serverUri, String clientId, String clientSecret, String grantType, String username, String password) { - this.serverUri = serverUri; + public OAuth2ClientCredentialsGrantCredentialsProvider(String tokenEndpointUri, String clientId, String clientSecret, String grantType, Map parameters, + HostnameVerifier hostnameVerifier, SSLSocketFactory sslSocketFactory) { + this.tokenEndpointUri = tokenEndpointUri; this.clientId = clientId; this.clientSecret = clientSecret; this.grantType = grantType; - this.username = username; - this.password = password; + this.parameters = Collections.unmodifiableMap(new HashMap<>(parameters)); + this.hostnameVerifier = hostnameVerifier; + this.sslSocketFactory = sslSocketFactory; this.id = UUID.randomUUID().toString(); } @@ -90,19 +99,8 @@ public String getUsername() { } @Override - public String getPassword() { - if (token.get() == null) { - refresh(); - } - return token.get().getAccess(); - } - - @Override - public Date getExpiration() { - if (token.get() == null) { - refresh(); - } - return token.get().getExpiration(); + protected String usernameFromToken(Token token) { + return ""; } protected Token parseToken(String response) { @@ -118,47 +116,21 @@ protected Token parseToken(String response) { } @Override - public void refresh() { - // refresh should happen at once. Other calls wait for the refresh to finish and move on. - if (refreshLock.tryLock()) { - LOGGER.debug("Refreshing token"); - try { - latch.set(new CountDownLatch(1)); - refreshInProcess.set(true); - token.set(retrieveToken()); - LOGGER.debug("Token refreshed"); - } finally { - latch.get().countDown(); - refreshInProcess.set(false); - refreshLock.unlock(); - } - } else { - try { - LOGGER.debug("Waiting for token refresh to be finished"); - while (!refreshInProcess.get()) { - Thread.sleep(10); - } - latch.get().await(); - LOGGER.debug("Done waiting for token refresh"); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - } - } - protected Token retrieveToken() { - // FIXME handle TLS specific settings try { StringBuilder urlParameters = new StringBuilder(); encode(urlParameters, "grant_type", grantType); - encode(urlParameters, "username", username); - encode(urlParameters, "password", password); + for (Map.Entry parameter : parameters.entrySet()) { + encode(urlParameters, parameter.getKey(), parameter.getValue()); + } byte[] postData = urlParameters.toString().getBytes(StandardCharsets.UTF_8); int postDataLength = postData.length; - URL url = new URL(serverUri); + URL url = new URL(tokenEndpointUri); + // FIXME close connection? // FIXME set timeout on request HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + conn.setDoOutput(true); conn.setInstanceFollowRedirects(false); conn.setRequestMethod("POST"); @@ -168,6 +140,9 @@ protected Token retrieveToken() { conn.setRequestProperty("accept", "application/json"); conn.setRequestProperty("content-length", Integer.toString(postDataLength)); conn.setUseCaches(false); + + configureHttpConnection(conn); + try (DataOutputStream wr = new DataOutputStream(conn.getOutputStream())) { wr.write(postData); } @@ -196,6 +171,28 @@ protected Token retrieveToken() { } } + @Override + protected String passwordFromToken(Token token) { + return token.getAccess(); + } + + @Override + protected Date expirationFromToken(Token token) { + return token.getExpiration(); + } + + protected void configureHttpConnection(HttpURLConnection connection) { + if (connection instanceof HttpsURLConnection) { + HttpsURLConnection securedConnection = (HttpsURLConnection) connection; + if (this.hostnameVerifier != null) { + securedConnection.setHostnameVerifier(this.hostnameVerifier); + } + if (this.sslSocketFactory != null) { + securedConnection.setSSLSocketFactory(this.sslSocketFactory); + } + } + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -230,4 +227,59 @@ public String getAccess() { return access; } } + + public static class OAuth2ClientCredentialsGrantCredentialsProviderBuilder { + + private final Map parameters = new HashMap<>(); + private String tokenEndpointUri; + private String clientId; + private String clientSecret; + private String grantType = "client_credentials"; + private HostnameVerifier hostnameVerifier; + + private SSLSocketFactory sslSocketFactory; + + public OAuth2ClientCredentialsGrantCredentialsProviderBuilder tokenEndpointUri(String tokenEndpointUri) { + this.tokenEndpointUri = tokenEndpointUri; + return this; + } + + public OAuth2ClientCredentialsGrantCredentialsProviderBuilder clientId(String clientId) { + this.clientId = clientId; + return this; + } + + public OAuth2ClientCredentialsGrantCredentialsProviderBuilder clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + public OAuth2ClientCredentialsGrantCredentialsProviderBuilder grantType(String grantType) { + this.grantType = grantType; + return this; + } + + public OAuth2ClientCredentialsGrantCredentialsProviderBuilder parameter(String name, String value) { + this.parameters.put(name, value); + return this; + } + + public OAuth2ClientCredentialsGrantCredentialsProviderBuilder setHostnameVerifier(HostnameVerifier hostnameVerifier) { + this.hostnameVerifier = hostnameVerifier; + return this; + } + + public OAuth2ClientCredentialsGrantCredentialsProviderBuilder setSslSocketFactory(SSLSocketFactory sslSocketFactory) { + this.sslSocketFactory = sslSocketFactory; + return this; + } + + public OAuth2ClientCredentialsGrantCredentialsProvider build() { + return new OAuth2ClientCredentialsGrantCredentialsProvider( + tokenEndpointUri, clientId, clientSecret, grantType, parameters, + hostnameVerifier, sslSocketFactory + ); + } + + } } diff --git a/src/main/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProvider.java new file mode 100644 index 0000000000..7bca427205 --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProvider.java @@ -0,0 +1,113 @@ +// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Date; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +/** + * An abstract {@link CredentialsProvider} that does not let token refresh happen concurrently. + *

+ * A token is usually long-lived (several minutes or more), can be re-used inside the same application, + * and refreshing it is a costly operation. This base class lets a first call to {@link #refresh()} + * pass and block concurrent calls until the first call is over. Concurrent calls are then unblocked and + * can benefit from the refresh. This avoids unnecessary refresh operations to happen if a token + * is already being renewed. + *

+ * Subclasses need to provide the actual token retrieval (whether is a first retrieval or a renewal is + * a implementation detail) and how to extract information (username, password, expiration date) from the retrieved + * token. + * + * @param the type of token (usually specified by the subclass) + */ +public abstract class RefreshProtectedCredentialsProvider implements CredentialsProvider { + + private static final Logger LOGGER = LoggerFactory.getLogger(RefreshProtectedCredentialsProvider.class); + + private final AtomicReference token = new AtomicReference<>(); + + private final Lock refreshLock = new ReentrantLock(); + private final AtomicReference latch = new AtomicReference<>(); + private AtomicBoolean refreshInProcess = new AtomicBoolean(false); + + @Override + public String getUsername() { + if (token.get() == null) { + refresh(); + } + return usernameFromToken(token.get()); + } + + @Override + public String getPassword() { + if (token.get() == null) { + refresh(); + } + return passwordFromToken(token.get()); + } + + @Override + public Date getExpiration() { + if (token.get() == null) { + refresh(); + } + return expirationFromToken(token.get()); + } + + @Override + public void refresh() { + // refresh should happen at once. Other calls wait for the refresh to finish and move on. + if (refreshLock.tryLock()) { + LOGGER.debug("Refreshing token"); + try { + latch.set(new CountDownLatch(1)); + refreshInProcess.set(true); + token.set(retrieveToken()); + LOGGER.debug("Token refreshed"); + } finally { + latch.get().countDown(); + refreshInProcess.set(false); + refreshLock.unlock(); + } + } else { + try { + LOGGER.debug("Waiting for token refresh to be finished"); + while (!refreshInProcess.get()) { + Thread.sleep(10); + } + latch.get().await(); + LOGGER.debug("Done waiting for token refresh"); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } + } + + protected abstract T retrieveToken(); + + protected abstract String usernameFromToken(T token); + + protected abstract String passwordFromToken(T token); + + protected abstract Date expirationFromToken(T token); +} diff --git a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java index 66e59ba866..56e5bd9a89 100644 --- a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java +++ b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java @@ -166,9 +166,7 @@ public void refreshActionIsRemovedIfItErrorsTooMuch() throws Exception { state.add(new DefaultCredentialsRefreshService.Registration("1", refreshAction)); int callsCountBeforeCancellation = 5; - IntStream.range(0, callsCountBeforeCancellation).forEach(i -> { - state.refresh(); - }); + IntStream.range(0, callsCountBeforeCancellation).forEach(i -> state.refresh()); verify(credentialsProvider, times(callsCountBeforeCancellation)).refresh(); verify(refreshAction, times(callsCountBeforeCancellation)).call(); diff --git a/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java b/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java index 6e1908fee2..662b24235c 100644 --- a/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java +++ b/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java @@ -16,28 +16,39 @@ package com.rabbitmq.client.impl; import com.rabbitmq.client.test.TestUtils; -import org.eclipse.jetty.server.Connector; -import org.eclipse.jetty.server.Request; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.ServerConnector; +import org.bouncycastle.asn1.x500.X500NameBuilder; +import org.bouncycastle.asn1.x500.style.BCStyle; +import org.bouncycastle.cert.X509CertificateHolder; +import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter; +import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder; +import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder; +import org.eclipse.jetty.http.HttpVersion; +import org.eclipse.jetty.server.*; import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.handler.ContextHandler; +import org.eclipse.jetty.util.ssl.SslContextFactory; import org.junit.After; import org.junit.Test; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManagerFactory; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.math.BigInteger; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.X509Certificate; +import java.time.Instant; +import java.time.temporal.ChronoUnit; import java.util.Calendar; import java.util.Date; -import java.util.Set; +import java.util.Map; import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; -import java.util.stream.IntStream; import static org.assertj.core.api.Assertions.assertThat; @@ -65,23 +76,26 @@ public void getToken() throws Exception { AtomicReference authorization = new AtomicReference<>(); AtomicReference accept = new AtomicReference<>(); AtomicReference accessToken = new AtomicReference<>(); + AtomicReference> httpParameters = new AtomicReference<>(); int expiresIn = 60; ContextHandler context = new ContextHandler(); - context.setContextPath("/uaa/oauth/token/"); + context.setContextPath("/uaa/oauth/token"); context.setHandler(new AbstractHandler() { @Override public void handle(String s, Request request, HttpServletRequest httpServletRequest, HttpServletResponse response) throws IOException { - httpMethod.set(request.getMethod()); contentType.set(request.getContentType()); authorization.set(request.getHeader("authorization")); accept.set(request.getHeader("accept")); accessToken.set(UUID.randomUUID().toString()); + + httpParameters.set(request.getParameterMap()); + String json = sampleJsonToken(accessToken.get(), expiresIn); response.setStatus(HttpServletResponse.SC_OK); @@ -91,7 +105,6 @@ public void handle(String s, Request request, HttpServletRequest httpServletRequ response.getWriter().print(json); request.setHandled(true); - } }); @@ -100,12 +113,13 @@ public void handle(String s, Request request, HttpServletRequest httpServletRequ server.setStopTimeout(1000); server.start(); - OAuth2ClientCredentialsGrantCredentialsProvider provider = new OAuth2ClientCredentialsGrantCredentialsProvider( - "http://localhost:" + port + "/uaa/oauth/token/", - "rabbit_client", "rabbit_secret", - "password", // UAA-specific, standard is client_credentials - "rabbit_super", "rabbit_super" // UAA-specific, to distinguish between RabbitMQ users - ); + OAuth2ClientCredentialsGrantCredentialsProvider provider = new OAuth2ClientCredentialsGrantCredentialsProvider.OAuth2ClientCredentialsGrantCredentialsProviderBuilder() + .tokenEndpointUri("http://localhost:" + port + "/uaa/oauth/token/") + .clientId("rabbit_client").clientSecret("rabbit_secret") + .grantType("password") + .parameter("username", "rabbit_super") + .parameter("password", "rabbit_super") + .build(); String password = provider.getPassword(); @@ -116,49 +130,59 @@ public void handle(String s, Request request, HttpServletRequest httpServletRequ assertThat(contentType).hasValue("application/x-www-form-urlencoded"); assertThat(authorization).hasValue("Basic cmFiYml0X2NsaWVudDpyYWJiaXRfc2VjcmV0"); assertThat(accept).hasValue("application/json"); + Map parameters = httpParameters.get(); + assertThat(parameters).isNotNull().hasSize(3).containsKeys("grant_type", "username", "password") + .hasEntrySatisfying("grant_type", v -> assertThat(v).hasSize(1).contains("password")) + .hasEntrySatisfying("username", v -> assertThat(v).hasSize(1).contains("rabbit_super")) + .hasEntrySatisfying("password", v -> assertThat(v).hasSize(1).contains("rabbit_super")); } @Test - public void refresh() throws Exception { - AtomicInteger retrieveTokenCallCount = new AtomicInteger(0); - OAuth2ClientCredentialsGrantCredentialsProvider provider = new OAuth2ClientCredentialsGrantCredentialsProvider( - "http://localhost:8080/uaa/oauth/token/", - "rabbit_client", "rabbit_secret", - "password", // UAA-specific, standard is client_credentials - "rabbit_super", "rabbit_super" // UAA-specific, to distinguish between RabbitMQ users - ) { + public void tls() throws Exception { + int port = TestUtils.randomNetworkPort(); + + String accessToken = UUID.randomUUID().toString(); + int expiresIn = 60; + + AbstractHandler httpHandler = new AbstractHandler() { @Override - protected Token retrieveToken() { - retrieveTokenCallCount.incrementAndGet(); - try { - Thread.sleep(2000L); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - return new Token(UUID.randomUUID().toString(), new Date()); + public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { + String json = sampleJsonToken(accessToken, expiresIn); + + response.setStatus(HttpServletResponse.SC_OK); + response.setContentLength(json.length()); + response.setContentType("application/json"); + + response.getWriter().print(json); + + baseRequest.setHandled(true); } }; - Set passwords = ConcurrentHashMap.newKeySet(); - CountDownLatch latch = new CountDownLatch(5); - IntStream.range(0, 5).forEach(i -> new Thread(() -> { - passwords.add(provider.getPassword()); - latch.countDown(); - }).start()); + KeyStore keyStore = startHttpsServer(port, httpHandler); - assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue(); + TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); + tmf.init(keyStore); + SSLContext sslContext = SSLContext.getInstance("TLSv1.2"); + sslContext.init(null, tmf.getTrustManagers(), null); - assertThat(retrieveTokenCallCount).hasValue(1); - assertThat(passwords).hasSize(1); + OAuth2ClientCredentialsGrantCredentialsProvider provider = new OAuth2ClientCredentialsGrantCredentialsProvider.OAuth2ClientCredentialsGrantCredentialsProviderBuilder() + .tokenEndpointUri("https://localhost:" + port + "/uaa/oauth/token/") + .clientId("rabbit_client").clientSecret("rabbit_secret") + .setSslSocketFactory(sslContext.getSocketFactory()) + .build(); + + String password = provider.getPassword(); + assertThat(password).isEqualTo(accessToken); + assertThat(provider.getExpiration()).isBetween(offsetNow(expiresIn - 10), offsetNow(expiresIn + 10)); } @Test public void parseToken() { OAuth2ClientCredentialsGrantCredentialsProvider provider = new OAuth2ClientCredentialsGrantCredentialsProvider( - "http://localhost:8080/uaa/oauth/token", + "http://localhost:8080/uaa/oauth/token/", "rabbit_client", "rabbit_secret", - "password", // UAA-specific, standard is client_credentials - "rabbit_super", "rabbit_super" // UAA-specific, to distinguish between RabbitMQ users + "client_credentials" ); String accessToken = "18c1b1dfdda04382a8bcc14d077b71dd"; @@ -187,4 +211,62 @@ String sampleJsonToken(String accessToken, int expiresIn) { return json.replace("{accessToken}", accessToken).replace("{expiresIn}", expiresIn + ""); } + KeyStore startHttpsServer(int port, Handler handler) throws Exception { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + String keyStorePassword = "password"; + keyStore.load(null, keyStorePassword.toCharArray()); + + KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA"); + kpg.initialize(2048); + KeyPair kp = kpg.generateKeyPair(); + + JcaX509v3CertificateBuilder certificateBuilder = new JcaX509v3CertificateBuilder( + new X500NameBuilder().addRDN(BCStyle.CN, "localhost").build(), + BigInteger.valueOf(new SecureRandom().nextInt()), + Date.from(Instant.now().minus(10, ChronoUnit.DAYS)), + Date.from(Instant.now().plus(10, ChronoUnit.DAYS)), + new X500NameBuilder().addRDN(BCStyle.CN, "localhost").build(), + kp.getPublic() + ); + + X509CertificateHolder certificateHolder = certificateBuilder.build(new JcaContentSignerBuilder("SHA256WithRSAEncryption") + .build(kp.getPrivate())); + + X509Certificate certificate = new JcaX509CertificateConverter().getCertificate(certificateHolder); + + keyStore.setKeyEntry("default", kp.getPrivate(), keyStorePassword.toCharArray(), new Certificate[]{certificate}); + + server = new Server(); + SslContextFactory sslContextFactory = new SslContextFactory.Server(); + sslContextFactory.setKeyStore(keyStore); + sslContextFactory.setKeyStorePassword(keyStorePassword); + + HttpConfiguration httpsConfiguration = new HttpConfiguration(); + httpsConfiguration.setSecureScheme("https"); + httpsConfiguration.setSecurePort(port); + httpsConfiguration.setOutputBufferSize(32768); + + SecureRequestCustomizer src = new SecureRequestCustomizer(); + src.setStsMaxAge(2000); + src.setStsIncludeSubDomains(true); + httpsConfiguration.addCustomizer(src); + + ServerConnector https = new ServerConnector(server, + new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()), + new HttpConnectionFactory(httpsConfiguration)); + https.setPort(port); + https.setIdleTimeout(500000); + + server.setConnectors(new Connector[]{https}); + + ContextHandler context = new ContextHandler(); + context.setContextPath("/uaa/oauth/token"); + context.setHandler(handler); + + server.setHandler(context); + + server.start(); + return keyStore; + } + } diff --git a/src/test/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProviderTest.java b/src/test/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProviderTest.java new file mode 100644 index 0000000000..5c15cd7400 --- /dev/null +++ b/src/test/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProviderTest.java @@ -0,0 +1,90 @@ +// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl; + +import org.junit.Test; + +import java.util.Date; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.IntStream; + +import static org.assertj.core.api.Assertions.assertThat; + +public class RefreshProtectedCredentialsProviderTest { + + @Test + public void refresh() throws Exception { + AtomicInteger retrieveTokenCallCount = new AtomicInteger(0); + + RefreshProtectedCredentialsProvider credentialsProvider = new RefreshProtectedCredentialsProvider() { + + @Override + protected TestToken retrieveToken() { + retrieveTokenCallCount.incrementAndGet(); + try { + Thread.sleep(2000L); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + return new TestToken(UUID.randomUUID().toString(), new Date()); + } + + @Override + protected String usernameFromToken(TestToken token) { + return ""; + } + + @Override + protected String passwordFromToken(TestToken token) { + return token.secret; + } + + @Override + protected Date expirationFromToken(TestToken token) { + return token.expiration; + } + }; + + Set passwords = ConcurrentHashMap.newKeySet(); + CountDownLatch latch = new CountDownLatch(5); + IntStream.range(0, 5).forEach(i -> new Thread(() -> { + passwords.add(credentialsProvider.getPassword()); + latch.countDown(); + }).start()); + + assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue(); + + assertThat(retrieveTokenCallCount).hasValue(1); + assertThat(passwords).hasSize(1); + } + + private static class TestToken { + + final String secret; + final Date expiration; + + TestToken(String secret, Date expiration) { + this.secret = secret; + this.expiration = expiration; + } + } + +} diff --git a/src/test/java/com/rabbitmq/client/test/ClientTests.java b/src/test/java/com/rabbitmq/client/test/ClientTests.java index 713930153b..1ec240888f 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientTests.java +++ b/src/test/java/com/rabbitmq/client/test/ClientTests.java @@ -17,11 +17,12 @@ package com.rabbitmq.client.test; import com.rabbitmq.client.JacksonJsonRpcTest; + import com.rabbitmq.client.DefaultJsonRpcTest; -import com.rabbitmq.client.impl.ValueWriterTest; -import com.rabbitmq.client.RefreshCredentialsTest; import com.rabbitmq.client.impl.DefaultCredentialsRefreshServiceTest; import com.rabbitmq.client.impl.OAuth2ClientCredentialsGrantCredentialsProviderTest; +import com.rabbitmq.client.impl.RefreshProtectedCredentialsProviderTest; +import com.rabbitmq.client.impl.ValueWriterTest; import com.rabbitmq.utility.IntAllocatorTests; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -77,6 +78,7 @@ TlsUtilsTest.class, ChannelNTest.class, ValueWriterTest.class, + RefreshProtectedCredentialsProviderTest.class, DefaultCredentialsRefreshServiceTest.class, OAuth2ClientCredentialsGrantCredentialsProviderTest.class, RefreshCredentialsTest.class diff --git a/src/test/java/com/rabbitmq/client/RefreshCredentialsTest.java b/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java similarity index 69% rename from src/test/java/com/rabbitmq/client/RefreshCredentialsTest.java rename to src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java index 41fe348e28..fa455b7744 100644 --- a/src/test/java/com/rabbitmq/client/RefreshCredentialsTest.java +++ b/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java @@ -13,16 +13,19 @@ // If you have any questions regarding licensing, please contact us at // info@rabbitmq.com. -package com.rabbitmq.client; +package com.rabbitmq.client.test; +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.Connection; +import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.impl.DefaultCredentialsRefreshService; -import com.rabbitmq.client.impl.OAuth2ClientCredentialsGrantCredentialsProvider; -import com.rabbitmq.client.test.TestUtils; +import com.rabbitmq.client.impl.RefreshProtectedCredentialsProvider; import org.junit.Before; import org.junit.Test; import java.time.Duration; import java.util.Calendar; +import java.util.Date; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -43,26 +46,31 @@ public void tearDown() { public void connectionAndRefreshCredentials() throws Exception { ConnectionFactory cf = TestUtils.connectionFactory(); CountDownLatch latch = new CountDownLatch(5); - // OAuth server is actually not used in this test, default RabbitMQ authentication backend is - OAuth2ClientCredentialsGrantCredentialsProvider provider = new OAuth2ClientCredentialsGrantCredentialsProvider( - "http://localhost:8080/uaa/oauth/token/", - "rabbit_client", "rabbit_secret", - "password", // UAA-specific, standard is client_credentials - "rabbit_super", "rabbit_super" // UAA-specific, to distinguish between RabbitMQ users - ) { + RefreshProtectedCredentialsProvider provider = new RefreshProtectedCredentialsProvider() { @Override - protected Token retrieveToken() { + protected TestToken retrieveToken() { latch.countDown(); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.SECOND, 2); - return new Token("guest", calendar.getTime()); + return new TestToken("guest", calendar.getTime()); } @Override - public String getUsername() { + protected String usernameFromToken(TestToken token) { return "guest"; } + + @Override + protected String passwordFromToken(TestToken token) { + return token.secret; + } + + @Override + protected Date expirationFromToken(TestToken token) { + return token.expiration; + } }; + cf.setCredentialsProvider(provider); refreshService = new DefaultCredentialsRefreshService.DefaultCredentialsRefreshServiceBuilder() .refreshDelayStrategy(DefaultCredentialsRefreshService.fixedDelayBeforeExpirationRefreshDelayStrategy(Duration.ofSeconds(1))) @@ -78,4 +86,15 @@ public String getUsername() { } } + private static class TestToken { + + final String secret; + final Date expiration; + + TestToken(String secret, Date expiration) { + this.secret = secret; + this.expiration = expiration; + } + } + } From 0ce9d78fa7179ccb1ad3754b349c8204710709bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 24 Jun 2019 17:55:57 +0200 Subject: [PATCH 162/328] Use Duration to track token expiration Easier to work with than a Date. (cherry picked from commit 6277348afb6a23d9c0db1bdc0a26a6a8ee0eb77b) --- .../rabbitmq/client/impl/AMQConnection.java | 8 +-- .../client/impl/CredentialsProvider.java | 9 ++-- .../impl/CredentialsRefreshService.java | 6 +-- .../DefaultCredentialsRefreshService.java | 51 +++++++++---------- ...ntCredentialsGrantCredentialsProvider.java | 39 +++++++++----- .../RefreshProtectedCredentialsProvider.java | 12 ++--- .../DefaultCredentialsRefreshServiceTest.java | 14 +---- ...edentialsGrantCredentialsProviderTest.java | 14 ++--- ...freshProtectedCredentialsProviderTest.java | 12 ++--- .../client/test/RefreshCredentialsTest.java | 26 ++++++---- 10 files changed, 95 insertions(+), 96 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java index 67c2c29afe..a08a785cbc 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 @@ -341,8 +341,8 @@ public void start() String username = credentialsProvider.getUsername(); String password = credentialsProvider.getPassword(); - if (credentialsProvider.getExpiration() != null) { - if (this.credentialsRefreshService.needRefresh(credentialsProvider.getExpiration())) { + if (credentialsProvider.getTimeBeforeExpiration() != null) { + if (this.credentialsRefreshService.needRefresh(credentialsProvider.getTimeBeforeExpiration())) { credentialsProvider.refresh(); username = credentialsProvider.getUsername(); password = credentialsProvider.getPassword(); @@ -426,7 +426,7 @@ public void start() throw AMQChannel.wrap(sse); } - if (this.credentialsProvider.getExpiration() != null) { + if (this.credentialsProvider.getTimeBeforeExpiration() != null) { String registrationId = this.credentialsRefreshService.register(credentialsProvider, () -> { // return false if connection is closed, so refresh service can get rid of this registration if (!isOpen()) { diff --git a/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java index a7db53f8c3..e4f6bda06a 100644 --- a/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java +++ b/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java @@ -15,7 +15,7 @@ package com.rabbitmq.client.impl; -import java.util.Date; +import java.time.Duration; /** * Provider interface for establishing credentials for connecting to the broker. Especially useful @@ -42,16 +42,15 @@ public interface CredentialsProvider { String getPassword(); /** - * The expiration date of the credentials, if any. + * The time before the credentials expire, if they do expire. *

* If credentials do not expire, must return null. Default * behavior is to return null, assuming credentials never * expire. * - * @return credentials expiration date + * @return time before expiration */ - default Date getExpiration() { - // no expiration by default + default Duration getTimeBeforeExpiration() { return null; } diff --git a/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java b/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java index 536c0dc0e0..2e6065336e 100644 --- a/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java +++ b/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java @@ -15,7 +15,7 @@ package com.rabbitmq.client.impl; -import java.util.Date; +import java.time.Duration; import java.util.concurrent.Callable; /** @@ -65,9 +65,9 @@ public interface CredentialsRefreshService { /** * Provide a hint about whether credentials should be renewed. * - * @param expiration + * @param timeBeforeExpiration * @return true if credentials should be renewed, false otherwise */ - boolean needRefresh(Date expiration); + boolean needRefresh(Duration timeBeforeExpiration); } diff --git a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java index 091948bb82..ec083b5895 100644 --- a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java +++ b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java @@ -19,7 +19,6 @@ import org.slf4j.LoggerFactory; import java.time.Duration; -import java.util.Date; import java.util.Iterator; import java.util.Map; import java.util.UUID; @@ -35,7 +34,7 @@ *

* This implementation keeps track of entities (typically AMQP connections) that need * to renew credentials. Token renewal is scheduled based on token expiration, using - * a Function refreshDelayStrategy. Once credentials + * a Function refreshDelayStrategy. Once credentials * for a {@link CredentialsProvider} have been renewed, the callback registered * by each entity/connection is performed. This callback typically propagates * the new credentials in the entity state, e.g. sending the new password to the @@ -51,11 +50,11 @@ public class DefaultCredentialsRefreshService implements CredentialsRefreshServi private final boolean privateScheduler; - private final Function refreshDelayStrategy; + private final Function refreshDelayStrategy; - private final Function needRefreshStrategy; + private final Function needRefreshStrategy; - public DefaultCredentialsRefreshService(ScheduledExecutorService scheduler, Function refreshDelayStrategy, Function needRefreshStrategy) { + public DefaultCredentialsRefreshService(ScheduledExecutorService scheduler, Function refreshDelayStrategy, Function needRefreshStrategy) { this.refreshDelayStrategy = refreshDelayStrategy; this.needRefreshStrategy = needRefreshStrategy; if (scheduler == null) { @@ -76,7 +75,7 @@ public DefaultCredentialsRefreshService(ScheduledExecutorService scheduler, Func * @param duration * @return */ - public static Function fixedDelayBeforeExpirationRefreshDelayStrategy(Duration duration) { + public static Function fixedDelayBeforeExpirationRefreshDelayStrategy(Duration duration) { return new FixedDelayBeforeExpirationRefreshDelayStrategy(duration.toMillis()); } @@ -86,20 +85,21 @@ public static Function fixedDelayBeforeExpirationRefreshDelayStrateg * @param limitBeforeExpiration * @return */ - public static Function fixedTimeNeedRefreshStrategy(Duration limitBeforeExpiration) { + public static Function fixedTimeNeedRefreshStrategy(Duration limitBeforeExpiration) { return new FixedTimeNeedRefreshStrategy(limitBeforeExpiration.toMillis()); } // TODO add a delay refresh strategy that bases the time on a percentage of the TTL, use it as default with 80% TTL private static Runnable refresh(ScheduledExecutorService scheduler, CredentialsProviderState credentialsProviderState, - Function refreshDelayStrategy) { + Function refreshDelayStrategy) { return () -> { LOGGER.debug("Refreshing token"); credentialsProviderState.refresh(); - Date expirationAfterRefresh = credentialsProviderState.credentialsProvider.getExpiration(); - long newDelay = refreshDelayStrategy.apply(expirationAfterRefresh); + Duration timeBeforeExpiration = credentialsProviderState.credentialsProvider.getTimeBeforeExpiration(); + + long newDelay = refreshDelayStrategy.apply(timeBeforeExpiration); LOGGER.debug("Scheduling refresh in {} milliseconds", newDelay); @@ -122,8 +122,7 @@ public String register(CredentialsProvider credentialsProvider, Callable { - Date expiration = credentialsProvider.getExpiration(); - long delay = refreshDelayStrategy.apply(expiration); + long delay = refreshDelayStrategy.apply(credentialsProvider.getTimeBeforeExpiration()); LOGGER.debug("Scheduling refresh in {} milliseconds", delay); return scheduler.schedule(refresh(scheduler, credentialsProviderState, refreshDelayStrategy), delay, TimeUnit.MILLISECONDS); }); @@ -140,8 +139,8 @@ public void unregister(CredentialsProvider credentialsProvider, String registrat } @Override - public boolean needRefresh(Date expiration) { - return this.needRefreshStrategy.apply(expiration); + public boolean needRefresh(Duration timeBeforeExpiration) { + return this.needRefreshStrategy.apply(timeBeforeExpiration); } public void close() { @@ -150,7 +149,7 @@ public void close() { } } - private static class FixedTimeNeedRefreshStrategy implements Function { + private static class FixedTimeNeedRefreshStrategy implements Function { private final long limitBeforeExpiration; @@ -159,13 +158,12 @@ private FixedTimeNeedRefreshStrategy(long limitBeforeExpiration) { } @Override - public Boolean apply(Date expiration) { - long ttl = expiration.getTime() - new Date().getTime(); - return ttl <= limitBeforeExpiration; + public Boolean apply(Duration timeBeforeExpiration) { + return timeBeforeExpiration.toMillis() <= limitBeforeExpiration; } } - private static class FixedDelayBeforeExpirationRefreshDelayStrategy implements Function { + private static class FixedDelayBeforeExpirationRefreshDelayStrategy implements Function { private final long delay; @@ -174,11 +172,10 @@ private FixedDelayBeforeExpirationRefreshDelayStrategy(long delay) { } @Override - public Long apply(Date expiration) { - long ttl = expiration.getTime() - new Date().getTime(); - long refreshTimeBeforeExpiration = ttl - delay; + public Long apply(Duration timeBeforeExpiration) { + long refreshTimeBeforeExpiration = timeBeforeExpiration.toMillis() - delay; if (refreshTimeBeforeExpiration < 0) { - return ttl; + return timeBeforeExpiration.toMillis(); } else { return refreshTimeBeforeExpiration; } @@ -279,21 +276,21 @@ public static class DefaultCredentialsRefreshServiceBuilder { private ScheduledExecutorService scheduler; - private Function refreshDelayStrategy = fixedDelayBeforeExpirationRefreshDelayStrategy(Duration.ofSeconds(60)); + private Function refreshDelayStrategy = fixedDelayBeforeExpirationRefreshDelayStrategy(Duration.ofSeconds(60)); - private Function needRefreshStrategy = fixedTimeNeedRefreshStrategy(Duration.ofSeconds(60)); + private Function needRefreshStrategy = fixedTimeNeedRefreshStrategy(Duration.ofSeconds(60)); public DefaultCredentialsRefreshServiceBuilder scheduler(ScheduledThreadPoolExecutor scheduler) { this.scheduler = scheduler; return this; } - public DefaultCredentialsRefreshServiceBuilder refreshDelayStrategy(Function refreshDelayStrategy) { + public DefaultCredentialsRefreshServiceBuilder refreshDelayStrategy(Function refreshDelayStrategy) { this.refreshDelayStrategy = refreshDelayStrategy; return this; } - public DefaultCredentialsRefreshServiceBuilder needRefreshStrategy(Function needRefreshStrategy) { + public DefaultCredentialsRefreshServiceBuilder needRefreshStrategy(Function needRefreshStrategy) { this.needRefreshStrategy = needRefreshStrategy; return this; } diff --git a/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java index 0338fcedd6..48f347555a 100644 --- a/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java +++ b/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java @@ -25,6 +25,9 @@ import java.net.URL; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.time.Instant; +import java.time.temporal.ChronoUnit; import java.util.*; /** @@ -107,9 +110,8 @@ protected Token parseToken(String response) { try { Map map = objectMapper.readValue(response, Map.class); int expiresIn = ((Number) map.get("expires_in")).intValue(); - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.SECOND, expiresIn); - return new Token(map.get("access_token").toString(), calendar.getTime()); + Instant receivedAt = Instant.now(); + return new Token(map.get("access_token").toString(), expiresIn, receivedAt); } catch (IOException e) { throw new OAuthTokenManagementException("Error while parsing OAuth 2 token", e); } @@ -177,8 +179,8 @@ protected String passwordFromToken(Token token) { } @Override - protected Date expirationFromToken(Token token) { - return token.getExpiration(); + protected Duration timeBeforeExpiration(Token token) { + return token.getTimeBeforeExpiration(); } protected void configureHttpConnection(HttpURLConnection connection) { @@ -212,20 +214,33 @@ public static class Token { private final String access; - private final Date expiration; + private final int expiresIn; - public Token(String access, Date expiration) { - this.access = access; - this.expiration = expiration; - } + private final Instant receivedAt; - public Date getExpiration() { - return expiration; + public Token(String access, int expiresIn, Instant receivedAt) { + this.access = access; + this.expiresIn = expiresIn; + this.receivedAt = receivedAt; } public String getAccess() { return access; } + + public int getExpiresIn() { + return expiresIn; + } + + public Instant getReceivedAt() { + return receivedAt; + } + + public Duration getTimeBeforeExpiration() { + Instant now = Instant.now(); + long age = receivedAt.until(now, ChronoUnit.SECONDS); + return Duration.ofSeconds(expiresIn - age); + } } public static class OAuth2ClientCredentialsGrantCredentialsProviderBuilder { diff --git a/src/main/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProvider.java index 7bca427205..21f6bc9780 100644 --- a/src/main/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProvider.java +++ b/src/main/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProvider.java @@ -18,7 +18,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Date; +import java.time.Duration; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; @@ -35,8 +35,8 @@ * is already being renewed. *

* Subclasses need to provide the actual token retrieval (whether is a first retrieval or a renewal is - * a implementation detail) and how to extract information (username, password, expiration date) from the retrieved - * token. + * a implementation detail) and how to extract information (username, password, time before expiration) + * from the retrieved token. * * @param the type of token (usually specified by the subclass) */ @@ -67,11 +67,11 @@ public String getPassword() { } @Override - public Date getExpiration() { + public Duration getTimeBeforeExpiration() { if (token.get() == null) { refresh(); } - return expirationFromToken(token.get()); + return timeBeforeExpiration(token.get()); } @Override @@ -109,5 +109,5 @@ public void refresh() { protected abstract String passwordFromToken(T token); - protected abstract Date expirationFromToken(T token); + protected abstract Duration timeBeforeExpiration(T token); } diff --git a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java index 56e5bd9a89..576612db54 100644 --- a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java +++ b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java @@ -23,8 +23,6 @@ import org.mockito.stubbing.Answer; import java.time.Duration; -import java.util.Calendar; -import java.util.Date; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.CopyOnWriteArrayList; @@ -63,11 +61,7 @@ public void scheduling() throws Exception { AtomicInteger passwordSequence = new AtomicInteger(0); when(credentialsProvider.getPassword()).thenAnswer( (Answer) invocation -> "password-" + passwordSequence.get()); - when(credentialsProvider.getExpiration()).thenAnswer((Answer) invocation -> { - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.SECOND, 5); - return calendar.getTime(); - }); + when(credentialsProvider.getTimeBeforeExpiration()).thenAnswer((Answer) invocation -> Duration.ofSeconds(5)); doAnswer(invocation -> { passwordSequence.incrementAndGet(); return null; @@ -88,11 +82,7 @@ public void scheduling() throws Exception { AtomicInteger passwordSequence2 = new AtomicInteger(0); CredentialsProvider credentialsProvider2 = mock(CredentialsProvider.class); when(credentialsProvider2.getPassword()).thenAnswer((Answer) invocation -> "password2-" + passwordSequence2.get()); - when(credentialsProvider2.getExpiration()).thenAnswer((Answer) invocation -> { - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.SECOND, 4); - return calendar.getTime(); - }); + when(credentialsProvider2.getTimeBeforeExpiration()).thenAnswer((Answer) invocation -> Duration.ofSeconds(4)); doAnswer(invocation -> { passwordSequence2.incrementAndGet(); return null; diff --git a/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java b/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java index 662b24235c..2cd19ee828 100644 --- a/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java +++ b/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java @@ -42,9 +42,9 @@ import java.security.SecureRandom; import java.security.cert.Certificate; import java.security.cert.X509Certificate; +import java.time.Duration; import java.time.Instant; import java.time.temporal.ChronoUnit; -import java.util.Calendar; import java.util.Date; import java.util.Map; import java.util.UUID; @@ -124,7 +124,7 @@ public void handle(String s, Request request, HttpServletRequest httpServletRequ String password = provider.getPassword(); assertThat(password).isEqualTo(accessToken.get()); - assertThat(provider.getExpiration()).isBetween(offsetNow(expiresIn - 10), offsetNow(expiresIn + 10)); + assertThat(provider.getTimeBeforeExpiration()).isBetween(Duration.ofSeconds(expiresIn - 10), Duration.ofSeconds(expiresIn + 10)); assertThat(httpMethod).hasValue("POST"); assertThat(contentType).hasValue("application/x-www-form-urlencoded"); @@ -174,7 +174,7 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques String password = provider.getPassword(); assertThat(password).isEqualTo(accessToken); - assertThat(provider.getExpiration()).isBetween(offsetNow(expiresIn - 10), offsetNow(expiresIn + 10)); + assertThat(provider.getTimeBeforeExpiration()).isBetween(Duration.ofSeconds(expiresIn - 10), Duration.ofSeconds(expiresIn + 10)); } @Test @@ -191,13 +191,7 @@ public void parseToken() { OAuth2ClientCredentialsGrantCredentialsProvider.Token token = provider.parseToken(response); assertThat(token.getAccess()).isEqualTo("18c1b1dfdda04382a8bcc14d077b71dd"); - assertThat(token.getExpiration()).isBetween(offsetNow(expiresIn - 10), offsetNow(expiresIn + 1)); - } - - Date offsetNow(int seconds) { - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.SECOND, seconds); - return calendar.getTime(); + assertThat(token.getTimeBeforeExpiration()).isBetween(Duration.ofSeconds(expiresIn - 10), Duration.ofSeconds(expiresIn + 1)); } String sampleJsonToken(String accessToken, int expiresIn) { diff --git a/src/test/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProviderTest.java b/src/test/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProviderTest.java index 5c15cd7400..a96c757e59 100644 --- a/src/test/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProviderTest.java +++ b/src/test/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProviderTest.java @@ -17,7 +17,7 @@ import org.junit.Test; -import java.util.Date; +import java.time.Duration; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; @@ -44,7 +44,7 @@ protected TestToken retrieveToken() { } catch (InterruptedException e) { throw new RuntimeException(e); } - return new TestToken(UUID.randomUUID().toString(), new Date()); + return new TestToken(UUID.randomUUID().toString()); } @Override @@ -58,8 +58,8 @@ protected String passwordFromToken(TestToken token) { } @Override - protected Date expirationFromToken(TestToken token) { - return token.expiration; + protected Duration timeBeforeExpiration(TestToken token) { + return Duration.ofSeconds(1); } }; @@ -79,11 +79,9 @@ protected Date expirationFromToken(TestToken token) { private static class TestToken { final String secret; - final Date expiration; - TestToken(String secret, Date expiration) { + TestToken(String secret) { this.secret = secret; - this.expiration = expiration; } } diff --git a/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java b/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java index fa455b7744..0870d4d92b 100644 --- a/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java +++ b/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java @@ -24,8 +24,8 @@ import org.junit.Test; import java.time.Duration; -import java.util.Calendar; -import java.util.Date; +import java.time.Instant; +import java.time.temporal.ChronoUnit; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -50,9 +50,7 @@ public void connectionAndRefreshCredentials() throws Exception { @Override protected TestToken retrieveToken() { latch.countDown(); - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.SECOND, 2); - return new TestToken("guest", calendar.getTime()); + return new TestToken("guest", 2, Instant.now()); } @Override @@ -66,8 +64,8 @@ protected String passwordFromToken(TestToken token) { } @Override - protected Date expirationFromToken(TestToken token) { - return token.expiration; + protected Duration timeBeforeExpiration(TestToken token) { + return token.getTimeBeforeExpiration(); } }; @@ -89,11 +87,19 @@ protected Date expirationFromToken(TestToken token) { private static class TestToken { final String secret; - final Date expiration; + final int expiresIn; + final Instant receivedAt; - TestToken(String secret, Date expiration) { + TestToken(String secret, int expiresIn, Instant receivedAt) { this.secret = secret; - this.expiration = expiration; + this.expiresIn = expiresIn; + this.receivedAt = receivedAt; + } + + public Duration getTimeBeforeExpiration() { + Instant now = Instant.now(); + long age = receivedAt.until(now, ChronoUnit.SECONDS); + return Duration.ofSeconds(expiresIn - age); } } From 5471dad4860c2da155b276235f80575e40aa3aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 25 Jun 2019 10:53:22 +0200 Subject: [PATCH 163/328] Add ratio-based token refresh delay strategy (cherry picked from commit 97c8700390eb199ca895b729c98a515c1474f673) --- .../DefaultCredentialsRefreshService.java | 93 +++++++++++++------ .../DefaultCredentialsRefreshServiceTest.java | 40 ++++++-- 2 files changed, 98 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java index ec083b5895..ed081017ae 100644 --- a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java +++ b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java @@ -50,11 +50,11 @@ public class DefaultCredentialsRefreshService implements CredentialsRefreshServi private final boolean privateScheduler; - private final Function refreshDelayStrategy; + private final Function refreshDelayStrategy; private final Function needRefreshStrategy; - public DefaultCredentialsRefreshService(ScheduledExecutorService scheduler, Function refreshDelayStrategy, Function needRefreshStrategy) { + public DefaultCredentialsRefreshService(ScheduledExecutorService scheduler, Function refreshDelayStrategy, Function needRefreshStrategy) { this.refreshDelayStrategy = refreshDelayStrategy; this.needRefreshStrategy = needRefreshStrategy; if (scheduler == null) { @@ -67,43 +67,57 @@ public DefaultCredentialsRefreshService(ScheduledExecutorService scheduler, Func } /** - * Delay before refresh is TTL - specified duration. + * Delay before refresh is a ratio of the time before expiration. *

- * E.g. if TTL is 60 seconds and specified duration is 20 seconds, refresh will + * E.g. if time before expiration is 60 seconds and specified ratio is 0.8, refresh will + * be scheduled in 60 x 0.8 = 48 seconds. + * + * @param ratio + * @return the delay before refreshing + */ + public static Function ratioRefreshDelayStrategy(double ratio) { + return new RatioRefreshDelayStrategy(ratio); + } + + /** + * Delay before refresh is time before expiration - specified duration. + *

+ * E.g. if time before expiration is 60 seconds and specified duration is 20 seconds, refresh will * be scheduled in 60 - 20 = 40 seconds. * * @param duration - * @return + * @return the delay before refreshing */ - public static Function fixedDelayBeforeExpirationRefreshDelayStrategy(Duration duration) { - return new FixedDelayBeforeExpirationRefreshDelayStrategy(duration.toMillis()); + public static Function fixedDelayBeforeExpirationRefreshDelayStrategy(Duration duration) { + return new FixedDelayBeforeExpirationRefreshDelayStrategy(duration); } /** * Advise to refresh credentials if TTL <= limit. * * @param limitBeforeExpiration - * @return + * @return true if credentials should be refreshed, false otherwise */ public static Function fixedTimeNeedRefreshStrategy(Duration limitBeforeExpiration) { return new FixedTimeNeedRefreshStrategy(limitBeforeExpiration.toMillis()); } - // TODO add a delay refresh strategy that bases the time on a percentage of the TTL, use it as default with 80% TTL - private static Runnable refresh(ScheduledExecutorService scheduler, CredentialsProviderState credentialsProviderState, - Function refreshDelayStrategy) { + Function refreshDelayStrategy) { return () -> { LOGGER.debug("Refreshing token"); credentialsProviderState.refresh(); Duration timeBeforeExpiration = credentialsProviderState.credentialsProvider.getTimeBeforeExpiration(); + Duration newDelay = refreshDelayStrategy.apply(timeBeforeExpiration); - long newDelay = refreshDelayStrategy.apply(timeBeforeExpiration); + LOGGER.debug("Scheduling refresh in {} seconds", newDelay.getSeconds()); - LOGGER.debug("Scheduling refresh in {} milliseconds", newDelay); - - ScheduledFuture scheduledFuture = scheduler.schedule(refresh(scheduler, credentialsProviderState, refreshDelayStrategy), newDelay, TimeUnit.MILLISECONDS); + ScheduledFuture scheduledFuture = scheduler.schedule( + refresh(scheduler, credentialsProviderState, refreshDelayStrategy), + newDelay.getSeconds(), + TimeUnit.SECONDS + ); credentialsProviderState.refreshTask.set(scheduledFuture); }; } @@ -122,9 +136,13 @@ public String register(CredentialsProvider credentialsProvider, Callable { - long delay = refreshDelayStrategy.apply(credentialsProvider.getTimeBeforeExpiration()); - LOGGER.debug("Scheduling refresh in {} milliseconds", delay); - return scheduler.schedule(refresh(scheduler, credentialsProviderState, refreshDelayStrategy), delay, TimeUnit.MILLISECONDS); + Duration delay = refreshDelayStrategy.apply(credentialsProvider.getTimeBeforeExpiration()); + LOGGER.debug("Scheduling refresh in {} seconds", delay.getSeconds()); + return scheduler.schedule( + refresh(scheduler, credentialsProviderState, refreshDelayStrategy), + delay.getSeconds(), + TimeUnit.SECONDS + ); }); return registrationId; @@ -163,25 +181,42 @@ public Boolean apply(Duration timeBeforeExpiration) { } } - private static class FixedDelayBeforeExpirationRefreshDelayStrategy implements Function { + private static class FixedDelayBeforeExpirationRefreshDelayStrategy implements Function { - private final long delay; + private final Duration delay; - private FixedDelayBeforeExpirationRefreshDelayStrategy(long delay) { + private FixedDelayBeforeExpirationRefreshDelayStrategy(Duration delay) { this.delay = delay; } @Override - public Long apply(Duration timeBeforeExpiration) { - long refreshTimeBeforeExpiration = timeBeforeExpiration.toMillis() - delay; - if (refreshTimeBeforeExpiration < 0) { - return timeBeforeExpiration.toMillis(); + public Duration apply(Duration timeBeforeExpiration) { + Duration refreshTimeBeforeExpiration = timeBeforeExpiration.minus(delay); + if (refreshTimeBeforeExpiration.isNegative()) { + return timeBeforeExpiration; } else { return refreshTimeBeforeExpiration; } } } + private static class RatioRefreshDelayStrategy implements Function { + + private final double ratio; + + private RatioRefreshDelayStrategy(double ratio) { + if (ratio < 0 || ratio > 1) { + throw new IllegalArgumentException("Ratio should be > 0 and <= 1: " + ratio); + } + this.ratio = ratio; + } + + @Override + public Duration apply(Duration duration) { + return Duration.ofSeconds((long) ((double) duration.getSeconds() * ratio)); + } + } + static class Registration { private final Callable refreshAction; @@ -240,7 +275,7 @@ void maybeSetRefreshTask(Supplier> scheduledFutureSupplier) { } void refresh() { - // FIXME check whether thread has been cancelled or not before refresh() and registratAction.call() + // FIXME check whether thread has been cancelled or not before refresh() and refreshAction.call() // FIXME protect this call, or at least log some error this.credentialsProvider.refresh(); @@ -276,16 +311,16 @@ public static class DefaultCredentialsRefreshServiceBuilder { private ScheduledExecutorService scheduler; - private Function refreshDelayStrategy = fixedDelayBeforeExpirationRefreshDelayStrategy(Duration.ofSeconds(60)); + private Function refreshDelayStrategy = ratioRefreshDelayStrategy(0.8); - private Function needRefreshStrategy = fixedTimeNeedRefreshStrategy(Duration.ofSeconds(60)); + private Function needRefreshStrategy = ttl -> false; public DefaultCredentialsRefreshServiceBuilder scheduler(ScheduledThreadPoolExecutor scheduler) { this.scheduler = scheduler; return this; } - public DefaultCredentialsRefreshServiceBuilder refreshDelayStrategy(Function refreshDelayStrategy) { + public DefaultCredentialsRefreshServiceBuilder refreshDelayStrategy(Function refreshDelayStrategy) { this.refreshDelayStrategy = refreshDelayStrategy; return this; } diff --git a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java index 576612db54..2229c34d52 100644 --- a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java +++ b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java @@ -29,8 +29,12 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Function; import java.util.stream.IntStream; +import static com.rabbitmq.client.impl.DefaultCredentialsRefreshService.fixedDelayBeforeExpirationRefreshDelayStrategy; +import static com.rabbitmq.client.impl.DefaultCredentialsRefreshService.fixedTimeNeedRefreshStrategy; +import static java.time.Duration.ofSeconds; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.*; @@ -55,13 +59,13 @@ public void tearDown() { @Test public void scheduling() throws Exception { refreshService = new DefaultCredentialsRefreshService.DefaultCredentialsRefreshServiceBuilder() - .refreshDelayStrategy(DefaultCredentialsRefreshService.fixedDelayBeforeExpirationRefreshDelayStrategy(Duration.ofSeconds(2))) + .refreshDelayStrategy(fixedDelayBeforeExpirationRefreshDelayStrategy(ofSeconds(2))) .build(); AtomicInteger passwordSequence = new AtomicInteger(0); when(credentialsProvider.getPassword()).thenAnswer( (Answer) invocation -> "password-" + passwordSequence.get()); - when(credentialsProvider.getTimeBeforeExpiration()).thenAnswer((Answer) invocation -> Duration.ofSeconds(5)); + when(credentialsProvider.getTimeBeforeExpiration()).thenAnswer((Answer) invocation -> ofSeconds(5)); doAnswer(invocation -> { passwordSequence.incrementAndGet(); return null; @@ -82,13 +86,12 @@ public void scheduling() throws Exception { AtomicInteger passwordSequence2 = new AtomicInteger(0); CredentialsProvider credentialsProvider2 = mock(CredentialsProvider.class); when(credentialsProvider2.getPassword()).thenAnswer((Answer) invocation -> "password2-" + passwordSequence2.get()); - when(credentialsProvider2.getTimeBeforeExpiration()).thenAnswer((Answer) invocation -> Duration.ofSeconds(4)); + when(credentialsProvider2.getTimeBeforeExpiration()).thenAnswer((Answer) invocation -> ofSeconds(4)); doAnswer(invocation -> { passwordSequence2.incrementAndGet(); return null; }).when(credentialsProvider2).refresh(); - List passwords2 = new CopyOnWriteArrayList<>(); CountDownLatch latch2 = new CountDownLatch(2 * 1); refreshAction = () -> { @@ -104,8 +107,6 @@ public void scheduling() throws Exception { "password2-1", "password2-2" ); assertThat(passwords).hasSizeGreaterThan(4); - - } @Test @@ -166,4 +167,31 @@ public void refreshActionIsRemovedIfItErrorsTooMuch() throws Exception { verify(refreshAction, times(callsCountBeforeCancellation)).call(); } + @Test + public void fixedDelayBeforeExpirationRefreshDelayStrategyTest() { + Function delayStrategy = fixedDelayBeforeExpirationRefreshDelayStrategy(ofSeconds(20)); + assertThat(delayStrategy.apply(ofSeconds(60))).as("refresh delay is TTL - fixed delay").isEqualTo(ofSeconds(40)); + assertThat(delayStrategy.apply(ofSeconds(10))).as("refresh delay is TTL if TTL < fixed delay").isEqualTo(ofSeconds(10)); + } + + @Test + public void fixedTimeNeedRefreshStrategyTest() { + Function refreshStrategy = fixedTimeNeedRefreshStrategy(ofSeconds(20)); + assertThat(refreshStrategy.apply(ofSeconds(60))).isFalse(); + assertThat(refreshStrategy.apply(ofSeconds(20))).isTrue(); + assertThat(refreshStrategy.apply(ofSeconds(19))).isTrue(); + assertThat(refreshStrategy.apply(ofSeconds(10))).isTrue(); + } + + @Test + public void ratioRefreshDelayStrategyTest() { + Function delayStrategy = DefaultCredentialsRefreshService.ratioRefreshDelayStrategy(0.8); + assertThat(delayStrategy.apply(ofSeconds(60))).isEqualTo(ofSeconds(48)); + assertThat(delayStrategy.apply(ofSeconds(30))).isEqualTo(ofSeconds(24)); + assertThat(delayStrategy.apply(ofSeconds(10))).isEqualTo(ofSeconds(8)); + assertThat(delayStrategy.apply(ofSeconds(5))).isEqualTo(ofSeconds(4)); + assertThat(delayStrategy.apply(ofSeconds(2))).isEqualTo(ofSeconds(1)); + assertThat(delayStrategy.apply(ofSeconds(1))).isEqualTo(ofSeconds(0)); + } + } From c5eafdc39ca0f72898004b152b9bdc4c4c50213f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 25 Jun 2019 11:52:23 +0200 Subject: [PATCH 164/328] Handle thread interruption in credentials refresh service (cherry picked from commit 443a5896191edbf5652841856f9f534d38665496) --- .../DefaultCredentialsRefreshService.java | 35 ++++++++++-- .../DefaultCredentialsRefreshServiceTest.java | 57 +++++++++++++++++++ 2 files changed, 88 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java index ed081017ae..032a94c779 100644 --- a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java +++ b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java @@ -275,13 +275,38 @@ void maybeSetRefreshTask(Supplier> scheduledFutureSupplier) { } void refresh() { - // FIXME check whether thread has been cancelled or not before refresh() and refreshAction.call() + if (Thread.currentThread().isInterrupted()) { + return; + } - // FIXME protect this call, or at least log some error - this.credentialsProvider.refresh(); + int attemptCount = 0; + boolean refreshSucceeded = false; + while (attemptCount < 3) { + LOGGER.debug("Refreshing token for credentials provider {}", credentialsProvider); + try { + this.credentialsProvider.refresh(); + LOGGER.debug("Token refreshed for credentials provider {}", credentialsProvider); + refreshSucceeded = true; + break; + } catch (Exception e) { + LOGGER.warn("Error while trying to refresh token: {}", e.getMessage()); + } + attemptCount++; + try { + Thread.sleep(1000L); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + return; + } + } + + if (!refreshSucceeded) { + LOGGER.warn("Token refresh failed after retry, aborting callbacks"); + return; + } Iterator iterator = registrations.values().iterator(); - while (iterator.hasNext()) { + while (iterator.hasNext() && !Thread.currentThread().isInterrupted()) { Registration registration = iterator.next(); // FIXME set a timeout on the call? (needs a separate thread) try { @@ -291,6 +316,8 @@ void refresh() { iterator.remove(); } registration.errorHistory.set(0); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); } catch (Exception e) { LOGGER.warn("Error while trying to refresh a connection token", e); registration.errorHistory.incrementAndGet(); diff --git a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java index 2229c34d52..5a1518610d 100644 --- a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java +++ b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java @@ -167,6 +167,63 @@ public void refreshActionIsRemovedIfItErrorsTooMuch() throws Exception { verify(refreshAction, times(callsCountBeforeCancellation)).call(); } + @Test + public void errorInRefreshShouldBeRetried() throws Exception { + DefaultCredentialsRefreshService.CredentialsProviderState state = new DefaultCredentialsRefreshService.CredentialsProviderState( + credentialsProvider + ); + doThrow(RuntimeException.class).doThrow(RuntimeException.class) + .doNothing().when(credentialsProvider).refresh(); + + when(refreshAction.call()).thenReturn(true); + + state.add(new DefaultCredentialsRefreshService.Registration("1", refreshAction)); + + state.refresh(); + + verify(credentialsProvider, times(3)).refresh(); + verify(refreshAction, times(1)).call(); + } + + @Test + public void callbacksAreNotCalledWhenRetryOnRefreshIsExhausted() throws Exception { + DefaultCredentialsRefreshService.CredentialsProviderState state = new DefaultCredentialsRefreshService.CredentialsProviderState( + credentialsProvider + ); + doThrow(RuntimeException.class).when(credentialsProvider).refresh(); + + state.add(new DefaultCredentialsRefreshService.Registration("1", refreshAction)); + + state.refresh(); + + verify(credentialsProvider, times(3)).refresh(); + verify(refreshAction, times(0)).call(); + } + + @Test + public void refreshCanBeInterrupted() throws Exception { + DefaultCredentialsRefreshService.CredentialsProviderState state = new DefaultCredentialsRefreshService.CredentialsProviderState( + credentialsProvider + ); + + AtomicInteger callbackCount = new AtomicInteger(10); + when(refreshAction.call()).thenAnswer(invocation -> { + callbackCount.decrementAndGet(); + Thread.sleep(1000L); + return true; + }); + + IntStream.range(0, callbackCount.get()).forEach(i -> state.add(new DefaultCredentialsRefreshService.Registration(i + "", refreshAction))); + + Thread refreshThread = new Thread(() -> state.refresh()); + refreshThread.start(); + Thread.sleep(1000L); + refreshThread.interrupt(); + refreshThread.join(5000); + assertThat(refreshThread.isAlive()).isFalse(); + assertThat(callbackCount).hasValueGreaterThan(1); // not all the callbacks were called, because thread has been cancelled + } + @Test public void fixedDelayBeforeExpirationRefreshDelayStrategyTest() { Function delayStrategy = fixedDelayBeforeExpirationRefreshDelayStrategy(ofSeconds(20)); From e58fca1b05597eacb75865afc63151e153ca93eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 4 Jul 2019 12:01:17 +0200 Subject: [PATCH 165/328] Send update.secret extension when scheduled [#167029587] (cherry picked from commit 136b3ea7232356ad98e94b3f57d34e267c2cebeb) --- .../rabbitmq/client/impl/AMQConnection.java | 6 +- .../DefaultCredentialsRefreshServiceTest.java | 57 +++++++++++- .../client/test/RefreshCredentialsTest.java | 4 + .../com/rabbitmq/client/test/TestUtils.java | 93 +++++++++++++------ .../rabbitmq/client/test/TestUtilsTest.java | 19 ++++ 5 files changed, 147 insertions(+), 32 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java index a08a785cbc..4b98db5af1 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java @@ -438,8 +438,10 @@ public void start() } String refreshedPassword = credentialsProvider.getPassword(); - // TODO send password to server with update-secret extension, using channel 0 - + AMQImpl.Connection.UpdateSecret updateSecret = new AMQImpl.Connection.UpdateSecret( + LongStringHelper.asLongString(refreshedPassword), "Refresh scheduled by client" + ); + _channel0.rpc(updateSecret); return true; }); diff --git a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java index 5a1518610d..0fa8e7ca72 100644 --- a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java +++ b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java @@ -15,6 +15,10 @@ package com.rabbitmq.client.impl; +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.Connection; +import com.rabbitmq.client.ConnectionFactory; +import com.rabbitmq.client.test.TestUtils; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; @@ -22,6 +26,7 @@ import org.mockito.junit.MockitoJUnitRunner; import org.mockito.stubbing.Answer; +import java.io.IOException; import java.time.Duration; import java.util.List; import java.util.concurrent.Callable; @@ -32,8 +37,7 @@ import java.util.function.Function; import java.util.stream.IntStream; -import static com.rabbitmq.client.impl.DefaultCredentialsRefreshService.fixedDelayBeforeExpirationRefreshDelayStrategy; -import static com.rabbitmq.client.impl.DefaultCredentialsRefreshService.fixedTimeNeedRefreshStrategy; +import static com.rabbitmq.client.impl.DefaultCredentialsRefreshService.*; import static java.time.Duration.ofSeconds; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.*; @@ -56,6 +60,55 @@ public void tearDown() { } } + @Test public void renew() { + ConnectionFactory cf = new ConnectionFactory(); + OAuth2ClientCredentialsGrantCredentialsProvider provider = new OAuth2ClientCredentialsGrantCredentialsProvider.OAuth2ClientCredentialsGrantCredentialsProviderBuilder() + .tokenEndpointUri("http://localhost:" + 8080 + "/uaa/oauth/token") + .clientId("rabbit_client").clientSecret("rabbit_secret") + .grantType("password") + .parameter("username", "rabbit_super") + .parameter("password", "rabbit_super") + .build(); + cf.setCredentialsProvider(provider); + + + } + + @Test public void connect() throws Exception { + ConnectionFactory cf = new ConnectionFactory(); + OAuth2ClientCredentialsGrantCredentialsProvider provider = new OAuth2ClientCredentialsGrantCredentialsProvider.OAuth2ClientCredentialsGrantCredentialsProviderBuilder() + .tokenEndpointUri("http://localhost:" + 8080 + "/uaa/oauth/token") + .clientId("rabbit_client").clientSecret("rabbit_secret") + .grantType("password") + .parameter("username", "rabbit_super") + .parameter("password", "rabbit_super") + .build(); + cf.setCredentialsProvider(provider); + refreshService = new DefaultCredentialsRefreshService.DefaultCredentialsRefreshServiceBuilder() +// .refreshDelayStrategy(ttl -> Duration.ofSeconds(60)) + .refreshDelayStrategy(ratioRefreshDelayStrategy(0.8)) + .needRefreshStrategy(expiration -> false) + .build(); + cf.setCredentialsRefreshService(refreshService); + try (Connection c = cf.newConnection()) { + + while (true) { + try { + Channel ch = c.createChannel(); + String queue = ch.queueDeclare().getQueue(); + TestUtils.sendAndConsumeMessage("", queue, queue, c); + System.out.println("Message sent and consumed"); + ch.close(); + } catch (IOException e) { + System.out.println(e.getCause().getMessage()); + } + Thread.sleep(10_000L); + } + } + + + } + @Test public void scheduling() throws Exception { refreshService = new DefaultCredentialsRefreshService.DefaultCredentialsRefreshServiceBuilder() diff --git a/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java b/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java index 0870d4d92b..963adc7964 100644 --- a/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java +++ b/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java @@ -21,7 +21,9 @@ import com.rabbitmq.client.impl.DefaultCredentialsRefreshService; import com.rabbitmq.client.impl.RefreshProtectedCredentialsProvider; import org.junit.Before; +import org.junit.ClassRule; import org.junit.Test; +import org.junit.rules.TestRule; import java.time.Duration; import java.time.Instant; @@ -33,6 +35,8 @@ public class RefreshCredentialsTest { + @ClassRule + public static TestRule brokerVersionTestRule = TestUtils.atLeast38(); DefaultCredentialsRefreshService refreshService; @Before diff --git a/src/test/java/com/rabbitmq/client/test/TestUtils.java b/src/test/java/com/rabbitmq/client/test/TestUtils.java index 21b1f542ad..e2890ab4bc 100644 --- a/src/test/java/com/rabbitmq/client/test/TestUtils.java +++ b/src/test/java/com/rabbitmq/client/test/TestUtils.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 @@ -15,19 +15,14 @@ package com.rabbitmq.client.test; -import com.rabbitmq.client.AMQP; -import com.rabbitmq.client.Channel; -import com.rabbitmq.client.Connection; -import com.rabbitmq.client.ConnectionFactory; -import com.rabbitmq.client.DefaultConsumer; -import com.rabbitmq.client.Envelope; -import com.rabbitmq.client.Recoverable; -import com.rabbitmq.client.RecoverableConnection; -import com.rabbitmq.client.RecoveryListener; -import com.rabbitmq.client.ShutdownSignalException; +import com.rabbitmq.client.*; import com.rabbitmq.client.impl.NetworkConnection; import com.rabbitmq.client.impl.recovery.AutorecoveringConnection; import com.rabbitmq.tools.Host; +import org.junit.AssumptionViolatedException; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; import org.slf4j.LoggerFactory; import javax.net.ssl.SSLContext; @@ -46,7 +41,7 @@ public class TestUtils { - public static final boolean USE_NIO = System.getProperty("use.nio") == null ? false : true; + public static final boolean USE_NIO = System.getProperty("use.nio") != null; public static ConnectionFactory connectionFactory() { ConnectionFactory connectionFactory = new ConnectionFactory(); @@ -79,7 +74,7 @@ public static SSLContext getSSLContext() throws NoSuchAlgorithmException { // pick the first protocol available, preferring TLSv1.2, then TLSv1, // falling back to SSLv3 if running on an ancient/crippled JDK - for(String proto : Arrays.asList("TLSv1.2", "TLSv1", "SSLv3")) { + for (String proto : Arrays.asList("TLSv1.2", "TLSv1", "SSLv3")) { try { c = SSLContext.getInstance(proto); return c; @@ -90,31 +85,49 @@ public static SSLContext getSSLContext() throws NoSuchAlgorithmException { throw new NoSuchAlgorithmException(); } + public static TestRule atLeast38() { + return new BrokerVersionTestRule("3.8.0"); + } + public static boolean isVersion37orLater(Connection connection) { + return atLeastVersion("3.7.0", connection); + } + + public static boolean isVersion38orLater(Connection connection) { + return atLeastVersion("3.8.0", connection); + } + + private static boolean atLeastVersion(String expectedVersion, Connection connection) { String currentVersion = null; try { - currentVersion = connection.getServerProperties().get("version").toString(); - // versions built from source: 3.7.0+rc.1.4.gedc5d96 - if (currentVersion.contains("+")) { - currentVersion = currentVersion.substring(0, currentVersion.indexOf("+")); - } - // alpha (snapshot) versions: 3.7.0~alpha.449-1 - if (currentVersion.contains("~")) { - currentVersion = currentVersion.substring(0, currentVersion.indexOf("~")); - } - // alpha (snapshot) versions: 3.7.1-alpha.40 - if (currentVersion.contains("-")) { - currentVersion = currentVersion.substring(0, currentVersion.indexOf("-")); - } - return "0.0.0".equals(currentVersion) || versionCompare(currentVersion, "3.7.0") >= 0; + currentVersion = currentVersion( + connection.getServerProperties().get("version").toString() + ); + return "0.0.0".equals(currentVersion) || versionCompare(currentVersion, expectedVersion) >= 0; } catch (RuntimeException e) { LoggerFactory.getLogger(TestUtils.class).warn("Unable to parse broker version {}", currentVersion, e); throw e; } } + private static String currentVersion(String currentVersion) { + // versions built from source: 3.7.0+rc.1.4.gedc5d96 + if (currentVersion.contains("+")) { + currentVersion = currentVersion.substring(0, currentVersion.indexOf("+")); + } + // alpha (snapshot) versions: 3.7.0~alpha.449-1 + if (currentVersion.contains("~")) { + currentVersion = currentVersion.substring(0, currentVersion.indexOf("~")); + } + // alpha (snapshot) versions: 3.7.1-alpha.40 + if (currentVersion.contains("-")) { + currentVersion = currentVersion.substring(0, currentVersion.indexOf("-")); + } + return currentVersion; + } + public static boolean sendAndConsumeMessage(String exchange, String routingKey, String queue, Connection c) - throws IOException, TimeoutException, InterruptedException { + throws IOException, TimeoutException, InterruptedException { Channel ch = c.createChannel(); try { ch.confirmSelect(); @@ -249,4 +262,28 @@ public static int randomNetworkPort() throws IOException { socket.close(); return port; } + + private static class BrokerVersionTestRule implements TestRule { + + private final String version; + + public BrokerVersionTestRule(String version) { + this.version = version; + } + + @Override + public Statement apply(Statement base, Description description) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + try (Connection c = TestUtils.connectionFactory().newConnection()) { + if (!TestUtils.atLeastVersion(version, c)) { + throw new AssumptionViolatedException("Broker version < " + version + ", skipping."); + } + } + base.evaluate(); + } + }; + } + } } diff --git a/src/test/java/com/rabbitmq/client/test/TestUtilsTest.java b/src/test/java/com/rabbitmq/client/test/TestUtilsTest.java index 379196a6d0..00374f3a4e 100644 --- a/src/test/java/com/rabbitmq/client/test/TestUtilsTest.java +++ b/src/test/java/com/rabbitmq/client/test/TestUtilsTest.java @@ -43,4 +43,23 @@ public void isVersion37orLater() { serverProperties.put("version", "3.7.1-alpha.40"); assertThat(TestUtils.isVersion37orLater(connection), is(true)); } + + @Test + public void isVersion38orLater() { + Map serverProperties = new HashMap<>(); + Connection connection = mock(Connection.class); + when(connection.getServerProperties()).thenReturn(serverProperties); + + serverProperties.put("version", "3.7.0+rc.1.4.gedc5d96"); + assertThat(TestUtils.isVersion38orLater(connection), is(false)); + + serverProperties.put("version", "3.7.0~alpha.449-1"); + assertThat(TestUtils.isVersion38orLater(connection), is(false)); + + serverProperties.put("version", "3.7.1-alpha.40"); + assertThat(TestUtils.isVersion38orLater(connection), is(false)); + + serverProperties.put("version", "3.8.0+beta.4.38.g33a7f97"); + assertThat(TestUtils.isVersion38orLater(connection), is(true)); + } } From bee8fb4cc95607907988e2eff10872376c5f06cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 4 Jul 2019 14:32:34 +0200 Subject: [PATCH 166/328] Remove some OAuth 2 integration tests They were supposed to be manual tests. (cherry picked from commit 7b50067c9a23412a7a156acf9d1dfe7fb45db778) --- .../DefaultCredentialsRefreshServiceTest.java | 57 +------------------ 1 file changed, 2 insertions(+), 55 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java index 0fa8e7ca72..5a1518610d 100644 --- a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java +++ b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java @@ -15,10 +15,6 @@ package com.rabbitmq.client.impl; -import com.rabbitmq.client.Channel; -import com.rabbitmq.client.Connection; -import com.rabbitmq.client.ConnectionFactory; -import com.rabbitmq.client.test.TestUtils; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; @@ -26,7 +22,6 @@ import org.mockito.junit.MockitoJUnitRunner; import org.mockito.stubbing.Answer; -import java.io.IOException; import java.time.Duration; import java.util.List; import java.util.concurrent.Callable; @@ -37,7 +32,8 @@ import java.util.function.Function; import java.util.stream.IntStream; -import static com.rabbitmq.client.impl.DefaultCredentialsRefreshService.*; +import static com.rabbitmq.client.impl.DefaultCredentialsRefreshService.fixedDelayBeforeExpirationRefreshDelayStrategy; +import static com.rabbitmq.client.impl.DefaultCredentialsRefreshService.fixedTimeNeedRefreshStrategy; import static java.time.Duration.ofSeconds; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.*; @@ -60,55 +56,6 @@ public void tearDown() { } } - @Test public void renew() { - ConnectionFactory cf = new ConnectionFactory(); - OAuth2ClientCredentialsGrantCredentialsProvider provider = new OAuth2ClientCredentialsGrantCredentialsProvider.OAuth2ClientCredentialsGrantCredentialsProviderBuilder() - .tokenEndpointUri("http://localhost:" + 8080 + "/uaa/oauth/token") - .clientId("rabbit_client").clientSecret("rabbit_secret") - .grantType("password") - .parameter("username", "rabbit_super") - .parameter("password", "rabbit_super") - .build(); - cf.setCredentialsProvider(provider); - - - } - - @Test public void connect() throws Exception { - ConnectionFactory cf = new ConnectionFactory(); - OAuth2ClientCredentialsGrantCredentialsProvider provider = new OAuth2ClientCredentialsGrantCredentialsProvider.OAuth2ClientCredentialsGrantCredentialsProviderBuilder() - .tokenEndpointUri("http://localhost:" + 8080 + "/uaa/oauth/token") - .clientId("rabbit_client").clientSecret("rabbit_secret") - .grantType("password") - .parameter("username", "rabbit_super") - .parameter("password", "rabbit_super") - .build(); - cf.setCredentialsProvider(provider); - refreshService = new DefaultCredentialsRefreshService.DefaultCredentialsRefreshServiceBuilder() -// .refreshDelayStrategy(ttl -> Duration.ofSeconds(60)) - .refreshDelayStrategy(ratioRefreshDelayStrategy(0.8)) - .needRefreshStrategy(expiration -> false) - .build(); - cf.setCredentialsRefreshService(refreshService); - try (Connection c = cf.newConnection()) { - - while (true) { - try { - Channel ch = c.createChannel(); - String queue = ch.queueDeclare().getQueue(); - TestUtils.sendAndConsumeMessage("", queue, queue, c); - System.out.println("Message sent and consumed"); - ch.close(); - } catch (IOException e) { - System.out.println(e.getCause().getMessage()); - } - Thread.sleep(10_000L); - } - } - - - } - @Test public void scheduling() throws Exception { refreshService = new DefaultCredentialsRefreshService.DefaultCredentialsRefreshServiceBuilder() From 9b3523020d98fdca7e2458a47893f871bc269678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 4 Jul 2019 17:52:26 +0200 Subject: [PATCH 167/328] Handle credentials refresh error [#167029587] (cherry picked from commit 77951bc2a5a8dad2488c5a3ffb41c99b5208f570) Conflicts: src/test/java/com/rabbitmq/client/test/ClientTests.java --- .../rabbitmq/client/impl/AMQConnection.java | 21 ++- .../AMQConnectionRefreshCredentialsTest.java | 173 ++++++++++++++++++ .../com/rabbitmq/client/test/ClientTests.java | 5 +- 3 files changed, 191 insertions(+), 8 deletions(-) create mode 100644 src/test/java/com/rabbitmq/client/impl/AMQConnectionRefreshCredentialsTest.java diff --git a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java index 4b98db5af1..cf41ded34d 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java @@ -243,11 +243,7 @@ public AMQConnection(ConnectionParams params, FrameHandler frameHandler, Metrics this.credentialsRefreshService = params.getCredentialsRefreshService(); - this._channel0 = new AMQChannel(this, 0) { - @Override public boolean processAsync(Command c) throws IOException { - return getConnection().processControlCommand(c); - } - }; + this._channel0 = createChannel0(); this._channelManager = null; @@ -262,6 +258,14 @@ public AMQConnection(ConnectionParams params, FrameHandler frameHandler, Metrics this.workPoolTimeout = params.getWorkPoolTimeout(); } + AMQChannel createChannel0() { + return new AMQChannel(this, 0) { + @Override public boolean processAsync(Command c) throws IOException { + return getConnection().processControlCommand(c); + } + }; + } + private void initializeConsumerWorkService() { this._workService = new ConsumerWorkService(consumerWorkServiceExecutor, threadFactory, workPoolTimeout, shutdownTimeout); } @@ -441,7 +445,12 @@ public void start() AMQImpl.Connection.UpdateSecret updateSecret = new AMQImpl.Connection.UpdateSecret( LongStringHelper.asLongString(refreshedPassword), "Refresh scheduled by client" ); - _channel0.rpc(updateSecret); + try { + _channel0.rpc(updateSecret); + } catch (ShutdownSignalException e) { + LOGGER.warn("Error while trying to update secret: {}. Connection has been closed.", e.getMessage()); + return false; + } return true; }); diff --git a/src/test/java/com/rabbitmq/client/impl/AMQConnectionRefreshCredentialsTest.java b/src/test/java/com/rabbitmq/client/impl/AMQConnectionRefreshCredentialsTest.java new file mode 100644 index 0000000000..d0978e1e61 --- /dev/null +++ b/src/test/java/com/rabbitmq/client/impl/AMQConnectionRefreshCredentialsTest.java @@ -0,0 +1,173 @@ +// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl; + +import com.rabbitmq.client.Method; +import com.rabbitmq.client.*; +import com.rabbitmq.client.test.TestUtils; +import org.junit.ClassRule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; + +import java.io.IOException; +import java.time.Duration; +import java.util.UUID; +import java.util.concurrent.Callable; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.*; + +@RunWith(MockitoJUnitRunner.class) +public class AMQConnectionRefreshCredentialsTest { + + @ClassRule + public static TestRule brokerVersionTestRule = TestUtils.atLeast38(); + + @Mock + CredentialsProvider credentialsProvider; + + @Mock + CredentialsRefreshService refreshService; + + private static ConnectionFactory connectionFactoryThatSendsGarbageAfterUpdateSecret() { + ConnectionFactory cf = new ConnectionFactory() { + @Override + protected AMQConnection createConnection(ConnectionParams params, FrameHandler frameHandler, MetricsCollector metricsCollector) { + return new AMQConnection(params, frameHandler, metricsCollector) { + + @Override + AMQChannel createChannel0() { + return new AMQChannel(this, 0) { + @Override + public boolean processAsync(Command c) throws IOException { + return getConnection().processControlCommand(c); + } + + @Override + public AMQCommand rpc(Method m) throws IOException, ShutdownSignalException { + if (m instanceof AMQImpl.Connection.UpdateSecret) { + super.rpc(m); + return super.rpc(new AMQImpl.Connection.UpdateSecret(LongStringHelper.asLongString(""), "Refresh scheduled by client") { + @Override + public int protocolMethodId() { + return 255; + } + }); + } else { + return super.rpc(m); + } + + } + }; + + } + }; + } + }; + cf.setAutomaticRecoveryEnabled(false); + if (TestUtils.USE_NIO) { + cf.useNio(); + } + return cf; + } + + @Test + @SuppressWarnings("unchecked") + public void connectionIsUnregisteredFromRefreshServiceWhenClosed() throws Exception { + when(credentialsProvider.getUsername()).thenReturn("guest"); + when(credentialsProvider.getPassword()).thenReturn("guest"); + when(credentialsProvider.getTimeBeforeExpiration()).thenReturn(Duration.ofSeconds(10)); + + ConnectionFactory cf = TestUtils.connectionFactory(); + cf.setCredentialsProvider(credentialsProvider); + + String registrationId = UUID.randomUUID().toString(); + CountDownLatch unregisteredLatch = new CountDownLatch(1); + + AtomicReference> refreshTokenCallable = new AtomicReference<>(); + when(refreshService.register(eq(credentialsProvider), any(Callable.class))).thenAnswer(invocation -> { + refreshTokenCallable.set(invocation.getArgument(1)); + return registrationId; + }); + doAnswer(invocation -> { + unregisteredLatch.countDown(); + return null; + }).when(refreshService).unregister(credentialsProvider, registrationId); + + cf.setCredentialsRefreshService(refreshService); + + verify(refreshService, never()).register(any(CredentialsProvider.class), any(Callable.class)); + try (Connection c = cf.newConnection()) { + verify(refreshService, times(1)).register(eq(credentialsProvider), any(Callable.class)); + Channel ch = c.createChannel(); + String queue = ch.queueDeclare().getQueue(); + TestUtils.sendAndConsumeMessage("", queue, queue, c); + verify(refreshService, never()).unregister(any(CredentialsProvider.class), anyString()); + // calling refresh + assertThat(refreshTokenCallable.get().call()).isTrue(); + } + verify(refreshService, times(1)).register(eq(credentialsProvider), any(Callable.class)); + assertThat(unregisteredLatch.await(5, TimeUnit.SECONDS)).isTrue(); + verify(refreshService, times(1)).unregister(credentialsProvider, registrationId); + } + + @Test + @SuppressWarnings("unchecked") + public void connectionIsUnregisteredFromRefreshServiceIfUpdateSecretFails() throws Exception { + when(credentialsProvider.getUsername()).thenReturn("guest"); + when(credentialsProvider.getPassword()).thenReturn("guest"); + when(credentialsProvider.getTimeBeforeExpiration()).thenReturn(Duration.ofSeconds(10)); + + ConnectionFactory cf = connectionFactoryThatSendsGarbageAfterUpdateSecret(); + cf.setCredentialsProvider(credentialsProvider); + + String registrationId = UUID.randomUUID().toString(); + CountDownLatch unregisteredLatch = new CountDownLatch(1); + AtomicReference> refreshTokenCallable = new AtomicReference<>(); + when(refreshService.register(eq(credentialsProvider), any(Callable.class))).thenAnswer(invocation -> { + refreshTokenCallable.set(invocation.getArgument(1)); + return registrationId; + }); + doAnswer(invocation -> { + unregisteredLatch.countDown(); + return null; + }).when(refreshService).unregister(credentialsProvider, registrationId); + + cf.setCredentialsRefreshService(refreshService); + + Connection c = cf.newConnection(); + verify(refreshService, times(1)).register(eq(credentialsProvider), any(Callable.class)); + Channel ch = c.createChannel(); + String queue = ch.queueDeclare().getQueue(); + TestUtils.sendAndConsumeMessage("", queue, queue, c); + verify(refreshService, never()).unregister(any(CredentialsProvider.class), anyString()); + + verify(refreshService, never()).unregister(any(CredentialsProvider.class), anyString()); + // calling refresh, this sends garbage and should make the broker close the connection + assertThat(refreshTokenCallable.get().call()).isFalse(); + assertThat(unregisteredLatch.await(5, TimeUnit.SECONDS)).isTrue(); + verify(refreshService, times(1)).unregister(credentialsProvider, registrationId); + assertThat(c.isOpen()).isFalse(); + } +} diff --git a/src/test/java/com/rabbitmq/client/test/ClientTests.java b/src/test/java/com/rabbitmq/client/test/ClientTests.java index 1ec240888f..24a86ea7fa 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientTests.java +++ b/src/test/java/com/rabbitmq/client/test/ClientTests.java @@ -17,12 +17,12 @@ package com.rabbitmq.client.test; import com.rabbitmq.client.JacksonJsonRpcTest; - import com.rabbitmq.client.DefaultJsonRpcTest; import com.rabbitmq.client.impl.DefaultCredentialsRefreshServiceTest; import com.rabbitmq.client.impl.OAuth2ClientCredentialsGrantCredentialsProviderTest; import com.rabbitmq.client.impl.RefreshProtectedCredentialsProviderTest; import com.rabbitmq.client.impl.ValueWriterTest; +import com.rabbitmq.client.impl.*; import com.rabbitmq.utility.IntAllocatorTests; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -81,7 +81,8 @@ RefreshProtectedCredentialsProviderTest.class, DefaultCredentialsRefreshServiceTest.class, OAuth2ClientCredentialsGrantCredentialsProviderTest.class, - RefreshCredentialsTest.class + RefreshCredentialsTest.class, + AMQConnectionRefreshCredentialsTest.class }) public class ClientTests { From 3c2b4833bc9b0ef38f6338cd6b65690fa2698f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 5 Jul 2019 10:47:45 +0200 Subject: [PATCH 168/328] Document credentials refresh service [#167029587] (cherry picked from commit 1c7b21c5f5f5f93e4ae5884269b5702c2ae38558) --- .../rabbitmq/client/ConnectionFactory.java | 28 +++++++++++-------- .../rabbitmq/client/impl/AMQConnection.java | 3 ++ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index 0047d55245..ea79e354f2 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -32,17 +32,8 @@ import java.net.URLDecoder; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TimeoutException; +import java.util.*; +import java.util.concurrent.*; import java.util.function.Predicate; import static java.util.concurrent.TimeUnit.MINUTES; @@ -848,6 +839,21 @@ public MetricsCollector getMetricsCollector() { return metricsCollector; } + /** + * Set a {@link CredentialsRefreshService} instance to handle credentials refresh if appropriate. + *

+ * Each created connection will register to the refresh service to send an AMQP update.secret + * frame when credentials are about to expire. This is the refresh service responsibility to schedule + * credentials refresh and udpate.secret frame sending, based on the information provided + * by the {@link CredentialsProvider}. + *

+ * Note the {@link CredentialsRefreshService} is used only when the {@link CredentialsProvider} + * signals credentials can expire, by returning a non-null value from {@link CredentialsProvider#getTimeBeforeExpiration()}. + * + * @param credentialsRefreshService the refresh service to use + * @see #setCredentialsProvider(CredentialsProvider) + * @see DefaultCredentialsRefreshService + */ public void setCredentialsRefreshService(CredentialsRefreshService credentialsRefreshService) { this.credentialsRefreshService = credentialsRefreshService; } diff --git a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java index cf41ded34d..cdb4623b71 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java @@ -346,6 +346,9 @@ public void start() String password = credentialsProvider.getPassword(); if (credentialsProvider.getTimeBeforeExpiration() != null) { + if (this.credentialsRefreshService == null) { + throw new IllegalStateException("Credentials can expire, a credentials refresh service should be set"); + } if (this.credentialsRefreshService.needRefresh(credentialsProvider.getTimeBeforeExpiration())) { credentialsProvider.refresh(); username = credentialsProvider.getUsername(); From aa4bb335032480edd93d5a9b7d7d8934764c0be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 8 Jul 2019 15:01:51 +0200 Subject: [PATCH 169/328] Rename CredentialsRefreshService#needRefresh to isApproachingExpiration [#167029587] (cherry picked from commit 7dc7170ce0562cce0891f2f62f9c1258cfc52074) --- .../rabbitmq/client/impl/AMQConnection.java | 2 +- .../impl/CredentialsRefreshService.java | 8 ++- .../DefaultCredentialsRefreshService.java | 72 ++++++++++++++----- .../DefaultCredentialsRefreshServiceTest.java | 6 +- .../client/test/RefreshCredentialsTest.java | 2 +- 5 files changed, 66 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java index cdb4623b71..5717611bb7 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java @@ -349,7 +349,7 @@ public void start() if (this.credentialsRefreshService == null) { throw new IllegalStateException("Credentials can expire, a credentials refresh service should be set"); } - if (this.credentialsRefreshService.needRefresh(credentialsProvider.getTimeBeforeExpiration())) { + if (this.credentialsRefreshService.isApproachingExpiration(credentialsProvider.getTimeBeforeExpiration())) { credentialsProvider.refresh(); username = credentialsProvider.getUsername(); password = credentialsProvider.getPassword(); diff --git a/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java b/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java index 2e6065336e..675fa8fe1b 100644 --- a/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java +++ b/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java @@ -63,11 +63,15 @@ public interface CredentialsRefreshService { void unregister(CredentialsProvider credentialsProvider, String registrationId); /** - * Provide a hint about whether credentials should be renewed. + * Provide a hint about whether credentials should be renewed now or not before attempting to connect. + *

+ * This can avoid a connection to use almost expired credentials if this connection + * is created just before credentials are refreshed in the background, but does not + * benefit from the refresh. * * @param timeBeforeExpiration * @return true if credentials should be renewed, false otherwise */ - boolean needRefresh(Duration timeBeforeExpiration); + boolean isApproachingExpiration(Duration timeBeforeExpiration); } diff --git a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java index 032a94c779..39d6db1fda 100644 --- a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java +++ b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java @@ -44,19 +44,57 @@ public class DefaultCredentialsRefreshService implements CredentialsRefreshServi private static final Logger LOGGER = LoggerFactory.getLogger(DefaultCredentialsRefreshService.class); + /** + * Scheduler used to schedule credentials refresh. + *

+ * Default is a single-threaded scheduler, which should be enough for most scenarios, assuming + * that credentials expire after a few minutes or hours. This default scheduler + * is automatically disposed of when the {@link DefaultCredentialsRefreshService} is closed. + *

+ * If an external scheduler is passed in, it is the developer's responsibility to + * close it. + */ private final ScheduledExecutorService scheduler; private final ConcurrentMap credentialsProviderStates = new ConcurrentHashMap<>(); private final boolean privateScheduler; + /** + * Strategy to schedule credentials refresh after credentials retrieval. + *

+ * Typical strategies schedule refresh after a ratio of the time before expiration + * (e.g. 80 % of the time before expiration) or after a fixed time before + * expiration (e.g. 20 seconds before credentials expire). + * + * @see #ratioRefreshDelayStrategy(double) + * @see #fixedDelayBeforeExpirationRefreshDelayStrategy(Duration) + */ private final Function refreshDelayStrategy; - private final Function needRefreshStrategy; + /** + * Strategy to provide a hint about whether credentials should be renewed now or not before attempting to connect. + *

+ * This can avoid a connection to use almost expired credentials if this connection + * is created just before credentials are refreshed in the background, but does not + * benefit from the refresh. + *

+ * Note setting such a strategy may require knowledge of the credentials validity and must be consistent + * with the {@link #refreshDelayStrategy} chosen. For example, for a validity of 60 minutes and + * a {@link #refreshDelayStrategy} that instructs to refresh 10 minutes before credentials expire, this + * strategy could hint that credentials that expire in 11 minutes or less (1 minute before a refresh is actually + * scheduled) should be refreshed, which would trigger an early refresh. + *

+ * The default strategy always return false. + */ + private final Function approachingExpirationStrategy; - public DefaultCredentialsRefreshService(ScheduledExecutorService scheduler, Function refreshDelayStrategy, Function needRefreshStrategy) { + public DefaultCredentialsRefreshService(ScheduledExecutorService scheduler, Function refreshDelayStrategy, Function approachingExpirationStrategy) { + if (refreshDelayStrategy == null) { + throw new IllegalArgumentException("Refresh delay strategy can not be null"); + } this.refreshDelayStrategy = refreshDelayStrategy; - this.needRefreshStrategy = needRefreshStrategy; + this.approachingExpirationStrategy = approachingExpirationStrategy == null ? duration -> false : approachingExpirationStrategy; if (scheduler == null) { this.scheduler = Executors.newScheduledThreadPool(1); privateScheduler = true; @@ -69,8 +107,8 @@ public DefaultCredentialsRefreshService(ScheduledExecutorService scheduler, Func /** * Delay before refresh is a ratio of the time before expiration. *

- * E.g. if time before expiration is 60 seconds and specified ratio is 0.8, refresh will - * be scheduled in 60 x 0.8 = 48 seconds. + * E.g. if time before expiration is 60 minutes and specified ratio is 0.8, refresh will + * be scheduled in 60 x 0.8 = 48 minutes. * * @param ratio * @return the delay before refreshing @@ -82,8 +120,8 @@ public static Function ratioRefreshDelayStrategy(double rati /** * Delay before refresh is time before expiration - specified duration. *

- * E.g. if time before expiration is 60 seconds and specified duration is 20 seconds, refresh will - * be scheduled in 60 - 20 = 40 seconds. + * E.g. if time before expiration is 60 minutes and specified duration is 10 minutes, refresh will + * be scheduled in 60 - 10 = 50 minutes. * * @param duration * @return the delay before refreshing @@ -98,8 +136,8 @@ public static Function fixedDelayBeforeExpirationRefreshDela * @param limitBeforeExpiration * @return true if credentials should be refreshed, false otherwise */ - public static Function fixedTimeNeedRefreshStrategy(Duration limitBeforeExpiration) { - return new FixedTimeNeedRefreshStrategy(limitBeforeExpiration.toMillis()); + public static Function fixedTimeApproachingExpirationStrategy(Duration limitBeforeExpiration) { + return new FixedTimeApproachingExpirationStrategy(limitBeforeExpiration.toMillis()); } private static Runnable refresh(ScheduledExecutorService scheduler, CredentialsProviderState credentialsProviderState, @@ -157,8 +195,8 @@ public void unregister(CredentialsProvider credentialsProvider, String registrat } @Override - public boolean needRefresh(Duration timeBeforeExpiration) { - return this.needRefreshStrategy.apply(timeBeforeExpiration); + public boolean isApproachingExpiration(Duration timeBeforeExpiration) { + return this.approachingExpirationStrategy.apply(timeBeforeExpiration); } public void close() { @@ -167,11 +205,11 @@ public void close() { } } - private static class FixedTimeNeedRefreshStrategy implements Function { + private static class FixedTimeApproachingExpirationStrategy implements Function { private final long limitBeforeExpiration; - private FixedTimeNeedRefreshStrategy(long limitBeforeExpiration) { + private FixedTimeApproachingExpirationStrategy(long limitBeforeExpiration) { this.limitBeforeExpiration = limitBeforeExpiration; } @@ -340,7 +378,7 @@ public static class DefaultCredentialsRefreshServiceBuilder { private Function refreshDelayStrategy = ratioRefreshDelayStrategy(0.8); - private Function needRefreshStrategy = ttl -> false; + private Function approachingExpirationStrategy = ttl -> false; public DefaultCredentialsRefreshServiceBuilder scheduler(ScheduledThreadPoolExecutor scheduler) { this.scheduler = scheduler; @@ -352,13 +390,13 @@ public DefaultCredentialsRefreshServiceBuilder refreshDelayStrategy(Function needRefreshStrategy) { - this.needRefreshStrategy = needRefreshStrategy; + public DefaultCredentialsRefreshServiceBuilder approachingExpirationStrategy(Function approachingExpirationStrategy) { + this.approachingExpirationStrategy = approachingExpirationStrategy; return this; } public DefaultCredentialsRefreshService build() { - return new DefaultCredentialsRefreshService(scheduler, refreshDelayStrategy, needRefreshStrategy); + return new DefaultCredentialsRefreshService(scheduler, refreshDelayStrategy, approachingExpirationStrategy); } } diff --git a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java index 5a1518610d..7009319b9c 100644 --- a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java +++ b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java @@ -33,7 +33,7 @@ import java.util.stream.IntStream; import static com.rabbitmq.client.impl.DefaultCredentialsRefreshService.fixedDelayBeforeExpirationRefreshDelayStrategy; -import static com.rabbitmq.client.impl.DefaultCredentialsRefreshService.fixedTimeNeedRefreshStrategy; +import static com.rabbitmq.client.impl.DefaultCredentialsRefreshService.fixedTimeApproachingExpirationStrategy; import static java.time.Duration.ofSeconds; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.*; @@ -232,8 +232,8 @@ public void fixedDelayBeforeExpirationRefreshDelayStrategyTest() { } @Test - public void fixedTimeNeedRefreshStrategyTest() { - Function refreshStrategy = fixedTimeNeedRefreshStrategy(ofSeconds(20)); + public void fixedTimeApproachingExpirationStrategyTest() { + Function refreshStrategy = fixedTimeApproachingExpirationStrategy(ofSeconds(20)); assertThat(refreshStrategy.apply(ofSeconds(60))).isFalse(); assertThat(refreshStrategy.apply(ofSeconds(20))).isTrue(); assertThat(refreshStrategy.apply(ofSeconds(19))).isTrue(); diff --git a/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java b/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java index 963adc7964..defa0c4b4f 100644 --- a/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java +++ b/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java @@ -76,7 +76,7 @@ protected Duration timeBeforeExpiration(TestToken token) { cf.setCredentialsProvider(provider); refreshService = new DefaultCredentialsRefreshService.DefaultCredentialsRefreshServiceBuilder() .refreshDelayStrategy(DefaultCredentialsRefreshService.fixedDelayBeforeExpirationRefreshDelayStrategy(Duration.ofSeconds(1))) - .needRefreshStrategy(expiration -> false) + .approachingExpirationStrategy(expiration -> false) .build(); cf.setCredentialsRefreshService(refreshService); From dc1b104f4461b8756aa1488d6afa941b0e14aa2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 8 Jul 2019 17:25:26 +0200 Subject: [PATCH 170/328] Document OAuth 2 credentials provider [#167029587] (cherry picked from commit 09f5320787594d64ee5cf6a79d9f488f90feefa9) Conflicts: src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java --- ...ntCredentialsGrantCredentialsProvider.java | 379 ++++++++++++++++-- ...edentialsGrantCredentialsProviderTest.java | 2 +- 2 files changed, 340 insertions(+), 41 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java index 48f347555a..71635b4baa 100644 --- a/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java +++ b/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java @@ -16,23 +16,51 @@ package com.rabbitmq.client.impl; import com.fasterxml.jackson.databind.ObjectMapper; +import com.rabbitmq.client.TrustEverythingTrustManager; -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.*; import java.io.*; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; import java.time.Duration; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.*; +import java.util.function.Consumer; + +import static com.rabbitmq.client.ConnectionFactory.computeDefaultTlsProtocol; /** + * A {@link CredentialsProvider} that performs an + * OAuth 2 Client Credentials flow + * to retrieve a token. + *

+ * The provider has different parameters to set, e.g. the token endpoint URI of the OAuth server to + * request, the client ID, the client secret, the grant type, etc. The {@link OAuth2ClientCredentialsGrantCredentialsProviderBuilder} + * class is the preferred way to create an instance of the provider. + *

+ * The implementation uses the JDK {@link HttpURLConnection} API to request the OAuth server. This can + * be easily changed by overriding the {@link #retrieveToken()} method. + *

+ * This class expects a JSON document as a response and needs Jackson + * to deserialize the response into a {@link Token}. This can be changed by overriding the {@link #parseToken(String)} + * method. + *

+ * TLS is supported by providing a HTTPS URI and setting a {@link SSLContext}. See + * {@link OAuth2ClientCredentialsGrantCredentialsProviderBuilder#tls()} for more information. + * Applications in production should always use HTTPS to retrieve tokens. + *

+ * If more customization is needed, a {@link #connectionConfigurator} callback can be provided to configure + * the connection. * * @see RefreshProtectedCredentialsProvider + * @see CredentialsRefreshService + * @see OAuth2ClientCredentialsGrantCredentialsProviderBuilder + * @see OAuth2ClientCredentialsGrantCredentialsProviderBuilder#tls() */ public class OAuth2ClientCredentialsGrantCredentialsProvider extends RefreshProtectedCredentialsProvider { @@ -51,21 +79,94 @@ public class OAuth2ClientCredentialsGrantCredentialsProvider extends RefreshProt private final HostnameVerifier hostnameVerifier; private final SSLSocketFactory sslSocketFactory; + private final Consumer connectionConfigurator; + + /** + * Use {@link OAuth2ClientCredentialsGrantCredentialsProviderBuilder} to create an instance. + * + * @param tokenEndpointUri + * @param clientId + * @param clientSecret + * @param grantType + */ public OAuth2ClientCredentialsGrantCredentialsProvider(String tokenEndpointUri, String clientId, String clientSecret, String grantType) { this(tokenEndpointUri, clientId, clientSecret, grantType, new HashMap<>()); } + /** + * Use {@link OAuth2ClientCredentialsGrantCredentialsProviderBuilder} to create an instance. + * + * @param tokenEndpointUri + * @param clientId + * @param clientSecret + * @param grantType + * @param parameters + */ + public OAuth2ClientCredentialsGrantCredentialsProvider(String tokenEndpointUri, String clientId, String clientSecret, String grantType, Map parameters) { + this(tokenEndpointUri, clientId, clientSecret, grantType, parameters, null, null, null); + } + + /** + * Use {@link OAuth2ClientCredentialsGrantCredentialsProviderBuilder} to create an instance. + * + * @param tokenEndpointUri + * @param clientId + * @param clientSecret + * @param grantType + * @param parameters + * @param connectionConfigurator + */ + public OAuth2ClientCredentialsGrantCredentialsProvider(String tokenEndpointUri, String clientId, String clientSecret, String grantType, Map parameters, + Consumer connectionConfigurator) { + this(tokenEndpointUri, clientId, clientSecret, grantType, parameters, null, null, connectionConfigurator); + } + + /** + * Use {@link OAuth2ClientCredentialsGrantCredentialsProviderBuilder} to create an instance. + * + * @param tokenEndpointUri + * @param clientId + * @param clientSecret + * @param grantType + * @param hostnameVerifier + * @param sslSocketFactory + */ public OAuth2ClientCredentialsGrantCredentialsProvider(String tokenEndpointUri, String clientId, String clientSecret, String grantType, HostnameVerifier hostnameVerifier, SSLSocketFactory sslSocketFactory) { - this(tokenEndpointUri, clientId, clientSecret, grantType, new HashMap<>(), hostnameVerifier, sslSocketFactory); + this(tokenEndpointUri, clientId, clientSecret, grantType, new HashMap<>(), hostnameVerifier, sslSocketFactory, null); } - public OAuth2ClientCredentialsGrantCredentialsProvider(String tokenEndpointUri, String clientId, String clientSecret, String grantType, Map parameters) { - this(tokenEndpointUri, clientId, clientSecret, grantType, parameters, null, null); + /** + * Use {@link OAuth2ClientCredentialsGrantCredentialsProviderBuilder} to create an instance. + * + * @param tokenEndpointUri + * @param clientId + * @param clientSecret + * @param grantType + * @param parameters + * @param hostnameVerifier + * @param sslSocketFactory + */ + public OAuth2ClientCredentialsGrantCredentialsProvider(String tokenEndpointUri, String clientId, String clientSecret, String grantType, Map parameters, + HostnameVerifier hostnameVerifier, SSLSocketFactory sslSocketFactory) { + this(tokenEndpointUri, clientId, clientSecret, grantType, parameters, hostnameVerifier, sslSocketFactory, null); } + /** + * Use {@link OAuth2ClientCredentialsGrantCredentialsProviderBuilder} to create an instance. + * + * @param tokenEndpointUri + * @param clientId + * @param clientSecret + * @param grantType + * @param parameters + * @param hostnameVerifier + * @param sslSocketFactory + * @param connectionConfigurator + */ public OAuth2ClientCredentialsGrantCredentialsProvider(String tokenEndpointUri, String clientId, String clientSecret, String grantType, Map parameters, - HostnameVerifier hostnameVerifier, SSLSocketFactory sslSocketFactory) { + HostnameVerifier hostnameVerifier, SSLSocketFactory sslSocketFactory, + Consumer connectionConfigurator) { this.tokenEndpointUri = tokenEndpointUri; this.clientId = clientId; this.clientSecret = clientSecret; @@ -73,6 +174,8 @@ public OAuth2ClientCredentialsGrantCredentialsProvider(String tokenEndpointUri, this.parameters = Collections.unmodifiableMap(new HashMap<>(parameters)); this.hostnameVerifier = hostnameVerifier; this.sslSocketFactory = sslSocketFactory; + this.connectionConfigurator = connectionConfigurator == null ? c -> { + } : connectionConfigurator; this.id = UUID.randomUUID().toString(); } @@ -81,13 +184,17 @@ private static StringBuilder encode(StringBuilder builder, String name, String v if (builder.length() > 0) { builder.append("&"); } - builder.append(URLEncoder.encode(name, UTF_8_CHARSET)) + builder.append(encode(name, UTF_8_CHARSET)) .append("=") - .append(URLEncoder.encode(value, UTF_8_CHARSET)); + .append(encode(value, UTF_8_CHARSET)); } return builder; } + private static String encode(String value, String charset) throws UnsupportedEncodingException { + return URLEncoder.encode(value, charset); + } + private static String basicAuthentication(String username, String password) { String credentials = username + ":" + password; byte[] credentialsAsBytes = credentials.getBytes(StandardCharsets.ISO_8859_1); @@ -129,8 +236,6 @@ protected Token retrieveToken() { int postDataLength = postData.length; URL url = new URL(tokenEndpointUri); - // FIXME close connection? - // FIXME set timeout on request HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); @@ -142,37 +247,52 @@ protected Token retrieveToken() { conn.setRequestProperty("accept", "application/json"); conn.setRequestProperty("content-length", Integer.toString(postDataLength)); conn.setUseCaches(false); + conn.setConnectTimeout(60_000); + conn.setReadTimeout(60_000); - configureHttpConnection(conn); + configureConnection(conn); try (DataOutputStream wr = new DataOutputStream(conn.getOutputStream())) { wr.write(postData); } - int responseCode = conn.getResponseCode(); - if (responseCode != 200) { - throw new OAuthTokenManagementException( - "HTTP request for token retrieval did not " + - "return 200 response code: " + responseCode - ); - } - - StringBuffer content = new StringBuffer(); - try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()))) { - String inputLine; - while ((inputLine = in.readLine()) != null) { - content.append(inputLine); - } - } - - // FIXME check result is json + checkResponseCode(conn.getResponseCode()); + checkContentType(conn.getHeaderField("content-type")); - return parseToken(content.toString()); + return parseToken(extractResponseBody(conn.getInputStream())); } catch (IOException e) { throw new OAuthTokenManagementException("Error while retrieving OAuth 2 token", e); } } + protected void checkContentType(String headerField) throws OAuthTokenManagementException { + if (headerField == null || !headerField.toLowerCase().contains("json")) { + throw new OAuthTokenManagementException( + "HTTP request for token retrieval is not JSON: " + headerField + ); + } + } + + protected void checkResponseCode(int responseCode) throws OAuthTokenManagementException { + if (responseCode != 200) { + throw new OAuthTokenManagementException( + "HTTP request for token retrieval did not " + + "return 200 response code: " + responseCode + ); + } + } + + protected String extractResponseBody(InputStream inputStream) throws IOException { + StringBuffer content = new StringBuffer(); + try (BufferedReader in = new BufferedReader(new InputStreamReader(inputStream))) { + String inputLine; + while ((inputLine = in.readLine()) != null) { + content.append(inputLine); + } + } + return content.toString(); + } + @Override protected String passwordFromToken(Token token) { return token.getAccess(); @@ -183,7 +303,12 @@ protected Duration timeBeforeExpiration(Token token) { return token.getTimeBeforeExpiration(); } - protected void configureHttpConnection(HttpURLConnection connection) { + protected void configureConnection(HttpURLConnection connection) { + this.connectionConfigurator.accept(connection); + this.configureConnectionForHttps(connection); + } + + protected void configureConnectionForHttps(HttpURLConnection connection) { if (connection instanceof HttpsURLConnection) { HttpsURLConnection securedConnection = (HttpsURLConnection) connection; if (this.hostnameVerifier != null) { @@ -243,6 +368,9 @@ public Duration getTimeBeforeExpiration() { } } + /** + * Helper to create {@link OAuth2ClientCredentialsGrantCredentialsProvider} instances. + */ public static class OAuth2ClientCredentialsGrantCredentialsProviderBuilder { private final Map parameters = new HashMap<>(); @@ -250,51 +378,222 @@ public static class OAuth2ClientCredentialsGrantCredentialsProviderBuilder { private String clientId; private String clientSecret; private String grantType = "client_credentials"; - private HostnameVerifier hostnameVerifier; - private SSLSocketFactory sslSocketFactory; + private Consumer connectionConfigurator; + private TlsConfiguration tlsConfiguration = new TlsConfiguration(this); + + /** + * Set the URI to request to get the token. + * + * @param tokenEndpointUri + * @return this builder instance + */ public OAuth2ClientCredentialsGrantCredentialsProviderBuilder tokenEndpointUri(String tokenEndpointUri) { this.tokenEndpointUri = tokenEndpointUri; return this; } + /** + * Set the OAuth 2 client ID + *

+ * The client ID usually identifies the application that requests a token. + * + * @param clientId + * @return this builder instance + */ public OAuth2ClientCredentialsGrantCredentialsProviderBuilder clientId(String clientId) { this.clientId = clientId; return this; } + /** + * Set the secret (password) to use to get a token. + * + * @param clientSecret + * @return this builder instance + */ public OAuth2ClientCredentialsGrantCredentialsProviderBuilder clientSecret(String clientSecret) { this.clientSecret = clientSecret; return this; } + /** + * Set the grant type to use when requesting the token. + *

+ * The default is client_credentials, but some OAuth 2 servers can use + * non-standard grant types to request tokens with extra-information. + * + * @param grantType + * @return this builder instance + */ public OAuth2ClientCredentialsGrantCredentialsProviderBuilder grantType(String grantType) { this.grantType = grantType; return this; } + /** + * Extra parameters to pass in the request. + *

+ * These parameters can be used by the OAuth 2 server to narrow down the identify of the user. + * + * @param name + * @param value + * @return this builder instance + */ public OAuth2ClientCredentialsGrantCredentialsProviderBuilder parameter(String name, String value) { this.parameters.put(name, value); return this; } - public OAuth2ClientCredentialsGrantCredentialsProviderBuilder setHostnameVerifier(HostnameVerifier hostnameVerifier) { - this.hostnameVerifier = hostnameVerifier; + /** + * A hook to configure the {@link HttpURLConnection} before the request is sent. + *

+ * Can be used to configuration settings like timeouts. + * + * @param connectionConfigurator + * @return this builder instance + */ + public OAuth2ClientCredentialsGrantCredentialsProviderBuilder connectionConfigurator(Consumer connectionConfigurator) { + this.connectionConfigurator = connectionConfigurator; return this; } - public OAuth2ClientCredentialsGrantCredentialsProviderBuilder setSslSocketFactory(SSLSocketFactory sslSocketFactory) { - this.sslSocketFactory = sslSocketFactory; - return this; + /** + * Get access to the TLS configuration to get the token on HTTPS. + *

+ * It is recommended that applications in production use HTTPS and configure it properly + * to perform token retrieval. Not doing so could result in sensitive data + * transiting in clear on the network. + *

+ * You can "exit" the TLS configuration and come back to the builder by + * calling {@link TlsConfiguration#builder()}. + * + * @return the TLS configuration for this builder. + * @see TlsConfiguration + * @see TlsConfiguration#builder() + */ + public TlsConfiguration tls() { + return this.tlsConfiguration; } + /** + * Create the {@link OAuth2ClientCredentialsGrantCredentialsProvider} instance. + * + * @return + */ public OAuth2ClientCredentialsGrantCredentialsProvider build() { return new OAuth2ClientCredentialsGrantCredentialsProvider( tokenEndpointUri, clientId, clientSecret, grantType, parameters, - hostnameVerifier, sslSocketFactory + tlsConfiguration.hostnameVerifier, tlsConfiguration.sslSocketFactory(), + connectionConfigurator ); } } -} + + /** + * TLS configuration for a {@link OAuth2ClientCredentialsGrantCredentialsProvider}. + *

+ * Use it from {@link OAuth2ClientCredentialsGrantCredentialsProviderBuilder#tls()}. + */ + public static class TlsConfiguration { + + private final OAuth2ClientCredentialsGrantCredentialsProviderBuilder builder; + + private HostnameVerifier hostnameVerifier; + + private SSLSocketFactory sslSocketFactory; + + private SSLContext sslContext; + + public TlsConfiguration(OAuth2ClientCredentialsGrantCredentialsProviderBuilder builder) { + this.builder = builder; + } + + /** + * Set the hostname verifier. + *

+ * {@link HttpsURLConnection} sets a default hostname verifier, so + * setting a custom one is only needed for specific cases. + * + * @param hostnameVerifier + * @return this TLS configuration instance + * @see HostnameVerifier + */ + public TlsConfiguration hostnameVerifier(HostnameVerifier hostnameVerifier) { + this.hostnameVerifier = hostnameVerifier; + return this; + } + + /** + * Set the {@link SSLSocketFactory} to use in the {@link HttpsURLConnection}. + *

+ * The {@link SSLSocketFactory} supersedes the {@link SSLContext} value if both are set up. + * + * @param sslSocketFactory + * @return this TLS configuration instance + */ + public TlsConfiguration sslSocketFactory(SSLSocketFactory sslSocketFactory) { + this.sslSocketFactory = sslSocketFactory; + return this; + } + + /** + * Set the {@link SSLContext} to use to create the {@link SSLSocketFactory} for the {@link HttpsURLConnection}. + *

+ * This is the preferred way to configure TLS version to use, trusted servers, etc. + *

+ * Note the {@link SSLContext} is not used if the {@link SSLSocketFactory} is set. + * + * @param sslContext + * @return this TLS configuration instances + */ + public TlsConfiguration sslContext(SSLContext sslContext) { + this.sslContext = sslContext; + return this; + } + + /** + * Set up a non-secured environment, useful for development and testing. + *

+ * With this configuration, all servers are trusted. + * + * DO NOT USE this in production. + * + * @return a TLS configuration that trusts all servers + */ + public TlsConfiguration dev() { + try { + SSLContext sslContext = SSLContext.getInstance(computeDefaultTlsProtocol( + SSLContext.getDefault().getSupportedSSLParameters().getProtocols() + )); + sslContext.init(null, new TrustManager[]{new TrustEverythingTrustManager()}, null); + this.sslContext = sslContext; + } catch (NoSuchAlgorithmException | KeyManagementException e) { + throw new OAuthTokenManagementException("Error while creating TLS context for development configuration", e); + } + return this; + } + + /** + * Go back to the builder to configure non-TLS settings. + * + * @return the wrapping builder + */ + public OAuth2ClientCredentialsGrantCredentialsProviderBuilder builder() { + return builder; + } + + private SSLSocketFactory sslSocketFactory() { + if (this.sslSocketFactory != null) { + return this.sslSocketFactory; + } else if (this.sslContext != null) { + return this.sslContext.getSocketFactory(); + } + return null; + } + + } + +} \ No newline at end of file diff --git a/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java b/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java index 2cd19ee828..e1d1c5abbf 100644 --- a/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java +++ b/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java @@ -169,7 +169,7 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques OAuth2ClientCredentialsGrantCredentialsProvider provider = new OAuth2ClientCredentialsGrantCredentialsProvider.OAuth2ClientCredentialsGrantCredentialsProviderBuilder() .tokenEndpointUri("https://localhost:" + port + "/uaa/oauth/token/") .clientId("rabbit_client").clientSecret("rabbit_secret") - .setSslSocketFactory(sslContext.getSocketFactory()) + .tls().sslContext(sslContext).builder() .build(); String password = provider.getPassword(); From 10ba790eb6da4ebbee26d1b73838bc6afd30bd3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 8 Jul 2019 17:47:03 +0200 Subject: [PATCH 171/328] Document DefaultCredentialsRefreshService [#167029587] (cherry picked from commit a9e8e733572ed9acea116bd76cba0926e368b70e) --- .../DefaultCredentialsRefreshService.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java index 39d6db1fda..d74d749a0d 100644 --- a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java +++ b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java @@ -39,6 +39,8 @@ * by each entity/connection is performed. This callback typically propagates * the new credentials in the entity state, e.g. sending the new password to the * broker for AMQP connections. + *

+ * Instances are preferably created with {@link DefaultCredentialsRefreshServiceBuilder}. */ public class DefaultCredentialsRefreshService implements CredentialsRefreshService { @@ -89,6 +91,13 @@ public class DefaultCredentialsRefreshService implements CredentialsRefreshServi */ private final Function approachingExpirationStrategy; + /** + * Constructor. Consider using {@link DefaultCredentialsRefreshServiceBuilder} to create instances. + * + * @param scheduler + * @param refreshDelayStrategy + * @param approachingExpirationStrategy + */ public DefaultCredentialsRefreshService(ScheduledExecutorService scheduler, Function refreshDelayStrategy, Function approachingExpirationStrategy) { if (refreshDelayStrategy == null) { throw new IllegalArgumentException("Refresh delay strategy can not be null"); @@ -371,6 +380,9 @@ void unregister(String registrationId) { } } + /** + * Builder to create instances of {@link DefaultCredentialsRefreshServiceBuilder}. + */ public static class DefaultCredentialsRefreshServiceBuilder { @@ -385,16 +397,43 @@ public DefaultCredentialsRefreshServiceBuilder scheduler(ScheduledThreadPoolExec return this; } + /** + * Set the strategy to schedule credentials refresh after credentials retrieval. + *

+ * Default is a 80 % ratio-based strategy (refresh is scheduled after 80 % of the time + * before expiration, e.g. 48 minutes for a token with a validity of 60 minutes, that + * is refresh will be scheduled 12 minutes before the token actually expires). + * + * @param refreshDelayStrategy + * @return this builder instance + * @see DefaultCredentialsRefreshService#refreshDelayStrategy + * @see DefaultCredentialsRefreshService#ratioRefreshDelayStrategy(double) + */ public DefaultCredentialsRefreshServiceBuilder refreshDelayStrategy(Function refreshDelayStrategy) { this.refreshDelayStrategy = refreshDelayStrategy; return this; } + /** + * Set the strategy to trigger an early refresh before attempting to connect. + *

+ * Default is to never advise to refresh before connecting. + * + * @param approachingExpirationStrategy + * @return this builder instances + * @see DefaultCredentialsRefreshService#approachingExpirationStrategy + * @see CredentialsRefreshService#isApproachingExpiration(Duration) + */ public DefaultCredentialsRefreshServiceBuilder approachingExpirationStrategy(Function approachingExpirationStrategy) { this.approachingExpirationStrategy = approachingExpirationStrategy; return this; } + /** + * Create the {@link DefaultCredentialsRefreshService} instance. + * + * @return + */ public DefaultCredentialsRefreshService build() { return new DefaultCredentialsRefreshService(scheduler, refreshDelayStrategy, approachingExpirationStrategy); } From e334a3ef2ebe05f1c51bad0283782a9a0cb7c546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 12 Sep 2019 09:50:13 +0200 Subject: [PATCH 172/328] Bump dependencies References #625 (cherry picked from commit c737a939466647c43f5b544e8696cf0f19b2ae37) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 837802079d..76005fa142 100644 --- a/pom.xml +++ b/pom.xml @@ -54,9 +54,9 @@ UTF-8 UTF-8 - 1.7.26 + 1.7.28 4.1.0 - 1.2.0 + 1.2.1 2.9.9.3 1.2.3 4.12 From 592bb7ec716a1ac9fcde4717b6c61edec4888b99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 12 Sep 2019 10:09:32 +0200 Subject: [PATCH 173/328] Bump test and build dependencies (cherry picked from commit d0e1a0863f8916c41755ba06a1d55043254fb908) --- pom.xml | 16 ++++----- .../com/rabbitmq/client/test/JavaNioTest.java | 35 +++++++++++-------- .../com/rabbitmq/client/test/RpcTest.java | 7 ++-- .../client/test/functional/Metrics.java | 6 ++-- 4 files changed, 34 insertions(+), 30 deletions(-) diff --git a/pom.xml b/pom.xml index 76005fa142..5d97a72dab 100644 --- a/pom.xml +++ b/pom.xml @@ -60,13 +60,13 @@ 2.9.9.3 1.2.3 4.12 - 3.1.6 + 4.0.1 3.0.0 - 3.12.2 - 9.4.19.v20190610 - 1.61 + 3.13.2 + 9.4.20.v20190813 + 1.63 - 3.0.1 + 3.1.1 2.5.3 2.3 3.0.2 @@ -75,9 +75,9 @@ 2.4.8 1.5 1.12 - 3.6.1 - 2.22.1 - 2.22.1 + 3.8.1 + 2.22.2 + 2.22.2 1.6 3.0.2 3.2.0 diff --git a/src/test/java/com/rabbitmq/client/test/JavaNioTest.java b/src/test/java/com/rabbitmq/client/test/JavaNioTest.java index 2b80277590..0d143e86e8 100644 --- a/src/test/java/com/rabbitmq/client/test/JavaNioTest.java +++ b/src/test/java/com/rabbitmq/client/test/JavaNioTest.java @@ -4,6 +4,7 @@ import com.rabbitmq.client.impl.nio.BlockingQueueNioQueue; import com.rabbitmq.client.impl.nio.DefaultByteBufferFactory; import com.rabbitmq.client.impl.nio.NioParams; +import org.assertj.core.api.Condition; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -14,10 +15,8 @@ import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicInteger; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.isOneOf; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; /** @@ -125,19 +124,21 @@ public void shutdownCompleted(ShutdownSignalException cause) { public void nioLoopCleaning() throws Exception { ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.useNio(); - for(int i = 0; i < 10; i++) { + for (int i = 0; i < 10; i++) { Connection connection = connectionFactory.newConnection(); connection.abort(); } } - @Test public void messageSize() throws Exception { + @Test + public void messageSize() throws Exception { for (int i = 0; i < 50; i++) { sendAndVerifyMessage(testConnection, 76390); } } - @Test public void byteBufferFactory() throws Exception { + @Test + public void byteBufferFactory() throws Exception { ConnectionFactory cf = new ConnectionFactory(); cf.useNio(); int baseCapacity = 32768; @@ -155,12 +156,15 @@ public void nioLoopCleaning() throws Exception { sendAndVerifyMessage(c, 100); } - assertThat(byteBuffers, hasSize(2)); - assertThat(byteBuffers.get(0).capacity(), isOneOf(nioParams.getReadByteBufferSize(), nioParams.getWriteByteBufferSize())); - assertThat(byteBuffers.get(1).capacity(), isOneOf(nioParams.getReadByteBufferSize(), nioParams.getWriteByteBufferSize())); + assertThat(byteBuffers).hasSize(2); + Condition condition = new Condition<>(c -> c == nioParams.getReadByteBufferSize() || + c == nioParams.getWriteByteBufferSize(), "capacity set by factory"); + assertThat(byteBuffers.get(0).capacity()).is(condition); + assertThat(byteBuffers.get(1).capacity()).is(condition); } - @Test public void directByteBuffers() throws Exception { + @Test + public void directByteBuffers() throws Exception { ConnectionFactory cf = new ConnectionFactory(); cf.useNio(); cf.setNioParams(new NioParams().setByteBufferFactory(new DefaultByteBufferFactory(capacity -> ByteBuffer.allocateDirect(capacity)))); @@ -169,15 +173,16 @@ public void nioLoopCleaning() throws Exception { } } - @Test public void customWriteQueue() throws Exception { + @Test + public void customWriteQueue() throws Exception { ConnectionFactory cf = new ConnectionFactory(); cf.useNio(); AtomicInteger count = new AtomicInteger(0); cf.setNioParams(new NioParams().setWriteQueueFactory(ctx -> { count.incrementAndGet(); return new BlockingQueueNioQueue( - new LinkedBlockingQueue<>(ctx.getNioParams().getWriteQueueCapacity()), - ctx.getNioParams().getWriteEnqueuingTimeoutInMs() + new LinkedBlockingQueue<>(ctx.getNioParams().getWriteQueueCapacity()), + ctx.getNioParams().getWriteEnqueuingTimeoutInMs() ); })); try (Connection c = cf.newConnection()) { @@ -193,7 +198,7 @@ private void sendAndVerifyMessage(Connection connection, int size) throws Except } private Connection basicGetBasicConsume(ConnectionFactory connectionFactory, String queue, final CountDownLatch latch) - throws IOException, TimeoutException { + throws IOException, TimeoutException { Connection connection = connectionFactory.newConnection(); Channel channel = connection.createChannel(); channel.queueDeclare(queue, false, false, false, null); @@ -213,7 +218,7 @@ public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProp } private boolean basicGetBasicConsume(Connection connection, String queue, final CountDownLatch latch, int msgSize) - throws Exception { + throws Exception { Channel channel = connection.createChannel(); channel.queueDeclare(queue, false, false, false, null); channel.queuePurge(queue); diff --git a/src/test/java/com/rabbitmq/client/test/RpcTest.java b/src/test/java/com/rabbitmq/client/test/RpcTest.java index 0c05f761e2..66251738d3 100644 --- a/src/test/java/com/rabbitmq/client/test/RpcTest.java +++ b/src/test/java/com/rabbitmq/client/test/RpcTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2019 Pivotal Software, Inc. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 @@ -24,13 +24,12 @@ import com.rabbitmq.client.impl.recovery.RecordedQueue; import com.rabbitmq.client.impl.recovery.TopologyRecoveryFilter; import com.rabbitmq.tools.Host; -import org.awaitility.Awaitility; -import org.awaitility.Duration; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.io.IOException; +import java.time.Duration; import java.util.HashMap; import java.util.Map; import java.util.UUID; @@ -301,7 +300,7 @@ public void handleRecoveryStarted(Recoverable recoverable) { serverThread.interrupt(); - waitAtMost(Duration.ONE_SECOND).until(() -> !serverThread.isAlive()) ; + waitAtMost(Duration.ofSeconds(1)).until(() -> !serverThread.isAlive()) ; client.close(); } diff --git a/src/test/java/com/rabbitmq/client/test/functional/Metrics.java b/src/test/java/com/rabbitmq/client/test/functional/Metrics.java index 783d9e197f..94d76bfe2d 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Metrics.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Metrics.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 @@ -30,13 +30,13 @@ import com.rabbitmq.client.test.BrokerTestCase; import com.rabbitmq.client.test.TestUtils; import com.rabbitmq.tools.Host; -import org.awaitility.Duration; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.io.IOException; import java.lang.reflect.Field; +import java.time.Duration; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -637,7 +637,7 @@ private void sendMessage(Channel channel) throws IOException { } private Duration timeout() { - return new Duration(10, TimeUnit.SECONDS); + return Duration.ofSeconds(10); } private static class MultipleAckConsumer extends DefaultConsumer { From d1779bad5342f8ed5ad78cfc3c316f9337e97897 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Thu, 12 Sep 2019 15:53:35 +0000 Subject: [PATCH 174/328] [maven-release-plugin] prepare release v5.8.0.RC1 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5d97a72dab..5283d0d91c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.8.0-SNAPSHOT + 5.8.0.RC1 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.8.0.RC1 From 9f56b9ba5a70763c1cb7cb15bfdb47a08827db88 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Thu, 12 Sep 2019 15:53:40 +0000 Subject: [PATCH 175/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5283d0d91c..5d97a72dab 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.8.0.RC1 + 5.8.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.8.0.RC1 + HEAD From 91b3ccb595eeafcc8ec607a5bcaf32ae1926dd47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 12 Sep 2019 17:57:06 +0200 Subject: [PATCH 176/328] Set release version to 5.8.0.RC2 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index 34cae24ccc..e3a47a9087 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,2 +1,2 @@ -RELEASE_VERSION="5.8.0.RC1" +RELEASE_VERSION="5.8.0.RC2" DEVELOPMENT_VERSION="5.8.0-SNAPSHOT" From 96718db6498d16e342eb128f8ffc91f45857ba9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 16 Sep 2019 11:34:18 +0200 Subject: [PATCH 177/328] Do not depend on generated classes for update-secret extension Some CI testing jobs are using the 3.7 branch of codegen, which does not contain the update-secret extension. The Java client then cannot be built because it requires some generated code for the extension. This commit adds the code to handle update-secret and thus makes the generated code not necessary. This is just a workaround for these testing jobs to succeed, it does not change the handling of the update-secret extension in the client. [#167029587] References #626 (cherry picked from commit e3c662ea695126a0fc0c18b5640c5e3704eb3aff) --- .../rabbitmq/client/impl/AMQConnection.java | 2 +- .../client/impl/UpdateSecretExtension.java | 108 ++++++++++++++++++ .../AMQConnectionRefreshCredentialsTest.java | 4 +- 3 files changed, 111 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/rabbitmq/client/impl/UpdateSecretExtension.java diff --git a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java index 5717611bb7..0d45cf0bb2 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java @@ -445,7 +445,7 @@ public void start() } String refreshedPassword = credentialsProvider.getPassword(); - AMQImpl.Connection.UpdateSecret updateSecret = new AMQImpl.Connection.UpdateSecret( + UpdateSecretExtension.UpdateSecret updateSecret = new UpdateSecretExtension.UpdateSecret( LongStringHelper.asLongString(refreshedPassword), "Refresh scheduled by client" ); try { diff --git a/src/main/java/com/rabbitmq/client/impl/UpdateSecretExtension.java b/src/main/java/com/rabbitmq/client/impl/UpdateSecretExtension.java new file mode 100644 index 0000000000..b54b90635c --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/UpdateSecretExtension.java @@ -0,0 +1,108 @@ +// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl; + +import com.rabbitmq.client.LongString; + +import java.io.IOException; +import java.util.Objects; + +/** + * Helper for update-secret extension {@link com.rabbitmq.client.Method}. + *

+ * {@link com.rabbitmq.client.Method} classes are usually automatically + * generated, but providing the class directly is necessary in this case + * for some internal CI testing jobs running against RabbitMQ 3.7. + * + * @since 5.8.0 + */ +abstract class UpdateSecretExtension { + + static class UpdateSecret extends Method { + + private final LongString newSecret; + private final String reason; + + public UpdateSecret(LongString newSecret, String reason) { + if (newSecret == null) + throw new IllegalStateException("Invalid configuration: 'newSecret' must be non-null."); + if (reason == null) + throw new IllegalStateException("Invalid configuration: 'reason' must be non-null."); + this.newSecret = newSecret; + this.reason = reason; + } + + public String getReason() { + return reason; + } + + public int protocolClassId() { + return 10; + } + + public int protocolMethodId() { + return 70; + } + + public String protocolMethodName() { + return "connection.update-secret"; + } + + public boolean hasContent() { + return false; + } + + public Object visit(AMQImpl.MethodVisitor visitor) throws IOException { + return null; + } + + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + UpdateSecret that = (UpdateSecret) o; + if (!Objects.equals(newSecret, that.newSecret)) + return false; + return Objects.equals(reason, that.reason); + } + + @Override + public int hashCode() { + int result = 0; + result = 31 * result + (newSecret != null ? newSecret.hashCode() : 0); + result = 31 * result + (reason != null ? reason.hashCode() : 0); + return result; + } + + public void appendArgumentDebugStringTo(StringBuilder acc) { + acc.append("(new-secret=") + .append(this.newSecret) + .append(", reason=") + .append(this.reason) + .append(")"); + } + + public void writeArgumentsTo(MethodArgumentWriter writer) + throws IOException { + writer.writeLongstr(this.newSecret); + writer.writeShortstr(this.reason); + } + } +} + diff --git a/src/test/java/com/rabbitmq/client/impl/AMQConnectionRefreshCredentialsTest.java b/src/test/java/com/rabbitmq/client/impl/AMQConnectionRefreshCredentialsTest.java index d0978e1e61..6293b39a1c 100644 --- a/src/test/java/com/rabbitmq/client/impl/AMQConnectionRefreshCredentialsTest.java +++ b/src/test/java/com/rabbitmq/client/impl/AMQConnectionRefreshCredentialsTest.java @@ -66,9 +66,9 @@ public boolean processAsync(Command c) throws IOException { @Override public AMQCommand rpc(Method m) throws IOException, ShutdownSignalException { - if (m instanceof AMQImpl.Connection.UpdateSecret) { + if (m instanceof UpdateSecretExtension.UpdateSecret) { super.rpc(m); - return super.rpc(new AMQImpl.Connection.UpdateSecret(LongStringHelper.asLongString(""), "Refresh scheduled by client") { + return super.rpc(new UpdateSecretExtension.UpdateSecret(LongStringHelper.asLongString(""), "Refresh scheduled by client") { @Override public int protocolMethodId() { return 255; From 1cda0a8031047f530a931b24d9387ebebabeca4c Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Tue, 17 Sep 2019 09:49:13 +0000 Subject: [PATCH 178/328] [maven-release-plugin] prepare release v5.8.0.RC2 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5d97a72dab..0d4e065d51 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.8.0-SNAPSHOT + 5.8.0.RC2 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.8.0.RC2 From e4b0c2752d0b86aecdaea4053170e2cc0ebbefcc Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Tue, 17 Sep 2019 09:49:19 +0000 Subject: [PATCH 179/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 0d4e065d51..5d97a72dab 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.8.0.RC2 + 5.8.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.8.0.RC2 + HEAD From b4f12c0fe04d12c3d61f1c9f1d70384a32ee54e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 17 Sep 2019 11:58:58 +0200 Subject: [PATCH 180/328] Set release version to 5.8.0.RC3 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index e3a47a9087..7449317a41 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,2 +1,2 @@ -RELEASE_VERSION="5.8.0.RC2" +RELEASE_VERSION="5.8.0.RC3" DEVELOPMENT_VERSION="5.8.0-SNAPSHOT" From 58b04fc76514cd0a8427229ecc4c5519317ddb55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 18 Sep 2019 15:13:22 +0200 Subject: [PATCH 181/328] Delete test queue It would sit in the broker after the test suite because it is not exclusive and was not deleted. (cherry picked from commit 3210e096d4ac02ecc6fc537accab00e1e4bfb3b1) --- .../java/com/rabbitmq/client/test/functional/Confirm.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/java/com/rabbitmq/client/test/functional/Confirm.java b/src/test/java/com/rabbitmq/client/test/functional/Confirm.java index 20adb70886..3e66e18f15 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Confirm.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Confirm.java @@ -66,6 +66,12 @@ public void setUp() throws IOException, TimeoutException { "confirm-multiple-queues"); } + @Override + protected void releaseResources() throws IOException { + super.releaseResources(); + channel.queueDelete("confirm-durable-nonexclusive"); + } + @Test public void persistentMandatoryCombinations() throws IOException, InterruptedException, TimeoutException { boolean b[] = { false, true }; From e60bd3a89f8d899078c0601b91b8087e81eb8efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 24 Sep 2019 10:14:10 +0200 Subject: [PATCH 182/328] Bump Jackson to 2.9.10 To address CVE-2019-14540 and CVE-2019-16335. Note Jackson is an optional dependency, required only when using the JSON-RPC support. (cherry picked from commit 0eda16cc3e81e5325eec70333cd85b2eadd493ad) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5d97a72dab..2639a9fdec 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ 1.7.28 4.1.0 1.2.1 - 2.9.9.3 + 2.9.10 1.2.3 4.12 4.0.1 From 47e7aa4c355f3ca44d0af8118ae26576d05b7393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 7 Oct 2019 17:46:36 +0200 Subject: [PATCH 183/328] Add release branch entry to release version file --- release-versions.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/release-versions.txt b/release-versions.txt index 7449317a41..d5cd6fe9bf 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,2 +1,3 @@ RELEASE_VERSION="5.8.0.RC3" DEVELOPMENT_VERSION="5.8.0-SNAPSHOT" +RELEASE_BRANCH="5.x.x-stable" From 0cdf59a4cfc7b84510a455bdace5533a83c30437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 5 Nov 2019 11:43:50 +0000 Subject: [PATCH 184/328] Bump Jackson to 2.10.0 (cherry picked from commit 3e9e1b81546e63bb66a45dfa5ffca2d9dbf96b06) Conflicts: pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2639a9fdec..012c55a062 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ 1.7.28 4.1.0 1.2.1 - 2.9.10 + 2.10.0 1.2.3 4.12 4.0.1 From 1e3efdce7344ec0063cc0ade212bfea5745c0500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 12 Dec 2019 14:07:59 +0100 Subject: [PATCH 185/328] Bump dependencies References #625 (cherry picked from commit 2586694d43e924201098340d8a140e9ede4d2a3f) --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 012c55a062..112f0e2cca 100644 --- a/pom.xml +++ b/pom.xml @@ -54,10 +54,10 @@ UTF-8 UTF-8 - 1.7.28 - 4.1.0 - 1.2.1 - 2.10.0 + 1.7.29 + 4.1.2 + 1.3.2 + 2.10.1 1.2.3 4.12 4.0.1 From c643faf9cfe7e893cd615984e6805ec254a30f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 12 Dec 2019 14:10:46 +0100 Subject: [PATCH 186/328] Bump test dependencies (cherry picked from commit 1f6edae538d377226b49a7390aee426fe24055e3) --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 112f0e2cca..b68cfcd1cd 100644 --- a/pom.xml +++ b/pom.xml @@ -61,10 +61,10 @@ 1.2.3 4.12 4.0.1 - 3.0.0 - 3.13.2 - 9.4.20.v20190813 - 1.63 + 3.2.0 + 3.14.0 + 9.4.24.v20191120 + 1.64 3.1.1 2.5.3 From c0f158ce6696d834f24c9277871b7518c88d2af0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 12 Dec 2019 14:43:10 +0100 Subject: [PATCH 187/328] Set release version to 5.8.0 --- release-versions.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release-versions.txt b/release-versions.txt index d5cd6fe9bf..302b34ece6 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,3 +1,3 @@ -RELEASE_VERSION="5.8.0.RC3" -DEVELOPMENT_VERSION="5.8.0-SNAPSHOT" +RELEASE_VERSION="5.8.0" +DEVELOPMENT_VERSION="5.8.1-SNAPSHOT" RELEASE_BRANCH="5.x.x-stable" From 3e1921b93a8baa91b7eedc3a986687402cbb7df3 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Thu, 12 Dec 2019 13:45:03 +0000 Subject: [PATCH 188/328] [maven-release-plugin] prepare release v5.8.0 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index b68cfcd1cd..5fc18abfd3 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.8.0-SNAPSHOT + 5.8.0 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.8.0 From 44f3e62fdd34769a1183be911bf7f05e07f17d8d Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Thu, 12 Dec 2019 13:45:10 +0000 Subject: [PATCH 189/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5fc18abfd3..8f6246fa08 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.8.0 + 5.8.1-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.8.0 + HEAD From fe2acc31dd1099be5ebc4807204602418e50aa64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 12 Dec 2019 14:55:25 +0100 Subject: [PATCH 190/328] Set release version to 5.8.1.RC1 --- release-versions.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release-versions.txt b/release-versions.txt index 302b34ece6..67caefa314 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,3 +1,3 @@ -RELEASE_VERSION="5.8.0" +RELEASE_VERSION="5.8.1.RC1" DEVELOPMENT_VERSION="5.8.1-SNAPSHOT" -RELEASE_BRANCH="5.x.x-stable" +RELEASE_BRANCH="5.8.x-stable" From da3d2f0fc86930a539a0933d59c19e786f9b6bf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 12 Dec 2019 14:56:38 +0100 Subject: [PATCH 191/328] Set release version to 5.9.0.RC1 --- release-versions.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/release-versions.txt b/release-versions.txt index 67caefa314..5682da02e8 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,3 +1,3 @@ -RELEASE_VERSION="5.8.1.RC1" -DEVELOPMENT_VERSION="5.8.1-SNAPSHOT" -RELEASE_BRANCH="5.8.x-stable" +RELEASE_VERSION="5.9.0.RC1" +DEVELOPMENT_VERSION="5.9.0-SNAPSHOT" +RELEASE_BRANCH="5.x.x-stable" From c832a3ff781ae6d58f1e6472e4a572a61941b5ab Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Sat, 28 Dec 2019 19:35:38 +0300 Subject: [PATCH 192/328] (c) bump (cherry picked from commit 24400f9d06142dd2586bf71964c4036118235e29) --- src/main/java/com/rabbitmq/client/impl/AMQConnection.java | 4 ++-- .../java/com/rabbitmq/client/impl/CredentialsProvider.java | 2 +- .../com/rabbitmq/client/impl/DefaultCredentialsProvider.java | 2 +- src/main/java/com/rabbitmq/client/impl/ValueReader.java | 2 +- src/main/java/com/rabbitmq/client/impl/ValueWriter.java | 2 +- .../java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java | 2 +- src/test/java/com/rabbitmq/client/test/TestUtils.java | 2 +- .../java/com/rabbitmq/client/test/functional/Metrics.java | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java index 0d45cf0bb2..8ed2740588 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 Pivotal Software, Inc. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 @@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicBoolean; final class Copyright { - final static String COPYRIGHT="Copyright (c) 2007-2019 Pivotal Software, Inc."; + final static String COPYRIGHT="Copyright (c) 2007-2020 Pivotal Software, Inc."; final static String LICENSE="Licensed under the MPL. See https://www.rabbitmq.com/"; } diff --git a/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java index e4f6bda06a..61bf56713f 100644 --- a/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java +++ b/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 Pivotal Software, Inc. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsProvider.java index 20cbbe3acc..cd58019bf6 100644 --- a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsProvider.java +++ b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsProvider.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 Pivotal Software, Inc. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/ValueReader.java b/src/main/java/com/rabbitmq/client/impl/ValueReader.java index 8a9e860443..32cf9a3732 100644 --- a/src/main/java/com/rabbitmq/client/impl/ValueReader.java +++ b/src/main/java/com/rabbitmq/client/impl/ValueReader.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 Pivotal Software, Inc. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/ValueWriter.java b/src/main/java/com/rabbitmq/client/impl/ValueWriter.java index 0c997d1545..7340cbd718 100644 --- a/src/main/java/com/rabbitmq/client/impl/ValueWriter.java +++ b/src/main/java/com/rabbitmq/client/impl/ValueWriter.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 Pivotal Software, Inc. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java index 7a5d77337b..6c1775cf8c 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 Pivotal Software, Inc. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/TestUtils.java b/src/test/java/com/rabbitmq/client/test/TestUtils.java index e2890ab4bc..57d80db95c 100644 --- a/src/test/java/com/rabbitmq/client/test/TestUtils.java +++ b/src/test/java/com/rabbitmq/client/test/TestUtils.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 Pivotal Software, Inc. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/Metrics.java b/src/test/java/com/rabbitmq/client/test/functional/Metrics.java index 94d76bfe2d..a39770f125 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Metrics.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Metrics.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 Pivotal Software, Inc. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 From e1e1d5e5e23289e6a0c56b3a6236dd37fec7ce5b Mon Sep 17 00:00:00 2001 From: janssk1 Date: Mon, 3 Feb 2020 11:51:51 +0100 Subject: [PATCH 193/328] 637: Configurable correlatorId generation for RPCClient Change-Id: I17d7a214d3336ad6e5fe890857a48b457ea599b6 (cherry picked from commit e554e4bfe58c4f75cdf44e8e05357a9e61cb2f28) --- .../IncrementingCorrelationIdGenerator.java | 18 +++++++++++++ .../java/com/rabbitmq/client/RpcClient.java | 18 +++++-------- .../com/rabbitmq/client/RpcClientParams.java | 12 +++++++++ .../com/rabbitmq/client/test/RpcTest.java | 25 ++++++++++++++++--- 4 files changed, 57 insertions(+), 16 deletions(-) create mode 100644 src/main/java/com/rabbitmq/client/IncrementingCorrelationIdGenerator.java diff --git a/src/main/java/com/rabbitmq/client/IncrementingCorrelationIdGenerator.java b/src/main/java/com/rabbitmq/client/IncrementingCorrelationIdGenerator.java new file mode 100644 index 0000000000..3b712cfcdf --- /dev/null +++ b/src/main/java/com/rabbitmq/client/IncrementingCorrelationIdGenerator.java @@ -0,0 +1,18 @@ +package com.rabbitmq.client; + +import java.util.function.Supplier; + +public class IncrementingCorrelationIdGenerator implements Supplier { + + private final String _prefix; + private int _correlationId; + + public IncrementingCorrelationIdGenerator(String _prefix) { + this._prefix = _prefix; + } + + @Override + public String get() { + return _prefix + _correlationId++; + } +} diff --git a/src/main/java/com/rabbitmq/client/RpcClient.java b/src/main/java/com/rabbitmq/client/RpcClient.java index 53563b0e8c..4a72ee8602 100644 --- a/src/main/java/com/rabbitmq/client/RpcClient.java +++ b/src/main/java/com/rabbitmq/client/RpcClient.java @@ -28,6 +28,7 @@ import java.util.Map.Entry; import java.util.concurrent.TimeoutException; import java.util.function.Function; +import java.util.function.Supplier; import com.rabbitmq.client.impl.MethodArgumentReader; import com.rabbitmq.client.impl.MethodArgumentWriter; @@ -79,12 +80,14 @@ public class RpcClient { } }; + public static Supplier DEFAULT_CORRELATION_ID_GENERATOR = new IncrementingCorrelationIdGenerator(""); + private final Function _replyHandler; /** Map from request correlation ID to continuation BlockingCell */ private final Map> _continuationMap = new HashMap>(); /** Contains the most recently-used request correlation ID */ - private int _correlationId; + private final Supplier _correlationIdGenerator; /** Consumer attached to our reply queue */ private DefaultConsumer _consumer; @@ -109,7 +112,7 @@ public RpcClient(RpcClientParams params) throws _timeout = params.getTimeout(); _useMandatory = params.shouldUseMandatory(); _replyHandler = params.getReplyHandler(); - _correlationId = 0; + _correlationIdGenerator = params.getCorrelationIdGenerator(); _consumer = setupConsumer(); if (_useMandatory) { @@ -293,8 +296,7 @@ public Response doCall(AMQP.BasicProperties props, byte[] message, int timeout) BlockingCell k = new BlockingCell(); String replyId; synchronized (_continuationMap) { - _correlationId++; - replyId = "" + _correlationId; + replyId = _correlationIdGenerator.get(); props = ((props==null) ? new AMQP.BasicProperties.Builder() : props.builder()) .correlationId(replyId).replyTo(_replyTo).build(); _continuationMap.put(replyId, k); @@ -474,14 +476,6 @@ public Map> getContinuationMap() { return _continuationMap; } - /** - * Retrieve the correlation id. - * @return the most recently used correlation id - */ - public int getCorrelationId() { - return _correlationId; - } - /** * Retrieve the consumer. * @return an interface to the client's consumer object diff --git a/src/main/java/com/rabbitmq/client/RpcClientParams.java b/src/main/java/com/rabbitmq/client/RpcClientParams.java index ce046a6cb6..da3d56b9f8 100644 --- a/src/main/java/com/rabbitmq/client/RpcClientParams.java +++ b/src/main/java/com/rabbitmq/client/RpcClientParams.java @@ -16,6 +16,7 @@ package com.rabbitmq.client; import java.util.function.Function; +import java.util.function.Supplier; /** * Holder class to configure a {@link RpcClient}. @@ -54,6 +55,8 @@ public class RpcClientParams { */ private Function replyHandler = RpcClient.DEFAULT_REPLY_HANDLER; + private Supplier correlationIdGenerator = RpcClient.DEFAULT_CORRELATION_ID_GENERATOR; + /** * Set the channel to use for communication. * @@ -170,6 +173,15 @@ public boolean shouldUseMandatory() { return useMandatory; } + public RpcClientParams correlationIdGenerator(Supplier correlationIdGenerator) { + this.correlationIdGenerator = correlationIdGenerator; + return this; + } + + public Supplier getCorrelationIdGenerator() { + return correlationIdGenerator; + } + public Function getReplyHandler() { return replyHandler; } diff --git a/src/test/java/com/rabbitmq/client/test/RpcTest.java b/src/test/java/com/rabbitmq/client/test/RpcTest.java index 66251738d3..8837f726c7 100644 --- a/src/test/java/com/rabbitmq/client/test/RpcTest.java +++ b/src/test/java/com/rabbitmq/client/test/RpcTest.java @@ -24,6 +24,7 @@ import com.rabbitmq.client.impl.recovery.RecordedQueue; import com.rabbitmq.client.impl.recovery.TopologyRecoveryFilter; import com.rabbitmq.tools.Host; +import org.hamcrest.CoreMatchers; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -39,9 +40,7 @@ import java.util.concurrent.atomic.AtomicInteger; import static org.awaitility.Awaitility.waitAtMost; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.Assert.*; public class RpcTest { @@ -138,6 +137,25 @@ public void rpcUnroutableWithMandatoryFlagShouldThrowUnroutableException() throw client.close(); } + @Test + public void rpcCustomCorrelatorId() throws Exception { + rpcServer = new TestRpcServer(serverChannel, queue); + new Thread(() -> { + try { + rpcServer.mainloop(); + } catch (Exception e) { + // safe to ignore when loops ends/server is canceled + } + }).start(); + RpcClient client = new RpcClient(new RpcClientParams() + .channel(clientChannel).exchange("").routingKey(queue).timeout(1000) + .correlationIdGenerator(new IncrementingCorrelationIdGenerator("myPrefix-")) + ); + RpcClient.Response response = client.doCall(null, "hello".getBytes()); + assertThat(response.getProperties().getCorrelationId(), CoreMatchers.equalTo("myPrefix-0")); + client.close(); + } + @Test public void rpcCustomReplyHandler() throws Exception { rpcServer = new TestRpcServer(serverChannel, queue); @@ -156,7 +174,6 @@ public void rpcCustomReplyHandler() throws Exception { return RpcClient.DEFAULT_REPLY_HANDLER.apply(reply); }) ); - assertEquals(0, replyHandlerCalls.get()); RpcClient.Response response = client.doCall(null, "hello".getBytes()); assertEquals(1, replyHandlerCalls.get()); assertEquals("*** hello ***", new String(response.getBody())); From 466dcf6d5792cb79863d47c565c3377a5eebf61b Mon Sep 17 00:00:00 2001 From: janssk1 Date: Mon, 3 Feb 2020 14:09:57 +0100 Subject: [PATCH 194/328] 637: Default generator should not be static Change-Id: I3bb119f3f7debeb0d45ff81dc9154e26635f03bb (cherry picked from commit 102cbbde18310edea0d6428adc686f07229d9839) --- src/main/java/com/rabbitmq/client/RpcClient.java | 2 -- src/main/java/com/rabbitmq/client/RpcClientParams.java | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/RpcClient.java b/src/main/java/com/rabbitmq/client/RpcClient.java index 4a72ee8602..03599c516c 100644 --- a/src/main/java/com/rabbitmq/client/RpcClient.java +++ b/src/main/java/com/rabbitmq/client/RpcClient.java @@ -80,8 +80,6 @@ public class RpcClient { } }; - public static Supplier DEFAULT_CORRELATION_ID_GENERATOR = new IncrementingCorrelationIdGenerator(""); - private final Function _replyHandler; /** Map from request correlation ID to continuation BlockingCell */ diff --git a/src/main/java/com/rabbitmq/client/RpcClientParams.java b/src/main/java/com/rabbitmq/client/RpcClientParams.java index da3d56b9f8..db32896cd5 100644 --- a/src/main/java/com/rabbitmq/client/RpcClientParams.java +++ b/src/main/java/com/rabbitmq/client/RpcClientParams.java @@ -55,7 +55,7 @@ public class RpcClientParams { */ private Function replyHandler = RpcClient.DEFAULT_REPLY_HANDLER; - private Supplier correlationIdGenerator = RpcClient.DEFAULT_CORRELATION_ID_GENERATOR; + private Supplier correlationIdGenerator = new IncrementingCorrelationIdGenerator(""); /** * Set the channel to use for communication. From 5ee2a77c932161459a56d076767a396335335353 Mon Sep 17 00:00:00 2001 From: janssk1 Date: Tue, 4 Feb 2020 18:49:45 +0100 Subject: [PATCH 195/328] 637: Default generator should not be static Change-Id: Ib1f90d5a25f1c5db32ff9c838cfbeb35aac5d671 (cherry picked from commit 59e9455d5eef03dee4e934e5c21219645fdd81fb) --- .../client/IncrementingCorrelationIdGenerator.java | 4 ++++ src/main/java/com/rabbitmq/client/RpcClient.java | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/main/java/com/rabbitmq/client/IncrementingCorrelationIdGenerator.java b/src/main/java/com/rabbitmq/client/IncrementingCorrelationIdGenerator.java index 3b712cfcdf..e9f8012627 100644 --- a/src/main/java/com/rabbitmq/client/IncrementingCorrelationIdGenerator.java +++ b/src/main/java/com/rabbitmq/client/IncrementingCorrelationIdGenerator.java @@ -15,4 +15,8 @@ public IncrementingCorrelationIdGenerator(String _prefix) { public String get() { return _prefix + _correlationId++; } + + public int getCorrelationId() { + return _correlationId; + } } diff --git a/src/main/java/com/rabbitmq/client/RpcClient.java b/src/main/java/com/rabbitmq/client/RpcClient.java index 03599c516c..df0ed91fe2 100644 --- a/src/main/java/com/rabbitmq/client/RpcClient.java +++ b/src/main/java/com/rabbitmq/client/RpcClient.java @@ -474,6 +474,19 @@ public Map> getContinuationMap() { return _continuationMap; } + /** + * Retrieve the correlation id. + * @return the most recently used correlation id + * @deprecated Only works for {@link IncrementingCorrelationIdGenerator} + */ + public int getCorrelationId() { + if (_correlationIdGenerator instanceof IncrementingCorrelationIdGenerator) { + return ((IncrementingCorrelationIdGenerator) _correlationIdGenerator).getCorrelationId(); + } else { + throw new UnsupportedOperationException(); + } + } + /** * Retrieve the consumer. * @return an interface to the client's consumer object From 177c4ea56c4ad3fbfb507701a4c46d5fdcae7a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 17 Feb 2020 12:13:31 +0100 Subject: [PATCH 196/328] Polish correlation ID supplier support in RPC client References #637 (cherry picked from commit 96b24b38516cef7eb011d5e4d5d1cb91cb1c0fb5) --- .../IncrementingCorrelationIdGenerator.java | 22 ------ .../java/com/rabbitmq/client/RpcClient.java | 75 ++++++++++++++++--- .../com/rabbitmq/client/RpcClientParams.java | 24 ++++-- .../com/rabbitmq/client/test/RpcTest.java | 13 ++-- 4 files changed, 90 insertions(+), 44 deletions(-) delete mode 100644 src/main/java/com/rabbitmq/client/IncrementingCorrelationIdGenerator.java diff --git a/src/main/java/com/rabbitmq/client/IncrementingCorrelationIdGenerator.java b/src/main/java/com/rabbitmq/client/IncrementingCorrelationIdGenerator.java deleted file mode 100644 index e9f8012627..0000000000 --- a/src/main/java/com/rabbitmq/client/IncrementingCorrelationIdGenerator.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.rabbitmq.client; - -import java.util.function.Supplier; - -public class IncrementingCorrelationIdGenerator implements Supplier { - - private final String _prefix; - private int _correlationId; - - public IncrementingCorrelationIdGenerator(String _prefix) { - this._prefix = _prefix; - } - - @Override - public String get() { - return _prefix + _correlationId++; - } - - public int getCorrelationId() { - return _correlationId; - } -} diff --git a/src/main/java/com/rabbitmq/client/RpcClient.java b/src/main/java/com/rabbitmq/client/RpcClient.java index df0ed91fe2..7c83c7eb2b 100644 --- a/src/main/java/com/rabbitmq/client/RpcClient.java +++ b/src/main/java/com/rabbitmq/client/RpcClient.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 Pivotal Software, Inc. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 @@ -84,9 +84,16 @@ public class RpcClient { /** Map from request correlation ID to continuation BlockingCell */ private final Map> _continuationMap = new HashMap>(); - /** Contains the most recently-used request correlation ID */ + + /** + * Generates correlation ID for each request. + * + * @since 5.9.0 + */ private final Supplier _correlationIdGenerator; + private String lastCorrelationId = "0"; + /** Consumer attached to our reply queue */ private DefaultConsumer _consumer; @@ -110,7 +117,7 @@ public RpcClient(RpcClientParams params) throws _timeout = params.getTimeout(); _useMandatory = params.shouldUseMandatory(); _replyHandler = params.getReplyHandler(); - _correlationIdGenerator = params.getCorrelationIdGenerator(); + _correlationIdGenerator = params.getCorrelationIdSupplier(); _consumer = setupConsumer(); if (_useMandatory) { @@ -295,6 +302,7 @@ public Response doCall(AMQP.BasicProperties props, byte[] message, int timeout) String replyId; synchronized (_continuationMap) { replyId = _correlationIdGenerator.get(); + lastCorrelationId = replyId; props = ((props==null) ? new AMQP.BasicProperties.Builder() : props.builder()) .correlationId(replyId).replyTo(_replyTo).build(); _continuationMap.put(replyId, k); @@ -475,16 +483,21 @@ public Map> getContinuationMap() { } /** - * Retrieve the correlation id. + * Retrieve the last correlation id used. + *

+ * Note as of 5.9.0, correlation IDs may not always be integers + * (by default, they are). + * This method will try to parse the last correlation ID string + * as an integer, so this may result in {@link NumberFormatException} + * if the correlation ID supplier provided by + * {@link RpcClientParams#correlationIdSupplier(Supplier)} + * does not generate appropriate IDs. + * * @return the most recently used correlation id - * @deprecated Only works for {@link IncrementingCorrelationIdGenerator} + * @see RpcClientParams#correlationIdSupplier(Supplier) */ public int getCorrelationId() { - if (_correlationIdGenerator instanceof IncrementingCorrelationIdGenerator) { - return ((IncrementingCorrelationIdGenerator) _correlationIdGenerator).getCorrelationId(); - } else { - throw new UnsupportedOperationException(); - } + return Integer.valueOf(this.lastCorrelationId); } /** @@ -532,5 +545,47 @@ public byte[] getBody() { return body; } } + + /** + * Creates generation IDs as a sequence of integers. + * + * @return + * @see RpcClientParams#correlationIdSupplier(Supplier) + * @since 5.9.0 + */ + public static Supplier incrementingCorrelationIdSupplier() { + return incrementingCorrelationIdSupplier(""); + } + + /** + * Creates generation IDs as a sequence of integers, with the provided prefix. + * + * @param prefix + * @return + * @see RpcClientParams#correlationIdSupplier(Supplier) + * @since 5.9.0 + */ + public static Supplier incrementingCorrelationIdSupplier(String prefix) { + return new IncrementingCorrelationIdSupplier(prefix); + } + + /** + * @since 5.9.0 + */ + private static class IncrementingCorrelationIdSupplier implements Supplier { + + private final String prefix; + private int correlationId; + + public IncrementingCorrelationIdSupplier(String prefix) { + this.prefix = prefix; + } + + @Override + public String get() { + return prefix + ++correlationId; + } + + } } diff --git a/src/main/java/com/rabbitmq/client/RpcClientParams.java b/src/main/java/com/rabbitmq/client/RpcClientParams.java index db32896cd5..870756e25a 100644 --- a/src/main/java/com/rabbitmq/client/RpcClientParams.java +++ b/src/main/java/com/rabbitmq/client/RpcClientParams.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 Pivotal Software, Inc. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 @@ -55,7 +55,10 @@ public class RpcClientParams { */ private Function replyHandler = RpcClient.DEFAULT_REPLY_HANDLER; - private Supplier correlationIdGenerator = new IncrementingCorrelationIdGenerator(""); + /** + * Logic to generate correlation IDs. + */ + private Supplier correlationIdSupplier = RpcClient.incrementingCorrelationIdSupplier(); /** * Set the channel to use for communication. @@ -149,7 +152,7 @@ public RpcClientParams timeout(int timeout) { * * @param useMandatory * @return - * @see #replyHandler(RpcClient.RpcClientReplyHandler) + * @see #replyHandler(Function) */ public RpcClientParams useMandatory(boolean useMandatory) { this.useMandatory = useMandatory; @@ -173,13 +176,20 @@ public boolean shouldUseMandatory() { return useMandatory; } - public RpcClientParams correlationIdGenerator(Supplier correlationIdGenerator) { - this.correlationIdGenerator = correlationIdGenerator; + /** + * Logic to generate correlation IDs. + * + * @param correlationIdGenerator + * @return + * @since 5.9.0 + */ + public RpcClientParams correlationIdSupplier(Supplier correlationIdGenerator) { + this.correlationIdSupplier = correlationIdGenerator; return this; } - public Supplier getCorrelationIdGenerator() { - return correlationIdGenerator; + public Supplier getCorrelationIdSupplier() { + return correlationIdSupplier; } public Function getReplyHandler() { diff --git a/src/test/java/com/rabbitmq/client/test/RpcTest.java b/src/test/java/com/rabbitmq/client/test/RpcTest.java index 8837f726c7..027c1e081a 100644 --- a/src/test/java/com/rabbitmq/client/test/RpcTest.java +++ b/src/test/java/com/rabbitmq/client/test/RpcTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 Pivotal Software, Inc. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 @@ -24,7 +24,7 @@ import com.rabbitmq.client.impl.recovery.RecordedQueue; import com.rabbitmq.client.impl.recovery.TopologyRecoveryFilter; import com.rabbitmq.tools.Host; -import org.hamcrest.CoreMatchers; +import org.assertj.core.api.Assertions; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -86,6 +86,9 @@ public void rpc() throws Exception { assertEquals("*** hello ***", new String(response.getBody())); assertEquals("pre-hello", response.getProperties().getHeaders().get("pre").toString()); assertEquals("post-hello", response.getProperties().getHeaders().get("post").toString()); + + Assertions.assertThat(client.getCorrelationId()).isEqualTo(Integer.valueOf(response.getProperties().getCorrelationId())); + client.close(); } @@ -138,7 +141,7 @@ public void rpcUnroutableWithMandatoryFlagShouldThrowUnroutableException() throw } @Test - public void rpcCustomCorrelatorId() throws Exception { + public void rpcCustomCorrelationId() throws Exception { rpcServer = new TestRpcServer(serverChannel, queue); new Thread(() -> { try { @@ -149,10 +152,10 @@ public void rpcCustomCorrelatorId() throws Exception { }).start(); RpcClient client = new RpcClient(new RpcClientParams() .channel(clientChannel).exchange("").routingKey(queue).timeout(1000) - .correlationIdGenerator(new IncrementingCorrelationIdGenerator("myPrefix-")) + .correlationIdSupplier(RpcClient.incrementingCorrelationIdSupplier("myPrefix-")) ); RpcClient.Response response = client.doCall(null, "hello".getBytes()); - assertThat(response.getProperties().getCorrelationId(), CoreMatchers.equalTo("myPrefix-0")); + Assertions.assertThat(response.getProperties().getCorrelationId()).isEqualTo("myPrefix-1"); client.close(); } From f25b038b2524a4526b1ea80f97d99355b35e2849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 17 Feb 2020 14:24:36 +0100 Subject: [PATCH 197/328] Rename property References #637 (cherry picked from commit 52c0643e3f0dd1d65fee7540410e7b611d239435) --- src/main/java/com/rabbitmq/client/RpcClient.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/RpcClient.java b/src/main/java/com/rabbitmq/client/RpcClient.java index 7c83c7eb2b..a49e403f3e 100644 --- a/src/main/java/com/rabbitmq/client/RpcClient.java +++ b/src/main/java/com/rabbitmq/client/RpcClient.java @@ -90,7 +90,7 @@ public class RpcClient { * * @since 5.9.0 */ - private final Supplier _correlationIdGenerator; + private final Supplier _correlationIdSupplier; private String lastCorrelationId = "0"; @@ -117,7 +117,7 @@ public RpcClient(RpcClientParams params) throws _timeout = params.getTimeout(); _useMandatory = params.shouldUseMandatory(); _replyHandler = params.getReplyHandler(); - _correlationIdGenerator = params.getCorrelationIdSupplier(); + _correlationIdSupplier = params.getCorrelationIdSupplier(); _consumer = setupConsumer(); if (_useMandatory) { @@ -301,7 +301,7 @@ public Response doCall(AMQP.BasicProperties props, byte[] message, int timeout) BlockingCell k = new BlockingCell(); String replyId; synchronized (_continuationMap) { - replyId = _correlationIdGenerator.get(); + replyId = _correlationIdSupplier.get(); lastCorrelationId = replyId; props = ((props==null) ? new AMQP.BasicProperties.Builder() : props.builder()) .correlationId(replyId).replyTo(_replyTo).build(); From 29dc1c825fca5e088d78828bfdbec739636067e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 1 Apr 2020 16:02:54 +0200 Subject: [PATCH 198/328] Change copyright and organization name to VMware --- LICENSE-MPL-RabbitMQ | 2 +- codegen.py | 4 ++-- pom.xml | 4 ++-- src/main/java/com/rabbitmq/client/Address.java | 2 +- src/main/java/com/rabbitmq/client/AddressResolver.java | 2 +- src/main/java/com/rabbitmq/client/AlreadyClosedException.java | 2 +- .../com/rabbitmq/client/AuthenticationFailureException.java | 2 +- src/main/java/com/rabbitmq/client/BasicProperties.java | 2 +- src/main/java/com/rabbitmq/client/BlockedCallback.java | 2 +- src/main/java/com/rabbitmq/client/BlockedListener.java | 2 +- src/main/java/com/rabbitmq/client/CancelCallback.java | 2 +- src/main/java/com/rabbitmq/client/Channel.java | 2 +- src/main/java/com/rabbitmq/client/Command.java | 2 +- src/main/java/com/rabbitmq/client/ConfirmCallback.java | 2 +- src/main/java/com/rabbitmq/client/ConfirmListener.java | 2 +- src/main/java/com/rabbitmq/client/Connection.java | 2 +- src/main/java/com/rabbitmq/client/ConnectionFactory.java | 2 +- .../com/rabbitmq/client/ConnectionFactoryConfigurator.java | 2 +- src/main/java/com/rabbitmq/client/Consumer.java | 2 +- .../java/com/rabbitmq/client/ConsumerCancelledException.java | 2 +- .../com/rabbitmq/client/ConsumerShutdownSignalCallback.java | 2 +- src/main/java/com/rabbitmq/client/ContentHeader.java | 2 +- src/main/java/com/rabbitmq/client/DefaultConsumer.java | 2 +- src/main/java/com/rabbitmq/client/DefaultSaslConfig.java | 2 +- .../com/rabbitmq/client/DefaultSocketChannelConfigurator.java | 2 +- .../java/com/rabbitmq/client/DefaultSocketConfigurator.java | 2 +- src/main/java/com/rabbitmq/client/DeliverCallback.java | 2 +- src/main/java/com/rabbitmq/client/Delivery.java | 2 +- .../java/com/rabbitmq/client/DnsRecordIpAddressResolver.java | 2 +- .../java/com/rabbitmq/client/DnsSrvRecordAddressResolver.java | 2 +- src/main/java/com/rabbitmq/client/Envelope.java | 2 +- src/main/java/com/rabbitmq/client/ExceptionHandler.java | 2 +- src/main/java/com/rabbitmq/client/GetResponse.java | 2 +- src/main/java/com/rabbitmq/client/JDKSaslConfig.java | 2 +- src/main/java/com/rabbitmq/client/ListAddressResolver.java | 2 +- src/main/java/com/rabbitmq/client/LongString.java | 2 +- .../java/com/rabbitmq/client/MalformedFrameException.java | 2 +- src/main/java/com/rabbitmq/client/MapRpcServer.java | 2 +- src/main/java/com/rabbitmq/client/MessageProperties.java | 2 +- src/main/java/com/rabbitmq/client/Method.java | 2 +- src/main/java/com/rabbitmq/client/MetricsCollector.java | 2 +- .../java/com/rabbitmq/client/MissedHeartbeatException.java | 2 +- src/main/java/com/rabbitmq/client/NoOpMetricsCollector.java | 2 +- .../client/PossibleAuthenticationFailureException.java | 2 +- .../com/rabbitmq/client/ProtocolVersionMismatchException.java | 2 +- src/main/java/com/rabbitmq/client/Recoverable.java | 2 +- src/main/java/com/rabbitmq/client/RecoveryDelayHandler.java | 2 +- src/main/java/com/rabbitmq/client/RecoveryListener.java | 2 +- src/main/java/com/rabbitmq/client/Return.java | 2 +- src/main/java/com/rabbitmq/client/ReturnCallback.java | 2 +- src/main/java/com/rabbitmq/client/ReturnListener.java | 2 +- src/main/java/com/rabbitmq/client/RpcClient.java | 2 +- src/main/java/com/rabbitmq/client/RpcClientParams.java | 2 +- src/main/java/com/rabbitmq/client/RpcServer.java | 2 +- src/main/java/com/rabbitmq/client/SaslConfig.java | 2 +- src/main/java/com/rabbitmq/client/SaslMechanism.java | 2 +- src/main/java/com/rabbitmq/client/ShutdownListener.java | 2 +- src/main/java/com/rabbitmq/client/ShutdownNotifier.java | 2 +- .../java/com/rabbitmq/client/ShutdownSignalException.java | 2 +- .../java/com/rabbitmq/client/SocketChannelConfigurator.java | 2 +- .../java/com/rabbitmq/client/SocketChannelConfigurators.java | 2 +- src/main/java/com/rabbitmq/client/SocketConfigurator.java | 2 +- src/main/java/com/rabbitmq/client/SocketConfigurators.java | 2 +- src/main/java/com/rabbitmq/client/SslContextFactory.java | 2 +- src/main/java/com/rabbitmq/client/SslEngineConfigurator.java | 2 +- src/main/java/com/rabbitmq/client/SslEngineConfigurators.java | 2 +- src/main/java/com/rabbitmq/client/StringRpcServer.java | 2 +- .../java/com/rabbitmq/client/TopologyRecoveryException.java | 2 +- .../java/com/rabbitmq/client/TrustEverythingTrustManager.java | 2 +- src/main/java/com/rabbitmq/client/UnblockedCallback.java | 2 +- src/main/java/com/rabbitmq/client/UnexpectedFrameError.java | 2 +- src/main/java/com/rabbitmq/client/UnexpectedMethodError.java | 2 +- src/main/java/com/rabbitmq/client/UnknownClassOrMethodId.java | 2 +- .../com/rabbitmq/client/UnroutableRpcRequestException.java | 2 +- .../java/com/rabbitmq/client/impl/AMQBasicProperties.java | 2 +- src/main/java/com/rabbitmq/client/impl/AMQChannel.java | 2 +- src/main/java/com/rabbitmq/client/impl/AMQCommand.java | 2 +- src/main/java/com/rabbitmq/client/impl/AMQConnection.java | 4 ++-- src/main/java/com/rabbitmq/client/impl/AMQContentHeader.java | 2 +- .../com/rabbitmq/client/impl/AbstractMetricsCollector.java | 2 +- src/main/java/com/rabbitmq/client/impl/CRDemoMechanism.java | 2 +- src/main/java/com/rabbitmq/client/impl/ChannelManager.java | 2 +- src/main/java/com/rabbitmq/client/impl/ChannelN.java | 2 +- src/main/java/com/rabbitmq/client/impl/ClientVersion.java | 2 +- src/main/java/com/rabbitmq/client/impl/CommandAssembler.java | 2 +- .../com/rabbitmq/client/impl/CompletableFutureRpcWrapper.java | 2 +- src/main/java/com/rabbitmq/client/impl/ConnectionParams.java | 2 +- .../java/com/rabbitmq/client/impl/ConsumerDispatcher.java | 2 +- .../java/com/rabbitmq/client/impl/ConsumerWorkService.java | 2 +- .../com/rabbitmq/client/impl/ContentHeaderPropertyReader.java | 2 +- .../com/rabbitmq/client/impl/ContentHeaderPropertyWriter.java | 2 +- .../java/com/rabbitmq/client/impl/CredentialsProvider.java | 2 +- .../com/rabbitmq/client/impl/CredentialsRefreshService.java | 2 +- .../com/rabbitmq/client/impl/DefaultCredentialsProvider.java | 2 +- .../client/impl/DefaultCredentialsRefreshService.java | 2 +- .../com/rabbitmq/client/impl/DefaultExceptionHandler.java | 2 +- src/main/java/com/rabbitmq/client/impl/Environment.java | 2 +- .../java/com/rabbitmq/client/impl/ErrorOnWriteListener.java | 2 +- src/main/java/com/rabbitmq/client/impl/ExternalMechanism.java | 2 +- .../com/rabbitmq/client/impl/ForgivingExceptionHandler.java | 2 +- src/main/java/com/rabbitmq/client/impl/Frame.java | 2 +- src/main/java/com/rabbitmq/client/impl/FrameHandler.java | 2 +- src/main/java/com/rabbitmq/client/impl/HeartbeatSender.java | 2 +- src/main/java/com/rabbitmq/client/impl/LongStringHelper.java | 2 +- src/main/java/com/rabbitmq/client/impl/Method.java | 2 +- .../java/com/rabbitmq/client/impl/MethodArgumentReader.java | 2 +- .../java/com/rabbitmq/client/impl/MethodArgumentWriter.java | 2 +- .../com/rabbitmq/client/impl/MicrometerMetricsCollector.java | 2 +- src/main/java/com/rabbitmq/client/impl/NetworkConnection.java | 2 +- .../impl/OAuth2ClientCredentialsGrantCredentialsProvider.java | 2 +- .../rabbitmq/client/impl/OAuthTokenManagementException.java | 2 +- src/main/java/com/rabbitmq/client/impl/PlainMechanism.java | 2 +- .../client/impl/RefreshProtectedCredentialsProvider.java | 2 +- .../com/rabbitmq/client/impl/RpcContinuationRpcWrapper.java | 2 +- src/main/java/com/rabbitmq/client/impl/RpcWrapper.java | 2 +- src/main/java/com/rabbitmq/client/impl/SetQueue.java | 2 +- .../com/rabbitmq/client/impl/ShutdownNotifierComponent.java | 2 +- .../java/com/rabbitmq/client/impl/SocketFrameHandler.java | 2 +- .../com/rabbitmq/client/impl/SocketFrameHandlerFactory.java | 2 +- .../com/rabbitmq/client/impl/StandardMetricsCollector.java | 2 +- .../java/com/rabbitmq/client/impl/StrictExceptionHandler.java | 2 +- src/main/java/com/rabbitmq/client/impl/TlsUtils.java | 2 +- .../java/com/rabbitmq/client/impl/TruncatedInputStream.java | 2 +- .../com/rabbitmq/client/impl/UnknownChannelException.java | 2 +- .../java/com/rabbitmq/client/impl/UpdateSecretExtension.java | 2 +- src/main/java/com/rabbitmq/client/impl/ValueReader.java | 2 +- src/main/java/com/rabbitmq/client/impl/ValueWriter.java | 2 +- .../com/rabbitmq/client/impl/VariableLinkedBlockingQueue.java | 4 ++-- src/main/java/com/rabbitmq/client/impl/Version.java | 2 +- src/main/java/com/rabbitmq/client/impl/WorkPool.java | 2 +- .../java/com/rabbitmq/client/impl/WorkPoolFullException.java | 2 +- .../com/rabbitmq/client/impl/nio/ByteBufferOutputStream.java | 2 +- src/main/java/com/rabbitmq/client/impl/nio/FrameBuilder.java | 2 +- .../java/com/rabbitmq/client/impl/nio/FrameWriteRequest.java | 2 +- .../java/com/rabbitmq/client/impl/nio/HeaderWriteRequest.java | 2 +- src/main/java/com/rabbitmq/client/impl/nio/NioHelper.java | 2 +- src/main/java/com/rabbitmq/client/impl/nio/NioLoop.java | 2 +- .../java/com/rabbitmq/client/impl/nio/NioLoopContext.java | 2 +- src/main/java/com/rabbitmq/client/impl/nio/NioParams.java | 2 +- .../java/com/rabbitmq/client/impl/nio/SelectorHolder.java | 2 +- .../rabbitmq/client/impl/nio/SocketChannelFrameHandler.java | 2 +- .../client/impl/nio/SocketChannelFrameHandlerFactory.java | 2 +- .../client/impl/nio/SocketChannelFrameHandlerState.java | 2 +- .../rabbitmq/client/impl/nio/SocketChannelRegistration.java | 2 +- .../client/impl/nio/SslEngineByteBufferOutputStream.java | 2 +- .../com/rabbitmq/client/impl/nio/SslEngineFrameBuilder.java | 2 +- .../java/com/rabbitmq/client/impl/nio/SslEngineHelper.java | 2 +- src/main/java/com/rabbitmq/client/impl/nio/WriteRequest.java | 2 +- .../rabbitmq/client/impl/recovery/AutorecoveringChannel.java | 2 +- .../client/impl/recovery/AutorecoveringConnection.java | 2 +- .../java/com/rabbitmq/client/impl/recovery/BackoffPolicy.java | 2 +- .../client/impl/recovery/ConsumerRecoveryListener.java | 2 +- .../rabbitmq/client/impl/recovery/DefaultRetryHandler.java | 2 +- .../rabbitmq/client/impl/recovery/QueueRecoveryListener.java | 2 +- .../com/rabbitmq/client/impl/recovery/RecordedBinding.java | 2 +- .../com/rabbitmq/client/impl/recovery/RecordedConsumer.java | 2 +- .../com/rabbitmq/client/impl/recovery/RecordedEntity.java | 2 +- .../com/rabbitmq/client/impl/recovery/RecordedExchange.java | 2 +- .../client/impl/recovery/RecordedExchangeBinding.java | 2 +- .../rabbitmq/client/impl/recovery/RecordedNamedEntity.java | 2 +- .../java/com/rabbitmq/client/impl/recovery/RecordedQueue.java | 2 +- .../rabbitmq/client/impl/recovery/RecordedQueueBinding.java | 2 +- .../client/impl/recovery/RecoveryAwareAMQConnection.java | 2 +- .../impl/recovery/RecoveryAwareAMQConnectionFactory.java | 2 +- .../client/impl/recovery/RecoveryAwareChannelManager.java | 2 +- .../rabbitmq/client/impl/recovery/RecoveryAwareChannelN.java | 2 +- .../client/impl/recovery/RecoveryCanBeginListener.java | 2 +- .../java/com/rabbitmq/client/impl/recovery/RetryContext.java | 2 +- .../java/com/rabbitmq/client/impl/recovery/RetryHandler.java | 2 +- .../java/com/rabbitmq/client/impl/recovery/RetryResult.java | 2 +- .../rabbitmq/client/impl/recovery/TopologyRecoveryFilter.java | 2 +- .../impl/recovery/TopologyRecoveryRetryHandlerBuilder.java | 2 +- .../client/impl/recovery/TopologyRecoveryRetryLogic.java | 2 +- src/main/java/com/rabbitmq/tools/json/JSONReader.java | 4 ++-- src/main/java/com/rabbitmq/tools/json/JSONSerializable.java | 2 +- src/main/java/com/rabbitmq/tools/json/JSONUtil.java | 2 +- src/main/java/com/rabbitmq/tools/json/JSONWriter.java | 4 ++-- .../java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java | 2 +- .../java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java | 2 +- src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java | 2 +- .../java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java | 2 +- src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java | 2 +- .../com/rabbitmq/tools/jsonrpc/JsonRpcMappingException.java | 2 +- src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java | 2 +- .../java/com/rabbitmq/tools/jsonrpc/ParameterDescription.java | 2 +- .../java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java | 2 +- .../java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java | 2 +- src/main/java/com/rabbitmq/utility/BlockingCell.java | 2 +- .../java/com/rabbitmq/utility/BlockingValueOrException.java | 2 +- src/main/java/com/rabbitmq/utility/IntAllocator.java | 2 +- src/main/java/com/rabbitmq/utility/SensibleClone.java | 2 +- src/main/java/com/rabbitmq/utility/Utility.java | 2 +- src/main/java/com/rabbitmq/utility/ValueOrException.java | 2 +- src/test/java/com/rabbitmq/client/AbstractJsonRpcTest.java | 2 +- src/test/java/com/rabbitmq/client/DefaultJsonRpcTest.java | 2 +- src/test/java/com/rabbitmq/client/JacksonJsonRpcTest.java | 2 +- src/test/java/com/rabbitmq/client/QueueingConsumer.java | 2 +- .../client/impl/AMQConnectionRefreshCredentialsTest.java | 2 +- .../client/impl/DefaultCredentialsRefreshServiceTest.java | 2 +- .../OAuth2ClientCredentialsGrantCredentialsProviderTest.java | 2 +- .../client/impl/RefreshProtectedCredentialsProviderTest.java | 2 +- src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java | 2 +- src/test/java/com/rabbitmq/client/impl/WorkPoolTests.java | 2 +- src/test/java/com/rabbitmq/client/test/AMQBuilderApiTest.java | 2 +- src/test/java/com/rabbitmq/client/test/AMQChannelTest.java | 2 +- src/test/java/com/rabbitmq/client/test/AMQConnectionTest.java | 2 +- .../java/com/rabbitmq/client/test/AbstractRMQTestSuite.java | 2 +- src/test/java/com/rabbitmq/client/test/AddressTest.java | 2 +- src/test/java/com/rabbitmq/client/test/AmqpUriTest.java | 2 +- src/test/java/com/rabbitmq/client/test/BlockingCellTest.java | 2 +- src/test/java/com/rabbitmq/client/test/BrokenFramesTest.java | 2 +- src/test/java/com/rabbitmq/client/test/BrokerTestCase.java | 2 +- src/test/java/com/rabbitmq/client/test/Bug20004Test.java | 2 +- .../client/test/ChannelAsyncCompletableFutureTest.java | 2 +- src/test/java/com/rabbitmq/client/test/ChannelNTest.java | 2 +- .../rabbitmq/client/test/ChannelNumberAllocationTests.java | 2 +- .../client/test/ChannelRpcTimeoutIntegrationTest.java | 2 +- src/test/java/com/rabbitmq/client/test/ClientTests.java | 2 +- src/test/java/com/rabbitmq/client/test/ClientVersionTest.java | 2 +- .../java/com/rabbitmq/client/test/ClonePropertiesTest.java | 2 +- src/test/java/com/rabbitmq/client/test/CloseInMainLoop.java | 2 +- src/test/java/com/rabbitmq/client/test/ConfirmBase.java | 2 +- .../java/com/rabbitmq/client/test/ConnectionFactoryTest.java | 2 +- src/test/java/com/rabbitmq/client/test/ConnectionTest.java | 2 +- .../com/rabbitmq/client/test/DefaultRetryHandlerTest.java | 2 +- .../rabbitmq/client/test/DnsSrvRecordAddressResolverTest.java | 2 +- src/test/java/com/rabbitmq/client/test/FrameBuilderTest.java | 2 +- .../java/com/rabbitmq/client/test/GeneratedClassesTest.java | 2 +- src/test/java/com/rabbitmq/client/test/JSONReadWriteTest.java | 2 +- .../java/com/rabbitmq/client/test/LambdaCallbackTest.java | 2 +- src/test/java/com/rabbitmq/client/test/LongStringTest.java | 2 +- .../java/com/rabbitmq/client/test/MetricsCollectorTest.java | 2 +- .../rabbitmq/client/test/MicrometerMetricsCollectorTest.java | 2 +- .../java/com/rabbitmq/client/test/MultiThreadedChannel.java | 2 +- .../rabbitmq/client/test/NioDeadlockOnConnectionClosing.java | 2 +- .../client/test/NoAutoRecoveryWhenTcpWindowIsFullTest.java | 2 +- .../rabbitmq/client/test/PropertyFileInitialisationTest.java | 2 +- .../java/com/rabbitmq/client/test/QueueingConsumerTests.java | 2 +- .../client/test/RecoveryAwareAMQConnectionFactoryTest.java | 2 +- .../com/rabbitmq/client/test/RecoveryDelayHandlerTest.java | 2 +- .../java/com/rabbitmq/client/test/RefreshCredentialsTest.java | 2 +- src/test/java/com/rabbitmq/client/test/RpcTest.java | 2 +- .../com/rabbitmq/client/test/RpcTopologyRecordingTest.java | 2 +- .../java/com/rabbitmq/client/test/SharedThreadPoolTest.java | 2 +- .../java/com/rabbitmq/client/test/SslContextFactoryTest.java | 2 +- .../com/rabbitmq/client/test/StrictExceptionHandlerTest.java | 2 +- src/test/java/com/rabbitmq/client/test/TableTest.java | 2 +- src/test/java/com/rabbitmq/client/test/TestUtils.java | 2 +- src/test/java/com/rabbitmq/client/test/TestUtilsTest.java | 2 +- src/test/java/com/rabbitmq/client/test/TlsUtilsTest.java | 2 +- .../java/com/rabbitmq/client/test/TrafficListenerTest.java | 2 +- .../com/rabbitmq/client/test/TruncatedInputStreamTest.java | 2 +- .../java/com/rabbitmq/client/test/ValueOrExceptionTest.java | 2 +- .../rabbitmq/client/test/functional/AbstractRejectTest.java | 2 +- .../rabbitmq/client/test/functional/AlternateExchange.java | 2 +- .../java/com/rabbitmq/client/test/functional/BasicGet.java | 2 +- .../com/rabbitmq/client/test/functional/BindingLifecycle.java | 2 +- .../rabbitmq/client/test/functional/BindingLifecycleBase.java | 2 +- .../java/com/rabbitmq/client/test/functional/CcRoutes.java | 2 +- .../rabbitmq/client/test/functional/ClusteredTestBase.java | 2 +- .../java/com/rabbitmq/client/test/functional/Confirm.java | 2 +- .../com/rabbitmq/client/test/functional/ConnectionOpen.java | 2 +- .../rabbitmq/client/test/functional/ConnectionRecovery.java | 2 +- .../client/test/functional/ConsumerCancelNotification.java | 2 +- .../com/rabbitmq/client/test/functional/ConsumerCount.java | 2 +- .../rabbitmq/client/test/functional/ConsumerPriorities.java | 2 +- .../rabbitmq/client/test/functional/DeadLetterExchange.java | 2 +- .../com/rabbitmq/client/test/functional/DefaultExchange.java | 2 +- .../com/rabbitmq/client/test/functional/DirectReplyTo.java | 2 +- .../com/rabbitmq/client/test/functional/DoubleDeletion.java | 2 +- .../rabbitmq/client/test/functional/DurableOnTransient.java | 2 +- .../rabbitmq/client/test/functional/ExceptionHandling.java | 2 +- .../rabbitmq/client/test/functional/ExceptionMessages.java | 2 +- .../com/rabbitmq/client/test/functional/ExchangeDeclare.java | 2 +- .../client/test/functional/ExchangeDeleteIfUnused.java | 2 +- .../client/test/functional/ExchangeDeletePredeclared.java | 2 +- .../client/test/functional/ExchangeEquivalenceBase.java | 2 +- .../client/test/functional/ExchangeExchangeBindings.java | 2 +- .../test/functional/ExchangeExchangeBindingsAutoDelete.java | 2 +- .../java/com/rabbitmq/client/test/functional/FrameMax.java | 2 +- .../com/rabbitmq/client/test/functional/FunctionalTests.java | 2 +- .../client/test/functional/HeadersExchangeValidation.java | 2 +- .../java/com/rabbitmq/client/test/functional/Heartbeat.java | 2 +- .../com/rabbitmq/client/test/functional/InternalExchange.java | 2 +- .../java/com/rabbitmq/client/test/functional/InvalidAcks.java | 2 +- .../com/rabbitmq/client/test/functional/InvalidAcksBase.java | 2 +- .../com/rabbitmq/client/test/functional/InvalidAcksTx.java | 2 +- .../com/rabbitmq/client/test/functional/MessageCount.java | 2 +- .../java/com/rabbitmq/client/test/functional/Metrics.java | 2 +- src/test/java/com/rabbitmq/client/test/functional/Nack.java | 2 +- .../rabbitmq/client/test/functional/NoRequeueOnCancel.java | 2 +- src/test/java/com/rabbitmq/client/test/functional/Nowait.java | 2 +- .../rabbitmq/client/test/functional/PerConsumerPrefetch.java | 2 +- .../com/rabbitmq/client/test/functional/PerMessageTTL.java | 2 +- .../java/com/rabbitmq/client/test/functional/PerQueueTTL.java | 2 +- .../client/test/functional/PerQueueVsPerMessageTTL.java | 2 +- .../java/com/rabbitmq/client/test/functional/Policies.java | 2 +- .../java/com/rabbitmq/client/test/functional/QosTests.java | 2 +- .../com/rabbitmq/client/test/functional/QueueExclusivity.java | 2 +- .../java/com/rabbitmq/client/test/functional/QueueLease.java | 2 +- .../com/rabbitmq/client/test/functional/QueueLifecycle.java | 2 +- .../com/rabbitmq/client/test/functional/QueueSizeLimit.java | 2 +- .../java/com/rabbitmq/client/test/functional/Recover.java | 2 +- src/test/java/com/rabbitmq/client/test/functional/Reject.java | 2 +- .../client/test/functional/RequeueOnChannelClose.java | 2 +- .../com/rabbitmq/client/test/functional/RequeueOnClose.java | 2 +- .../client/test/functional/RequeueOnConnectionClose.java | 2 +- .../java/com/rabbitmq/client/test/functional/Routing.java | 2 +- .../com/rabbitmq/client/test/functional/SaslMechanisms.java | 2 +- .../java/com/rabbitmq/client/test/functional/TTLHandling.java | 2 +- src/test/java/com/rabbitmq/client/test/functional/Tables.java | 2 +- .../client/test/functional/TopologyRecoveryFiltering.java | 2 +- .../client/test/functional/TopologyRecoveryRetry.java | 2 +- .../com/rabbitmq/client/test/functional/Transactions.java | 2 +- .../client/test/functional/UnbindAutoDeleteExchange.java | 2 +- .../com/rabbitmq/client/test/functional/UnexpectedFrames.java | 2 +- .../com/rabbitmq/client/test/functional/UserIDHeader.java | 2 +- .../java/com/rabbitmq/client/test/server/AbsentQueue.java | 2 +- .../client/test/server/AlternateExchangeEquivalence.java | 2 +- .../com/rabbitmq/client/test/server/BlockedConnection.java | 2 +- .../java/com/rabbitmq/client/test/server/Bug19219Test.java | 2 +- .../rabbitmq/client/test/server/ChannelLimitNegotiation.java | 2 +- .../client/test/server/DeadLetterExchangeDurable.java | 2 +- .../rabbitmq/client/test/server/DurableBindingLifecycle.java | 2 +- .../client/test/server/EffectVisibilityCrossNodeTest.java | 2 +- .../rabbitmq/client/test/server/ExclusiveQueueDurability.java | 2 +- src/test/java/com/rabbitmq/client/test/server/Firehose.java | 2 +- src/test/java/com/rabbitmq/client/test/server/HATests.java | 2 +- .../java/com/rabbitmq/client/test/server/LoopbackUsers.java | 2 +- .../java/com/rabbitmq/client/test/server/MemoryAlarms.java | 2 +- .../java/com/rabbitmq/client/test/server/MessageRecovery.java | 2 +- .../java/com/rabbitmq/client/test/server/Permissions.java | 2 +- .../rabbitmq/client/test/server/PersistenceGuarantees.java | 2 +- .../java/com/rabbitmq/client/test/server/PriorityQueues.java | 2 +- .../java/com/rabbitmq/client/test/server/ServerTests.java | 2 +- src/test/java/com/rabbitmq/client/test/server/Shutdown.java | 2 +- .../com/rabbitmq/client/test/server/TopicPermissions.java | 2 +- .../com/rabbitmq/client/test/server/XDeathHeaderGrowth.java | 2 +- .../com/rabbitmq/client/test/ssl/BadVerifiedConnection.java | 2 +- .../client/test/ssl/ConnectionFactoryDefaultTlsVersion.java | 2 +- .../com/rabbitmq/client/test/ssl/HostnameVerification.java | 2 +- .../rabbitmq/client/test/ssl/NioTlsUnverifiedConnection.java | 2 +- src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java | 2 +- .../com/rabbitmq/client/test/ssl/TlsConnectionLogging.java | 2 +- .../com/rabbitmq/client/test/ssl/UnverifiedConnection.java | 2 +- .../java/com/rabbitmq/client/test/ssl/VerifiedConnection.java | 2 +- src/test/java/com/rabbitmq/tools/Host.java | 2 +- src/test/java/com/rabbitmq/utility/IntAllocatorTests.java | 2 +- 348 files changed, 354 insertions(+), 354 deletions(-) diff --git a/LICENSE-MPL-RabbitMQ b/LICENSE-MPL-RabbitMQ index b237a959b0..50770c2540 100644 --- a/LICENSE-MPL-RabbitMQ +++ b/LICENSE-MPL-RabbitMQ @@ -447,7 +447,7 @@ EXHIBIT A -Mozilla Public License. The Original Code is RabbitMQ. The Initial Developer of the Original Code is GoPivotal, Inc. - Copyright (c) 2007-2016 Pivotal Software, Inc. All rights reserved. + Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. Alternatively, the contents of this file may be used under the terms of the GNU General Public License version 2 (the "GPL2"), or diff --git a/codegen.py b/codegen.py index 3a67ce435d..42c577a0d9 100755 --- a/codegen.py +++ b/codegen.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -## Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +## Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. ## ## This software, the RabbitMQ Java client library, is triple-licensed under the ## Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 @@ -130,7 +130,7 @@ def printFileHeader(): print("""// NOTE: This -*- java -*- source code is autogenerated from the AMQP // specification! // -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/pom.xml b/pom.xml index 8f6246fa08..0c79405b3b 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,7 @@ info@rabbitmq.com Team RabbitMQ - Pivotal Software, Inc. + VMware, Inc. or its affiliates. https://rabbitmq.com @@ -46,7 +46,7 @@ - Pivotal Software, Inc. + VMware, Inc. or its affiliates. https://www.rabbitmq.com diff --git a/src/main/java/com/rabbitmq/client/Address.java b/src/main/java/com/rabbitmq/client/Address.java index c70ae34df7..26b9cd9d3e 100644 --- a/src/main/java/com/rabbitmq/client/Address.java +++ b/src/main/java/com/rabbitmq/client/Address.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/AddressResolver.java b/src/main/java/com/rabbitmq/client/AddressResolver.java index 10ad17cb44..4a4f0d8461 100644 --- a/src/main/java/com/rabbitmq/client/AddressResolver.java +++ b/src/main/java/com/rabbitmq/client/AddressResolver.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/AlreadyClosedException.java b/src/main/java/com/rabbitmq/client/AlreadyClosedException.java index 06cca515ac..37060907f9 100644 --- a/src/main/java/com/rabbitmq/client/AlreadyClosedException.java +++ b/src/main/java/com/rabbitmq/client/AlreadyClosedException.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/AuthenticationFailureException.java b/src/main/java/com/rabbitmq/client/AuthenticationFailureException.java index 998bddd2a1..391be6d039 100644 --- a/src/main/java/com/rabbitmq/client/AuthenticationFailureException.java +++ b/src/main/java/com/rabbitmq/client/AuthenticationFailureException.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/BasicProperties.java b/src/main/java/com/rabbitmq/client/BasicProperties.java index 2dc7150cd1..4001508cfb 100644 --- a/src/main/java/com/rabbitmq/client/BasicProperties.java +++ b/src/main/java/com/rabbitmq/client/BasicProperties.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/BlockedCallback.java b/src/main/java/com/rabbitmq/client/BlockedCallback.java index 7e711dfdca..f679e79427 100644 --- a/src/main/java/com/rabbitmq/client/BlockedCallback.java +++ b/src/main/java/com/rabbitmq/client/BlockedCallback.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/BlockedListener.java b/src/main/java/com/rabbitmq/client/BlockedListener.java index 968fbb710c..4e0f820615 100644 --- a/src/main/java/com/rabbitmq/client/BlockedListener.java +++ b/src/main/java/com/rabbitmq/client/BlockedListener.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/CancelCallback.java b/src/main/java/com/rabbitmq/client/CancelCallback.java index c2691f053e..ee6df1964a 100644 --- a/src/main/java/com/rabbitmq/client/CancelCallback.java +++ b/src/main/java/com/rabbitmq/client/CancelCallback.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/Channel.java b/src/main/java/com/rabbitmq/client/Channel.java index b1daa31100..cd0b9b2962 100644 --- a/src/main/java/com/rabbitmq/client/Channel.java +++ b/src/main/java/com/rabbitmq/client/Channel.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/Command.java b/src/main/java/com/rabbitmq/client/Command.java index b6c0e349a0..2630773ecc 100644 --- a/src/main/java/com/rabbitmq/client/Command.java +++ b/src/main/java/com/rabbitmq/client/Command.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/ConfirmCallback.java b/src/main/java/com/rabbitmq/client/ConfirmCallback.java index fff2c9a6d6..41197874e3 100644 --- a/src/main/java/com/rabbitmq/client/ConfirmCallback.java +++ b/src/main/java/com/rabbitmq/client/ConfirmCallback.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/ConfirmListener.java b/src/main/java/com/rabbitmq/client/ConfirmListener.java index 9404588554..51162d9baf 100644 --- a/src/main/java/com/rabbitmq/client/ConfirmListener.java +++ b/src/main/java/com/rabbitmq/client/ConfirmListener.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/Connection.java b/src/main/java/com/rabbitmq/client/Connection.java index 2b1c9281ee..d45c1b90ea 100644 --- a/src/main/java/com/rabbitmq/client/Connection.java +++ b/src/main/java/com/rabbitmq/client/Connection.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index ea79e354f2..b6b1f5b848 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactoryConfigurator.java b/src/main/java/com/rabbitmq/client/ConnectionFactoryConfigurator.java index 694b7626a8..4470760d75 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactoryConfigurator.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactoryConfigurator.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/Consumer.java b/src/main/java/com/rabbitmq/client/Consumer.java index 61e799ae85..118ce0a8f3 100644 --- a/src/main/java/com/rabbitmq/client/Consumer.java +++ b/src/main/java/com/rabbitmq/client/Consumer.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/ConsumerCancelledException.java b/src/main/java/com/rabbitmq/client/ConsumerCancelledException.java index 5d98220fd1..7078cfcf99 100644 --- a/src/main/java/com/rabbitmq/client/ConsumerCancelledException.java +++ b/src/main/java/com/rabbitmq/client/ConsumerCancelledException.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/ConsumerShutdownSignalCallback.java b/src/main/java/com/rabbitmq/client/ConsumerShutdownSignalCallback.java index 27e0f8ad39..fb055dde7e 100644 --- a/src/main/java/com/rabbitmq/client/ConsumerShutdownSignalCallback.java +++ b/src/main/java/com/rabbitmq/client/ConsumerShutdownSignalCallback.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/ContentHeader.java b/src/main/java/com/rabbitmq/client/ContentHeader.java index 36e2ec29d2..ddb7d52b14 100644 --- a/src/main/java/com/rabbitmq/client/ContentHeader.java +++ b/src/main/java/com/rabbitmq/client/ContentHeader.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/DefaultConsumer.java b/src/main/java/com/rabbitmq/client/DefaultConsumer.java index 84ca404549..0e1670d39a 100644 --- a/src/main/java/com/rabbitmq/client/DefaultConsumer.java +++ b/src/main/java/com/rabbitmq/client/DefaultConsumer.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/DefaultSaslConfig.java b/src/main/java/com/rabbitmq/client/DefaultSaslConfig.java index 54373d868d..62ac85c4c1 100644 --- a/src/main/java/com/rabbitmq/client/DefaultSaslConfig.java +++ b/src/main/java/com/rabbitmq/client/DefaultSaslConfig.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/DefaultSocketChannelConfigurator.java b/src/main/java/com/rabbitmq/client/DefaultSocketChannelConfigurator.java index 425899532c..38494da70e 100644 --- a/src/main/java/com/rabbitmq/client/DefaultSocketChannelConfigurator.java +++ b/src/main/java/com/rabbitmq/client/DefaultSocketChannelConfigurator.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/DefaultSocketConfigurator.java b/src/main/java/com/rabbitmq/client/DefaultSocketConfigurator.java index e6fa99a5fc..0c3118e049 100644 --- a/src/main/java/com/rabbitmq/client/DefaultSocketConfigurator.java +++ b/src/main/java/com/rabbitmq/client/DefaultSocketConfigurator.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/DeliverCallback.java b/src/main/java/com/rabbitmq/client/DeliverCallback.java index ad44b7cf13..8e17dfb407 100644 --- a/src/main/java/com/rabbitmq/client/DeliverCallback.java +++ b/src/main/java/com/rabbitmq/client/DeliverCallback.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/Delivery.java b/src/main/java/com/rabbitmq/client/Delivery.java index eca6971be4..3e99f20974 100644 --- a/src/main/java/com/rabbitmq/client/Delivery.java +++ b/src/main/java/com/rabbitmq/client/Delivery.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/DnsRecordIpAddressResolver.java b/src/main/java/com/rabbitmq/client/DnsRecordIpAddressResolver.java index a26504c0fc..fb28f16a41 100644 --- a/src/main/java/com/rabbitmq/client/DnsRecordIpAddressResolver.java +++ b/src/main/java/com/rabbitmq/client/DnsRecordIpAddressResolver.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/DnsSrvRecordAddressResolver.java b/src/main/java/com/rabbitmq/client/DnsSrvRecordAddressResolver.java index 1388f716ae..81775fc9f6 100644 --- a/src/main/java/com/rabbitmq/client/DnsSrvRecordAddressResolver.java +++ b/src/main/java/com/rabbitmq/client/DnsSrvRecordAddressResolver.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/Envelope.java b/src/main/java/com/rabbitmq/client/Envelope.java index 3a83a05058..cc8e7ceda1 100644 --- a/src/main/java/com/rabbitmq/client/Envelope.java +++ b/src/main/java/com/rabbitmq/client/Envelope.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/ExceptionHandler.java b/src/main/java/com/rabbitmq/client/ExceptionHandler.java index 45122737b1..3ed8183f28 100644 --- a/src/main/java/com/rabbitmq/client/ExceptionHandler.java +++ b/src/main/java/com/rabbitmq/client/ExceptionHandler.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/GetResponse.java b/src/main/java/com/rabbitmq/client/GetResponse.java index f6980304d6..ba157a0fb9 100644 --- a/src/main/java/com/rabbitmq/client/GetResponse.java +++ b/src/main/java/com/rabbitmq/client/GetResponse.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/JDKSaslConfig.java b/src/main/java/com/rabbitmq/client/JDKSaslConfig.java index 9c1e44a248..d8a240a30e 100644 --- a/src/main/java/com/rabbitmq/client/JDKSaslConfig.java +++ b/src/main/java/com/rabbitmq/client/JDKSaslConfig.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/ListAddressResolver.java b/src/main/java/com/rabbitmq/client/ListAddressResolver.java index e4f80cb20e..a7b3d96657 100644 --- a/src/main/java/com/rabbitmq/client/ListAddressResolver.java +++ b/src/main/java/com/rabbitmq/client/ListAddressResolver.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/LongString.java b/src/main/java/com/rabbitmq/client/LongString.java index ee9a24169a..447ef1e510 100644 --- a/src/main/java/com/rabbitmq/client/LongString.java +++ b/src/main/java/com/rabbitmq/client/LongString.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/MalformedFrameException.java b/src/main/java/com/rabbitmq/client/MalformedFrameException.java index 2d63e5b961..ae799f0f5d 100644 --- a/src/main/java/com/rabbitmq/client/MalformedFrameException.java +++ b/src/main/java/com/rabbitmq/client/MalformedFrameException.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/MapRpcServer.java b/src/main/java/com/rabbitmq/client/MapRpcServer.java index 2671a044cb..93ceaa10fe 100644 --- a/src/main/java/com/rabbitmq/client/MapRpcServer.java +++ b/src/main/java/com/rabbitmq/client/MapRpcServer.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/MessageProperties.java b/src/main/java/com/rabbitmq/client/MessageProperties.java index 4ba9b40e17..8369eeb645 100644 --- a/src/main/java/com/rabbitmq/client/MessageProperties.java +++ b/src/main/java/com/rabbitmq/client/MessageProperties.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/Method.java b/src/main/java/com/rabbitmq/client/Method.java index 393f64cc1b..bd7b8531e7 100644 --- a/src/main/java/com/rabbitmq/client/Method.java +++ b/src/main/java/com/rabbitmq/client/Method.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/MetricsCollector.java b/src/main/java/com/rabbitmq/client/MetricsCollector.java index 31d4480423..9b289d87bd 100644 --- a/src/main/java/com/rabbitmq/client/MetricsCollector.java +++ b/src/main/java/com/rabbitmq/client/MetricsCollector.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/MissedHeartbeatException.java b/src/main/java/com/rabbitmq/client/MissedHeartbeatException.java index 90e8cdb83a..83400d2db5 100644 --- a/src/main/java/com/rabbitmq/client/MissedHeartbeatException.java +++ b/src/main/java/com/rabbitmq/client/MissedHeartbeatException.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/NoOpMetricsCollector.java b/src/main/java/com/rabbitmq/client/NoOpMetricsCollector.java index 30e0d83402..163fe8afe4 100644 --- a/src/main/java/com/rabbitmq/client/NoOpMetricsCollector.java +++ b/src/main/java/com/rabbitmq/client/NoOpMetricsCollector.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/PossibleAuthenticationFailureException.java b/src/main/java/com/rabbitmq/client/PossibleAuthenticationFailureException.java index bbb053d611..d6cca886db 100644 --- a/src/main/java/com/rabbitmq/client/PossibleAuthenticationFailureException.java +++ b/src/main/java/com/rabbitmq/client/PossibleAuthenticationFailureException.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/ProtocolVersionMismatchException.java b/src/main/java/com/rabbitmq/client/ProtocolVersionMismatchException.java index 7b031b9621..8cd857545b 100644 --- a/src/main/java/com/rabbitmq/client/ProtocolVersionMismatchException.java +++ b/src/main/java/com/rabbitmq/client/ProtocolVersionMismatchException.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/Recoverable.java b/src/main/java/com/rabbitmq/client/Recoverable.java index 50dcec5b4d..c4b066f66c 100644 --- a/src/main/java/com/rabbitmq/client/Recoverable.java +++ b/src/main/java/com/rabbitmq/client/Recoverable.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/RecoveryDelayHandler.java b/src/main/java/com/rabbitmq/client/RecoveryDelayHandler.java index 524d3c1786..e00c7d3940 100644 --- a/src/main/java/com/rabbitmq/client/RecoveryDelayHandler.java +++ b/src/main/java/com/rabbitmq/client/RecoveryDelayHandler.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/RecoveryListener.java b/src/main/java/com/rabbitmq/client/RecoveryListener.java index 2e346ae097..968b828521 100644 --- a/src/main/java/com/rabbitmq/client/RecoveryListener.java +++ b/src/main/java/com/rabbitmq/client/RecoveryListener.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/Return.java b/src/main/java/com/rabbitmq/client/Return.java index 5c78977bce..f441a69873 100644 --- a/src/main/java/com/rabbitmq/client/Return.java +++ b/src/main/java/com/rabbitmq/client/Return.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/ReturnCallback.java b/src/main/java/com/rabbitmq/client/ReturnCallback.java index 0f413716e2..1eb1c99271 100644 --- a/src/main/java/com/rabbitmq/client/ReturnCallback.java +++ b/src/main/java/com/rabbitmq/client/ReturnCallback.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/ReturnListener.java b/src/main/java/com/rabbitmq/client/ReturnListener.java index d5094c0d14..2ec72fbc15 100644 --- a/src/main/java/com/rabbitmq/client/ReturnListener.java +++ b/src/main/java/com/rabbitmq/client/ReturnListener.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/RpcClient.java b/src/main/java/com/rabbitmq/client/RpcClient.java index a49e403f3e..7e5a4e4ef6 100644 --- a/src/main/java/com/rabbitmq/client/RpcClient.java +++ b/src/main/java/com/rabbitmq/client/RpcClient.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2020 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/RpcClientParams.java b/src/main/java/com/rabbitmq/client/RpcClientParams.java index 870756e25a..ea1ab30d87 100644 --- a/src/main/java/com/rabbitmq/client/RpcClientParams.java +++ b/src/main/java/com/rabbitmq/client/RpcClientParams.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2020 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/RpcServer.java b/src/main/java/com/rabbitmq/client/RpcServer.java index 457e5f6679..a1bc413c50 100644 --- a/src/main/java/com/rabbitmq/client/RpcServer.java +++ b/src/main/java/com/rabbitmq/client/RpcServer.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/SaslConfig.java b/src/main/java/com/rabbitmq/client/SaslConfig.java index 1db18614dc..d8555cf6b2 100644 --- a/src/main/java/com/rabbitmq/client/SaslConfig.java +++ b/src/main/java/com/rabbitmq/client/SaslConfig.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/SaslMechanism.java b/src/main/java/com/rabbitmq/client/SaslMechanism.java index a98bdcc866..d411f2072e 100644 --- a/src/main/java/com/rabbitmq/client/SaslMechanism.java +++ b/src/main/java/com/rabbitmq/client/SaslMechanism.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/ShutdownListener.java b/src/main/java/com/rabbitmq/client/ShutdownListener.java index 351e0b9b9b..5a2427334f 100644 --- a/src/main/java/com/rabbitmq/client/ShutdownListener.java +++ b/src/main/java/com/rabbitmq/client/ShutdownListener.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/ShutdownNotifier.java b/src/main/java/com/rabbitmq/client/ShutdownNotifier.java index 8802dcdaf9..66aa021d7a 100644 --- a/src/main/java/com/rabbitmq/client/ShutdownNotifier.java +++ b/src/main/java/com/rabbitmq/client/ShutdownNotifier.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/ShutdownSignalException.java b/src/main/java/com/rabbitmq/client/ShutdownSignalException.java index 5e49720382..769158198d 100644 --- a/src/main/java/com/rabbitmq/client/ShutdownSignalException.java +++ b/src/main/java/com/rabbitmq/client/ShutdownSignalException.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/SocketChannelConfigurator.java b/src/main/java/com/rabbitmq/client/SocketChannelConfigurator.java index ceb3a95a88..43307caada 100644 --- a/src/main/java/com/rabbitmq/client/SocketChannelConfigurator.java +++ b/src/main/java/com/rabbitmq/client/SocketChannelConfigurator.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/SocketChannelConfigurators.java b/src/main/java/com/rabbitmq/client/SocketChannelConfigurators.java index 566d3ddc13..0355528b4e 100644 --- a/src/main/java/com/rabbitmq/client/SocketChannelConfigurators.java +++ b/src/main/java/com/rabbitmq/client/SocketChannelConfigurators.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/SocketConfigurator.java b/src/main/java/com/rabbitmq/client/SocketConfigurator.java index 30c9ed4bab..8a49c57d96 100644 --- a/src/main/java/com/rabbitmq/client/SocketConfigurator.java +++ b/src/main/java/com/rabbitmq/client/SocketConfigurator.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/SocketConfigurators.java b/src/main/java/com/rabbitmq/client/SocketConfigurators.java index 551ad95ca9..5d3ea0e280 100644 --- a/src/main/java/com/rabbitmq/client/SocketConfigurators.java +++ b/src/main/java/com/rabbitmq/client/SocketConfigurators.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/SslContextFactory.java b/src/main/java/com/rabbitmq/client/SslContextFactory.java index 9a1fbcac6c..468c1237cd 100644 --- a/src/main/java/com/rabbitmq/client/SslContextFactory.java +++ b/src/main/java/com/rabbitmq/client/SslContextFactory.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/SslEngineConfigurator.java b/src/main/java/com/rabbitmq/client/SslEngineConfigurator.java index 01b22c4c05..6f95bb392a 100644 --- a/src/main/java/com/rabbitmq/client/SslEngineConfigurator.java +++ b/src/main/java/com/rabbitmq/client/SslEngineConfigurator.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java b/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java index 44c2e16f70..0cb7b451d7 100644 --- a/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java +++ b/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/StringRpcServer.java b/src/main/java/com/rabbitmq/client/StringRpcServer.java index 2f8e62bade..375079607a 100644 --- a/src/main/java/com/rabbitmq/client/StringRpcServer.java +++ b/src/main/java/com/rabbitmq/client/StringRpcServer.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/TopologyRecoveryException.java b/src/main/java/com/rabbitmq/client/TopologyRecoveryException.java index 0c2bcc1f5d..cf9d18d105 100644 --- a/src/main/java/com/rabbitmq/client/TopologyRecoveryException.java +++ b/src/main/java/com/rabbitmq/client/TopologyRecoveryException.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/TrustEverythingTrustManager.java b/src/main/java/com/rabbitmq/client/TrustEverythingTrustManager.java index 544c74f1d8..9001d02507 100644 --- a/src/main/java/com/rabbitmq/client/TrustEverythingTrustManager.java +++ b/src/main/java/com/rabbitmq/client/TrustEverythingTrustManager.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/UnblockedCallback.java b/src/main/java/com/rabbitmq/client/UnblockedCallback.java index 8b3b5a6ad5..76ac083ac7 100644 --- a/src/main/java/com/rabbitmq/client/UnblockedCallback.java +++ b/src/main/java/com/rabbitmq/client/UnblockedCallback.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/UnexpectedFrameError.java b/src/main/java/com/rabbitmq/client/UnexpectedFrameError.java index 1bb425f5d8..e8275aec3a 100644 --- a/src/main/java/com/rabbitmq/client/UnexpectedFrameError.java +++ b/src/main/java/com/rabbitmq/client/UnexpectedFrameError.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/UnexpectedMethodError.java b/src/main/java/com/rabbitmq/client/UnexpectedMethodError.java index 8a14ebea87..ab30336a07 100644 --- a/src/main/java/com/rabbitmq/client/UnexpectedMethodError.java +++ b/src/main/java/com/rabbitmq/client/UnexpectedMethodError.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/UnknownClassOrMethodId.java b/src/main/java/com/rabbitmq/client/UnknownClassOrMethodId.java index 6440c8c0c9..1f0e3715f3 100644 --- a/src/main/java/com/rabbitmq/client/UnknownClassOrMethodId.java +++ b/src/main/java/com/rabbitmq/client/UnknownClassOrMethodId.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/UnroutableRpcRequestException.java b/src/main/java/com/rabbitmq/client/UnroutableRpcRequestException.java index 18ad13aa3c..89e9d059f0 100644 --- a/src/main/java/com/rabbitmq/client/UnroutableRpcRequestException.java +++ b/src/main/java/com/rabbitmq/client/UnroutableRpcRequestException.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/AMQBasicProperties.java b/src/main/java/com/rabbitmq/client/impl/AMQBasicProperties.java index 35e2507b0c..591713e706 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQBasicProperties.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQBasicProperties.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/AMQChannel.java b/src/main/java/com/rabbitmq/client/impl/AMQChannel.java index 3cdcf8c50f..837fdef8d9 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQChannel.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQChannel.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/AMQCommand.java b/src/main/java/com/rabbitmq/client/impl/AMQCommand.java index 929eaa3804..0395bb10f6 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQCommand.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQCommand.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java index 8ed2740588..c989b3a972 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2020 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 @@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicBoolean; final class Copyright { - final static String COPYRIGHT="Copyright (c) 2007-2020 Pivotal Software, Inc."; + final static String COPYRIGHT="Copyright (c) 2007-2020 VMware, Inc. or its affiliates."; final static String LICENSE="Licensed under the MPL. See https://www.rabbitmq.com/"; } diff --git a/src/main/java/com/rabbitmq/client/impl/AMQContentHeader.java b/src/main/java/com/rabbitmq/client/impl/AMQContentHeader.java index 97028e2376..523336e0ca 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQContentHeader.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQContentHeader.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/AbstractMetricsCollector.java b/src/main/java/com/rabbitmq/client/impl/AbstractMetricsCollector.java index 435a794481..c0a3c5eb6b 100644 --- a/src/main/java/com/rabbitmq/client/impl/AbstractMetricsCollector.java +++ b/src/main/java/com/rabbitmq/client/impl/AbstractMetricsCollector.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/CRDemoMechanism.java b/src/main/java/com/rabbitmq/client/impl/CRDemoMechanism.java index b61b4d0ad4..e516750b6c 100644 --- a/src/main/java/com/rabbitmq/client/impl/CRDemoMechanism.java +++ b/src/main/java/com/rabbitmq/client/impl/CRDemoMechanism.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/ChannelManager.java b/src/main/java/com/rabbitmq/client/impl/ChannelManager.java index 73b78f71b4..162c141f34 100644 --- a/src/main/java/com/rabbitmq/client/impl/ChannelManager.java +++ b/src/main/java/com/rabbitmq/client/impl/ChannelManager.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/ChannelN.java b/src/main/java/com/rabbitmq/client/impl/ChannelN.java index 5ab12bda20..61f2d0683e 100644 --- a/src/main/java/com/rabbitmq/client/impl/ChannelN.java +++ b/src/main/java/com/rabbitmq/client/impl/ChannelN.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/ClientVersion.java b/src/main/java/com/rabbitmq/client/impl/ClientVersion.java index dcda1072cd..53ec1b927c 100644 --- a/src/main/java/com/rabbitmq/client/impl/ClientVersion.java +++ b/src/main/java/com/rabbitmq/client/impl/ClientVersion.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/CommandAssembler.java b/src/main/java/com/rabbitmq/client/impl/CommandAssembler.java index da65cef8f2..8a2915c0d7 100644 --- a/src/main/java/com/rabbitmq/client/impl/CommandAssembler.java +++ b/src/main/java/com/rabbitmq/client/impl/CommandAssembler.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/CompletableFutureRpcWrapper.java b/src/main/java/com/rabbitmq/client/impl/CompletableFutureRpcWrapper.java index c2a3e5c649..1f1b91f569 100644 --- a/src/main/java/com/rabbitmq/client/impl/CompletableFutureRpcWrapper.java +++ b/src/main/java/com/rabbitmq/client/impl/CompletableFutureRpcWrapper.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/ConnectionParams.java b/src/main/java/com/rabbitmq/client/impl/ConnectionParams.java index 57a028783b..92428fc436 100644 --- a/src/main/java/com/rabbitmq/client/impl/ConnectionParams.java +++ b/src/main/java/com/rabbitmq/client/impl/ConnectionParams.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/ConsumerDispatcher.java b/src/main/java/com/rabbitmq/client/impl/ConsumerDispatcher.java index 91b1e7cb3b..bb22d9f626 100644 --- a/src/main/java/com/rabbitmq/client/impl/ConsumerDispatcher.java +++ b/src/main/java/com/rabbitmq/client/impl/ConsumerDispatcher.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/ConsumerWorkService.java b/src/main/java/com/rabbitmq/client/impl/ConsumerWorkService.java index 128e9f07e9..bb662d98e7 100644 --- a/src/main/java/com/rabbitmq/client/impl/ConsumerWorkService.java +++ b/src/main/java/com/rabbitmq/client/impl/ConsumerWorkService.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyReader.java b/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyReader.java index ca1a13411e..d3502e9fe2 100644 --- a/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyReader.java +++ b/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyReader.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyWriter.java b/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyWriter.java index ad6211ab6d..59440bc7e7 100644 --- a/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyWriter.java +++ b/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyWriter.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java index 61bf56713f..abcfb6af17 100644 --- a/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java +++ b/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2020 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java b/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java index 675fa8fe1b..d365053af1 100644 --- a/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java +++ b/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java @@ -1,4 +1,4 @@ -// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsProvider.java index cd58019bf6..6263524898 100644 --- a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsProvider.java +++ b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsProvider.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2020 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java index d74d749a0d..2beafaad74 100644 --- a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java +++ b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java @@ -1,4 +1,4 @@ -// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/DefaultExceptionHandler.java b/src/main/java/com/rabbitmq/client/impl/DefaultExceptionHandler.java index 8183a9f296..f1a0def2f3 100644 --- a/src/main/java/com/rabbitmq/client/impl/DefaultExceptionHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/DefaultExceptionHandler.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/Environment.java b/src/main/java/com/rabbitmq/client/impl/Environment.java index 8ee8fab995..c7f6c528b0 100644 --- a/src/main/java/com/rabbitmq/client/impl/Environment.java +++ b/src/main/java/com/rabbitmq/client/impl/Environment.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/ErrorOnWriteListener.java b/src/main/java/com/rabbitmq/client/impl/ErrorOnWriteListener.java index 84d493984a..7edf05e994 100644 --- a/src/main/java/com/rabbitmq/client/impl/ErrorOnWriteListener.java +++ b/src/main/java/com/rabbitmq/client/impl/ErrorOnWriteListener.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/ExternalMechanism.java b/src/main/java/com/rabbitmq/client/impl/ExternalMechanism.java index 1983589dd9..5cddc69ac4 100644 --- a/src/main/java/com/rabbitmq/client/impl/ExternalMechanism.java +++ b/src/main/java/com/rabbitmq/client/impl/ExternalMechanism.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/ForgivingExceptionHandler.java b/src/main/java/com/rabbitmq/client/impl/ForgivingExceptionHandler.java index a91bf86f30..e4c2648394 100644 --- a/src/main/java/com/rabbitmq/client/impl/ForgivingExceptionHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/ForgivingExceptionHandler.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/Frame.java b/src/main/java/com/rabbitmq/client/impl/Frame.java index a5fd59e454..f99b9d1260 100644 --- a/src/main/java/com/rabbitmq/client/impl/Frame.java +++ b/src/main/java/com/rabbitmq/client/impl/Frame.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/FrameHandler.java b/src/main/java/com/rabbitmq/client/impl/FrameHandler.java index 91168340be..0e54b34435 100644 --- a/src/main/java/com/rabbitmq/client/impl/FrameHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/FrameHandler.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/HeartbeatSender.java b/src/main/java/com/rabbitmq/client/impl/HeartbeatSender.java index 69b2c00b83..998581d0a5 100644 --- a/src/main/java/com/rabbitmq/client/impl/HeartbeatSender.java +++ b/src/main/java/com/rabbitmq/client/impl/HeartbeatSender.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/LongStringHelper.java b/src/main/java/com/rabbitmq/client/impl/LongStringHelper.java index de5fc3c55e..d80d9a01f3 100644 --- a/src/main/java/com/rabbitmq/client/impl/LongStringHelper.java +++ b/src/main/java/com/rabbitmq/client/impl/LongStringHelper.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/Method.java b/src/main/java/com/rabbitmq/client/impl/Method.java index c89c377546..0b894416ac 100644 --- a/src/main/java/com/rabbitmq/client/impl/Method.java +++ b/src/main/java/com/rabbitmq/client/impl/Method.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/MethodArgumentReader.java b/src/main/java/com/rabbitmq/client/impl/MethodArgumentReader.java index e61ffc5380..24ab627450 100644 --- a/src/main/java/com/rabbitmq/client/impl/MethodArgumentReader.java +++ b/src/main/java/com/rabbitmq/client/impl/MethodArgumentReader.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/MethodArgumentWriter.java b/src/main/java/com/rabbitmq/client/impl/MethodArgumentWriter.java index db2005d32f..02317eec87 100644 --- a/src/main/java/com/rabbitmq/client/impl/MethodArgumentWriter.java +++ b/src/main/java/com/rabbitmq/client/impl/MethodArgumentWriter.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/MicrometerMetricsCollector.java b/src/main/java/com/rabbitmq/client/impl/MicrometerMetricsCollector.java index 17db75e9d9..ab910361df 100644 --- a/src/main/java/com/rabbitmq/client/impl/MicrometerMetricsCollector.java +++ b/src/main/java/com/rabbitmq/client/impl/MicrometerMetricsCollector.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/NetworkConnection.java b/src/main/java/com/rabbitmq/client/impl/NetworkConnection.java index 281e36f892..747a1921a7 100644 --- a/src/main/java/com/rabbitmq/client/impl/NetworkConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/NetworkConnection.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java index 71635b4baa..da3ff81973 100644 --- a/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java +++ b/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java @@ -1,4 +1,4 @@ -// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/OAuthTokenManagementException.java b/src/main/java/com/rabbitmq/client/impl/OAuthTokenManagementException.java index 62db5e07a5..cf17053b24 100644 --- a/src/main/java/com/rabbitmq/client/impl/OAuthTokenManagementException.java +++ b/src/main/java/com/rabbitmq/client/impl/OAuthTokenManagementException.java @@ -1,4 +1,4 @@ -// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/PlainMechanism.java b/src/main/java/com/rabbitmq/client/impl/PlainMechanism.java index 7cd9aa70e8..c586385299 100644 --- a/src/main/java/com/rabbitmq/client/impl/PlainMechanism.java +++ b/src/main/java/com/rabbitmq/client/impl/PlainMechanism.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProvider.java index 21f6bc9780..a4cc01c186 100644 --- a/src/main/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProvider.java +++ b/src/main/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProvider.java @@ -1,4 +1,4 @@ -// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/RpcContinuationRpcWrapper.java b/src/main/java/com/rabbitmq/client/impl/RpcContinuationRpcWrapper.java index da57ffbae7..8fcf901b55 100644 --- a/src/main/java/com/rabbitmq/client/impl/RpcContinuationRpcWrapper.java +++ b/src/main/java/com/rabbitmq/client/impl/RpcContinuationRpcWrapper.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/RpcWrapper.java b/src/main/java/com/rabbitmq/client/impl/RpcWrapper.java index f504908394..84c3bb0363 100644 --- a/src/main/java/com/rabbitmq/client/impl/RpcWrapper.java +++ b/src/main/java/com/rabbitmq/client/impl/RpcWrapper.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/SetQueue.java b/src/main/java/com/rabbitmq/client/impl/SetQueue.java index 0ad6e86ba9..9ab2cd3526 100644 --- a/src/main/java/com/rabbitmq/client/impl/SetQueue.java +++ b/src/main/java/com/rabbitmq/client/impl/SetQueue.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/ShutdownNotifierComponent.java b/src/main/java/com/rabbitmq/client/impl/ShutdownNotifierComponent.java index a8d2a9be93..0ee95e083c 100644 --- a/src/main/java/com/rabbitmq/client/impl/ShutdownNotifierComponent.java +++ b/src/main/java/com/rabbitmq/client/impl/ShutdownNotifierComponent.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/SocketFrameHandler.java b/src/main/java/com/rabbitmq/client/impl/SocketFrameHandler.java index 02cc9a2d2d..8d1d2eee15 100644 --- a/src/main/java/com/rabbitmq/client/impl/SocketFrameHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/SocketFrameHandler.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/SocketFrameHandlerFactory.java b/src/main/java/com/rabbitmq/client/impl/SocketFrameHandlerFactory.java index 687f90d4fd..0391b31297 100644 --- a/src/main/java/com/rabbitmq/client/impl/SocketFrameHandlerFactory.java +++ b/src/main/java/com/rabbitmq/client/impl/SocketFrameHandlerFactory.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/StandardMetricsCollector.java b/src/main/java/com/rabbitmq/client/impl/StandardMetricsCollector.java index ac5896c472..f6273bef19 100644 --- a/src/main/java/com/rabbitmq/client/impl/StandardMetricsCollector.java +++ b/src/main/java/com/rabbitmq/client/impl/StandardMetricsCollector.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/StrictExceptionHandler.java b/src/main/java/com/rabbitmq/client/impl/StrictExceptionHandler.java index dac47024af..d1f54768b0 100644 --- a/src/main/java/com/rabbitmq/client/impl/StrictExceptionHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/StrictExceptionHandler.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/TlsUtils.java b/src/main/java/com/rabbitmq/client/impl/TlsUtils.java index 938c1ad9d4..5b4290f79c 100644 --- a/src/main/java/com/rabbitmq/client/impl/TlsUtils.java +++ b/src/main/java/com/rabbitmq/client/impl/TlsUtils.java @@ -1,4 +1,4 @@ -// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/TruncatedInputStream.java b/src/main/java/com/rabbitmq/client/impl/TruncatedInputStream.java index 0df6d3c492..a572952af8 100644 --- a/src/main/java/com/rabbitmq/client/impl/TruncatedInputStream.java +++ b/src/main/java/com/rabbitmq/client/impl/TruncatedInputStream.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/UnknownChannelException.java b/src/main/java/com/rabbitmq/client/impl/UnknownChannelException.java index 1bf87a0d8f..5e9474c5a9 100644 --- a/src/main/java/com/rabbitmq/client/impl/UnknownChannelException.java +++ b/src/main/java/com/rabbitmq/client/impl/UnknownChannelException.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/UpdateSecretExtension.java b/src/main/java/com/rabbitmq/client/impl/UpdateSecretExtension.java index b54b90635c..5edd65813c 100644 --- a/src/main/java/com/rabbitmq/client/impl/UpdateSecretExtension.java +++ b/src/main/java/com/rabbitmq/client/impl/UpdateSecretExtension.java @@ -1,4 +1,4 @@ -// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/ValueReader.java b/src/main/java/com/rabbitmq/client/impl/ValueReader.java index 32cf9a3732..9611324f3a 100644 --- a/src/main/java/com/rabbitmq/client/impl/ValueReader.java +++ b/src/main/java/com/rabbitmq/client/impl/ValueReader.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2020 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/ValueWriter.java b/src/main/java/com/rabbitmq/client/impl/ValueWriter.java index 7340cbd718..e6167cec7e 100644 --- a/src/main/java/com/rabbitmq/client/impl/ValueWriter.java +++ b/src/main/java/com/rabbitmq/client/impl/ValueWriter.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2020 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/VariableLinkedBlockingQueue.java b/src/main/java/com/rabbitmq/client/impl/VariableLinkedBlockingQueue.java index 33b4303294..97be3a8270 100644 --- a/src/main/java/com/rabbitmq/client/impl/VariableLinkedBlockingQueue.java +++ b/src/main/java/com/rabbitmq/client/impl/VariableLinkedBlockingQueue.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 @@ -14,7 +14,7 @@ // info@rabbitmq.com. /* - * Modifications Copyright 2015 Pivotal Software, Inc and licenced as per + * Modifications Copyright 2015-2020 VMware, Inc. or its affiliates. and licenced as per * the rest of the RabbitMQ Java client. */ diff --git a/src/main/java/com/rabbitmq/client/impl/Version.java b/src/main/java/com/rabbitmq/client/impl/Version.java index addb073176..109359fe3d 100644 --- a/src/main/java/com/rabbitmq/client/impl/Version.java +++ b/src/main/java/com/rabbitmq/client/impl/Version.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/WorkPool.java b/src/main/java/com/rabbitmq/client/impl/WorkPool.java index dfccd33acf..39b8b743b7 100644 --- a/src/main/java/com/rabbitmq/client/impl/WorkPool.java +++ b/src/main/java/com/rabbitmq/client/impl/WorkPool.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/WorkPoolFullException.java b/src/main/java/com/rabbitmq/client/impl/WorkPoolFullException.java index 146d05f414..eba1fe14cf 100644 --- a/src/main/java/com/rabbitmq/client/impl/WorkPoolFullException.java +++ b/src/main/java/com/rabbitmq/client/impl/WorkPoolFullException.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/nio/ByteBufferOutputStream.java b/src/main/java/com/rabbitmq/client/impl/nio/ByteBufferOutputStream.java index a8b951b56a..16fe3f2682 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/ByteBufferOutputStream.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/ByteBufferOutputStream.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/nio/FrameBuilder.java b/src/main/java/com/rabbitmq/client/impl/nio/FrameBuilder.java index 5bb867899f..bc99531070 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/FrameBuilder.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/FrameBuilder.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/nio/FrameWriteRequest.java b/src/main/java/com/rabbitmq/client/impl/nio/FrameWriteRequest.java index 570fa24e5c..33a5ba5b74 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/FrameWriteRequest.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/FrameWriteRequest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/nio/HeaderWriteRequest.java b/src/main/java/com/rabbitmq/client/impl/nio/HeaderWriteRequest.java index 96e35849e4..79e34359c3 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/HeaderWriteRequest.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/HeaderWriteRequest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/nio/NioHelper.java b/src/main/java/com/rabbitmq/client/impl/nio/NioHelper.java index 277025222f..3438013c1f 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/NioHelper.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/NioHelper.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/nio/NioLoop.java b/src/main/java/com/rabbitmq/client/impl/nio/NioLoop.java index e153e721c8..f194eeef42 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/NioLoop.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/NioLoop.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/nio/NioLoopContext.java b/src/main/java/com/rabbitmq/client/impl/nio/NioLoopContext.java index a74a99f5a2..47639cfc35 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/NioLoopContext.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/NioLoopContext.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java b/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java index ea555283cc..fa0f545605 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SelectorHolder.java b/src/main/java/com/rabbitmq/client/impl/nio/SelectorHolder.java index 8542e52cb1..7426280acb 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SelectorHolder.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SelectorHolder.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandler.java b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandler.java index 8e9bab5dc5..d46ce4e0bb 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandler.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java index 784a5f80cd..f4473b8ae3 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerState.java b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerState.java index bea18489c7..b5822fcd91 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerState.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerState.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelRegistration.java b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelRegistration.java index e09dee9010..2befb3d3a6 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelRegistration.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelRegistration.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SslEngineByteBufferOutputStream.java b/src/main/java/com/rabbitmq/client/impl/nio/SslEngineByteBufferOutputStream.java index 11145eae1e..8ec782613d 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SslEngineByteBufferOutputStream.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SslEngineByteBufferOutputStream.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SslEngineFrameBuilder.java b/src/main/java/com/rabbitmq/client/impl/nio/SslEngineFrameBuilder.java index 056470aae4..141bb47293 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SslEngineFrameBuilder.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SslEngineFrameBuilder.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SslEngineHelper.java b/src/main/java/com/rabbitmq/client/impl/nio/SslEngineHelper.java index c4b8a33c26..0de786c7b3 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SslEngineHelper.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SslEngineHelper.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/nio/WriteRequest.java b/src/main/java/com/rabbitmq/client/impl/nio/WriteRequest.java index 635c8bc426..b696bc421f 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/WriteRequest.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/WriteRequest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java index e74170d247..969fb45593 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java index 379961971c..f04e3778d5 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/BackoffPolicy.java b/src/main/java/com/rabbitmq/client/impl/recovery/BackoffPolicy.java index a05c2a8a3c..6ed2a2deef 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/BackoffPolicy.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/BackoffPolicy.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/ConsumerRecoveryListener.java b/src/main/java/com/rabbitmq/client/impl/recovery/ConsumerRecoveryListener.java index 1018f9a332..291528af3e 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/ConsumerRecoveryListener.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/ConsumerRecoveryListener.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java b/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java index ec9a86cbc8..1fa64afa4e 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/QueueRecoveryListener.java b/src/main/java/com/rabbitmq/client/impl/recovery/QueueRecoveryListener.java index ca3d518685..55eef2d9f1 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/QueueRecoveryListener.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/QueueRecoveryListener.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedBinding.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedBinding.java index 4b144ae00b..2cdf188ed7 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedBinding.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedBinding.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedConsumer.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedConsumer.java index 1eb9c7a943..4aa87a2d0b 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedConsumer.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedConsumer.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedEntity.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedEntity.java index b92dd6028b..c55a398563 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedEntity.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedEntity.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedExchange.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedExchange.java index 2884604fdc..d75530fad6 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedExchange.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedExchange.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedExchangeBinding.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedExchangeBinding.java index 3b6d72881d..286b793185 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedExchangeBinding.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedExchangeBinding.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedNamedEntity.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedNamedEntity.java index 7bb2e43514..b00a9c2df4 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedNamedEntity.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedNamedEntity.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java index f446e1682c..6cb43cfdae 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueueBinding.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueueBinding.java index a933ce3acd..09d2636d32 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueueBinding.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueueBinding.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnection.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnection.java index b50e7027e5..94768de1db 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnection.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnectionFactory.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnectionFactory.java index 3b326a76bf..01a172fac3 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnectionFactory.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelManager.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelManager.java index aed1cffc05..b9daf354f2 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelManager.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelManager.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelN.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelN.java index faaa095bf6..206c20a1c7 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelN.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelN.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryCanBeginListener.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryCanBeginListener.java index fc21af6bc6..2c272198b4 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryCanBeginListener.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryCanBeginListener.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RetryContext.java b/src/main/java/com/rabbitmq/client/impl/recovery/RetryContext.java index a9bdc05e5f..60645e199a 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RetryContext.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RetryContext.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RetryHandler.java b/src/main/java/com/rabbitmq/client/impl/recovery/RetryHandler.java index 5ed7f823f0..459ca80080 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RetryHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RetryHandler.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RetryResult.java b/src/main/java/com/rabbitmq/client/impl/recovery/RetryResult.java index c4797c39bf..6c4e693314 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RetryResult.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RetryResult.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryFilter.java b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryFilter.java index d5f0ec9a26..835249ec55 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryFilter.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryFilter.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java index 887a494bc5..c2ad1078d5 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java index 26db1f27a8..8daa2ac33e 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/tools/json/JSONReader.java b/src/main/java/com/rabbitmq/tools/json/JSONReader.java index 5bd332c7bd..c22ee8eb00 100644 --- a/src/main/java/com/rabbitmq/tools/json/JSONReader.java +++ b/src/main/java/com/rabbitmq/tools/json/JSONReader.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 @@ -15,7 +15,7 @@ /* Copyright (c) 2006-2007 Frank Carver - Copyright (c) 2007-2016 Pivotal Software, Inc. All Rights Reserved + Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/main/java/com/rabbitmq/tools/json/JSONSerializable.java b/src/main/java/com/rabbitmq/tools/json/JSONSerializable.java index 39f72d4ac2..e3fdcd1180 100644 --- a/src/main/java/com/rabbitmq/tools/json/JSONSerializable.java +++ b/src/main/java/com/rabbitmq/tools/json/JSONSerializable.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/tools/json/JSONUtil.java b/src/main/java/com/rabbitmq/tools/json/JSONUtil.java index c024e142c8..f814462e5e 100644 --- a/src/main/java/com/rabbitmq/tools/json/JSONUtil.java +++ b/src/main/java/com/rabbitmq/tools/json/JSONUtil.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/tools/json/JSONWriter.java b/src/main/java/com/rabbitmq/tools/json/JSONWriter.java index ec05322c34..187fb5402f 100644 --- a/src/main/java/com/rabbitmq/tools/json/JSONWriter.java +++ b/src/main/java/com/rabbitmq/tools/json/JSONWriter.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 @@ -15,7 +15,7 @@ /* Copyright (c) 2006-2007 Frank Carver - Copyright (c) 2007-2016 Pivotal Software, Inc. All Rights Reserved + Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java b/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java index c9c050e02a..204e68007b 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/DefaultJsonRpcMapper.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java index 6c1775cf8c..8b239eed5b 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2020 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java index 870eadd843..bea5ccf690 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java index 18c0e93b84..c46b95c259 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java index fdad5e1960..6e311dc6e4 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMappingException.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMappingException.java index 03a7d12b91..6a764e6960 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMappingException.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMappingException.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java index 61a3796647..6cfe8eec98 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/ParameterDescription.java b/src/main/java/com/rabbitmq/tools/jsonrpc/ParameterDescription.java index 97fb9d0d01..6106cbf60c 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/ParameterDescription.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/ParameterDescription.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java b/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java index db637d1c38..44ac3a0b76 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java b/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java index a42a1b2f1d..af2029d98c 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/utility/BlockingCell.java b/src/main/java/com/rabbitmq/utility/BlockingCell.java index 7fc8ec5641..9f9dce24a4 100644 --- a/src/main/java/com/rabbitmq/utility/BlockingCell.java +++ b/src/main/java/com/rabbitmq/utility/BlockingCell.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/utility/BlockingValueOrException.java b/src/main/java/com/rabbitmq/utility/BlockingValueOrException.java index 683358c206..77df219b72 100644 --- a/src/main/java/com/rabbitmq/utility/BlockingValueOrException.java +++ b/src/main/java/com/rabbitmq/utility/BlockingValueOrException.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/utility/IntAllocator.java b/src/main/java/com/rabbitmq/utility/IntAllocator.java index 6032a4dcc8..9c1e93cd1f 100644 --- a/src/main/java/com/rabbitmq/utility/IntAllocator.java +++ b/src/main/java/com/rabbitmq/utility/IntAllocator.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/utility/SensibleClone.java b/src/main/java/com/rabbitmq/utility/SensibleClone.java index 01f51b4f21..50405ec0eb 100644 --- a/src/main/java/com/rabbitmq/utility/SensibleClone.java +++ b/src/main/java/com/rabbitmq/utility/SensibleClone.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/utility/Utility.java b/src/main/java/com/rabbitmq/utility/Utility.java index d345717fc4..f4cbbf324d 100644 --- a/src/main/java/com/rabbitmq/utility/Utility.java +++ b/src/main/java/com/rabbitmq/utility/Utility.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/main/java/com/rabbitmq/utility/ValueOrException.java b/src/main/java/com/rabbitmq/utility/ValueOrException.java index d882b28430..7be45ef8a2 100644 --- a/src/main/java/com/rabbitmq/utility/ValueOrException.java +++ b/src/main/java/com/rabbitmq/utility/ValueOrException.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/AbstractJsonRpcTest.java b/src/test/java/com/rabbitmq/client/AbstractJsonRpcTest.java index e9ec771bd7..017cb6e308 100644 --- a/src/test/java/com/rabbitmq/client/AbstractJsonRpcTest.java +++ b/src/test/java/com/rabbitmq/client/AbstractJsonRpcTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/DefaultJsonRpcTest.java b/src/test/java/com/rabbitmq/client/DefaultJsonRpcTest.java index 049554d1d2..42cd9cfa66 100644 --- a/src/test/java/com/rabbitmq/client/DefaultJsonRpcTest.java +++ b/src/test/java/com/rabbitmq/client/DefaultJsonRpcTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/JacksonJsonRpcTest.java b/src/test/java/com/rabbitmq/client/JacksonJsonRpcTest.java index 091ce44680..af9b827810 100644 --- a/src/test/java/com/rabbitmq/client/JacksonJsonRpcTest.java +++ b/src/test/java/com/rabbitmq/client/JacksonJsonRpcTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/QueueingConsumer.java b/src/test/java/com/rabbitmq/client/QueueingConsumer.java index e803720e42..434e7a8d82 100644 --- a/src/test/java/com/rabbitmq/client/QueueingConsumer.java +++ b/src/test/java/com/rabbitmq/client/QueueingConsumer.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/impl/AMQConnectionRefreshCredentialsTest.java b/src/test/java/com/rabbitmq/client/impl/AMQConnectionRefreshCredentialsTest.java index 6293b39a1c..50493bcbd0 100644 --- a/src/test/java/com/rabbitmq/client/impl/AMQConnectionRefreshCredentialsTest.java +++ b/src/test/java/com/rabbitmq/client/impl/AMQConnectionRefreshCredentialsTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java index 7009319b9c..21faa59b15 100644 --- a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java +++ b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java b/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java index e1d1c5abbf..d81722779d 100644 --- a/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java +++ b/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProviderTest.java b/src/test/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProviderTest.java index a96c757e59..d273b3e70b 100644 --- a/src/test/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProviderTest.java +++ b/src/test/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProviderTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java b/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java index 76cbd0d6df..ead66ee8ad 100644 --- a/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java +++ b/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/impl/WorkPoolTests.java b/src/test/java/com/rabbitmq/client/impl/WorkPoolTests.java index fec748d205..30141ef9f0 100644 --- a/src/test/java/com/rabbitmq/client/impl/WorkPoolTests.java +++ b/src/test/java/com/rabbitmq/client/impl/WorkPoolTests.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/AMQBuilderApiTest.java b/src/test/java/com/rabbitmq/client/test/AMQBuilderApiTest.java index 27a3f5b304..9d6fb50abb 100644 --- a/src/test/java/com/rabbitmq/client/test/AMQBuilderApiTest.java +++ b/src/test/java/com/rabbitmq/client/test/AMQBuilderApiTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/AMQChannelTest.java b/src/test/java/com/rabbitmq/client/test/AMQChannelTest.java index 04554f4aa5..cb5f65d4fb 100644 --- a/src/test/java/com/rabbitmq/client/test/AMQChannelTest.java +++ b/src/test/java/com/rabbitmq/client/test/AMQChannelTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/AMQConnectionTest.java b/src/test/java/com/rabbitmq/client/test/AMQConnectionTest.java index ece2e42e05..c278b4cc13 100644 --- a/src/test/java/com/rabbitmq/client/test/AMQConnectionTest.java +++ b/src/test/java/com/rabbitmq/client/test/AMQConnectionTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/AbstractRMQTestSuite.java b/src/test/java/com/rabbitmq/client/test/AbstractRMQTestSuite.java index cb27d22e7c..70fdbaaa6e 100644 --- a/src/test/java/com/rabbitmq/client/test/AbstractRMQTestSuite.java +++ b/src/test/java/com/rabbitmq/client/test/AbstractRMQTestSuite.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/AddressTest.java b/src/test/java/com/rabbitmq/client/test/AddressTest.java index a67bd96c86..ca714b146b 100644 --- a/src/test/java/com/rabbitmq/client/test/AddressTest.java +++ b/src/test/java/com/rabbitmq/client/test/AddressTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java b/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java index 11cd5bf248..9b4b467f9c 100644 --- a/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java +++ b/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/BlockingCellTest.java b/src/test/java/com/rabbitmq/client/test/BlockingCellTest.java index 83cc168694..7c4ef998b0 100644 --- a/src/test/java/com/rabbitmq/client/test/BlockingCellTest.java +++ b/src/test/java/com/rabbitmq/client/test/BlockingCellTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/BrokenFramesTest.java b/src/test/java/com/rabbitmq/client/test/BrokenFramesTest.java index b9853a6731..0d713308d2 100644 --- a/src/test/java/com/rabbitmq/client/test/BrokenFramesTest.java +++ b/src/test/java/com/rabbitmq/client/test/BrokenFramesTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java b/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java index 2608c0ca2e..cda8d3ca44 100644 --- a/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java +++ b/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/Bug20004Test.java b/src/test/java/com/rabbitmq/client/test/Bug20004Test.java index 58581f076f..ac62af0095 100644 --- a/src/test/java/com/rabbitmq/client/test/Bug20004Test.java +++ b/src/test/java/com/rabbitmq/client/test/Bug20004Test.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ChannelAsyncCompletableFutureTest.java b/src/test/java/com/rabbitmq/client/test/ChannelAsyncCompletableFutureTest.java index c6e51f777f..cc1141d116 100644 --- a/src/test/java/com/rabbitmq/client/test/ChannelAsyncCompletableFutureTest.java +++ b/src/test/java/com/rabbitmq/client/test/ChannelAsyncCompletableFutureTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ChannelNTest.java b/src/test/java/com/rabbitmq/client/test/ChannelNTest.java index f6e85e686e..214173a577 100644 --- a/src/test/java/com/rabbitmq/client/test/ChannelNTest.java +++ b/src/test/java/com/rabbitmq/client/test/ChannelNTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ChannelNumberAllocationTests.java b/src/test/java/com/rabbitmq/client/test/ChannelNumberAllocationTests.java index 93329ab822..a3ec4b81f7 100644 --- a/src/test/java/com/rabbitmq/client/test/ChannelNumberAllocationTests.java +++ b/src/test/java/com/rabbitmq/client/test/ChannelNumberAllocationTests.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java b/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java index 875d608d96..87494900a6 100644 --- a/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java +++ b/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ClientTests.java b/src/test/java/com/rabbitmq/client/test/ClientTests.java index 24a86ea7fa..1d1be76fda 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientTests.java +++ b/src/test/java/com/rabbitmq/client/test/ClientTests.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ClientVersionTest.java b/src/test/java/com/rabbitmq/client/test/ClientVersionTest.java index 33b15a956b..3c36dd7015 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientVersionTest.java +++ b/src/test/java/com/rabbitmq/client/test/ClientVersionTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ClonePropertiesTest.java b/src/test/java/com/rabbitmq/client/test/ClonePropertiesTest.java index 153095ee01..6e50f31e29 100644 --- a/src/test/java/com/rabbitmq/client/test/ClonePropertiesTest.java +++ b/src/test/java/com/rabbitmq/client/test/ClonePropertiesTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/CloseInMainLoop.java b/src/test/java/com/rabbitmq/client/test/CloseInMainLoop.java index 623ce9a516..109f8200aa 100644 --- a/src/test/java/com/rabbitmq/client/test/CloseInMainLoop.java +++ b/src/test/java/com/rabbitmq/client/test/CloseInMainLoop.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ConfirmBase.java b/src/test/java/com/rabbitmq/client/test/ConfirmBase.java index 099f8e8d04..2421bfed40 100644 --- a/src/test/java/com/rabbitmq/client/test/ConfirmBase.java +++ b/src/test/java/com/rabbitmq/client/test/ConfirmBase.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java b/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java index adca51336a..feacb2327c 100644 --- a/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java +++ b/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ConnectionTest.java b/src/test/java/com/rabbitmq/client/test/ConnectionTest.java index 85dc789130..cef3e68a18 100644 --- a/src/test/java/com/rabbitmq/client/test/ConnectionTest.java +++ b/src/test/java/com/rabbitmq/client/test/ConnectionTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/DefaultRetryHandlerTest.java b/src/test/java/com/rabbitmq/client/test/DefaultRetryHandlerTest.java index cc105304a7..c6fe244c51 100644 --- a/src/test/java/com/rabbitmq/client/test/DefaultRetryHandlerTest.java +++ b/src/test/java/com/rabbitmq/client/test/DefaultRetryHandlerTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/DnsSrvRecordAddressResolverTest.java b/src/test/java/com/rabbitmq/client/test/DnsSrvRecordAddressResolverTest.java index 82bdea47de..886aa1f533 100644 --- a/src/test/java/com/rabbitmq/client/test/DnsSrvRecordAddressResolverTest.java +++ b/src/test/java/com/rabbitmq/client/test/DnsSrvRecordAddressResolverTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/FrameBuilderTest.java b/src/test/java/com/rabbitmq/client/test/FrameBuilderTest.java index ce71a779a7..64013cadd8 100644 --- a/src/test/java/com/rabbitmq/client/test/FrameBuilderTest.java +++ b/src/test/java/com/rabbitmq/client/test/FrameBuilderTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/GeneratedClassesTest.java b/src/test/java/com/rabbitmq/client/test/GeneratedClassesTest.java index e9dbcfca98..c144e7e3d3 100644 --- a/src/test/java/com/rabbitmq/client/test/GeneratedClassesTest.java +++ b/src/test/java/com/rabbitmq/client/test/GeneratedClassesTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/JSONReadWriteTest.java b/src/test/java/com/rabbitmq/client/test/JSONReadWriteTest.java index 44f322f2e0..3c71951aab 100644 --- a/src/test/java/com/rabbitmq/client/test/JSONReadWriteTest.java +++ b/src/test/java/com/rabbitmq/client/test/JSONReadWriteTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/LambdaCallbackTest.java b/src/test/java/com/rabbitmq/client/test/LambdaCallbackTest.java index 571824a73a..29505b73ab 100644 --- a/src/test/java/com/rabbitmq/client/test/LambdaCallbackTest.java +++ b/src/test/java/com/rabbitmq/client/test/LambdaCallbackTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/LongStringTest.java b/src/test/java/com/rabbitmq/client/test/LongStringTest.java index df04cddd51..59f9556e2c 100644 --- a/src/test/java/com/rabbitmq/client/test/LongStringTest.java +++ b/src/test/java/com/rabbitmq/client/test/LongStringTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/MetricsCollectorTest.java b/src/test/java/com/rabbitmq/client/test/MetricsCollectorTest.java index 74f85ac668..27b4f21cd8 100644 --- a/src/test/java/com/rabbitmq/client/test/MetricsCollectorTest.java +++ b/src/test/java/com/rabbitmq/client/test/MetricsCollectorTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/MicrometerMetricsCollectorTest.java b/src/test/java/com/rabbitmq/client/test/MicrometerMetricsCollectorTest.java index b84c956852..5cc8aa6178 100644 --- a/src/test/java/com/rabbitmq/client/test/MicrometerMetricsCollectorTest.java +++ b/src/test/java/com/rabbitmq/client/test/MicrometerMetricsCollectorTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/MultiThreadedChannel.java b/src/test/java/com/rabbitmq/client/test/MultiThreadedChannel.java index d583a03b4a..4790016a40 100644 --- a/src/test/java/com/rabbitmq/client/test/MultiThreadedChannel.java +++ b/src/test/java/com/rabbitmq/client/test/MultiThreadedChannel.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/NioDeadlockOnConnectionClosing.java b/src/test/java/com/rabbitmq/client/test/NioDeadlockOnConnectionClosing.java index 78082344b1..c9e1607653 100644 --- a/src/test/java/com/rabbitmq/client/test/NioDeadlockOnConnectionClosing.java +++ b/src/test/java/com/rabbitmq/client/test/NioDeadlockOnConnectionClosing.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/NoAutoRecoveryWhenTcpWindowIsFullTest.java b/src/test/java/com/rabbitmq/client/test/NoAutoRecoveryWhenTcpWindowIsFullTest.java index 1047dc4287..5014bcda2f 100644 --- a/src/test/java/com/rabbitmq/client/test/NoAutoRecoveryWhenTcpWindowIsFullTest.java +++ b/src/test/java/com/rabbitmq/client/test/NoAutoRecoveryWhenTcpWindowIsFullTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/PropertyFileInitialisationTest.java b/src/test/java/com/rabbitmq/client/test/PropertyFileInitialisationTest.java index 34b6a63054..3d6099e12c 100644 --- a/src/test/java/com/rabbitmq/client/test/PropertyFileInitialisationTest.java +++ b/src/test/java/com/rabbitmq/client/test/PropertyFileInitialisationTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/QueueingConsumerTests.java b/src/test/java/com/rabbitmq/client/test/QueueingConsumerTests.java index cf5114faef..01676ade92 100644 --- a/src/test/java/com/rabbitmq/client/test/QueueingConsumerTests.java +++ b/src/test/java/com/rabbitmq/client/test/QueueingConsumerTests.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/RecoveryAwareAMQConnectionFactoryTest.java b/src/test/java/com/rabbitmq/client/test/RecoveryAwareAMQConnectionFactoryTest.java index 704c252bc0..f09721a036 100644 --- a/src/test/java/com/rabbitmq/client/test/RecoveryAwareAMQConnectionFactoryTest.java +++ b/src/test/java/com/rabbitmq/client/test/RecoveryAwareAMQConnectionFactoryTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/RecoveryDelayHandlerTest.java b/src/test/java/com/rabbitmq/client/test/RecoveryDelayHandlerTest.java index 1b988251f3..7828b5eefe 100644 --- a/src/test/java/com/rabbitmq/client/test/RecoveryDelayHandlerTest.java +++ b/src/test/java/com/rabbitmq/client/test/RecoveryDelayHandlerTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java b/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java index defa0c4b4f..b72c95ee1d 100644 --- a/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java +++ b/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/RpcTest.java b/src/test/java/com/rabbitmq/client/test/RpcTest.java index 027c1e081a..87d0be518b 100644 --- a/src/test/java/com/rabbitmq/client/test/RpcTest.java +++ b/src/test/java/com/rabbitmq/client/test/RpcTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2020 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/RpcTopologyRecordingTest.java b/src/test/java/com/rabbitmq/client/test/RpcTopologyRecordingTest.java index 47c56b9953..1f0f023018 100644 --- a/src/test/java/com/rabbitmq/client/test/RpcTopologyRecordingTest.java +++ b/src/test/java/com/rabbitmq/client/test/RpcTopologyRecordingTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/SharedThreadPoolTest.java b/src/test/java/com/rabbitmq/client/test/SharedThreadPoolTest.java index 15d7749a37..a1fe0175f5 100644 --- a/src/test/java/com/rabbitmq/client/test/SharedThreadPoolTest.java +++ b/src/test/java/com/rabbitmq/client/test/SharedThreadPoolTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/SslContextFactoryTest.java b/src/test/java/com/rabbitmq/client/test/SslContextFactoryTest.java index ed930c111e..4f591221ce 100644 --- a/src/test/java/com/rabbitmq/client/test/SslContextFactoryTest.java +++ b/src/test/java/com/rabbitmq/client/test/SslContextFactoryTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/StrictExceptionHandlerTest.java b/src/test/java/com/rabbitmq/client/test/StrictExceptionHandlerTest.java index 3b09ede84b..300d8ad053 100644 --- a/src/test/java/com/rabbitmq/client/test/StrictExceptionHandlerTest.java +++ b/src/test/java/com/rabbitmq/client/test/StrictExceptionHandlerTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/TableTest.java b/src/test/java/com/rabbitmq/client/test/TableTest.java index 630c7fc34d..e750301413 100644 --- a/src/test/java/com/rabbitmq/client/test/TableTest.java +++ b/src/test/java/com/rabbitmq/client/test/TableTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/TestUtils.java b/src/test/java/com/rabbitmq/client/test/TestUtils.java index 57d80db95c..012882d3f4 100644 --- a/src/test/java/com/rabbitmq/client/test/TestUtils.java +++ b/src/test/java/com/rabbitmq/client/test/TestUtils.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2020 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/TestUtilsTest.java b/src/test/java/com/rabbitmq/client/test/TestUtilsTest.java index 00374f3a4e..1de1fe975a 100644 --- a/src/test/java/com/rabbitmq/client/test/TestUtilsTest.java +++ b/src/test/java/com/rabbitmq/client/test/TestUtilsTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2017-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/TlsUtilsTest.java b/src/test/java/com/rabbitmq/client/test/TlsUtilsTest.java index e632e47282..078989ca12 100644 --- a/src/test/java/com/rabbitmq/client/test/TlsUtilsTest.java +++ b/src/test/java/com/rabbitmq/client/test/TlsUtilsTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/TrafficListenerTest.java b/src/test/java/com/rabbitmq/client/test/TrafficListenerTest.java index d860678d98..69c223cf31 100644 --- a/src/test/java/com/rabbitmq/client/test/TrafficListenerTest.java +++ b/src/test/java/com/rabbitmq/client/test/TrafficListenerTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/TruncatedInputStreamTest.java b/src/test/java/com/rabbitmq/client/test/TruncatedInputStreamTest.java index 4409798a17..570f15c848 100644 --- a/src/test/java/com/rabbitmq/client/test/TruncatedInputStreamTest.java +++ b/src/test/java/com/rabbitmq/client/test/TruncatedInputStreamTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ValueOrExceptionTest.java b/src/test/java/com/rabbitmq/client/test/ValueOrExceptionTest.java index de58c84aba..789dccfa29 100644 --- a/src/test/java/com/rabbitmq/client/test/ValueOrExceptionTest.java +++ b/src/test/java/com/rabbitmq/client/test/ValueOrExceptionTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/AbstractRejectTest.java b/src/test/java/com/rabbitmq/client/test/functional/AbstractRejectTest.java index 9d58d590de..470418c384 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/AbstractRejectTest.java +++ b/src/test/java/com/rabbitmq/client/test/functional/AbstractRejectTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/AlternateExchange.java b/src/test/java/com/rabbitmq/client/test/functional/AlternateExchange.java index 242e95032b..fc620a5034 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/AlternateExchange.java +++ b/src/test/java/com/rabbitmq/client/test/functional/AlternateExchange.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/BasicGet.java b/src/test/java/com/rabbitmq/client/test/functional/BasicGet.java index dddd17e8d6..1e854ec495 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/BasicGet.java +++ b/src/test/java/com/rabbitmq/client/test/functional/BasicGet.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycle.java b/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycle.java index 0223c4c878..48c82a22ad 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycle.java +++ b/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycle.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycleBase.java b/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycleBase.java index bb5f24c634..ae21a981f5 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycleBase.java +++ b/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycleBase.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/CcRoutes.java b/src/test/java/com/rabbitmq/client/test/functional/CcRoutes.java index 7e02faae15..4782459840 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/CcRoutes.java +++ b/src/test/java/com/rabbitmq/client/test/functional/CcRoutes.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/ClusteredTestBase.java b/src/test/java/com/rabbitmq/client/test/functional/ClusteredTestBase.java index 6d1b430cf9..c3ae467c4f 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ClusteredTestBase.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ClusteredTestBase.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/Confirm.java b/src/test/java/com/rabbitmq/client/test/functional/Confirm.java index 3e66e18f15..9f0860b820 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Confirm.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Confirm.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/ConnectionOpen.java b/src/test/java/com/rabbitmq/client/test/functional/ConnectionOpen.java index 91b6f18ba9..9f99ba1797 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ConnectionOpen.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ConnectionOpen.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/ConnectionRecovery.java b/src/test/java/com/rabbitmq/client/test/functional/ConnectionRecovery.java index 04cf8b04d2..486e5448ce 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ConnectionRecovery.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ConnectionRecovery.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/ConsumerCancelNotification.java b/src/test/java/com/rabbitmq/client/test/functional/ConsumerCancelNotification.java index fdda32ea18..082725531b 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ConsumerCancelNotification.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ConsumerCancelNotification.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/ConsumerCount.java b/src/test/java/com/rabbitmq/client/test/functional/ConsumerCount.java index e4230d9f92..73f91a5e10 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ConsumerCount.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ConsumerCount.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/ConsumerPriorities.java b/src/test/java/com/rabbitmq/client/test/functional/ConsumerPriorities.java index 7193decee2..a3eebd85bb 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ConsumerPriorities.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ConsumerPriorities.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java b/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java index 6a7f97725e..fa6124ce16 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java +++ b/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/DefaultExchange.java b/src/test/java/com/rabbitmq/client/test/functional/DefaultExchange.java index fb27da6391..df2ceb5fdd 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/DefaultExchange.java +++ b/src/test/java/com/rabbitmq/client/test/functional/DefaultExchange.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/DirectReplyTo.java b/src/test/java/com/rabbitmq/client/test/functional/DirectReplyTo.java index 1573c5f4c4..c8d1befec1 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/DirectReplyTo.java +++ b/src/test/java/com/rabbitmq/client/test/functional/DirectReplyTo.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/DoubleDeletion.java b/src/test/java/com/rabbitmq/client/test/functional/DoubleDeletion.java index 305b152fab..20b87d7312 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/DoubleDeletion.java +++ b/src/test/java/com/rabbitmq/client/test/functional/DoubleDeletion.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/DurableOnTransient.java b/src/test/java/com/rabbitmq/client/test/functional/DurableOnTransient.java index adb11c9bf3..dc9f5d5155 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/DurableOnTransient.java +++ b/src/test/java/com/rabbitmq/client/test/functional/DurableOnTransient.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/ExceptionHandling.java b/src/test/java/com/rabbitmq/client/test/functional/ExceptionHandling.java index f0c22e90f6..f0c73fcd17 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ExceptionHandling.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ExceptionHandling.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/ExceptionMessages.java b/src/test/java/com/rabbitmq/client/test/functional/ExceptionMessages.java index 88b53a8b9a..d2810dcb94 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ExceptionMessages.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ExceptionMessages.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeclare.java b/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeclare.java index 2eeef91572..5578560302 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeclare.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeclare.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeleteIfUnused.java b/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeleteIfUnused.java index dab4ebd080..ec763486f0 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeleteIfUnused.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeleteIfUnused.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeletePredeclared.java b/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeletePredeclared.java index 0b1cf6969b..ee25ca6232 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeletePredeclared.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeletePredeclared.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/ExchangeEquivalenceBase.java b/src/test/java/com/rabbitmq/client/test/functional/ExchangeEquivalenceBase.java index 0e8bfcd92a..f2f3916ca5 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ExchangeEquivalenceBase.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ExchangeEquivalenceBase.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/ExchangeExchangeBindings.java b/src/test/java/com/rabbitmq/client/test/functional/ExchangeExchangeBindings.java index 739da0c71a..b3ed2f5a3a 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ExchangeExchangeBindings.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ExchangeExchangeBindings.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/ExchangeExchangeBindingsAutoDelete.java b/src/test/java/com/rabbitmq/client/test/functional/ExchangeExchangeBindingsAutoDelete.java index baf7a1ce6a..15f63fbd48 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ExchangeExchangeBindingsAutoDelete.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ExchangeExchangeBindingsAutoDelete.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/FrameMax.java b/src/test/java/com/rabbitmq/client/test/functional/FrameMax.java index 303d01e00d..ac1e98e7e6 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/FrameMax.java +++ b/src/test/java/com/rabbitmq/client/test/functional/FrameMax.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/FunctionalTests.java b/src/test/java/com/rabbitmq/client/test/functional/FunctionalTests.java index fb48f29585..f8a89554a5 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/FunctionalTests.java +++ b/src/test/java/com/rabbitmq/client/test/functional/FunctionalTests.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/HeadersExchangeValidation.java b/src/test/java/com/rabbitmq/client/test/functional/HeadersExchangeValidation.java index ac28b3ed68..2ff1a36781 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/HeadersExchangeValidation.java +++ b/src/test/java/com/rabbitmq/client/test/functional/HeadersExchangeValidation.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/Heartbeat.java b/src/test/java/com/rabbitmq/client/test/functional/Heartbeat.java index 14c58c60a0..b4f9c9b756 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Heartbeat.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Heartbeat.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/InternalExchange.java b/src/test/java/com/rabbitmq/client/test/functional/InternalExchange.java index 97b34bfdba..cfb705b06b 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/InternalExchange.java +++ b/src/test/java/com/rabbitmq/client/test/functional/InternalExchange.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/InvalidAcks.java b/src/test/java/com/rabbitmq/client/test/functional/InvalidAcks.java index b869378d50..dff81c600b 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/InvalidAcks.java +++ b/src/test/java/com/rabbitmq/client/test/functional/InvalidAcks.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/InvalidAcksBase.java b/src/test/java/com/rabbitmq/client/test/functional/InvalidAcksBase.java index e71404a268..025954022f 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/InvalidAcksBase.java +++ b/src/test/java/com/rabbitmq/client/test/functional/InvalidAcksBase.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/InvalidAcksTx.java b/src/test/java/com/rabbitmq/client/test/functional/InvalidAcksTx.java index 388c7ee414..635929bb4b 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/InvalidAcksTx.java +++ b/src/test/java/com/rabbitmq/client/test/functional/InvalidAcksTx.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/MessageCount.java b/src/test/java/com/rabbitmq/client/test/functional/MessageCount.java index 9820e6aa68..a8d302a55a 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/MessageCount.java +++ b/src/test/java/com/rabbitmq/client/test/functional/MessageCount.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/Metrics.java b/src/test/java/com/rabbitmq/client/test/functional/Metrics.java index a39770f125..98b82ed7af 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Metrics.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Metrics.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2020 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/Nack.java b/src/test/java/com/rabbitmq/client/test/functional/Nack.java index 65057cb363..5b39638d78 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Nack.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Nack.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/NoRequeueOnCancel.java b/src/test/java/com/rabbitmq/client/test/functional/NoRequeueOnCancel.java index c7b220e660..829cf3d25f 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/NoRequeueOnCancel.java +++ b/src/test/java/com/rabbitmq/client/test/functional/NoRequeueOnCancel.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/Nowait.java b/src/test/java/com/rabbitmq/client/test/functional/Nowait.java index b6c03cb593..af79b0d195 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Nowait.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Nowait.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/PerConsumerPrefetch.java b/src/test/java/com/rabbitmq/client/test/functional/PerConsumerPrefetch.java index 31dd63f3a0..16a1cfdf95 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/PerConsumerPrefetch.java +++ b/src/test/java/com/rabbitmq/client/test/functional/PerConsumerPrefetch.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/PerMessageTTL.java b/src/test/java/com/rabbitmq/client/test/functional/PerMessageTTL.java index 00a3adc98d..0b25fbe699 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/PerMessageTTL.java +++ b/src/test/java/com/rabbitmq/client/test/functional/PerMessageTTL.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/PerQueueTTL.java b/src/test/java/com/rabbitmq/client/test/functional/PerQueueTTL.java index 8a221e2bb6..55c44e6cb3 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/PerQueueTTL.java +++ b/src/test/java/com/rabbitmq/client/test/functional/PerQueueTTL.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/PerQueueVsPerMessageTTL.java b/src/test/java/com/rabbitmq/client/test/functional/PerQueueVsPerMessageTTL.java index b586c98c5d..f4c9914bda 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/PerQueueVsPerMessageTTL.java +++ b/src/test/java/com/rabbitmq/client/test/functional/PerQueueVsPerMessageTTL.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/Policies.java b/src/test/java/com/rabbitmq/client/test/functional/Policies.java index f1dba4d33d..8f86294766 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Policies.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Policies.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/QosTests.java b/src/test/java/com/rabbitmq/client/test/functional/QosTests.java index 637df3c894..1634741a83 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/QosTests.java +++ b/src/test/java/com/rabbitmq/client/test/functional/QosTests.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/QueueExclusivity.java b/src/test/java/com/rabbitmq/client/test/functional/QueueExclusivity.java index 5d7f84663a..3351b1d1a6 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/QueueExclusivity.java +++ b/src/test/java/com/rabbitmq/client/test/functional/QueueExclusivity.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/QueueLease.java b/src/test/java/com/rabbitmq/client/test/functional/QueueLease.java index b5ab03a48d..3ec1986792 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/QueueLease.java +++ b/src/test/java/com/rabbitmq/client/test/functional/QueueLease.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/QueueLifecycle.java b/src/test/java/com/rabbitmq/client/test/functional/QueueLifecycle.java index 77c5e6df92..c082a91c41 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/QueueLifecycle.java +++ b/src/test/java/com/rabbitmq/client/test/functional/QueueLifecycle.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/QueueSizeLimit.java b/src/test/java/com/rabbitmq/client/test/functional/QueueSizeLimit.java index 7bec3e47c2..fd4c26343e 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/QueueSizeLimit.java +++ b/src/test/java/com/rabbitmq/client/test/functional/QueueSizeLimit.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/Recover.java b/src/test/java/com/rabbitmq/client/test/functional/Recover.java index 0d764cc6b1..654846648f 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Recover.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Recover.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/Reject.java b/src/test/java/com/rabbitmq/client/test/functional/Reject.java index 0a99111137..11f3d52d37 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Reject.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Reject.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/RequeueOnChannelClose.java b/src/test/java/com/rabbitmq/client/test/functional/RequeueOnChannelClose.java index c9e44830c3..6b1eb781a0 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/RequeueOnChannelClose.java +++ b/src/test/java/com/rabbitmq/client/test/functional/RequeueOnChannelClose.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/RequeueOnClose.java b/src/test/java/com/rabbitmq/client/test/functional/RequeueOnClose.java index 35150997a8..1900f97218 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/RequeueOnClose.java +++ b/src/test/java/com/rabbitmq/client/test/functional/RequeueOnClose.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/RequeueOnConnectionClose.java b/src/test/java/com/rabbitmq/client/test/functional/RequeueOnConnectionClose.java index 8f36f0e2b6..6af8d01dd2 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/RequeueOnConnectionClose.java +++ b/src/test/java/com/rabbitmq/client/test/functional/RequeueOnConnectionClose.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/Routing.java b/src/test/java/com/rabbitmq/client/test/functional/Routing.java index f4efdab194..cfaf9eb38b 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Routing.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Routing.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/SaslMechanisms.java b/src/test/java/com/rabbitmq/client/test/functional/SaslMechanisms.java index d4dcf9130d..1d769f8a10 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/SaslMechanisms.java +++ b/src/test/java/com/rabbitmq/client/test/functional/SaslMechanisms.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/TTLHandling.java b/src/test/java/com/rabbitmq/client/test/functional/TTLHandling.java index 40719510fa..26d501e35f 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/TTLHandling.java +++ b/src/test/java/com/rabbitmq/client/test/functional/TTLHandling.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/Tables.java b/src/test/java/com/rabbitmq/client/test/functional/Tables.java index 009d8c827e..ad631596e9 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Tables.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Tables.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryFiltering.java b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryFiltering.java index 3eb9687eea..e8c3ff1148 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryFiltering.java +++ b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryFiltering.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java index f6dc2ac5ae..215645fcaf 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java +++ b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/Transactions.java b/src/test/java/com/rabbitmq/client/test/functional/Transactions.java index ff677dde35..25fb8410c5 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Transactions.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Transactions.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/UnbindAutoDeleteExchange.java b/src/test/java/com/rabbitmq/client/test/functional/UnbindAutoDeleteExchange.java index cb9491a6e7..fcafc73ebb 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/UnbindAutoDeleteExchange.java +++ b/src/test/java/com/rabbitmq/client/test/functional/UnbindAutoDeleteExchange.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/UnexpectedFrames.java b/src/test/java/com/rabbitmq/client/test/functional/UnexpectedFrames.java index 2599a7663c..de118e90dd 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/UnexpectedFrames.java +++ b/src/test/java/com/rabbitmq/client/test/functional/UnexpectedFrames.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/functional/UserIDHeader.java b/src/test/java/com/rabbitmq/client/test/functional/UserIDHeader.java index 7d64fee7a7..17db1bc8a8 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/UserIDHeader.java +++ b/src/test/java/com/rabbitmq/client/test/functional/UserIDHeader.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/AbsentQueue.java b/src/test/java/com/rabbitmq/client/test/server/AbsentQueue.java index 83c1be3454..886820c094 100644 --- a/src/test/java/com/rabbitmq/client/test/server/AbsentQueue.java +++ b/src/test/java/com/rabbitmq/client/test/server/AbsentQueue.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/AlternateExchangeEquivalence.java b/src/test/java/com/rabbitmq/client/test/server/AlternateExchangeEquivalence.java index 213240039d..fbc019b263 100644 --- a/src/test/java/com/rabbitmq/client/test/server/AlternateExchangeEquivalence.java +++ b/src/test/java/com/rabbitmq/client/test/server/AlternateExchangeEquivalence.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/BlockedConnection.java b/src/test/java/com/rabbitmq/client/test/server/BlockedConnection.java index 61a84ae731..30e07d3a2c 100644 --- a/src/test/java/com/rabbitmq/client/test/server/BlockedConnection.java +++ b/src/test/java/com/rabbitmq/client/test/server/BlockedConnection.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/Bug19219Test.java b/src/test/java/com/rabbitmq/client/test/server/Bug19219Test.java index f048252728..7f48b7aeb4 100644 --- a/src/test/java/com/rabbitmq/client/test/server/Bug19219Test.java +++ b/src/test/java/com/rabbitmq/client/test/server/Bug19219Test.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/ChannelLimitNegotiation.java b/src/test/java/com/rabbitmq/client/test/server/ChannelLimitNegotiation.java index f6500b0677..cd8a99ed34 100644 --- a/src/test/java/com/rabbitmq/client/test/server/ChannelLimitNegotiation.java +++ b/src/test/java/com/rabbitmq/client/test/server/ChannelLimitNegotiation.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/DeadLetterExchangeDurable.java b/src/test/java/com/rabbitmq/client/test/server/DeadLetterExchangeDurable.java index c6c4e85c91..8ee7169797 100644 --- a/src/test/java/com/rabbitmq/client/test/server/DeadLetterExchangeDurable.java +++ b/src/test/java/com/rabbitmq/client/test/server/DeadLetterExchangeDurable.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/DurableBindingLifecycle.java b/src/test/java/com/rabbitmq/client/test/server/DurableBindingLifecycle.java index 388a3ce7a5..a8c4ff6b8d 100644 --- a/src/test/java/com/rabbitmq/client/test/server/DurableBindingLifecycle.java +++ b/src/test/java/com/rabbitmq/client/test/server/DurableBindingLifecycle.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/EffectVisibilityCrossNodeTest.java b/src/test/java/com/rabbitmq/client/test/server/EffectVisibilityCrossNodeTest.java index cea5f368a1..0aa40943fe 100644 --- a/src/test/java/com/rabbitmq/client/test/server/EffectVisibilityCrossNodeTest.java +++ b/src/test/java/com/rabbitmq/client/test/server/EffectVisibilityCrossNodeTest.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/ExclusiveQueueDurability.java b/src/test/java/com/rabbitmq/client/test/server/ExclusiveQueueDurability.java index 57cb457087..7d931f12cf 100644 --- a/src/test/java/com/rabbitmq/client/test/server/ExclusiveQueueDurability.java +++ b/src/test/java/com/rabbitmq/client/test/server/ExclusiveQueueDurability.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/Firehose.java b/src/test/java/com/rabbitmq/client/test/server/Firehose.java index c1c95ab8a4..56b0cdcb10 100644 --- a/src/test/java/com/rabbitmq/client/test/server/Firehose.java +++ b/src/test/java/com/rabbitmq/client/test/server/Firehose.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/HATests.java b/src/test/java/com/rabbitmq/client/test/server/HATests.java index 17b8ad1351..8918098f5d 100644 --- a/src/test/java/com/rabbitmq/client/test/server/HATests.java +++ b/src/test/java/com/rabbitmq/client/test/server/HATests.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/LoopbackUsers.java b/src/test/java/com/rabbitmq/client/test/server/LoopbackUsers.java index a7ddad4560..d9b7be93b1 100644 --- a/src/test/java/com/rabbitmq/client/test/server/LoopbackUsers.java +++ b/src/test/java/com/rabbitmq/client/test/server/LoopbackUsers.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/MemoryAlarms.java b/src/test/java/com/rabbitmq/client/test/server/MemoryAlarms.java index 76a092d868..b664e7b62e 100644 --- a/src/test/java/com/rabbitmq/client/test/server/MemoryAlarms.java +++ b/src/test/java/com/rabbitmq/client/test/server/MemoryAlarms.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/MessageRecovery.java b/src/test/java/com/rabbitmq/client/test/server/MessageRecovery.java index 71df04dce5..4080fdce8c 100644 --- a/src/test/java/com/rabbitmq/client/test/server/MessageRecovery.java +++ b/src/test/java/com/rabbitmq/client/test/server/MessageRecovery.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/Permissions.java b/src/test/java/com/rabbitmq/client/test/server/Permissions.java index 233b85e9cc..24c25a4391 100644 --- a/src/test/java/com/rabbitmq/client/test/server/Permissions.java +++ b/src/test/java/com/rabbitmq/client/test/server/Permissions.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/PersistenceGuarantees.java b/src/test/java/com/rabbitmq/client/test/server/PersistenceGuarantees.java index 4070393600..42846db2a1 100644 --- a/src/test/java/com/rabbitmq/client/test/server/PersistenceGuarantees.java +++ b/src/test/java/com/rabbitmq/client/test/server/PersistenceGuarantees.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/PriorityQueues.java b/src/test/java/com/rabbitmq/client/test/server/PriorityQueues.java index ad1629bd62..805b5c6fc4 100644 --- a/src/test/java/com/rabbitmq/client/test/server/PriorityQueues.java +++ b/src/test/java/com/rabbitmq/client/test/server/PriorityQueues.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/ServerTests.java b/src/test/java/com/rabbitmq/client/test/server/ServerTests.java index bf8631a4b8..bda7cac3fd 100644 --- a/src/test/java/com/rabbitmq/client/test/server/ServerTests.java +++ b/src/test/java/com/rabbitmq/client/test/server/ServerTests.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/Shutdown.java b/src/test/java/com/rabbitmq/client/test/server/Shutdown.java index bab3724818..53cd63c184 100644 --- a/src/test/java/com/rabbitmq/client/test/server/Shutdown.java +++ b/src/test/java/com/rabbitmq/client/test/server/Shutdown.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/TopicPermissions.java b/src/test/java/com/rabbitmq/client/test/server/TopicPermissions.java index 1a5c02a4c8..c258e7a773 100644 --- a/src/test/java/com/rabbitmq/client/test/server/TopicPermissions.java +++ b/src/test/java/com/rabbitmq/client/test/server/TopicPermissions.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/server/XDeathHeaderGrowth.java b/src/test/java/com/rabbitmq/client/test/server/XDeathHeaderGrowth.java index 16bd88ab02..4aa0839f39 100644 --- a/src/test/java/com/rabbitmq/client/test/server/XDeathHeaderGrowth.java +++ b/src/test/java/com/rabbitmq/client/test/server/XDeathHeaderGrowth.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ssl/BadVerifiedConnection.java b/src/test/java/com/rabbitmq/client/test/ssl/BadVerifiedConnection.java index a11998c499..9b9e291314 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/BadVerifiedConnection.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/BadVerifiedConnection.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ssl/ConnectionFactoryDefaultTlsVersion.java b/src/test/java/com/rabbitmq/client/test/ssl/ConnectionFactoryDefaultTlsVersion.java index 9d6546572b..0ffbc52df5 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/ConnectionFactoryDefaultTlsVersion.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/ConnectionFactoryDefaultTlsVersion.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java index 71b6a497f9..9fef361381 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ssl/NioTlsUnverifiedConnection.java b/src/test/java/com/rabbitmq/client/test/ssl/NioTlsUnverifiedConnection.java index 07ac30a901..4c22736e8b 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/NioTlsUnverifiedConnection.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/NioTlsUnverifiedConnection.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java b/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java index 88107b41fe..0dbb808584 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java b/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java index 6eb865ea41..845e0a476c 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java @@ -1,4 +1,4 @@ -// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ssl/UnverifiedConnection.java b/src/test/java/com/rabbitmq/client/test/ssl/UnverifiedConnection.java index 6d65599b4c..dd041fef5c 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/UnverifiedConnection.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/UnverifiedConnection.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/client/test/ssl/VerifiedConnection.java b/src/test/java/com/rabbitmq/client/test/ssl/VerifiedConnection.java index e662113085..52c3763064 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/VerifiedConnection.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/VerifiedConnection.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/tools/Host.java b/src/test/java/com/rabbitmq/tools/Host.java index c30ec7fc6f..91f4c68f50 100644 --- a/src/test/java/com/rabbitmq/tools/Host.java +++ b/src/test/java/com/rabbitmq/tools/Host.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 diff --git a/src/test/java/com/rabbitmq/utility/IntAllocatorTests.java b/src/test/java/com/rabbitmq/utility/IntAllocatorTests.java index 96586f5686..1dbdfa95a6 100644 --- a/src/test/java/com/rabbitmq/utility/IntAllocatorTests.java +++ b/src/test/java/com/rabbitmq/utility/IntAllocatorTests.java @@ -1,4 +1,4 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. +// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the // Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 From 14d9c1f1bb730dfe9d644cc81dba22fe733c0c4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 1 Apr 2020 11:46:06 +0200 Subject: [PATCH 199/328] Check qos, heartbeat, max channel are unsigned shorts To avoid truncation and subtle bugs. Fixes #640 (cherry picked from commit 733788e26ba73ea90a1be72b99227c6a10003054) Conflicts: src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java --- .../java/com/rabbitmq/client/Channel.java | 33 ++++--- .../rabbitmq/client/ConnectionFactory.java | 16 ++- .../rabbitmq/client/impl/AMQConnection.java | 18 +++- .../com/rabbitmq/client/impl/ChannelN.java | 32 +++--- .../rabbitmq/client/test/ChannelNTest.java | 31 ++++++ .../com/rabbitmq/client/test/ClientTests.java | 1 - .../client/test/ConnectionFactoryTest.java | 97 ++++++++++++------- .../rabbitmq/client/test/ssl/SSLTests.java | 4 +- 8 files changed, 163 insertions(+), 69 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/Channel.java b/src/main/java/com/rabbitmq/client/Channel.java index cd0b9b2962..b84df3d95b 100644 --- a/src/main/java/com/rabbitmq/client/Channel.java +++ b/src/main/java/com/rabbitmq/client/Channel.java @@ -197,42 +197,49 @@ public interface Channel extends ShutdownNotifier, AutoCloseable { /** * Request specific "quality of service" settings. - * + *

* These settings impose limits on the amount of data the server * will deliver to consumers before requiring acknowledgements. * Thus they provide a means of consumer-initiated flow control. - * @see com.rabbitmq.client.AMQP.Basic.Qos - * @param prefetchSize maximum amount of content (measured in - * octets) that the server will deliver, 0 if unlimited + *

+ * Note the prefetch count must be between 0 and 65535 (unsigned short in AMQP 0-9-1). + * + * @param prefetchSize maximum amount of content (measured in + * octets) that the server will deliver, 0 if unlimited * @param prefetchCount maximum number of messages that the server - * will deliver, 0 if unlimited - * @param global true if the settings should be applied to the - * entire channel rather than each consumer + * will deliver, 0 if unlimited + * @param global true if the settings should be applied to the + * entire channel rather than each consumer * @throws java.io.IOException if an error is encountered + * @see com.rabbitmq.client.AMQP.Basic.Qos */ void basicQos(int prefetchSize, int prefetchCount, boolean global) throws IOException; /** * Request a specific prefetchCount "quality of service" settings * for this channel. + *

+ * Note the prefetch count must be between 0 and 65535 (unsigned short in AMQP 0-9-1). * - * @see #basicQos(int, int, boolean) * @param prefetchCount maximum number of messages that the server - * will deliver, 0 if unlimited - * @param global true if the settings should be applied to the - * entire channel rather than each consumer + * will deliver, 0 if unlimited + * @param global true if the settings should be applied to the + * entire channel rather than each consumer * @throws java.io.IOException if an error is encountered + * @see #basicQos(int, int, boolean) */ void basicQos(int prefetchCount, boolean global) throws IOException; /** * Request a specific prefetchCount "quality of service" settings * for this channel. + *

+ * Note the prefetch count must be between 0 and 65535 (unsigned short in AMQP 0-9-1). * - * @see #basicQos(int, int, boolean) * @param prefetchCount maximum number of messages that the server - * will deliver, 0 if unlimited + * will deliver, 0 if unlimited * @throws java.io.IOException if an error is encountered + * @see #basicQos(int, int, boolean) */ void basicQos(int prefetchCount) throws IOException; diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index b6b1f5b848..7fdcdb1324 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -47,6 +47,8 @@ */ public class ConnectionFactory implements Cloneable { + private static final int MAX_UNSIGNED_SHORT = 65535; + /** Default user name */ public static final String DEFAULT_USER = "guest"; /** Default password */ @@ -384,10 +386,16 @@ public int getRequestedChannelMax() { } /** - * Set the requested maximum channel number + * Set the requested maximum channel number. + *

+ * Note the value must be between 0 and 65535 (unsigned short in AMQP 0-9-1). + * * @param requestedChannelMax initially requested maximum channel number; zero for unlimited */ public void setRequestedChannelMax(int requestedChannelMax) { + if (requestedChannelMax < 0 || requestedChannelMax > MAX_UNSIGNED_SHORT) { + throw new IllegalArgumentException("Requested channel max must be between 0 and " + MAX_UNSIGNED_SHORT); + } this.requestedChannelMax = requestedChannelMax; } @@ -477,10 +485,16 @@ public int getShutdownTimeout() { * Set the requested heartbeat timeout. Heartbeat frames will be sent at about 1/2 the timeout interval. * If server heartbeat timeout is configured to a non-zero value, this method can only be used * to lower the value; otherwise any value provided by the client will be used. + *

+ * Note the value must be between 0 and 65535 (unsigned short in AMQP 0-9-1). + * * @param requestedHeartbeat the initially requested heartbeat timeout, in seconds; zero for none * @see RabbitMQ Heartbeats Guide */ public void setRequestedHeartbeat(int requestedHeartbeat) { + if (requestedHeartbeat < 0 || requestedHeartbeat > MAX_UNSIGNED_SHORT) { + throw new IllegalArgumentException("Requested heartbeat must be between 0 and " + MAX_UNSIGNED_SHORT); + } this.requestedHeartbeat = requestedHeartbeat; } diff --git a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java index c989b3a972..b140788a84 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java @@ -15,13 +15,12 @@ package com.rabbitmq.client.impl; -import com.rabbitmq.client.*; import com.rabbitmq.client.Method; +import com.rabbitmq.client.*; import com.rabbitmq.client.impl.AMQChannel.BlockingRpcContinuation; import com.rabbitmq.client.impl.recovery.RecoveryCanBeginListener; import com.rabbitmq.utility.BlockingCell; import com.rabbitmq.utility.Utility; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,6 +46,8 @@ final class Copyright { */ public class AMQConnection extends ShutdownNotifierComponent implements Connection, NetworkConnection { + private static final int MAX_UNSIGNED_SHORT = 65535; + private static final Logger LOGGER = LoggerFactory.getLogger(AMQConnection.class); // we want socket write and channel shutdown timeouts to kick in after // the heartbeat one, so we use a value of 105% of the effective heartbeat timeout @@ -402,6 +403,11 @@ public void start() int channelMax = negotiateChannelMax(this.requestedChannelMax, connTune.getChannelMax()); + + if (!checkUnsignedShort(channelMax)) { + throw new IllegalArgumentException("Negotiated channel max must be between 0 and " + MAX_UNSIGNED_SHORT + ": " + channelMax); + } + _channelManager = instantiateChannelManager(channelMax, threadFactory); int frameMax = @@ -413,6 +419,10 @@ public void start() negotiatedMaxValue(this.requestedHeartbeat, connTune.getHeartbeat()); + if (!checkUnsignedShort(heartbeat)) { + throw new IllegalArgumentException("Negotiated heartbeat must be between 0 and " + MAX_UNSIGNED_SHORT + ": " + heartbeat); + } + setHeartbeat(heartbeat); _channel0.transmit(new AMQP.Connection.TuneOk.Builder() @@ -629,6 +639,10 @@ private static int negotiatedMaxValue(int clientValue, int serverValue) { Math.min(clientValue, serverValue); } + private static boolean checkUnsignedShort(int value) { + return value >= 0 && value <= MAX_UNSIGNED_SHORT; + } + private class MainLoop implements Runnable { /** diff --git a/src/main/java/com/rabbitmq/client/impl/ChannelN.java b/src/main/java/com/rabbitmq/client/impl/ChannelN.java index 61f2d0683e..94da03e7bc 100644 --- a/src/main/java/com/rabbitmq/client/impl/ChannelN.java +++ b/src/main/java/com/rabbitmq/client/impl/ChannelN.java @@ -15,30 +15,24 @@ package com.rabbitmq.client.impl; -import java.io.IOException; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.SortedSet; -import java.util.TreeSet; -import java.util.concurrent.*; - -import com.rabbitmq.client.ConfirmCallback; import com.rabbitmq.client.*; -import com.rabbitmq.client.AMQP.BasicProperties; +import com.rabbitmq.client.Connection; import com.rabbitmq.client.Method; -import com.rabbitmq.client.impl.AMQImpl.Basic; +import com.rabbitmq.client.AMQP.BasicProperties; import com.rabbitmq.client.impl.AMQImpl.Channel; -import com.rabbitmq.client.impl.AMQImpl.Confirm; -import com.rabbitmq.client.impl.AMQImpl.Exchange; import com.rabbitmq.client.impl.AMQImpl.Queue; -import com.rabbitmq.client.impl.AMQImpl.Tx; +import com.rabbitmq.client.impl.AMQImpl.*; import com.rabbitmq.utility.Utility; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.IOException; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeoutException; + /** * Main interface to AMQP protocol functionality. Public API - * Implementation of all AMQChannels except channel zero. @@ -50,6 +44,7 @@ * */ public class ChannelN extends AMQChannel implements com.rabbitmq.client.Channel { + private static final int MAX_UNSIGNED_SHORT = 65535; private static final String UNSPECIFIED_OUT_OF_BAND = ""; private static final Logger LOGGER = LoggerFactory.getLogger(ChannelN.class); @@ -647,7 +642,10 @@ public AMQCommand transformReply(AMQCommand command) { public void basicQos(int prefetchSize, int prefetchCount, boolean global) throws IOException { - exnWrappingRpc(new Basic.Qos(prefetchSize, prefetchCount, global)); + if (prefetchCount < 0 || prefetchCount > MAX_UNSIGNED_SHORT) { + throw new IllegalArgumentException("Prefetch count must be between 0 and " + MAX_UNSIGNED_SHORT); + } + exnWrappingRpc(new Basic.Qos(prefetchSize, prefetchCount, global)); } /** Public API - {@inheritDoc} */ diff --git a/src/test/java/com/rabbitmq/client/test/ChannelNTest.java b/src/test/java/com/rabbitmq/client/test/ChannelNTest.java index 214173a577..194f086ef8 100644 --- a/src/test/java/com/rabbitmq/client/test/ChannelNTest.java +++ b/src/test/java/com/rabbitmq/client/test/ChannelNTest.java @@ -25,6 +25,9 @@ import java.io.IOException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.stream.Stream; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; public class ChannelNTest { @@ -58,4 +61,32 @@ public void callingBasicCancelForUnknownConsumerThrowsException() throws Excepti channel.basicCancel("does-not-exist"); } + @Test + public void qosShouldBeUnsignedShort() { + AMQConnection connection = Mockito.mock(AMQConnection.class); + ChannelN channel = new ChannelN(connection, 1, consumerWorkService); + class TestConfig { + int value; + Consumer call; + + public TestConfig(int value, Consumer call) { + this.value = value; + this.call = call; + } + } + Consumer qos = value -> channel.basicQos(value); + Consumer qosGlobal = value -> channel.basicQos(value, true); + Consumer qosPrefetchSize = value -> channel.basicQos(10, value, true); + Stream.of( + new TestConfig(-1, qos), new TestConfig(65536, qos) + ).flatMap(config -> Stream.of(config, new TestConfig(config.value, qosGlobal), new TestConfig(config.value, qosPrefetchSize))) + .forEach(config -> assertThatThrownBy(() -> config.call.apply(config.value)).isInstanceOf(IllegalArgumentException.class)); + } + + interface Consumer { + + void apply(int value) throws Exception; + + } + } diff --git a/src/test/java/com/rabbitmq/client/test/ClientTests.java b/src/test/java/com/rabbitmq/client/test/ClientTests.java index 1d1be76fda..601234b2db 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientTests.java +++ b/src/test/java/com/rabbitmq/client/test/ClientTests.java @@ -57,7 +57,6 @@ ConnectionFactoryTest.class, RecoveryAwareAMQConnectionFactoryTest.class, RpcTest.class, - SslContextFactoryTest.class, LambdaCallbackTest.class, ChannelAsyncCompletableFutureTest.class, RecoveryDelayHandlerTest.class, diff --git a/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java b/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java index feacb2327c..0d1b695783 100644 --- a/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java +++ b/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java @@ -15,18 +15,8 @@ package com.rabbitmq.client.test; -import com.rabbitmq.client.Address; -import com.rabbitmq.client.AddressResolver; -import com.rabbitmq.client.Connection; -import com.rabbitmq.client.ConnectionFactory; -import com.rabbitmq.client.DnsRecordIpAddressResolver; -import com.rabbitmq.client.ListAddressResolver; -import com.rabbitmq.client.MetricsCollector; -import com.rabbitmq.client.impl.AMQConnection; -import com.rabbitmq.client.impl.ConnectionParams; -import com.rabbitmq.client.impl.CredentialsProvider; -import com.rabbitmq.client.impl.FrameHandler; -import com.rabbitmq.client.impl.FrameHandlerFactory; +import com.rabbitmq.client.*; +import com.rabbitmq.client.impl.*; import org.junit.Test; import java.io.IOException; @@ -36,17 +26,18 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; +import java.util.stream.Stream; -import static org.hamcrest.Matchers.allOf; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.Matchers.notNullValue; -import static org.junit.Assert.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.*; public class ConnectionFactoryTest { // see https://github.com/rabbitmq/rabbitmq-java-client/issues/262 - @Test public void tryNextAddressIfTimeoutExceptionNoAutoRecovery() throws IOException, TimeoutException { + @Test + public void tryNextAddressIfTimeoutExceptionNoAutoRecovery() throws IOException, TimeoutException { final AMQConnection connectionThatThrowsTimeout = mock(AMQConnection.class); final AMQConnection connectionThatSucceeds = mock(AMQConnection.class); final Queue connections = new ArrayBlockingQueue(10); @@ -68,22 +59,23 @@ protected synchronized FrameHandlerFactory createFrameHandlerFactory() { doThrow(TimeoutException.class).when(connectionThatThrowsTimeout).start(); doNothing().when(connectionThatSucceeds).start(); Connection returnedConnection = connectionFactory.newConnection( - new Address[] { new Address("host1"), new Address("host2") } + new Address[]{new Address("host1"), new Address("host2")} ); - assertSame(connectionThatSucceeds, returnedConnection); + assertThat(returnedConnection).isSameAs(connectionThatSucceeds); } - + // see https://github.com/rabbitmq/rabbitmq-java-client/pull/350 - @Test public void customizeCredentialsProvider() throws Exception { + @Test + public void customizeCredentialsProvider() throws Exception { final CredentialsProvider provider = mock(CredentialsProvider.class); final AMQConnection connection = mock(AMQConnection.class); final AtomicBoolean createCalled = new AtomicBoolean(false); - + ConnectionFactory connectionFactory = new ConnectionFactory() { @Override protected AMQConnection createConnection(ConnectionParams params, FrameHandler frameHandler, - MetricsCollector metricsCollector) { - assertSame(provider, params.getCredentialsProvider()); + MetricsCollector metricsCollector) { + assertThat(provider).isSameAs(params.getCredentialsProvider()); createCalled.set(true); return connection; } @@ -95,22 +87,23 @@ protected synchronized FrameHandlerFactory createFrameHandlerFactory() { }; connectionFactory.setCredentialsProvider(provider); connectionFactory.setAutomaticRecoveryEnabled(false); - + doNothing().when(connection).start(); - + Connection returnedConnection = connectionFactory.newConnection(); - assertSame(returnedConnection, connection); - assertTrue(createCalled.get()); + assertThat(returnedConnection).isSameAs(connection); + assertThat(createCalled).isTrue(); } - @Test public void shouldUseDnsResolutionWhenOneAddressAndNoTls() throws Exception { + @Test + public void shouldNotUseDnsResolutionWhenOneAddressAndNoTls() throws Exception { AMQConnection connection = mock(AMQConnection.class); AtomicReference addressResolver = new AtomicReference<>(); ConnectionFactory connectionFactory = new ConnectionFactory() { @Override protected AMQConnection createConnection(ConnectionParams params, FrameHandler frameHandler, - MetricsCollector metricsCollector) { + MetricsCollector metricsCollector) { return connection; } @@ -131,17 +124,18 @@ protected synchronized FrameHandlerFactory createFrameHandlerFactory() { doNothing().when(connection).start(); connectionFactory.newConnection(); - assertThat(addressResolver.get(), allOf(notNullValue(), instanceOf(DnsRecordIpAddressResolver.class))); + assertThat(addressResolver.get()).isNotNull().isInstanceOf(ListAddressResolver.class); } - @Test public void shouldNotUseDnsResolutionWhenOneAddressAndTls() throws Exception { + @Test + public void shouldNotUseDnsResolutionWhenOneAddressAndTls() throws Exception { AMQConnection connection = mock(AMQConnection.class); AtomicReference addressResolver = new AtomicReference<>(); ConnectionFactory connectionFactory = new ConnectionFactory() { @Override protected AMQConnection createConnection(ConnectionParams params, FrameHandler frameHandler, - MetricsCollector metricsCollector) { + MetricsCollector metricsCollector) { return connection; } @@ -163,7 +157,42 @@ protected synchronized FrameHandlerFactory createFrameHandlerFactory() { connectionFactory.useSslProtocol(); connectionFactory.newConnection(); - assertThat(addressResolver.get(), allOf(notNullValue(), instanceOf(ListAddressResolver.class))); + assertThat(addressResolver.get()).isNotNull().isInstanceOf(ListAddressResolver.class); + } + + @Test + public void heartbeatAndChannelMaxMustBeUnsignedShorts() { + class TestConfig { + int value; + Consumer call; + boolean expectException; + + public TestConfig(int value, Consumer call, boolean expectException) { + this.value = value; + this.call = call; + this.expectException = expectException; + } + } + + ConnectionFactory cf = new ConnectionFactory(); + Consumer setHeartbeat = cf::setRequestedHeartbeat; + Consumer setChannelMax = cf::setRequestedChannelMax; + + Stream.of( + new TestConfig(0, setHeartbeat, false), + new TestConfig(10, setHeartbeat, false), + new TestConfig(65535, setHeartbeat, false), + new TestConfig(-1, setHeartbeat, true), + new TestConfig(65536, setHeartbeat, true)) + .flatMap(config -> Stream.of(config, new TestConfig(config.value, setChannelMax, config.expectException))) + .forEach(config -> { + if (config.expectException) { + assertThatThrownBy(() -> config.call.accept(config.value)).isInstanceOf(IllegalArgumentException.class); + } else { + config.call.accept(config.value); + } + }); + } } diff --git a/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java b/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java index 0dbb808584..1dddf62e38 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java @@ -17,6 +17,7 @@ package com.rabbitmq.client.test.ssl; import com.rabbitmq.client.test.AbstractRMQTestSuite; +import com.rabbitmq.client.test.SslContextFactoryTest; import org.junit.runner.RunWith; import org.junit.runner.Runner; import org.junit.runners.Suite; @@ -34,7 +35,8 @@ ConnectionFactoryDefaultTlsVersion.class, NioTlsUnverifiedConnection.class, HostnameVerification.class, - TlsConnectionLogging.class + TlsConnectionLogging.class, + SslContextFactoryTest.class }) public class SSLTests { From af4295c33986fb1e6854c1fdb915d109bd64a341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 1 Apr 2020 15:20:00 +0200 Subject: [PATCH 200/328] Bump test dependencies Don't use JUnit's assertThat anymore, as it's deprecated in 4.13. Use assertj instead. Get rid of Awaitility (created a waitUntil test utility instead) and Hamcrest (not used anymore). (cherry picked from commit d979c388603698fc6a7b2d26507ec6554ab684a2) Conflicts: src/test/java/com/rabbitmq/client/test/FrameBuilderTest.java src/test/java/com/rabbitmq/client/test/MetricsCollectorTest.java --- pom.xml | 21 +-- .../rabbitmq/client/test/AMQChannelTest.java | 37 +++-- .../ChannelRpcTimeoutIntegrationTest.java | 10 +- .../client/test/ClientVersionTest.java | 8 +- .../test/DnsSrvRecordAddressResolverTest.java | 15 +- .../client/test/FrameBuilderTest.java | 37 +++-- .../com/rabbitmq/client/test/FrameTest.java | 5 +- .../client/test/MetricsCollectorTest.java | 83 +++++----- .../test/MicrometerMetricsCollectorTest.java | 17 +-- ...NoAutoRecoveryWhenTcpWindowIsFullTest.java | 31 ++-- .../test/PropertyFileInitialisationTest.java | 86 +++++------ .../com/rabbitmq/client/test/RpcTest.java | 4 +- .../test/StrictExceptionHandlerTest.java | 7 +- .../com/rabbitmq/client/test/TestUtils.java | 25 +++ .../rabbitmq/client/test/TestUtilsTest.java | 17 +-- .../test/functional/ConnectionRecovery.java | 142 +++++++++--------- .../client/test/functional/Metrics.java | 132 ++++++++-------- .../functional/TopologyRecoveryFiltering.java | 14 +- src/test/java/com/rabbitmq/tools/Host.java | 3 +- 19 files changed, 326 insertions(+), 368 deletions(-) diff --git a/pom.xml b/pom.xml index 0c79405b3b..76f2173524 100644 --- a/pom.xml +++ b/pom.xml @@ -59,11 +59,10 @@ 1.3.2 2.10.1 1.2.3 - 4.12 - 4.0.1 - 3.2.0 - 3.14.0 - 9.4.24.v20191120 + 4.13 + 3.3.3 + 3.15.0 + 9.4.27.v20200227 1.64 3.1.1 @@ -722,12 +721,6 @@ ${logback.version} test - - org.awaitility - awaitility - ${awaitility.version} - test - org.mockito mockito-core @@ -740,12 +733,6 @@ ${assertj.version} test - - org.hamcrest - hamcrest-library - 1.3 - test - org.eclipse.jetty jetty-servlet diff --git a/src/test/java/com/rabbitmq/client/test/AMQChannelTest.java b/src/test/java/com/rabbitmq/client/test/AMQChannelTest.java index cb5f65d4fb..73a8731eea 100644 --- a/src/test/java/com/rabbitmq/client/test/AMQChannelTest.java +++ b/src/test/java/com/rabbitmq/client/test/AMQChannelTest.java @@ -33,8 +33,8 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import static org.mockito.Mockito.*; public class AMQChannelTest { @@ -69,10 +69,10 @@ public class AMQChannelTest { fail("Should time out and throw an exception"); } catch(ChannelContinuationTimeoutException e) { // OK - assertThat((DummyAmqChannel) e.getChannel(), is(channel)); - assertThat(e.getChannelNumber(), is(channel.getChannelNumber())); - assertThat(e.getMethod(), is(method)); - assertNull("outstanding RPC should have been cleaned", channel.nextOutstandingRpc()); + assertThat((DummyAmqChannel) e.getChannel()).isEqualTo(channel); + assertThat(e.getChannelNumber()).isEqualTo(channel.getChannelNumber()); + assertThat(e.getMethod()).isEqualTo(method); + assertThat(channel.nextOutstandingRpc()).as("outstanding RPC should have been cleaned").isNull(); } } @@ -105,7 +105,7 @@ public Void call() throws Exception { }, (long) (rpcTimeout / 2.0), TimeUnit.MILLISECONDS); AMQCommand rpcResponse = channel.rpc(method); - assertThat(rpcResponse.getMethod(), is(response)); + assertThat(rpcResponse.getMethod()).isEqualTo(response); } @Test @@ -130,10 +130,10 @@ public void testRpcTimeoutReplyComesDuringNexRpc() throws Exception { fail("Should time out and throw an exception"); } catch(final ChannelContinuationTimeoutException e) { // OK - assertThat((DummyAmqChannel) e.getChannel(), is(channel)); - assertThat(e.getChannelNumber(), is(channel.getChannelNumber())); - assertThat(e.getMethod(), is(method)); - assertNull("outstanding RPC should have been cleaned", channel.nextOutstandingRpc()); + assertThat((DummyAmqChannel) e.getChannel()).isEqualTo(channel); + assertThat(e.getChannelNumber()).isEqualTo(channel.getChannelNumber()); + assertThat(e.getMethod()).isEqualTo(method); + assertThat(channel.nextOutstandingRpc()).as("outstanding RPC should have been cleaned").isNull(); } // now do a basic.consume request and have the queue.declareok returned instead @@ -151,18 +151,15 @@ public void testRpcTimeoutReplyComesDuringNexRpc() throws Exception { final Method response2 = new AMQImpl.Basic.ConsumeOk.Builder() .consumerTag("456").build(); - scheduler.schedule(new Callable() { - @Override - public Void call() throws Exception { - channel.handleCompleteInboundCommand(new AMQCommand(response1)); - Thread.sleep(10); - channel.handleCompleteInboundCommand(new AMQCommand(response2)); - return null; - } + scheduler.schedule((Callable) () -> { + channel.handleCompleteInboundCommand(new AMQCommand(response1)); + Thread.sleep(10); + channel.handleCompleteInboundCommand(new AMQCommand(response2)); + return null; }, (long) (rpcTimeout / 2.0), TimeUnit.MILLISECONDS); AMQCommand rpcResponse = channel.rpc(method); - assertThat(rpcResponse.getMethod(), is(response2)); + assertThat(rpcResponse.getMethod()).isEqualTo(response2); } static class DummyAmqChannel extends AMQChannel { diff --git a/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java b/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java index 87494900a6..948074580f 100644 --- a/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java +++ b/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java @@ -27,8 +27,8 @@ import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeoutException; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; public class ChannelRpcTimeoutIntegrationTest { @@ -73,9 +73,9 @@ public void tearDown() { fail("Should time out and throw an exception"); } catch(ChannelContinuationTimeoutException e) { // OK - assertThat((Channel) e.getChannel(), is(channel)); - assertThat(e.getChannelNumber(), is(channel.getChannelNumber())); - assertThat(e.getMethod(), instanceOf(AMQP.Queue.Declare.class)); + assertThat((Channel) e.getChannel()).isEqualTo(channel); + assertThat(e.getChannelNumber()).isEqualTo(channel.getChannelNumber()); + assertThat(e.getMethod()).isInstanceOf(AMQP.Queue.Declare.class); } } finally { connection.close(); diff --git a/src/test/java/com/rabbitmq/client/test/ClientVersionTest.java b/src/test/java/com/rabbitmq/client/test/ClientVersionTest.java index 3c36dd7015..9d7560adaf 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientVersionTest.java +++ b/src/test/java/com/rabbitmq/client/test/ClientVersionTest.java @@ -18,15 +18,13 @@ import com.rabbitmq.client.impl.ClientVersion; import org.junit.Test; -import static org.hamcrest.Matchers.not; -import static org.hamcrest.Matchers.notNullValue; -import static org.junit.Assert.assertThat; +import static org.assertj.core.api.Assertions.assertThat; public class ClientVersionTest { @Test public void clientVersion() { - assertThat(ClientVersion.VERSION, notNullValue()); - assertThat(ClientVersion.VERSION, not("0.0.0")); + assertThat(ClientVersion.VERSION).isNotNull(); + assertThat(ClientVersion.VERSION).isNotEqualTo("0.0.0"); } } diff --git a/src/test/java/com/rabbitmq/client/test/DnsSrvRecordAddressResolverTest.java b/src/test/java/com/rabbitmq/client/test/DnsSrvRecordAddressResolverTest.java index 886aa1f533..e315d1147c 100644 --- a/src/test/java/com/rabbitmq/client/test/DnsSrvRecordAddressResolverTest.java +++ b/src/test/java/com/rabbitmq/client/test/DnsSrvRecordAddressResolverTest.java @@ -23,8 +23,7 @@ import java.util.Arrays; import java.util.List; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; +import static org.assertj.core.api.Assertions.assertThat; /** * @@ -46,12 +45,12 @@ protected List lookupSrvRecords(String service, String dnsUrls) throw }; List

addresses = resolver.getAddresses(); - assertThat(addresses.size(), is(5)); - assertThat(addresses.get(0).getHost(), is("alt1.xmpp-server.l.google.com")); - assertThat(addresses.get(1).getHost(), is("alt2.xmpp-server.l.google.com")); - assertThat(addresses.get(2).getHost(), is("alt3.xmpp-server.l.google.com")); - assertThat(addresses.get(3).getHost(), is("alt4.xmpp-server.l.google.com")); - assertThat(addresses.get(4).getHost(), is("alt5.xmpp-server.l.google.com")); + assertThat(addresses.size()).isEqualTo(5); + assertThat(addresses.get(0).getHost()).isEqualTo("alt1.xmpp-server.l.google.com"); + assertThat(addresses.get(1).getHost()).isEqualTo("alt2.xmpp-server.l.google.com"); + assertThat(addresses.get(2).getHost()).isEqualTo("alt3.xmpp-server.l.google.com"); + assertThat(addresses.get(3).getHost()).isEqualTo("alt4.xmpp-server.l.google.com"); + assertThat(addresses.get(4).getHost()).isEqualTo("alt5.xmpp-server.l.google.com"); } } diff --git a/src/test/java/com/rabbitmq/client/test/FrameBuilderTest.java b/src/test/java/com/rabbitmq/client/test/FrameBuilderTest.java index 64013cadd8..9c4c4197ec 100644 --- a/src/test/java/com/rabbitmq/client/test/FrameBuilderTest.java +++ b/src/test/java/com/rabbitmq/client/test/FrameBuilderTest.java @@ -28,11 +28,8 @@ import java.nio.ByteBuffer; import java.nio.channels.ReadableByteChannel; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.hamcrest.Matchers.nullValue; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; /** * @@ -52,10 +49,10 @@ public void buildFrameInOneGo() throws IOException { buffer = ByteBuffer.wrap(new byte[] { 1, 0, 0, 0, 0, 0, 3, 1, 2, 3, end() }); builder = new FrameBuilder(channel, buffer); Frame frame = builder.readFrame(); - assertThat(frame, notNullValue()); - assertThat(frame.type, is(1)); - assertThat(frame.channel, is(0)); - assertThat(frame.getPayload().length, is(3)); + assertThat(frame).isNotNull(); + assertThat(frame.type).isEqualTo(1); + assertThat(frame.channel).isEqualTo(0); + assertThat(frame.getPayload()).hasSize(3); } @Test @@ -73,13 +70,13 @@ public void buildFramesInOneGo() throws IOException { int frameCount = 0; Frame frame; while ((frame = builder.readFrame()) != null) { - assertThat(frame, notNullValue()); - assertThat(frame.type, is(1)); - assertThat(frame.channel, is(0)); - assertThat(frame.getPayload().length, is(3)); + assertThat(frame).isNotNull(); + assertThat(frame.type).isEqualTo(1); + assertThat(frame.channel).isEqualTo(0); + assertThat(frame.getPayload()).hasSize(3); frameCount++; } - assertThat(frameCount, is(nbFrames)); + assertThat(frameCount).isEqualTo(nbFrames); } @Test @@ -87,17 +84,17 @@ public void buildFrameInSeveralCalls() throws IOException { buffer = ByteBuffer.wrap(new byte[] { 1, 0, 0, 0, 0, 0, 3, 1, 2 }); builder = new FrameBuilder(channel, buffer); Frame frame = builder.readFrame(); - assertThat(frame, nullValue()); + assertThat(frame).isNull(); buffer.clear(); buffer.put(b(3)).put(end()); buffer.flip(); frame = builder.readFrame(); - assertThat(frame, notNullValue()); - assertThat(frame.type, is(1)); - assertThat(frame.channel, is(0)); - assertThat(frame.getPayload().length, is(3)); + assertThat(frame).isNotNull(); + assertThat(frame.type).isEqualTo(1); + assertThat(frame.channel).isEqualTo(0); + assertThat(frame.getPayload()).hasSize(3); } @Test @@ -127,7 +124,7 @@ public void protocolMismatchHeader() throws IOException { builder.readFrame(); fail("protocol header not correct, exception should have been thrown"); } catch (MalformedFrameException e) { - assertThat(e.getMessage(), is(messages[i])); + assertThat(e.getMessage()).isEqualTo(messages[i]); } } } diff --git a/src/test/java/com/rabbitmq/client/test/FrameTest.java b/src/test/java/com/rabbitmq/client/test/FrameTest.java index a154a6cfe3..26441a848b 100644 --- a/src/test/java/com/rabbitmq/client/test/FrameTest.java +++ b/src/test/java/com/rabbitmq/client/test/FrameTest.java @@ -17,8 +17,7 @@ import java.util.List; import java.util.Random; -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; +import static org.assertj.core.api.Assertions.assertThat; /** * @@ -72,7 +71,7 @@ private void checkWrittenChunks(int totalFrameSize, AccumulatorWritableByteChann for (byte[] chunk : channel.chunks) { totalWritten += chunk.length; } - assertThat(totalWritten, equalTo(totalFrameSize)); + assertThat(totalWritten).isEqualTo(totalFrameSize); } private static class AccumulatorWritableByteChannel implements WritableByteChannel { diff --git a/src/test/java/com/rabbitmq/client/test/MetricsCollectorTest.java b/src/test/java/com/rabbitmq/client/test/MetricsCollectorTest.java index 27b4f21cd8..5d424a69a3 100644 --- a/src/test/java/com/rabbitmq/client/test/MetricsCollectorTest.java +++ b/src/test/java/com/rabbitmq/client/test/MetricsCollectorTest.java @@ -28,8 +28,7 @@ import java.io.IOException; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -70,16 +69,16 @@ public void basicGetAndAck() { metrics.consumedMessage(channel, 6, false); metrics.basicAck(channel, 6, false); - assertThat(acknowledgedMessages(metrics), is(1L)); + assertThat(acknowledgedMessages(metrics)).isEqualTo(1L); metrics.basicAck(channel, 3, true); - assertThat(acknowledgedMessages(metrics), is(1L+2L)); + assertThat(acknowledgedMessages(metrics)).isEqualTo(1L+2L); metrics.basicAck(channel, 6, true); - assertThat(acknowledgedMessages(metrics), is(1L+2L+1L)); + assertThat(acknowledgedMessages(metrics)).isEqualTo(1L+2L+1L); metrics.basicAck(channel, 10, true); - assertThat(acknowledgedMessages(metrics), is(1L+2L+1L)); + assertThat(acknowledgedMessages(metrics)).isEqualTo(1L+2L+1L); } @Test public void basicConsumeAndAck() { @@ -99,8 +98,8 @@ public void basicGetAndAck() { metrics.basicConsume(channel, consumerTagWithManualAck, false); metrics.consumedMessage(channel, 1, consumerTagWithAutoAck); - assertThat(consumedMessages(metrics), is(1L)); - assertThat(acknowledgedMessages(metrics), is(0L)); + assertThat(consumedMessages(metrics)).isEqualTo(1L); + assertThat(acknowledgedMessages(metrics)).isEqualTo(0L); metrics.consumedMessage(channel, 2, consumerTagWithManualAck); metrics.consumedMessage(channel, 3, consumerTagWithManualAck); @@ -109,44 +108,44 @@ public void basicGetAndAck() { metrics.consumedMessage(channel, 6, consumerTagWithManualAck); metrics.basicAck(channel, 6, false); - assertThat(acknowledgedMessages(metrics), is(1L)); + assertThat(acknowledgedMessages(metrics)).isEqualTo(1L); metrics.basicAck(channel, 3, true); - assertThat(acknowledgedMessages(metrics), is(1L+2L)); + assertThat(acknowledgedMessages(metrics)).isEqualTo(1L+2L); metrics.basicAck(channel, 6, true); - assertThat(acknowledgedMessages(metrics), is(1L+2L+1L)); + assertThat(acknowledgedMessages(metrics)).isEqualTo(1L+2L+1L); metrics.basicAck(channel, 10, true); - assertThat(acknowledgedMessages(metrics), is(1L+2L+1L)); + assertThat(acknowledgedMessages(metrics)).isEqualTo(1L+2L+1L); } @Test public void publishingAndPublishingFailures() { AbstractMetricsCollector metrics = factory.create(); Channel channel = mock(Channel.class); - assertThat(failedToPublishMessages(metrics), is(0L)); - assertThat(publishedMessages(metrics), is(0L)); + assertThat(failedToPublishMessages(metrics)).isEqualTo(0L); + assertThat(publishedMessages(metrics)).isEqualTo(0L); metrics.basicPublishFailure(channel, new IOException()); - assertThat(failedToPublishMessages(metrics), is(1L)); - assertThat(publishedMessages(metrics), is(0L)); + assertThat(failedToPublishMessages(metrics)).isEqualTo(1L); + assertThat(publishedMessages(metrics)).isEqualTo(0L); metrics.basicPublish(channel); - assertThat(failedToPublishMessages(metrics), is(1L)); - assertThat(publishedMessages(metrics), is(1L)); + assertThat(failedToPublishMessages(metrics)).isEqualTo(1L); + assertThat(publishedMessages(metrics)).isEqualTo(1L); metrics.basicPublishFailure(channel, new IOException()); - assertThat(failedToPublishMessages(metrics), is(2L)); - assertThat(publishedMessages(metrics), is(1L)); + assertThat(failedToPublishMessages(metrics)).isEqualTo(2L); + assertThat(publishedMessages(metrics)).isEqualTo(1L); metrics.basicPublish(channel); - assertThat(failedToPublishMessages(metrics), is(2L)); - assertThat(publishedMessages(metrics), is(2L)); + assertThat(failedToPublishMessages(metrics)).isEqualTo(2L); + assertThat(publishedMessages(metrics)).isEqualTo(2L); metrics.cleanStaleState(); - assertThat(failedToPublishMessages(metrics), is(2L)); - assertThat(publishedMessages(metrics), is(2L)); + assertThat(failedToPublishMessages(metrics)).isEqualTo(2L); + assertThat(publishedMessages(metrics)).isEqualTo(2L); } @Test public void publishingAcknowledgements() { @@ -154,19 +153,19 @@ public void basicGetAndAck() { AbstractMetricsCollector metrics = factory.create(); Channel channel = mock(Channel.class); // begins with no messages acknowledged - assertThat(publishAck(metrics), is(0L)); + assertThat(publishAck(metrics)).isEqualTo(0L); // first acknowledgement gets tracked metrics.basicPublishAck(channel, anyDeliveryTag, false); - assertThat(publishAck(metrics), is(1L)); + assertThat(publishAck(metrics)).isEqualTo(1L); // second acknowledgement gets tracked metrics.basicPublishAck(channel, anyDeliveryTag, false); - assertThat(publishAck(metrics), is(2L)); + assertThat(publishAck(metrics)).isEqualTo(2L); // multiple deliveries aren't tracked metrics.basicPublishAck(channel, anyDeliveryTag, true); - assertThat(publishAck(metrics), is(2L)); + assertThat(publishAck(metrics)).isEqualTo(2); // cleaning stale state doesn't affect the metric metrics.cleanStaleState(); - assertThat(publishAck(metrics), is(2L)); + assertThat(publishAck(metrics)).isEqualTo(2); } @Test public void publishingNotAcknowledgements() { @@ -174,35 +173,35 @@ public void basicGetAndAck() { AbstractMetricsCollector metrics = factory.create(); Channel channel = mock(Channel.class); // begins with no messages not-acknowledged - assertThat(publishNack(metrics), is(0L)); + assertThat(publishNack(metrics)).isEqualTo(0L); // first not-acknowledgement gets tracked metrics.basicPublishNack(channel, anyDeliveryTag, false); - assertThat(publishNack(metrics), is(1L)); + assertThat(publishNack(metrics)).isEqualTo(1L); // second not-acknowledgement gets tracked metrics.basicPublishNack(channel, anyDeliveryTag, false); - assertThat(publishNack(metrics), is(2L)); + assertThat(publishNack(metrics)).isEqualTo(2L); // multiple deliveries aren't tracked metrics.basicPublishNack(channel, anyDeliveryTag, true); - assertThat(publishNack(metrics), is(2L)); + assertThat(publishNack(metrics)).isEqualTo(2L); // cleaning stale state doesn't affect the metric metrics.cleanStaleState(); - assertThat(publishNack(metrics), is(2L)); + assertThat(publishNack(metrics)).isEqualTo(2L); } @Test public void publishingUnrouted() { AbstractMetricsCollector metrics = factory.create(); Channel channel = mock(Channel.class); // begins with no messages not-acknowledged - assertThat(publishUnrouted(metrics), is(0L)); + assertThat(publishUnrouted(metrics)).isEqualTo(0L); // first unrouted gets tracked metrics.basicPublishUnrouted(channel); - assertThat(publishUnrouted(metrics), is(1L)); + assertThat(publishUnrouted(metrics)).isEqualTo(1L); // second unrouted gets tracked metrics.basicPublishUnrouted(channel); - assertThat(publishUnrouted(metrics), is(2L)); + assertThat(publishUnrouted(metrics)).isEqualTo(2L); // cleaning stale state doesn't affect the metric metrics.cleanStaleState(); - assertThat(publishUnrouted(metrics), is(2L)); + assertThat(publishUnrouted(metrics)).isEqualTo(2L); } @Test public void cleanStaleState() { @@ -236,13 +235,13 @@ public void basicGetAndAck() { metrics.newChannel(closedChannel); metrics.newChannel(openChannelInClosedConnection); - assertThat(connections(metrics), is(2L)); - assertThat(channels(metrics), is(2L+1L)); + assertThat(connections(metrics)).isEqualTo(2L); + assertThat(channels(metrics)).isEqualTo(2L+1L); metrics.cleanStaleState(); - assertThat(connections(metrics), is(1L)); - assertThat(channels(metrics), is(1L)); + assertThat(connections(metrics)).isEqualTo(1L); + assertThat(channels(metrics)).isEqualTo(1L); } diff --git a/src/test/java/com/rabbitmq/client/test/MicrometerMetricsCollectorTest.java b/src/test/java/com/rabbitmq/client/test/MicrometerMetricsCollectorTest.java index 5cc8aa6178..77798a0088 100644 --- a/src/test/java/com/rabbitmq/client/test/MicrometerMetricsCollectorTest.java +++ b/src/test/java/com/rabbitmq/client/test/MicrometerMetricsCollectorTest.java @@ -18,14 +18,10 @@ import com.rabbitmq.client.impl.MicrometerMetricsCollector; import io.micrometer.core.instrument.Meter; import io.micrometer.core.instrument.simple.SimpleMeterRegistry; +import org.assertj.core.api.Assertions; import org.junit.Before; import org.junit.Test; -import java.util.Iterator; - -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; - /** * */ @@ -44,7 +40,7 @@ public void init() { public void noTag() { collector = new MicrometerMetricsCollector(registry, "rabbitmq"); for (Meter meter : registry.getMeters()) { - assertThat(size(meter.getId().getTags()), is(0)); + Assertions.assertThat(meter.getId().getTags()).isEmpty(); } } @@ -52,7 +48,7 @@ public void noTag() { public void tags() { collector = new MicrometerMetricsCollector(registry, "rabbitmq", "uri", "/api/users"); for (Meter meter : registry.getMeters()) { - assertThat(size(meter.getId().getTags()), is(1)); + Assertions.assertThat(meter.getId().getTags()).hasSize(1); } } @@ -61,11 +57,4 @@ public void tagsMustBeKeyValuePairs() { collector = new MicrometerMetricsCollector(registry, "rabbitmq", "uri"); } - static int size(Iterable iterable) { - Iterator iterator = iterable.iterator(); - int i = 0; - for ( ; iterator.hasNext() ; ++i ) iterator.next(); - return i; - } - } diff --git a/src/test/java/com/rabbitmq/client/test/NoAutoRecoveryWhenTcpWindowIsFullTest.java b/src/test/java/com/rabbitmq/client/test/NoAutoRecoveryWhenTcpWindowIsFullTest.java index 5014bcda2f..62a237cb83 100644 --- a/src/test/java/com/rabbitmq/client/test/NoAutoRecoveryWhenTcpWindowIsFullTest.java +++ b/src/test/java/com/rabbitmq/client/test/NoAutoRecoveryWhenTcpWindowIsFullTest.java @@ -42,8 +42,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; +import static org.assertj.core.api.Assertions.assertThat; /** * Test to trigger and check the fix of rabbitmq/rabbitmq-java-client#341, @@ -149,15 +148,13 @@ public void handleRecoveryStarted(Recoverable recoverable) { produceMessagesInBackground(producingChannel, queue); startConsumer(queue); - assertThat( - "Connection should have been closed and should have recovered by now", - recoveryLatch.await(60, TimeUnit.SECONDS), is(true) - ); + assertThat(recoveryLatch.await(60, TimeUnit.SECONDS)) + .as("Connection should have been closed and should have recovered by now") + .isTrue(); - assertThat( - "Consumer should have recovered by now", - consumerOkLatch.await(5, TimeUnit.SECONDS), is(true) - ); + assertThat(consumerOkLatch.await(5, TimeUnit.SECONDS)) + .as("Consumer should have recovered by now") + .isTrue(); } private void closeConnectionIfOpen(Connection connection) throws IOException { @@ -173,16 +170,12 @@ private void declareQueue(final Channel channel, final String queue) throws IOEx private void produceMessagesInBackground(final Channel channel, final String queue) throws IOException { final AMQP.BasicProperties properties = new AMQP.BasicProperties.Builder().deliveryMode(1).build(); - executorService.submit(new Callable() { - - @Override - public Void call() throws Exception { - for (int i = 0; i < NUM_MESSAGES_TO_PRODUCE; i++) { - channel.basicPublish("", queue, false, properties, MESSAGE_CONTENT); - } - closeConnectionIfOpen(producingConnection); - return null; + executorService.submit((Callable) () -> { + for (int i = 0; i < NUM_MESSAGES_TO_PRODUCE; i++) { + channel.basicPublish("", queue, false, properties, MESSAGE_CONTENT); } + closeConnectionIfOpen(producingConnection); + return null; }); } diff --git a/src/test/java/com/rabbitmq/client/test/PropertyFileInitialisationTest.java b/src/test/java/com/rabbitmq/client/test/PropertyFileInitialisationTest.java index 3d6099e12c..0c5df5823f 100644 --- a/src/test/java/com/rabbitmq/client/test/PropertyFileInitialisationTest.java +++ b/src/test/java/com/rabbitmq/client/test/PropertyFileInitialisationTest.java @@ -30,11 +30,7 @@ import java.util.Properties; import static com.rabbitmq.client.impl.AMQConnection.defaultClientProperties; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not; -import static org.hamcrest.Matchers.notNullValue; -import static org.junit.Assert.assertThat; +import static org.assertj.core.api.Assertions.assertThat; /** * @@ -84,24 +80,24 @@ public static Object[] data() { @Test public void propertyInitialisationUri() { cf.load(Collections.singletonMap("rabbitmq.uri", "amqp://foo:bar@127.0.0.1:5673/dummy")); - assertThat(cf.getUsername(), is("foo")); - assertThat(cf.getPassword(), is("bar")); - assertThat(cf.getVirtualHost(), is("dummy")); - assertThat(cf.getHost(), is("127.0.0.1")); - assertThat(cf.getPort(), is(5673)); + assertThat(cf.getUsername()).isEqualTo("foo"); + assertThat(cf.getPassword()).isEqualTo("bar"); + assertThat(cf.getVirtualHost()).isEqualTo("dummy"); + assertThat(cf.getHost()).isEqualTo("127.0.0.1"); + assertThat(cf.getPort()).isEqualTo(5673); } @Test public void propertyInitialisationIncludeDefaultClientPropertiesByDefault() { - cf.load(new HashMap()); - assertThat(cf.getClientProperties().entrySet(), hasSize(defaultClientProperties().size())); + cf.load(new HashMap<>()); + assertThat(cf.getClientProperties().entrySet()).hasSize(defaultClientProperties().size()); } @Test public void propertyInitialisationAddCustomClientProperty() { cf.load(new HashMap() {{ put("rabbitmq.client.properties.foo", "bar"); }}); - assertThat(cf.getClientProperties().entrySet(), hasSize(defaultClientProperties().size() + 1)); - assertThat(cf.getClientProperties().get("foo").toString(), is("bar")); + assertThat(cf.getClientProperties().entrySet()).hasSize(defaultClientProperties().size() + 1); + assertThat(cf.getClientProperties()).extracting("foo").isEqualTo("bar"); } @Test public void propertyInitialisationGetRidOfDefaultClientPropertyWithEmptyValue() { @@ -109,7 +105,7 @@ public static Object[] data() { cf.load(new HashMap() {{ put("rabbitmq.client.properties." + key, ""); }}); - assertThat(cf.getClientProperties().entrySet(), hasSize(defaultClientProperties().size() - 1)); + assertThat(cf.getClientProperties().entrySet()).hasSize(defaultClientProperties().size() - 1); } @Test public void propertyInitialisationOverrideDefaultClientProperty() { @@ -117,8 +113,8 @@ public static Object[] data() { cf.load(new HashMap() {{ put("rabbitmq.client.properties." + key, "whatever"); }}); - assertThat(cf.getClientProperties().entrySet(), hasSize(defaultClientProperties().size())); - assertThat(cf.getClientProperties().get(key).toString(), is("whatever")); + assertThat(cf.getClientProperties().entrySet()).hasSize(defaultClientProperties().size()); + assertThat(cf.getClientProperties()).extracting(key).isEqualTo("whatever"); } @Test public void propertyInitialisationDoNotUseNio() throws Exception { @@ -126,37 +122,37 @@ public static Object[] data() { put("rabbitmq.use.nio", "false"); put("rabbitmq.nio.nb.io.threads", "2"); }}); - assertThat(cf.getNioParams().getNbIoThreads(), not(2)); + assertThat(cf.getNioParams().getNbIoThreads()).isNotEqualTo(2); } private void checkConnectionFactory() { - assertThat(cf.getUsername(), is("foo")); - assertThat(cf.getPassword(), is("bar")); - assertThat(cf.getVirtualHost(), is("dummy")); - assertThat(cf.getHost(), is("127.0.0.1")); - assertThat(cf.getPort(), is(5673)); - - assertThat(cf.getRequestedChannelMax(), is(1)); - assertThat(cf.getRequestedFrameMax(), is(2)); - assertThat(cf.getRequestedHeartbeat(), is(10)); - assertThat(cf.getConnectionTimeout(), is(10000)); - assertThat(cf.getHandshakeTimeout(), is(5000)); - - assertThat(cf.getClientProperties().entrySet(), hasSize(defaultClientProperties().size() + 1)); - assertThat(cf.getClientProperties().get("foo").toString(), is("bar")); - - assertThat(cf.isAutomaticRecoveryEnabled(), is(false)); - assertThat(cf.isTopologyRecoveryEnabled(), is(false)); - assertThat(cf.getNetworkRecoveryInterval(), is(10000l)); - assertThat(cf.getChannelRpcTimeout(), is(10000)); - assertThat(cf.isChannelShouldCheckRpcResponseType(), is(true)); - - assertThat(cf.getNioParams(), notNullValue()); - assertThat(cf.getNioParams().getReadByteBufferSize(), is(32000)); - assertThat(cf.getNioParams().getWriteByteBufferSize(), is(32000)); - assertThat(cf.getNioParams().getNbIoThreads(), is(2)); - assertThat(cf.getNioParams().getWriteEnqueuingTimeoutInMs(), is(5000)); - assertThat(cf.getNioParams().getWriteQueueCapacity(), is(1000)); + assertThat(cf.getUsername()).isEqualTo("foo"); + assertThat(cf.getPassword()).isEqualTo("bar"); + assertThat(cf.getVirtualHost()).isEqualTo("dummy"); + assertThat(cf.getHost()).isEqualTo("127.0.0.1"); + assertThat(cf.getPort()).isEqualTo(5673); + + assertThat(cf.getRequestedChannelMax()).isEqualTo(1); + assertThat(cf.getRequestedFrameMax()).isEqualTo(2); + assertThat(cf.getRequestedHeartbeat()).isEqualTo(10); + assertThat(cf.getConnectionTimeout()).isEqualTo(10000); + assertThat(cf.getHandshakeTimeout()).isEqualTo(5000); + + assertThat(cf.getClientProperties().entrySet()).hasSize(defaultClientProperties().size() + 1); + assertThat(cf.getClientProperties()).extracting("foo").isEqualTo("bar"); + + assertThat(cf.isAutomaticRecoveryEnabled()).isFalse(); + assertThat(cf.isTopologyRecoveryEnabled()).isFalse(); + assertThat(cf.getNetworkRecoveryInterval()).isEqualTo(10000l); + assertThat(cf.getChannelRpcTimeout()).isEqualTo(10000); + assertThat(cf.isChannelShouldCheckRpcResponseType()).isTrue(); + + assertThat(cf.getNioParams()).isNotNull(); + assertThat(cf.getNioParams().getReadByteBufferSize()).isEqualTo(32000); + assertThat(cf.getNioParams().getWriteByteBufferSize()).isEqualTo(32000); + assertThat(cf.getNioParams().getNbIoThreads()).isEqualTo(2); + assertThat(cf.getNioParams().getWriteEnqueuingTimeoutInMs()).isEqualTo(5000); + assertThat(cf.getNioParams().getWriteQueueCapacity()).isEqualTo(1000); } private Properties getPropertiesWitPrefix(String prefix) throws IOException { diff --git a/src/test/java/com/rabbitmq/client/test/RpcTest.java b/src/test/java/com/rabbitmq/client/test/RpcTest.java index 87d0be518b..a11544f2b4 100644 --- a/src/test/java/com/rabbitmq/client/test/RpcTest.java +++ b/src/test/java/com/rabbitmq/client/test/RpcTest.java @@ -39,7 +39,7 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; -import static org.awaitility.Awaitility.waitAtMost; +import static com.rabbitmq.client.test.TestUtils.waitAtMost; import static org.junit.Assert.*; public class RpcTest { @@ -320,7 +320,7 @@ public void handleRecoveryStarted(Recoverable recoverable) { serverThread.interrupt(); - waitAtMost(Duration.ofSeconds(1)).until(() -> !serverThread.isAlive()) ; + waitAtMost(Duration.ofSeconds(1), () -> !serverThread.isAlive()); client.close(); } diff --git a/src/test/java/com/rabbitmq/client/test/StrictExceptionHandlerTest.java b/src/test/java/com/rabbitmq/client/test/StrictExceptionHandlerTest.java index 300d8ad053..06bf5efe7c 100644 --- a/src/test/java/com/rabbitmq/client/test/StrictExceptionHandlerTest.java +++ b/src/test/java/com/rabbitmq/client/test/StrictExceptionHandlerTest.java @@ -28,9 +28,8 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; public class StrictExceptionHandlerTest { @@ -58,7 +57,7 @@ public void handleConsumerException(Channel channel, Throwable exception, Consum channel )); channel.basicPublish("", queue, null, new byte[0]); - assertThat(latch.await(5, TimeUnit.SECONDS), is(true)); + assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); } } diff --git a/src/test/java/com/rabbitmq/client/test/TestUtils.java b/src/test/java/com/rabbitmq/client/test/TestUtils.java index 012882d3f4..b6cec91132 100644 --- a/src/test/java/com/rabbitmq/client/test/TestUtils.java +++ b/src/test/java/com/rabbitmq/client/test/TestUtils.java @@ -19,6 +19,7 @@ import com.rabbitmq.client.impl.NetworkConnection; import com.rabbitmq.client.impl.recovery.AutorecoveringConnection; import com.rabbitmq.tools.Host; +import org.assertj.core.api.Assertions; import org.junit.AssumptionViolatedException; import org.junit.rules.TestRule; import org.junit.runner.Description; @@ -29,6 +30,7 @@ import java.io.IOException; import java.net.ServerSocket; import java.security.NoSuchAlgorithmException; +import java.time.Duration; import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -36,6 +38,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import java.util.function.BooleanSupplier; import static org.junit.Assert.assertTrue; @@ -53,6 +56,28 @@ public static ConnectionFactory connectionFactory() { return connectionFactory; } + public static void waitAtMost(Duration timeout, BooleanSupplier condition) { + if (condition.getAsBoolean()) { + return; + } + int waitTime = 100; + int waitedTime = 0; + long timeoutInMs = timeout.toMillis(); + while (waitedTime <= timeoutInMs) { + try { + Thread.sleep(waitTime); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new RuntimeException(e); + } + if (condition.getAsBoolean()) { + return; + } + waitedTime += waitTime; + } + Assertions.fail("Waited " + timeout.getSeconds() + " second(s), condition never got true"); + } + public static void close(Connection connection) { if (connection != null) { try { diff --git a/src/test/java/com/rabbitmq/client/test/TestUtilsTest.java b/src/test/java/com/rabbitmq/client/test/TestUtilsTest.java index 1de1fe975a..76e5276d7d 100644 --- a/src/test/java/com/rabbitmq/client/test/TestUtilsTest.java +++ b/src/test/java/com/rabbitmq/client/test/TestUtilsTest.java @@ -16,13 +16,12 @@ package com.rabbitmq.client.test; import com.rabbitmq.client.Connection; +import org.assertj.core.api.Assertions; import org.junit.Test; import java.util.HashMap; import java.util.Map; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -35,13 +34,13 @@ public void isVersion37orLater() { when(connection.getServerProperties()).thenReturn(serverProperties); serverProperties.put("version", "3.7.0+rc.1.4.gedc5d96"); - assertThat(TestUtils.isVersion37orLater(connection), is(true)); + Assertions.assertThat(TestUtils.isVersion37orLater(connection)).isTrue(); serverProperties.put("version", "3.7.0~alpha.449-1"); - assertThat(TestUtils.isVersion37orLater(connection), is(true)); + Assertions.assertThat(TestUtils.isVersion37orLater(connection)).isTrue(); serverProperties.put("version", "3.7.1-alpha.40"); - assertThat(TestUtils.isVersion37orLater(connection), is(true)); + Assertions.assertThat(TestUtils.isVersion37orLater(connection)).isTrue(); } @Test @@ -51,15 +50,15 @@ public void isVersion38orLater() { when(connection.getServerProperties()).thenReturn(serverProperties); serverProperties.put("version", "3.7.0+rc.1.4.gedc5d96"); - assertThat(TestUtils.isVersion38orLater(connection), is(false)); + Assertions.assertThat(TestUtils.isVersion38orLater(connection)).isFalse(); serverProperties.put("version", "3.7.0~alpha.449-1"); - assertThat(TestUtils.isVersion38orLater(connection), is(false)); + Assertions.assertThat(TestUtils.isVersion38orLater(connection)).isFalse(); serverProperties.put("version", "3.7.1-alpha.40"); - assertThat(TestUtils.isVersion38orLater(connection), is(false)); + Assertions.assertThat(TestUtils.isVersion38orLater(connection)).isFalse(); serverProperties.put("version", "3.8.0+beta.4.38.g33a7f97"); - assertThat(TestUtils.isVersion38orLater(connection), is(true)); + Assertions.assertThat(TestUtils.isVersion38orLater(connection)).isTrue(); } } diff --git a/src/test/java/com/rabbitmq/client/test/functional/ConnectionRecovery.java b/src/test/java/com/rabbitmq/client/test/functional/ConnectionRecovery.java index 486e5448ce..426e3c2c0f 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ConnectionRecovery.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ConnectionRecovery.java @@ -40,9 +40,8 @@ import java.util.concurrent.atomic.AtomicReference; import static com.rabbitmq.client.test.TestUtils.prepareForRecovery; -import static org.hamcrest.Matchers.greaterThanOrEqualTo; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; @SuppressWarnings("ThrowFromFinallyBlock") public class ConnectionRecovery extends BrokerTestCase { @@ -51,9 +50,9 @@ public class ConnectionRecovery extends BrokerTestCase { private static final int MANY_DECLARATIONS_LOOP_COUNT = 500; @Test public void connectionRecovery() throws IOException, InterruptedException { - assertTrue(connection.isOpen()); + assertThat(connection.isOpen()).isTrue(); closeAndWaitForRecovery(); - assertTrue(connection.isOpen()); + assertThat(connection.isOpen()).isTrue(); } @Test public void namedConnectionRecovery() @@ -61,20 +60,20 @@ public class ConnectionRecovery extends BrokerTestCase { String connectionName = "custom name"; RecoverableConnection c = newRecoveringConnection(connectionName); try { - assertTrue(c.isOpen()); - assertEquals(connectionName, c.getClientProvidedName()); + assertThat(c.isOpen()).isTrue(); + assertThat(connectionName).isEqualTo(c.getClientProvidedName()); TestUtils.closeAndWaitForRecovery(c); - assertTrue(c.isOpen()); - assertEquals(connectionName, c.getClientProvidedName()); + assertThat(c.isOpen()).isTrue(); + assertThat(connectionName).isEqualTo(c.getClientProvidedName()); } finally { c.abort(); } } @Test public void connectionRecoveryWithServerRestart() throws IOException, InterruptedException { - assertTrue(connection.isOpen()); + assertThat(connection.isOpen()).isTrue(); restartPrimaryAndWaitForRecovery(); - assertTrue(connection.isOpen()); + assertThat(connection.isOpen()).isTrue(); } @Test public void connectionRecoveryWithArrayOfAddresses() @@ -82,9 +81,9 @@ public class ConnectionRecovery extends BrokerTestCase { final Address[] addresses = {new Address("127.0.0.1"), new Address("127.0.0.1", 5672)}; RecoverableConnection c = newRecoveringConnection(addresses); try { - assertTrue(c.isOpen()); + assertThat(c.isOpen()).isTrue(); TestUtils.closeAndWaitForRecovery(c); - assertTrue(c.isOpen()); + assertThat(c.isOpen()).isTrue(); } finally { c.abort(); } @@ -98,9 +97,9 @@ public class ConnectionRecovery extends BrokerTestCase { RecoverableConnection c = newRecoveringConnection(addresses); try { - assertTrue(c.isOpen()); + assertThat(c.isOpen()).isTrue(); TestUtils.closeAndWaitForRecovery(c); - assertTrue(c.isOpen()); + assertThat(c.isOpen()).isTrue(); } finally { c.abort(); } @@ -113,14 +112,14 @@ public class ConnectionRecovery extends BrokerTestCase { String q = "java-client.test.recovery.q2"; ch.queueDeclare(q, false, true, false, null); ch.queueDeclarePassive(q); - assertTrue(c.isOpen()); + assertThat(c.isOpen()).isTrue(); try { CountDownLatch shutdownLatch = prepareForShutdown(c); CountDownLatch recoveryLatch = prepareForRecovery(c); Host.closeConnection((NetworkConnection) c); wait(shutdownLatch); wait(recoveryLatch); - assertTrue(c.isOpen()); + assertThat(c.isOpen()).isTrue(); ch.queueDeclarePassive(q); fail("expected passive declaration to throw"); } catch (java.io.IOException e) { @@ -154,15 +153,15 @@ public String getPassword() { }); RecoverableConnection c = (RecoverableConnection) cf.newConnection(); try { - assertTrue(c.isOpen()); - assertThat(usernameRequested.get(), is(1)); - assertThat(passwordRequested.get(), is(1)); + assertThat(c.isOpen()).isTrue(); + assertThat(usernameRequested.get()).isEqualTo(1); + assertThat(passwordRequested.get()).isEqualTo(1); TestUtils.closeAndWaitForRecovery(c); - assertTrue(c.isOpen()); + assertThat(c.isOpen()).isTrue(); // username is requested in AMQConnection#toString, so it can be accessed at any time - assertThat(usernameRequested.get(), greaterThanOrEqualTo(2)); - assertThat(passwordRequested.get(), is(2)); + assertThat(usernameRequested.get()).isGreaterThanOrEqualTo(2); + assertThat(passwordRequested.get()).isEqualTo(2); } finally { c.abort(); } @@ -204,13 +203,13 @@ public void handleRecoveryStarted(Recoverable recoverable) { latch.countDown(); } }); - assertTrue(connection.isOpen()); + assertThat(connection.isOpen()).isTrue(); closeAndWaitForRecovery(); - assertTrue(connection.isOpen()); - assertEquals("shutdown hook 1", events.get(0)); - assertEquals("shutdown hook 2", events.get(1)); + assertThat(connection.isOpen()).isTrue(); + assertThat(events).element(0).isEqualTo("shutdown hook 1"); + assertThat(events).element(1).isEqualTo("shutdown hook 2"); recoveryCanBeginLatch.await(5, TimeUnit.SECONDS); - assertEquals("recovery start hook 1", events.get(2)); + assertThat(events).element(2).isEqualTo("recovery start hook 1"); connection.close(); wait(latch); } @@ -223,9 +222,9 @@ public void shutdownCompleted(ShutdownSignalException cause) { latch.countDown(); } }); - assertTrue(connection.isOpen()); + assertThat(connection.isOpen()).isTrue(); closeAndWaitForRecovery(); - assertTrue(connection.isOpen()); + assertThat(connection.isOpen()).isTrue(); connection.close(); wait(latch); } @@ -238,11 +237,11 @@ public void shutdownCompleted(ShutdownSignalException cause) { latch.countDown(); } }); - assertTrue(connection.isOpen()); + assertThat(connection.isOpen()).isTrue(); closeAndWaitForRecovery(); - assertTrue(connection.isOpen()); + assertThat(connection.isOpen()).isTrue(); closeAndWaitForRecovery(); - assertTrue(connection.isOpen()); + assertThat(connection.isOpen()).isTrue(); connection.close(); wait(latch); } @@ -271,8 +270,8 @@ public void handleUnblocked() throws IOException { Channel ch1 = connection.createChannel(); Channel ch2 = connection.createChannel(); - assertTrue(ch1.isOpen()); - assertTrue(ch2.isOpen()); + assertThat(ch1.isOpen()).isTrue(); + assertThat(ch2.isOpen()).isTrue(); closeAndWaitForRecovery(); expectChannelRecovery(ch1); expectChannelRecovery(ch2); @@ -391,7 +390,7 @@ private void testClientNamedQueueRecoveryWith(String q, boolean noWait) throws I ch.basicPublish(x, "", null, "msg".getBytes()); waitForConfirms(ch); AMQP.Queue.DeclareOk ok = ch.queueDeclare(q, false, false, true, null); - assertEquals(1, ok.getMessageCount()); + assertThat(ok.getMessageCount()).isEqualTo(1); ch.queueDelete(q); ch.exchangeDelete(x); } @@ -422,7 +421,7 @@ public void queueRecovered(String oldName, String newName) { ch.basicPublish(x, "", null, "msg".getBytes()); waitForConfirms(ch); AMQP.Queue.DeclareOk ok = ch.queueDeclarePassive(nameAfter.get()); - assertEquals(1, ok.getMessageCount()); + assertThat(ok.getMessageCount()).isEqualTo(1); ch.queueDelete(nameAfter.get()); ch.exchangeDelete(x); } @@ -511,13 +510,10 @@ public void queueRecovered(String oldName, String newName) { final AtomicReference nameBefore = new AtomicReference(); final AtomicReference nameAfter = new AtomicReference(); final CountDownLatch listenerLatch = new CountDownLatch(1); - ((AutorecoveringConnection)connection).addQueueRecoveryListener(new QueueRecoveryListener() { - @Override - public void queueRecovered(String oldName, String newName) { - nameBefore.set(oldName); - nameAfter.set(newName); - listenerLatch.countDown(); - } + ((AutorecoveringConnection)connection).addQueueRecoveryListener((oldName, newName) -> { + nameBefore.set(oldName); + nameAfter.set(newName); + listenerLatch.countDown(); }); closeAndWaitForRecovery(); @@ -525,7 +521,7 @@ public void queueRecovered(String oldName, String newName) { expectChannelRecovery(channel); channel.basicPublish(x, "", null, "msg".getBytes()); assertDelivered(q, 1); - assertFalse(nameBefore.get().equals(nameAfter.get())); + assertThat(nameBefore).doesNotHaveValue(nameAfter.get()); channel.queueDelete(q); } @@ -620,11 +616,11 @@ public void queueRecovered(String oldName, String newName) { channel.queueDeclare(q, true, false, false, null); // now delete it using the delegate so AutorecoveringConnection and AutorecoveringChannel are not aware of it ((AutorecoveringChannel)channel).getDelegate().queueDelete(q); - assertNotNull(((AutorecoveringConnection)connection).getRecordedQueues().get(q)); + assertThat(((AutorecoveringConnection)connection).getRecordedQueues().get(q)).isNotNull(); // exclude the queue from recovery ((AutorecoveringConnection)connection).excludeQueueFromRecovery(q, true); // verify its not there - assertNull(((AutorecoveringConnection)connection).getRecordedQueues().get(q)); + assertThat(((AutorecoveringConnection)connection).getRecordedQueues().get(q)).isNull(); // reconnect closeAndWaitForRecovery(); expectChannelRecovery(channel); @@ -669,7 +665,7 @@ public void consumerRecovered(String oldConsumerTag, String newConsumerTag) { assertConsumerCount(n, q); closeAndWaitForRecovery(); wait(listenerLatch); - assertTrue(tagA.get().equals(tagB.get())); + assertThat(tagA.get().equals(tagB.get())).isTrue(); expectChannelRecovery(channel); assertConsumerCount(n, q); @@ -721,8 +717,8 @@ public void handleRecoveryStarted(Recoverable recoverable) { RecoverableChannel ch2 = (RecoverableChannel) connection.createChannel(); ch2.addRecoveryListener(listener); - assertTrue(ch1.isOpen()); - assertTrue(ch2.isOpen()); + assertThat(ch1.isOpen()).isTrue(); + assertThat(ch2.isOpen()).isTrue(); closeAndWaitForRecovery(); expectChannelRecovery(ch1); expectChannelRecovery(ch2); @@ -777,23 +773,23 @@ public void handleDelivery(String consumerTag, Channel channel1 = connection.createChannel(); Channel channel2 = connection.createChannel(); - assertEquals(0, connectionConsumers.size()); + assertThat(connectionConsumers).isEmpty(); String queue = channel1.queueDeclare().getQueue(); - channel1.basicConsume(queue, true, new HashMap(), new DefaultConsumer(channel1)); - assertEquals(1, connectionConsumers.size()); - channel1.basicConsume(queue, true, new HashMap(), new DefaultConsumer(channel1)); - assertEquals(2, connectionConsumers.size()); + channel1.basicConsume(queue, true, new HashMap<>(), new DefaultConsumer(channel1)); + assertThat(connectionConsumers).hasSize(1); + channel1.basicConsume(queue, true, new HashMap<>(), new DefaultConsumer(channel1)); + assertThat(connectionConsumers).hasSize(2); - channel2.basicConsume(queue, true, new HashMap(), new DefaultConsumer(channel2)); - assertEquals(3, connectionConsumers.size()); + channel2.basicConsume(queue, true, new HashMap<>(), new DefaultConsumer(channel2)); + assertThat(connectionConsumers).hasSize(3); channel1.close(); - assertEquals(3 - 2, connectionConsumers.size()); + assertThat(connectionConsumers).hasSize(3 - 2); channel2.close(); - assertEquals(0, connectionConsumers.size()); + assertThat(connectionConsumers).isEmpty(); } finally { connection.abort(); } @@ -804,9 +800,9 @@ public void handleDelivery(String consumerTag, connectionFactory.setRecoveryDelayHandler(new RecoveryDelayHandler.ExponentialBackoffDelayHandler()); Connection testConnection = connectionFactory.newConnection(); try { - assertTrue(testConnection.isOpen()); + assertThat(testConnection.isOpen()).isTrue(); TestUtils.closeAndWaitForRecovery((RecoverableConnection) testConnection); - assertTrue(testConnection.isOpen()); + assertThat(testConnection.isOpen()).isTrue(); } finally { connection.close(); } @@ -817,9 +813,9 @@ public void handleDelivery(String consumerTag, final ThreadPoolExecutor executor = new ThreadPoolExecutor(8, 8, 30, TimeUnit.SECONDS, new LinkedBlockingQueue()); executor.allowCoreThreadTimeOut(true); ConnectionFactory connectionFactory = buildConnectionFactoryWithRecoveryEnabled(false); - assertNull(connectionFactory.getTopologyRecoveryExecutor()); + assertThat(connectionFactory.getTopologyRecoveryExecutor()).isNull(); connectionFactory.setTopologyRecoveryExecutor(executor); - assertEquals(executor, connectionFactory.getTopologyRecoveryExecutor()); + assertThat(connectionFactory.getTopologyRecoveryExecutor()).isEqualTo(executor); RecoverableConnection testConnection = (RecoverableConnection) connectionFactory.newConnection(); try { final List channels = new ArrayList(); @@ -864,7 +860,7 @@ public void handleDelivery(String consumerTag, Envelope envelope, BasicPropertie } } // verify all queues/consumers got it - assertTrue(latch.await(30, TimeUnit.SECONDS)); + assertThat(latch.await(30, TimeUnit.SECONDS)).isTrue(); // cleanup Channel cleanupChannel = testConnection.createChannel(); @@ -878,7 +874,7 @@ public void handleDelivery(String consumerTag, Envelope envelope, BasicPropertie } private void assertConsumerCount(int exp, String q) throws IOException { - assertEquals(exp, channel.queueDeclarePassive(q).getConsumerCount()); + assertThat(channel.queueDeclarePassive(q).getConsumerCount()).isEqualTo(exp); } private static AMQP.Queue.DeclareOk declareClientNamedQueue(Channel ch, String q) throws IOException { @@ -906,11 +902,11 @@ private static void expectQueueRecovery(Channel ch, String q) throws IOException ch.confirmSelect(); ch.queuePurge(q); AMQP.Queue.DeclareOk ok1 = declareClientNamedQueue(ch, q); - assertEquals(0, ok1.getMessageCount()); + assertThat(ok1.getMessageCount()).isEqualTo(0); ch.basicPublish("", q, null, "msg".getBytes()); waitForConfirms(ch); AMQP.Queue.DeclareOk ok2 = declareClientNamedQueue(ch, q); - assertEquals(1, ok2.getMessageCount()); + assertThat(ok2.getMessageCount()).isEqualTo(1); } private static void expectAutoDeleteQueueAndBindingRecovery(Channel ch, String x, String q) throws IOException, InterruptedException, @@ -918,12 +914,12 @@ private static void expectAutoDeleteQueueAndBindingRecovery(Channel ch, String x ch.confirmSelect(); ch.queuePurge(q); AMQP.Queue.DeclareOk ok1 = declareClientNamedAutoDeleteQueue(ch, q); - assertEquals(0, ok1.getMessageCount()); + assertThat(ok1.getMessageCount()).isEqualTo(0); ch.exchangeDeclare(x, "fanout"); ch.basicPublish(x, "", null, "msg".getBytes()); waitForConfirms(ch); AMQP.Queue.DeclareOk ok2 = declareClientNamedAutoDeleteQueue(ch, q); - assertEquals(1, ok2.getMessageCount()); + assertThat(ok2.getMessageCount()).isEqualTo(1); } private static void expectExchangeRecovery(Channel ch, String x) throws IOException, InterruptedException, TimeoutException { @@ -964,7 +960,7 @@ private void restartPrimaryAndWaitForRecovery(Connection connection) throws IOEx } private static void expectChannelRecovery(Channel ch) { - assertTrue(ch.isOpen()); + assertThat(ch.isOpen()).isTrue(); } @Override @@ -1020,7 +1016,7 @@ private static ConnectionFactory buildConnectionFactoryWithRecoveryEnabled(boole private static void wait(CountDownLatch latch) throws InterruptedException { // we want to wait for recovery to complete for a reasonable amount of time // but still make recovery failures easy to notice in development environments - assertTrue(latch.await(90, TimeUnit.SECONDS)); + assertThat(latch.await(90, TimeUnit.SECONDS)).isTrue(); } private static void waitForConfirms(Channel ch) throws InterruptedException, TimeoutException { @@ -1028,10 +1024,10 @@ private static void waitForConfirms(Channel ch) throws InterruptedException, Tim } private static void assertRecordedQueues(Connection conn, int size) { - assertEquals(size, ((AutorecoveringConnection)conn).getRecordedQueues().size()); + assertThat(((AutorecoveringConnection)conn).getRecordedQueues()).hasSize(size); } private static void assertRecordedExchanges(Connection conn, int size) { - assertEquals(size, ((AutorecoveringConnection)conn).getRecordedExchanges().size()); + assertThat(((AutorecoveringConnection)conn).getRecordedExchanges()).hasSize(size); } } diff --git a/src/test/java/com/rabbitmq/client/test/functional/Metrics.java b/src/test/java/com/rabbitmq/client/test/functional/Metrics.java index 98b82ed7af..3e2dc6df74 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Metrics.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Metrics.java @@ -49,11 +49,8 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; -import static org.awaitility.Awaitility.waitAtMost; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; +import static com.rabbitmq.client.test.TestUtils.waitAtMost; +import static org.assertj.core.api.Assertions.assertThat; /** * @@ -88,51 +85,51 @@ protected void releaseResources() throws IOException { Connection connection2 = null; try { connection1 = connectionFactory.newConnection(); - assertThat(metrics.getConnections().getCount(), is(1L)); + assertThat(metrics.getConnections().getCount()).isEqualTo(1L); connection1.createChannel(); connection1.createChannel(); Channel channel = connection1.createChannel(); - assertThat(metrics.getChannels().getCount(), is(3L)); + assertThat(metrics.getChannels().getCount()).isEqualTo(3L); sendMessage(channel); - assertThat(metrics.getPublishedMessages().getCount(), is(1L)); + assertThat(metrics.getPublishedMessages().getCount()).isEqualTo(1L); sendMessage(channel); - assertThat(metrics.getPublishedMessages().getCount(), is(2L)); + assertThat(metrics.getPublishedMessages().getCount()).isEqualTo(2L); channel.basicGet(QUEUE, true); - assertThat(metrics.getConsumedMessages().getCount(), is(1L)); + assertThat(metrics.getConsumedMessages().getCount()).isEqualTo(1L); channel.basicGet(QUEUE, true); - assertThat(metrics.getConsumedMessages().getCount(), is(2L)); + assertThat(metrics.getConsumedMessages().getCount()).isEqualTo(2L); channel.basicGet(QUEUE, true); - assertThat(metrics.getConsumedMessages().getCount(), is(2L)); + assertThat(metrics.getConsumedMessages().getCount()).isEqualTo(2L); connection2 = connectionFactory.newConnection(); - assertThat(metrics.getConnections().getCount(), is(2L)); + assertThat(metrics.getConnections().getCount()).isEqualTo(2L); connection2.createChannel(); channel = connection2.createChannel(); - assertThat(metrics.getChannels().getCount(), is(3L+2L)); + assertThat(metrics.getChannels().getCount()).isEqualTo(3L+2L); sendMessage(channel); sendMessage(channel); - assertThat(metrics.getPublishedMessages().getCount(), is(2L+2L)); + assertThat(metrics.getPublishedMessages().getCount()).isEqualTo(2L+2L); channel.basicGet(QUEUE, true); - assertThat(metrics.getConsumedMessages().getCount(), is(2L+1L)); + assertThat(metrics.getConsumedMessages().getCount()).isEqualTo(2L+1L); channel.basicConsume(QUEUE, true, new DefaultConsumer(channel)); - waitAtMost(timeout()).until(() -> metrics.getConsumedMessages().getCount(), equalTo(2L+1L+1L)); + waitAtMost(timeout(), () -> metrics.getConsumedMessages().getCount() == 2L+1L+1L); safeClose(connection1); - waitAtMost(timeout()).until(() -> metrics.getConnections().getCount(), equalTo(1L)); - waitAtMost(timeout()).until(() -> metrics.getChannels().getCount(), equalTo(2L)); + waitAtMost(timeout(), () -> metrics.getConnections().getCount() == 1L); + waitAtMost(timeout(), () -> metrics.getChannels().getCount() == 2L); safeClose(connection2); - waitAtMost(timeout()).until(() -> metrics.getConnections().getCount(), equalTo(0L)); - waitAtMost(timeout()).until(() -> metrics.getChannels().getCount(), equalTo(0L)); + waitAtMost(timeout(), () -> metrics.getConnections().getCount() == 0L); + waitAtMost(timeout(), () -> metrics.getChannels().getCount() == 0L); - assertThat(metrics.getAcknowledgedMessages().getCount(), is(0L)); - assertThat(metrics.getRejectedMessages().getCount(), is(0L)); + assertThat(metrics.getAcknowledgedMessages().getCount()).isEqualTo(0L); + assertThat(metrics.getRejectedMessages().getCount()).isEqualTo(0L); } finally { safeClose(connection1); @@ -148,7 +145,7 @@ protected void releaseResources() throws IOException { connection = connectionFactory.newConnection(); Channel channel = connection.createChannel(); channel.confirmSelect(); - assertThat(metrics.getPublishUnroutedMessages().getCount(), is(0L)); + assertThat(metrics.getPublishUnroutedMessages().getCount()).isEqualTo(0L); // when channel.basicPublish( "amq.direct", @@ -158,10 +155,7 @@ protected void releaseResources() throws IOException { "any-message".getBytes() ); // then - waitAtMost(timeout()).until( - () -> metrics.getPublishUnroutedMessages().getCount(), - equalTo(1L) - ); + waitAtMost(timeout(), () -> metrics.getPublishUnroutedMessages().getCount() == 1L); } finally { safeClose(connection); } @@ -175,13 +169,13 @@ protected void releaseResources() throws IOException { connection = connectionFactory.newConnection(); Channel channel = connection.createChannel(); channel.confirmSelect(); - assertThat(metrics.getPublishAcknowledgedMessages().getCount(), is(0L)); + assertThat(metrics.getPublishAcknowledgedMessages().getCount()).isEqualTo(0L); channel.basicConsume(QUEUE, false, new MultipleAckConsumer(channel, false)); // when sendMessage(channel); channel.waitForConfirms(30 * 60 * 1000); // then - assertThat(metrics.getPublishAcknowledgedMessages().getCount(), is(1L)); + assertThat(metrics.getPublishAcknowledgedMessages().getCount()).isEqualTo(1L); } finally { safeClose(connection); } @@ -200,8 +194,8 @@ protected void releaseResources() throws IOException { sendMessage(channel1); GetResponse getResponse = channel1.basicGet(QUEUE, false); channel1.basicAck(getResponse.getEnvelope().getDeliveryTag(), false); - assertThat(metrics.getConsumedMessages().getCount(), is(1L)); - assertThat(metrics.getAcknowledgedMessages().getCount(), is(1L)); + assertThat(metrics.getConsumedMessages().getCount()).isEqualTo(1L); + assertThat(metrics.getAcknowledgedMessages().getCount()).isEqualTo(1L); // basicGet / basicAck sendMessage(channel1); @@ -218,18 +212,18 @@ protected void releaseResources() throws IOException { GetResponse response5 = channel1.basicGet(QUEUE, false); GetResponse response6 = channel2.basicGet(QUEUE, false); - assertThat(metrics.getConsumedMessages().getCount(), is(1L+6L)); - assertThat(metrics.getAcknowledgedMessages().getCount(), is(1L)); + assertThat(metrics.getConsumedMessages().getCount()).isEqualTo(1L+6L); + assertThat(metrics.getAcknowledgedMessages().getCount()).isEqualTo(1L); channel1.basicAck(response5.getEnvelope().getDeliveryTag(), false); - assertThat(metrics.getAcknowledgedMessages().getCount(), is(1L+1L)); + assertThat(metrics.getAcknowledgedMessages().getCount()).isEqualTo(1L+1L); channel1.basicAck(response3.getEnvelope().getDeliveryTag(), true); - assertThat(metrics.getAcknowledgedMessages().getCount(), is(1L+1L+2L)); + assertThat(metrics.getAcknowledgedMessages().getCount()).isEqualTo(1L+1L+2L); channel2.basicAck(response2.getEnvelope().getDeliveryTag(), true); - assertThat(metrics.getAcknowledgedMessages().getCount(), is(1L+(1L+2L)+1L)); + assertThat(metrics.getAcknowledgedMessages().getCount()).isEqualTo(1L+(1L+2L)+1L); channel2.basicAck(response6.getEnvelope().getDeliveryTag(), true); - assertThat(metrics.getAcknowledgedMessages().getCount(), is(1L+(1L+2L)+1L+2L)); + assertThat(metrics.getAcknowledgedMessages().getCount()).isEqualTo(1L+(1L+2L)+1L+2L); long alreadySentMessages = 1+(1+2)+1+2; @@ -244,15 +238,9 @@ protected void releaseResources() throws IOException { sendMessage(i%2 == 0 ? channel1 : channel2); } - waitAtMost(timeout()).until( - () -> metrics.getConsumedMessages().getCount(), - equalTo(alreadySentMessages+nbMessages) - ); + waitAtMost(timeout(), () -> metrics.getConsumedMessages().getCount() == alreadySentMessages+nbMessages); - waitAtMost(timeout()).until( - () -> metrics.getAcknowledgedMessages().getCount(), - equalTo(alreadySentMessages+nbMessages) - ); + waitAtMost(timeout(), () -> metrics.getAcknowledgedMessages().getCount() == alreadySentMessages+nbMessages); } finally { safeClose(connection); @@ -277,10 +265,10 @@ protected void releaseResources() throws IOException { GetResponse response3 = channel.basicGet(QUEUE, false); channel.basicReject(response2.getEnvelope().getDeliveryTag(), false); - assertThat(metrics.getRejectedMessages().getCount(), is(1L)); + assertThat(metrics.getRejectedMessages().getCount()).isEqualTo(1L); channel.basicNack(response3.getEnvelope().getDeliveryTag(), true, false); - assertThat(metrics.getRejectedMessages().getCount(), is(1L+2L)); + assertThat(metrics.getRejectedMessages().getCount()).isEqualTo(1L+2L); } finally { safeClose(connection); } @@ -326,9 +314,9 @@ protected void releaseResources() throws IOException { } executorService.invokeAll(tasks); - assertThat(metrics.getPublishedMessages().getCount(), is(nbOfMessages)); - waitAtMost(timeout()).until(() -> metrics.getConsumedMessages().getCount(), equalTo(nbOfMessages)); - assertThat(metrics.getAcknowledgedMessages().getCount(), is(0L)); + assertThat(metrics.getPublishedMessages().getCount()).isEqualTo(nbOfMessages); + waitAtMost(timeout(), () -> metrics.getConsumedMessages().getCount() == nbOfMessages); + assertThat(metrics.getAcknowledgedMessages().getCount()).isEqualTo(0L); // to remove the listeners for(int i = 0; i < nbChannels; i++) { @@ -355,9 +343,9 @@ protected void releaseResources() throws IOException { } executorService.invokeAll(tasks); - assertThat(metrics.getPublishedMessages().getCount(), is(2*nbOfMessages)); - waitAtMost(timeout()).until(() -> metrics.getConsumedMessages().getCount(), equalTo(2*nbOfMessages)); - waitAtMost(timeout()).until(() -> metrics.getAcknowledgedMessages().getCount(), equalTo(nbOfMessages)); + assertThat(metrics.getPublishedMessages().getCount()).isEqualTo(2*nbOfMessages); + waitAtMost(timeout(), () -> metrics.getConsumedMessages().getCount() == 2*nbOfMessages); + waitAtMost(timeout(), () -> metrics.getAcknowledgedMessages().getCount() == nbOfMessages); // to remove the listeners for(int i = 0; i < nbChannels; i++) { @@ -384,10 +372,10 @@ protected void releaseResources() throws IOException { } executorService.invokeAll(tasks); - assertThat(metrics.getPublishedMessages().getCount(), is(3*nbOfMessages)); - waitAtMost(timeout()).until(() -> metrics.getConsumedMessages().getCount(), equalTo(3*nbOfMessages)); - waitAtMost(timeout()).until(() -> metrics.getAcknowledgedMessages().getCount(), equalTo(nbOfMessages)); - waitAtMost(timeout()).until(() -> metrics.getRejectedMessages().getCount(), equalTo(nbOfMessages)); + assertThat(metrics.getPublishedMessages().getCount()).isEqualTo(3*nbOfMessages); + waitAtMost(timeout(), () -> metrics.getConsumedMessages().getCount() == 3*nbOfMessages); + waitAtMost(timeout(), () -> metrics.getAcknowledgedMessages().getCount() == nbOfMessages); + waitAtMost(timeout(), () -> metrics.getRejectedMessages().getCount() == nbOfMessages); } finally { for (Connection connection : connections) { safeClose(connection); @@ -405,13 +393,13 @@ protected void releaseResources() throws IOException { connection = connectionFactory.newConnection(); Channel channel = connection.createChannel(); - assertThat(metrics.getConnections().getCount(), is(1L)); - assertThat(metrics.getChannels().getCount(), is(1L)); + assertThat(metrics.getConnections().getCount()).isEqualTo(1L); + assertThat(metrics.getChannels().getCount()).isEqualTo(1L); channel.basicPublish("unlikelynameforanexchange", "", null, "msg".getBytes("UTF-8")); - waitAtMost(timeout()).until(() -> metrics.getChannels().getCount(), is(0L)); - assertThat(metrics.getConnections().getCount(), is(1L)); + waitAtMost(timeout(), () -> metrics.getChannels().getCount() == 0L); + assertThat(metrics.getConnections().getCount()).isEqualTo(1L); } finally { safeClose(connection); } @@ -429,19 +417,19 @@ protected void releaseResources() throws IOException { connection = connectionFactory.newConnection(); Collection shutdownHooks = getShutdownHooks(connection); - assertThat(shutdownHooks.size(), is(0)); + assertThat(shutdownHooks.size()).isEqualTo(0); connection.createChannel(); - assertThat(metrics.getConnections().getCount(), is(1L)); - assertThat(metrics.getChannels().getCount(), is(1L)); + assertThat(metrics.getConnections().getCount()).isEqualTo(1L); + assertThat(metrics.getChannels().getCount()).isEqualTo(1L); closeAndWaitForRecovery((AutorecoveringConnection) connection); - assertThat(metrics.getConnections().getCount(), is(1L)); - assertThat(metrics.getChannels().getCount(), is(1L)); + assertThat(metrics.getConnections().getCount()).isEqualTo(1L); + assertThat(metrics.getChannels().getCount()).isEqualTo(1L); - assertThat(shutdownHooks.size(), is(0)); + assertThat(shutdownHooks.size()).isEqualTo(0); } finally { safeClose(connection); } @@ -482,10 +470,10 @@ protected void releaseResources() throws IOException { sendMessage(channel2); } - waitAtMost(timeout()).until(() -> ackedMessages.get(), equalTo(nbMessages * 2)); + waitAtMost(timeout(), () -> ackedMessages.get() == nbMessages * 2); - assertThat(metrics.getConsumedMessages().getCount(), is((long) (nbMessages * 2))); - assertThat(metrics.getAcknowledgedMessages().getCount(), is((long) (nbMessages * 2))); + assertThat(metrics.getConsumedMessages().getCount()).isEqualTo((long) (nbMessages * 2)); + assertThat(metrics.getAcknowledgedMessages().getCount()).isEqualTo((long) (nbMessages * 2)); } finally { safeClose(connection); @@ -517,7 +505,7 @@ public void handleRecoveryStarted(Recoverable recoverable) { } }); Host.closeConnection(connection); - assertTrue(latch.await(5, TimeUnit.SECONDS)); + assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); } private Collection getShutdownHooks(Connection connection) throws NoSuchFieldException, IllegalAccessException { diff --git a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryFiltering.java b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryFiltering.java index e8c3ff1148..27c210639c 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryFiltering.java +++ b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryFiltering.java @@ -32,17 +32,13 @@ import org.junit.Test; import java.io.IOException; +import java.time.Duration; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; -import static com.rabbitmq.client.test.TestUtils.closeAndWaitForRecovery; -import static com.rabbitmq.client.test.TestUtils.exchangeExists; -import static com.rabbitmq.client.test.TestUtils.queueExists; -import static com.rabbitmq.client.test.TestUtils.sendAndConsumeMessage; -import static org.awaitility.Awaitility.waitAtMost; -import static org.hamcrest.Matchers.is; +import static com.rabbitmq.client.test.TestUtils.*; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -147,7 +143,7 @@ public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProp } }); ch.basicPublish("topology.recovery.exchange", "recovered.consumer", null, "".getBytes()); - waitAtMost(5, TimeUnit.SECONDS).untilAtomic(recoveredConsumerMessageCount, is(1)); + waitAtMost(Duration.ofSeconds(5), () -> recoveredConsumerMessageCount.get() == 1); final AtomicInteger filteredConsumerMessageCount = new AtomicInteger(0); final CountDownLatch filteredConsumerLatch = new CountDownLatch(2); @@ -160,13 +156,13 @@ public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProp } }); ch.basicPublish("topology.recovery.exchange", "filtered.consumer", null, "".getBytes()); - waitAtMost(5, TimeUnit.SECONDS).untilAtomic(filteredConsumerMessageCount, is(1)); + waitAtMost(Duration.ofSeconds(5), () -> filteredConsumerMessageCount.get() == 1); closeAndWaitForRecovery((RecoverableConnection) c); int initialCount = recoveredConsumerMessageCount.get(); ch.basicPublish("topology.recovery.exchange", "recovered.consumer", null, "".getBytes()); - waitAtMost(5, TimeUnit.SECONDS).untilAtomic(recoveredConsumerMessageCount, is(initialCount + 1)); + waitAtMost(Duration.ofSeconds(5), () -> recoveredConsumerMessageCount.get() == initialCount + 1); ch.basicPublish("topology.recovery.exchange", "filtered.consumer", null, "".getBytes()); assertFalse("Consumer shouldn't recover, no extra messages should have been received", diff --git a/src/test/java/com/rabbitmq/tools/Host.java b/src/test/java/com/rabbitmq/tools/Host.java index 91f4c68f50..47c34b01ab 100644 --- a/src/test/java/com/rabbitmq/tools/Host.java +++ b/src/test/java/com/rabbitmq/tools/Host.java @@ -173,7 +173,8 @@ public static String makeCommand() public static String nodenameA() { - return System.getProperty("test-broker.A.nodename"); +// return System.getProperty("test-broker.A.nodename"); + return "rabbit@acogoluegnes-inspiron"; } public static String node_portA() From 855bcbcdb6ffdfc2514d6320f990817eefd6e99a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 1 Apr 2020 15:51:24 +0200 Subject: [PATCH 201/328] Bump Maven plugin (cherry picked from commit bc204c380a1c74e35e74f96ab7e14b9cfaa41c71) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 76f2173524..a3d188dfe9 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ 9.4.27.v20200227 1.64 - 3.1.1 + 3.2.0 2.5.3 2.3 3.0.2 From df38f551ccc87d1e1996004195a95774b2030c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 1 Apr 2020 17:26:49 +0200 Subject: [PATCH 202/328] Fix test --- .../java/com/rabbitmq/client/test/ConnectionFactoryTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java b/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java index 0d1b695783..ff1e7e4b80 100644 --- a/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java +++ b/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java @@ -124,7 +124,7 @@ protected synchronized FrameHandlerFactory createFrameHandlerFactory() { doNothing().when(connection).start(); connectionFactory.newConnection(); - assertThat(addressResolver.get()).isNotNull().isInstanceOf(ListAddressResolver.class); + assertThat(addressResolver.get()).isNotNull().isInstanceOf(DnsRecordIpAddressResolver.class); } @Test From efb05908d5685f1242521decc94bbeab08564e70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 1 Apr 2020 17:57:31 +0200 Subject: [PATCH 203/328] Fix broker node name --- src/test/java/com/rabbitmq/tools/Host.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/java/com/rabbitmq/tools/Host.java b/src/test/java/com/rabbitmq/tools/Host.java index 47c34b01ab..91f4c68f50 100644 --- a/src/test/java/com/rabbitmq/tools/Host.java +++ b/src/test/java/com/rabbitmq/tools/Host.java @@ -173,8 +173,7 @@ public static String makeCommand() public static String nodenameA() { -// return System.getProperty("test-broker.A.nodename"); - return "rabbit@acogoluegnes-inspiron"; + return System.getProperty("test-broker.A.nodename"); } public static String node_portA() From f2ea8622effd331b5da86b8d84972f85827e52dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 2 Apr 2020 11:03:06 +0200 Subject: [PATCH 204/328] Make sure qos, heartbeat, max channel are unsigned shorts Sets the value to 0 or 65535 and issues a warning if it is out of range. Fixes #642 --- .../rabbitmq/client/ConnectionFactory.java | 28 +++++++++++---- .../rabbitmq/client/impl/AMQConnection.java | 18 ++++++---- .../com/rabbitmq/client/impl/ChannelN.java | 8 +++-- .../rabbitmq/client/test/ChannelNTest.java | 32 ++++++++++++++--- .../client/test/ConnectionFactoryTest.java | 35 ++++++++++--------- 5 files changed, 84 insertions(+), 37 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index 7fdcdb1324..71286d3b3b 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -21,6 +21,8 @@ import com.rabbitmq.client.impl.recovery.AutorecoveringConnection; import com.rabbitmq.client.impl.recovery.RetryHandler; import com.rabbitmq.client.impl.recovery.TopologyRecoveryFilter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.net.SocketFactory; import javax.net.ssl.SSLContext; @@ -47,6 +49,8 @@ */ public class ConnectionFactory implements Cloneable { + private static final Logger LOGGER = LoggerFactory.getLogger(ConnectionFactory.class); + private static final int MAX_UNSIGNED_SHORT = 65535; /** Default user name */ @@ -393,10 +397,11 @@ public int getRequestedChannelMax() { * @param requestedChannelMax initially requested maximum channel number; zero for unlimited */ public void setRequestedChannelMax(int requestedChannelMax) { - if (requestedChannelMax < 0 || requestedChannelMax > MAX_UNSIGNED_SHORT) { - throw new IllegalArgumentException("Requested channel max must be between 0 and " + MAX_UNSIGNED_SHORT); + this.requestedChannelMax = ensureUnsignedShort(requestedChannelMax); + if (this.requestedChannelMax != requestedChannelMax) { + LOGGER.warn("Requested channel max must be between 0 and {}, value has been set to {} instead of {}", + MAX_UNSIGNED_SHORT, this.requestedChannelMax, requestedChannelMax); } - this.requestedChannelMax = requestedChannelMax; } /** @@ -492,10 +497,11 @@ public int getShutdownTimeout() { * @see RabbitMQ Heartbeats Guide */ public void setRequestedHeartbeat(int requestedHeartbeat) { - if (requestedHeartbeat < 0 || requestedHeartbeat > MAX_UNSIGNED_SHORT) { - throw new IllegalArgumentException("Requested heartbeat must be between 0 and " + MAX_UNSIGNED_SHORT); + this.requestedHeartbeat = ensureUnsignedShort(requestedHeartbeat); + if (this.requestedHeartbeat != requestedHeartbeat) { + LOGGER.warn("Requested heartbeat must be between 0 and {}, value has been set to {} instead of {}", + MAX_UNSIGNED_SHORT, this.requestedHeartbeat, requestedHeartbeat); } - this.requestedHeartbeat = requestedHeartbeat; } /** @@ -1574,4 +1580,14 @@ public void setTopologyRecoveryRetryHandler(RetryHandler topologyRecoveryRetryHa public void setTrafficListener(TrafficListener trafficListener) { this.trafficListener = trafficListener; } + + public static int ensureUnsignedShort(int value) { + if (value < 0) { + return 0; + } else if (value > MAX_UNSIGNED_SHORT) { + return MAX_UNSIGNED_SHORT; + } else { + return value; + } + } } diff --git a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java index b140788a84..d99784f933 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java @@ -400,12 +400,15 @@ public void start() } try { - int channelMax = + int negotiatedChannelMax = negotiateChannelMax(this.requestedChannelMax, connTune.getChannelMax()); - if (!checkUnsignedShort(channelMax)) { - throw new IllegalArgumentException("Negotiated channel max must be between 0 and " + MAX_UNSIGNED_SHORT + ": " + channelMax); + int channelMax = ConnectionFactory.ensureUnsignedShort(negotiatedChannelMax); + + if (channelMax != negotiatedChannelMax) { + LOGGER.warn("Channel max must be between 0 and {}, value has been set to {} instead of {}", + MAX_UNSIGNED_SHORT, channelMax, negotiatedChannelMax); } _channelManager = instantiateChannelManager(channelMax, threadFactory); @@ -415,12 +418,15 @@ public void start() connTune.getFrameMax()); this._frameMax = frameMax; - int heartbeat = + int negotiatedHeartbeat = negotiatedMaxValue(this.requestedHeartbeat, connTune.getHeartbeat()); - if (!checkUnsignedShort(heartbeat)) { - throw new IllegalArgumentException("Negotiated heartbeat must be between 0 and " + MAX_UNSIGNED_SHORT + ": " + heartbeat); + int heartbeat = ConnectionFactory.ensureUnsignedShort(negotiatedHeartbeat); + + if (heartbeat != negotiatedHeartbeat) { + LOGGER.warn("Heartbeat must be between 0 and {}, value has been set to {} instead of {}", + MAX_UNSIGNED_SHORT, heartbeat, negotiatedHeartbeat); } setHeartbeat(heartbeat); diff --git a/src/main/java/com/rabbitmq/client/impl/ChannelN.java b/src/main/java/com/rabbitmq/client/impl/ChannelN.java index 94da03e7bc..2bbc37a3ca 100644 --- a/src/main/java/com/rabbitmq/client/impl/ChannelN.java +++ b/src/main/java/com/rabbitmq/client/impl/ChannelN.java @@ -642,10 +642,12 @@ public AMQCommand transformReply(AMQCommand command) { public void basicQos(int prefetchSize, int prefetchCount, boolean global) throws IOException { - if (prefetchCount < 0 || prefetchCount > MAX_UNSIGNED_SHORT) { - throw new IllegalArgumentException("Prefetch count must be between 0 and " + MAX_UNSIGNED_SHORT); + int unsignedShortPrefetchCount = ConnectionFactory.ensureUnsignedShort(prefetchCount); + if (unsignedShortPrefetchCount != prefetchCount) { + LOGGER.warn("Prefetch count must be between 0 and {}, value has been set to {} instead of {}", + MAX_UNSIGNED_SHORT, unsignedShortPrefetchCount, prefetchCount); } - exnWrappingRpc(new Basic.Qos(prefetchSize, prefetchCount, global)); + exnWrappingRpc(new Basic.Qos(prefetchSize, unsignedShortPrefetchCount, global)); } /** Public API - {@inheritDoc} */ diff --git a/src/test/java/com/rabbitmq/client/test/ChannelNTest.java b/src/test/java/com/rabbitmq/client/test/ChannelNTest.java index 194f086ef8..c955c28071 100644 --- a/src/test/java/com/rabbitmq/client/test/ChannelNTest.java +++ b/src/test/java/com/rabbitmq/client/test/ChannelNTest.java @@ -25,8 +25,10 @@ import java.io.IOException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Stream; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; public class ChannelNTest { @@ -64,23 +66,43 @@ public void callingBasicCancelForUnknownConsumerThrowsException() throws Excepti @Test public void qosShouldBeUnsignedShort() { AMQConnection connection = Mockito.mock(AMQConnection.class); - ChannelN channel = new ChannelN(connection, 1, consumerWorkService); + AtomicReference qosMethod = new AtomicReference<>(); + ChannelN channel = new ChannelN(connection, 1, consumerWorkService) { + @Override + public AMQCommand exnWrappingRpc(Method m) { + qosMethod.set((com.rabbitmq.client.AMQP.Basic.Qos) m); + return null; + } + }; class TestConfig { int value; Consumer call; + int expected; - public TestConfig(int value, Consumer call) { + public TestConfig(int value, Consumer call, int expected) { this.value = value; this.call = call; + this.expected = expected; } } Consumer qos = value -> channel.basicQos(value); Consumer qosGlobal = value -> channel.basicQos(value, true); Consumer qosPrefetchSize = value -> channel.basicQos(10, value, true); Stream.of( - new TestConfig(-1, qos), new TestConfig(65536, qos) - ).flatMap(config -> Stream.of(config, new TestConfig(config.value, qosGlobal), new TestConfig(config.value, qosPrefetchSize))) - .forEach(config -> assertThatThrownBy(() -> config.call.apply(config.value)).isInstanceOf(IllegalArgumentException.class)); + new TestConfig(-1, qos, 0), new TestConfig(65536, qos, 65535), + new TestConfig(10, qos, 10), new TestConfig(0, qos, 0) + ).flatMap(config -> Stream.of(config, new TestConfig(config.value, qosGlobal, config.expected), new TestConfig(config.value, qosPrefetchSize, config.expected))) + .forEach(config -> { + try { + assertThat(qosMethod.get()).isNull(); + config.call.apply(config.value); + assertThat(qosMethod.get()).isNotNull(); + assertThat(qosMethod.get().getPrefetchCount()).isEqualTo(config.expected); + qosMethod.set(null); + } catch (Exception e) { + e.printStackTrace(); + } + }); } interface Consumer { diff --git a/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java b/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java index ff1e7e4b80..1846078ff2 100644 --- a/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java +++ b/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java @@ -27,10 +27,10 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; +import java.util.function.Supplier; import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.*; public class ConnectionFactoryTest { @@ -164,33 +164,34 @@ protected synchronized FrameHandlerFactory createFrameHandlerFactory() { public void heartbeatAndChannelMaxMustBeUnsignedShorts() { class TestConfig { int value; - Consumer call; - boolean expectException; + Supplier getCall; + Consumer setCall; + int expected; - public TestConfig(int value, Consumer call, boolean expectException) { + public TestConfig(int value, Supplier getCall, Consumer setCall, int expected) { this.value = value; - this.call = call; - this.expectException = expectException; + this.getCall = getCall; + this.setCall = setCall; + this.expected = expected; } } ConnectionFactory cf = new ConnectionFactory(); + Supplier getHeartbeart = () -> cf.getRequestedHeartbeat(); Consumer setHeartbeat = cf::setRequestedHeartbeat; + Supplier getChannelMax = () -> cf.getRequestedChannelMax(); Consumer setChannelMax = cf::setRequestedChannelMax; Stream.of( - new TestConfig(0, setHeartbeat, false), - new TestConfig(10, setHeartbeat, false), - new TestConfig(65535, setHeartbeat, false), - new TestConfig(-1, setHeartbeat, true), - new TestConfig(65536, setHeartbeat, true)) - .flatMap(config -> Stream.of(config, new TestConfig(config.value, setChannelMax, config.expectException))) + new TestConfig(0, getHeartbeart, setHeartbeat, 0), + new TestConfig(10, getHeartbeart, setHeartbeat, 10), + new TestConfig(65535, getHeartbeart, setHeartbeat, 65535), + new TestConfig(-1, getHeartbeart, setHeartbeat, 0), + new TestConfig(65536, getHeartbeart, setHeartbeat, 65535)) + .flatMap(config -> Stream.of(config, new TestConfig(config.value, getChannelMax, setChannelMax, config.expected))) .forEach(config -> { - if (config.expectException) { - assertThatThrownBy(() -> config.call.accept(config.value)).isInstanceOf(IllegalArgumentException.class); - } else { - config.call.accept(config.value); - } + config.setCall.accept(config.value); + assertThat(config.getCall.get()).isEqualTo(config.expected); }); } From 880308399aa107171bdddb17de97eb5551fd5d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 3 Apr 2020 14:47:57 +0200 Subject: [PATCH 205/328] Bump optional dependencies Fixes #644 --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index a3d188dfe9..bf3107a86b 100644 --- a/pom.xml +++ b/pom.xml @@ -54,10 +54,10 @@ UTF-8 UTF-8 - 1.7.29 - 4.1.2 - 1.3.2 - 2.10.1 + 1.7.30 + 4.1.5 + 1.4.1 + 2.10.3 1.2.3 4.13 3.3.3 From 4bc22ce4ca2a700be332243630ec477c042d640b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 3 Apr 2020 14:50:00 +0200 Subject: [PATCH 206/328] Set version to 5.9.0-SNAPSHOT in POM --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bf3107a86b..322d53e335 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.8.1-SNAPSHOT + 5.9.0-SNAPSHOT jar RabbitMQ Java Client From ea945d313a9f9084c70fafe39504b07c676e2ec1 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 3 Apr 2020 14:21:35 +0000 Subject: [PATCH 207/328] [maven-release-plugin] prepare release v5.9.0.RC1 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 322d53e335..3096cf2127 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.9.0-SNAPSHOT + 5.9.0.RC1 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.9.0.RC1 From 963729f57fd21f9de7bf4bd309b0d6a525322e0a Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 3 Apr 2020 14:21:42 +0000 Subject: [PATCH 208/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 3096cf2127..322d53e335 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.9.0.RC1 + 5.9.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.9.0.RC1 + HEAD From ea25ebf3f2acf55cc25a531d89c4b5741768ee2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 3 Apr 2020 16:26:22 +0200 Subject: [PATCH 209/328] Set release version to 5.9.0.RC2 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index 5682da02e8..1c6d8d6528 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,3 +1,3 @@ -RELEASE_VERSION="5.9.0.RC1" +RELEASE_VERSION="5.9.0.RC2" DEVELOPMENT_VERSION="5.9.0-SNAPSHOT" RELEASE_BRANCH="5.x.x-stable" From 08a8819b13d67e2a4e45ca0b81cab8e5bfb23fdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 14 Apr 2020 14:11:42 +0200 Subject: [PATCH 210/328] Set release version to 5.9.0 --- release-versions.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release-versions.txt b/release-versions.txt index 1c6d8d6528..7607b9254a 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,3 +1,3 @@ -RELEASE_VERSION="5.9.0.RC2" -DEVELOPMENT_VERSION="5.9.0-SNAPSHOT" +RELEASE_VERSION="5.9.0" +DEVELOPMENT_VERSION="5.10.0-SNAPSHOT" RELEASE_BRANCH="5.x.x-stable" From 86f9aceae30cb325225fa155c0cc6ddaa0ad6f39 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Tue, 14 Apr 2020 12:13:54 +0000 Subject: [PATCH 211/328] [maven-release-plugin] prepare release v5.9.0 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 322d53e335..12590442f4 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.9.0-SNAPSHOT + 5.9.0 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.9.0 From 668f1a2f38b6448929db31867ec4db8fde3fdbb0 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Tue, 14 Apr 2020 12:14:01 +0000 Subject: [PATCH 212/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 12590442f4..57d0eca42f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.9.0 + 5.10.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.9.0 + HEAD From 14ee07904b2117e7b1c0a97670546ef19ab72aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 14 Apr 2020 14:37:10 +0200 Subject: [PATCH 213/328] Set release version to 5.10.0.RC1 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index 7607b9254a..643407832b 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,3 +1,3 @@ -RELEASE_VERSION="5.9.0" +RELEASE_VERSION="5.10.0.RC1" DEVELOPMENT_VERSION="5.10.0-SNAPSHOT" RELEASE_BRANCH="5.x.x-stable" From 051c30d5d75ec3c81b69883dcdfceea236c1178c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 16 Apr 2020 16:19:05 +0200 Subject: [PATCH 214/328] Add TLS keys to properties-based configuration Fixes #646 (cherry picked from commit 99e1054e4a3d15234984ee5103de125d91e2e90c) --- pom.xml | 8 +- .../client/ConnectionFactoryConfigurator.java | 267 ++++++++++++++---- .../test/PropertyFileInitialisationTest.java | 229 +++++++++++---- .../tls/keystore.p12 | Bin 0 -> 2453 bytes .../tls/truststore.jks | Bin 0 -> 1218 bytes 5 files changed, 387 insertions(+), 117 deletions(-) create mode 100644 src/test/resources/property-file-initialisation/tls/keystore.p12 create mode 100644 src/test/resources/property-file-initialisation/tls/truststore.jks diff --git a/pom.xml b/pom.xml index 57d0eca42f..f9f31bc6a5 100644 --- a/pom.xml +++ b/pom.xml @@ -68,7 +68,7 @@ 3.2.0 2.5.3 2.3 - 3.0.2 + 3.1.0 3.0.1 2.0 2.4.8 @@ -783,6 +783,12 @@ org.apache.maven.plugins maven-resources-plugin ${maven.resources.plugin.version} + + + p12 + jks + + org.codehaus.gmaven diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactoryConfigurator.java b/src/main/java/com/rabbitmq/client/ConnectionFactoryConfigurator.java index 4470760d75..9cd9c7ee31 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactoryConfigurator.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactoryConfigurator.java @@ -18,36 +18,35 @@ import com.rabbitmq.client.impl.AMQConnection; import com.rabbitmq.client.impl.nio.NioParams; -import java.io.BufferedReader; -import java.io.FileReader; +import javax.net.ssl.*; +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; -import java.io.Reader; import java.net.URISyntaxException; -import java.security.KeyManagementException; -import java.security.NoSuchAlgorithmException; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; +import java.security.*; +import java.security.cert.CertificateException; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; /** * Helper class to load {@link ConnectionFactory} settings from a property file. - * + *

* The authorised keys are the constants values in this class (e.g. USERNAME). * The property file/properties instance/map instance keys can have * a prefix, the default being rabbitmq.. - * + *

* Property files can be loaded from the file system (the default), * but also from the classpath, by using the classpath: prefix * in the location. - * + *

* Client properties can be set by using * the client.properties. prefix, e.g. client.properties.app.name. * Default client properties and custom client properties are merged. To remove * a default client property, set its key to an empty value. * - * @since 4.4.0 * @see ConnectionFactory#load(String, String) + * @since 5.1.0 */ public class ConnectionFactoryConfigurator { @@ -76,6 +75,33 @@ public class ConnectionFactoryConfigurator { public static final String NIO_NB_IO_THREADS = "nio.nb.io.threads"; public static final String NIO_WRITE_ENQUEUING_TIMEOUT_IN_MS = "nio.write.enqueuing.timeout.in.ms"; public static final String NIO_WRITE_QUEUE_CAPACITY = "nio.write.queue.capacity"; + public static final String SSL_ALGORITHM = "ssl.algorithm"; + public static final String SSL_ENABLED = "ssl.enabled"; + public static final String SSL_KEY_STORE = "ssl.key.store"; + public static final String SSL_KEY_STORE_PASSWORD = "ssl.key.store.password"; + public static final String SSL_KEY_STORE_TYPE = "ssl.key.store.type"; + public static final String SSL_KEY_STORE_ALGORITHM = "ssl.key.store.algorithm"; + public static final String SSL_TRUST_STORE = "ssl.trust.store"; + public static final String SSL_TRUST_STORE_PASSWORD = "ssl.trust.store.password"; + public static final String SSL_TRUST_STORE_TYPE = "ssl.trust.store.type"; + public static final String SSL_TRUST_STORE_ALGORITHM = "ssl.trust.store.algorithm"; + public static final String SSL_VALIDATE_SERVER_CERTIFICATE = "ssl.validate.server.certificate"; + public static final String SSL_VERIFY_HOSTNAME = "ssl.verify.hostname"; + + // aliases allow to be compatible with keys from Spring Boot and still be consistent with + // the initial naming of the keys + private static final Map> ALIASES = new ConcurrentHashMap>() {{ + put(SSL_KEY_STORE, Arrays.asList("ssl.key-store")); + put(SSL_KEY_STORE_PASSWORD, Arrays.asList("ssl.key-store-password")); + put(SSL_KEY_STORE_TYPE, Arrays.asList("ssl.key-store-type")); + put(SSL_KEY_STORE_ALGORITHM, Arrays.asList("ssl.key-store-algorithm")); + put(SSL_TRUST_STORE, Arrays.asList("ssl.trust-store")); + put(SSL_TRUST_STORE_PASSWORD, Arrays.asList("ssl.trust-store-password")); + put(SSL_TRUST_STORE_TYPE, Arrays.asList("ssl.trust-store-type")); + put(SSL_TRUST_STORE_ALGORITHM, Arrays.asList("ssl.trust-store-algorithm")); + put(SSL_VALIDATE_SERVER_CERTIFICATE, Arrays.asList("ssl.validate-server-certificate")); + put(SSL_VERIFY_HOSTNAME, Arrays.asList("ssl.verify-hostname")); + }}; @SuppressWarnings("unchecked") public static void load(ConnectionFactory cf, String propertyFileLocation, String prefix) throws IOException { @@ -83,32 +109,22 @@ public static void load(ConnectionFactory cf, String propertyFileLocation, Strin throw new IllegalArgumentException("Property file argument cannot be null or empty"); } Properties properties = new Properties(); - if (propertyFileLocation.startsWith("classpath:")) { - InputStream in = null; - try { - in = ConnectionFactoryConfigurator.class.getResourceAsStream( - propertyFileLocation.substring("classpath:".length()) - ); - properties.load(in); - } finally { - if (in != null) { - in.close(); - } - } - } else { - Reader reader = null; - try { - reader = new BufferedReader(new FileReader(propertyFileLocation)); - properties.load(reader); - } finally { - if (reader != null) { - reader.close(); - } - } + try (InputStream in = loadResource(propertyFileLocation)) { + properties.load(in); } load(cf, (Map) properties, prefix); } + private static InputStream loadResource(String location) throws FileNotFoundException { + if (location.startsWith("classpath:")) { + return ConnectionFactoryConfigurator.class.getResourceAsStream( + location.substring("classpath:".length()) + ); + } else { + return new FileInputStream(location); + } + } + public static void load(ConnectionFactory cf, Map properties, String prefix) { prefix = prefix == null ? "" : prefix; String uri = properties.get(prefix + "uri"); @@ -116,54 +132,54 @@ public static void load(ConnectionFactory cf, Map properties, St try { cf.setUri(uri); } catch (URISyntaxException e) { - throw new IllegalArgumentException("Error while setting AMQP URI: "+uri, e); + throw new IllegalArgumentException("Error while setting AMQP URI: " + uri, e); } catch (NoSuchAlgorithmException e) { - throw new IllegalArgumentException("Error while setting AMQP URI: "+uri, e); + throw new IllegalArgumentException("Error while setting AMQP URI: " + uri, e); } catch (KeyManagementException e) { - throw new IllegalArgumentException("Error while setting AMQP URI: "+uri, e); + throw new IllegalArgumentException("Error while setting AMQP URI: " + uri, e); } } - String username = properties.get(prefix + USERNAME); + String username = lookUp(USERNAME, properties, prefix); if (username != null) { cf.setUsername(username); } - String password = properties.get(prefix + PASSWORD); + String password = lookUp(PASSWORD, properties, prefix); if (password != null) { cf.setPassword(password); } - String vhost = properties.get(prefix + VIRTUAL_HOST); + String vhost = lookUp(VIRTUAL_HOST, properties, prefix); if (vhost != null) { cf.setVirtualHost(vhost); } - String host = properties.get(prefix + HOST); + String host = lookUp(HOST, properties, prefix); if (host != null) { cf.setHost(host); } - String port = properties.get(prefix + PORT); + String port = lookUp(PORT, properties, prefix); if (port != null) { cf.setPort(Integer.valueOf(port)); } - String requestedChannelMax = properties.get(prefix + CONNECTION_CHANNEL_MAX); + String requestedChannelMax = lookUp(CONNECTION_CHANNEL_MAX, properties, prefix); if (requestedChannelMax != null) { cf.setRequestedChannelMax(Integer.valueOf(requestedChannelMax)); } - String requestedFrameMax = properties.get(prefix + CONNECTION_FRAME_MAX); + String requestedFrameMax = lookUp(CONNECTION_FRAME_MAX, properties, prefix); if (requestedFrameMax != null) { cf.setRequestedFrameMax(Integer.valueOf(requestedFrameMax)); } - String requestedHeartbeat = properties.get(prefix + CONNECTION_HEARTBEAT); + String requestedHeartbeat = lookUp(CONNECTION_HEARTBEAT, properties, prefix); if (requestedHeartbeat != null) { cf.setRequestedHeartbeat(Integer.valueOf(requestedHeartbeat)); } - String connectionTimeout = properties.get(prefix + CONNECTION_TIMEOUT); + String connectionTimeout = lookUp(CONNECTION_TIMEOUT, properties, prefix); if (connectionTimeout != null) { cf.setConnectionTimeout(Integer.valueOf(connectionTimeout)); } - String handshakeTimeout = properties.get(prefix + HANDSHAKE_TIMEOUT); + String handshakeTimeout = lookUp(HANDSHAKE_TIMEOUT, properties, prefix); if (handshakeTimeout != null) { cf.setHandshakeTimeout(Integer.valueOf(handshakeTimeout)); } - String shutdownTimeout = properties.get(prefix + SHUTDOWN_TIMEOUT); + String shutdownTimeout = lookUp(SHUTDOWN_TIMEOUT, properties, prefix); if (shutdownTimeout != null) { cf.setShutdownTimeout(Integer.valueOf(shutdownTimeout)); } @@ -180,63 +196,175 @@ public static void load(ConnectionFactory cf, Map properties, St clientProperties.remove(clientPropertyKey); } else { clientProperties.put( - clientPropertyKey, - entry.getValue() + clientPropertyKey, + entry.getValue() ); } } } cf.setClientProperties(clientProperties); - String automaticRecovery = properties.get(prefix + CONNECTION_RECOVERY_ENABLED); + String automaticRecovery = lookUp(CONNECTION_RECOVERY_ENABLED, properties, prefix); if (automaticRecovery != null) { cf.setAutomaticRecoveryEnabled(Boolean.valueOf(automaticRecovery)); } - String topologyRecovery = properties.get(prefix + TOPOLOGY_RECOVERY_ENABLED); + String topologyRecovery = lookUp(TOPOLOGY_RECOVERY_ENABLED, properties, prefix); if (topologyRecovery != null) { cf.setTopologyRecoveryEnabled(Boolean.getBoolean(topologyRecovery)); } - String networkRecoveryInterval = properties.get(prefix + CONNECTION_RECOVERY_INTERVAL); + String networkRecoveryInterval = lookUp(CONNECTION_RECOVERY_INTERVAL, properties, prefix); if (networkRecoveryInterval != null) { cf.setNetworkRecoveryInterval(Long.valueOf(networkRecoveryInterval)); } - String channelRpcTimeout = properties.get(prefix + CHANNEL_RPC_TIMEOUT); + String channelRpcTimeout = lookUp(CHANNEL_RPC_TIMEOUT, properties, prefix); if (channelRpcTimeout != null) { cf.setChannelRpcTimeout(Integer.valueOf(channelRpcTimeout)); } - String channelShouldCheckRpcResponseType = properties.get(prefix + CHANNEL_SHOULD_CHECK_RPC_RESPONSE_TYPE); + String channelShouldCheckRpcResponseType = lookUp(CHANNEL_SHOULD_CHECK_RPC_RESPONSE_TYPE, properties, prefix); if (channelShouldCheckRpcResponseType != null) { cf.setChannelShouldCheckRpcResponseType(Boolean.valueOf(channelShouldCheckRpcResponseType)); } - String useNio = properties.get(prefix + USE_NIO); + String useNio = lookUp(USE_NIO, properties, prefix); if (useNio != null && Boolean.valueOf(useNio)) { cf.useNio(); NioParams nioParams = new NioParams(); - String readByteBufferSize = properties.get(prefix + NIO_READ_BYTE_BUFFER_SIZE); + String readByteBufferSize = lookUp(NIO_READ_BYTE_BUFFER_SIZE, properties, prefix); if (readByteBufferSize != null) { nioParams.setReadByteBufferSize(Integer.valueOf(readByteBufferSize)); } - String writeByteBufferSize = properties.get(prefix + NIO_WRITE_BYTE_BUFFER_SIZE); + String writeByteBufferSize = lookUp(NIO_WRITE_BYTE_BUFFER_SIZE, properties, prefix); if (writeByteBufferSize != null) { nioParams.setWriteByteBufferSize(Integer.valueOf(writeByteBufferSize)); } - String nbIoThreads = properties.get(prefix + NIO_NB_IO_THREADS); + String nbIoThreads = lookUp(NIO_NB_IO_THREADS, properties, prefix); if (nbIoThreads != null) { nioParams.setNbIoThreads(Integer.valueOf(nbIoThreads)); } - String writeEnqueuingTime = properties.get(prefix + NIO_WRITE_ENQUEUING_TIMEOUT_IN_MS); + String writeEnqueuingTime = lookUp(NIO_WRITE_ENQUEUING_TIMEOUT_IN_MS, properties, prefix); if (writeEnqueuingTime != null) { nioParams.setWriteEnqueuingTimeoutInMs(Integer.valueOf(writeEnqueuingTime)); } - String writeQueueCapacity = properties.get(prefix + NIO_WRITE_QUEUE_CAPACITY); + String writeQueueCapacity = lookUp(NIO_WRITE_QUEUE_CAPACITY, properties, prefix); if (writeQueueCapacity != null) { nioParams.setWriteQueueCapacity(Integer.valueOf(writeQueueCapacity)); } cf.setNioParams(nioParams); } + + String useSsl = lookUp(SSL_ENABLED, properties, prefix); + if (useSsl != null && Boolean.valueOf(useSsl)) { + setUpSsl(cf, properties, prefix); + } + } + + private static void setUpSsl(ConnectionFactory cf, Map properties, String prefix) { + String algorithm = lookUp(SSL_ALGORITHM, properties, prefix); + String keyStoreLocation = lookUp(SSL_KEY_STORE, properties, prefix); + String keyStorePassword = lookUp(SSL_KEY_STORE_PASSWORD, properties, prefix); + String keyStoreType = lookUp(SSL_KEY_STORE_TYPE, properties, prefix, "PKCS12"); + String keyStoreAlgorithm = lookUp(SSL_KEY_STORE_ALGORITHM, properties, prefix, "SunX509"); + String trustStoreLocation = lookUp(SSL_TRUST_STORE, properties, prefix); + String trustStorePassword = lookUp(SSL_TRUST_STORE_PASSWORD, properties, prefix); + String trustStoreType = lookUp(SSL_TRUST_STORE_TYPE, properties, prefix, "JKS"); + String trustStoreAlgorithm = lookUp(SSL_TRUST_STORE_ALGORITHM, properties, prefix, "SunX509"); + String validateServerCertificate = lookUp(SSL_VALIDATE_SERVER_CERTIFICATE, properties, prefix); + String verifyHostname = lookUp(SSL_VERIFY_HOSTNAME, properties, prefix); + + try { + algorithm = algorithm == null ? + ConnectionFactory.computeDefaultTlsProtocol(SSLContext.getDefault().getSupportedSSLParameters().getProtocols()) : algorithm; + boolean enableHostnameVerification = verifyHostname == null ? Boolean.FALSE : Boolean.valueOf(verifyHostname); + + if (keyStoreLocation == null && trustStoreLocation == null) { + setUpBasicSsl( + cf, + validateServerCertificate == null ? Boolean.FALSE : Boolean.valueOf(validateServerCertificate), + enableHostnameVerification, + algorithm + ); + } else { + KeyManager[] keyManagers = configureKeyManagers(keyStoreLocation, keyStorePassword, keyStoreType, keyStoreAlgorithm); + TrustManager[] trustManagers = configureTrustManagers(trustStoreLocation, trustStorePassword, trustStoreType, trustStoreAlgorithm); + + // create ssl context + SSLContext sslContext = SSLContext.getInstance(algorithm); + sslContext.init(keyManagers, trustManagers, null); + + cf.useSslProtocol(sslContext); + + if (enableHostnameVerification) { + cf.enableHostnameVerification(); + } + } + } catch (NoSuchAlgorithmException | IOException | CertificateException | + UnrecoverableKeyException | KeyStoreException | KeyManagementException e) { + throw new IllegalStateException("Error while configuring TLS", e); + } + } + + private static KeyManager[] configureKeyManagers(String keystore, String keystorePassword, String keystoreType, String keystoreAlgorithm) throws KeyStoreException, IOException, NoSuchAlgorithmException, + CertificateException, UnrecoverableKeyException { + char[] keyPassphrase = null; + if (keystorePassword != null) { + keyPassphrase = keystorePassword.toCharArray(); + } + KeyManager[] keyManagers = null; + if (keystore != null) { + KeyStore ks = KeyStore.getInstance(keystoreType); + try (InputStream in = loadResource(keystore)) { + ks.load(in, keyPassphrase); + } + KeyManagerFactory kmf = KeyManagerFactory.getInstance(keystoreAlgorithm); + kmf.init(ks, keyPassphrase); + keyManagers = kmf.getKeyManagers(); + } + return keyManagers; + } + + private static TrustManager[] configureTrustManagers(String truststore, String truststorePassword, String truststoreType, String truststoreAlgorithm) + throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException { + char[] trustPassphrase = null; + if (truststorePassword != null) { + trustPassphrase = truststorePassword.toCharArray(); + } + TrustManager[] trustManagers = null; + if (truststore != null) { + KeyStore tks = KeyStore.getInstance(truststoreType); + try (InputStream in = loadResource(truststore)) { + tks.load(in, trustPassphrase); + } + TrustManagerFactory tmf = TrustManagerFactory.getInstance(truststoreAlgorithm); + tmf.init(tks); + trustManagers = tmf.getTrustManagers(); + } + return trustManagers; + } + + private static void setUpBasicSsl(ConnectionFactory cf, boolean validateServerCertificate, boolean verifyHostname, String sslAlgorithm) throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException { + if (validateServerCertificate) { + useDefaultTrustStore(cf, sslAlgorithm, verifyHostname); + } else { + if (sslAlgorithm == null) { + cf.useSslProtocol(); + } else { + cf.useSslProtocol(sslAlgorithm); + } + } + } + + private static void useDefaultTrustStore(ConnectionFactory cf, String sslAlgorithm, boolean verifyHostname) throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException { + SSLContext sslContext = SSLContext.getInstance(sslAlgorithm); + TrustManagerFactory trustManagerFactory = + TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + trustManagerFactory.init((KeyStore) null); + sslContext.init(null, trustManagerFactory.getTrustManagers(), null); + cf.useSslProtocol(sslContext); + if (verifyHostname) { + cf.enableHostnameVerification(); + } } public static void load(ConnectionFactory connectionFactory, String propertyFileLocation) throws IOException { @@ -256,4 +384,21 @@ public static void load(ConnectionFactory connectionFactory, Properties properti public static void load(ConnectionFactory connectionFactory, Map properties) { load(connectionFactory, properties, DEFAULT_PREFIX); } + + public static String lookUp(String key, Map properties, String prefix) { + return lookUp(key, properties, prefix, null); + } + + public static String lookUp(String key, Map properties, String prefix, String defaultValue) { + String value = properties.get(prefix + key); + if (value == null) { + value = ALIASES.getOrDefault(key, Collections.emptyList()).stream() + .map(alias -> properties.get(prefix + alias)) + .filter(v -> v != null) + .findFirst().orElse(defaultValue); + } + return value; + } + + } diff --git a/src/test/java/com/rabbitmq/client/test/PropertyFileInitialisationTest.java b/src/test/java/com/rabbitmq/client/test/PropertyFileInitialisationTest.java index 0c5df5823f..2a140721a5 100644 --- a/src/test/java/com/rabbitmq/client/test/PropertyFileInitialisationTest.java +++ b/src/test/java/com/rabbitmq/client/test/PropertyFileInitialisationTest.java @@ -18,66 +18,64 @@ import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.ConnectionFactoryConfigurator; import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; +import javax.net.ssl.SSLContext; import java.io.FileReader; import java.io.IOException; import java.io.Reader; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; +import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Stream; import static com.rabbitmq.client.impl.AMQConnection.defaultClientProperties; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; /** * */ -@RunWith(Parameterized.class) public class PropertyFileInitialisationTest { - @Parameterized.Parameters - public static Object[] data() { - return new Object[] { - "./src/test/resources/property-file-initialisation/configuration.properties", - "classpath:/property-file-initialisation/configuration.properties" - }; - } - - @Parameterized.Parameter - public String propertyFileLocation; - ConnectionFactory cf = new ConnectionFactory(); - @Test public void propertyInitialisationFromFile() throws IOException { - cf.load(propertyFileLocation); - checkConnectionFactory(); + @Test + public void propertyInitialisationFromFile() throws IOException { + for (String propertyFileLocation : Arrays.asList( + "./src/test/resources/property-file-initialisation/configuration.properties", + "classpath:/property-file-initialisation/configuration.properties")) { + ConnectionFactory connectionFactory = new ConnectionFactory(); + connectionFactory.load(propertyFileLocation); + checkConnectionFactory(connectionFactory); + } } - @Test public void propertyInitialisationCustomPrefix() throws Exception { + @Test + public void propertyInitialisationCustomPrefix() throws Exception { Properties propertiesCustomPrefix = getPropertiesWitPrefix("prefix."); cf.load(propertiesCustomPrefix, "prefix."); checkConnectionFactory(); } - @Test public void propertyInitialisationNoPrefix() throws Exception { + @Test + public void propertyInitialisationNoPrefix() throws Exception { Properties propertiesCustomPrefix = getPropertiesWitPrefix(""); cf.load(propertiesCustomPrefix, ""); checkConnectionFactory(); } - @Test public void propertyInitialisationNullPrefix() throws Exception { + @Test + public void propertyInitialisationNullPrefix() throws Exception { Properties propertiesCustomPrefix = getPropertiesWitPrefix(""); cf.load(propertiesCustomPrefix, null); checkConnectionFactory(); } - @Test public void propertyInitialisationUri() { + @Test + public void propertyInitialisationUri() { cf.load(Collections.singletonMap("rabbitmq.uri", "amqp://foo:bar@127.0.0.1:5673/dummy")); assertThat(cf.getUsername()).isEqualTo("foo"); @@ -87,12 +85,14 @@ public static Object[] data() { assertThat(cf.getPort()).isEqualTo(5673); } - @Test public void propertyInitialisationIncludeDefaultClientPropertiesByDefault() { + @Test + public void propertyInitialisationIncludeDefaultClientPropertiesByDefault() { cf.load(new HashMap<>()); assertThat(cf.getClientProperties().entrySet()).hasSize(defaultClientProperties().size()); } - @Test public void propertyInitialisationAddCustomClientProperty() { + @Test + public void propertyInitialisationAddCustomClientProperty() { cf.load(new HashMap() {{ put("rabbitmq.client.properties.foo", "bar"); }}); @@ -100,7 +100,8 @@ public static Object[] data() { assertThat(cf.getClientProperties()).extracting("foo").isEqualTo("bar"); } - @Test public void propertyInitialisationGetRidOfDefaultClientPropertyWithEmptyValue() { + @Test + public void propertyInitialisationGetRidOfDefaultClientPropertyWithEmptyValue() { final String key = defaultClientProperties().entrySet().iterator().next().getKey(); cf.load(new HashMap() {{ put("rabbitmq.client.properties." + key, ""); @@ -108,7 +109,8 @@ public static Object[] data() { assertThat(cf.getClientProperties().entrySet()).hasSize(defaultClientProperties().size() - 1); } - @Test public void propertyInitialisationOverrideDefaultClientProperty() { + @Test + public void propertyInitialisationOverrideDefaultClientProperty() { final String key = defaultClientProperties().entrySet().iterator().next().getKey(); cf.load(new HashMap() {{ put("rabbitmq.client.properties." + key, "whatever"); @@ -117,7 +119,8 @@ public static Object[] data() { assertThat(cf.getClientProperties()).extracting(key).isEqualTo("whatever"); } - @Test public void propertyInitialisationDoNotUseNio() throws Exception { + @Test + public void propertyInitialisationDoNotUseNio() throws Exception { cf.load(new HashMap() {{ put("rabbitmq.use.nio", "false"); put("rabbitmq.nio.nb.io.threads", "2"); @@ -125,34 +128,150 @@ public static Object[] data() { assertThat(cf.getNioParams().getNbIoThreads()).isNotEqualTo(2); } + @Test + public void lookUp() { + assertThat(ConnectionFactoryConfigurator.lookUp( + ConnectionFactoryConfigurator.SSL_KEY_STORE, + Collections.singletonMap(ConnectionFactoryConfigurator.SSL_KEY_STORE, "some file"), + "" + )).as("exact key should be looked up").isEqualTo("some file"); + + assertThat(ConnectionFactoryConfigurator.lookUp( + ConnectionFactoryConfigurator.SSL_KEY_STORE, + Collections.emptyMap(), + "" + )).as("lookup should return null when no match").isNull(); + + assertThat(ConnectionFactoryConfigurator.lookUp( + ConnectionFactoryConfigurator.SSL_KEY_STORE, + Collections.singletonMap("ssl.key-store", "some file"), // key alias + "" + )).as("alias key should be used when initial is missing").isEqualTo("some file"); + + assertThat(ConnectionFactoryConfigurator.lookUp( + ConnectionFactoryConfigurator.SSL_TRUST_STORE_TYPE, + Collections.emptyMap(), + "", + "JKS" + )).as("default value should be returned when key is not found").isEqualTo("JKS"); + } + + @Test + public void tlsInitialisationWithKeyManagerAndTrustManagerShouldSucceed() { + Stream.of("./src/test/resources/property-file-initialisation/tls/", + "classpath:/property-file-initialisation/tls/").forEach(baseDirectory -> { + Map configuration = new HashMap<>(); + configuration.put(ConnectionFactoryConfigurator.SSL_ENABLED, "true"); + configuration.put(ConnectionFactoryConfigurator.SSL_KEY_STORE, baseDirectory + "keystore.p12"); + configuration.put(ConnectionFactoryConfigurator.SSL_KEY_STORE_PASSWORD, "bunnies"); + configuration.put(ConnectionFactoryConfigurator.SSL_KEY_STORE_TYPE, "PKCS12"); + configuration.put(ConnectionFactoryConfigurator.SSL_KEY_STORE_ALGORITHM, "SunX509"); + + configuration.put(ConnectionFactoryConfigurator.SSL_TRUST_STORE, baseDirectory + "truststore.jks"); + configuration.put(ConnectionFactoryConfigurator.SSL_TRUST_STORE_PASSWORD, "bunnies"); + configuration.put(ConnectionFactoryConfigurator.SSL_TRUST_STORE_TYPE, "JKS"); + configuration.put(ConnectionFactoryConfigurator.SSL_TRUST_STORE_ALGORITHM, "SunX509"); + + configuration.put(ConnectionFactoryConfigurator.SSL_VERIFY_HOSTNAME, "true"); + + ConnectionFactory connectionFactory = mock(ConnectionFactory.class); + ConnectionFactoryConfigurator.load(connectionFactory, configuration, ""); + + verify(connectionFactory, times(1)).useSslProtocol(any(SSLContext.class)); + verify(connectionFactory, times(1)).enableHostnameVerification(); + }); + } + + @Test + public void tlsNotEnabledIfNotConfigured() { + ConnectionFactory connectionFactory = mock(ConnectionFactory.class); + ConnectionFactoryConfigurator.load(connectionFactory, Collections.emptyMap(), ""); + verify(connectionFactory, never()).useSslProtocol(any(SSLContext.class)); + } + + @Test + public void tlsNotEnabledIfDisabled() { + ConnectionFactory connectionFactory = mock(ConnectionFactory.class); + ConnectionFactoryConfigurator.load( + connectionFactory, + Collections.singletonMap(ConnectionFactoryConfigurator.SSL_ENABLED, "false"), + "" + ); + verify(connectionFactory, never()).useSslProtocol(any(SSLContext.class)); + } + + @Test + public void tlsSslContextSetIfTlsEnabled() { + AtomicBoolean sslProtocolSet = new AtomicBoolean(false); + ConnectionFactory connectionFactory = new ConnectionFactory() { + @Override + public void useSslProtocol(SSLContext context) { + sslProtocolSet.set(true); + super.useSslProtocol(context); + } + }; + ConnectionFactoryConfigurator.load( + connectionFactory, + Collections.singletonMap(ConnectionFactoryConfigurator.SSL_ENABLED, "true"), + "" + ); + assertThat(sslProtocolSet).isTrue(); + } + + @Test + public void tlsBasicSetupShouldTrustEveryoneWhenServerValidationIsNotEnabled() throws Exception { + String algorithm = ConnectionFactory.computeDefaultTlsProtocol(SSLContext.getDefault().getSupportedSSLParameters().getProtocols()); + Map configuration = new HashMap<>(); + configuration.put(ConnectionFactoryConfigurator.SSL_ENABLED, "true"); + configuration.put(ConnectionFactoryConfigurator.SSL_VALIDATE_SERVER_CERTIFICATE, "false"); + ConnectionFactory connectionFactory = mock(ConnectionFactory.class); + ConnectionFactoryConfigurator.load(connectionFactory, configuration, ""); + verify(connectionFactory, times(1)).useSslProtocol(algorithm); + } + + @Test + public void tlsBasicSetupShouldSetDefaultTrustManagerWhenServerValidationIsEnabled() throws Exception { + Map configuration = new HashMap<>(); + configuration.put(ConnectionFactoryConfigurator.SSL_ENABLED, "true"); + configuration.put(ConnectionFactoryConfigurator.SSL_VALIDATE_SERVER_CERTIFICATE, "true"); + ConnectionFactory connectionFactory = mock(ConnectionFactory.class); + ConnectionFactoryConfigurator.load(connectionFactory, configuration, ""); + verify(connectionFactory, never()).useSslProtocol(anyString()); + verify(connectionFactory, times(1)).useSslProtocol(any(SSLContext.class)); + } + private void checkConnectionFactory() { - assertThat(cf.getUsername()).isEqualTo("foo"); - assertThat(cf.getPassword()).isEqualTo("bar"); - assertThat(cf.getVirtualHost()).isEqualTo("dummy"); - assertThat(cf.getHost()).isEqualTo("127.0.0.1"); - assertThat(cf.getPort()).isEqualTo(5673); + checkConnectionFactory(this.cf); + } - assertThat(cf.getRequestedChannelMax()).isEqualTo(1); - assertThat(cf.getRequestedFrameMax()).isEqualTo(2); - assertThat(cf.getRequestedHeartbeat()).isEqualTo(10); - assertThat(cf.getConnectionTimeout()).isEqualTo(10000); - assertThat(cf.getHandshakeTimeout()).isEqualTo(5000); + private void checkConnectionFactory(ConnectionFactory connectionFactory) { + assertThat(connectionFactory.getUsername()).isEqualTo("foo"); + assertThat(connectionFactory.getPassword()).isEqualTo("bar"); + assertThat(connectionFactory.getVirtualHost()).isEqualTo("dummy"); + assertThat(connectionFactory.getHost()).isEqualTo("127.0.0.1"); + assertThat(connectionFactory.getPort()).isEqualTo(5673); - assertThat(cf.getClientProperties().entrySet()).hasSize(defaultClientProperties().size() + 1); - assertThat(cf.getClientProperties()).extracting("foo").isEqualTo("bar"); + assertThat(connectionFactory.getRequestedChannelMax()).isEqualTo(1); + assertThat(connectionFactory.getRequestedFrameMax()).isEqualTo(2); + assertThat(connectionFactory.getRequestedHeartbeat()).isEqualTo(10); + assertThat(connectionFactory.getConnectionTimeout()).isEqualTo(10000); + assertThat(connectionFactory.getHandshakeTimeout()).isEqualTo(5000); + + assertThat(connectionFactory.getClientProperties().entrySet()).hasSize(defaultClientProperties().size() + 1); + assertThat(connectionFactory.getClientProperties()).extracting("foo").isEqualTo("bar"); - assertThat(cf.isAutomaticRecoveryEnabled()).isFalse(); - assertThat(cf.isTopologyRecoveryEnabled()).isFalse(); - assertThat(cf.getNetworkRecoveryInterval()).isEqualTo(10000l); - assertThat(cf.getChannelRpcTimeout()).isEqualTo(10000); - assertThat(cf.isChannelShouldCheckRpcResponseType()).isTrue(); + assertThat(connectionFactory.isAutomaticRecoveryEnabled()).isFalse(); + assertThat(connectionFactory.isTopologyRecoveryEnabled()).isFalse(); + assertThat(connectionFactory.getNetworkRecoveryInterval()).isEqualTo(10000l); + assertThat(connectionFactory.getChannelRpcTimeout()).isEqualTo(10000); + assertThat(connectionFactory.isChannelShouldCheckRpcResponseType()).isTrue(); - assertThat(cf.getNioParams()).isNotNull(); - assertThat(cf.getNioParams().getReadByteBufferSize()).isEqualTo(32000); - assertThat(cf.getNioParams().getWriteByteBufferSize()).isEqualTo(32000); - assertThat(cf.getNioParams().getNbIoThreads()).isEqualTo(2); - assertThat(cf.getNioParams().getWriteEnqueuingTimeoutInMs()).isEqualTo(5000); - assertThat(cf.getNioParams().getWriteQueueCapacity()).isEqualTo(1000); + assertThat(connectionFactory.getNioParams()).isNotNull(); + assertThat(connectionFactory.getNioParams().getReadByteBufferSize()).isEqualTo(32000); + assertThat(connectionFactory.getNioParams().getWriteByteBufferSize()).isEqualTo(32000); + assertThat(connectionFactory.getNioParams().getNbIoThreads()).isEqualTo(2); + assertThat(connectionFactory.getNioParams().getWriteEnqueuingTimeoutInMs()).isEqualTo(5000); + assertThat(connectionFactory.getNioParams().getWriteQueueCapacity()).isEqualTo(1000); } private Properties getPropertiesWitPrefix(String prefix) throws IOException { @@ -168,8 +287,8 @@ private Properties getPropertiesWitPrefix(String prefix) throws IOException { Properties propertiesCustomPrefix = new Properties(); for (Map.Entry entry : properties.entrySet()) { propertiesCustomPrefix.put( - prefix + entry.getKey().toString().substring(ConnectionFactoryConfigurator.DEFAULT_PREFIX.length()), - entry.getValue() + prefix + entry.getKey().toString().substring(ConnectionFactoryConfigurator.DEFAULT_PREFIX.length()), + entry.getValue() ); } return propertiesCustomPrefix; diff --git a/src/test/resources/property-file-initialisation/tls/keystore.p12 b/src/test/resources/property-file-initialisation/tls/keystore.p12 new file mode 100644 index 0000000000000000000000000000000000000000..a5280a6cbfc9397e6a2ad7146b3859e685bc4434 GIT binary patch literal 2453 zcmV;G32OE*f(elV0Ru3C30DRQDuzgg_YDCD0ic2jNCbijL@_XY_nhDe6@ z4FLxRpn?PFFoFZ*0s#Opf&<+K2`Yw2hW8Bt2LUh~1_~;MNQUt@E?CQoZmLNl(%$Xi%*sEDPmpsXTtmVgCUP z9c0jUNIZ#6_<{ghk2g}iObqpcM)QEt(AGmT`A&qTRq}`6bsLo{4N3aM%bUcg>8)8H zih9lQtQ2hC209&3$!6Zuws=frumiq*Ph0B`Z{h9%m=kGyH4|mckw~3BcjKy_^I>1T zU}k#gdqJ-KcoBGM3fD*C^!=@dWXm}B6)Cn~!MA>9w#xq)xBD+T<`Z^G;1aymUs&y| z)lL4bU(NQ83io1~x$#p5gfX#^1;xsqaE3dxZ3TLP2u-NvGCqE-Q1c`}+X5$WlICbM z98B$V%AKoBvk_phj$`s2LC(EsHy@H$G0@8iM`SZ!oau;v^CUdI;})}7ZMa>_+gfO0 zC|A{x96tO8RL7(ZsZ|0k6-=;v9%YfrZDo)Aju4YT} z@?<>*lXEM!c_!LiHQxt_$|LAQUOzst_hR`s!Bo=%7l_xBYw`JhymkE_4hTVq%8baH zW`h4HhoeEy%Huv%O&IQe9LpinL?oa^kg{xk2KT;fu1C1VPUsHwT*h*;VGicvncJHA z5k_Hr3M)$uD4gn{V#liwH7byi`odl@r6d^`T0<35ObC)yn?+de1#n-_IwN{b&e&}* z6rN;hu|-}}M7k(&LNQUz=3HJr#wi9;Mp8KdCt_i zjeT4eMw)imK#f{xkLGMrIntd`KIsRX%CA!65B`kut~Gp4*qh;R0<`P1HhhLo$JCCQ zX1-mBrErs%H?p<9!!s`n;d3?gi;y@LOPmqo{+>JkHE8fHekww?56X z`;Lv9R5-i9)Zl7d^Da`&wK<=Y1QDB7^a=q4qtcax93pN*DHDLvT{$+D>{>E@Aq*y>xyZI z(ML5rE2vIMq^cI4IwVN!kDGsiZ^vQWws9}Uq6(goz9BmikW+cHC69H1a>qcs^FETn z1PoE9Y`y6^%|%`JEj{)zDr%@VB^qIcX<2 zd1}_S6!F(CLVzBNeNp}h)oNF$U&y^s>CTYTt-cY3ogap^euT2+tCh*)W|Sq?phJPB z*GP=RGn>{AlPkl4!45$|XJ#_vZ0|w3+1(iWU`3mV2|L8%p=IcE7EFRrxCFF^;=lrA z&U7=lLBX>NYUnEFA@m@p!~^2UTS(t8dd3373t`D=$NT%DaiOrNqM2K}Y*Me^UanJ; zv^Vnn(2h4h^{#vtKANAPvUPA>&Y3G{yCB2E!?eTFgOe&bEK1_Nrd*>scJc_R*!z8| z09;_Xr>GyPD0I*JNOCwv>?AyewOywN1jbFAPsjI$R3)mu`O$MCJ;Xo!ig%OFYm}$x z3`omJ-nMWhuH#jLAnf7p@OYs-TfvP*Pl1?u&l@Xr7t8?71;dDbcR%QAj-8mKlg_1* zG8)#HNp)K=!~JI{w=c!8X_>p}Q|%f(e0|}XK(vV2+`j#;IU9)+k6Geh!bBi&@Gb5tbioO{q?AsWkf*!d4!$uo7c zKfR++p?zp`HJ_c$>!6%yo%4MYP4>37gfz$*$ky`X5(71XsKF)WPAn`p|Buma7&K}0 zeW0+jHYN^Ll$!0!>S8`L_c6VlkTE*E@c<9jb_$V4wZE4QGsfNV3hf*=-sOf&{(-0Ru3C1a}4rDuzgg_YDCD0ic2eXas@;WH5pRU@(FNTm}g$hDe6@ z4FLxRpn?QVFoFb00s#Opf&@Ya2`Yw2hW8Bt2LUiC1_~;MNQU8^@R{Tt>+g$%b7#^NFz$ZuT}>j7sL!X zJ?^yu$ir)lBSKE0=$l)J_I+=8>tj3{$J`O2AvNLeAMJc@?e_Ly4C?$Qma}j$1w$q z#ACO4@N?e^h`7qeH0!%U<6`^_hu_r`KNZ7wrZB$o1kPyjv0#|`qAvb>6EdhhGCwm$ zf{|;*6Vb|}+Mn>MfV0i&wr0Lpe_Vd=<^IczN3G1d4BKo5+FqZ%``G}Kp%~9mw*8B= zAQ#4r-w|EseD#9gNh%Xk&&U)o_dtK6vziatFkh&_1d8tfbSintht6Tkn($OGsh})H zh8@TaYQa2=>a~!TS0E(RIfNZy7NkL6Qn&%j6K;5Jg^*kNc)ikK-l)-7u`QfNWiy*a z{YZlXBQF7Ut%wD_S=3Jqqzt)T)IzC}w<(|--bk7^U9LMefC~NY)iJ|Qhr_rU>(Fo? z-RfKn4TT*bM;O zk)FZl1Y*Du>-O+@(|VsDy1X;s@%Qm5+_Y!Ula?fVV>oxZ2oT`J^mKJp?-K%Lo_5Eu+ z-brRhBaw_WU(dJ^DK9i5;^e)@bBMbLc;%#H+Hrxvz_MC}{2B{@8o6)da|vT_a`(^&AtD{p!3!qQmQr$F5mI{9igs7JW+#Jz=Q?Bs;OIk!g&=DH9pU)R!$VNkVwe5dy!_?$wmqIiU4X=Z@4t(Hp@XMO>4jw@AjMJpT zD@eg-3X2(&n9f(y3Nl@KJDshhY4-F@!&v)E;g-l5$UI;F#yC6|HgrUOr#v0ByQn6z z>p7&AmnnlqIaJg2Chb#Nf42f8?5|QE!=+~41XmuQ1&%=h!^FIreQMO=D2Fu;X%YJ$ zw4;V}3r%g$5tll}d|mId5LaShl=6L=-wc0hG)5xMnn@bk0;4M-5NiiK_c9xe zop#+A7Jvo1fh9NXzOAY~pD;c!AutIB1uG5%0vZJX1Qb6MJC1$<{Xd?3cCOfI_8rl1 gntKEk`UyVFG_s>ccNeh1daTsm2u%w$0s{etpb_dgAOHXW literal 0 HcmV?d00001 From e1f2c8e28e5a113d55dd57f6dfc6929e3af264fd Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Wed, 22 Apr 2020 20:19:10 +0300 Subject: [PATCH 215/328] AutorecoveringConnection.maybeDeleteRecordedAutoDeleteExchange does not need to acquire a lock on this.consumers It most likely was a copy-paste artefact introduced back in 2013-2014. AutorecoveringConnection.maybeDeleteRecordedAutoDeleteQueue does need to lock this.consumers as conditional queue deletion does need to check the number of known consumers on that queue. 1aad565 addressed a potential deadlock caused by the unsafe order of lock acquisitions. In #648 another similar issue was discovered which #649 tried to address by acquiring a lock on this.consumers early. However, exchange cleanup does not need to lock this.consumers as it does not mutate it. Closes #648. (cherry picked from commit 5c3fce8d224c434c3f3858840123b03d28a1d9cd) --- .../impl/recovery/AutorecoveringConnection.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java index f04e3778d5..785d98e5f4 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java @@ -1032,15 +1032,13 @@ void maybeDeleteRecordedAutoDeleteQueue(String queue) { } void maybeDeleteRecordedAutoDeleteExchange(String exchange) { - synchronized (this.consumers) { - synchronized (this.recordedExchanges) { - if(!hasMoreDestinationsBoundToExchange(Utility.copy(this.recordedBindings), exchange)) { - RecordedExchange x = this.recordedExchanges.get(exchange); - // last binding where this exchange is the source is gone, remove recorded exchange - // if it is auto-deleted. See bug 26364. - if(x != null && x.isAutoDelete()) { - deleteRecordedExchange(exchange); - } + synchronized (this.recordedExchanges) { + if(!hasMoreDestinationsBoundToExchange(Utility.copy(this.recordedBindings), exchange)) { + RecordedExchange x = this.recordedExchanges.get(exchange); + // last binding where this exchange is the source is gone, remove recorded exchange + // if it is auto-deleted. See bug 26364. + if(x != null && x.isAutoDelete()) { + deleteRecordedExchange(exchange); } } } From 653aa486d87d0729cc6968eaf998be6fc1128518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 28 Apr 2020 11:45:55 +0200 Subject: [PATCH 216/328] Lock NIO loop initialization (precaution) The initialization is supposed to be called in a lock already. (cherry picked from commit 7d7ca78500b25156d5694e26034ec000a18fd787) --- .../client/impl/nio/NioLoopContext.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/nio/NioLoopContext.java b/src/main/java/com/rabbitmq/client/impl/nio/NioLoopContext.java index 47639cfc35..a73a7a0420 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/NioLoopContext.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/NioLoopContext.java @@ -54,12 +54,19 @@ public NioLoopContext(SocketChannelFrameHandlerFactory socketChannelFrameHandler } void initStateIfNecessary() throws IOException { - // FIXME this should be synchronized - if (this.readSelectorState == null) { - this.readSelectorState = new SelectorHolder(Selector.open()); - this.writeSelectorState = new SelectorHolder(Selector.open()); + // This code is supposed to be called only from the SocketChannelFrameHandlerFactory + // and while holding the lock. + // We lock just in case some other code calls this method in the future. + socketChannelFrameHandlerFactory.lock(); + try { + if (this.readSelectorState == null) { + this.readSelectorState = new SelectorHolder(Selector.open()); + this.writeSelectorState = new SelectorHolder(Selector.open()); - startIoLoops(); + startIoLoops(); + } + } finally { + socketChannelFrameHandlerFactory.unlock(); } } From 8a334573c0c0f720f668030e18c6dc48f62ed5f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 29 Apr 2020 09:20:33 +0200 Subject: [PATCH 217/328] Bump Maven to 3.6.3 --- .mvn/wrapper/MavenWrapperDownloader.java | 117 ++++++++ .mvn/wrapper/maven-wrapper.jar | Bin 48336 -> 50710 bytes .mvn/wrapper/maven-wrapper.properties | 3 +- mvnw | 89 +++++- mvnw.cmd | 327 +++++++++++++---------- 5 files changed, 387 insertions(+), 149 deletions(-) create mode 100644 .mvn/wrapper/MavenWrapperDownloader.java mode change 100755 => 100644 .mvn/wrapper/maven-wrapper.jar mode change 100755 => 100644 .mvn/wrapper/maven-wrapper.properties mode change 100755 => 100644 mvnw.cmd diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000..b901097f2d --- /dev/null +++ b/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar old mode 100755 new mode 100644 index f775b1c04cf89b25c7814d3a8a7c810301092e57..2cc7d4a55c0cd0092912bf49ae38b3a9e3fd0054 GIT binary patch delta 13080 zcmY+qV|bq3^8X#1josL`lQy<(+t$_CykgtAVyj^r+i7guO`i7t-T%FxeZE@jGvApt z$2#WCoNK0^AyQ)?6YK$^2>mQ*;*Wvrq&QOLSmGUxAUe39p_&l0sIO}ja;8ITYZ_|h z^qvDB1HNy;9$KO}`*`JFFWKsq;4Q@o@U8m9iNcjqaS48kRrxyIDDXk$=ar$7D$_R~ z*vTG52~M~2Bwaf540Y}>^crKBzvFI$$m+6lAaJXv-%30dfef5>RMS=Ew(>t$;zT6t zFuJqZlzEB_ROlaDh?gAHT%^;E*ZBLPJ= z_`FT@6O7DIi%~p&ukm#0&|oq27c7$}qf`&;DLv1uZpIKm2?=IVr0{nV^XzW5U=cDs z7uQDDDS;_7i-*HnM`19vtNA|MfuvdeJXEhv>Ng=_v{~VKKNhsr+Gu|vBzb+JQKjp+ z>E|dwFvZskNa3v>%;8!Tc||FVrgr5_Qga{CWJ9XS;UQ^FnoIA`kd32TI7~pTbqlFQ zHA%T|+m+$;QteVkv%$f(NRdI%a-0yfi{ZZo3pTI1l~~O1D<=l*L6E-0(7+bAup7#| zTP!;NQu=YK_`E=g*DfrRwV+{Z zXg4i-v+Xokfzn9xmeUQQ?7HRVUx=v@78T>bk?;gU)uqw z8&N0l&uulx7r}!@Jj%&rY!T*EiD1pcW`_>D!*Yr8=rCI1nbkP2Od#^Fn-mUP z2NB!QIcL3Ro@SforM)Ip?6L=l#DomH*FRLvm=zPuCC%WIP3Fl`O-`tpl}*l|hD)99(Q9{OT}WSf z6Tv9_TVzM{i{~y_cGsxYILC}DIEiNRphZvE`hy%I%2?fS0j_SvU>U{M_Gy4|uyqAt zG2Ct^k9@Cs-R7_8)O$7! zeT96g1w`@GsvShbA?K^1g=z4zj37@f!p9ODg{LpHaJIRIubs8WqUNw^@MD%@CC;IB z(~BLtCpr#&cEjgVtD48Y{wrDZ}!v zAs;Hg!DV*2z`2eaQVdB2a>%?um`ob=7e?n4&(mprFkHy(sS8}HSS9JCir()A3*y+h zHSLNtawA=u%}cwno_){{r%Z6JP@b9(YQep5=k}v{vvk^@zZ{gH>8S(AU9AK>t|F8K zgi(#}?Z~Qeb1BY%V*LS-7H8?oM%5K)7EzK?0M?w43hXe4E%pQXEIepj-;rfZ>^dF; zJ=VrW&8N7tSG@~dO;>K0);Q-w`U~RijctHSIEG7TqTV6`&JP!YVX9$<$FfF>u*+cM zS2W7yPIGRw^xl|P0wuUVRWU|jhyV}lMAQIi!5R@P;JxQEK2Pqj#AWj+e~E;HzfP#h zOhn5P*&PHAK8G6dsDzT5x>*rQa6fQs*hT5c4-K3B0&AYEq9dWZnuKiztXrL(mVeyv zz3e`E%r(<)!9swa>Avm-1blpKOqIR+J}HCQ??B_zL1hwpa@Z)OkFe77IVk8HA0-29 z738!W+`>6cEL1m8Ea`Gw#*N1owlK=O$Fn(#XxRnve{s5Hq}*|+!DqYJF%9iPaCVw@ zPDZ;A?Y_3=2~T?#d^^JC3Frh)dReRzaHwimeOl!ofcW8#a<;yLwMKHev8E1hSB=FJ z_@?49duK=e%Q8+EqA%B5e<#vcM ze?S8)Mav-{n;wde03WuBv~KqMb$Mb@LLi0`#+FrVAO__`q%^glNxX%=ZR;sv`bO&g zaCMXBw8W=eGou;`J#7j-sjuw5XH5%fL?jLC0j@M9<8Db7Hq&nQyvz(QU99{7ai08{tq2BQ_&1R>ubhMK6vLjg34otZlO((r}{1|`?Ancw>Yv3w%r1K%;i^a3K6Z4 zvLodo0%P{E#8@t%9T`Zez7kmi(AT?z{e2%$2Rlvt*L*tNnx+`fH?ZR`|6E?dww=T^ zFYX++2<&8H0FUP97rnQ9qZ(A40|;B$WReJXoSW|+h5YBqB@vMNut|#{gXR(gD1jZ% zJUE^Z%aOO7+0;hKx!lvSi0NL7;QYJhY7b{A#ey(CGm^|wY8gyKR27kcp0MH28_H`3 zNE}+G-89rS2MH>rbrIo~#DK}TizdrDezG#o8 zuB$+9VcPjyK2VJ@is2j1ZVA4DN+uAI0?!LCRT;vS%|buXJmC;Pmm=`u0$KZ={utJz zhF|}Vpvn<`S%!=6Edk&Ke%zLsrfLgTJJgI1G6oT{PxxfdC`S)%yYu|4v@4S&48+=x zqVT`*=@K2d=jhSnLGD85MsrjJouhx!8R(h3aPU5n_lgeVo-*J3l7ifY#jVWrW86x3 zio@fyO&jcHy#@y00BnsF&TwH%O$N}j&y37|-0zc$YjkDco~Zwbsu2mD_>E;wBz2+9 z-An`S+olK1LG13>&zSv6XZ+LNkUCc0@`veY2!?p&=g_*epI}(nS7og(4Q^qF# zJ1p{g{8zaGXqr?}?6%p=z3~+MlzKM{YN#(I+Q0xq9Y`=ag`#Hr7wy=1xhh^3r*JmoXf!>K zu)`KPLWL@zG;8siRl}qraCeni1HtNv=hn2oBuATH+<`B*xZS%O(hDLl8TuqYroRl? zPeKSghE!(LO+u5e!az}R%M~WK|Ik~;LN*iJ!CM10BIrBH$WAm&4~1!=uR;KjlT2G> z;m(e9>!$gE6VmVpciT@e2gQsVu5w)^n|ZS50K`qe%#}Ta!%S-6<&N)jX2F4AXsfLi zZCY--F}#i&1ftw?n#@-dm(XqNfD z_8oAw>37CoCK%0B!+bdFpTjqX(C>06avFH8cAAhw?C{Ijr<7aJxPF-xUfb8L@7-zz z3f0?tjsH2ssf@Fa%j#ZW4Hq#*&;hF|iD?;trZ4b#k#yY3q0GKbyGGy}#%E;NZ~X(& zvH=4F#T^gD)qZuPV;d31R~NESG1zBXeZt*@K0eSK!kbvz zRZ7R-E{0|I7A?JK;YQWd*i$0{2b_Fqa(&+;!(lX4jb5fairCD@0doww{!3~y9i17V zgc{GNeip4tEaD5*K4pWgnKHi$3=MR6T@2iVm0~2uvzhJkyWG7+Ezby=t$BB1?9`in zfAj>?d}h;$&^>&I{it)edwuR8og(gmad;bV^VR3wpc4`I8KrWL8sP42v^>YqNRv!J zM+8e1FReq%0k=FiZze9WjrxPKAEq3Ym2Q~^ddkOvX6e@|v*WgKK&OBEvKZKfLXG&K{(UpEz!enHCKyO1< z?GW2L3~!^f>d572Dc(FMr*One>Ca%Tp%t5V-wo0sit){b@*T%yh&)AXdoy=@yzDri zY*BX+{2`cArzjt7keW#-zH}efn=hFL=HP|e3FKJtsipIY@;sp^1*yd}Uv!Ii24~cv zMW!qE$uwvW_t_Pi7wZPVis=PF!S({7I%o(eA~+~-`cUpl(-x777PX`%)?-yUq3~YN zB-ZzQ4qifRN$dccl31>#a6}&_4MW0?$nJTqW*O;;jKxI9;pW2;|a-i|1KAavvsG)$#@XjwA=LU?k^e_emL+ z)4_KBTAC-knfPAtE5n0v4^bhsiLmr*44>r(Eah(`e!p;VAmVSt zYrtvn`(RC(pvwlkR@v3oHJ`Fr6I4FA-H{+%eCT9qqUt_GqzE`5uD0h6awIqY3BdIE znK!`5C|S_FclD5Pz03;mK%u?s2?HFyxlw+FKRaL;&Iu^=0<%4eb-xoM_eU2GVp)!M zt&hKI4-tGUx!Vg+>51q)V`dG(1T^XaI3=8rC03wfwk1s7sPy7=+h0+NovD{Dw_p7A zga_|o+uzX$vEonF!w8v%cb!;?!=ta$htBs@r8AA!13lU3JlO!JH$~x6StQRRj|yGU zo4Zb6m&5vUc{J|bS)VvgdQoc;DC>nrnaP>7f<@@E7T5;||9D`%8ryr<$72ueV^ zlbw-SD98M|OL;pWni0Dd9XztL*WCWB<4n|oCWwQM&iYVk+7>v^%_iZfq7a#wREm}3 zqQv{{k-~rxVu!~?Ka{Z_?Z+H#4UhP|(;oQ`^&KeXv7^`mgBtauBGS~zd>3Nh&M&l` zsjkNlT&ZjT<)yJNR3|TFlJ%*_jS^v;Z1g91%c~FBTECLw&wfwvUU$9Xq~v7b1?y@} zIhYT1A)|ls6e_hBzh4v68fuDiOaQ9aaMg)c(+_gUs_iYjuzSl4{KzCWn$x3JFxEe> z!60}#uEHRAwtifQlz6^hinMsHsl;HssalA%ssTX&1_$o1Luz?*ufpH1#nj8`a;LxO z2oy-}M6On1zt<@ZS&FZ9ah@ix^V5F(nm=dSfbnePS^xU`l5%Hb!1t(|G7yhm>p)T^ zy8^;=%cNdfTO%C2UR%2brhA7W&ae3VlP=Eqz7sTM_C@cJ%iTu)n?PSI&@lCnPX13*5iGYGWh@Cpf^{h;ZNiL(sZJyJk2o#x8n* z0p>Zu-H5;}A@-USPmDraD|K+yhW=hj5yT{^v(Vg+%}waUzijBBskPuT?4w2 z4urMpD#x+-Du=yw<_2T;Wm_+|ua#yJ#sGyx&X-%Nn!7F679V1}*H&BI&QCV#&UHl9e?a*wvJpq2)S!KT@|Qk-pZ$^lcq1AN3H5t z{B+>&nIMC7&to?VeXaJA%4=j691$e#I7(u-O+>}BzeOIjr?+mMtqrOI#QFcu_=uS> zvZ4WCwI-2LcUWjs1(23myVBUvceW&g^OyRWiUSTi+$#sL?F6M zleo!<^3v`avYt$i-fVe}-N~<22O~;-;pZ#Buo}%c8vW~-oL-y-+iID0hq+UdL&ja6 zK`U0i9A3*GZx(@U!Ha3S&dl+}I$X4jFP5Td4H5p=Eu&>B+egnu6c^rC#v> zgG%d>5@%Mkz06r{0VJTW;em?qOai9w?mS<=daR3;bxdGHq3{XW_1(jC90TK1nyFd} z!}kZ1XPe@~J<9GlRVgi%xuB1_4f^`^%;$svWiF3%tQvmv!nmGf0rv{MFvnri^}MDK zdnQFMj@PZFcVyRsE-EOG>82s+877mTvG6at=PV628b?Hu)upBm5-;6GQ z)Lu010wNK=hV~TObA=(*(SV+c1?0{|BO>})>`{j>4H3wazY>x>kePhWrr$X8#ZY$F zYZom1{Uy?b%0bNGiv4%8g6Aiyq|8+q&yH$10u+_i)tKrQOnT&H|l*Lq#Y>4{yjsLEUg_>K97D9_oR1l>ddAu%Dq@b69j|} z7_sjyiCQqT)hse;8C-3d}QQVWJkbx@oLNhtL|S^hq7fcv=<>GnH6z;!e~E$h2I-JYz3 ziMI-QdLVKb)ltxovk{{{D`$qdz70D-I4B-Lmh68`ni&ST0EK7H-U5rGPuU@j*0Cw{^%y{eyR=d!oteiH@ zQM_No{39o$3mw8-%4Y#&O3|BW%nPI5KBhKK({XEkH7yTczxs8l96YQR)vG1Zt!Yp+ z)^wzojwfV{YwPHXe7Ei~@}XJI2ghQ|+DPENyPma{K0;+R1AWRFn9uk;8lldS<}J?K zyfQRfT&WgI2dJHAS#FM8r6JiDfBch93Fi2i zCMKw7#>+g@Y-V$x;10Dom!yheIHJPN$Xem~c>s}|=DI*dkEoJ-PZ>?fQYcOZm|6%v za5VKOi`f<{Iupw*j}j#5p9zBE*@$p*?c&sPGC6W<{VfI#$nb|O)k^VP2n6@=Yhmw4 z6JjQ%>n8@dWWLRYl@9RYEIuU_EM%dCi*l%DVOJ+E?|XN@l4K5~k?=DcxRA!>SxG`?X!u+rv~MI`^MA4&LcPS*n09g z^PfsCk%Y^&Yxc&bAcqi5%&U0zJV4pY=R8}&;eYKE<_3=Eo%}c>R4v^mnb7>Lrue!? z>OGhc?!B9?;H%p6IX-E^DLaiIO0UDz)ECg{5zRbe8uq3_3MGk%BFGeO{jHE|>Snyb zL(o|<_gz3L9K15Yf6TTI9C$k#f$emB52-r9N@cn32dZ9vFqXyrRtX@m#B{jV7{I zq--LxydzR>I+^T@hT|+k3;m=S%$9sRvZV^&RX!V^tfzTQE%W~9;z(t2?a7q~Q4E-I zZ9ExfDRX$XExdhyBbg=2JwW;Sx7+OSMLQW9BZ!GI+JTi{&+Gxsp z%X{PZVHY*6=$`WijpCEX>c(w_IiDdPttv}&L|D2@?GK{1s?Dnv*Y|E>xl1O}GzgdV zldT`-}+}763S2$Sm;% z1;YaHRJ&`-YbwVG-br6<=;plW93AxK_i=O2HAiuvBozQtCH$ps5@Dbd+c#x#L{z+& z9Rgm#n^~Ng-K@aM-CS;Ee43g|-atd*f#r%0e8XeuY#L?p;j1u}-U&W0KH2wk={@NA z+P32|-rLVi2bcSD0~X_bHh|yhQ5t%Yw$ni<)k92r&;+ME?;uG80%v}%Z6+0gZ(M{w zEMgLGI@_>&<2~MRmz*ar_lh@$oLjR7PVQZVT1M&aq!5>Cj#31VfVeN_P~1NS;eMJf zlN$EPyAbm43$C9XoCc5US?Dtvw)>!N8f$>Q3%ub6+RQQb;Mew_C3SFE*L{pX~ke@ch&6wqV!qRX${|`TaCSV?SVePeDTc;ZK4( zyF~|x*RXz?k*MV%($5*)Bn>_?cUdTakLj9jVVAL6bx>2nQv9xDAnRKj(AsazxO%Tw z7``dFcR^2M^^7;{7GN`4B}m_?g$oG4O}R&=zMlJZM{+0CT-I^6GACS-7cucA%`hQz zwR&E3-URM`Ie4tiAiVChim&xx>Co1<+ZI+=aJSqe`D&g)=h6RWd?j(^mGn{O&Q%n~ zU=Px#A_$WN&EWlkMc_yCY^vsONW@Cjj^S(N{5Sb|Xql?_b^!HO#miEz2;SJqrtk2T zA!9DSBL2skiiT>c1!xyy;=WxawW6yG;qz9hGb_Zd3cAwhC~F2Ml{(}8t_l$@@R@O# zRc#5^)m)Uy*|tm2nzuEtnHC31r)!h`8{N#9Q%mIfkpvMB0Ho*tg{zCM#=0F8%yc3n>p6l*bK9l$vQr#) zgVyWU$=-pSe&#YjTY5gk2eK-yvtpx7fU!HLGNI8n5-HAs$T9PM*KNnRe;&QZ7ee-mBK6vv zGS@YwgMpmsa%aKexq*Dn7<@&+ft~l`GJ)WDN1O!?`Lc83f)a*l^Cg{72PuW&#-)ds zg^3?>?8n}LT;{pOFf@SzLfK8Lxg*s!c{r;fGN5uPoJL+IdJcf3iPaliRC{V8@IocT zM4Q^@lpkRsC-K7!pmUM`t+UyZP$LnR`sG!IJG@6?p+}U`(Bz^^uGz59glxrTM-kD0 z{H8Rco0*kcVT(B1ji`~yRAz$}c8?uo>UOWq{b)hn_xxLkZ#Z1J-B3tUlYv4-_;X&F zDnJ}|ZiK0DR}eH{d+2o)rYT$BQ_z%&FWlBe%4ldN3AnkFM0!blX%b*H7K54J$d@UD z<91}vEK8TVbdq}JV(ROJMp!z)0;N#zkAeD|Z;}OS>f#ai@w`(JG{4hNv6d3&ax_+b z@;2BXL3By}xDQT<&04Y8`vCv@LtwuEP8W6^6$~tb)#`^IL8w@gH}H3wUDwVqobY;S zU&kre+_~HAmfnDmC-^P&Tq_zD4)SAdzwf^wjqjh8LKYMEf&&v$iM(?Y@MVzL!~K5N zd<)NQUgO7f=+EZ`=sFsld9>m#3kCOV!vq{rPvJ(@vMIt^LE7U#L31P=QQy zovvB;Mc+md$!WQ~8E{Y1tS>dcI}Hp%jUvspkVNG)ZDQO27%!pcRU66EU{TU~I;Q$= zB)ED5$*|=aL^OdUPpkt;zw;uNB2U6e3IT1-beId3k)2k`9m+D>OOhPI4F(w0q@`Q_ z2>HRU_!q3>1}a?FVDxtzFbD`=l1_f);#-_WnjJ>Sn&AGTNdb8sSAkPYS}b7_$zm!c z_K<~z$wYbpD37L(%*v;K;Ug$XHe1Y(UzX=?ooI6Ops9S9??{b=9pBanqsa-KGlmu(Q+tV6G;1Ia=y}R zb#$IMw^DFo;f|Gvyzy6YBF>ccQ9Df0rYtMT-=aW*g$tpk-+coI1GE3Xkp^BWE`T3_ zCf-Nya=qDp!yaEGJ3i$^ow@F))hvf}xE=lAb@lnO`|P6LUSo|~hpIwZ3<^Sth_-nx z8$yW^mo;KTxwWbWqWPur!v?uXAVla#C$O1;;P#cW!}qf1apL2#`|@^IQTU1F+qp?R zA|ez%lB+;D)%?#8?3gNQPC>6xH2?K-53dC4k74?FV+`^Aw!5?w9 z=(0xUx=$iUPKV#6G_6?H1zp;N*STHl%IF!k&c{_BbuH9LHmU1cLhOoLYsH zCqr39z;Y~QvdN`X(uEREYpT5Ceb~!uxX;V#`jtZ7DdOV;;l-)jE<~XCdScAWns3K1 zEy_A4OCwLCvTwQpN65&8Zlg7&3E0{Y$N?RyJ&euoob?#W2iTg+E1~D4)6n zM!kfI299c&s=4+_uF3kZCIO;`B{=6|V<8rJslDsqb@i6@FdN?4rDdb(m!o`E*+AOe zrF};_mQXG8Q%D*E5<<#_=%xjj2^!uT_Ak`yP+yN7#{f=32zp9}5qQr0Mw`2jMWJV9WquxjC-fwhK}x|W z-|`uZSQHyY7<$^NVdmXrp;4d3!Zm^~SC*8N#WHb{fn?Q^UptPW(2Amu!35a4QgqMH z6}DvJmw8Y-uZF5Z{K<)nAoR+bF{uH`MKGA)sE>7kkZvd>nQ2AE8{RHE1<<9xfn1+%(Q(B9{!#5_znY#IrENbj0zAxJz%zqOvtc~stJKcTs%Xg*Ig4?v*QJubIcvK}bX3#iy)f*QMFmQ-Opp|J zS-uwScG#52MG11muhs#CcsjF>097JZ8iLChP_nXLs?g)BUdp?G%e*=B*-jgw*f<+Z zXz4&rK;Mdi_J`M%Lu7F0l>+qRj(!un$&u-d^V(#ND_AoFcW3^u*hd;K<_&5@9R`bR zzG}l-j0M5T1z(h0c?3~80ll=B^RHTA3pe&L*pBs8RfXS zi7f(n{k??F1=9P;8)E$BwhC7qgY@w3w=kZP5%Y>=8g0~U4n-@mfvvxbykc;7_JwX$ z^bC9WY1`7vuJEAa*C@4HU@I$*Qz=pmh03;W8>A~H{S!M4)vhSpPj?(z@ylR)`a54U z0pFb$*7t^&mW6P5`{NyHo~U}ndoy&%N+p^gmD#1Q&N4Q!R6&fn{WZh_ftT%9`qD?~+fEh{6_*+}tHWc{`SI zn|nyJj>Y3}7!K!1=+Cug?}%@sp@t2ffb>|2zS?U7OSr^ejmetRX(yRjd*k8~y#pkA zPro?`8($ILBZOI>8F!rwUt>(qp|0|vH4X(A(`IX|^ysZ(rgm#TwJDCi*L{D4#3*$h zJ=Ts`?A@isc~@rW)bA56o0(O7k}-SB(p*Z9r4oKGf`bz+x1v_DVbEq9ky8|v1gsYZ zVTe~%o`&rcETnfiALKEUea+emy)d2HA3F$%7wmM5=`Lsf@<^l#%yc|G*joe}iVTe^ z|HKqU?ypC=!NeHcT4c^a1KW1HEKw9Hi5^{Az?_8`IcU$+SMM!fK>jjylCc)WJIWv;E8#~xpR&?TK-2NSc@-Ip7jGu_2Z2(0*$eUB`Rs-M3DW*g)b zZr^z~m+ZQT-29ou+rR>=R0dGPy7w&f4N(Vf)mb2%hIbRNwb2BJNket>&n>46m!NJn zyq*PXUM&q!Z;=Bn^sFy~>{<@fp`S7RnC=wGl7%(Q9YL+}G$`OYGXM);${5IEADB)0 z=l%SN16rG-9ro0|g2`c|j?SmKrJTO)?v$2HP1U{*8Oc7RI5U<8Pvc)-05FLh!&&SR z+`r;6@QNQa7Sx~1oOZ7;9f%(`R5W=b59PL7wvlp$BXJaVhE&^3y*@E3?qYe{L&m_? z#lF~;1@Pm>Mj!9%F9V`vr$Yq&)}m$WNf_H=8gKVo)M1JIukpJUTg)JGyok;#B%o>! z*C1TlQ6T-QKGzx}%}}T8c~EYA<3EnYUOeL7kzc?6Ig@wi*mCb3eIAdgI6`Be)32}g zXrH6nmNn(ufuA+&1^dzKTV6ksH~c!+c8TuyWH*_NWriGbGzq{CDo@$6GCk{W85IgQ z*D&WEV2?ynH<0-02ZfpxEE)H<@{^d78m|rJ#RoxkHh3eP%9$xRer|t79?++;ktb^> zdX5x+WG|uj-D}W}VVad5l@!wxb*t zZ3@$7PAZd-a0(kO#c8~peBSIlD>F@mB4imwnyyQaFc`|d+UDV6x6I6-T|+PHfw5M+ z>gt<=*8l`!42DZHNyDr(Fh0(u+B8MxFI&78Xxmv1!`+l)5F9l_7polw6M4)#Oo>nA zhs}SQYC7;Lpg=Vr!GGu3!N55G%(egbg8(L0o51G%nN@alu>_)369I8*P{8Ma zR5d&hD3CzbP7I)H4IPBy-z5RCqlN~m2|WG(Hj|L}KmrgN;eUsn!NA!58yTz#oFD!l zuRk;M5EQJyf?90Ce@0;c9OeWC2B!Ky+8V_Frv6iUcta<{>KxE@E>6fCMvM37LD+~9Ss;5<^KqU82%An)DjZ@ z|Lz-%`F}*QO#g^9sIY;Wb$|1aO}qk2Z4V929T)!uL4%=AE3og^fv)u zVma5rOU+IKb7$zX>cF{Rgr%asL6~CjS8`O&ou~i{-z7 z0r=632Bc~JdqA%3zYquL)6Dq?vMl2ETXt57cXs{{sr#{{uE!#Qp#) z|Nnp~Hv-^kD;hAU_3r^b-~KU7c{2The`DnY{|j(|3T-@pz^}0X0GR;ve_VIk{<`i* z{9_;qCI<4iGyMUh(f)L5(fb1@yp87+O0(kBs87Kn2RS&Ie_j zA-F>E&z|yPCvu-qH8?x0TAfLnCHrQwbc}t>5QJ2ggGXSv-=-<5144>JLN9P^flZ-U zk-S`M7Wg0_Ab26bWRSqR7N`t3@DQ>YNcD5If5Y9F{%4I2_MQ|BLTv2%X!ZC)O*MSu z33f5_Q1Ulf2iv@G;cim149L&cGAohxwJzod8D3KyF6Q@#RSv=s0zGQ*h`lx?I*_Ne zlIifo?)?(en&qqe^h*b%S}ZfGwJhW#X?k|QP)#QI+hhrw(7bHDf50VX*}LTQf#7CU zd8IM0NtZE^VHSJnNR98jXg|FK#N9sgk*OytoRf#QpqR7DX_W^DbRD~)wRjJqQ78`2 ze+iUuEBwSyqEzV0ABD)@ASc0sousRGQOk2KH=l7CtctN9*mdV&I2$;MmW04?C|=-{ zSUtVas(YdncF(5CT$#7^L1`FG6C@>HAAso$$6YO-(qu{T2x&Z4rqFK%h|pLT=1&}C zatV4q&$`r{|P_J>agi5Pn76d)H%0r$%k z<#rx)<1=6Ka>6XiUtsZGe`xbxDJn+gB^c%rL((9&%%Bq75c?0k?N%Il5T;f5>Ag_6 zLy-*T3y(;f-`A)16&;y8I6R(UJi2x^*v>((N{WiZ07++U20h@I9br0toj}TDJbov7 z=ov+V(M8g_h|w$ixx@RT0*8S3AzunlbI~#vd<1$ zala)fFmPJUFz3sx+o?7}o_@Li!eQn?otbK*y*@2W61&2n6vC1Q*=D|tEF{`GlCT#SWOPa z@uQb2@?hA0nn>BMLrBN60rel9;B;*fMj*yLPze! zLG%3eBe2`KW?aMzsn=$(ojXSq4_e7XRDioMk(}ohDmx!ZuLU4Te_LI@x@g|o7V~a9 zXTOwdVR%Tipkc@Al=9i3X!IN;5qgL$gIk;YUS$M4*Z&%<1n(zLspb8BDY%93ExMCBqaRM%~23UWu$2{6@wRi+77^`2R0QogTQ z@Kl|yc|&*3;ay4q4!J{wD*L(_Zz!7?vs7`F_=T?o)19>rQAbt|ToJ~dnt4~2ReLUj zG6qe(xMX_Hm$)bjjI(G#-&J2aweazjm9O*!jkq6vs)#cPVpP*P)$~`EN7sCAaAVve zho<3)*I-h~(sw&5HbsFY19@Is(_VchLD*%lEY_lIzTk=6br)jc;hox*6R4H9nbeqW zTu1CZ@h4y@eLwlSr&mk zAKY5OgqzX={HSYKKJn74x1#h_rJK`j$ zS^wVoTbuF)w}r=j`?kc3Z`7+5G$f|}oJoyxiW;94hwhj_c*9>ghtsH+EiCelnk%<@ z7JqkD0oJBu9QHsMkiWhmMW0eDsz75l!}Fiq@sVGHznz9X8*TAR8zAfaiE^}14k6`j zF0u%I>)`&mG3$Yyxpt;~jp`dQ)5e_}rlLMK`xZUF(%*CcP4TrCm+x0NPF>xOj>HyE>?VHzZNFGqlmQqtf#DcTp> zMaXkFztaG3)w;Z@sG$u>qwtHNF?`Nc9FmC8NMie^E@?Uqu5a<@B8k0?_dGsIQ>aHD9aqP1W*zbkdgebqZ20G~ z*3otfX6+cLk`3&gX!=%C^!ePNVu^FjW@gE7qfQE`8Rj?$$0bv zygzLqjqJl0Re_#$R^B1R5|y>FbGL066ZtocNaqwYuMAj%K{{uehm8JNo@fiNV@beH7gQ$9%KF*JX3%ZyeKv>JNiT!A>&K+U+A zRxMs~QLU|C|C_pVOru@wK~sa9R#zL=>fQ(RAhgNv_`MVK6@!B(kaQ++^dWXfDoWB6 zZrwBef|^matd@|P(|zl1gVObaEw79dUa&qI4aAxPKmqOBIJmMsGzf2af4|BGdHkW3;2|I; zP{ArPz&cW*kB}fMBfWXI*BH(jqUbE{ky<8JbBM8|hLyo2QTD-Fsv#(C+$1x$rKPBk zO4myqHzC@LV$8T=2YjV|*z>P~xQNTIU$ZMc zH0E2`#WmzXEs`(cVwqRX03m5J*xz**r!4t<3)j&-(yTQy({CJH0ED*BlVx`Zdb(#{ z_eJSS<;Nu&vg`flvyc$14@&>5o$1%rGQ6)_>vVtr9{Xi@+X{`l|p$^{j&9F z=O@R?h`*^da=u0Ocv@JF3zJ-owxE!8D#)bCb25yqF^(7owF0lQ0X8V*xaG~9Vx=ZF zuu>Z!e(&T#P>bn7FUL*L>9n~~$5!k8SYJP!o>U~}Z9wh{yrnO>BoVyVb#s2grw4}GU z94T0)C-AI!L_|p?K&C3SnV{o~<7e=|BqkxKqSM0~>m=p78OL+)=)wv@l zTcs;0yAz9${A*9pz;vUwKJGl8^RE%mIQaC%v%4Fyl+SOzU+PlDgs>)ts&G(r(A8d` zKVzjJL{knvfNgT6#;L0JcXfDdnTJ)tF9G}}v5}wxUJ)|S{(c(3Xhi)i28{YX8+I&z zDDPhEy-F#O5<3}+WDI#Y zS_v!~BEN|cC7}#XQ$ReJg!h#r(6hOzyPEO>(Nkl8dyXz}33+N5Um6x|npJyh_8 zWx;s$ylmc|D<|QeM7o=R(}FAF*{<%`z7NH{xpy=U$ExofN|U^2_-x0DYXSoZ<)e94 zqpw{X1Rk&y_lQ$*HW(qUY=U|yL7~Q#a}${htzUd(BaytYwk>1k5b|$8aM75KwL{M( z%K>+YM~}HXA+`c(cBAcT?zW6co#8-wxPUxN5IF(GpOYWptU^2P%hP4^F|w1Wf#+S> zyB?sCJb)(+F1s*ghx7E5-&rG81rc@}}!Rv(Be@`b1O+B^<+{&4wQ z?p$0_)SANsU7(s+?K$``fAG5O<#>n(iJ2?Z@~-1)mTwQwyr*T ze=hIX59@tUpBd&y$vdcc*-Zw@yP4&XbH9Ohsp#4ku*0dbKQCX0&W@Fifl?lnp7H#W zikLqb*{Dxf0T?eKgnQm-3E$+RPAw=^1U3eg5|7CBX_OLh%l_!*4;MA^E`tX~DMS)= zJ=b042TsX-6P*h|T5K>xn`-7v=5iIAiAZV!ijm?}(B9iB#$qI?6gMcT>GM)kwH%t# z@~Kt2_26|;)1JQTI{2gDOIAX6qZZYG-8lNOZ}i2vSqRn6SX9s ziK!G}Nw{Rhh1*a@(3;7_^~t_mokKicxs!uqKfgUqhiN-#+7#GWGLpj9CmhZ8*sn;>`2H<;v*GIzr8Jk#Ly0=TT@x*eKwT5mL*>_Ng`l=5%mwlrU6VC~Zb^l$$1oDOAm^k1Pfo#B zI@>i0q4t7UW(kunI`|A^#fPvY-T8?r7}}_Sg-?+<&POS{=!CtFI(+j_9@N;pSYnd3 zX0&S1AY@I!+owztf}{_|@qI`#ii%{JUrDa|!%_ z5HH(Fk0mySz`Q`IwS*vlMtUN&<&%;EMX_@vtrNaT3pPRpAA!{w#;h3ALR5OSo7ltn zLDzgi=UCt2IP~iXcJN){8bdpBV)TF~QSR^~s6*G=8zFX$1s&fxmo-odiOWy?_9Rc{ zhfj-zdhB^vS#@(^jkL-u-PgEK53Hr!)S7%EV%Kp+YM-V!p8T9$f@<*lt9lmkpfj|A z7WrT^OFD@6!=8n3iT+HzJ(gxo7aiw4*tUcQru zp!8VIRtJMV7+g-y&VXQ4g({<;+7>rh7U_{wxI(%r-{#j^L&zZbAo+KcA6Y$Vo*04$@@GGvuA0Fq8*Nb))z(=ldx>MWGAnYZT`5(QNICt{hi|3VYMb!?{bfsvH6?Cw| z$&+Lv=g8^S>xY<>pX}F32%H-T=;;^E?Tg)%J}eukm}Y!Zk3PjYnA6CB_dBOlJPoUy zH}Ha+Xh=MC`msf1>2S~Ui6lQxM+u2k?le2VS`ho8KTcJMp2zKqDfAq%fI(?i9po2* zu3qn`)}r|QNh3DnmJ0k3RdtfASCuoTxx(p)rlhcSW9U#^K`R(*A^Z6|qCnZ))KASH zqj6n4!R=okC59yCDy6K5jEFPM1eq2kSM{WH8)v`sRRf8vj)_>q6qX{1Fni41S2LT@ zbuS@Wf2+pQct!i+3V!j%X5KRQjRozJnuMktfrD)&lX49;ws4QTzpe#|67-YsM(Gl7 z@@CzAEx&NQ#p;wrr!)2UBB+|S5WxC`ggxih8MOtJV%DR6awIX#8`S*1N@-A#&XTO} z8C?eFrXRh?dsyf$+`E|h6YLrK=m++HLiOHm;yLW8Qq7jpK5pP{*2vv7c>q0s96Ibe z3mT9ET0z)l^{00tK8Ns~{HCc%0&QM3BzJ9SXsjIY1&-N_+349krKvq+f{Sgfg<>}u zdZrPR=bEiYvpOGM3I#UCfc{U#^Jh_UFU5V3oZDzRM#3s+Jk6XuHI2M@YU!CS)%`PE z-Z5C`X`#Y9dRFJae{%rk-aoo(jlr6ziAEr!oL*!Fot8@~na=-Um3Eijq};em>0@MXk*U6X@43WY%xhE@={0B&oBY@g9NYow-=77op_uu4x=* z&zsXnp5Ah%vW@4o>#lHPguo%|Rud+{NUy4ig5|pM+ZOBsXNlQUB}3m({=5Ce=CmOw z0wT|Z4?-cZo*6DmMpU~_fX&67guJ=d`etB1QO1!O8Kn_v+}R#ia?NJnxa#Oj$l9+j z2ootq*MLyaWKNCpNHNRd_zQUE)FvaYvp)Uz>@L*Ap&9p0%L5RU+(A>Lg+7(3|8cxYjr({ks-KKh}dVyO^y4B$eR#Pfn#Jtz*9nQ`lq&a;VP%7WaY4A z&+2g!ulTM`>l@2;wP9|PK&+5&Fo}0s)&qIRML9HRyzo}VxqFR81|FZ7*v;2LXva2v z2q7x;<6cS>c7&OH=g>ZL0R0NOVsKb>3$XhXxB0SESFEO_r9OmkbA2fz{>j&_a?0SD zE&A0+O_pSolst3RpimZjoa@kX0+DZq(kD<;Tg-q#xtY1hG1FI`#2u#+96LrcTmsY_ zrMPC6q1S_K5|B-AZJr&ElHFrVq=_BFeqNm7ImH)J`t(Zrw{9K@uhN4-hk(E!`CB)G zwHO&dtM;=Z7=r2fjl0eEX;{pVIy$m4P;+{e20CQo>XiBQ5-n4*DLn{0}sMKi;IOMnjfN2Ci?GH zG*GKipET$0UV9C;n{U%ssu=i=d&ae2=W0cuW+8+;O04;qvFbIk!bTex?n;^PBR_ot zb?(1>^|sDj+82$LGdvrTu@n5UDUR91INqlWzIa0HGdUE-t-_p(73zOeo@D^5GvJ=* z%A5}pq#Ba;JTG}Eq$I=zgnkhrx_4VMO=-)v-G)p$?m+!a9~MS0FYs}^A6sUUEIEj^ z&52t7YDN=UL()VO0F3;i{JoPrB*Zx!l#7LOKR9qC5&RBEwzSE7%r?ND^ph1fispeTB z$f2YLzvWKXen``(Zu z4B(ee@q%B`&L=&}Yha;?O$R@b<>e`N^Fz-gPxn_(ldZiKO+$&Q?^NpP{G`}g#OCdv&ZN+9poPc9Q zx#*i^vl$r@L0-E>i<)ITQIexYcKT(@xUzoZd`C~kUa zuq3clzYqfKoZC!vlV(kpoX>Os#8?|{R*7P*nc0Ryu55kKD>CG`uBPaPf#{Dv18L}v z080&&I++U(&GuzS;3zt-aW=VlKaqhC2;(b^75a-!pz)zJ*C;KXr$M*J5&96P%f9x7lpGHg?bDlMdd|gbNLPzGM@v852fvqK-hek?K}1)xfIRMf8BH zE~FJuN3~LdbT*!?XdsQtH0i)yN@`&)f%j}EIwd}lmq}SY+ZczQ8@5)A*{VX*g_;l> zQE<{oe?wSdK%w?%q18F?*NC0HoKUcZ^jMxhNXs*+-KP8yyckNKjy!{FkYPzcw51YChH0a9JV+nuQQWhuuH0qC*q^IEt^9ZW7s1{Bj9#pQsvH7>dk(#Dv7 z^;aB{c7xG}Kl&TPve$|x_E86YRE{HW$khRLKv|cuiO@D}!;Oq|CVt_`EwS2YKdr5u zf-aa;u9G1YpB7?QpBWurdCiOSpUS>O*mh#GA4vIj;X zsWn?a_Ckr@8hwg!0-EK&u+=OXg#zh>NqUlTe7~bIFiZnyu`;MTqpCc=VjzX$m#iI4b`F^y7Cx?oOFda(1ITLEZX*|)P1oxuN}b_asCWeQreEIc&Wpk1=kl_ zK1iKo%f@sBfXyNFcCoOGtb&e=mbtmiOCv)Xzzc$~%H^&XU*V$qGmfz775{>f;Zv^N z8Rg{^Y@<2msa#qN=AsMS?#)91<$2YfZ%W`xcaWWe4+rw{Bhj;Bj|1L{JxKHF$*b`e z+!;>*+AFddH=9*_)*djt)Krz|Vk;TI@}f!oqc-g(^sKO@TxXt^gbke6Zg*NRWTjW* zA3^ty{r*4v5|U!725pS+Y}K`>TT#vZr#G zeyMx8NycO>dv$~qxbwwAASZ#vnWYY3boktJ3uTz$aBfip_o`Cj)lJ-@y_(*gl zS_A+-Qlu?DWlFZj#hl*_P}0t=*i%yG@&;3KV&PCZJoQM_0vk!@qh&%hS#sgJmgpN9 zOje)69ddZpf5p*E&i_nFoc0SCx*auVkP$?-;!-NF_ZxII&>Qx~5a-)lU(27(&2NiG>_O4U^;-o#aU^-d0Ol&TD7FAv(UpLd-D=K_&=J@FuE zC4&WuZz`dXswk;1G;-7ll>yf7774*#fc8qX3DDN{uSP5nwj+BLK}Z2i z%}bpKhMFI$@M~c(Xsy;Hd7(&EHQKRKpGg?uI#nl{vfFImcM&Cpqho?Q# z)R_0G$n#f>7f?w7$W6Qo(hQ{n$>)zN9kT^c(}eVWjao*MEYJGpc_8xAggYJ)ILH)L zlu)#md}$A8&{HbW4Ra?z-zDzPPgz0RE$}4xX_?!RybI9#J(kC}Z+QH8Lys3r=`q5n zKC!LQ`jj@wyEb@w+G>5O>M8ivbu4YCPaE7+a5)Ko3CgNVRpwIph)@~ZZQrdY%Q2v@{yBwVpU-#Y*!zL92j5&c~?3yp1kf0g~@4&Y#Pjz9rG?u+tOH zI;ZRZPzCV}y^*5((qAeg{YdROyqR}9C|=D_@kp^2aPweoia$Do{N9VF`e2Q;skj|V z>|w%$?d0F=4%Zb&?N9t5h6HLQ*4;DN`nmI@%&CWS@?&7r;m_07HG}0sutrd9$`g@uTp#AyC;&1^dI>QLe@&VMPfZa8=QG=X35>v(k zr%@2$oKyT0>bcN28_&%i@{>=%b=LJ^GlHaC2|Y%7ec;J}JuZsUYca;YxE+8>-K2U* zVMQS|U;9=$x1C#gG-(0T8>2KG5)mYl2~h7NZjrk_u>a)-4uqAFxm?USq3p@(MUyv0 zSG2%a>m_jlGth`jpW`&V!Tv3gu!3*L;r5XrAXf1H?JXMfZF#}|I|T-otk;Aj2WQm_ zKp8`V{UM3K_x1EprI26}C_1ow0|w0BgJEE!23#mesCUK z5Z|MKU6z2sY^aYi&092iiLM-bJg~KXGPH^xlgBR`2>7i*5~e z>hgbYwAudaJ$D0wMY{jS2DttMncZUVBEbU;8O{x!`1+pwZVa$!&)?W4?|<+z5F@@1 z16==)-TVDxtf83yjI_Ofjc=fLC5XP?}8O9(a-!YqB8!at+D_YT+#pcX3Kg11sLGf4j`Cn;BP#B(K~d0Z{U{v b%O!U$ef%H-8Z!hlL?I>w1WwuCzxjUv+~`jN diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties old mode 100755 new mode 100644 index a3ba20ec52..642d572ce9 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1 +1,2 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.1/apache-maven-3.6.1-bin.zip +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/mvnw b/mvnw index 4e574d9a02..41c0f0c23d 100755 --- a/mvnw +++ b/mvnw @@ -8,7 +8,7 @@ # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # -# https://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an @@ -19,7 +19,7 @@ # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script +# Maven Start Up Batch script # # Required ENV vars: # ------------------ @@ -114,7 +114,6 @@ if $mingw ; then M2_HOME="`(cd "$M2_HOME"; pwd)`" [ -n "$JAVA_HOME" ] && JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? fi if [ -z "$JAVA_HOME" ]; then @@ -200,6 +199,85 @@ if [ -z "$BASE_DIR" ]; then exit 1; fi +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} if [ "$MVNW_VERBOSE" = true ]; then echo $MAVEN_PROJECTBASEDIR @@ -218,6 +296,11 @@ if $cygwin; then MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` fi +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain exec "$JAVACMD" \ diff --git a/mvnw.cmd b/mvnw.cmd old mode 100755 new mode 100644 index 23ab056e29..86115719e5 --- a/mvnw.cmd +++ b/mvnw.cmd @@ -1,145 +1,182 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM https://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" - -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% From 5fcb48440552831696c1f8f721ec698697d3d2fd Mon Sep 17 00:00:00 2001 From: dcorbacho Date: Mon, 13 Jul 2020 12:00:04 +0100 Subject: [PATCH 218/328] Switch to Mozilla Public License 2.0 (MPL 2.0) (cherry picked from commit 0646231ff9d2022ba24cd1a5f2243fa71bbac39b) Conflicts: README.md --- LICENSE | 2 +- LICENSE-MPL-RabbitMQ | 840 ++++++++---------- README.md | 4 +- codegen.py | 4 +- .../java/com/rabbitmq/client/Address.java | 2 +- .../com/rabbitmq/client/AddressResolver.java | 2 +- .../client/AlreadyClosedException.java | 2 +- .../AuthenticationFailureException.java | 2 +- .../com/rabbitmq/client/BasicProperties.java | 2 +- .../com/rabbitmq/client/BlockedCallback.java | 2 +- .../com/rabbitmq/client/BlockedListener.java | 2 +- .../com/rabbitmq/client/CancelCallback.java | 2 +- .../java/com/rabbitmq/client/Channel.java | 2 +- .../java/com/rabbitmq/client/Command.java | 2 +- .../com/rabbitmq/client/ConfirmCallback.java | 2 +- .../com/rabbitmq/client/ConfirmListener.java | 2 +- .../java/com/rabbitmq/client/Connection.java | 2 +- .../rabbitmq/client/ConnectionFactory.java | 2 +- .../client/ConnectionFactoryConfigurator.java | 2 +- .../java/com/rabbitmq/client/Consumer.java | 2 +- .../client/ConsumerCancelledException.java | 2 +- .../ConsumerShutdownSignalCallback.java | 2 +- .../com/rabbitmq/client/ContentHeader.java | 2 +- .../com/rabbitmq/client/DefaultConsumer.java | 2 +- .../rabbitmq/client/DefaultSaslConfig.java | 2 +- .../DefaultSocketChannelConfigurator.java | 2 +- .../client/DefaultSocketConfigurator.java | 2 +- .../com/rabbitmq/client/DeliverCallback.java | 2 +- .../java/com/rabbitmq/client/Delivery.java | 2 +- .../client/DnsRecordIpAddressResolver.java | 2 +- .../client/DnsSrvRecordAddressResolver.java | 2 +- .../java/com/rabbitmq/client/Envelope.java | 2 +- .../com/rabbitmq/client/ExceptionHandler.java | 2 +- .../java/com/rabbitmq/client/GetResponse.java | 2 +- .../com/rabbitmq/client/JDKSaslConfig.java | 2 +- .../rabbitmq/client/ListAddressResolver.java | 2 +- .../java/com/rabbitmq/client/LongString.java | 2 +- .../client/MalformedFrameException.java | 2 +- .../com/rabbitmq/client/MapRpcServer.java | 2 +- .../rabbitmq/client/MessageProperties.java | 2 +- src/main/java/com/rabbitmq/client/Method.java | 2 +- .../com/rabbitmq/client/MetricsCollector.java | 2 +- .../client/MissedHeartbeatException.java | 2 +- .../rabbitmq/client/NoOpMetricsCollector.java | 2 +- ...ossibleAuthenticationFailureException.java | 2 +- .../ProtocolVersionMismatchException.java | 2 +- .../java/com/rabbitmq/client/Recoverable.java | 2 +- .../rabbitmq/client/RecoveryDelayHandler.java | 2 +- .../com/rabbitmq/client/RecoveryListener.java | 2 +- src/main/java/com/rabbitmq/client/Return.java | 2 +- .../com/rabbitmq/client/ReturnCallback.java | 2 +- .../com/rabbitmq/client/ReturnListener.java | 2 +- .../java/com/rabbitmq/client/RpcClient.java | 2 +- .../com/rabbitmq/client/RpcClientParams.java | 2 +- .../java/com/rabbitmq/client/RpcServer.java | 2 +- .../java/com/rabbitmq/client/SaslConfig.java | 2 +- .../com/rabbitmq/client/SaslMechanism.java | 2 +- .../com/rabbitmq/client/ShutdownListener.java | 2 +- .../com/rabbitmq/client/ShutdownNotifier.java | 2 +- .../client/ShutdownSignalException.java | 2 +- .../client/SocketChannelConfigurator.java | 2 +- .../client/SocketChannelConfigurators.java | 2 +- .../rabbitmq/client/SocketConfigurator.java | 2 +- .../rabbitmq/client/SocketConfigurators.java | 2 +- .../rabbitmq/client/SslContextFactory.java | 2 +- .../client/SslEngineConfigurator.java | 2 +- .../client/SslEngineConfigurators.java | 2 +- .../com/rabbitmq/client/StringRpcServer.java | 2 +- .../client/TopologyRecoveryException.java | 2 +- .../client/TrustEverythingTrustManager.java | 2 +- .../rabbitmq/client/UnblockedCallback.java | 2 +- .../rabbitmq/client/UnexpectedFrameError.java | 2 +- .../client/UnexpectedMethodError.java | 2 +- .../client/UnknownClassOrMethodId.java | 2 +- .../client/UnroutableRpcRequestException.java | 2 +- .../client/impl/AMQBasicProperties.java | 2 +- .../com/rabbitmq/client/impl/AMQChannel.java | 2 +- .../com/rabbitmq/client/impl/AMQCommand.java | 2 +- .../rabbitmq/client/impl/AMQConnection.java | 2 +- .../client/impl/AMQContentHeader.java | 2 +- .../client/impl/AbstractMetricsCollector.java | 2 +- .../rabbitmq/client/impl/CRDemoMechanism.java | 2 +- .../rabbitmq/client/impl/ChannelManager.java | 2 +- .../com/rabbitmq/client/impl/ChannelN.java | 2 +- .../rabbitmq/client/impl/ClientVersion.java | 2 +- .../client/impl/CommandAssembler.java | 2 +- .../impl/CompletableFutureRpcWrapper.java | 2 +- .../client/impl/ConnectionParams.java | 2 +- .../client/impl/ConsumerDispatcher.java | 2 +- .../client/impl/ConsumerWorkService.java | 2 +- .../impl/ContentHeaderPropertyReader.java | 2 +- .../impl/ContentHeaderPropertyWriter.java | 2 +- .../client/impl/CredentialsProvider.java | 4 +- .../impl/CredentialsRefreshService.java | 2 +- .../impl/DefaultCredentialsProvider.java | 2 +- .../DefaultCredentialsRefreshService.java | 2 +- .../client/impl/DefaultExceptionHandler.java | 2 +- .../com/rabbitmq/client/impl/Environment.java | 2 +- .../client/impl/ErrorOnWriteListener.java | 2 +- .../client/impl/ExternalMechanism.java | 2 +- .../impl/ForgivingExceptionHandler.java | 2 +- .../java/com/rabbitmq/client/impl/Frame.java | 2 +- .../rabbitmq/client/impl/FrameHandler.java | 2 +- .../rabbitmq/client/impl/HeartbeatSender.java | 2 +- .../client/impl/LongStringHelper.java | 2 +- .../java/com/rabbitmq/client/impl/Method.java | 2 +- .../client/impl/MethodArgumentReader.java | 2 +- .../client/impl/MethodArgumentWriter.java | 2 +- .../impl/MicrometerMetricsCollector.java | 2 +- .../client/impl/NetworkConnection.java | 2 +- ...ntCredentialsGrantCredentialsProvider.java | 2 +- .../impl/OAuthTokenManagementException.java | 2 +- .../rabbitmq/client/impl/PlainMechanism.java | 2 +- .../RefreshProtectedCredentialsProvider.java | 2 +- .../impl/RpcContinuationRpcWrapper.java | 2 +- .../com/rabbitmq/client/impl/RpcWrapper.java | 2 +- .../com/rabbitmq/client/impl/SetQueue.java | 2 +- .../impl/ShutdownNotifierComponent.java | 2 +- .../client/impl/SocketFrameHandler.java | 2 +- .../impl/SocketFrameHandlerFactory.java | 2 +- .../client/impl/StandardMetricsCollector.java | 2 +- .../client/impl/StrictExceptionHandler.java | 2 +- .../com/rabbitmq/client/impl/TlsUtils.java | 2 +- .../client/impl/TruncatedInputStream.java | 2 +- .../client/impl/UnknownChannelException.java | 2 +- .../client/impl/UpdateSecretExtension.java | 2 +- .../com/rabbitmq/client/impl/ValueReader.java | 2 +- .../com/rabbitmq/client/impl/ValueWriter.java | 2 +- .../impl/VariableLinkedBlockingQueue.java | 2 +- .../com/rabbitmq/client/impl/Version.java | 2 +- .../com/rabbitmq/client/impl/WorkPool.java | 2 +- .../client/impl/WorkPoolFullException.java | 2 +- .../impl/nio/ByteBufferOutputStream.java | 2 +- .../client/impl/nio/FrameBuilder.java | 2 +- .../client/impl/nio/FrameWriteRequest.java | 2 +- .../client/impl/nio/HeaderWriteRequest.java | 2 +- .../rabbitmq/client/impl/nio/NioHelper.java | 2 +- .../com/rabbitmq/client/impl/nio/NioLoop.java | 2 +- .../client/impl/nio/NioLoopContext.java | 2 +- .../rabbitmq/client/impl/nio/NioParams.java | 2 +- .../client/impl/nio/SelectorHolder.java | 2 +- .../impl/nio/SocketChannelFrameHandler.java | 2 +- .../nio/SocketChannelFrameHandlerFactory.java | 2 +- .../nio/SocketChannelFrameHandlerState.java | 2 +- .../impl/nio/SocketChannelRegistration.java | 2 +- .../nio/SslEngineByteBufferOutputStream.java | 2 +- .../impl/nio/SslEngineFrameBuilder.java | 2 +- .../client/impl/nio/SslEngineHelper.java | 2 +- .../client/impl/nio/WriteRequest.java | 2 +- .../impl/recovery/AutorecoveringChannel.java | 2 +- .../recovery/AutorecoveringConnection.java | 2 +- .../client/impl/recovery/BackoffPolicy.java | 2 +- .../recovery/ConsumerRecoveryListener.java | 2 +- .../impl/recovery/DefaultRetryHandler.java | 2 +- .../impl/recovery/QueueRecoveryListener.java | 2 +- .../client/impl/recovery/RecordedBinding.java | 2 +- .../impl/recovery/RecordedConsumer.java | 2 +- .../client/impl/recovery/RecordedEntity.java | 2 +- .../impl/recovery/RecordedExchange.java | 2 +- .../recovery/RecordedExchangeBinding.java | 2 +- .../impl/recovery/RecordedNamedEntity.java | 2 +- .../client/impl/recovery/RecordedQueue.java | 2 +- .../impl/recovery/RecordedQueueBinding.java | 2 +- .../recovery/RecoveryAwareAMQConnection.java | 2 +- .../RecoveryAwareAMQConnectionFactory.java | 2 +- .../recovery/RecoveryAwareChannelManager.java | 2 +- .../impl/recovery/RecoveryAwareChannelN.java | 2 +- .../recovery/RecoveryCanBeginListener.java | 2 +- .../client/impl/recovery/RetryContext.java | 2 +- .../client/impl/recovery/RetryHandler.java | 2 +- .../client/impl/recovery/RetryResult.java | 2 +- .../impl/recovery/TopologyRecoveryFilter.java | 2 +- .../TopologyRecoveryRetryHandlerBuilder.java | 2 +- .../recovery/TopologyRecoveryRetryLogic.java | 2 +- .../com/rabbitmq/tools/json/JSONUtil.java | 2 +- .../tools/jsonrpc/JacksonJsonRpcMapper.java | 2 +- .../rabbitmq/tools/jsonrpc/JsonRpcClient.java | 2 +- .../tools/jsonrpc/JsonRpcException.java | 2 +- .../rabbitmq/tools/jsonrpc/JsonRpcMapper.java | 2 +- .../jsonrpc/JsonRpcMappingException.java | 2 +- .../rabbitmq/tools/jsonrpc/JsonRpcServer.java | 2 +- .../tools/jsonrpc/ParameterDescription.java | 2 +- .../tools/jsonrpc/ProcedureDescription.java | 2 +- .../tools/jsonrpc/ServiceDescription.java | 2 +- .../com/rabbitmq/utility/BlockingCell.java | 2 +- .../utility/BlockingValueOrException.java | 2 +- .../com/rabbitmq/utility/IntAllocator.java | 2 +- .../com/rabbitmq/utility/SensibleClone.java | 2 +- .../java/com/rabbitmq/utility/Utility.java | 2 +- .../rabbitmq/utility/ValueOrException.java | 2 +- .../rabbitmq/client/AbstractJsonRpcTest.java | 2 +- .../rabbitmq/client/JacksonJsonRpcTest.java | 2 +- .../com/rabbitmq/client/QueueingConsumer.java | 2 +- .../AMQConnectionRefreshCredentialsTest.java | 2 +- .../DefaultCredentialsRefreshServiceTest.java | 2 +- ...edentialsGrantCredentialsProviderTest.java | 2 +- ...freshProtectedCredentialsProviderTest.java | 2 +- .../rabbitmq/client/impl/ValueWriterTest.java | 2 +- .../rabbitmq/client/impl/WorkPoolTests.java | 2 +- .../client/test/AMQBuilderApiTest.java | 2 +- .../rabbitmq/client/test/AMQChannelTest.java | 2 +- .../client/test/AMQConnectionTest.java | 2 +- .../client/test/AbstractRMQTestSuite.java | 2 +- .../com/rabbitmq/client/test/AddressTest.java | 2 +- .../com/rabbitmq/client/test/AmqpUriTest.java | 2 +- .../client/test/BlockingCellTest.java | 2 +- .../client/test/BrokenFramesTest.java | 2 +- .../rabbitmq/client/test/BrokerTestCase.java | 2 +- .../rabbitmq/client/test/Bug20004Test.java | 2 +- .../ChannelAsyncCompletableFutureTest.java | 2 +- .../rabbitmq/client/test/ChannelNTest.java | 2 +- .../test/ChannelNumberAllocationTests.java | 2 +- .../ChannelRpcTimeoutIntegrationTest.java | 2 +- .../com/rabbitmq/client/test/ClientTests.java | 2 +- .../client/test/ClientVersionTest.java | 2 +- .../client/test/ClonePropertiesTest.java | 2 +- .../rabbitmq/client/test/CloseInMainLoop.java | 2 +- .../com/rabbitmq/client/test/ConfirmBase.java | 2 +- .../client/test/ConnectionFactoryTest.java | 2 +- .../rabbitmq/client/test/ConnectionTest.java | 2 +- .../client/test/DefaultRetryHandlerTest.java | 2 +- .../test/DnsSrvRecordAddressResolverTest.java | 2 +- .../client/test/FrameBuilderTest.java | 2 +- .../client/test/GeneratedClassesTest.java | 2 +- .../client/test/LambdaCallbackTest.java | 2 +- .../rabbitmq/client/test/LongStringTest.java | 2 +- .../client/test/MetricsCollectorTest.java | 2 +- .../test/MicrometerMetricsCollectorTest.java | 2 +- .../client/test/MultiThreadedChannel.java | 2 +- .../test/NioDeadlockOnConnectionClosing.java | 2 +- ...NoAutoRecoveryWhenTcpWindowIsFullTest.java | 2 +- .../test/PropertyFileInitialisationTest.java | 2 +- .../client/test/QueueingConsumerTests.java | 2 +- ...RecoveryAwareAMQConnectionFactoryTest.java | 2 +- .../client/test/RecoveryDelayHandlerTest.java | 2 +- .../client/test/RefreshCredentialsTest.java | 2 +- .../com/rabbitmq/client/test/RpcTest.java | 2 +- .../client/test/RpcTopologyRecordingTest.java | 2 +- .../client/test/SharedThreadPoolTest.java | 2 +- .../client/test/SslContextFactoryTest.java | 2 +- .../test/StrictExceptionHandlerTest.java | 2 +- .../com/rabbitmq/client/test/TableTest.java | 2 +- .../com/rabbitmq/client/test/TestUtils.java | 2 +- .../rabbitmq/client/test/TestUtilsTest.java | 2 +- .../rabbitmq/client/test/TlsUtilsTest.java | 2 +- .../client/test/TrafficListenerTest.java | 2 +- .../client/test/TruncatedInputStreamTest.java | 2 +- .../client/test/ValueOrExceptionTest.java | 2 +- .../test/functional/AbstractRejectTest.java | 2 +- .../test/functional/AlternateExchange.java | 2 +- .../client/test/functional/BasicGet.java | 2 +- .../test/functional/BindingLifecycle.java | 2 +- .../test/functional/BindingLifecycleBase.java | 2 +- .../client/test/functional/CcRoutes.java | 2 +- .../test/functional/ClusteredTestBase.java | 2 +- .../client/test/functional/Confirm.java | 2 +- .../test/functional/ConnectionOpen.java | 2 +- .../test/functional/ConnectionRecovery.java | 2 +- .../ConsumerCancelNotification.java | 2 +- .../client/test/functional/ConsumerCount.java | 2 +- .../test/functional/ConsumerPriorities.java | 2 +- .../test/functional/DeadLetterExchange.java | 2 +- .../test/functional/DefaultExchange.java | 2 +- .../client/test/functional/DirectReplyTo.java | 2 +- .../test/functional/DoubleDeletion.java | 2 +- .../test/functional/DurableOnTransient.java | 2 +- .../test/functional/ExceptionHandling.java | 2 +- .../test/functional/ExceptionMessages.java | 2 +- .../test/functional/ExchangeDeclare.java | 2 +- .../functional/ExchangeDeleteIfUnused.java | 2 +- .../functional/ExchangeDeletePredeclared.java | 2 +- .../functional/ExchangeEquivalenceBase.java | 2 +- .../functional/ExchangeExchangeBindings.java | 2 +- .../ExchangeExchangeBindingsAutoDelete.java | 2 +- .../client/test/functional/FrameMax.java | 2 +- .../test/functional/FunctionalTests.java | 2 +- .../functional/HeadersExchangeValidation.java | 2 +- .../client/test/functional/Heartbeat.java | 2 +- .../test/functional/InternalExchange.java | 2 +- .../client/test/functional/InvalidAcks.java | 2 +- .../test/functional/InvalidAcksBase.java | 2 +- .../client/test/functional/InvalidAcksTx.java | 2 +- .../client/test/functional/MessageCount.java | 2 +- .../client/test/functional/Metrics.java | 2 +- .../rabbitmq/client/test/functional/Nack.java | 2 +- .../test/functional/NoRequeueOnCancel.java | 2 +- .../client/test/functional/Nowait.java | 2 +- .../test/functional/PerConsumerPrefetch.java | 2 +- .../client/test/functional/PerMessageTTL.java | 2 +- .../client/test/functional/PerQueueTTL.java | 2 +- .../functional/PerQueueVsPerMessageTTL.java | 2 +- .../client/test/functional/Policies.java | 2 +- .../client/test/functional/QosTests.java | 2 +- .../test/functional/QueueExclusivity.java | 2 +- .../client/test/functional/QueueLease.java | 2 +- .../test/functional/QueueLifecycle.java | 2 +- .../test/functional/QueueSizeLimit.java | 2 +- .../client/test/functional/Recover.java | 2 +- .../client/test/functional/Reject.java | 2 +- .../functional/RequeueOnChannelClose.java | 2 +- .../test/functional/RequeueOnClose.java | 2 +- .../functional/RequeueOnConnectionClose.java | 2 +- .../client/test/functional/Routing.java | 2 +- .../test/functional/SaslMechanisms.java | 2 +- .../client/test/functional/TTLHandling.java | 2 +- .../client/test/functional/Tables.java | 2 +- .../functional/TopologyRecoveryFiltering.java | 2 +- .../functional/TopologyRecoveryRetry.java | 2 +- .../client/test/functional/Transactions.java | 2 +- .../functional/UnbindAutoDeleteExchange.java | 2 +- .../test/functional/UnexpectedFrames.java | 2 +- .../client/test/functional/UserIDHeader.java | 2 +- .../client/test/server/AbsentQueue.java | 2 +- .../server/AlternateExchangeEquivalence.java | 2 +- .../client/test/server/BlockedConnection.java | 2 +- .../client/test/server/Bug19219Test.java | 2 +- .../test/server/ChannelLimitNegotiation.java | 2 +- .../server/DeadLetterExchangeDurable.java | 2 +- .../test/server/DurableBindingLifecycle.java | 2 +- .../server/EffectVisibilityCrossNodeTest.java | 2 +- .../test/server/ExclusiveQueueDurability.java | 2 +- .../rabbitmq/client/test/server/Firehose.java | 2 +- .../rabbitmq/client/test/server/HATests.java | 2 +- .../client/test/server/LoopbackUsers.java | 2 +- .../client/test/server/MemoryAlarms.java | 2 +- .../client/test/server/MessageRecovery.java | 2 +- .../client/test/server/Permissions.java | 2 +- .../test/server/PersistenceGuarantees.java | 2 +- .../client/test/server/PriorityQueues.java | 2 +- .../client/test/server/ServerTests.java | 2 +- .../rabbitmq/client/test/server/Shutdown.java | 2 +- .../client/test/server/TopicPermissions.java | 2 +- .../test/server/XDeathHeaderGrowth.java | 2 +- .../test/ssl/BadVerifiedConnection.java | 2 +- .../ConnectionFactoryDefaultTlsVersion.java | 2 +- .../client/test/ssl/HostnameVerification.java | 2 +- .../test/ssl/NioTlsUnverifiedConnection.java | 2 +- .../rabbitmq/client/test/ssl/SSLTests.java | 2 +- .../client/test/ssl/TlsConnectionLogging.java | 2 +- .../client/test/ssl/UnverifiedConnection.java | 2 +- .../client/test/ssl/VerifiedConnection.java | 2 +- src/test/java/com/rabbitmq/tools/Host.java | 2 +- .../rabbitmq/utility/IntAllocatorTests.java | 2 +- 343 files changed, 718 insertions(+), 812 deletions(-) diff --git a/LICENSE b/LICENSE index dc3c875662..53599f221a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ This package, the RabbitMQ Java client library, is triple-licensed under -the Mozilla Public License 1.1 ("MPL"), the GNU General Public License +the Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, please see LICENSE-APACHE2. diff --git a/LICENSE-MPL-RabbitMQ b/LICENSE-MPL-RabbitMQ index 50770c2540..14e2f777f6 100644 --- a/LICENSE-MPL-RabbitMQ +++ b/LICENSE-MPL-RabbitMQ @@ -1,467 +1,373 @@ - MOZILLA PUBLIC LICENSE - Version 1.1 - - --------------- - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the - Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to - the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Code, prior Modifications used by a Contributor, and the Modifications - made by that particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the - combination of the Original Code and Modifications, in each case - including portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally - accepted in the software development community for the electronic - transfer of data. - - 1.5. "Executable" means Covered Code in any form other than Source - Code. - - 1.6. "Initial Developer" means the individual or entity identified - as the Initial Developer in the Source Code notice required by Exhibit - A. - - 1.7. "Larger Work" means a work which combines Covered Code or - portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the - substance or structure of either the Original Code or any previous - Modifications. When Covered Code is released as a series of files, a - Modification is: - A. Any addition to or deletion from the contents of a file - containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or - previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code - which is described in the Source Code notice required by Exhibit A as - Original Code, and which, at the time of its release under this - License is not already Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for - making modifications to it, including all modules it contains, plus - any associated interface definition files, scripts used to control - compilation and installation of an Executable, or source code - differential comparisons against either the Original Code or another - well known, available Covered Code of the Contributor's choice. The - Source Code can be in a compressed or archival form, provided the - appropriate decompression or de-archiving software is widely available - for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, this - License or a future version of this License issued under Section 6.1. - For legal entities, "You" includes any entity which controls, is - controlled by, or is under common control with You. For purposes of - this definition, "control" means (a) the power, direct or indirect, - to cause the direction or management of such entity, whether by - contract or otherwise, or (b) ownership of more than fifty percent - (50%) of the outstanding shares or beneficial ownership of such - entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, - non-exclusive license, subject to third party intellectual property - claims: - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Code (or portions thereof) with or without Modifications, and/or - as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or - selling of Original Code, to make, have made, use, practice, - sell, and offer for sale, and/or otherwise dispose of the - Original Code (or portions thereof). - - (c) the licenses granted in this Section 2.1(a) and (b) are - effective on the date Initial Developer first distributes - Original Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: 1) for code that You delete from the Original Code; 2) - separate from the Original Code; or 3) for infringements caused - by: i) the modification of the Original Code or ii) the - combination of the Original Code with other software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor - hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor, to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof) either on an - unmodified basis, with other Modifications, as Covered Code - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or - selling of Modifications made by that Contributor either alone - and/or in combination with its Contributor Version (or portions - of such combination), to make, use, sell, offer for sale, have - made, and/or otherwise dispose of: 1) Modifications made by that - Contributor (or portions thereof); and 2) the combination of - Modifications made by that Contributor with its Contributor - Version (or portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are - effective on the date Contributor first makes Commercial Use of - the Covered Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: 1) for any code that Contributor has deleted from the - Contributor Version; 2) separate from the Contributor Version; - 3) for infringements caused by: i) third party modifications of - Contributor Version or ii) the combination of Modifications made - by that Contributor with other software (except as part of the - Contributor Version) or other devices; or 4) under Patent Claims - infringed by Covered Code in the absence of Modifications made by - that Contributor. - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are - governed by the terms of this License, including without limitation - Section 2.2. The Source Code version of Covered Code may be - distributed only under the terms of this License or a future version - of this License released under Section 6.1, and You must include a - copy of this License with every copy of the Source Code You - distribute. You may not offer or impose any terms on any Source Code - version that alters or restricts the applicable version of this - License or the recipients' rights hereunder. However, You may include - an additional document offering the additional rights described in - Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be - made available in Source Code form under the terms of this License - either on the same media as an Executable version or via an accepted - Electronic Distribution Mechanism to anyone to whom you made an - Executable version available; and if made available via Electronic - Distribution Mechanism, must remain available for at least twelve (12) - months after the date it initially became available, or at least six - (6) months after a subsequent version of that particular Modification - has been made available to such recipients. You are responsible for - ensuring that the Source Code version remains available even if the - Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a - file documenting the changes You made to create that Covered Code and - the date of any change. You must include a prominent statement that - the Modification is derived, directly or indirectly, from Original - Code provided by the Initial Developer and including the name of the - Initial Developer in (a) the Source Code, and (b) in any notice in an - Executable version or related documentation in which You describe the - origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's - intellectual property rights is required to exercise the rights - granted by such Contributor under Sections 2.1 or 2.2, - Contributor must include a text file with the Source Code - distribution titled "LEGAL" which describes the claim and the - party making the claim in sufficient detail that a recipient will - know whom to contact. If Contributor obtains such knowledge after - the Modification is made available as described in Section 3.2, - Contributor shall promptly modify the LEGAL file in all copies - Contributor makes available thereafter and shall take other steps - (such as notifying appropriate mailing lists or newsgroups) - reasonably calculated to inform those who received the Covered - Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming - interface and Contributor has knowledge of patent licenses which - are reasonably necessary to implement that API, Contributor must - also include this information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to - Section 3.4(a) above, Contributor believes that Contributor's - Modifications are Contributor's original creation(s) and/or - Contributor has sufficient rights to grant the rights conveyed by - this License. - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source - Code. If it is not possible to put such notice in a particular Source - Code file due to its structure, then You must include such notice in a - location (such as a relevant directory) where a user would be likely - to look for such a notice. If You created one or more Modification(s) - You may add your name as a Contributor to the notice described in - Exhibit A. You must also duplicate this License in any documentation - for the Source Code where You describe recipients' rights or ownership - rights relating to Covered Code. You may choose to offer, and to - charge a fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Code. However, You - may do so only on Your own behalf, and not on behalf of the Initial - Developer or any Contributor. You must make it absolutely clear than - any such warranty, support, indemnity or liability obligation is - offered by You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred by the - Initial Developer or such Contributor as a result of warranty, - support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the - requirements of Section 3.1-3.5 have been met for that Covered Code, - and if You include a notice stating that the Source Code version of - the Covered Code is available under the terms of this License, - including a description of how and where You have fulfilled the - obligations of Section 3.2. The notice must be conspicuously included - in any notice in an Executable version, related documentation or - collateral in which You describe recipients' rights relating to the - Covered Code. You may distribute the Executable version of Covered - Code or ownership rights under a license of Your choice, which may - contain terms different from this License, provided that You are in - compliance with the terms of this License and that the license for the - Executable version does not attempt to limit or alter the recipient's - rights in the Source Code version from the rights set forth in this - License. If You distribute the Executable version under a different - license You must make it absolutely clear that any terms which differ - from this License are offered by You alone, not by the Initial - Developer or any Contributor. You hereby agree to indemnify the - Initial Developer and every Contributor for any liability incurred by - the Initial Developer or such Contributor as a result of any such - terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code - not governed by the terms of this License and distribute the Larger - Work as a single product. In such a case, You must make sure the - requirements of this License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this - License with respect to some or all of the Covered Code due to - statute, judicial order, or regulation then You must: (a) comply with - the terms of this License to the maximum extent possible; and (b) - describe the limitations and the code they affect. Such description - must be included in the LEGAL file described in Section 3.4 and must - be included with all distributions of the Source Code. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has - attached the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised - and/or new versions of the License from time to time. Each version - will be given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the - License, You may always continue to use it under the terms of that - version. You may also choose to use such Covered Code under the terms - of any subsequent version of the License published by Netscape. No one - other than Netscape has the right to modify the terms applicable to - Covered Code created under this License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may - only do in order to apply it to code which is not already Covered Code - governed by this License), You must (a) rename Your license so that - the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", - "MPL", "NPL" or any confusingly similar phrase do not appear in your - license (except to note that your license differs from this License) - and (b) otherwise make it clear that Your version of the license - contains terms which differ from the Mozilla Public License and - Netscape Public License. (Filling in the name of the Initial - Developer, Original Code or Contributor in the notice described in - Exhibit A shall not of themselves be deemed to be modifications of - this License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF - DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. - THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE - IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, - YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE - COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER - OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to cure - such breach within 30 days of becoming aware of the breach. All - sublicenses to the Covered Code which are properly granted shall - survive any termination of this License. Provisions which, by their - nature, must remain in effect beyond the termination of this License - shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement - claim (excluding declatory judgment actions) against Initial Developer - or a Contributor (the Initial Developer or Contributor against whom - You file such action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly - infringes any patent, then any and all rights granted by such - Participant to You under Sections 2.1 and/or 2.2 of this License - shall, upon 60 days notice from Participant terminate prospectively, - unless if within 60 days after receipt of notice You either: (i) - agree in writing to pay Participant a mutually agreeable reasonable - royalty for Your past and future use of Modifications made by such - Participant, or (ii) withdraw Your litigation claim with respect to - the Contributor Version against such Participant. If within 60 days - of notice, a reasonable royalty and payment arrangement are not - mutually agreed upon in writing by the parties or the litigation claim - is not withdrawn, the rights granted by Participant to You under - Sections 2.1 and/or 2.2 automatically terminate at the expiration of - the 60 day notice period specified above. - - (b) any software, hardware, or device, other than such Participant's - Contributor Version, directly or indirectly infringes any patent, then - any rights granted to You by such Participant under Sections 2.1(b) - and 2.2(b) are revoked effective as of the date You first made, used, - sold, distributed, or had made, Modifications made by that - Participant. - - 8.3. If You assert a patent infringement claim against Participant - alleging that such Participant's Contributor Version directly or - indirectly infringes any patent where such claim is resolved (such as - by license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, - all end user license agreements (excluding distributors and resellers) - which have been validly granted by You or any distributor hereunder - prior to termination shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL - DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, - OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR - ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY - CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, - WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY - RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW - PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE - EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO - THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in - 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" and "commercial computer software documentation," as such - terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 - C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), - all U.S. Government End Users acquire Covered Code with only those - rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - California law provisions (except to the extent applicable law, if - any, provides otherwise), excluding its conflict-of-law provisions. - With respect to disputes in which at least one party is a citizen of, - or an entity chartered or registered to do business in the United - States of America, any litigation relating to this License shall be - subject to the jurisdiction of the Federal Courts of the Northern - District of California, with venue lying in Santa Clara County, - California, with the losing party responsible for costs, including - without limitation, court costs and reasonable attorneys' fees and - expenses. The application of the United Nations Convention on - Contracts for the International Sale of Goods is expressly excluded. - Any law or regulation which provides that the language of a contract - shall be construed against the drafter shall not apply to this - License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as - "Multiple-Licensed". "Multiple-Licensed" means that the Initial - Developer permits you to utilize portions of the Covered Code under - Your choice of the MPL or the alternative licenses, if any, specified - by the Initial Developer in the file described in Exhibit A. - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - https://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. - - The Original Code is RabbitMQ. - - The Initial Developer of the Original Code is GoPivotal, Inc. - Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. - - Alternatively, the contents of this file may be used under the terms - of the GNU General Public License version 2 (the "GPL2"), or - the Apache License version 2 (the "ASL2") in which case the - provisions of GPL2 or the ASL2 are applicable instead of those - above. If you wish to allow use of your version of this file only - under the terms of the GPL2 or the ASL2 and not to allow others to use - your version of this file under the MPL, indicate your decision by - deleting the provisions above and replace them with the notice and - other provisions required by the GPL2 or the ASL2. If you do not delete - the provisions above, a recipient may use your version of this file - under either the MPL, the GPL2 or the ASL2.'' - - [NOTE: The text of this Exhibit A may differ slightly from the text of - the notices in the Source Code files of the Original Code. You should - use the text of this Exhibit A rather than the text found in the - Original Code Source Code for Your Modifications.] +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/README.md b/README.md index 103c73d08d..cdc88f8d07 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,6 @@ See [Contributing](./CONTRIBUTING.md) and [How to Run Tests](./RUNNING_TESTS.md) ## License -This package, the RabbitMQ Java client library, is triple-licensed under -the Mozilla Public License 1.1 ("MPL"), the GNU General Public License +This package, the RabbitMQ Java client library, is [triple-licensed](https://www.rabbitmq.com/api-guide.html#license) under +the Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 ("GPL") and the Apache License version 2 ("ASL"). diff --git a/codegen.py b/codegen.py index 42c577a0d9..42e29eaab1 100755 --- a/codegen.py +++ b/codegen.py @@ -3,7 +3,7 @@ ## Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. ## ## This software, the RabbitMQ Java client library, is triple-licensed under the -## Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +## Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 ## ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see ## LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, ## please see LICENSE-APACHE2. @@ -133,7 +133,7 @@ def printFileHeader(): // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/Address.java b/src/main/java/com/rabbitmq/client/Address.java index 26b9cd9d3e..394f5e7b60 100644 --- a/src/main/java/com/rabbitmq/client/Address.java +++ b/src/main/java/com/rabbitmq/client/Address.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/AddressResolver.java b/src/main/java/com/rabbitmq/client/AddressResolver.java index 4a4f0d8461..8350bac153 100644 --- a/src/main/java/com/rabbitmq/client/AddressResolver.java +++ b/src/main/java/com/rabbitmq/client/AddressResolver.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/AlreadyClosedException.java b/src/main/java/com/rabbitmq/client/AlreadyClosedException.java index 37060907f9..69a000847e 100644 --- a/src/main/java/com/rabbitmq/client/AlreadyClosedException.java +++ b/src/main/java/com/rabbitmq/client/AlreadyClosedException.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/AuthenticationFailureException.java b/src/main/java/com/rabbitmq/client/AuthenticationFailureException.java index 391be6d039..56f26561ca 100644 --- a/src/main/java/com/rabbitmq/client/AuthenticationFailureException.java +++ b/src/main/java/com/rabbitmq/client/AuthenticationFailureException.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/BasicProperties.java b/src/main/java/com/rabbitmq/client/BasicProperties.java index 4001508cfb..9a0b953698 100644 --- a/src/main/java/com/rabbitmq/client/BasicProperties.java +++ b/src/main/java/com/rabbitmq/client/BasicProperties.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/BlockedCallback.java b/src/main/java/com/rabbitmq/client/BlockedCallback.java index f679e79427..d9e22fbe88 100644 --- a/src/main/java/com/rabbitmq/client/BlockedCallback.java +++ b/src/main/java/com/rabbitmq/client/BlockedCallback.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/BlockedListener.java b/src/main/java/com/rabbitmq/client/BlockedListener.java index 4e0f820615..521f8d19cd 100644 --- a/src/main/java/com/rabbitmq/client/BlockedListener.java +++ b/src/main/java/com/rabbitmq/client/BlockedListener.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/CancelCallback.java b/src/main/java/com/rabbitmq/client/CancelCallback.java index ee6df1964a..419f34a4bd 100644 --- a/src/main/java/com/rabbitmq/client/CancelCallback.java +++ b/src/main/java/com/rabbitmq/client/CancelCallback.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/Channel.java b/src/main/java/com/rabbitmq/client/Channel.java index b84df3d95b..2520858b9e 100644 --- a/src/main/java/com/rabbitmq/client/Channel.java +++ b/src/main/java/com/rabbitmq/client/Channel.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/Command.java b/src/main/java/com/rabbitmq/client/Command.java index 2630773ecc..dad5c6aa64 100644 --- a/src/main/java/com/rabbitmq/client/Command.java +++ b/src/main/java/com/rabbitmq/client/Command.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/ConfirmCallback.java b/src/main/java/com/rabbitmq/client/ConfirmCallback.java index 41197874e3..e02355f957 100644 --- a/src/main/java/com/rabbitmq/client/ConfirmCallback.java +++ b/src/main/java/com/rabbitmq/client/ConfirmCallback.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/ConfirmListener.java b/src/main/java/com/rabbitmq/client/ConfirmListener.java index 51162d9baf..50f25ad2c3 100644 --- a/src/main/java/com/rabbitmq/client/ConfirmListener.java +++ b/src/main/java/com/rabbitmq/client/ConfirmListener.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/Connection.java b/src/main/java/com/rabbitmq/client/Connection.java index d45c1b90ea..5004ac9372 100644 --- a/src/main/java/com/rabbitmq/client/Connection.java +++ b/src/main/java/com/rabbitmq/client/Connection.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index 71286d3b3b..0b55ef7d34 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactoryConfigurator.java b/src/main/java/com/rabbitmq/client/ConnectionFactoryConfigurator.java index 9cd9c7ee31..d59770380e 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactoryConfigurator.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactoryConfigurator.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/Consumer.java b/src/main/java/com/rabbitmq/client/Consumer.java index 118ce0a8f3..cb57e9d956 100644 --- a/src/main/java/com/rabbitmq/client/Consumer.java +++ b/src/main/java/com/rabbitmq/client/Consumer.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/ConsumerCancelledException.java b/src/main/java/com/rabbitmq/client/ConsumerCancelledException.java index 7078cfcf99..44495fceb4 100644 --- a/src/main/java/com/rabbitmq/client/ConsumerCancelledException.java +++ b/src/main/java/com/rabbitmq/client/ConsumerCancelledException.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/ConsumerShutdownSignalCallback.java b/src/main/java/com/rabbitmq/client/ConsumerShutdownSignalCallback.java index fb055dde7e..0fe41694a4 100644 --- a/src/main/java/com/rabbitmq/client/ConsumerShutdownSignalCallback.java +++ b/src/main/java/com/rabbitmq/client/ConsumerShutdownSignalCallback.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/ContentHeader.java b/src/main/java/com/rabbitmq/client/ContentHeader.java index ddb7d52b14..ff3f0f0a1e 100644 --- a/src/main/java/com/rabbitmq/client/ContentHeader.java +++ b/src/main/java/com/rabbitmq/client/ContentHeader.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/DefaultConsumer.java b/src/main/java/com/rabbitmq/client/DefaultConsumer.java index 0e1670d39a..b2b4644b3c 100644 --- a/src/main/java/com/rabbitmq/client/DefaultConsumer.java +++ b/src/main/java/com/rabbitmq/client/DefaultConsumer.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/DefaultSaslConfig.java b/src/main/java/com/rabbitmq/client/DefaultSaslConfig.java index 62ac85c4c1..0e4de02da1 100644 --- a/src/main/java/com/rabbitmq/client/DefaultSaslConfig.java +++ b/src/main/java/com/rabbitmq/client/DefaultSaslConfig.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/DefaultSocketChannelConfigurator.java b/src/main/java/com/rabbitmq/client/DefaultSocketChannelConfigurator.java index 38494da70e..470bd6f940 100644 --- a/src/main/java/com/rabbitmq/client/DefaultSocketChannelConfigurator.java +++ b/src/main/java/com/rabbitmq/client/DefaultSocketChannelConfigurator.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/DefaultSocketConfigurator.java b/src/main/java/com/rabbitmq/client/DefaultSocketConfigurator.java index 0c3118e049..57732f45c3 100644 --- a/src/main/java/com/rabbitmq/client/DefaultSocketConfigurator.java +++ b/src/main/java/com/rabbitmq/client/DefaultSocketConfigurator.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/DeliverCallback.java b/src/main/java/com/rabbitmq/client/DeliverCallback.java index 8e17dfb407..4760c7be1a 100644 --- a/src/main/java/com/rabbitmq/client/DeliverCallback.java +++ b/src/main/java/com/rabbitmq/client/DeliverCallback.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/Delivery.java b/src/main/java/com/rabbitmq/client/Delivery.java index 3e99f20974..91c36ffa3d 100644 --- a/src/main/java/com/rabbitmq/client/Delivery.java +++ b/src/main/java/com/rabbitmq/client/Delivery.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/DnsRecordIpAddressResolver.java b/src/main/java/com/rabbitmq/client/DnsRecordIpAddressResolver.java index fb28f16a41..2f9ce570a4 100644 --- a/src/main/java/com/rabbitmq/client/DnsRecordIpAddressResolver.java +++ b/src/main/java/com/rabbitmq/client/DnsRecordIpAddressResolver.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/DnsSrvRecordAddressResolver.java b/src/main/java/com/rabbitmq/client/DnsSrvRecordAddressResolver.java index 81775fc9f6..5c340c3347 100644 --- a/src/main/java/com/rabbitmq/client/DnsSrvRecordAddressResolver.java +++ b/src/main/java/com/rabbitmq/client/DnsSrvRecordAddressResolver.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/Envelope.java b/src/main/java/com/rabbitmq/client/Envelope.java index cc8e7ceda1..d8164f050d 100644 --- a/src/main/java/com/rabbitmq/client/Envelope.java +++ b/src/main/java/com/rabbitmq/client/Envelope.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/ExceptionHandler.java b/src/main/java/com/rabbitmq/client/ExceptionHandler.java index 3ed8183f28..90c982d11e 100644 --- a/src/main/java/com/rabbitmq/client/ExceptionHandler.java +++ b/src/main/java/com/rabbitmq/client/ExceptionHandler.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/GetResponse.java b/src/main/java/com/rabbitmq/client/GetResponse.java index ba157a0fb9..83ea3bc991 100644 --- a/src/main/java/com/rabbitmq/client/GetResponse.java +++ b/src/main/java/com/rabbitmq/client/GetResponse.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/JDKSaslConfig.java b/src/main/java/com/rabbitmq/client/JDKSaslConfig.java index d8a240a30e..e39beb2eec 100644 --- a/src/main/java/com/rabbitmq/client/JDKSaslConfig.java +++ b/src/main/java/com/rabbitmq/client/JDKSaslConfig.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/ListAddressResolver.java b/src/main/java/com/rabbitmq/client/ListAddressResolver.java index a7b3d96657..e04eaa4431 100644 --- a/src/main/java/com/rabbitmq/client/ListAddressResolver.java +++ b/src/main/java/com/rabbitmq/client/ListAddressResolver.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/LongString.java b/src/main/java/com/rabbitmq/client/LongString.java index 447ef1e510..3b091b98fc 100644 --- a/src/main/java/com/rabbitmq/client/LongString.java +++ b/src/main/java/com/rabbitmq/client/LongString.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/MalformedFrameException.java b/src/main/java/com/rabbitmq/client/MalformedFrameException.java index ae799f0f5d..a05dc95928 100644 --- a/src/main/java/com/rabbitmq/client/MalformedFrameException.java +++ b/src/main/java/com/rabbitmq/client/MalformedFrameException.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/MapRpcServer.java b/src/main/java/com/rabbitmq/client/MapRpcServer.java index 93ceaa10fe..5a65fe3126 100644 --- a/src/main/java/com/rabbitmq/client/MapRpcServer.java +++ b/src/main/java/com/rabbitmq/client/MapRpcServer.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/MessageProperties.java b/src/main/java/com/rabbitmq/client/MessageProperties.java index 8369eeb645..bd7b6cd71c 100644 --- a/src/main/java/com/rabbitmq/client/MessageProperties.java +++ b/src/main/java/com/rabbitmq/client/MessageProperties.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/Method.java b/src/main/java/com/rabbitmq/client/Method.java index bd7b8531e7..d6aa573ce0 100644 --- a/src/main/java/com/rabbitmq/client/Method.java +++ b/src/main/java/com/rabbitmq/client/Method.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/MetricsCollector.java b/src/main/java/com/rabbitmq/client/MetricsCollector.java index 9b289d87bd..3c4aada94d 100644 --- a/src/main/java/com/rabbitmq/client/MetricsCollector.java +++ b/src/main/java/com/rabbitmq/client/MetricsCollector.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/MissedHeartbeatException.java b/src/main/java/com/rabbitmq/client/MissedHeartbeatException.java index 83400d2db5..ef3bf5335d 100644 --- a/src/main/java/com/rabbitmq/client/MissedHeartbeatException.java +++ b/src/main/java/com/rabbitmq/client/MissedHeartbeatException.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/NoOpMetricsCollector.java b/src/main/java/com/rabbitmq/client/NoOpMetricsCollector.java index 163fe8afe4..b2e9b703ef 100644 --- a/src/main/java/com/rabbitmq/client/NoOpMetricsCollector.java +++ b/src/main/java/com/rabbitmq/client/NoOpMetricsCollector.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/PossibleAuthenticationFailureException.java b/src/main/java/com/rabbitmq/client/PossibleAuthenticationFailureException.java index d6cca886db..9c8876d8e4 100644 --- a/src/main/java/com/rabbitmq/client/PossibleAuthenticationFailureException.java +++ b/src/main/java/com/rabbitmq/client/PossibleAuthenticationFailureException.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/ProtocolVersionMismatchException.java b/src/main/java/com/rabbitmq/client/ProtocolVersionMismatchException.java index 8cd857545b..e15e5873e3 100644 --- a/src/main/java/com/rabbitmq/client/ProtocolVersionMismatchException.java +++ b/src/main/java/com/rabbitmq/client/ProtocolVersionMismatchException.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/Recoverable.java b/src/main/java/com/rabbitmq/client/Recoverable.java index c4b066f66c..30d68992ba 100644 --- a/src/main/java/com/rabbitmq/client/Recoverable.java +++ b/src/main/java/com/rabbitmq/client/Recoverable.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/RecoveryDelayHandler.java b/src/main/java/com/rabbitmq/client/RecoveryDelayHandler.java index e00c7d3940..84a2d577e7 100644 --- a/src/main/java/com/rabbitmq/client/RecoveryDelayHandler.java +++ b/src/main/java/com/rabbitmq/client/RecoveryDelayHandler.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/RecoveryListener.java b/src/main/java/com/rabbitmq/client/RecoveryListener.java index 968b828521..a3374414e2 100644 --- a/src/main/java/com/rabbitmq/client/RecoveryListener.java +++ b/src/main/java/com/rabbitmq/client/RecoveryListener.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/Return.java b/src/main/java/com/rabbitmq/client/Return.java index f441a69873..d25532b773 100644 --- a/src/main/java/com/rabbitmq/client/Return.java +++ b/src/main/java/com/rabbitmq/client/Return.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/ReturnCallback.java b/src/main/java/com/rabbitmq/client/ReturnCallback.java index 1eb1c99271..efa3ad6065 100644 --- a/src/main/java/com/rabbitmq/client/ReturnCallback.java +++ b/src/main/java/com/rabbitmq/client/ReturnCallback.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/ReturnListener.java b/src/main/java/com/rabbitmq/client/ReturnListener.java index 2ec72fbc15..5f45f84ef4 100644 --- a/src/main/java/com/rabbitmq/client/ReturnListener.java +++ b/src/main/java/com/rabbitmq/client/ReturnListener.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/RpcClient.java b/src/main/java/com/rabbitmq/client/RpcClient.java index 7e5a4e4ef6..9d42e60d09 100644 --- a/src/main/java/com/rabbitmq/client/RpcClient.java +++ b/src/main/java/com/rabbitmq/client/RpcClient.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/RpcClientParams.java b/src/main/java/com/rabbitmq/client/RpcClientParams.java index ea1ab30d87..190792250f 100644 --- a/src/main/java/com/rabbitmq/client/RpcClientParams.java +++ b/src/main/java/com/rabbitmq/client/RpcClientParams.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/RpcServer.java b/src/main/java/com/rabbitmq/client/RpcServer.java index a1bc413c50..426c8d749f 100644 --- a/src/main/java/com/rabbitmq/client/RpcServer.java +++ b/src/main/java/com/rabbitmq/client/RpcServer.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/SaslConfig.java b/src/main/java/com/rabbitmq/client/SaslConfig.java index d8555cf6b2..5042f2c16f 100644 --- a/src/main/java/com/rabbitmq/client/SaslConfig.java +++ b/src/main/java/com/rabbitmq/client/SaslConfig.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/SaslMechanism.java b/src/main/java/com/rabbitmq/client/SaslMechanism.java index d411f2072e..9a11b5a27f 100644 --- a/src/main/java/com/rabbitmq/client/SaslMechanism.java +++ b/src/main/java/com/rabbitmq/client/SaslMechanism.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/ShutdownListener.java b/src/main/java/com/rabbitmq/client/ShutdownListener.java index 5a2427334f..9775e454b0 100644 --- a/src/main/java/com/rabbitmq/client/ShutdownListener.java +++ b/src/main/java/com/rabbitmq/client/ShutdownListener.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/ShutdownNotifier.java b/src/main/java/com/rabbitmq/client/ShutdownNotifier.java index 66aa021d7a..9c1e3e8bfc 100644 --- a/src/main/java/com/rabbitmq/client/ShutdownNotifier.java +++ b/src/main/java/com/rabbitmq/client/ShutdownNotifier.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/ShutdownSignalException.java b/src/main/java/com/rabbitmq/client/ShutdownSignalException.java index 769158198d..24be455978 100644 --- a/src/main/java/com/rabbitmq/client/ShutdownSignalException.java +++ b/src/main/java/com/rabbitmq/client/ShutdownSignalException.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/SocketChannelConfigurator.java b/src/main/java/com/rabbitmq/client/SocketChannelConfigurator.java index 43307caada..4571e707f9 100644 --- a/src/main/java/com/rabbitmq/client/SocketChannelConfigurator.java +++ b/src/main/java/com/rabbitmq/client/SocketChannelConfigurator.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/SocketChannelConfigurators.java b/src/main/java/com/rabbitmq/client/SocketChannelConfigurators.java index 0355528b4e..711af1cf58 100644 --- a/src/main/java/com/rabbitmq/client/SocketChannelConfigurators.java +++ b/src/main/java/com/rabbitmq/client/SocketChannelConfigurators.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/SocketConfigurator.java b/src/main/java/com/rabbitmq/client/SocketConfigurator.java index 8a49c57d96..151f572461 100644 --- a/src/main/java/com/rabbitmq/client/SocketConfigurator.java +++ b/src/main/java/com/rabbitmq/client/SocketConfigurator.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/SocketConfigurators.java b/src/main/java/com/rabbitmq/client/SocketConfigurators.java index 5d3ea0e280..23bc1b6a1b 100644 --- a/src/main/java/com/rabbitmq/client/SocketConfigurators.java +++ b/src/main/java/com/rabbitmq/client/SocketConfigurators.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/SslContextFactory.java b/src/main/java/com/rabbitmq/client/SslContextFactory.java index 468c1237cd..0b285a9bf9 100644 --- a/src/main/java/com/rabbitmq/client/SslContextFactory.java +++ b/src/main/java/com/rabbitmq/client/SslContextFactory.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/SslEngineConfigurator.java b/src/main/java/com/rabbitmq/client/SslEngineConfigurator.java index 6f95bb392a..0ed04182f3 100644 --- a/src/main/java/com/rabbitmq/client/SslEngineConfigurator.java +++ b/src/main/java/com/rabbitmq/client/SslEngineConfigurator.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java b/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java index 0cb7b451d7..6e8ca36589 100644 --- a/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java +++ b/src/main/java/com/rabbitmq/client/SslEngineConfigurators.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/StringRpcServer.java b/src/main/java/com/rabbitmq/client/StringRpcServer.java index 375079607a..d437cb28b4 100644 --- a/src/main/java/com/rabbitmq/client/StringRpcServer.java +++ b/src/main/java/com/rabbitmq/client/StringRpcServer.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/TopologyRecoveryException.java b/src/main/java/com/rabbitmq/client/TopologyRecoveryException.java index cf9d18d105..bdd8b7f807 100644 --- a/src/main/java/com/rabbitmq/client/TopologyRecoveryException.java +++ b/src/main/java/com/rabbitmq/client/TopologyRecoveryException.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/TrustEverythingTrustManager.java b/src/main/java/com/rabbitmq/client/TrustEverythingTrustManager.java index 9001d02507..e7913d048e 100644 --- a/src/main/java/com/rabbitmq/client/TrustEverythingTrustManager.java +++ b/src/main/java/com/rabbitmq/client/TrustEverythingTrustManager.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/UnblockedCallback.java b/src/main/java/com/rabbitmq/client/UnblockedCallback.java index 76ac083ac7..6d79423922 100644 --- a/src/main/java/com/rabbitmq/client/UnblockedCallback.java +++ b/src/main/java/com/rabbitmq/client/UnblockedCallback.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/UnexpectedFrameError.java b/src/main/java/com/rabbitmq/client/UnexpectedFrameError.java index e8275aec3a..e15e449e5b 100644 --- a/src/main/java/com/rabbitmq/client/UnexpectedFrameError.java +++ b/src/main/java/com/rabbitmq/client/UnexpectedFrameError.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/UnexpectedMethodError.java b/src/main/java/com/rabbitmq/client/UnexpectedMethodError.java index ab30336a07..f5cde49379 100644 --- a/src/main/java/com/rabbitmq/client/UnexpectedMethodError.java +++ b/src/main/java/com/rabbitmq/client/UnexpectedMethodError.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/UnknownClassOrMethodId.java b/src/main/java/com/rabbitmq/client/UnknownClassOrMethodId.java index 1f0e3715f3..3ad973a7b6 100644 --- a/src/main/java/com/rabbitmq/client/UnknownClassOrMethodId.java +++ b/src/main/java/com/rabbitmq/client/UnknownClassOrMethodId.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/UnroutableRpcRequestException.java b/src/main/java/com/rabbitmq/client/UnroutableRpcRequestException.java index 89e9d059f0..1a2877e14a 100644 --- a/src/main/java/com/rabbitmq/client/UnroutableRpcRequestException.java +++ b/src/main/java/com/rabbitmq/client/UnroutableRpcRequestException.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/AMQBasicProperties.java b/src/main/java/com/rabbitmq/client/impl/AMQBasicProperties.java index 591713e706..54f312f06a 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQBasicProperties.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQBasicProperties.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/AMQChannel.java b/src/main/java/com/rabbitmq/client/impl/AMQChannel.java index 837fdef8d9..fe64ab370e 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQChannel.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQChannel.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/AMQCommand.java b/src/main/java/com/rabbitmq/client/impl/AMQCommand.java index 0395bb10f6..b8cb3c97dd 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQCommand.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQCommand.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java index d99784f933..311391ba82 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQConnection.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/AMQContentHeader.java b/src/main/java/com/rabbitmq/client/impl/AMQContentHeader.java index 523336e0ca..e3bf4a479f 100644 --- a/src/main/java/com/rabbitmq/client/impl/AMQContentHeader.java +++ b/src/main/java/com/rabbitmq/client/impl/AMQContentHeader.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/AbstractMetricsCollector.java b/src/main/java/com/rabbitmq/client/impl/AbstractMetricsCollector.java index c0a3c5eb6b..44cf1aff9e 100644 --- a/src/main/java/com/rabbitmq/client/impl/AbstractMetricsCollector.java +++ b/src/main/java/com/rabbitmq/client/impl/AbstractMetricsCollector.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/CRDemoMechanism.java b/src/main/java/com/rabbitmq/client/impl/CRDemoMechanism.java index e516750b6c..85f0d47cc4 100644 --- a/src/main/java/com/rabbitmq/client/impl/CRDemoMechanism.java +++ b/src/main/java/com/rabbitmq/client/impl/CRDemoMechanism.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/ChannelManager.java b/src/main/java/com/rabbitmq/client/impl/ChannelManager.java index 162c141f34..59f7bb3fee 100644 --- a/src/main/java/com/rabbitmq/client/impl/ChannelManager.java +++ b/src/main/java/com/rabbitmq/client/impl/ChannelManager.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/ChannelN.java b/src/main/java/com/rabbitmq/client/impl/ChannelN.java index 2bbc37a3ca..8a769a0d45 100644 --- a/src/main/java/com/rabbitmq/client/impl/ChannelN.java +++ b/src/main/java/com/rabbitmq/client/impl/ChannelN.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/ClientVersion.java b/src/main/java/com/rabbitmq/client/impl/ClientVersion.java index 53ec1b927c..556bd6dc48 100644 --- a/src/main/java/com/rabbitmq/client/impl/ClientVersion.java +++ b/src/main/java/com/rabbitmq/client/impl/ClientVersion.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/CommandAssembler.java b/src/main/java/com/rabbitmq/client/impl/CommandAssembler.java index 8a2915c0d7..f19294862f 100644 --- a/src/main/java/com/rabbitmq/client/impl/CommandAssembler.java +++ b/src/main/java/com/rabbitmq/client/impl/CommandAssembler.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/CompletableFutureRpcWrapper.java b/src/main/java/com/rabbitmq/client/impl/CompletableFutureRpcWrapper.java index 1f1b91f569..2157e15d71 100644 --- a/src/main/java/com/rabbitmq/client/impl/CompletableFutureRpcWrapper.java +++ b/src/main/java/com/rabbitmq/client/impl/CompletableFutureRpcWrapper.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/ConnectionParams.java b/src/main/java/com/rabbitmq/client/impl/ConnectionParams.java index 92428fc436..a2b49d0f98 100644 --- a/src/main/java/com/rabbitmq/client/impl/ConnectionParams.java +++ b/src/main/java/com/rabbitmq/client/impl/ConnectionParams.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/ConsumerDispatcher.java b/src/main/java/com/rabbitmq/client/impl/ConsumerDispatcher.java index bb22d9f626..fec98710fe 100644 --- a/src/main/java/com/rabbitmq/client/impl/ConsumerDispatcher.java +++ b/src/main/java/com/rabbitmq/client/impl/ConsumerDispatcher.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/ConsumerWorkService.java b/src/main/java/com/rabbitmq/client/impl/ConsumerWorkService.java index bb662d98e7..b3810aae2f 100644 --- a/src/main/java/com/rabbitmq/client/impl/ConsumerWorkService.java +++ b/src/main/java/com/rabbitmq/client/impl/ConsumerWorkService.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyReader.java b/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyReader.java index d3502e9fe2..115c3ef520 100644 --- a/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyReader.java +++ b/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyReader.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyWriter.java b/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyWriter.java index 59440bc7e7..029329a13d 100644 --- a/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyWriter.java +++ b/src/main/java/com/rabbitmq/client/impl/ContentHeaderPropertyWriter.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java index abcfb6af17..19b159df78 100644 --- a/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java +++ b/src/main/java/com/rabbitmq/client/impl/CredentialsProvider.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. @@ -63,4 +63,4 @@ default void refresh() { // no need to refresh anything by default } -} \ No newline at end of file +} diff --git a/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java b/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java index d365053af1..a490a61a5b 100644 --- a/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java +++ b/src/main/java/com/rabbitmq/client/impl/CredentialsRefreshService.java @@ -1,7 +1,7 @@ // Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsProvider.java index 6263524898..eaf8a90c0c 100644 --- a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsProvider.java +++ b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsProvider.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java index 2beafaad74..f4edeae391 100644 --- a/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java +++ b/src/main/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshService.java @@ -1,7 +1,7 @@ // Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/DefaultExceptionHandler.java b/src/main/java/com/rabbitmq/client/impl/DefaultExceptionHandler.java index f1a0def2f3..f521a37c14 100644 --- a/src/main/java/com/rabbitmq/client/impl/DefaultExceptionHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/DefaultExceptionHandler.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/Environment.java b/src/main/java/com/rabbitmq/client/impl/Environment.java index c7f6c528b0..149b9a102e 100644 --- a/src/main/java/com/rabbitmq/client/impl/Environment.java +++ b/src/main/java/com/rabbitmq/client/impl/Environment.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/ErrorOnWriteListener.java b/src/main/java/com/rabbitmq/client/impl/ErrorOnWriteListener.java index 7edf05e994..dd9de0ce1c 100644 --- a/src/main/java/com/rabbitmq/client/impl/ErrorOnWriteListener.java +++ b/src/main/java/com/rabbitmq/client/impl/ErrorOnWriteListener.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/ExternalMechanism.java b/src/main/java/com/rabbitmq/client/impl/ExternalMechanism.java index 5cddc69ac4..e50a0c17c7 100644 --- a/src/main/java/com/rabbitmq/client/impl/ExternalMechanism.java +++ b/src/main/java/com/rabbitmq/client/impl/ExternalMechanism.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/ForgivingExceptionHandler.java b/src/main/java/com/rabbitmq/client/impl/ForgivingExceptionHandler.java index e4c2648394..8a7d790382 100644 --- a/src/main/java/com/rabbitmq/client/impl/ForgivingExceptionHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/ForgivingExceptionHandler.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/Frame.java b/src/main/java/com/rabbitmq/client/impl/Frame.java index f99b9d1260..b1ecd916dd 100644 --- a/src/main/java/com/rabbitmq/client/impl/Frame.java +++ b/src/main/java/com/rabbitmq/client/impl/Frame.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/FrameHandler.java b/src/main/java/com/rabbitmq/client/impl/FrameHandler.java index 0e54b34435..8d49352cb5 100644 --- a/src/main/java/com/rabbitmq/client/impl/FrameHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/FrameHandler.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/HeartbeatSender.java b/src/main/java/com/rabbitmq/client/impl/HeartbeatSender.java index 998581d0a5..d682317fe3 100644 --- a/src/main/java/com/rabbitmq/client/impl/HeartbeatSender.java +++ b/src/main/java/com/rabbitmq/client/impl/HeartbeatSender.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/LongStringHelper.java b/src/main/java/com/rabbitmq/client/impl/LongStringHelper.java index d80d9a01f3..0a824db6de 100644 --- a/src/main/java/com/rabbitmq/client/impl/LongStringHelper.java +++ b/src/main/java/com/rabbitmq/client/impl/LongStringHelper.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/Method.java b/src/main/java/com/rabbitmq/client/impl/Method.java index 0b894416ac..73b0e5e0d5 100644 --- a/src/main/java/com/rabbitmq/client/impl/Method.java +++ b/src/main/java/com/rabbitmq/client/impl/Method.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/MethodArgumentReader.java b/src/main/java/com/rabbitmq/client/impl/MethodArgumentReader.java index 24ab627450..e5c3f437ee 100644 --- a/src/main/java/com/rabbitmq/client/impl/MethodArgumentReader.java +++ b/src/main/java/com/rabbitmq/client/impl/MethodArgumentReader.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/MethodArgumentWriter.java b/src/main/java/com/rabbitmq/client/impl/MethodArgumentWriter.java index 02317eec87..f452191413 100644 --- a/src/main/java/com/rabbitmq/client/impl/MethodArgumentWriter.java +++ b/src/main/java/com/rabbitmq/client/impl/MethodArgumentWriter.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/MicrometerMetricsCollector.java b/src/main/java/com/rabbitmq/client/impl/MicrometerMetricsCollector.java index ab910361df..cd8e7b829d 100644 --- a/src/main/java/com/rabbitmq/client/impl/MicrometerMetricsCollector.java +++ b/src/main/java/com/rabbitmq/client/impl/MicrometerMetricsCollector.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/NetworkConnection.java b/src/main/java/com/rabbitmq/client/impl/NetworkConnection.java index 747a1921a7..03ca1d2201 100644 --- a/src/main/java/com/rabbitmq/client/impl/NetworkConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/NetworkConnection.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java index da3ff81973..5e9618317d 100644 --- a/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java +++ b/src/main/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProvider.java @@ -1,7 +1,7 @@ // Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/OAuthTokenManagementException.java b/src/main/java/com/rabbitmq/client/impl/OAuthTokenManagementException.java index cf17053b24..d3419189cb 100644 --- a/src/main/java/com/rabbitmq/client/impl/OAuthTokenManagementException.java +++ b/src/main/java/com/rabbitmq/client/impl/OAuthTokenManagementException.java @@ -1,7 +1,7 @@ // Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/PlainMechanism.java b/src/main/java/com/rabbitmq/client/impl/PlainMechanism.java index c586385299..75651d74b0 100644 --- a/src/main/java/com/rabbitmq/client/impl/PlainMechanism.java +++ b/src/main/java/com/rabbitmq/client/impl/PlainMechanism.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProvider.java b/src/main/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProvider.java index a4cc01c186..cd8f855b01 100644 --- a/src/main/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProvider.java +++ b/src/main/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProvider.java @@ -1,7 +1,7 @@ // Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/RpcContinuationRpcWrapper.java b/src/main/java/com/rabbitmq/client/impl/RpcContinuationRpcWrapper.java index 8fcf901b55..71d60a4690 100644 --- a/src/main/java/com/rabbitmq/client/impl/RpcContinuationRpcWrapper.java +++ b/src/main/java/com/rabbitmq/client/impl/RpcContinuationRpcWrapper.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/RpcWrapper.java b/src/main/java/com/rabbitmq/client/impl/RpcWrapper.java index 84c3bb0363..8d81258ffc 100644 --- a/src/main/java/com/rabbitmq/client/impl/RpcWrapper.java +++ b/src/main/java/com/rabbitmq/client/impl/RpcWrapper.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/SetQueue.java b/src/main/java/com/rabbitmq/client/impl/SetQueue.java index 9ab2cd3526..6a5dc8db12 100644 --- a/src/main/java/com/rabbitmq/client/impl/SetQueue.java +++ b/src/main/java/com/rabbitmq/client/impl/SetQueue.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/ShutdownNotifierComponent.java b/src/main/java/com/rabbitmq/client/impl/ShutdownNotifierComponent.java index 0ee95e083c..e4ec15836b 100644 --- a/src/main/java/com/rabbitmq/client/impl/ShutdownNotifierComponent.java +++ b/src/main/java/com/rabbitmq/client/impl/ShutdownNotifierComponent.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/SocketFrameHandler.java b/src/main/java/com/rabbitmq/client/impl/SocketFrameHandler.java index 8d1d2eee15..6efd6f83f9 100644 --- a/src/main/java/com/rabbitmq/client/impl/SocketFrameHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/SocketFrameHandler.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/SocketFrameHandlerFactory.java b/src/main/java/com/rabbitmq/client/impl/SocketFrameHandlerFactory.java index 0391b31297..1186b6ea93 100644 --- a/src/main/java/com/rabbitmq/client/impl/SocketFrameHandlerFactory.java +++ b/src/main/java/com/rabbitmq/client/impl/SocketFrameHandlerFactory.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/StandardMetricsCollector.java b/src/main/java/com/rabbitmq/client/impl/StandardMetricsCollector.java index f6273bef19..07e7780817 100644 --- a/src/main/java/com/rabbitmq/client/impl/StandardMetricsCollector.java +++ b/src/main/java/com/rabbitmq/client/impl/StandardMetricsCollector.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/StrictExceptionHandler.java b/src/main/java/com/rabbitmq/client/impl/StrictExceptionHandler.java index d1f54768b0..62f37d72b4 100644 --- a/src/main/java/com/rabbitmq/client/impl/StrictExceptionHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/StrictExceptionHandler.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/TlsUtils.java b/src/main/java/com/rabbitmq/client/impl/TlsUtils.java index 5b4290f79c..a11deddc2c 100644 --- a/src/main/java/com/rabbitmq/client/impl/TlsUtils.java +++ b/src/main/java/com/rabbitmq/client/impl/TlsUtils.java @@ -1,7 +1,7 @@ // Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/TruncatedInputStream.java b/src/main/java/com/rabbitmq/client/impl/TruncatedInputStream.java index a572952af8..dd35c3f2e6 100644 --- a/src/main/java/com/rabbitmq/client/impl/TruncatedInputStream.java +++ b/src/main/java/com/rabbitmq/client/impl/TruncatedInputStream.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/UnknownChannelException.java b/src/main/java/com/rabbitmq/client/impl/UnknownChannelException.java index 5e9474c5a9..ff59b907cf 100644 --- a/src/main/java/com/rabbitmq/client/impl/UnknownChannelException.java +++ b/src/main/java/com/rabbitmq/client/impl/UnknownChannelException.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/UpdateSecretExtension.java b/src/main/java/com/rabbitmq/client/impl/UpdateSecretExtension.java index 5edd65813c..3028a886ab 100644 --- a/src/main/java/com/rabbitmq/client/impl/UpdateSecretExtension.java +++ b/src/main/java/com/rabbitmq/client/impl/UpdateSecretExtension.java @@ -1,7 +1,7 @@ // Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/ValueReader.java b/src/main/java/com/rabbitmq/client/impl/ValueReader.java index 9611324f3a..83455bfe66 100644 --- a/src/main/java/com/rabbitmq/client/impl/ValueReader.java +++ b/src/main/java/com/rabbitmq/client/impl/ValueReader.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/ValueWriter.java b/src/main/java/com/rabbitmq/client/impl/ValueWriter.java index e6167cec7e..c167fc0475 100644 --- a/src/main/java/com/rabbitmq/client/impl/ValueWriter.java +++ b/src/main/java/com/rabbitmq/client/impl/ValueWriter.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/VariableLinkedBlockingQueue.java b/src/main/java/com/rabbitmq/client/impl/VariableLinkedBlockingQueue.java index 97be3a8270..60dbe04bb4 100644 --- a/src/main/java/com/rabbitmq/client/impl/VariableLinkedBlockingQueue.java +++ b/src/main/java/com/rabbitmq/client/impl/VariableLinkedBlockingQueue.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/Version.java b/src/main/java/com/rabbitmq/client/impl/Version.java index 109359fe3d..3e64d51702 100644 --- a/src/main/java/com/rabbitmq/client/impl/Version.java +++ b/src/main/java/com/rabbitmq/client/impl/Version.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/WorkPool.java b/src/main/java/com/rabbitmq/client/impl/WorkPool.java index 39b8b743b7..e4d7dc8cfe 100644 --- a/src/main/java/com/rabbitmq/client/impl/WorkPool.java +++ b/src/main/java/com/rabbitmq/client/impl/WorkPool.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/WorkPoolFullException.java b/src/main/java/com/rabbitmq/client/impl/WorkPoolFullException.java index eba1fe14cf..68e7175f1a 100644 --- a/src/main/java/com/rabbitmq/client/impl/WorkPoolFullException.java +++ b/src/main/java/com/rabbitmq/client/impl/WorkPoolFullException.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/nio/ByteBufferOutputStream.java b/src/main/java/com/rabbitmq/client/impl/nio/ByteBufferOutputStream.java index 16fe3f2682..e8ed5ff841 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/ByteBufferOutputStream.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/ByteBufferOutputStream.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/nio/FrameBuilder.java b/src/main/java/com/rabbitmq/client/impl/nio/FrameBuilder.java index bc99531070..8352174360 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/FrameBuilder.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/FrameBuilder.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/nio/FrameWriteRequest.java b/src/main/java/com/rabbitmq/client/impl/nio/FrameWriteRequest.java index 33a5ba5b74..d291a0d3f4 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/FrameWriteRequest.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/FrameWriteRequest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/nio/HeaderWriteRequest.java b/src/main/java/com/rabbitmq/client/impl/nio/HeaderWriteRequest.java index 79e34359c3..558f35e025 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/HeaderWriteRequest.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/HeaderWriteRequest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/nio/NioHelper.java b/src/main/java/com/rabbitmq/client/impl/nio/NioHelper.java index 3438013c1f..ab8a49b71b 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/NioHelper.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/NioHelper.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/nio/NioLoop.java b/src/main/java/com/rabbitmq/client/impl/nio/NioLoop.java index f194eeef42..ae7fa970e9 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/NioLoop.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/NioLoop.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/nio/NioLoopContext.java b/src/main/java/com/rabbitmq/client/impl/nio/NioLoopContext.java index a73a7a0420..55412e0908 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/NioLoopContext.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/NioLoopContext.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java b/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java index fa0f545605..88eedf9145 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/NioParams.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SelectorHolder.java b/src/main/java/com/rabbitmq/client/impl/nio/SelectorHolder.java index 7426280acb..97b64b2be1 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SelectorHolder.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SelectorHolder.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandler.java b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandler.java index d46ce4e0bb..c17c5e9579 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandler.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java index f4473b8ae3..10f550d70a 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerFactory.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerState.java b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerState.java index b5822fcd91..50f08a59f2 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerState.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelFrameHandlerState.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelRegistration.java b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelRegistration.java index 2befb3d3a6..2c9d3f0d03 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelRegistration.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SocketChannelRegistration.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SslEngineByteBufferOutputStream.java b/src/main/java/com/rabbitmq/client/impl/nio/SslEngineByteBufferOutputStream.java index 8ec782613d..c861ad6e77 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SslEngineByteBufferOutputStream.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SslEngineByteBufferOutputStream.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SslEngineFrameBuilder.java b/src/main/java/com/rabbitmq/client/impl/nio/SslEngineFrameBuilder.java index 141bb47293..c2f1923874 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SslEngineFrameBuilder.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SslEngineFrameBuilder.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/nio/SslEngineHelper.java b/src/main/java/com/rabbitmq/client/impl/nio/SslEngineHelper.java index 0de786c7b3..1e7e3a0793 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/SslEngineHelper.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/SslEngineHelper.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/nio/WriteRequest.java b/src/main/java/com/rabbitmq/client/impl/nio/WriteRequest.java index b696bc421f..c61731e18b 100644 --- a/src/main/java/com/rabbitmq/client/impl/nio/WriteRequest.java +++ b/src/main/java/com/rabbitmq/client/impl/nio/WriteRequest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java index 969fb45593..f2afc9d04c 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java index 785d98e5f4..94b24aa7c2 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/BackoffPolicy.java b/src/main/java/com/rabbitmq/client/impl/recovery/BackoffPolicy.java index 6ed2a2deef..08498683ab 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/BackoffPolicy.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/BackoffPolicy.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/ConsumerRecoveryListener.java b/src/main/java/com/rabbitmq/client/impl/recovery/ConsumerRecoveryListener.java index 291528af3e..8c87d86090 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/ConsumerRecoveryListener.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/ConsumerRecoveryListener.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java b/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java index 1fa64afa4e..dc55fc7ed4 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/QueueRecoveryListener.java b/src/main/java/com/rabbitmq/client/impl/recovery/QueueRecoveryListener.java index 55eef2d9f1..66f7f9248f 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/QueueRecoveryListener.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/QueueRecoveryListener.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedBinding.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedBinding.java index 2cdf188ed7..0ddf4e3bcf 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedBinding.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedBinding.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedConsumer.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedConsumer.java index 4aa87a2d0b..3b0d5009d5 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedConsumer.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedConsumer.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedEntity.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedEntity.java index c55a398563..a9fae4c3ae 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedEntity.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedEntity.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedExchange.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedExchange.java index d75530fad6..7625b5a870 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedExchange.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedExchange.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedExchangeBinding.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedExchangeBinding.java index 286b793185..d128b59bf0 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedExchangeBinding.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedExchangeBinding.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedNamedEntity.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedNamedEntity.java index b00a9c2df4..6ea8b6fa96 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedNamedEntity.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedNamedEntity.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java index 6cb43cfdae..3580fe091e 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueueBinding.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueueBinding.java index 09d2636d32..12ed3d48bb 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueueBinding.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueueBinding.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnection.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnection.java index 94768de1db..251f0aaaa1 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnection.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnectionFactory.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnectionFactory.java index 01a172fac3..ab23cc4494 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnectionFactory.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelManager.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelManager.java index b9daf354f2..d8aa7123cb 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelManager.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelManager.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelN.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelN.java index 206c20a1c7..01cf1c74ee 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelN.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareChannelN.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryCanBeginListener.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryCanBeginListener.java index 2c272198b4..cb5eae86fb 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryCanBeginListener.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryCanBeginListener.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RetryContext.java b/src/main/java/com/rabbitmq/client/impl/recovery/RetryContext.java index 60645e199a..6640a7e7c1 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RetryContext.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RetryContext.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RetryHandler.java b/src/main/java/com/rabbitmq/client/impl/recovery/RetryHandler.java index 459ca80080..a5eac40fab 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RetryHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RetryHandler.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RetryResult.java b/src/main/java/com/rabbitmq/client/impl/recovery/RetryResult.java index 6c4e693314..df1d6ae1df 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RetryResult.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RetryResult.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryFilter.java b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryFilter.java index 835249ec55..602b5452f5 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryFilter.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryFilter.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java index c2ad1078d5..bed71f9f0b 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java index 8daa2ac33e..6a91a5202a 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/tools/json/JSONUtil.java b/src/main/java/com/rabbitmq/tools/json/JSONUtil.java index f814462e5e..55c2b695ed 100644 --- a/src/main/java/com/rabbitmq/tools/json/JSONUtil.java +++ b/src/main/java/com/rabbitmq/tools/json/JSONUtil.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java index 8b239eed5b..81a1f26b5b 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JacksonJsonRpcMapper.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java index bea5ccf690..da96560bd5 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcClient.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java index c46b95c259..d167d0318e 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcException.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java index 6e311dc6e4..980428612b 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMapper.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMappingException.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMappingException.java index 6a764e6960..fc998b1b02 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMappingException.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcMappingException.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java index 6cfe8eec98..816ec9d879 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/JsonRpcServer.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/ParameterDescription.java b/src/main/java/com/rabbitmq/tools/jsonrpc/ParameterDescription.java index 6106cbf60c..cc58516b1c 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/ParameterDescription.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/ParameterDescription.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java b/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java index 44ac3a0b76..431d4e6e13 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/ProcedureDescription.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java b/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java index af2029d98c..8986cc24e2 100644 --- a/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java +++ b/src/main/java/com/rabbitmq/tools/jsonrpc/ServiceDescription.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/utility/BlockingCell.java b/src/main/java/com/rabbitmq/utility/BlockingCell.java index 9f9dce24a4..f9c588b7cf 100644 --- a/src/main/java/com/rabbitmq/utility/BlockingCell.java +++ b/src/main/java/com/rabbitmq/utility/BlockingCell.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/utility/BlockingValueOrException.java b/src/main/java/com/rabbitmq/utility/BlockingValueOrException.java index 77df219b72..5946ccbb4d 100644 --- a/src/main/java/com/rabbitmq/utility/BlockingValueOrException.java +++ b/src/main/java/com/rabbitmq/utility/BlockingValueOrException.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/utility/IntAllocator.java b/src/main/java/com/rabbitmq/utility/IntAllocator.java index 9c1e93cd1f..88d9f3efb8 100644 --- a/src/main/java/com/rabbitmq/utility/IntAllocator.java +++ b/src/main/java/com/rabbitmq/utility/IntAllocator.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/utility/SensibleClone.java b/src/main/java/com/rabbitmq/utility/SensibleClone.java index 50405ec0eb..78e68cb6a5 100644 --- a/src/main/java/com/rabbitmq/utility/SensibleClone.java +++ b/src/main/java/com/rabbitmq/utility/SensibleClone.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/utility/Utility.java b/src/main/java/com/rabbitmq/utility/Utility.java index f4cbbf324d..b89639c7d6 100644 --- a/src/main/java/com/rabbitmq/utility/Utility.java +++ b/src/main/java/com/rabbitmq/utility/Utility.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/main/java/com/rabbitmq/utility/ValueOrException.java b/src/main/java/com/rabbitmq/utility/ValueOrException.java index 7be45ef8a2..93cb1fe563 100644 --- a/src/main/java/com/rabbitmq/utility/ValueOrException.java +++ b/src/main/java/com/rabbitmq/utility/ValueOrException.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/AbstractJsonRpcTest.java b/src/test/java/com/rabbitmq/client/AbstractJsonRpcTest.java index 017cb6e308..0b6bc20a68 100644 --- a/src/test/java/com/rabbitmq/client/AbstractJsonRpcTest.java +++ b/src/test/java/com/rabbitmq/client/AbstractJsonRpcTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/JacksonJsonRpcTest.java b/src/test/java/com/rabbitmq/client/JacksonJsonRpcTest.java index af9b827810..e7a57021d4 100644 --- a/src/test/java/com/rabbitmq/client/JacksonJsonRpcTest.java +++ b/src/test/java/com/rabbitmq/client/JacksonJsonRpcTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/QueueingConsumer.java b/src/test/java/com/rabbitmq/client/QueueingConsumer.java index 434e7a8d82..33a033008f 100644 --- a/src/test/java/com/rabbitmq/client/QueueingConsumer.java +++ b/src/test/java/com/rabbitmq/client/QueueingConsumer.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/impl/AMQConnectionRefreshCredentialsTest.java b/src/test/java/com/rabbitmq/client/impl/AMQConnectionRefreshCredentialsTest.java index 50493bcbd0..989ee69ffa 100644 --- a/src/test/java/com/rabbitmq/client/impl/AMQConnectionRefreshCredentialsTest.java +++ b/src/test/java/com/rabbitmq/client/impl/AMQConnectionRefreshCredentialsTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java index 21faa59b15..3bd0cca640 100644 --- a/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java +++ b/src/test/java/com/rabbitmq/client/impl/DefaultCredentialsRefreshServiceTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java b/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java index d81722779d..bcf96c7f1c 100644 --- a/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java +++ b/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProviderTest.java b/src/test/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProviderTest.java index d273b3e70b..a65ed3b6ca 100644 --- a/src/test/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProviderTest.java +++ b/src/test/java/com/rabbitmq/client/impl/RefreshProtectedCredentialsProviderTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java b/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java index ead66ee8ad..ea0d94c683 100644 --- a/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java +++ b/src/test/java/com/rabbitmq/client/impl/ValueWriterTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/impl/WorkPoolTests.java b/src/test/java/com/rabbitmq/client/impl/WorkPoolTests.java index 30141ef9f0..4cc054ca88 100644 --- a/src/test/java/com/rabbitmq/client/impl/WorkPoolTests.java +++ b/src/test/java/com/rabbitmq/client/impl/WorkPoolTests.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/AMQBuilderApiTest.java b/src/test/java/com/rabbitmq/client/test/AMQBuilderApiTest.java index 9d6fb50abb..46241c38b3 100644 --- a/src/test/java/com/rabbitmq/client/test/AMQBuilderApiTest.java +++ b/src/test/java/com/rabbitmq/client/test/AMQBuilderApiTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/AMQChannelTest.java b/src/test/java/com/rabbitmq/client/test/AMQChannelTest.java index 73a8731eea..0ea1a89c60 100644 --- a/src/test/java/com/rabbitmq/client/test/AMQChannelTest.java +++ b/src/test/java/com/rabbitmq/client/test/AMQChannelTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/AMQConnectionTest.java b/src/test/java/com/rabbitmq/client/test/AMQConnectionTest.java index c278b4cc13..e36631de7c 100644 --- a/src/test/java/com/rabbitmq/client/test/AMQConnectionTest.java +++ b/src/test/java/com/rabbitmq/client/test/AMQConnectionTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/AbstractRMQTestSuite.java b/src/test/java/com/rabbitmq/client/test/AbstractRMQTestSuite.java index 70fdbaaa6e..cd1a32a6aa 100644 --- a/src/test/java/com/rabbitmq/client/test/AbstractRMQTestSuite.java +++ b/src/test/java/com/rabbitmq/client/test/AbstractRMQTestSuite.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/AddressTest.java b/src/test/java/com/rabbitmq/client/test/AddressTest.java index ca714b146b..631dc5d986 100644 --- a/src/test/java/com/rabbitmq/client/test/AddressTest.java +++ b/src/test/java/com/rabbitmq/client/test/AddressTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java b/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java index 9b4b467f9c..a57e92da4d 100644 --- a/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java +++ b/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/BlockingCellTest.java b/src/test/java/com/rabbitmq/client/test/BlockingCellTest.java index 7c4ef998b0..b5c7e9a3b0 100644 --- a/src/test/java/com/rabbitmq/client/test/BlockingCellTest.java +++ b/src/test/java/com/rabbitmq/client/test/BlockingCellTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/BrokenFramesTest.java b/src/test/java/com/rabbitmq/client/test/BrokenFramesTest.java index 0d713308d2..0ea3a02793 100644 --- a/src/test/java/com/rabbitmq/client/test/BrokenFramesTest.java +++ b/src/test/java/com/rabbitmq/client/test/BrokenFramesTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java b/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java index cda8d3ca44..d61721ad8b 100644 --- a/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java +++ b/src/test/java/com/rabbitmq/client/test/BrokerTestCase.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/Bug20004Test.java b/src/test/java/com/rabbitmq/client/test/Bug20004Test.java index ac62af0095..63e237d4b1 100644 --- a/src/test/java/com/rabbitmq/client/test/Bug20004Test.java +++ b/src/test/java/com/rabbitmq/client/test/Bug20004Test.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ChannelAsyncCompletableFutureTest.java b/src/test/java/com/rabbitmq/client/test/ChannelAsyncCompletableFutureTest.java index cc1141d116..a871d49455 100644 --- a/src/test/java/com/rabbitmq/client/test/ChannelAsyncCompletableFutureTest.java +++ b/src/test/java/com/rabbitmq/client/test/ChannelAsyncCompletableFutureTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ChannelNTest.java b/src/test/java/com/rabbitmq/client/test/ChannelNTest.java index c955c28071..1568881016 100644 --- a/src/test/java/com/rabbitmq/client/test/ChannelNTest.java +++ b/src/test/java/com/rabbitmq/client/test/ChannelNTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ChannelNumberAllocationTests.java b/src/test/java/com/rabbitmq/client/test/ChannelNumberAllocationTests.java index a3ec4b81f7..aa916529d7 100644 --- a/src/test/java/com/rabbitmq/client/test/ChannelNumberAllocationTests.java +++ b/src/test/java/com/rabbitmq/client/test/ChannelNumberAllocationTests.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java b/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java index 948074580f..2e9c4bf9ed 100644 --- a/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java +++ b/src/test/java/com/rabbitmq/client/test/ChannelRpcTimeoutIntegrationTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ClientTests.java b/src/test/java/com/rabbitmq/client/test/ClientTests.java index 601234b2db..681542ab70 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientTests.java +++ b/src/test/java/com/rabbitmq/client/test/ClientTests.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ClientVersionTest.java b/src/test/java/com/rabbitmq/client/test/ClientVersionTest.java index 9d7560adaf..c2c39284e3 100644 --- a/src/test/java/com/rabbitmq/client/test/ClientVersionTest.java +++ b/src/test/java/com/rabbitmq/client/test/ClientVersionTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ClonePropertiesTest.java b/src/test/java/com/rabbitmq/client/test/ClonePropertiesTest.java index 6e50f31e29..aae4d10e28 100644 --- a/src/test/java/com/rabbitmq/client/test/ClonePropertiesTest.java +++ b/src/test/java/com/rabbitmq/client/test/ClonePropertiesTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/CloseInMainLoop.java b/src/test/java/com/rabbitmq/client/test/CloseInMainLoop.java index 109f8200aa..00e9570136 100644 --- a/src/test/java/com/rabbitmq/client/test/CloseInMainLoop.java +++ b/src/test/java/com/rabbitmq/client/test/CloseInMainLoop.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ConfirmBase.java b/src/test/java/com/rabbitmq/client/test/ConfirmBase.java index 2421bfed40..144ab68564 100644 --- a/src/test/java/com/rabbitmq/client/test/ConfirmBase.java +++ b/src/test/java/com/rabbitmq/client/test/ConfirmBase.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java b/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java index 1846078ff2..a31a4b2ac4 100644 --- a/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java +++ b/src/test/java/com/rabbitmq/client/test/ConnectionFactoryTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ConnectionTest.java b/src/test/java/com/rabbitmq/client/test/ConnectionTest.java index cef3e68a18..c7da088e79 100644 --- a/src/test/java/com/rabbitmq/client/test/ConnectionTest.java +++ b/src/test/java/com/rabbitmq/client/test/ConnectionTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/DefaultRetryHandlerTest.java b/src/test/java/com/rabbitmq/client/test/DefaultRetryHandlerTest.java index c6fe244c51..3aa28efdb9 100644 --- a/src/test/java/com/rabbitmq/client/test/DefaultRetryHandlerTest.java +++ b/src/test/java/com/rabbitmq/client/test/DefaultRetryHandlerTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/DnsSrvRecordAddressResolverTest.java b/src/test/java/com/rabbitmq/client/test/DnsSrvRecordAddressResolverTest.java index e315d1147c..4950cc2323 100644 --- a/src/test/java/com/rabbitmq/client/test/DnsSrvRecordAddressResolverTest.java +++ b/src/test/java/com/rabbitmq/client/test/DnsSrvRecordAddressResolverTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/FrameBuilderTest.java b/src/test/java/com/rabbitmq/client/test/FrameBuilderTest.java index 9c4c4197ec..38fd654f3f 100644 --- a/src/test/java/com/rabbitmq/client/test/FrameBuilderTest.java +++ b/src/test/java/com/rabbitmq/client/test/FrameBuilderTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/GeneratedClassesTest.java b/src/test/java/com/rabbitmq/client/test/GeneratedClassesTest.java index c144e7e3d3..78919bbca6 100644 --- a/src/test/java/com/rabbitmq/client/test/GeneratedClassesTest.java +++ b/src/test/java/com/rabbitmq/client/test/GeneratedClassesTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/LambdaCallbackTest.java b/src/test/java/com/rabbitmq/client/test/LambdaCallbackTest.java index 29505b73ab..0f30f4f83a 100644 --- a/src/test/java/com/rabbitmq/client/test/LambdaCallbackTest.java +++ b/src/test/java/com/rabbitmq/client/test/LambdaCallbackTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/LongStringTest.java b/src/test/java/com/rabbitmq/client/test/LongStringTest.java index 59f9556e2c..7c711b4fe4 100644 --- a/src/test/java/com/rabbitmq/client/test/LongStringTest.java +++ b/src/test/java/com/rabbitmq/client/test/LongStringTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/MetricsCollectorTest.java b/src/test/java/com/rabbitmq/client/test/MetricsCollectorTest.java index 5d424a69a3..9c18b2ac1f 100644 --- a/src/test/java/com/rabbitmq/client/test/MetricsCollectorTest.java +++ b/src/test/java/com/rabbitmq/client/test/MetricsCollectorTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/MicrometerMetricsCollectorTest.java b/src/test/java/com/rabbitmq/client/test/MicrometerMetricsCollectorTest.java index 77798a0088..125d185160 100644 --- a/src/test/java/com/rabbitmq/client/test/MicrometerMetricsCollectorTest.java +++ b/src/test/java/com/rabbitmq/client/test/MicrometerMetricsCollectorTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/MultiThreadedChannel.java b/src/test/java/com/rabbitmq/client/test/MultiThreadedChannel.java index 4790016a40..93a2d1c837 100644 --- a/src/test/java/com/rabbitmq/client/test/MultiThreadedChannel.java +++ b/src/test/java/com/rabbitmq/client/test/MultiThreadedChannel.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/NioDeadlockOnConnectionClosing.java b/src/test/java/com/rabbitmq/client/test/NioDeadlockOnConnectionClosing.java index c9e1607653..0f3984ade7 100644 --- a/src/test/java/com/rabbitmq/client/test/NioDeadlockOnConnectionClosing.java +++ b/src/test/java/com/rabbitmq/client/test/NioDeadlockOnConnectionClosing.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/NoAutoRecoveryWhenTcpWindowIsFullTest.java b/src/test/java/com/rabbitmq/client/test/NoAutoRecoveryWhenTcpWindowIsFullTest.java index 62a237cb83..c4edf038a7 100644 --- a/src/test/java/com/rabbitmq/client/test/NoAutoRecoveryWhenTcpWindowIsFullTest.java +++ b/src/test/java/com/rabbitmq/client/test/NoAutoRecoveryWhenTcpWindowIsFullTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/PropertyFileInitialisationTest.java b/src/test/java/com/rabbitmq/client/test/PropertyFileInitialisationTest.java index 2a140721a5..40138a26d6 100644 --- a/src/test/java/com/rabbitmq/client/test/PropertyFileInitialisationTest.java +++ b/src/test/java/com/rabbitmq/client/test/PropertyFileInitialisationTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/QueueingConsumerTests.java b/src/test/java/com/rabbitmq/client/test/QueueingConsumerTests.java index 01676ade92..ba9d72e47b 100644 --- a/src/test/java/com/rabbitmq/client/test/QueueingConsumerTests.java +++ b/src/test/java/com/rabbitmq/client/test/QueueingConsumerTests.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/RecoveryAwareAMQConnectionFactoryTest.java b/src/test/java/com/rabbitmq/client/test/RecoveryAwareAMQConnectionFactoryTest.java index f09721a036..785b58ec53 100644 --- a/src/test/java/com/rabbitmq/client/test/RecoveryAwareAMQConnectionFactoryTest.java +++ b/src/test/java/com/rabbitmq/client/test/RecoveryAwareAMQConnectionFactoryTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/RecoveryDelayHandlerTest.java b/src/test/java/com/rabbitmq/client/test/RecoveryDelayHandlerTest.java index 7828b5eefe..be9958b487 100644 --- a/src/test/java/com/rabbitmq/client/test/RecoveryDelayHandlerTest.java +++ b/src/test/java/com/rabbitmq/client/test/RecoveryDelayHandlerTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java b/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java index b72c95ee1d..0a0100cbc6 100644 --- a/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java +++ b/src/test/java/com/rabbitmq/client/test/RefreshCredentialsTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/RpcTest.java b/src/test/java/com/rabbitmq/client/test/RpcTest.java index a11544f2b4..eb8673183e 100644 --- a/src/test/java/com/rabbitmq/client/test/RpcTest.java +++ b/src/test/java/com/rabbitmq/client/test/RpcTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/RpcTopologyRecordingTest.java b/src/test/java/com/rabbitmq/client/test/RpcTopologyRecordingTest.java index 1f0f023018..3769218fd7 100644 --- a/src/test/java/com/rabbitmq/client/test/RpcTopologyRecordingTest.java +++ b/src/test/java/com/rabbitmq/client/test/RpcTopologyRecordingTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/SharedThreadPoolTest.java b/src/test/java/com/rabbitmq/client/test/SharedThreadPoolTest.java index a1fe0175f5..747a2805e5 100644 --- a/src/test/java/com/rabbitmq/client/test/SharedThreadPoolTest.java +++ b/src/test/java/com/rabbitmq/client/test/SharedThreadPoolTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/SslContextFactoryTest.java b/src/test/java/com/rabbitmq/client/test/SslContextFactoryTest.java index 4f591221ce..585e74f7a8 100644 --- a/src/test/java/com/rabbitmq/client/test/SslContextFactoryTest.java +++ b/src/test/java/com/rabbitmq/client/test/SslContextFactoryTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/StrictExceptionHandlerTest.java b/src/test/java/com/rabbitmq/client/test/StrictExceptionHandlerTest.java index 06bf5efe7c..fbb3ad984b 100644 --- a/src/test/java/com/rabbitmq/client/test/StrictExceptionHandlerTest.java +++ b/src/test/java/com/rabbitmq/client/test/StrictExceptionHandlerTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/TableTest.java b/src/test/java/com/rabbitmq/client/test/TableTest.java index e750301413..bb07a71f21 100644 --- a/src/test/java/com/rabbitmq/client/test/TableTest.java +++ b/src/test/java/com/rabbitmq/client/test/TableTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/TestUtils.java b/src/test/java/com/rabbitmq/client/test/TestUtils.java index b6cec91132..19d63d8d86 100644 --- a/src/test/java/com/rabbitmq/client/test/TestUtils.java +++ b/src/test/java/com/rabbitmq/client/test/TestUtils.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/TestUtilsTest.java b/src/test/java/com/rabbitmq/client/test/TestUtilsTest.java index 76e5276d7d..b73e8033cc 100644 --- a/src/test/java/com/rabbitmq/client/test/TestUtilsTest.java +++ b/src/test/java/com/rabbitmq/client/test/TestUtilsTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2017-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/TlsUtilsTest.java b/src/test/java/com/rabbitmq/client/test/TlsUtilsTest.java index 078989ca12..f04d22dc1c 100644 --- a/src/test/java/com/rabbitmq/client/test/TlsUtilsTest.java +++ b/src/test/java/com/rabbitmq/client/test/TlsUtilsTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/TrafficListenerTest.java b/src/test/java/com/rabbitmq/client/test/TrafficListenerTest.java index 69c223cf31..ebc25349d4 100644 --- a/src/test/java/com/rabbitmq/client/test/TrafficListenerTest.java +++ b/src/test/java/com/rabbitmq/client/test/TrafficListenerTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/TruncatedInputStreamTest.java b/src/test/java/com/rabbitmq/client/test/TruncatedInputStreamTest.java index 570f15c848..3adc9492a0 100644 --- a/src/test/java/com/rabbitmq/client/test/TruncatedInputStreamTest.java +++ b/src/test/java/com/rabbitmq/client/test/TruncatedInputStreamTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ValueOrExceptionTest.java b/src/test/java/com/rabbitmq/client/test/ValueOrExceptionTest.java index 789dccfa29..1ae80029be 100644 --- a/src/test/java/com/rabbitmq/client/test/ValueOrExceptionTest.java +++ b/src/test/java/com/rabbitmq/client/test/ValueOrExceptionTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/AbstractRejectTest.java b/src/test/java/com/rabbitmq/client/test/functional/AbstractRejectTest.java index 470418c384..8c87db34f1 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/AbstractRejectTest.java +++ b/src/test/java/com/rabbitmq/client/test/functional/AbstractRejectTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/AlternateExchange.java b/src/test/java/com/rabbitmq/client/test/functional/AlternateExchange.java index fc620a5034..8f2dd6675a 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/AlternateExchange.java +++ b/src/test/java/com/rabbitmq/client/test/functional/AlternateExchange.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/BasicGet.java b/src/test/java/com/rabbitmq/client/test/functional/BasicGet.java index 1e854ec495..e64dee9e9a 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/BasicGet.java +++ b/src/test/java/com/rabbitmq/client/test/functional/BasicGet.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycle.java b/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycle.java index 48c82a22ad..91a5c54d49 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycle.java +++ b/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycle.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycleBase.java b/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycleBase.java index ae21a981f5..51c0e93585 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycleBase.java +++ b/src/test/java/com/rabbitmq/client/test/functional/BindingLifecycleBase.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/CcRoutes.java b/src/test/java/com/rabbitmq/client/test/functional/CcRoutes.java index 4782459840..ebb54164a3 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/CcRoutes.java +++ b/src/test/java/com/rabbitmq/client/test/functional/CcRoutes.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/ClusteredTestBase.java b/src/test/java/com/rabbitmq/client/test/functional/ClusteredTestBase.java index c3ae467c4f..06f53f715a 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ClusteredTestBase.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ClusteredTestBase.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/Confirm.java b/src/test/java/com/rabbitmq/client/test/functional/Confirm.java index 9f0860b820..0c427bd261 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Confirm.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Confirm.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/ConnectionOpen.java b/src/test/java/com/rabbitmq/client/test/functional/ConnectionOpen.java index 9f99ba1797..22fe19e326 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ConnectionOpen.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ConnectionOpen.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/ConnectionRecovery.java b/src/test/java/com/rabbitmq/client/test/functional/ConnectionRecovery.java index 426e3c2c0f..ac43c15faf 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ConnectionRecovery.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ConnectionRecovery.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/ConsumerCancelNotification.java b/src/test/java/com/rabbitmq/client/test/functional/ConsumerCancelNotification.java index 082725531b..1c68176d76 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ConsumerCancelNotification.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ConsumerCancelNotification.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/ConsumerCount.java b/src/test/java/com/rabbitmq/client/test/functional/ConsumerCount.java index 73f91a5e10..b0ba1c3206 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ConsumerCount.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ConsumerCount.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/ConsumerPriorities.java b/src/test/java/com/rabbitmq/client/test/functional/ConsumerPriorities.java index a3eebd85bb..10bde1f0f1 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ConsumerPriorities.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ConsumerPriorities.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java b/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java index fa6124ce16..36c09add6a 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java +++ b/src/test/java/com/rabbitmq/client/test/functional/DeadLetterExchange.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/DefaultExchange.java b/src/test/java/com/rabbitmq/client/test/functional/DefaultExchange.java index df2ceb5fdd..7d0e9f7899 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/DefaultExchange.java +++ b/src/test/java/com/rabbitmq/client/test/functional/DefaultExchange.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/DirectReplyTo.java b/src/test/java/com/rabbitmq/client/test/functional/DirectReplyTo.java index c8d1befec1..2cef783ba1 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/DirectReplyTo.java +++ b/src/test/java/com/rabbitmq/client/test/functional/DirectReplyTo.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/DoubleDeletion.java b/src/test/java/com/rabbitmq/client/test/functional/DoubleDeletion.java index 20b87d7312..14f6dee293 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/DoubleDeletion.java +++ b/src/test/java/com/rabbitmq/client/test/functional/DoubleDeletion.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/DurableOnTransient.java b/src/test/java/com/rabbitmq/client/test/functional/DurableOnTransient.java index dc9f5d5155..cfc00d7b0a 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/DurableOnTransient.java +++ b/src/test/java/com/rabbitmq/client/test/functional/DurableOnTransient.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/ExceptionHandling.java b/src/test/java/com/rabbitmq/client/test/functional/ExceptionHandling.java index f0c73fcd17..611a8eea82 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ExceptionHandling.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ExceptionHandling.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/ExceptionMessages.java b/src/test/java/com/rabbitmq/client/test/functional/ExceptionMessages.java index d2810dcb94..68f4da2204 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ExceptionMessages.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ExceptionMessages.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeclare.java b/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeclare.java index 5578560302..7c1e6f2e76 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeclare.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeclare.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeleteIfUnused.java b/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeleteIfUnused.java index ec763486f0..bbaf6b323c 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeleteIfUnused.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeleteIfUnused.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeletePredeclared.java b/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeletePredeclared.java index ee25ca6232..28d4d667f6 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeletePredeclared.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ExchangeDeletePredeclared.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/ExchangeEquivalenceBase.java b/src/test/java/com/rabbitmq/client/test/functional/ExchangeEquivalenceBase.java index f2f3916ca5..830a2b89e5 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ExchangeEquivalenceBase.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ExchangeEquivalenceBase.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/ExchangeExchangeBindings.java b/src/test/java/com/rabbitmq/client/test/functional/ExchangeExchangeBindings.java index b3ed2f5a3a..cc50182001 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ExchangeExchangeBindings.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ExchangeExchangeBindings.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/ExchangeExchangeBindingsAutoDelete.java b/src/test/java/com/rabbitmq/client/test/functional/ExchangeExchangeBindingsAutoDelete.java index 15f63fbd48..ff8cb0a846 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/ExchangeExchangeBindingsAutoDelete.java +++ b/src/test/java/com/rabbitmq/client/test/functional/ExchangeExchangeBindingsAutoDelete.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/FrameMax.java b/src/test/java/com/rabbitmq/client/test/functional/FrameMax.java index ac1e98e7e6..bfe1bcd826 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/FrameMax.java +++ b/src/test/java/com/rabbitmq/client/test/functional/FrameMax.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/FunctionalTests.java b/src/test/java/com/rabbitmq/client/test/functional/FunctionalTests.java index f8a89554a5..db87a38695 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/FunctionalTests.java +++ b/src/test/java/com/rabbitmq/client/test/functional/FunctionalTests.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/HeadersExchangeValidation.java b/src/test/java/com/rabbitmq/client/test/functional/HeadersExchangeValidation.java index 2ff1a36781..b2eeee7719 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/HeadersExchangeValidation.java +++ b/src/test/java/com/rabbitmq/client/test/functional/HeadersExchangeValidation.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/Heartbeat.java b/src/test/java/com/rabbitmq/client/test/functional/Heartbeat.java index b4f9c9b756..62611f2a35 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Heartbeat.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Heartbeat.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/InternalExchange.java b/src/test/java/com/rabbitmq/client/test/functional/InternalExchange.java index cfb705b06b..43a571afc8 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/InternalExchange.java +++ b/src/test/java/com/rabbitmq/client/test/functional/InternalExchange.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/InvalidAcks.java b/src/test/java/com/rabbitmq/client/test/functional/InvalidAcks.java index dff81c600b..217c55e1c9 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/InvalidAcks.java +++ b/src/test/java/com/rabbitmq/client/test/functional/InvalidAcks.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/InvalidAcksBase.java b/src/test/java/com/rabbitmq/client/test/functional/InvalidAcksBase.java index 025954022f..1c249007bd 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/InvalidAcksBase.java +++ b/src/test/java/com/rabbitmq/client/test/functional/InvalidAcksBase.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/InvalidAcksTx.java b/src/test/java/com/rabbitmq/client/test/functional/InvalidAcksTx.java index 635929bb4b..81fc7e61f7 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/InvalidAcksTx.java +++ b/src/test/java/com/rabbitmq/client/test/functional/InvalidAcksTx.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/MessageCount.java b/src/test/java/com/rabbitmq/client/test/functional/MessageCount.java index a8d302a55a..3cb81344af 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/MessageCount.java +++ b/src/test/java/com/rabbitmq/client/test/functional/MessageCount.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/Metrics.java b/src/test/java/com/rabbitmq/client/test/functional/Metrics.java index 3e2dc6df74..67e25960a7 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Metrics.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Metrics.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/Nack.java b/src/test/java/com/rabbitmq/client/test/functional/Nack.java index 5b39638d78..61c10e589a 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Nack.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Nack.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/NoRequeueOnCancel.java b/src/test/java/com/rabbitmq/client/test/functional/NoRequeueOnCancel.java index 829cf3d25f..41d68d94d5 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/NoRequeueOnCancel.java +++ b/src/test/java/com/rabbitmq/client/test/functional/NoRequeueOnCancel.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/Nowait.java b/src/test/java/com/rabbitmq/client/test/functional/Nowait.java index af79b0d195..5f713fff61 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Nowait.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Nowait.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/PerConsumerPrefetch.java b/src/test/java/com/rabbitmq/client/test/functional/PerConsumerPrefetch.java index 16a1cfdf95..4a36a22052 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/PerConsumerPrefetch.java +++ b/src/test/java/com/rabbitmq/client/test/functional/PerConsumerPrefetch.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/PerMessageTTL.java b/src/test/java/com/rabbitmq/client/test/functional/PerMessageTTL.java index 0b25fbe699..ab09bdbfdd 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/PerMessageTTL.java +++ b/src/test/java/com/rabbitmq/client/test/functional/PerMessageTTL.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/PerQueueTTL.java b/src/test/java/com/rabbitmq/client/test/functional/PerQueueTTL.java index 55c44e6cb3..506ea50c8f 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/PerQueueTTL.java +++ b/src/test/java/com/rabbitmq/client/test/functional/PerQueueTTL.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/PerQueueVsPerMessageTTL.java b/src/test/java/com/rabbitmq/client/test/functional/PerQueueVsPerMessageTTL.java index f4c9914bda..58475877be 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/PerQueueVsPerMessageTTL.java +++ b/src/test/java/com/rabbitmq/client/test/functional/PerQueueVsPerMessageTTL.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/Policies.java b/src/test/java/com/rabbitmq/client/test/functional/Policies.java index 8f86294766..f4d1dd4988 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Policies.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Policies.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/QosTests.java b/src/test/java/com/rabbitmq/client/test/functional/QosTests.java index 1634741a83..276a363f4e 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/QosTests.java +++ b/src/test/java/com/rabbitmq/client/test/functional/QosTests.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/QueueExclusivity.java b/src/test/java/com/rabbitmq/client/test/functional/QueueExclusivity.java index 3351b1d1a6..6148ebab27 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/QueueExclusivity.java +++ b/src/test/java/com/rabbitmq/client/test/functional/QueueExclusivity.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/QueueLease.java b/src/test/java/com/rabbitmq/client/test/functional/QueueLease.java index 3ec1986792..284f6bd67d 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/QueueLease.java +++ b/src/test/java/com/rabbitmq/client/test/functional/QueueLease.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/QueueLifecycle.java b/src/test/java/com/rabbitmq/client/test/functional/QueueLifecycle.java index c082a91c41..8ee54671dc 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/QueueLifecycle.java +++ b/src/test/java/com/rabbitmq/client/test/functional/QueueLifecycle.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/QueueSizeLimit.java b/src/test/java/com/rabbitmq/client/test/functional/QueueSizeLimit.java index fd4c26343e..8d34862543 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/QueueSizeLimit.java +++ b/src/test/java/com/rabbitmq/client/test/functional/QueueSizeLimit.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/Recover.java b/src/test/java/com/rabbitmq/client/test/functional/Recover.java index 654846648f..61d48973ce 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Recover.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Recover.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/Reject.java b/src/test/java/com/rabbitmq/client/test/functional/Reject.java index 11f3d52d37..2d296a13ea 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Reject.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Reject.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/RequeueOnChannelClose.java b/src/test/java/com/rabbitmq/client/test/functional/RequeueOnChannelClose.java index 6b1eb781a0..8e6c0c6f9e 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/RequeueOnChannelClose.java +++ b/src/test/java/com/rabbitmq/client/test/functional/RequeueOnChannelClose.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/RequeueOnClose.java b/src/test/java/com/rabbitmq/client/test/functional/RequeueOnClose.java index 1900f97218..e86ed31bdf 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/RequeueOnClose.java +++ b/src/test/java/com/rabbitmq/client/test/functional/RequeueOnClose.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/RequeueOnConnectionClose.java b/src/test/java/com/rabbitmq/client/test/functional/RequeueOnConnectionClose.java index 6af8d01dd2..c212512a95 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/RequeueOnConnectionClose.java +++ b/src/test/java/com/rabbitmq/client/test/functional/RequeueOnConnectionClose.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/Routing.java b/src/test/java/com/rabbitmq/client/test/functional/Routing.java index cfaf9eb38b..050eb379b0 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Routing.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Routing.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/SaslMechanisms.java b/src/test/java/com/rabbitmq/client/test/functional/SaslMechanisms.java index 1d769f8a10..631d21a2a5 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/SaslMechanisms.java +++ b/src/test/java/com/rabbitmq/client/test/functional/SaslMechanisms.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/TTLHandling.java b/src/test/java/com/rabbitmq/client/test/functional/TTLHandling.java index 26d501e35f..4a2b23ae5c 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/TTLHandling.java +++ b/src/test/java/com/rabbitmq/client/test/functional/TTLHandling.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/Tables.java b/src/test/java/com/rabbitmq/client/test/functional/Tables.java index ad631596e9..6f8f1854a8 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Tables.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Tables.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryFiltering.java b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryFiltering.java index 27c210639c..3798ddf70a 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryFiltering.java +++ b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryFiltering.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java index 215645fcaf..ffc744bb86 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java +++ b/src/test/java/com/rabbitmq/client/test/functional/TopologyRecoveryRetry.java @@ -1,7 +1,7 @@ // Copyright (c) 2018-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/Transactions.java b/src/test/java/com/rabbitmq/client/test/functional/Transactions.java index 25fb8410c5..3e3d66883b 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Transactions.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Transactions.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/UnbindAutoDeleteExchange.java b/src/test/java/com/rabbitmq/client/test/functional/UnbindAutoDeleteExchange.java index fcafc73ebb..29c4faa2b4 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/UnbindAutoDeleteExchange.java +++ b/src/test/java/com/rabbitmq/client/test/functional/UnbindAutoDeleteExchange.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/UnexpectedFrames.java b/src/test/java/com/rabbitmq/client/test/functional/UnexpectedFrames.java index de118e90dd..e028c3cf47 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/UnexpectedFrames.java +++ b/src/test/java/com/rabbitmq/client/test/functional/UnexpectedFrames.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/functional/UserIDHeader.java b/src/test/java/com/rabbitmq/client/test/functional/UserIDHeader.java index 17db1bc8a8..d776029df5 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/UserIDHeader.java +++ b/src/test/java/com/rabbitmq/client/test/functional/UserIDHeader.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/AbsentQueue.java b/src/test/java/com/rabbitmq/client/test/server/AbsentQueue.java index 886820c094..a0e857d828 100644 --- a/src/test/java/com/rabbitmq/client/test/server/AbsentQueue.java +++ b/src/test/java/com/rabbitmq/client/test/server/AbsentQueue.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/AlternateExchangeEquivalence.java b/src/test/java/com/rabbitmq/client/test/server/AlternateExchangeEquivalence.java index fbc019b263..676dac7015 100644 --- a/src/test/java/com/rabbitmq/client/test/server/AlternateExchangeEquivalence.java +++ b/src/test/java/com/rabbitmq/client/test/server/AlternateExchangeEquivalence.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/BlockedConnection.java b/src/test/java/com/rabbitmq/client/test/server/BlockedConnection.java index 30e07d3a2c..4856ea151b 100644 --- a/src/test/java/com/rabbitmq/client/test/server/BlockedConnection.java +++ b/src/test/java/com/rabbitmq/client/test/server/BlockedConnection.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/Bug19219Test.java b/src/test/java/com/rabbitmq/client/test/server/Bug19219Test.java index 7f48b7aeb4..e16d40d731 100644 --- a/src/test/java/com/rabbitmq/client/test/server/Bug19219Test.java +++ b/src/test/java/com/rabbitmq/client/test/server/Bug19219Test.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/ChannelLimitNegotiation.java b/src/test/java/com/rabbitmq/client/test/server/ChannelLimitNegotiation.java index cd8a99ed34..a890f2ca66 100644 --- a/src/test/java/com/rabbitmq/client/test/server/ChannelLimitNegotiation.java +++ b/src/test/java/com/rabbitmq/client/test/server/ChannelLimitNegotiation.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/DeadLetterExchangeDurable.java b/src/test/java/com/rabbitmq/client/test/server/DeadLetterExchangeDurable.java index 8ee7169797..312ce61810 100644 --- a/src/test/java/com/rabbitmq/client/test/server/DeadLetterExchangeDurable.java +++ b/src/test/java/com/rabbitmq/client/test/server/DeadLetterExchangeDurable.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/DurableBindingLifecycle.java b/src/test/java/com/rabbitmq/client/test/server/DurableBindingLifecycle.java index a8c4ff6b8d..5be557cd3d 100644 --- a/src/test/java/com/rabbitmq/client/test/server/DurableBindingLifecycle.java +++ b/src/test/java/com/rabbitmq/client/test/server/DurableBindingLifecycle.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/EffectVisibilityCrossNodeTest.java b/src/test/java/com/rabbitmq/client/test/server/EffectVisibilityCrossNodeTest.java index 0aa40943fe..b4c9a0bc6a 100644 --- a/src/test/java/com/rabbitmq/client/test/server/EffectVisibilityCrossNodeTest.java +++ b/src/test/java/com/rabbitmq/client/test/server/EffectVisibilityCrossNodeTest.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/ExclusiveQueueDurability.java b/src/test/java/com/rabbitmq/client/test/server/ExclusiveQueueDurability.java index 7d931f12cf..2be62c3c9e 100644 --- a/src/test/java/com/rabbitmq/client/test/server/ExclusiveQueueDurability.java +++ b/src/test/java/com/rabbitmq/client/test/server/ExclusiveQueueDurability.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/Firehose.java b/src/test/java/com/rabbitmq/client/test/server/Firehose.java index 56b0cdcb10..28064a1383 100644 --- a/src/test/java/com/rabbitmq/client/test/server/Firehose.java +++ b/src/test/java/com/rabbitmq/client/test/server/Firehose.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/HATests.java b/src/test/java/com/rabbitmq/client/test/server/HATests.java index 8918098f5d..d4078c4ac2 100644 --- a/src/test/java/com/rabbitmq/client/test/server/HATests.java +++ b/src/test/java/com/rabbitmq/client/test/server/HATests.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/LoopbackUsers.java b/src/test/java/com/rabbitmq/client/test/server/LoopbackUsers.java index d9b7be93b1..44f323ab95 100644 --- a/src/test/java/com/rabbitmq/client/test/server/LoopbackUsers.java +++ b/src/test/java/com/rabbitmq/client/test/server/LoopbackUsers.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/MemoryAlarms.java b/src/test/java/com/rabbitmq/client/test/server/MemoryAlarms.java index b664e7b62e..690a77ddcd 100644 --- a/src/test/java/com/rabbitmq/client/test/server/MemoryAlarms.java +++ b/src/test/java/com/rabbitmq/client/test/server/MemoryAlarms.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/MessageRecovery.java b/src/test/java/com/rabbitmq/client/test/server/MessageRecovery.java index 4080fdce8c..f59e4ced96 100644 --- a/src/test/java/com/rabbitmq/client/test/server/MessageRecovery.java +++ b/src/test/java/com/rabbitmq/client/test/server/MessageRecovery.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/Permissions.java b/src/test/java/com/rabbitmq/client/test/server/Permissions.java index 24c25a4391..c67d0cc0c6 100644 --- a/src/test/java/com/rabbitmq/client/test/server/Permissions.java +++ b/src/test/java/com/rabbitmq/client/test/server/Permissions.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/PersistenceGuarantees.java b/src/test/java/com/rabbitmq/client/test/server/PersistenceGuarantees.java index 42846db2a1..69bc8093b4 100644 --- a/src/test/java/com/rabbitmq/client/test/server/PersistenceGuarantees.java +++ b/src/test/java/com/rabbitmq/client/test/server/PersistenceGuarantees.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/PriorityQueues.java b/src/test/java/com/rabbitmq/client/test/server/PriorityQueues.java index 805b5c6fc4..76c34dbbeb 100644 --- a/src/test/java/com/rabbitmq/client/test/server/PriorityQueues.java +++ b/src/test/java/com/rabbitmq/client/test/server/PriorityQueues.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/ServerTests.java b/src/test/java/com/rabbitmq/client/test/server/ServerTests.java index bda7cac3fd..a532586e40 100644 --- a/src/test/java/com/rabbitmq/client/test/server/ServerTests.java +++ b/src/test/java/com/rabbitmq/client/test/server/ServerTests.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/Shutdown.java b/src/test/java/com/rabbitmq/client/test/server/Shutdown.java index 53cd63c184..8d7194bd38 100644 --- a/src/test/java/com/rabbitmq/client/test/server/Shutdown.java +++ b/src/test/java/com/rabbitmq/client/test/server/Shutdown.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/TopicPermissions.java b/src/test/java/com/rabbitmq/client/test/server/TopicPermissions.java index c258e7a773..5b79de1387 100644 --- a/src/test/java/com/rabbitmq/client/test/server/TopicPermissions.java +++ b/src/test/java/com/rabbitmq/client/test/server/TopicPermissions.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/server/XDeathHeaderGrowth.java b/src/test/java/com/rabbitmq/client/test/server/XDeathHeaderGrowth.java index 4aa0839f39..fb65d954b3 100644 --- a/src/test/java/com/rabbitmq/client/test/server/XDeathHeaderGrowth.java +++ b/src/test/java/com/rabbitmq/client/test/server/XDeathHeaderGrowth.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ssl/BadVerifiedConnection.java b/src/test/java/com/rabbitmq/client/test/ssl/BadVerifiedConnection.java index 9b9e291314..9137213578 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/BadVerifiedConnection.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/BadVerifiedConnection.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ssl/ConnectionFactoryDefaultTlsVersion.java b/src/test/java/com/rabbitmq/client/test/ssl/ConnectionFactoryDefaultTlsVersion.java index 0ffbc52df5..dde98277d4 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/ConnectionFactoryDefaultTlsVersion.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/ConnectionFactoryDefaultTlsVersion.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java index 9fef361381..014c02cfdd 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/HostnameVerification.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ssl/NioTlsUnverifiedConnection.java b/src/test/java/com/rabbitmq/client/test/ssl/NioTlsUnverifiedConnection.java index 4c22736e8b..29fe35899e 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/NioTlsUnverifiedConnection.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/NioTlsUnverifiedConnection.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java b/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java index 1dddf62e38..3d629d15ea 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/SSLTests.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java b/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java index 845e0a476c..49b9ac3ad9 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/TlsConnectionLogging.java @@ -1,7 +1,7 @@ // Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ssl/UnverifiedConnection.java b/src/test/java/com/rabbitmq/client/test/ssl/UnverifiedConnection.java index dd041fef5c..a14a257c24 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/UnverifiedConnection.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/UnverifiedConnection.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/client/test/ssl/VerifiedConnection.java b/src/test/java/com/rabbitmq/client/test/ssl/VerifiedConnection.java index 52c3763064..50d4d9003b 100644 --- a/src/test/java/com/rabbitmq/client/test/ssl/VerifiedConnection.java +++ b/src/test/java/com/rabbitmq/client/test/ssl/VerifiedConnection.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/tools/Host.java b/src/test/java/com/rabbitmq/tools/Host.java index 91f4c68f50..f1adeded61 100644 --- a/src/test/java/com/rabbitmq/tools/Host.java +++ b/src/test/java/com/rabbitmq/tools/Host.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. diff --git a/src/test/java/com/rabbitmq/utility/IntAllocatorTests.java b/src/test/java/com/rabbitmq/utility/IntAllocatorTests.java index 1dbdfa95a6..d29e134442 100644 --- a/src/test/java/com/rabbitmq/utility/IntAllocatorTests.java +++ b/src/test/java/com/rabbitmq/utility/IntAllocatorTests.java @@ -1,7 +1,7 @@ // Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved. // // This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 // ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see // LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, // please see LICENSE-APACHE2. From 6da919044a1831d3f1a6f56d981f8f0e53b08284 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Fri, 17 Jul 2020 16:28:44 +0300 Subject: [PATCH 219/328] Drop Exhibit B from our MPL2 file (cherry picked from commit cd331898ea3791f2d4ef3ccbb17dc4e1c6a3f6c3) --- LICENSE-MPL-RabbitMQ | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/LICENSE-MPL-RabbitMQ b/LICENSE-MPL-RabbitMQ index 14e2f777f6..b30605c3b1 100644 --- a/LICENSE-MPL-RabbitMQ +++ b/LICENSE-MPL-RabbitMQ @@ -35,7 +35,7 @@ Mozilla Public License Version 2.0 means any form of the work other than Source Code Form. 1.7. "Larger Work" - means a work that combines Covered Software with other material, in + means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software. 1.8. "License" @@ -364,10 +364,4 @@ file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice ---------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. +Copyright (c) 2007-2020 VMware, Inc. or its affiliates. From f149e482df3c56ed44b3ec4dc33a94e9332b3471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 21 Jul 2020 18:00:52 +0200 Subject: [PATCH 220/328] Use MPL 2.0 in pom.xml (cherry picked from commit 283902d3ed7e42098b60cbbf95154aa93a741dbd) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index f9f31bc6a5..3042444b47 100644 --- a/pom.xml +++ b/pom.xml @@ -23,8 +23,8 @@ repo - MPL 1.1 - https://www.mozilla.org/MPL/MPL-1.1.txt + MPL 2.0 + https://www.mozilla.org/en-US/MPL/2.0/ repo From 9d5f9e902cc066d858a2a50a2e19f8776d4b2114 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Oct 2020 23:15:29 +0000 Subject: [PATCH 221/328] Bump junit from 4.13 to 4.13.1 Bumps [junit](https://github.com/junit-team/junit4) from 4.13 to 4.13.1. - [Release notes](https://github.com/junit-team/junit4/releases) - [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md) - [Commits](https://github.com/junit-team/junit4/compare/r4.13...r4.13.1) Signed-off-by: dependabot[bot] (cherry picked from commit ed63367a63308893c04a0038e721f41a42272e39) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3042444b47..0f2b9911e2 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,7 @@ 1.4.1 2.10.3 1.2.3 - 4.13 + 4.13.1 3.3.3 3.15.0 9.4.27.v20200227 From 6a686264aaec141790f1f0168d867b3c3e39819e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 14 Oct 2020 10:16:22 +0200 Subject: [PATCH 222/328] Bump dependencies References #660 (cherry picked from commit 7feb61ebd84e2a09c4e9e1403c9f6a16e29d433e) Conflicts: pom.xml --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 0f2b9911e2..2679eddad6 100644 --- a/pom.xml +++ b/pom.xml @@ -55,9 +55,9 @@ UTF-8 1.7.30 - 4.1.5 - 1.4.1 - 2.10.3 + 4.1.13 + 1.5.5 + 2.11.3 1.2.3 4.13.1 3.3.3 From cd182872defc4737a3ac62f83eb1c0bd15f112b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 14 Oct 2020 10:17:21 +0200 Subject: [PATCH 223/328] Bump test dependencies (cherry picked from commit 04a5e5c296e8b0a8df7e76940edf4255b3800045) --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 2679eddad6..5bf24198ed 100644 --- a/pom.xml +++ b/pom.xml @@ -60,10 +60,10 @@ 2.11.3 1.2.3 4.13.1 - 3.3.3 - 3.15.0 - 9.4.27.v20200227 - 1.64 + 3.5.13 + 3.17.2 + 9.4.32.v20200930 + 1.66 3.2.0 2.5.3 From d37a09f784255fe4e9f83b1dbd3fe837b59677b1 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Wed, 14 Oct 2020 13:52:25 +0000 Subject: [PATCH 224/328] [maven-release-plugin] prepare release v5.10.0.RC1 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5bf24198ed..54862f41d3 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.10.0-SNAPSHOT + 5.10.0.RC1 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.10.0.RC1 From 599e1e889cdf0e1e1416a6442b817b01c92952d8 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Wed, 14 Oct 2020 13:52:31 +0000 Subject: [PATCH 225/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 54862f41d3..5bf24198ed 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.10.0.RC1 + 5.10.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.10.0.RC1 + HEAD From afbb7d32ddb5f9d545a62f43b82ee36212ad932b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 14 Oct 2020 16:14:12 +0200 Subject: [PATCH 226/328] Set release version to 5.10.0.RC2 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index 643407832b..f87d576a21 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,3 +1,3 @@ -RELEASE_VERSION="5.10.0.RC1" +RELEASE_VERSION="5.10.0.RC2" DEVELOPMENT_VERSION="5.10.0-SNAPSHOT" RELEASE_BRANCH="5.x.x-stable" From 700fe97e948ce98001323ed54ba4520d4db69fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 19 Oct 2020 12:04:28 +0200 Subject: [PATCH 227/328] Clean state in AutorecoveringChannel#abort Fixes #661 (cherry picked from commit 4d6847f8573d19b64f15443895ad3413303ac1f5) --- .../impl/recovery/AutorecoveringChannel.java | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java index f2afc9d04c..545b26c3ed 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java @@ -17,6 +17,7 @@ import com.rabbitmq.client.*; import com.rabbitmq.client.impl.AMQCommand; +import com.rabbitmq.client.impl.recovery.Utils.IoTimeoutExceptionRunnable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -69,33 +70,41 @@ public Channel getDelegate() { @Override public void close() throws IOException, TimeoutException { - try { - delegate.close(); - } finally { - for (String consumerTag : consumerTags) { - this.connection.deleteRecordedConsumer(consumerTag); - } - this.connection.unregisterChannel(this); - } + executeAndClean(() -> delegate.close()); } @Override public void close(int closeCode, String closeMessage) throws IOException, TimeoutException { - try { - delegate.close(closeCode, closeMessage); - } finally { - this.connection.unregisterChannel(this); - } + executeAndClean(() -> delegate.close(closeCode, closeMessage)); } @Override public void abort() throws IOException { - delegate.abort(); + try { + executeAndClean(() -> delegate.abort()); + } catch (TimeoutException e) { + // abort() ignores exceptions + } } @Override public void abort(int closeCode, String closeMessage) throws IOException { - delegate.abort(closeCode, closeMessage); + try { + executeAndClean(() -> delegate.abort(closeCode, closeMessage)); + } catch (TimeoutException e) { + // abort() ignores exceptions + } + } + + private void executeAndClean(IoTimeoutExceptionRunnable callback) throws IOException, TimeoutException { + try { + callback.run(); + } finally { + for (String consumerTag : consumerTags) { + this.connection.deleteRecordedConsumer(consumerTag); + } + this.connection.unregisterChannel(this); + } } @Override From 2f4d11236583fa5986f380b3d85800709a410c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 19 Oct 2020 12:07:27 +0200 Subject: [PATCH 228/328] Add missing class (cherry picked from commit 35739f24b578699760edbeddb7a7b6b9194cc371) --- .../rabbitmq/client/impl/recovery/Utils.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/main/java/com/rabbitmq/client/impl/recovery/Utils.java diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/Utils.java b/src/main/java/com/rabbitmq/client/impl/recovery/Utils.java new file mode 100644 index 0000000000..569f9da73a --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/recovery/Utils.java @@ -0,0 +1,32 @@ +// Copyright (c) 2020 VMware, Inc. or its affiliates. All rights reserved. +// +// This software, the RabbitMQ Java client library, is triple-licensed under the +// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2 +// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see +// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, +// please see LICENSE-APACHE2. +// +// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, +// either express or implied. See the LICENSE file for specific language governing +// rights and limitations of this software. +// +// If you have any questions regarding licensing, please contact us at +// info@rabbitmq.com. + +package com.rabbitmq.client.impl.recovery; + +import java.io.IOException; +import java.util.concurrent.TimeoutException; + +final class Utils { + + private Utils() {} + + @FunctionalInterface + interface IoTimeoutExceptionRunnable { + + void run() throws IOException, TimeoutException; + + } + +} From e8e719ea51cfbf3b0ec880a1f5da7c064476db27 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Wed, 21 Oct 2020 08:19:19 +0000 Subject: [PATCH 229/328] [maven-release-plugin] prepare release v5.10.0.RC2 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5bf24198ed..b3a844fc8f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.10.0-SNAPSHOT + 5.10.0.RC2 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.10.0.RC2 From 37db0e876989afc607fbd9504bdb203c668ac2d0 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Wed, 21 Oct 2020 08:19:26 +0000 Subject: [PATCH 230/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index b3a844fc8f..5bf24198ed 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.10.0.RC2 + 5.10.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.10.0.RC2 + HEAD From 42aaeda49d38f318ca4c492a88e6aa1f03b928b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 21 Oct 2020 10:23:55 +0200 Subject: [PATCH 231/328] Set release version to 5.10.0.RC3 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index f87d576a21..f39fade999 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,3 +1,3 @@ -RELEASE_VERSION="5.10.0.RC2" +RELEASE_VERSION="5.10.0.RC3" DEVELOPMENT_VERSION="5.10.0-SNAPSHOT" RELEASE_BRANCH="5.x.x-stable" From 82e9db804fdc691e273b105b3f53200009cc2664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 23 Oct 2020 13:57:30 +0200 Subject: [PATCH 232/328] Set release version to 5.10.0 --- release-versions.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release-versions.txt b/release-versions.txt index f39fade999..382b6cd0ef 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,3 +1,3 @@ -RELEASE_VERSION="5.10.0.RC3" -DEVELOPMENT_VERSION="5.10.0-SNAPSHOT" +RELEASE_VERSION="5.10.0" +DEVELOPMENT_VERSION="5.11.0-SNAPSHOT" RELEASE_BRANCH="5.x.x-stable" From 0d95b0e4bbf740f959f6387ee7398fcc144924a6 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 23 Oct 2020 12:01:00 +0000 Subject: [PATCH 233/328] [maven-release-plugin] prepare release v5.10.0 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5bf24198ed..11e7900be5 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.10.0-SNAPSHOT + 5.10.0 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.10.0 From f9fb1f2a8e65834dd6238bbc84eaaf788ba909f2 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 23 Oct 2020 12:01:06 +0000 Subject: [PATCH 234/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 11e7900be5..a36f78c52d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.10.0 + 5.11.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.10.0 + HEAD From 48a61952aabf59df50a9fe29587c9a0b8ee0a403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 23 Oct 2020 14:04:05 +0200 Subject: [PATCH 235/328] Set release version to 5.11.0.RC1 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index 382b6cd0ef..0a6a0327d6 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,3 +1,3 @@ -RELEASE_VERSION="5.10.0" +RELEASE_VERSION="5.11.0.RC1" DEVELOPMENT_VERSION="5.11.0-SNAPSHOT" RELEASE_BRANCH="5.x.x-stable" From 7f81af288876d1a0a635701f8729ad1d11d0fda2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 23 Oct 2020 14:39:22 +0200 Subject: [PATCH 236/328] Bump metrics dependency References #662 (cherry picked from commit 661d6a1da71523dec3bf091075e8c192370e4d30) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a36f78c52d..bc4d5fc2fa 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,7 @@ UTF-8 1.7.30 - 4.1.13 + 4.1.14 1.5.5 2.11.3 1.2.3 From 8153a007b8b0975ec44a876b96e916ff2eea072c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 23 Oct 2020 14:40:00 +0200 Subject: [PATCH 237/328] Bump test dependencies (cherry picked from commit 0a82f8ec78c849ac5f2b758d003f8e2a88dd7c16) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index bc4d5fc2fa..0b51d5f5ea 100644 --- a/pom.xml +++ b/pom.xml @@ -60,9 +60,9 @@ 2.11.3 1.2.3 4.13.1 - 3.5.13 + 3.5.15 3.17.2 - 9.4.32.v20200930 + 9.4.33.v20201020 1.66 3.2.0 From ebf83091291086a9949b2f1304917a0c0f43dbcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 2 Nov 2020 15:40:38 +0100 Subject: [PATCH 238/328] Don't create server-named quorum queues in tests This is no longer allowed in 3.9. (cherry picked from commit 8777491622cdad8fd1edd92cc1e3b00e64f4fb69) Conflicts: src/test/java/com/rabbitmq/client/test/functional/Nack.java src/test/java/com/rabbitmq/client/test/functional/Reject.java --- .../com/rabbitmq/client/test/TestUtils.java | 8 +++++ .../rabbitmq/client/test/functional/Nack.java | 34 +++++++++++++++---- .../client/test/functional/Reject.java | 31 +++++++++++++++-- 3 files changed, 64 insertions(+), 9 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/TestUtils.java b/src/test/java/com/rabbitmq/client/test/TestUtils.java index 19d63d8d86..5ead24e06e 100644 --- a/src/test/java/com/rabbitmq/client/test/TestUtils.java +++ b/src/test/java/com/rabbitmq/client/test/TestUtils.java @@ -311,4 +311,12 @@ public void evaluate() throws Throwable { }; } } + + @FunctionalInterface + public interface CallableFunction { + + R apply(T t) throws Exception; + + } + } diff --git a/src/test/java/com/rabbitmq/client/test/functional/Nack.java b/src/test/java/com/rabbitmq/client/test/functional/Nack.java index 61c10e589a..ea0d6d9124 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Nack.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Nack.java @@ -19,19 +19,43 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.test.TestUtils; +import com.rabbitmq.client.test.TestUtils.CallableFunction; +import java.util.Collections; import java.util.HashSet; import java.util.Set; +import java.util.UUID; import org.junit.Test; import com.rabbitmq.client.AMQP; import com.rabbitmq.client.QueueingConsumer; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +@RunWith(Parameterized.class) public class Nack extends AbstractRejectTest { + @Parameterized.Parameters + public static Object[] queueCreators() { + return new Object[] { + (CallableFunction) channel -> { + String q = UUID.randomUUID().toString(); + channel.queueDeclare(q, true, false, false, Collections.singletonMap("x-queue-type", "quorum")); + return q; + }, + (CallableFunction) channel -> { + String q = UUID.randomUUID().toString(); + channel.queueDeclare(q, true, false, false, Collections.singletonMap("x-queue-type", "classic")); + return q; + }}; + } + + @Parameterized.Parameter public TestUtils.CallableFunction queueCreator; + @Test public void singleNack() throws Exception { - String q = - channel.queueDeclare("", false, true, false, null).getQueue(); + String q = queueCreator.apply(channel); byte[] m1 = "1".getBytes(); byte[] m2 = "2".getBytes(); @@ -62,8 +86,7 @@ public class Nack extends AbstractRejectTest { } @Test public void multiNack() throws Exception { - String q = - channel.queueDeclare("", false, true, false, null).getQueue(); + String q = queueCreator.apply(channel); byte[] m1 = "1".getBytes(); byte[] m2 = "2".getBytes(); @@ -104,8 +127,7 @@ public class Nack extends AbstractRejectTest { } @Test public void nackAll() throws Exception { - String q = - channel.queueDeclare("", false, true, false, null).getQueue(); + String q = queueCreator.apply(channel); byte[] m1 = "1".getBytes(); byte[] m2 = "2".getBytes(); diff --git a/src/test/java/com/rabbitmq/client/test/functional/Reject.java b/src/test/java/com/rabbitmq/client/test/functional/Reject.java index 2d296a13ea..aa3952b036 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Reject.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Reject.java @@ -18,19 +18,44 @@ import static org.junit.Assert.assertNull; -import java.io.IOException; +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.test.TestUtils; +import com.rabbitmq.client.test.TestUtils.CallableFunction; +import java.util.Collections; +import java.util.UUID; import org.junit.Test; import com.rabbitmq.client.AMQP; import com.rabbitmq.client.QueueingConsumer; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +@RunWith(Parameterized.class) public class Reject extends AbstractRejectTest { + + @Parameterized.Parameters + public static Object[] queueCreators() { + return new Object[] { + (CallableFunction) channel -> { + String q = UUID.randomUUID().toString(); + channel.queueDeclare(q, true, false, false, Collections.singletonMap("x-queue-type", "quorum")); + return q; + }, + (CallableFunction) channel -> { + String q = UUID.randomUUID().toString(); + channel.queueDeclare(q, true, false, false, Collections.singletonMap("x-queue-type", "classic")); + return q; + }}; + } + + @Parameterized.Parameter public TestUtils.CallableFunction queueCreator; + @Test public void reject() - throws IOException, InterruptedException + throws Exception { - String q = channel.queueDeclare("", false, true, false, null).getQueue(); + String q = queueCreator.apply(channel); byte[] m1 = "1".getBytes(); byte[] m2 = "2".getBytes(); From ce1eaaf89227d3bd8658d69ca8f1be389b964eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 5 Nov 2020 11:38:53 +0100 Subject: [PATCH 239/328] Sync on publish confirm in reject/nack tests To avoid race conditions and test failures. (cherry picked from commit 7a64d6d68dc6c8f592161863b1730ac60bc5b15f) --- .../com/rabbitmq/client/test/functional/Nack.java | 12 ++++++++++++ .../com/rabbitmq/client/test/functional/Reject.java | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/src/test/java/com/rabbitmq/client/test/functional/Nack.java b/src/test/java/com/rabbitmq/client/test/functional/Nack.java index ea0d6d9124..ce9b70ddd0 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Nack.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Nack.java @@ -60,9 +60,13 @@ public static Object[] queueCreators() { byte[] m1 = "1".getBytes(); byte[] m2 = "2".getBytes(); + channel.confirmSelect(); + basicPublishVolatile(m1, q); basicPublishVolatile(m2, q); + channel.waitForConfirmsOrDie(1000); + long tag1 = checkDelivery(channel.basicGet(q, false), m1, false); long tag2 = checkDelivery(channel.basicGet(q, false), m2, false); @@ -93,11 +97,15 @@ public static Object[] queueCreators() { byte[] m3 = "3".getBytes(); byte[] m4 = "4".getBytes(); + channel.confirmSelect(); + basicPublishVolatile(m1, q); basicPublishVolatile(m2, q); basicPublishVolatile(m3, q); basicPublishVolatile(m4, q); + channel.waitForConfirmsOrDie(1000); + checkDelivery(channel.basicGet(q, false), m1, false); long tag1 = checkDelivery(channel.basicGet(q, false), m2, false); checkDelivery(channel.basicGet(q, false), m3, false); @@ -132,9 +140,13 @@ public static Object[] queueCreators() { byte[] m1 = "1".getBytes(); byte[] m2 = "2".getBytes(); + channel.confirmSelect(); + basicPublishVolatile(m1, q); basicPublishVolatile(m2, q); + channel.waitForConfirmsOrDie(1000); + checkDelivery(channel.basicGet(q, false), m1, false); checkDelivery(channel.basicGet(q, false), m2, false); diff --git a/src/test/java/com/rabbitmq/client/test/functional/Reject.java b/src/test/java/com/rabbitmq/client/test/functional/Reject.java index aa3952b036..c2c5dd76bd 100644 --- a/src/test/java/com/rabbitmq/client/test/functional/Reject.java +++ b/src/test/java/com/rabbitmq/client/test/functional/Reject.java @@ -57,12 +57,16 @@ public static Object[] queueCreators() { { String q = queueCreator.apply(channel); + channel.confirmSelect(); + byte[] m1 = "1".getBytes(); byte[] m2 = "2".getBytes(); basicPublishVolatile(m1, q); basicPublishVolatile(m2, q); + channel.waitForConfirmsOrDie(1000); + long tag1 = checkDelivery(channel.basicGet(q, false), m1, false); long tag2 = checkDelivery(channel.basicGet(q, false), m2, false); QueueingConsumer c = new QueueingConsumer(secondaryChannel); From 1ac4011dd9e5e31088641738fa83eabecbc00872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 5 Nov 2020 16:24:29 +0100 Subject: [PATCH 240/328] Bump Micrometer to 1.6.0 References #662 (cherry picked from commit 2854ee1685dc9b1a58f2ec890e5baaf628060654) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0b51d5f5ea..575a0c2690 100644 --- a/pom.xml +++ b/pom.xml @@ -56,7 +56,7 @@ 1.7.30 4.1.14 - 1.5.5 + 1.6.0 2.11.3 1.2.3 4.13.1 From eebf6d47d9490a98a299845d2862b6ab0c7cd50d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 5 Nov 2020 16:29:39 +0100 Subject: [PATCH 241/328] Bump test dependencies (cherry picked from commit ff5a104b8b5e8621821d3b9c7bf0a28584d39159) --- pom.xml | 8 ++++---- .../com/rabbitmq/client/test/ConnectionTest.java | 12 ++++++++++-- .../client/test/DefaultRetryHandlerTest.java | 12 ++++++++++-- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 575a0c2690..5e1a904adf 100644 --- a/pom.xml +++ b/pom.xml @@ -60,10 +60,10 @@ 2.11.3 1.2.3 4.13.1 - 3.5.15 - 3.17.2 - 9.4.33.v20201020 - 1.66 + 3.6.0 + 3.18.0 + 9.4.34.v20201102 + 1.67 3.2.0 2.5.3 diff --git a/src/test/java/com/rabbitmq/client/test/ConnectionTest.java b/src/test/java/com/rabbitmq/client/test/ConnectionTest.java index c7da088e79..8fb1c82059 100644 --- a/src/test/java/com/rabbitmq/client/test/ConnectionTest.java +++ b/src/test/java/com/rabbitmq/client/test/ConnectionTest.java @@ -17,6 +17,7 @@ import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -31,7 +32,7 @@ import static org.junit.Assert.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; +import static org.mockito.MockitoAnnotations.openMocks; @RunWith(Parameterized.class) public class ConnectionTest { @@ -43,6 +44,8 @@ public class ConnectionTest { @Mock Channel ch = mock(Channel.class); + AutoCloseable mocks; + @Parameterized.Parameters public static Object[] configurators() { return new Object[]{new NotNumberedChannelCreationCallback(), new NumberedChannelCreationCallback()}; @@ -50,7 +53,12 @@ public static Object[] configurators() { @Before public void init() { - initMocks(this); + mocks = openMocks(this); + } + + @After + public void tearDown() throws Exception { + mocks.close(); } @Test diff --git a/src/test/java/com/rabbitmq/client/test/DefaultRetryHandlerTest.java b/src/test/java/com/rabbitmq/client/test/DefaultRetryHandlerTest.java index 3aa28efdb9..ae841b430b 100644 --- a/src/test/java/com/rabbitmq/client/test/DefaultRetryHandlerTest.java +++ b/src/test/java/com/rabbitmq/client/test/DefaultRetryHandlerTest.java @@ -23,6 +23,7 @@ import com.rabbitmq.client.impl.recovery.RecordedQueue; import com.rabbitmq.client.impl.recovery.RetryContext; import com.rabbitmq.client.impl.recovery.RetryHandler; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; @@ -42,7 +43,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; +import static org.mockito.MockitoAnnotations.openMocks; /** * @@ -72,9 +73,16 @@ public class DefaultRetryHandlerTest { @Mock BackoffPolicy backoffPolicy; + AutoCloseable mocks; + @Before public void init() { - initMocks(this); + mocks = openMocks(this); + } + + @After + public void tearDown() throws Exception { + mocks.close(); } @Test From b8336356b3e9439dad8e9f2e3b326218a70360a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 16 Nov 2020 11:04:24 +0100 Subject: [PATCH 242/328] Add JShell plugin for easy REPL usage (cherry picked from commit a9b186db22c98d23544fc302bee45ce7f8bddcab) --- README.md | 16 ++++++++++++++++ pom.xml | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/README.md b/README.md index cdc88f8d07..af9fd6d934 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,22 @@ They require Java 6 or higher. compile 'com.rabbitmq:amqp-client:4.6.0' ``` +## Experimenting with JShell + +You can experiment with the client from JShell. This requires Java 9 or more. + +``` +git clone https://github.com/rabbitmq/rabbitmq-java-client.git +cd rabbitmq-java-client +./mvnw test-compile jshell:run +... +import com.rabbitmq.client.* +ConnectionFactory cf = new ConnectionFactory() +Connection c = cf.newConnection() +... +c.close() +/exit +``` ## Contributing diff --git a/pom.xml b/pom.xml index 5e1a904adf..a2983a2689 100644 --- a/pom.xml +++ b/pom.xml @@ -82,6 +82,7 @@ 3.2.0 0.0.6 1.8 + 1.3 - ossrh-release + snapshots @@ -546,13 +547,25 @@ - bintray-release + release + + + org.sonatype.plugins + nexus-staging-maven-plugin + ${nexus-staging-maven-plugin.version} + true + + ossrh + https://oss.sonatype.org/ + false + + + org.apache.maven.plugins maven-javadoc-plugin @@ -593,9 +606,8 @@ - bintray-rabbitmq-maven - rabbitmq-maven - https://api.bintray.com/maven/rabbitmq/maven/com.rabbitmq:amqp-client/;publish=1 + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ From b353e320203dd5b1da2aee0df74ec0983fbeec64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 17 Feb 2021 13:55:18 +0100 Subject: [PATCH 272/328] Increase Nexus staging timeout (cherry picked from commit 57e7beb469360145f258d2c58c1bf04ab93a1272) --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index bed04347b4..9bd5129873 100644 --- a/pom.xml +++ b/pom.xml @@ -563,6 +563,7 @@ ossrh https://oss.sonatype.org/ false + 10 From e2afbe33ca9dddcc3166f1359fb9e75397ee21e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 19 Feb 2021 15:06:30 +0100 Subject: [PATCH 273/328] Fix profile name in comment (cherry picked from commit 082b4cdd91ed2fa82dd4b1a2c14594a1819f5ee9) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9bd5129873..f1e37d58bf 100644 --- a/pom.xml +++ b/pom.xml @@ -494,7 +494,7 @@ snapshots From b970e5a74853228ac0becfd60ebc25d9accddcbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 19 Feb 2021 15:07:31 +0100 Subject: [PATCH 274/328] Set release version to 5.11.0 --- release-versions.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release-versions.txt b/release-versions.txt index 0399f4de78..847472b0cf 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,3 +1,3 @@ -RELEASE_VERSION="5.11.0.RC2" -DEVELOPMENT_VERSION="5.11.0-SNAPSHOT" +RELEASE_VERSION="5.11.0" +DEVELOPMENT_VERSION="5.12.0-SNAPSHOT" RELEASE_BRANCH="5.x.x-stable" From f95857097057aa5e614300246d3635643d8e8af4 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 19 Feb 2021 14:31:38 +0000 Subject: [PATCH 275/328] [maven-release-plugin] prepare release v5.11.0 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index f1e37d58bf..ca472d199c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.11.0-SNAPSHOT + 5.11.0 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.11.0 From b96287257ace58c642167bb5cb6ba0b5ea914b45 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 19 Feb 2021 14:31:43 +0000 Subject: [PATCH 276/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index ca472d199c..501162ec65 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.11.0 + 5.12.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.11.0 + HEAD From 44537c668c83a30880799cdfe30e235ddefc92b3 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 19 Feb 2021 14:37:06 +0000 Subject: [PATCH 277/328] [maven-release-plugin] prepare release v5.11.0 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 501162ec65..ca472d199c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.12.0-SNAPSHOT + 5.11.0 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.11.0 From ce51568e7ca3a5e6bf9119df656f3c237b5cf3c5 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 19 Feb 2021 14:37:11 +0000 Subject: [PATCH 278/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index ca472d199c..501162ec65 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.11.0 + 5.12.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.11.0 + HEAD From 1f67e389b085a951b6364b010240b69c92b29dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 19 Feb 2021 15:53:28 +0100 Subject: [PATCH 279/328] Increase deployment timeout (cherry picked from commit f0ce5f68456f33206671e8bbd886923848fe8608) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 501162ec65..9e8c3dcb1d 100644 --- a/pom.xml +++ b/pom.xml @@ -563,7 +563,7 @@ ossrh https://oss.sonatype.org/ false - 10 + 20 From e89f37e8b077bc6a9cc0bba58b8ebe2b1a899253 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 19 Feb 2021 14:55:39 +0000 Subject: [PATCH 280/328] [maven-release-plugin] prepare release v5.11.0 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 9e8c3dcb1d..8dfa4bbae5 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.12.0-SNAPSHOT + 5.11.0 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.11.0 From 4eefa9c3400f6de180411231c63d271367b3222a Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 19 Feb 2021 14:55:44 +0000 Subject: [PATCH 281/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8dfa4bbae5..9e8c3dcb1d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.11.0 + 5.12.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.11.0 + HEAD From 7c6e0e256c7470b578f5aeaa7c0ccebc12a7ea05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 19 Feb 2021 16:16:05 +0100 Subject: [PATCH 282/328] Set release version to 5.12.0.RC1 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index 847472b0cf..7c74c0e65d 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,3 +1,3 @@ -RELEASE_VERSION="5.11.0" +RELEASE_VERSION="5.12.0.RC1" DEVELOPMENT_VERSION="5.12.0-SNAPSHOT" RELEASE_BRANCH="5.x.x-stable" From bf9220c0cf2221d96e154f98083c31f633d37522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 19 Feb 2021 17:00:15 +0100 Subject: [PATCH 283/328] Deps are only codegen --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 13f9fa779c..2dc08da902 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ MVN_FLAGS += -Ddeps.dir="$(abspath $(DEPS_DIR))" all: deps $(MVN) $(MVN_FLAGS) compile -deps: $(DEPS_DIR)/rabbit $(DEPS_DIR)/rabbitmq_ct_helpers +deps: $(DEPS_DIR)/rabbitmq_codegen @: dist: clean @@ -29,6 +29,9 @@ $(DEPS_DIR)/rabbit: $(DEPS_DIR)/rabbitmq_ct_helpers: git clone https://github.com/rabbitmq/rabbitmq-ct-helpers.git "$@" +$(DEPS_DIR)/rabbitmq_codegen: + git clone https://github.com/rabbitmq/rabbitmq-codegen.git "$@" + tests: deps $(MVN) $(MVN_FLAGS) verify From 33c10920895bbe7c71e6535a214e829a8b0b2f30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 19 Feb 2021 17:01:55 +0100 Subject: [PATCH 284/328] Retrieve deps before generating Javadoc (cherry picked from commit 8252793927912c935c6605aa6d4ad5f2b497f74b) --- deploy-javadoc.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/deploy-javadoc.sh b/deploy-javadoc.sh index af38def8ef..74878215e9 100755 --- a/deploy-javadoc.sh +++ b/deploy-javadoc.sh @@ -3,6 +3,7 @@ DEPLOY_DIRECTORY=api/current TAG=$(git describe --exact-match --tags $(git log -n1 --pretty='%h')) +make deps ./mvnw -q clean javadoc:javadoc -Dmaven.javadoc.failOnError=false git co gh-pages rm -rf $DEPLOY_DIRECTORY/* From 7401a4b292ca8e3043328fa668935583a628d41c Mon Sep 17 00:00:00 2001 From: Julien Blondeau Date: Fri, 19 Feb 2021 17:09:40 +0100 Subject: [PATCH 285/328] Handle basic query parameters in connection URI (cherry picked from commit 4ffb6eaf3086635502f14fe13843a462faf84cad) --- .../rabbitmq/client/ConnectionFactory.java | 64 +++++++++++++ .../com/rabbitmq/client/test/AmqpUriTest.java | 89 +++++++++++++++---- 2 files changed, 136 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index 0b55ef7d34..b69094ac17 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -352,6 +352,11 @@ public void setUri(URI uri) setVirtualHost(uriDecode(uri.getPath().substring(1))); } + + String rawQuery = uri.getRawQuery(); + if (rawQuery != null && rawQuery.length() > 0) { + setQuery(rawQuery); + } } /** @@ -381,6 +386,65 @@ private static String uriDecode(String s) { } } + /** + * Convenience method for setting some fields from query parameters + * Will handle only a subset of the query parameters supported by the + * official erlang client + * https://www.rabbitmq.com/uri-query-parameters.html + * @param rawQuery is the string containing the raw query parameters part from a URI + */ + private void setQuery(String rawQuery) { + Map parameters = new HashMap<>(); + + // parsing the query parameters + try { + for (String param : rawQuery.split("&")) { + String[] pair = param.split("="); + String key = URLDecoder.decode(pair[0], "US-ASCII"); + String value = null; + if (pair.length > 1) { + value = URLDecoder.decode(pair[1], "US-ASCII"); + } + parameters.put(key, value); + } + } catch (IOException e) { + throw new RuntimeException("Cannot parse the query parameters", e); + } + + // heartbeat + String heartbeat = parameters.get("heartbeat"); + if (heartbeat != null) { + try { + int heartbeatInt = Integer.parseInt(heartbeat); + setRequestedHeartbeat(heartbeatInt); + } catch (NumberFormatException e) { + throw new IllegalArgumentException("Requested heartbeat must an integer"); + } + } + + // connection_timeout + String connectionTimeout = parameters.get("connection_timeout"); + if (connectionTimeout != null) { + try { + int connectionTimeoutInt = Integer.parseInt(connectionTimeout); + setConnectionTimeout(connectionTimeoutInt); + } catch (NumberFormatException e) { + throw new IllegalArgumentException("TCP connection timeout must an integer"); + } + } + + // channel_max + String channelMax = parameters.get("channel_max"); + if (channelMax != null) { + try { + int channelMaxInt = Integer.parseInt(channelMax); + setRequestedChannelMax(channelMaxInt); + } catch (NumberFormatException e) { + throw new IllegalArgumentException("Requested channel max must an integer"); + } + } + } + /** * Retrieve the requested maximum channel number * @return the initially requested maximum channel number; zero for unlimited diff --git a/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java b/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java index a57e92da4d..19aad24954 100644 --- a/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java +++ b/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java @@ -32,35 +32,63 @@ public class AmqpUriTest extends BrokerTestCase { /* From the spec (subset of the tests) */ parseSuccess("amqp://user:pass@host:10000/vhost", - "user", "pass", "host", 10000, "vhost"); + "user", "pass", "host", 10000, "vhost", false); parseSuccess("aMQps://user%61:%61pass@host:10000/v%2fhost", - "usera", "apass", "host", 10000, "v/host"); - parseSuccess("amqp://host", "guest", "guest", "host", 5672, "/"); + "usera", "apass", "host", 10000, "v/host", true); + parseSuccess("amqp://host", "guest", "guest", "host", 5672, "/", false); parseSuccess("amqp:///vhost", - "guest", "guest", "localhost", 5672, "vhost"); - parseSuccess("amqp://host/", "guest", "guest", "host", 5672, ""); - parseSuccess("amqp://host/%2f", "guest", "guest", "host", 5672, "/"); - parseSuccess("amqp://[::1]", "guest", "guest", "[::1]", 5672, "/"); + "guest", "guest", "localhost", 5672, "vhost", false); + parseSuccess("amqp://host/", "guest", "guest", "host", 5672, "", false); + parseSuccess("amqp://host/%2f", "guest", "guest", "host", 5672, "/", false); + parseSuccess("amqp://[::1]", "guest", "guest", "[::1]", 5672, "/", false); /* Various other success cases */ - parseSuccess("amqp://host:100", "guest", "guest", "host", 100, "/"); - parseSuccess("amqp://[::1]:100", "guest", "guest", "[::1]", 100, "/"); + parseSuccess("amqp://host:100", "guest", "guest", "host", 100, "/", false); + parseSuccess("amqp://[::1]:100", "guest", "guest", "[::1]", 100, "/", false); parseSuccess("amqp://host/blah", - "guest", "guest", "host", 5672, "blah"); + "guest", "guest", "host", 5672, "blah", false); parseSuccess("amqp://host:100/blah", - "guest", "guest", "host", 100, "blah"); + "guest", "guest", "host", 100, "blah", false); parseSuccess("amqp://[::1]/blah", - "guest", "guest", "[::1]", 5672, "blah"); + "guest", "guest", "[::1]", 5672, "blah", false); parseSuccess("amqp://[::1]:100/blah", - "guest", "guest", "[::1]", 100, "blah"); + "guest", "guest", "[::1]", 100, "blah", false); parseSuccess("amqp://user:pass@host", - "user", "pass", "host", 5672, "/"); + "user", "pass", "host", 5672, "/", false); parseSuccess("amqp://user:pass@[::1]", - "user", "pass", "[::1]", 5672, "/"); + "user", "pass", "[::1]", 5672, "/", false); parseSuccess("amqp://user:pass@[::1]:100", - "user", "pass", "[::1]", 100, "/"); + "user", "pass", "[::1]", 100, "/", false); + + /* using query parameters */ + parseSuccess("amqp://user:pass@host:10000/vhost?", + "user", "pass", "host", 10000, "vhost", false); + parseSuccess("amqp://user:pass@host:10000/vhost?&", + "user", "pass", "host", 10000, "vhost", false); + parseSuccess("amqp://user:pass@host:10000/vhost?unknown_parameter", + "user", "pass", "host", 10000, "vhost", false); + parseSuccess("amqp://user:pass@host:10000/vhost?unknown_parameter=value", + "user", "pass", "host", 10000, "vhost", false); + parseSuccess("amqp://user:pass@host:10000/vhost?unknown%2fparameter=value", + "user", "pass", "host", 10000, "vhost", false); + + parseSuccess("amqp://user:pass@host:10000/vhost?heartbeat=342", + "user", "pass", "host", 10000, "vhost", false, + 342, null, null); + parseSuccess("amqp://user:pass@host:10000/vhost?connection_timeout=442", + "user", "pass", "host", 10000, "vhost", false, + null, 442, null); + parseSuccess("amqp://user:pass@host:10000/vhost?channel_max=542", + "user", "pass", "host", 10000, "vhost", false, + null, null, 542); + parseSuccess("amqp://user:pass@host:10000/vhost?heartbeat=342&connection_timeout=442&channel_max=542", + "user", "pass", "host", 10000, "vhost", false, + 342, 442, 542); + parseSuccess("amqp://user:pass@host:10000/vhost?heartbeat=342&connection_timeout=442&channel_max=542&a=b", + "user", "pass", "host", 10000, "vhost", false, + 342, 442, 542); /* Various failure cases */ parseFail("https://www.rabbitmq.com"); @@ -71,10 +99,26 @@ public class AmqpUriTest extends BrokerTestCase parseFail("amqp://foo%1"); parseFail("amqp://foo%1x"); parseFail("amqp://foo%xy"); + + parseFail("amqp://user:pass@host:10000/vhost?heartbeat=not_an_integer"); + parseFail("amqp://user:pass@host:10000/vhost?heartbeat=-1"); + parseFail("amqp://user:pass@host:10000/vhost?connection_timeout=not_an_integer"); + parseFail("amqp://user:pass@host:10000/vhost?connection_timeout=-1"); + parseFail("amqp://user:pass@host:10000/vhost?channel_max=not_an_integer"); + parseFail("amqp://user:pass@host:10000/vhost?channel_max=-1"); + parseFail("amqp://user:pass@host:10000/vhost?heartbeat=342?connection_timeout=442"); } private void parseSuccess(String uri, String user, String password, - String host, int port, String vhost) + String host, int port, String vhost, boolean secured) + throws URISyntaxException, NoSuchAlgorithmException, KeyManagementException + { + parseSuccess(uri, user, password, host, port, vhost, secured, null, null, null); + } + + private void parseSuccess(String uri, String user, String password, + String host, int port, String vhost, boolean secured, + Integer heartbeat, Integer connectionTimeout, Integer channelMax) throws URISyntaxException, NoSuchAlgorithmException, KeyManagementException { ConnectionFactory cf = TestUtils.connectionFactory(); @@ -85,6 +129,17 @@ private void parseSuccess(String uri, String user, String password, assertEquals(host, cf.getHost()); assertEquals(port, cf.getPort()); assertEquals(vhost, cf.getVirtualHost()); + assertEquals(secured, cf.isSSL()); + + if(heartbeat != null) { + assertEquals(heartbeat.intValue(), cf.getRequestedHeartbeat()); + } + if(connectionTimeout != null) { + assertEquals(connectionTimeout.intValue(), cf.getConnectionTimeout()); + } + if(channelMax != null) { + assertEquals(channelMax.intValue(), cf.getRequestedChannelMax()); + } } private void parseFail(String uri) { From d9108eca3e99c080cb34c9c87a4151e178e98292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 22 Feb 2021 10:01:28 +0100 Subject: [PATCH 286/328] Handle URI query parameters in chain of responsibility With fallback hook, by default empty. References #672 (cherry picked from commit b3edb1e6f60a9a62caaf2c710bd9b104479b1ea3) --- .../rabbitmq/client/ConnectionFactory.java | 83 ++++++++++++------- .../com/rabbitmq/client/test/AmqpUriTest.java | 18 +++- 2 files changed, 68 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index b69094ac17..b3b8612b59 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -24,6 +24,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.Map.Entry; +import java.util.function.BiConsumer; import javax.net.SocketFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocketFactory; @@ -386,6 +388,36 @@ private static String uriDecode(String s) { } } + private static final Map> URI_QUERY_PARAMETER_HANDLERS = + new HashMap>() { + { + put("heartbeat", (value, cf) -> { + try { + int heartbeatInt = Integer.parseInt(value); + cf.setRequestedHeartbeat(heartbeatInt); + } catch (NumberFormatException e) { + throw new IllegalArgumentException("Requested heartbeat must an integer"); + } + }); + put("connection_timeout", (value, cf) -> { + try { + int connectionTimeoutInt = Integer.parseInt(value); + cf.setConnectionTimeout(connectionTimeoutInt); + } catch (NumberFormatException e) { + throw new IllegalArgumentException("TCP connection timeout must an integer"); + } + }); + put("channel_max", (value, cf) -> { + try { + int channelMaxInt = Integer.parseInt(value); + cf.setRequestedChannelMax(channelMaxInt); + } catch (NumberFormatException e) { + throw new IllegalArgumentException("Requested channel max must an integer"); + } + }); + } + }; + /** * Convenience method for setting some fields from query parameters * Will handle only a subset of the query parameters supported by the @@ -395,7 +427,6 @@ private static String uriDecode(String s) { */ private void setQuery(String rawQuery) { Map parameters = new HashMap<>(); - // parsing the query parameters try { for (String param : rawQuery.split("&")) { @@ -408,43 +439,31 @@ private void setQuery(String rawQuery) { parameters.put(key, value); } } catch (IOException e) { - throw new RuntimeException("Cannot parse the query parameters", e); + throw new IllegalArgumentException("Cannot parse the query parameters", e); } - // heartbeat - String heartbeat = parameters.get("heartbeat"); - if (heartbeat != null) { - try { - int heartbeatInt = Integer.parseInt(heartbeat); - setRequestedHeartbeat(heartbeatInt); - } catch (NumberFormatException e) { - throw new IllegalArgumentException("Requested heartbeat must an integer"); - } - } - - // connection_timeout - String connectionTimeout = parameters.get("connection_timeout"); - if (connectionTimeout != null) { - try { - int connectionTimeoutInt = Integer.parseInt(connectionTimeout); - setConnectionTimeout(connectionTimeoutInt); - } catch (NumberFormatException e) { - throw new IllegalArgumentException("TCP connection timeout must an integer"); - } - } - - // channel_max - String channelMax = parameters.get("channel_max"); - if (channelMax != null) { - try { - int channelMaxInt = Integer.parseInt(channelMax); - setRequestedChannelMax(channelMaxInt); - } catch (NumberFormatException e) { - throw new IllegalArgumentException("Requested channel max must an integer"); + for (Entry entry : parameters.entrySet()) { + BiConsumer handler = URI_QUERY_PARAMETER_HANDLERS + .get(entry.getKey()); + if (handler != null) { + handler.accept(entry.getValue(), this); + } else { + processUriQueryParameter(entry.getKey(), entry.getValue()); } } } + /** + * Hook to process query parameters not handled natively. + * Handled natively: heartbeat, connection_timeout, + * channel_max. + * @param key + * @param value + */ + protected void processUriQueryParameter(String key, String value) { + + } + /** * Retrieve the requested maximum channel number * @return the initially requested maximum channel number; zero for unlimited diff --git a/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java b/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java index 19aad24954..92d4232934 100644 --- a/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java +++ b/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java @@ -14,6 +14,7 @@ // info@rabbitmq.com. package com.rabbitmq.client.test; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -21,11 +22,13 @@ import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; +import java.util.HashMap; +import java.util.Map; import org.junit.Test; import com.rabbitmq.client.ConnectionFactory; -public class AmqpUriTest extends BrokerTestCase +public class AmqpUriTest { @Test public void uriParsing() throws URISyntaxException, NoSuchAlgorithmException, KeyManagementException @@ -109,6 +112,19 @@ public class AmqpUriTest extends BrokerTestCase parseFail("amqp://user:pass@host:10000/vhost?heartbeat=342?connection_timeout=442"); } + @Test + public void processUriQueryParameterShouldBeCalledForNotHandledParameter() throws Exception { + Map processedParameters = new HashMap<>(); + ConnectionFactory cf = new ConnectionFactory() { + @Override + protected void processUriQueryParameter(String key, String value) { + processedParameters.put(key, value); + } + }; + cf.setUri("amqp://user:pass@host:10000/vhost?heartbeat=60&key=value"); + assertThat(processedParameters).hasSize(1).containsEntry("key", "value"); + } + private void parseSuccess(String uri, String user, String password, String host, int port, String vhost, boolean secured) throws URISyntaxException, NoSuchAlgorithmException, KeyManagementException From bf362d5d765beb6206d5c2c7b2949ce2cb01df4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 22 Feb 2021 10:58:41 +0100 Subject: [PATCH 287/328] Fix AMQP parsing test Difference between 6.x and 5.x. References #640, #642, #672 --- src/test/java/com/rabbitmq/client/test/AmqpUriTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java b/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java index 92d4232934..d5be86e4ee 100644 --- a/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java +++ b/src/test/java/com/rabbitmq/client/test/AmqpUriTest.java @@ -104,11 +104,9 @@ public class AmqpUriTest parseFail("amqp://foo%xy"); parseFail("amqp://user:pass@host:10000/vhost?heartbeat=not_an_integer"); - parseFail("amqp://user:pass@host:10000/vhost?heartbeat=-1"); parseFail("amqp://user:pass@host:10000/vhost?connection_timeout=not_an_integer"); parseFail("amqp://user:pass@host:10000/vhost?connection_timeout=-1"); parseFail("amqp://user:pass@host:10000/vhost?channel_max=not_an_integer"); - parseFail("amqp://user:pass@host:10000/vhost?channel_max=-1"); parseFail("amqp://user:pass@host:10000/vhost?heartbeat=342?connection_timeout=442"); } From 24d96bddfc96badf68dc7df6bd7b469f0c5699ae Mon Sep 17 00:00:00 2001 From: Gustaf Andersson Date: Mon, 22 Mar 2021 14:04:54 +0100 Subject: [PATCH 288/328] Add support for reading unsigned short "u". Add support for reading unsigned short "u". https://www.rabbitmq.com/amqp-0-9-1-errata.html#section_3 (cherry picked from commit 7812ebf0705eb6291d6b4fcc87c3443ab1617a7b) --- src/main/java/com/rabbitmq/client/impl/ValueReader.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/rabbitmq/client/impl/ValueReader.java b/src/main/java/com/rabbitmq/client/impl/ValueReader.java index 83455bfe66..3e80f8853e 100644 --- a/src/main/java/com/rabbitmq/client/impl/ValueReader.java +++ b/src/main/java/com/rabbitmq/client/impl/ValueReader.java @@ -194,6 +194,9 @@ static Object readFieldValue(DataInputStream in) case 's': value = in.readShort(); break; + case 'u': + value = in.readUnsignedShort(); + break; case 't': value = in.readBoolean(); break; From 11dce898a4e0ff96db8bd36bc12a388f6072baf9 Mon Sep 17 00:00:00 2001 From: Gustaf Andersson Date: Mon, 22 Mar 2021 16:00:21 +0100 Subject: [PATCH 289/328] Add support for reading unsigned int "i" Add support for reading unsigned int "I" https://www.rabbitmq.com/amqp-0-9-1-errata.html#section_3 (cherry picked from commit 5971e42e97f80df4d0228a6a9669c8c1a4d725cd) --- .../java/com/rabbitmq/client/impl/ValueReader.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/com/rabbitmq/client/impl/ValueReader.java b/src/main/java/com/rabbitmq/client/impl/ValueReader.java index 3e80f8853e..4912c8541d 100644 --- a/src/main/java/com/rabbitmq/client/impl/ValueReader.java +++ b/src/main/java/com/rabbitmq/client/impl/ValueReader.java @@ -164,6 +164,9 @@ static Object readFieldValue(DataInputStream in) case 'I': value = in.readInt(); break; + case 'i': + value = readUnsignedInt(in); + break; case 'D': int scale = in.readUnsignedByte(); byte [] unscaled = new byte[4]; @@ -213,6 +216,17 @@ static Object readFieldValue(DataInputStream in) return value; } + /** Read an unsigned int */ + private static long readUnsignedInt(DataInputStream in) throws IOException { + long ch1 = in.read(); + long ch2 = in.read(); + long ch3 = in.read(); + long ch4 = in.read(); + if ((ch1 | ch2 | ch3 | ch4) < 0) + throw new EOFException(); + return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + ch4); + } + /** Read a field-array */ private static List readArray(DataInputStream in) throws IOException From 4d0ba6d2d3bf015d1629e1ae56f50b7a0c2ad85c Mon Sep 17 00:00:00 2001 From: Gustaf Andersson Date: Mon, 22 Mar 2021 16:07:36 +0100 Subject: [PATCH 290/328] code style (cherry picked from commit 4895aa2d6d5d5774674075663ea6fa751e48e86e) --- src/main/java/com/rabbitmq/client/impl/ValueReader.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/client/impl/ValueReader.java b/src/main/java/com/rabbitmq/client/impl/ValueReader.java index 4912c8541d..7c708f73d2 100644 --- a/src/main/java/com/rabbitmq/client/impl/ValueReader.java +++ b/src/main/java/com/rabbitmq/client/impl/ValueReader.java @@ -217,7 +217,9 @@ static Object readFieldValue(DataInputStream in) } /** Read an unsigned int */ - private static long readUnsignedInt(DataInputStream in) throws IOException { + private static long readUnsignedInt(DataInputStream in) + throws IOException + { long ch1 = in.read(); long ch2 = in.read(); long ch3 = in.read(); From a53f600f849eaa71a90854caa28711b298dae85c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 29 Mar 2021 09:56:02 +0200 Subject: [PATCH 291/328] Add missing import References #675 (cherry picked from commit 3db2425473a53c7546362beb26fd14eab1a5ef4e) --- src/main/java/com/rabbitmq/client/impl/ValueReader.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/rabbitmq/client/impl/ValueReader.java b/src/main/java/com/rabbitmq/client/impl/ValueReader.java index 7c708f73d2..1162cc8af0 100644 --- a/src/main/java/com/rabbitmq/client/impl/ValueReader.java +++ b/src/main/java/com/rabbitmq/client/impl/ValueReader.java @@ -17,6 +17,7 @@ package com.rabbitmq.client.impl; import java.io.DataInputStream; +import java.io.EOFException; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; From af322a76761e4fcf8a8103d8fdbb24012fa03911 Mon Sep 17 00:00:00 2001 From: Michael Dent Date: Thu, 1 Apr 2021 14:20:29 -0500 Subject: [PATCH 292/328] topology recovery updates --- .../client/TopologyRecoveryException.java | 14 +++++ .../impl/recovery/AutorecoveringChannel.java | 6 +- .../recovery/AutorecoveringConnection.java | 60 ++++++++++++++----- .../impl/recovery/DefaultRetryHandler.java | 20 +++---- .../TopologyRecoveryRetryHandlerBuilder.java | 20 +++---- .../recovery/TopologyRecoveryRetryLogic.java | 53 ++++++++++++++-- 6 files changed, 132 insertions(+), 41 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/TopologyRecoveryException.java b/src/main/java/com/rabbitmq/client/TopologyRecoveryException.java index bdd8b7f807..bb8163a096 100644 --- a/src/main/java/com/rabbitmq/client/TopologyRecoveryException.java +++ b/src/main/java/com/rabbitmq/client/TopologyRecoveryException.java @@ -15,6 +15,8 @@ package com.rabbitmq.client; +import com.rabbitmq.client.impl.recovery.RecordedEntity; + /** * Indicates an exception thrown during topology recovery. * @@ -22,7 +24,19 @@ * @since 3.3.0 */ public class TopologyRecoveryException extends Exception { + + private final RecordedEntity recordedEntity; + public TopologyRecoveryException(String message, Throwable cause) { + this(message, cause, null); + } + + public TopologyRecoveryException(String message, Throwable cause, final RecordedEntity recordedEntity) { super(message, cause); + this.recordedEntity = recordedEntity; + } + + public RecordedEntity getRecordedEntity() { + return recordedEntity; } } diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java index 52e100ad57..97cacc81b0 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java @@ -900,7 +900,11 @@ private void recordConsumer(String result, this.connection.recordConsumer(result, consumer); } - private void deleteRecordedConsumer(String consumerTag) { + /** + * Delete the recorded consumer from this channel and accompanying connection + * @param consumerTag consumer tag to delete + */ + public void deleteRecordedConsumer(String consumerTag) { this.consumerTags.remove(consumerTag); RecordedConsumer c = this.connection.deleteRecordedConsumer(consumerTag); if (c != null) { diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java index f217bd4dc4..98d5a4d610 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java @@ -143,7 +143,7 @@ private void setupErrorOnWriteListenerForPotentialRecovery() { }); } - private TopologyRecoveryFilter letAllPassFilter() { + private static TopologyRecoveryFilter letAllPassFilter() { return new TopologyRecoveryFilter() {}; } @@ -644,7 +644,7 @@ private void recoverChannels(final RecoveryAwareAMQConnection newConn) { } } - void recoverChannel(AutorecoveringChannel channel) throws IOException { + public void recoverChannel(AutorecoveringChannel channel) throws IOException { channel.automaticallyRecover(this, this.delegate); } @@ -666,6 +666,38 @@ private void notifyTopologyRecoveryListenersStarted() { } } + /** + * Recover a closed channel and all topology (i.e. RecordedEntities) associated to it. + * Any errors will be sent to the {@link #getExceptionHandler()}. + * @param channel channel to recover + * @throws IllegalArgumentException if this channel is not owned by this connection + */ + public void recoverChannelAndTopology(final AutorecoveringChannel channel) { + if (!channels.containsValue(channel)) { + throw new IllegalArgumentException("This channel is not owned by this connection"); + } + try { + LOGGER.debug("Recovering channel={}", channel); + recoverChannel(channel); + LOGGER.debug("Recovered channel={}. Now recovering its topology", channel); + Utility.copy(recordedExchanges).values().stream() + .filter(e -> e.getChannel() == channel) + .forEach(e -> recoverExchange(e, false)); + Utility.copy(recordedQueues).values().stream() + .filter(q -> q.getChannel() == channel) + .forEach(q -> recoverQueue(q.getName(), q, false)); + Utility.copy(recordedBindings).stream() + .filter(b -> b.getChannel() == channel) + .forEach(b -> recoverBinding(b, false)); + Utility.copy(consumers).values().stream() + .filter(c -> c.getChannel() == channel) + .forEach(c -> recoverConsumer(c.getConsumerTag(), c, false)); + LOGGER.debug("Recovered topology for channel={}", channel); + } catch (Exception e) { + getExceptionHandler().handleChannelRecoveryException(channel, e); + } + } + private void recoverTopology(final ExecutorService executor) { // The recovery sequence is the following: // 1. Recover exchanges @@ -704,7 +736,7 @@ private void recoverTopology(final ExecutorService executor) { } } - private void recoverExchange(RecordedExchange x, boolean retry) { + public void recoverExchange(RecordedExchange x, boolean retry) { // recorded exchanges are guaranteed to be non-predefined (we filter out predefined ones in exchangeDeclare). MK. try { if (topologyRecoveryFilter.filterExchange(x)) { @@ -722,7 +754,7 @@ private void recoverExchange(RecordedExchange x, boolean retry) { } catch (Exception cause) { final String message = "Caught an exception while recovering exchange " + x.getName() + ": " + cause.getMessage(); - TopologyRecoveryException e = new TopologyRecoveryException(message, cause); + TopologyRecoveryException e = new TopologyRecoveryException(message, cause, x); this.getExceptionHandler().handleTopologyRecoveryException(delegate, x.getDelegateChannel(), e); } } @@ -766,12 +798,12 @@ public void recoverQueue(final String oldName, RecordedQueue q, boolean retry) { } catch (Exception cause) { final String message = "Caught an exception while recovering queue " + oldName + ": " + cause.getMessage(); - TopologyRecoveryException e = new TopologyRecoveryException(message, cause); + TopologyRecoveryException e = new TopologyRecoveryException(message, cause, q); this.getExceptionHandler().handleTopologyRecoveryException(delegate, q.getDelegateChannel(), e); } } - private void recoverBinding(RecordedBinding b, boolean retry) { + public void recoverBinding(RecordedBinding b, boolean retry) { try { if (this.topologyRecoveryFilter.filterBinding(b)) { if (retry) { @@ -788,7 +820,7 @@ private void recoverBinding(RecordedBinding b, boolean retry) { } catch (Exception cause) { String message = "Caught an exception while recovering binding between " + b.getSource() + " and " + b.getDestination() + ": " + cause.getMessage(); - TopologyRecoveryException e = new TopologyRecoveryException(message, cause); + TopologyRecoveryException e = new TopologyRecoveryException(message, cause, b); this.getExceptionHandler().handleTopologyRecoveryException(delegate, b.getDelegateChannel(), e); } } @@ -800,7 +832,7 @@ public void recoverConsumer(final String tag, RecordedConsumer consumer, boolean String newTag = null; if (retry) { final RecordedConsumer entity = consumer; - RetryResult retryResult = wrapRetryIfNecessary(consumer, () -> entity.recover()); + RetryResult retryResult = wrapRetryIfNecessary(consumer, entity::recover); consumer = (RecordedConsumer) retryResult.getRecordedEntity(); newTag = (String) retryResult.getResult(); } else { @@ -824,7 +856,7 @@ public void recoverConsumer(final String tag, RecordedConsumer consumer, boolean } catch (Exception cause) { final String message = "Caught an exception while recovering consumer " + tag + ": " + cause.getMessage(); - TopologyRecoveryException e = new TopologyRecoveryException(message, cause); + TopologyRecoveryException e = new TopologyRecoveryException(message, cause, consumer); this.getExceptionHandler().handleTopologyRecoveryException(delegate, consumer.getDelegateChannel(), e); } } @@ -889,14 +921,10 @@ private void recoverEntitiesAsynchronously(ExecutorService executor, Collection< private List> groupEntitiesByChannel(final Collection entities) { // map entities by channel - final Map> map = new LinkedHashMap>(); + final Map> map = new LinkedHashMap<>(); for (final E entity : entities) { final AutorecoveringChannel channel = entity.getChannel(); - List list = map.get(channel); - if (list == null) { - map.put(channel, list = new ArrayList()); - } - list.add(entity); + map.computeIfAbsent(channel, c -> new ArrayList<>()).add(entity); } // now create a runnable per channel final List> callables = new ArrayList<>(); @@ -1083,7 +1111,7 @@ boolean hasMoreConsumersOnQueue(Collection consumers, String q } Set removeBindingsWithDestination(String s) { - final Set result = new HashSet(); + final Set result = new LinkedHashSet<>(); synchronized (this.recordedBindings) { for (Iterator it = this.recordedBindings.iterator(); it.hasNext(); ) { RecordedBinding b = it.next(); diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java b/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java index dc55fc7ed4..2e2890c05b 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/DefaultRetryHandler.java @@ -40,19 +40,19 @@ public class DefaultRetryHandler implements RetryHandler { private static final Logger LOGGER = LoggerFactory.getLogger(DefaultRetryHandler.class); - private final BiPredicate queueRecoveryRetryCondition; - private final BiPredicate exchangeRecoveryRetryCondition; - private final BiPredicate bindingRecoveryRetryCondition; - private final BiPredicate consumerRecoveryRetryCondition; + protected final BiPredicate queueRecoveryRetryCondition; + protected final BiPredicate exchangeRecoveryRetryCondition; + protected final BiPredicate bindingRecoveryRetryCondition; + protected final BiPredicate consumerRecoveryRetryCondition; - private final RetryOperation queueRecoveryRetryOperation; - private final RetryOperation exchangeRecoveryRetryOperation; - private final RetryOperation bindingRecoveryRetryOperation; - private final RetryOperation consumerRecoveryRetryOperation; + protected final RetryOperation queueRecoveryRetryOperation; + protected final RetryOperation exchangeRecoveryRetryOperation; + protected final RetryOperation bindingRecoveryRetryOperation; + protected final RetryOperation consumerRecoveryRetryOperation; - private final int retryAttempts; + protected final int retryAttempts; - private final BackoffPolicy backoffPolicy; + protected final BackoffPolicy backoffPolicy; public DefaultRetryHandler(BiPredicate queueRecoveryRetryCondition, BiPredicate exchangeRecoveryRetryCondition, diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java index bed71f9f0b..b8dfdff7bc 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryHandlerBuilder.java @@ -30,19 +30,19 @@ */ public class TopologyRecoveryRetryHandlerBuilder { - private BiPredicate queueRecoveryRetryCondition = (q, e) -> false; - private BiPredicate exchangeRecoveryRetryCondition = (ex, e) -> false; - private BiPredicate bindingRecoveryRetryCondition = (b, e) -> false; - private BiPredicate consumerRecoveryRetryCondition = (c, e) -> false; + protected BiPredicate queueRecoveryRetryCondition = (q, e) -> false; + protected BiPredicate exchangeRecoveryRetryCondition = (ex, e) -> false; + protected BiPredicate bindingRecoveryRetryCondition = (b, e) -> false; + protected BiPredicate consumerRecoveryRetryCondition = (c, e) -> false; - private DefaultRetryHandler.RetryOperation queueRecoveryRetryOperation = context -> null; - private DefaultRetryHandler.RetryOperation exchangeRecoveryRetryOperation = context -> null; - private DefaultRetryHandler.RetryOperation bindingRecoveryRetryOperation = context -> null; - private DefaultRetryHandler.RetryOperation consumerRecoveryRetryOperation = context -> null; + protected DefaultRetryHandler.RetryOperation queueRecoveryRetryOperation = context -> null; + protected DefaultRetryHandler.RetryOperation exchangeRecoveryRetryOperation = context -> null; + protected DefaultRetryHandler.RetryOperation bindingRecoveryRetryOperation = context -> null; + protected DefaultRetryHandler.RetryOperation consumerRecoveryRetryOperation = context -> null; - private int retryAttempts = 2; + protected int retryAttempts = 2; - private BackoffPolicy backoffPolicy = nbAttempts -> { + protected BackoffPolicy backoffPolicy = nbAttempts -> { }; public static TopologyRecoveryRetryHandlerBuilder builder() { diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java index 94c347f7fa..b93ba7a647 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java @@ -18,7 +18,6 @@ import com.rabbitmq.client.AMQP; import com.rabbitmq.client.ShutdownSignalException; import com.rabbitmq.utility.Utility; - import java.util.function.BiPredicate; import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryHandlerBuilder.builder; @@ -55,6 +54,18 @@ public abstract class TopologyRecoveryRetryLogic { } return null; }; + + /** + * Recover a queue + */ + public static final DefaultRetryHandler.RetryOperation RECOVER_QUEUE = context -> { + if (context.entity() instanceof RecordedQueue) { + final RecordedQueue recordedQueue = context.queue(); + AutorecoveringConnection connection = context.connection(); + connection.recoverQueue(recordedQueue.getName(), recordedQueue, false); + } + return null; + }; /** * Recover the destination queue of a binding. @@ -138,18 +149,52 @@ public abstract class TopologyRecoveryRetryLogic { * Recover a consumer. */ public static final DefaultRetryHandler.RetryOperation RECOVER_CONSUMER = context -> context.consumer().recover(); + + /** + * Recover earlier consumers that share the same channel as this retry context + */ + public static final DefaultRetryHandler.RetryOperation RECOVER_PREVIOUS_CONSUMERS = context -> { + if (context.entity() instanceof RecordedConsumer) { + // recover all consumers for the same channel that were recovered before this current + // consumer. need to do this incase some consumers had already been recovered + // successfully on a different queue before this one failed + final AutorecoveringChannel channel = context.consumer().getChannel(); + for (RecordedConsumer consumer : Utility.copy(context.connection().getRecordedConsumers()).values()) { + if (consumer == context.entity()) { + break; + } else if (consumer.getChannel() == channel) { + final RetryContext retryContext = new RetryContext(consumer, context.exception(), context.connection()); + RECOVER_CONSUMER_QUEUE.call(retryContext); + consumer.recover(); + RECOVER_CONSUMER_QUEUE_BINDINGS.call(retryContext); + } + } + } + return null; + }; /** * Pre-configured {@link TopologyRecoveryRetryHandlerBuilder} that retries recovery of bindings and consumers * when their respective queue is not found. + * * This retry handler can be useful for long recovery processes, whereby auto-delete queues * can be deleted between queue recovery and binding/consumer recovery. + * + * Also useful to retry channel-closed 404 errors that may arise with auto-delete queues during a cluster cycle. */ public static final TopologyRecoveryRetryHandlerBuilder RETRY_ON_QUEUE_NOT_FOUND_RETRY_HANDLER = builder() + .queueRecoveryRetryCondition(CHANNEL_CLOSED_NOT_FOUND) .bindingRecoveryRetryCondition(CHANNEL_CLOSED_NOT_FOUND) .consumerRecoveryRetryCondition(CHANNEL_CLOSED_NOT_FOUND) - .bindingRecoveryRetryOperation(RECOVER_CHANNEL.andThen(RECOVER_BINDING_QUEUE).andThen(RECOVER_BINDING) + .queueRecoveryRetryOperation(RECOVER_CHANNEL + .andThen(RECOVER_QUEUE)) + .bindingRecoveryRetryOperation(RECOVER_CHANNEL + .andThen(RECOVER_BINDING_QUEUE) + .andThen(RECOVER_BINDING) .andThen(RECOVER_PREVIOUS_QUEUE_BINDINGS)) - .consumerRecoveryRetryOperation(RECOVER_CHANNEL.andThen(RECOVER_CONSUMER_QUEUE.andThen(RECOVER_CONSUMER) - .andThen(RECOVER_CONSUMER_QUEUE_BINDINGS))); + .consumerRecoveryRetryOperation(RECOVER_CHANNEL + .andThen(RECOVER_CONSUMER_QUEUE) + .andThen(RECOVER_CONSUMER) + .andThen(RECOVER_CONSUMER_QUEUE_BINDINGS) + .andThen(RECOVER_PREVIOUS_CONSUMERS)); } From 2d988ee5b30ad68745b8fb74b475553ea1c97549 Mon Sep 17 00:00:00 2001 From: Michael Dent Date: Fri, 2 Apr 2021 09:15:56 -0500 Subject: [PATCH 293/328] consumer recovery needs to return the new consumer tag --- .../client/impl/recovery/TopologyRecoveryRetryLogic.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java index b93ba7a647..f947d2fd4f 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java @@ -165,10 +165,11 @@ public abstract class TopologyRecoveryRetryLogic { } else if (consumer.getChannel() == channel) { final RetryContext retryContext = new RetryContext(consumer, context.exception(), context.connection()); RECOVER_CONSUMER_QUEUE.call(retryContext); - consumer.recover(); + context.connection().recoverConsumer(consumer.getConsumerTag(), consumer, false); RECOVER_CONSUMER_QUEUE_BINDINGS.call(retryContext); } } + return context.consumer().getConsumerTag(); } return null; }; From c5dfe559aed5163a785e78c94b55c826f1f17a60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 6 Apr 2021 08:50:37 +0200 Subject: [PATCH 294/328] Bump dependencies Fixes #681 (cherry picked from commit cc759a922ddd2d98289289b908997f26d5e83ceb) --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 9e8c3dcb1d..b6ea067b42 100644 --- a/pom.xml +++ b/pom.xml @@ -55,9 +55,9 @@ UTF-8 1.7.30 - 4.1.17 - 1.6.3 - 2.12.1 + 4.1.18 + 1.6.5 + 2.12.2 1.2.3 4.13.2 3.7.7 From c46b6b0cd490b772ebe9263adc40ac03900c5ffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 6 Apr 2021 08:51:29 +0200 Subject: [PATCH 295/328] Bump test dependencies (cherry picked from commit ca0b059da2ce0a4927413ae1532473d39bc6a40e) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index b6ea067b42..72929ae352 100644 --- a/pom.xml +++ b/pom.xml @@ -60,9 +60,9 @@ 2.12.2 1.2.3 4.13.2 - 3.7.7 + 3.8.0 3.19.0 - 9.4.36.v20210114 + 9.4.39.v20210325 1.68 3.2.0 From 4407bfa41edfd1982e408bb44c0dcc1d6acd0000 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Tue, 6 Apr 2021 11:29:35 +0000 Subject: [PATCH 296/328] [maven-release-plugin] prepare release v5.12.0.RC1 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 72929ae352..ec71b3a5ca 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.12.0-SNAPSHOT + 5.12.0.RC1 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.12.0.RC1 From 7ddb1ddf78919f00807c4f38fe0b721a3dc235f3 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Tue, 6 Apr 2021 11:29:38 +0000 Subject: [PATCH 297/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index ec71b3a5ca..72929ae352 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.12.0.RC1 + 5.12.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.12.0.RC1 + HEAD From 9020188119c90aebcdebcbfa71811d6962c877ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Tue, 6 Apr 2021 13:49:45 +0200 Subject: [PATCH 298/328] Set release version to 5.12.0.RC2 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index 7c74c0e65d..f74d8c8579 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,3 +1,3 @@ -RELEASE_VERSION="5.12.0.RC1" +RELEASE_VERSION="5.12.0.RC2" DEVELOPMENT_VERSION="5.12.0-SNAPSHOT" RELEASE_BRANCH="5.x.x-stable" From d3a74633822268080b67cf0745f65601a78f6c5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 7 Apr 2021 17:41:13 +0200 Subject: [PATCH 299/328] Bump mockito (cherry picked from commit e0a00aec06462c6b2a1473bb40eba1faed322be3) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 72929ae352..a41a16e2cb 100644 --- a/pom.xml +++ b/pom.xml @@ -60,7 +60,7 @@ 2.12.2 1.2.3 4.13.2 - 3.8.0 + 3.9.0 3.19.0 9.4.39.v20210325 1.68 From 079c2c866f2f3e82cdd8c1a64f0d94e4283cd640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 9 Apr 2021 08:41:35 +0200 Subject: [PATCH 300/328] Set release version to 5.12.0 --- release-versions.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release-versions.txt b/release-versions.txt index f74d8c8579..60a3b95880 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,3 +1,3 @@ -RELEASE_VERSION="5.12.0.RC2" -DEVELOPMENT_VERSION="5.12.0-SNAPSHOT" +RELEASE_VERSION="5.12.0" +DEVELOPMENT_VERSION="5.13.0-SNAPSHOT" RELEASE_BRANCH="5.x.x-stable" From a969598816bcc39a56bfa6b5cb4bf9fc549cfc50 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 9 Apr 2021 06:44:12 +0000 Subject: [PATCH 301/328] [maven-release-plugin] prepare release v5.12.0 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index a41a16e2cb..2eb5bf8db8 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.12.0-SNAPSHOT + 5.12.0 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.12.0 From 3731fb1b56746a5ba9db27deb4968407d9b21c26 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Fri, 9 Apr 2021 06:44:15 +0000 Subject: [PATCH 302/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 2eb5bf8db8..56e1e85742 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.12.0 + 5.13.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.12.0 + HEAD From 08c0761cde7ead0d3faa183aa78da1d695cc1106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 9 Apr 2021 08:53:42 +0200 Subject: [PATCH 303/328] Set release version to 5.13.0.RC1 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index 60a3b95880..6444570f66 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,3 +1,3 @@ -RELEASE_VERSION="5.12.0" +RELEASE_VERSION="5.13.0.RC1" DEVELOPMENT_VERSION="5.13.0-SNAPSHOT" RELEASE_BRANCH="5.x.x-stable" From 21a77a62c6859808d128767aaa2b25850dd4caf2 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Wed, 14 Apr 2021 15:31:12 +0300 Subject: [PATCH 304/328] Merge pull request #682 from laurio/patch-1 fix typo in ForgivingExceptionHandler.java (cherry picked from commit 05a87e1cb8f7dc587c26243131896822f983e277) --- .../com/rabbitmq/client/impl/ForgivingExceptionHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/client/impl/ForgivingExceptionHandler.java b/src/main/java/com/rabbitmq/client/impl/ForgivingExceptionHandler.java index 8a7d790382..1c99f0a390 100644 --- a/src/main/java/com/rabbitmq/client/impl/ForgivingExceptionHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/ForgivingExceptionHandler.java @@ -33,7 +33,7 @@ public class ForgivingExceptionHandler implements ExceptionHandler { @Override public void handleUnexpectedConnectionDriverException(Connection conn, Throwable exception) { - log("An unexpected connection driver error occured", exception); + log("An unexpected connection driver error occurred", exception); } @Override From c5bfe2d89449580f63b8ae9299d205a9f6fa9f63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 19 Apr 2021 14:53:23 +0200 Subject: [PATCH 305/328] Bump optional dependencies References #683 (cherry picked from commit 8b37859321ae8102c42be3c66f1b1aa7e06a3abf) --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 56e1e85742..831e088764 100644 --- a/pom.xml +++ b/pom.xml @@ -55,9 +55,9 @@ UTF-8 1.7.30 - 4.1.18 - 1.6.5 - 2.12.2 + 4.1.19 + 1.6.6 + 2.12.3 1.2.3 4.13.2 3.9.0 From d0fd731908a17719b5d8a97abdce59acfc6e103d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 19 Apr 2021 14:54:34 +0200 Subject: [PATCH 306/328] Bump test dependency (cherry picked from commit b7fe5206f8e1163c3b41484a5b30ee738ac48bc5) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 831e088764..447e8aafa7 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 4.13.2 3.9.0 3.19.0 - 9.4.39.v20210325 + 9.4.40.v20210413 1.68 3.2.0 From a3470e91c534ba4c10c1e0364afc9d8c004dfbe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 29 Apr 2021 17:24:47 +0200 Subject: [PATCH 307/328] Bump metrics References #683 (cherry picked from commit 8ccbc13a442f0a8e9f269e45d2a1406215fcae46) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 447e8aafa7..985478d5eb 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,7 @@ UTF-8 1.7.30 - 4.1.19 + 4.1.20 1.6.6 2.12.3 1.2.3 From 19bd212dcd61c8ca28b3df02e8fefaf327298739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 7 May 2021 14:27:44 +0200 Subject: [PATCH 308/328] Bump metrics References #683 (cherry picked from commit 518f6db5054c6ae62173c4fedcd0fd39c76a8fdf) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 985478d5eb..7b233380d7 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,7 @@ UTF-8 1.7.30 - 4.1.20 + 4.1.21 1.6.6 2.12.3 1.2.3 From c52f2f07e488b038ab9412efb2a7b83b802835e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 17 May 2021 09:15:06 +0200 Subject: [PATCH 309/328] Bump dependencies References #683 (cherry picked from commit f2853a394acda365ef5fc0d90e75d7cce03f014d) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 7b233380d7..e9dbd1c121 100644 --- a/pom.xml +++ b/pom.xml @@ -55,8 +55,8 @@ UTF-8 1.7.30 - 4.1.21 - 1.6.6 + 4.2.0 + 1.7.0 2.12.3 1.2.3 4.13.2 From 339ca7279a158b318722e3882fdf6de2cc568aab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 17 May 2021 09:15:52 +0200 Subject: [PATCH 310/328] Bump Mockito (cherry picked from commit e3ae28cd3e8aa8bf9a487a352fac561586fff367) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e9dbd1c121..e54a1336b0 100644 --- a/pom.xml +++ b/pom.xml @@ -60,7 +60,7 @@ 2.12.3 1.2.3 4.13.2 - 3.9.0 + 3.10.0 3.19.0 9.4.40.v20210413 1.68 From c76be10eeab9e76e597d81bb36ce59c851ad51f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 17 May 2021 10:07:54 +0200 Subject: [PATCH 311/328] Fix TLS configuration for Java 13.0.7 (cherry picked from commit cc7c86773e439d4244cf1a6a6be3ef9bf86be44e) --- ...CredentialsGrantCredentialsProviderTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java b/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java index bcf96c7f1c..0a08125d8f 100644 --- a/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java +++ b/src/test/java/com/rabbitmq/client/impl/OAuth2ClientCredentialsGrantCredentialsProviderTest.java @@ -28,6 +28,7 @@ import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.junit.After; +import org.junit.Before; import org.junit.Test; import javax.net.ssl.SSLContext; @@ -56,8 +57,24 @@ public class OAuth2ClientCredentialsGrantCredentialsProviderTest { Server server; + static boolean isJava13() { + String javaVersion = System.getProperty("java.version"); + return javaVersion != null && javaVersion.startsWith("13."); + } + + @Before + public void init() { + if (isJava13()) { + // for Java 13.0.7, see https://github.com/bcgit/bc-java/issues/941 + System.setProperty("keystore.pkcs12.keyProtectionAlgorithm", "PBEWithHmacSHA256AndAES_256"); + } + } + @After public void tearDown() throws Exception { + if (isJava13()) { + System.setProperty("keystore.pkcs12.keyProtectionAlgorithm", ""); + } if (server != null) { server.stop(); } From d7d100ab5e308c6090ddb5cb0e95979b99c632a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 7 Jun 2021 15:08:29 +0200 Subject: [PATCH 312/328] Bump test dependencies (cherry picked from commit 4dde118ff77b5e210e5569db15b4cc757800d92b) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index e54a1336b0..9ac502476c 100644 --- a/pom.xml +++ b/pom.xml @@ -60,9 +60,9 @@ 2.12.3 1.2.3 4.13.2 - 3.10.0 + 3.11.0 3.19.0 - 9.4.40.v20210413 + 9.4.41.v20210516 1.68 3.2.0 From ecbc577846b1a3f8ff1c56d590b6e68014ead86e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 14 Jun 2021 10:13:58 +0200 Subject: [PATCH 313/328] Bump test dependencies (cherry picked from commit 39fe12273feef0f0e18b221628fae60a780cce26) --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 9ac502476c..eb91c16cf6 100644 --- a/pom.xml +++ b/pom.xml @@ -60,10 +60,10 @@ 2.12.3 1.2.3 4.13.2 - 3.11.0 + 3.11.1 3.19.0 - 9.4.41.v20210516 - 1.68 + 9.4.42.v20210604 + 1.69 3.2.0 2.5.3 From d366c987634d8e2a3ed0a43a8b78e7e365fb14b2 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Sun, 20 Jun 2021 10:35:47 +0800 Subject: [PATCH 314/328] Move resolved address shuffling to AddressResolver so that it can be overridden by implementations, e.g. to perform no shuffling at all. References #690. (cherry picked from commit a4e76fb49e8b7676e4ba4ab3acb2e95a9282de38) --- src/main/java/com/rabbitmq/client/AddressResolver.java | 7 +++++++ .../impl/recovery/RecoveryAwareAMQConnectionFactory.java | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/rabbitmq/client/AddressResolver.java b/src/main/java/com/rabbitmq/client/AddressResolver.java index 8350bac153..2451912845 100644 --- a/src/main/java/com/rabbitmq/client/AddressResolver.java +++ b/src/main/java/com/rabbitmq/client/AddressResolver.java @@ -16,6 +16,8 @@ package com.rabbitmq.client; import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -30,4 +32,9 @@ public interface AddressResolver { */ List
getAddresses() throws IOException; + default List
maybeShuffle(List
input) { + List
list = new ArrayList
(input); + Collections.shuffle(list); + return list; + } } diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnectionFactory.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnectionFactory.java index ab23cc4494..6c1b56b121 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnectionFactory.java @@ -55,7 +55,8 @@ public RecoveryAwareAMQConnectionFactory(ConnectionParams params, FrameHandlerFa // package protected API, made public for testing only public RecoveryAwareAMQConnection newConnection() throws IOException, TimeoutException { Exception lastException = null; - List
shuffled = shuffle(addressResolver.getAddresses()); + List
resolved = addressResolver.getAddresses(); + List
shuffled = addressResolver.maybeShuffle(resolved); for (Address addr : shuffled) { try { From f04572f79964c5c47dfe2ccfc469b205fb252e68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 21 Jun 2021 09:08:51 +0200 Subject: [PATCH 315/328] Document optional shuffling in AddressResolver References #691. (cherry picked from commit 3415f888fcc4955483c937a76e225403db161488) --- .../com/rabbitmq/client/AddressResolver.java | 40 ++++++++++++------- .../RecoveryAwareAMQConnectionFactory.java | 6 --- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/AddressResolver.java b/src/main/java/com/rabbitmq/client/AddressResolver.java index 2451912845..4a90a8e014 100644 --- a/src/main/java/com/rabbitmq/client/AddressResolver.java +++ b/src/main/java/com/rabbitmq/client/AddressResolver.java @@ -20,21 +20,33 @@ import java.util.Collections; import java.util.List; -/** - * Strategy interface to get the potential servers to connect to. - */ +/** Strategy interface to get the potential servers to connect to. */ public interface AddressResolver { - /** - * Get the potential {@link Address}es to connect to. - * @return candidate {@link Address}es - * @throws IOException if it encounters a problem - */ - List
getAddresses() throws IOException; + /** + * Get the potential {@link Address}es to connect to. + * + * @return candidate {@link Address}es + * @throws IOException if it encounters a problem + */ + List
getAddresses() throws IOException; - default List
maybeShuffle(List
input) { - List
list = new ArrayList
(input); - Collections.shuffle(list); - return list; - } + /** + * Optionally shuffle the list of addresses returned by {@link #getAddresses()}. + * + *

The automatic connection recovery calls this method after {@link #getAddresses()} to pick a + * random address for reconnecting. + * + *

The default method implementation calls {@link Collections#shuffle(List)}. Custom + * implementations can choose to not do any shuffling to have more predictability in the + * reconnection. + * + * @param input + * @return potentially shuffled list of addresses. + */ + default List

maybeShuffle(List
input) { + List
list = new ArrayList
(input); + Collections.shuffle(list); + return list; + } } diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnectionFactory.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnectionFactory.java index 6c1b56b121..0dc677363f 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveryAwareAMQConnectionFactory.java @@ -82,12 +82,6 @@ public RecoveryAwareAMQConnection newConnection() throws IOException, TimeoutExc throw new IOException("failed to connect"); } - private static List
shuffle(List
addrs) { - List
list = new ArrayList
(addrs); - Collections.shuffle(list); - return list; - } - protected RecoveryAwareAMQConnection createConnection(ConnectionParams params, FrameHandler handler, MetricsCollector metricsCollector) { return new RecoveryAwareAMQConnection(params, handler, metricsCollector); } From 60cefd002e3fbc0a2c04a439fce5d32264ae28df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 21 Jun 2021 09:26:05 +0200 Subject: [PATCH 316/328] Bump dependencies References #683 (cherry picked from commit c8a3fa5dcff93947a20d8cd4b52b75c58d87599b) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index eb91c16cf6..e0b76ff6ea 100644 --- a/pom.xml +++ b/pom.xml @@ -54,8 +54,8 @@ UTF-8 UTF-8 - 1.7.30 - 4.2.0 + 1.7.31 + 4.2.1 1.7.0 2.12.3 1.2.3 From b56e8f7367eae6ad14b406f15bca16fcd0d45891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Mon, 21 Jun 2021 09:26:49 +0200 Subject: [PATCH 317/328] Bump assertj (cherry picked from commit e32bcbb2824f7616a13acd5827a87ca92e54f08f) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e0b76ff6ea..3bf0a89ff9 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ 1.2.3 4.13.2 3.11.1 - 3.19.0 + 3.20.2 9.4.42.v20210604 1.69 From 1f8ddcce84c150d18e22362493659d599718cf86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 24 Jun 2021 15:08:57 +0200 Subject: [PATCH 318/328] Bump dependencies References #683 (cherry picked from commit 3841e6bcd572dc1d5137d032b8f4caee4c6099bf) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 3bf0a89ff9..ac3f52f7cc 100644 --- a/pom.xml +++ b/pom.xml @@ -55,8 +55,8 @@ UTF-8 1.7.31 - 4.2.1 - 1.7.0 + 4.2.2 + 1.7.1 2.12.3 1.2.3 4.13.2 From e935a34a5072dd5efaa20b569dc2dd88e6350bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 24 Jun 2021 15:09:36 +0200 Subject: [PATCH 319/328] Bump Mockito to 3.11.2 (cherry picked from commit 83d5fc35070931cf71e4606c67cfd4c5d30cf31d) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ac3f52f7cc..f9c92a513d 100644 --- a/pom.xml +++ b/pom.xml @@ -60,7 +60,7 @@ 2.12.3 1.2.3 4.13.2 - 3.11.1 + 3.11.2 3.20.2 9.4.42.v20210604 1.69 From 11204feb0c0cdd7997477ccbf04673c79a5f98b3 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Wed, 30 Jun 2021 07:44:09 +0000 Subject: [PATCH 320/328] [maven-release-plugin] prepare release v5.13.0.RC1 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index f9c92a513d..8a563cc01e 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.13.0-SNAPSHOT + 5.13.0.RC1 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.13.0.RC1 From 2bc3e555520df81d30ceba203ee8170ab3498413 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Wed, 30 Jun 2021 07:44:14 +0000 Subject: [PATCH 321/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8a563cc01e..f9c92a513d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.13.0.RC1 + 5.13.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.13.0.RC1 + HEAD From f8763929210da59cdf710a4db6e3b8b4305c33e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 30 Jun 2021 09:49:09 +0200 Subject: [PATCH 322/328] Set release version to 5.13.0.RC2 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index 6444570f66..b350937ea3 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,3 +1,3 @@ -RELEASE_VERSION="5.13.0.RC1" +RELEASE_VERSION="5.13.0.RC2" DEVELOPMENT_VERSION="5.13.0-SNAPSHOT" RELEASE_BRANCH="5.x.x-stable" From e88962d6359d47fe6292ce122e972088e5d93557 Mon Sep 17 00:00:00 2001 From: Michael Dent Date: Wed, 30 Jun 2021 12:15:30 -0500 Subject: [PATCH 323/328] Topology recovery retry fixes --- .../recovery/AutorecoveringConnection.java | 159 +++++++++++------- .../client/impl/recovery/RecordedQueue.java | 18 +- .../recovery/TopologyRecoveryRetryLogic.java | 59 +++++-- 3 files changed, 164 insertions(+), 72 deletions(-) diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java index 98d5a4d610..7b5a1e16af 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java @@ -759,42 +759,15 @@ public void recoverExchange(RecordedExchange x, boolean retry) { } } - + /** + * Recover the queue. Any exceptions during recovery will be delivered to the connection's {@link ExceptionHandler}. + * @param oldName queue name + * @param q recorded queue + * @param retry whether to retry the recovery if an error occurs and a RetryHandler was configured on the connection + */ public void recoverQueue(final String oldName, RecordedQueue q, boolean retry) { try { - if (topologyRecoveryFilter.filterQueue(q)) { - LOGGER.debug("Recovering {}", q); - if (retry) { - final RecordedQueue entity = q; - q = (RecordedQueue) wrapRetryIfNecessary(q, () -> { - entity.recover(); - return null; - }).getRecordedEntity(); - } else { - q.recover(); - } - String newName = q.getName(); - if (!oldName.equals(newName)) { - // make sure server-named queues are re-added with - // their new names. MK. - synchronized (this.recordedQueues) { - this.propagateQueueNameChangeToBindings(oldName, newName); - this.propagateQueueNameChangeToConsumers(oldName, newName); - // bug26552: - // remove old name after we've updated the bindings and consumers, - // plus only for server-named queues, both to make sure we don't lose - // anything to recover. MK. - if(q.isServerNamed()) { - deleteRecordedQueue(oldName); - } - this.recordedQueues.put(newName, q); - } - } - for (QueueRecoveryListener qrl : Utility.copy(this.queueRecoveryListeners)) { - qrl.queueRecovered(oldName, newName); - } - LOGGER.debug("{} has recovered", q); - } + internalRecoverQueue(oldName, q, retry); } catch (Exception cause) { final String message = "Caught an exception while recovering queue " + oldName + ": " + cause.getMessage(); @@ -802,6 +775,52 @@ public void recoverQueue(final String oldName, RecordedQueue q, boolean retry) { this.getExceptionHandler().handleTopologyRecoveryException(delegate, q.getDelegateChannel(), e); } } + + /** + * Recover the queue. Errors are not retried and not delivered to the connection's {@link ExceptionHandler} + * @param oldName queue name + * @param q recorded queue + * @throws Exception if an error occurs recovering the queue + */ + void recoverQueue(final String oldName, RecordedQueue q) throws Exception { + internalRecoverQueue(oldName, q, false); + } + + private void internalRecoverQueue(final String oldName, RecordedQueue q, boolean retry) throws Exception { + if (topologyRecoveryFilter.filterQueue(q)) { + LOGGER.debug("Recovering {}", q); + if (retry) { + final RecordedQueue entity = q; + q = (RecordedQueue) wrapRetryIfNecessary(q, () -> { + entity.recover(); + return null; + }).getRecordedEntity(); + } else { + q.recover(); + } + String newName = q.getName(); + if (!oldName.equals(newName)) { + // make sure server-named queues are re-added with + // their new names. MK. + synchronized (this.recordedQueues) { + this.propagateQueueNameChangeToBindings(oldName, newName); + this.propagateQueueNameChangeToConsumers(oldName, newName); + // bug26552: + // remove old name after we've updated the bindings and consumers, + // plus only for server-named queues, both to make sure we don't lose + // anything to recover. MK. + if(q.isServerNamed()) { + deleteRecordedQueue(oldName); + } + this.recordedQueues.put(newName, q); + } + } + for (QueueRecoveryListener qrl : Utility.copy(this.queueRecoveryListeners)) { + qrl.queueRecovered(oldName, newName); + } + LOGGER.debug("{} has recovered", q); + } + } public void recoverBinding(RecordedBinding b, boolean retry) { try { @@ -825,34 +844,15 @@ public void recoverBinding(RecordedBinding b, boolean retry) { } } + /** + * Recover the consumer. Any exceptions during recovery will be delivered to the connection's {@link ExceptionHandler}. + * @param tag consumer tag + * @param consumer recorded consumer + * @param retry whether to retry the recovery if an error occurs and a RetryHandler was configured on the connection + */ public void recoverConsumer(final String tag, RecordedConsumer consumer, boolean retry) { try { - if (this.topologyRecoveryFilter.filterConsumer(consumer)) { - LOGGER.debug("Recovering {}", consumer); - String newTag = null; - if (retry) { - final RecordedConsumer entity = consumer; - RetryResult retryResult = wrapRetryIfNecessary(consumer, entity::recover); - consumer = (RecordedConsumer) retryResult.getRecordedEntity(); - newTag = (String) retryResult.getResult(); - } else { - newTag = consumer.recover(); - } - - // make sure server-generated tags are re-added. MK. - if(tag != null && !tag.equals(newTag)) { - synchronized (this.consumers) { - this.consumers.remove(tag); - this.consumers.put(newTag, consumer); - } - consumer.getChannel().updateConsumerTag(tag, newTag); - } - - for (ConsumerRecoveryListener crl : Utility.copy(this.consumerRecoveryListeners)) { - crl.consumerRecovered(tag, newTag); - } - LOGGER.debug("{} has recovered", consumer); - } + internalRecoverConsumer(tag, consumer, retry); } catch (Exception cause) { final String message = "Caught an exception while recovering consumer " + tag + ": " + cause.getMessage(); @@ -860,6 +860,45 @@ public void recoverConsumer(final String tag, RecordedConsumer consumer, boolean this.getExceptionHandler().handleTopologyRecoveryException(delegate, consumer.getDelegateChannel(), e); } } + + /** + * Recover the consumer. Errors are not retried and not delivered to the connection's {@link ExceptionHandler} + * @param tag consumer tag + * @param consumer recorded consumer + * @throws Exception if an error occurs recovering the consumer + */ + void recoverConsumer(final String tag, RecordedConsumer consumer) throws Exception { + internalRecoverConsumer(tag, consumer, false); + } + + private void internalRecoverConsumer(final String tag, RecordedConsumer consumer, boolean retry) throws Exception { + if (this.topologyRecoveryFilter.filterConsumer(consumer)) { + LOGGER.debug("Recovering {}", consumer); + String newTag = null; + if (retry) { + final RecordedConsumer entity = consumer; + RetryResult retryResult = wrapRetryIfNecessary(consumer, entity::recover); + consumer = (RecordedConsumer) retryResult.getRecordedEntity(); + newTag = (String) retryResult.getResult(); + } else { + newTag = consumer.recover(); + } + + // make sure server-generated tags are re-added. MK. + if(tag != null && !tag.equals(newTag)) { + synchronized (this.consumers) { + this.consumers.remove(tag); + this.consumers.put(newTag, consumer); + } + consumer.getChannel().updateConsumerTag(tag, newTag); + } + + for (ConsumerRecoveryListener crl : Utility.copy(this.consumerRecoveryListeners)) { + crl.consumerRecovered(tag, newTag); + } + LOGGER.debug("{} has recovered", consumer); + } + } private RetryResult wrapRetryIfNecessary(RecordedEntity entity, Callable recoveryAction) throws Exception { if (this.retryHandler == null) { diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java index 3580fe091e..14dd3f69d4 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java @@ -37,6 +37,10 @@ public RecordedQueue exclusive(boolean value) { this.exclusive = value; return this; } + + public boolean isExclusive() { + return this.exclusive; + } public RecordedQueue serverNamed(boolean value) { this.serverNamed = value; @@ -47,8 +51,6 @@ public boolean isServerNamed() { return this.serverNamed; } - public boolean isAutoDelete() { return this.autoDelete; } - public void recover() throws IOException { this.name = this.channel.getDelegate().queueDeclare(this.getNameToUseForRecovery(), this.durable, @@ -69,17 +71,29 @@ public RecordedQueue durable(boolean value) { this.durable = value; return this; } + + public boolean isDurable() { + return this.durable; + } public RecordedQueue autoDelete(boolean value) { this.autoDelete = value; return this; } + + public boolean isAutoDelete() { + return this.autoDelete; + } public RecordedQueue arguments(Map value) { this.arguments = value; return this; } + public Map getArguments() { + return arguments; + } + @Override public String toString() { return "RecordedQueue[name=" + name + ", durable=" + durable + ", autoDelete=" + autoDelete + ", exclusive=" + exclusive + ", arguments=" + arguments + "serverNamed=" + serverNamed + ", channel=" + channel + "]"; diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java index f947d2fd4f..5781c54d36 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/TopologyRecoveryRetryLogic.java @@ -18,6 +18,9 @@ import com.rabbitmq.client.AMQP; import com.rabbitmq.client.ShutdownSignalException; import com.rabbitmq.utility.Utility; +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.Map.Entry; import java.util.function.BiPredicate; import static com.rabbitmq.client.impl.recovery.TopologyRecoveryRetryHandlerBuilder.builder; @@ -62,7 +65,7 @@ public abstract class TopologyRecoveryRetryLogic { if (context.entity() instanceof RecordedQueue) { final RecordedQueue recordedQueue = context.queue(); AutorecoveringConnection connection = context.connection(); - connection.recoverQueue(recordedQueue.getName(), recordedQueue, false); + connection.recoverQueue(recordedQueue.getName(), recordedQueue); } return null; }; @@ -76,9 +79,7 @@ public abstract class TopologyRecoveryRetryLogic { AutorecoveringConnection connection = context.connection(); RecordedQueue recordedQueue = connection.getRecordedQueues().get(binding.getDestination()); if (recordedQueue != null) { - connection.recoverQueue( - recordedQueue.getName(), recordedQueue, false - ); + connection.recoverQueue(recordedQueue.getName(), recordedQueue); } } return null; @@ -122,9 +123,7 @@ public abstract class TopologyRecoveryRetryLogic { AutorecoveringConnection connection = context.connection(); RecordedQueue recordedQueue = connection.getRecordedQueues().get(consumer.getQueue()); if (recordedQueue != null) { - connection.recoverQueue( - recordedQueue.getName(), recordedQueue, false - ); + connection.recoverQueue(recordedQueue.getName(), recordedQueue); } } return null; @@ -165,7 +164,7 @@ public abstract class TopologyRecoveryRetryLogic { } else if (consumer.getChannel() == channel) { final RetryContext retryContext = new RetryContext(consumer, context.exception(), context.connection()); RECOVER_CONSUMER_QUEUE.call(retryContext); - context.connection().recoverConsumer(consumer.getConsumerTag(), consumer, false); + context.connection().recoverConsumer(consumer.getConsumerTag(), consumer); RECOVER_CONSUMER_QUEUE_BINDINGS.call(retryContext); } } @@ -173,6 +172,44 @@ public abstract class TopologyRecoveryRetryLogic { } return null; }; + + /** + * Recover earlier auto-delete or exclusive queues that share the same channel as this retry context + */ + public static final DefaultRetryHandler.RetryOperation RECOVER_PREVIOUS_AUTO_DELETE_QUEUES = context -> { + if (context.entity() instanceof RecordedQueue) { + AutorecoveringConnection connection = context.connection(); + RecordedQueue queue = context.queue(); + // recover all queues for the same channel that had already been recovered successfully before this queue failed. + // If the previous ones were auto-delete or exclusive, they need recovered again + for (Entry entry : Utility.copy(connection.getRecordedQueues()).entrySet()) { + if (entry.getValue() == queue) { + // we have gotten to the queue in this context. Since this is an ordered map we can now break + // as we know we have recovered all the earlier queues on this channel + break; + } else if (queue.getChannel() == entry.getValue().getChannel() + && (entry.getValue().isAutoDelete() || entry.getValue().isExclusive())) { + connection.recoverQueue(entry.getKey(), entry.getValue()); + } + } + } else if (context.entity() instanceof RecordedQueueBinding) { + AutorecoveringConnection connection = context.connection(); + Set queues = new LinkedHashSet<>(); + for (Entry entry : Utility.copy(connection.getRecordedQueues()).entrySet()) { + if (context.entity().getChannel() == entry.getValue().getChannel() + && (entry.getValue().isAutoDelete() || entry.getValue().isExclusive())) { + connection.recoverQueue(entry.getKey(), entry.getValue()); + queues.add(entry.getValue().getName()); + } + } + for (final RecordedBinding binding : Utility.copy(connection.getRecordedBindings())) { + if (binding instanceof RecordedQueueBinding && queues.contains(binding.getDestination())) { + binding.recover(); + } + } + } + return null; + }; /** * Pre-configured {@link TopologyRecoveryRetryHandlerBuilder} that retries recovery of bindings and consumers @@ -188,11 +225,13 @@ public abstract class TopologyRecoveryRetryLogic { .bindingRecoveryRetryCondition(CHANNEL_CLOSED_NOT_FOUND) .consumerRecoveryRetryCondition(CHANNEL_CLOSED_NOT_FOUND) .queueRecoveryRetryOperation(RECOVER_CHANNEL - .andThen(RECOVER_QUEUE)) + .andThen(RECOVER_QUEUE) + .andThen(RECOVER_PREVIOUS_AUTO_DELETE_QUEUES)) .bindingRecoveryRetryOperation(RECOVER_CHANNEL .andThen(RECOVER_BINDING_QUEUE) .andThen(RECOVER_BINDING) - .andThen(RECOVER_PREVIOUS_QUEUE_BINDINGS)) + .andThen(RECOVER_PREVIOUS_QUEUE_BINDINGS) + .andThen(RECOVER_PREVIOUS_AUTO_DELETE_QUEUES)) .consumerRecoveryRetryOperation(RECOVER_CHANNEL .andThen(RECOVER_CONSUMER_QUEUE) .andThen(RECOVER_CONSUMER) From a19879ba07b5bab42c3574010ba39da0f9e44e52 Mon Sep 17 00:00:00 2001 From: Michael Dent Date: Fri, 2 Jul 2021 13:46:13 -0500 Subject: [PATCH 324/328] Allow changing queue name during recovery --- .../com/rabbitmq/client/ConnectionFactory.java | 13 +++++++++++++ .../rabbitmq/client/impl/ConnectionParams.java | 12 +++++++++++- .../impl/recovery/AutorecoveringChannel.java | 6 ++++-- .../recovery/AutorecoveringConnection.java | 14 +++++++++----- .../client/impl/recovery/RecordedQueue.java | 15 ++++++++++----- .../recovery/RecoveredQueueNameSupplier.java | 18 ++++++++++++++++++ 6 files changed, 65 insertions(+), 13 deletions(-) create mode 100644 src/main/java/com/rabbitmq/client/impl/recovery/RecoveredQueueNameSupplier.java diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index b3b8612b59..6488be4838 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -19,6 +19,7 @@ import com.rabbitmq.client.impl.nio.NioParams; import com.rabbitmq.client.impl.nio.SocketChannelFrameHandlerFactory; import com.rabbitmq.client.impl.recovery.AutorecoveringConnection; +import com.rabbitmq.client.impl.recovery.RecoveredQueueNameSupplier; import com.rabbitmq.client.impl.recovery.RetryHandler; import com.rabbitmq.client.impl.recovery.TopologyRecoveryFilter; import org.slf4j.Logger; @@ -190,6 +191,8 @@ public class ConnectionFactory implements Cloneable { * @since 5.4.0 */ private RetryHandler topologyRecoveryRetryHandler; + + private RecoveredQueueNameSupplier recoveredQueueNameSupplier; /** * Traffic listener notified of inbound and outbound {@link Command}s. @@ -1267,6 +1270,7 @@ public ConnectionParams params(ExecutorService consumerWorkServiceExecutor) { result.setTopologyRecoveryFilter(topologyRecoveryFilter); result.setConnectionRecoveryTriggeringCondition(connectionRecoveryTriggeringCondition); result.setTopologyRecoveryRetryHandler(topologyRecoveryRetryHandler); + result.setRecoveredQueueNameSupplier(recoveredQueueNameSupplier); result.setTrafficListener(trafficListener); result.setCredentialsRefreshService(credentialsRefreshService); return result; @@ -1648,6 +1652,15 @@ public void setConnectionRecoveryTriggeringCondition(Predicate connectionRecoveryTriggeringCondition; private RetryHandler topologyRecoveryRetryHandler; - + private RecoveredQueueNameSupplier recoveredQueueNameSupplier; + private ExceptionHandler exceptionHandler; private ThreadFactory threadFactory; @@ -271,6 +273,14 @@ public void setTopologyRecoveryRetryHandler(RetryHandler topologyRecoveryRetryHa public RetryHandler getTopologyRecoveryRetryHandler() { return topologyRecoveryRetryHandler; } + + public void setRecoveredQueueNameSupplier(RecoveredQueueNameSupplier recoveredQueueNameSupplier) { + this.recoveredQueueNameSupplier = recoveredQueueNameSupplier; + } + + public RecoveredQueueNameSupplier getRecoveredQueueNameSupplier() { + return recoveredQueueNameSupplier; + } public void setTrafficListener(TrafficListener trafficListener) { this.trafficListener = trafficListener; diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java index 97cacc81b0..cfba283dd2 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java @@ -355,7 +355,8 @@ public void queueDeclareNoWait(String queue, durable(durable). exclusive(exclusive). autoDelete(autoDelete). - arguments(arguments); + arguments(arguments). + recoveredQueueNameSupplier(connection.getRecoveredQueueNameSupplier()); delegate.queueDeclareNoWait(queue, durable, exclusive, autoDelete, arguments); recordQueue(queue, meta); @@ -848,7 +849,8 @@ private void recordQueue(AMQP.Queue.DeclareOk ok, String queue, boolean durable, durable(durable). exclusive(exclusive). autoDelete(autoDelete). - arguments(arguments); + arguments(arguments). + recoveredQueueNameSupplier(connection.getRecoveredQueueNameSupplier()); if (queue.equals(RecordedQueue.EMPTY_STRING)) { q.serverNamed(true); } diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java index 98d5a4d610..c332e06fc4 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java @@ -96,6 +96,8 @@ public class AutorecoveringConnection implements RecoverableConnection, NetworkC private final Predicate connectionRecoveryTriggeringCondition; private final RetryHandler retryHandler; + + private final RecoveredQueueNameSupplier recoveredQueueNameSupplier; public AutorecoveringConnection(ConnectionParams params, FrameHandlerFactory f, List
addrs) { this(params, f, new ListAddressResolver(addrs)); @@ -119,6 +121,8 @@ public AutorecoveringConnection(ConnectionParams params, FrameHandlerFactory f, letAllPassFilter() : params.getTopologyRecoveryFilter(); this.retryHandler = params.getTopologyRecoveryRetryHandler(); + this.recoveredQueueNameSupplier = params.getRecoveredQueueNameSupplier() == null ? + RecordedQueue.DEFAULT_QUEUE_NAME_SUPPLIER : params.getRecoveredQueueNameSupplier(); } private void setupErrorOnWriteListenerForPotentialRecovery() { @@ -564,6 +568,10 @@ public void addConsumerRecoveryListener(ConsumerRecoveryListener listener) { public void removeConsumerRecoveryListener(ConsumerRecoveryListener listener) { this.consumerRecoveryListeners.remove(listener); } + + RecoveredQueueNameSupplier getRecoveredQueueNameSupplier() { + return this.recoveredQueueNameSupplier; + } private synchronized void beginAutomaticRecovery() throws InterruptedException { final long delay = this.params.getRecoveryDelayHandler().getDelay(0); @@ -782,11 +790,7 @@ public void recoverQueue(final String oldName, RecordedQueue q, boolean retry) { this.propagateQueueNameChangeToConsumers(oldName, newName); // bug26552: // remove old name after we've updated the bindings and consumers, - // plus only for server-named queues, both to make sure we don't lose - // anything to recover. MK. - if(q.isServerNamed()) { - deleteRecordedQueue(oldName); - } + deleteRecordedQueue(oldName); this.recordedQueues.put(newName, q); } } diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java index 3580fe091e..d18fe8c99d 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java @@ -23,6 +23,10 @@ */ public class RecordedQueue extends RecordedNamedEntity { public static final String EMPTY_STRING = ""; + + static final RecoveredQueueNameSupplier DEFAULT_QUEUE_NAME_SUPPLIER = q -> q.isServerNamed() ? EMPTY_STRING : q.name; + + private RecoveredQueueNameSupplier recoveredQueueNameSupplier = DEFAULT_QUEUE_NAME_SUPPLIER; private boolean durable; private boolean autoDelete; private Map arguments; @@ -58,11 +62,7 @@ public void recover() throws IOException { } public String getNameToUseForRecovery() { - if(isServerNamed()) { - return EMPTY_STRING; - } else { - return this.name; - } + return recoveredQueueNameSupplier.getNameToUseForRecovery(this); } public RecordedQueue durable(boolean value) { @@ -80,6 +80,11 @@ public RecordedQueue arguments(Map value) { return this; } + public RecordedQueue recoveredQueueNameSupplier(RecoveredQueueNameSupplier recoveredQueueNameSupplier) { + this.recoveredQueueNameSupplier = recoveredQueueNameSupplier; + return this; + } + @Override public String toString() { return "RecordedQueue[name=" + name + ", durable=" + durable + ", autoDelete=" + autoDelete + ", exclusive=" + exclusive + ", arguments=" + arguments + "serverNamed=" + serverNamed + ", channel=" + channel + "]"; diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveredQueueNameSupplier.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveredQueueNameSupplier.java new file mode 100644 index 0000000000..c1fb3bd930 --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveredQueueNameSupplier.java @@ -0,0 +1,18 @@ +package com.rabbitmq.client.impl.recovery; + +/** + * Functional callback interface that can be used to rename a queue during topology recovery. + * Can use along with {@link QueueRecoveryListener} to know when such a queue has been recovered successfully. + * + * @see QueueRecoveryListener + */ +@FunctionalInterface +public interface RecoveredQueueNameSupplier { + + /** + * Get the queue name to use when recovering this RecordedQueue entity + * @param recordedQueue the queue to be recovered + * @return new queue name + */ + String getNameToUseForRecovery(final RecordedQueue recordedQueue); +} \ No newline at end of file From 3b6dbbb17f2d5cbd4d5f0ace6e02927558a9cdc2 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Wed, 30 Jun 2021 07:44:09 +0000 Subject: [PATCH 325/328] [maven-release-plugin] prepare release v5.13.0.RC1 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index f9c92a513d..8a563cc01e 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.13.0-SNAPSHOT + 5.13.0.RC1 jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - HEAD + v5.13.0.RC1 From eb1d711f0659a7aca37e605cd86531c4bc6419c4 Mon Sep 17 00:00:00 2001 From: pivotal-rabbitmq-ci Date: Wed, 30 Jun 2021 07:44:14 +0000 Subject: [PATCH 326/328] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8a563cc01e..f9c92a513d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rabbitmq amqp-client - 5.13.0.RC1 + 5.13.0-SNAPSHOT jar RabbitMQ Java Client @@ -42,7 +42,7 @@ https://github.com/rabbitmq/rabbitmq-java-client scm:git:git://github.com/rabbitmq/rabbitmq-java-client.git scm:git:git@github.com:rabbitmq/rabbitmq-java-client.git - v5.13.0.RC1 + HEAD From 318b784888305303b393c61328495749ecc39c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 30 Jun 2021 09:49:09 +0200 Subject: [PATCH 327/328] Set release version to 5.13.0.RC2 --- release-versions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-versions.txt b/release-versions.txt index 6444570f66..b350937ea3 100644 --- a/release-versions.txt +++ b/release-versions.txt @@ -1,3 +1,3 @@ -RELEASE_VERSION="5.13.0.RC1" +RELEASE_VERSION="5.13.0.RC2" DEVELOPMENT_VERSION="5.13.0-SNAPSHOT" RELEASE_BRANCH="5.x.x-stable" From f3af73e9dd76d4e1d0fb2f0bd619838567f57fb2 Mon Sep 17 00:00:00 2001 From: Michael Dent Date: Fri, 2 Jul 2021 13:46:13 -0500 Subject: [PATCH 328/328] Allow changing queue name during recovery Author: Michael Dent --- .../com/rabbitmq/client/ConnectionFactory.java | 13 +++++++++++++ .../rabbitmq/client/impl/ConnectionParams.java | 12 +++++++++++- .../impl/recovery/AutorecoveringChannel.java | 6 ++++-- .../recovery/AutorecoveringConnection.java | 18 +++++++++++------- .../client/impl/recovery/RecordedQueue.java | 17 +++++++++++------ .../recovery/RecoveredQueueNameSupplier.java | 18 ++++++++++++++++++ 6 files changed, 68 insertions(+), 16 deletions(-) create mode 100644 src/main/java/com/rabbitmq/client/impl/recovery/RecoveredQueueNameSupplier.java diff --git a/src/main/java/com/rabbitmq/client/ConnectionFactory.java b/src/main/java/com/rabbitmq/client/ConnectionFactory.java index b3b8612b59..6488be4838 100644 --- a/src/main/java/com/rabbitmq/client/ConnectionFactory.java +++ b/src/main/java/com/rabbitmq/client/ConnectionFactory.java @@ -19,6 +19,7 @@ import com.rabbitmq.client.impl.nio.NioParams; import com.rabbitmq.client.impl.nio.SocketChannelFrameHandlerFactory; import com.rabbitmq.client.impl.recovery.AutorecoveringConnection; +import com.rabbitmq.client.impl.recovery.RecoveredQueueNameSupplier; import com.rabbitmq.client.impl.recovery.RetryHandler; import com.rabbitmq.client.impl.recovery.TopologyRecoveryFilter; import org.slf4j.Logger; @@ -190,6 +191,8 @@ public class ConnectionFactory implements Cloneable { * @since 5.4.0 */ private RetryHandler topologyRecoveryRetryHandler; + + private RecoveredQueueNameSupplier recoveredQueueNameSupplier; /** * Traffic listener notified of inbound and outbound {@link Command}s. @@ -1267,6 +1270,7 @@ public ConnectionParams params(ExecutorService consumerWorkServiceExecutor) { result.setTopologyRecoveryFilter(topologyRecoveryFilter); result.setConnectionRecoveryTriggeringCondition(connectionRecoveryTriggeringCondition); result.setTopologyRecoveryRetryHandler(topologyRecoveryRetryHandler); + result.setRecoveredQueueNameSupplier(recoveredQueueNameSupplier); result.setTrafficListener(trafficListener); result.setCredentialsRefreshService(credentialsRefreshService); return result; @@ -1648,6 +1652,15 @@ public void setConnectionRecoveryTriggeringCondition(Predicate connectionRecoveryTriggeringCondition; private RetryHandler topologyRecoveryRetryHandler; - + private RecoveredQueueNameSupplier recoveredQueueNameSupplier; + private ExceptionHandler exceptionHandler; private ThreadFactory threadFactory; @@ -271,6 +273,14 @@ public void setTopologyRecoveryRetryHandler(RetryHandler topologyRecoveryRetryHa public RetryHandler getTopologyRecoveryRetryHandler() { return topologyRecoveryRetryHandler; } + + public void setRecoveredQueueNameSupplier(RecoveredQueueNameSupplier recoveredQueueNameSupplier) { + this.recoveredQueueNameSupplier = recoveredQueueNameSupplier; + } + + public RecoveredQueueNameSupplier getRecoveredQueueNameSupplier() { + return recoveredQueueNameSupplier; + } public void setTrafficListener(TrafficListener trafficListener) { this.trafficListener = trafficListener; diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java index 97cacc81b0..cfba283dd2 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java @@ -355,7 +355,8 @@ public void queueDeclareNoWait(String queue, durable(durable). exclusive(exclusive). autoDelete(autoDelete). - arguments(arguments); + arguments(arguments). + recoveredQueueNameSupplier(connection.getRecoveredQueueNameSupplier()); delegate.queueDeclareNoWait(queue, durable, exclusive, autoDelete, arguments); recordQueue(queue, meta); @@ -848,7 +849,8 @@ private void recordQueue(AMQP.Queue.DeclareOk ok, String queue, boolean durable, durable(durable). exclusive(exclusive). autoDelete(autoDelete). - arguments(arguments); + arguments(arguments). + recoveredQueueNameSupplier(connection.getRecoveredQueueNameSupplier()); if (queue.equals(RecordedQueue.EMPTY_STRING)) { q.serverNamed(true); } diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java index 7b5a1e16af..9cb0dbff59 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringConnection.java @@ -96,6 +96,8 @@ public class AutorecoveringConnection implements RecoverableConnection, NetworkC private final Predicate connectionRecoveryTriggeringCondition; private final RetryHandler retryHandler; + + private final RecoveredQueueNameSupplier recoveredQueueNameSupplier; public AutorecoveringConnection(ConnectionParams params, FrameHandlerFactory f, List
addrs) { this(params, f, new ListAddressResolver(addrs)); @@ -119,6 +121,8 @@ public AutorecoveringConnection(ConnectionParams params, FrameHandlerFactory f, letAllPassFilter() : params.getTopologyRecoveryFilter(); this.retryHandler = params.getTopologyRecoveryRetryHandler(); + this.recoveredQueueNameSupplier = params.getRecoveredQueueNameSupplier() == null ? + RecordedQueue.DEFAULT_QUEUE_NAME_SUPPLIER : params.getRecoveredQueueNameSupplier(); } private void setupErrorOnWriteListenerForPotentialRecovery() { @@ -564,6 +568,10 @@ public void addConsumerRecoveryListener(ConsumerRecoveryListener listener) { public void removeConsumerRecoveryListener(ConsumerRecoveryListener listener) { this.consumerRecoveryListeners.remove(listener); } + + RecoveredQueueNameSupplier getRecoveredQueueNameSupplier() { + return this.recoveredQueueNameSupplier; + } private synchronized void beginAutomaticRecovery() throws InterruptedException { final long delay = this.params.getRecoveryDelayHandler().getDelay(0); @@ -800,18 +808,14 @@ private void internalRecoverQueue(final String oldName, RecordedQueue q, boolean } String newName = q.getName(); if (!oldName.equals(newName)) { - // make sure server-named queues are re-added with - // their new names. MK. + // make sure queues are re-added with + // their new names, if applicable. MK. synchronized (this.recordedQueues) { this.propagateQueueNameChangeToBindings(oldName, newName); this.propagateQueueNameChangeToConsumers(oldName, newName); // bug26552: // remove old name after we've updated the bindings and consumers, - // plus only for server-named queues, both to make sure we don't lose - // anything to recover. MK. - if(q.isServerNamed()) { - deleteRecordedQueue(oldName); - } + deleteRecordedQueue(oldName); this.recordedQueues.put(newName, q); } } diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java index 14dd3f69d4..52caced2af 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecordedQueue.java @@ -23,6 +23,10 @@ */ public class RecordedQueue extends RecordedNamedEntity { public static final String EMPTY_STRING = ""; + + static final RecoveredQueueNameSupplier DEFAULT_QUEUE_NAME_SUPPLIER = q -> q.isServerNamed() ? EMPTY_STRING : q.name; + + private RecoveredQueueNameSupplier recoveredQueueNameSupplier = DEFAULT_QUEUE_NAME_SUPPLIER; private boolean durable; private boolean autoDelete; private Map arguments; @@ -60,11 +64,7 @@ public void recover() throws IOException { } public String getNameToUseForRecovery() { - if(isServerNamed()) { - return EMPTY_STRING; - } else { - return this.name; - } + return recoveredQueueNameSupplier.getNameToUseForRecovery(this); } public RecordedQueue durable(boolean value) { @@ -89,10 +89,15 @@ public RecordedQueue arguments(Map value) { this.arguments = value; return this; } - + public Map getArguments() { return arguments; } + + public RecordedQueue recoveredQueueNameSupplier(RecoveredQueueNameSupplier recoveredQueueNameSupplier) { + this.recoveredQueueNameSupplier = recoveredQueueNameSupplier; + return this; + } @Override public String toString() { diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/RecoveredQueueNameSupplier.java b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveredQueueNameSupplier.java new file mode 100644 index 0000000000..c1fb3bd930 --- /dev/null +++ b/src/main/java/com/rabbitmq/client/impl/recovery/RecoveredQueueNameSupplier.java @@ -0,0 +1,18 @@ +package com.rabbitmq.client.impl.recovery; + +/** + * Functional callback interface that can be used to rename a queue during topology recovery. + * Can use along with {@link QueueRecoveryListener} to know when such a queue has been recovered successfully. + * + * @see QueueRecoveryListener + */ +@FunctionalInterface +public interface RecoveredQueueNameSupplier { + + /** + * Get the queue name to use when recovering this RecordedQueue entity + * @param recordedQueue the queue to be recovered + * @return new queue name + */ + String getNameToUseForRecovery(final RecordedQueue recordedQueue); +} \ No newline at end of file