Skip to content

[Issue #3576]:Optimization: In the case of high concurrency,ThreadLocalRandom is better than Random#3578

Closed
mrhbj wants to merge 1 commit into
apache:developfrom
mrhbj:develop
Closed

[Issue #3576]:Optimization: In the case of high concurrency,ThreadLocalRandom is better than Random#3578
mrhbj wants to merge 1 commit into
apache:developfrom
mrhbj:develop

Conversation

@mrhbj
Copy link
Copy Markdown
Contributor

@mrhbj mrhbj commented Dec 3, 2021

DefaultMQProducerImpl .java
code1:
public class DefaultMQProducerImpl implements MQProducerInner { private final InternalLogger log = ClientLogger.getLog(); private final Random random = new Random();

code2:
private SendResult sendDefaultImpl(
Message msg,
final CommunicationMode communicationMode,
final SendCallback sendCallback,
final long timeout
) throws MQClientException, RemotingException, MQBrokerException, InterruptedException {
this.makeSureStateOK();
Validators.checkMessage(msg, this.defaultMQProducer);
final long invokeID = random.nextLong();

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.004%) to 55.154% when pulling 0f05762 on mrhbj:develop into 4daade3 on apache:develop.

@mrhbj mrhbj closed this Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants