Favor Math.[min|max]() over handcrafted code
In line with the general trend toward favoring core JDK APIs for common tasks in Spring Framework 5.2, this commit replaces handcrafted statements with Math.min() and Math.max() were applicable.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -383,8 +383,7 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
|
||||
public void setMaxConcurrentConsumers(int maxConcurrentConsumers) {
|
||||
Assert.isTrue(maxConcurrentConsumers > 0, "'maxConcurrentConsumers' value must be at least 1 (one)");
|
||||
synchronized (this.lifecycleMonitor) {
|
||||
this.maxConcurrentConsumers =
|
||||
(maxConcurrentConsumers > this.concurrentConsumers ? maxConcurrentConsumers : this.concurrentConsumers);
|
||||
this.maxConcurrentConsumers = Math.max(maxConcurrentConsumers, this.concurrentConsumers);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user