Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use available processor number for default thread count in consumer w…
…ork service The current value is available processors times 2, which may be overkill nowadays. The commit also allows using the rabbitmq.amqp.client.availableProcessors system property value, which is convenient as it's configuration-based (no code changes required). Fixes #730 (cherry picked from commit 49c5e2c)
- Loading branch information
1 parent
c1735ca
commit 659c21f
Showing
2 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) 2022 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; | ||
|
||
final class Utils { | ||
|
||
private static final int AVAILABLE_PROCESSORS = | ||
Integer.parseInt( | ||
System.getProperty( | ||
"rabbitmq.amqp.client.availableProcessors", | ||
String.valueOf(Runtime.getRuntime().availableProcessors()))); | ||
|
||
static int availableProcessors() { | ||
return AVAILABLE_PROCESSORS; | ||
} | ||
|
||
private Utils() {} | ||
} |