Refine use of substring operations
Closes gh-25445
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.
|
||||
@@ -310,7 +310,7 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
|
||||
int separatorIndex = concurrency.indexOf('-');
|
||||
if (separatorIndex != -1) {
|
||||
setConcurrentConsumers(Integer.parseInt(concurrency.substring(0, separatorIndex)));
|
||||
setMaxConcurrentConsumers(Integer.parseInt(concurrency.substring(separatorIndex + 1, concurrency.length())));
|
||||
setMaxConcurrentConsumers(Integer.parseInt(concurrency.substring(separatorIndex + 1)));
|
||||
}
|
||||
else {
|
||||
setConcurrentConsumers(1);
|
||||
@@ -384,8 +384,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ public class SimpleMessageListenerContainer extends AbstractMessageListenerConta
|
||||
try {
|
||||
int separatorIndex = concurrency.indexOf('-');
|
||||
if (separatorIndex != -1) {
|
||||
setConcurrentConsumers(Integer.parseInt(concurrency.substring(separatorIndex + 1, concurrency.length())));
|
||||
setConcurrentConsumers(Integer.parseInt(concurrency.substring(separatorIndex + 1)));
|
||||
}
|
||||
else {
|
||||
setConcurrentConsumers(Integer.parseInt(concurrency));
|
||||
|
||||
@@ -226,7 +226,7 @@ public class JmsActivationSpecConfig {
|
||||
try {
|
||||
int separatorIndex = concurrency.indexOf('-');
|
||||
if (separatorIndex != -1) {
|
||||
setMaxConcurrency(Integer.parseInt(concurrency.substring(separatorIndex + 1, concurrency.length())));
|
||||
setMaxConcurrency(Integer.parseInt(concurrency.substring(separatorIndex + 1)));
|
||||
}
|
||||
else {
|
||||
setMaxConcurrency(Integer.parseInt(concurrency));
|
||||
|
||||
Reference in New Issue
Block a user