[
https://issues.apache.org/jira/browse/AMQ-6783?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Giovanni Liva updated AMQ-6783:
-------------------------------
Attachment: patchAMQ-6783.txt
> VMTransportFactory code improvements
> ------------------------------------
>
> Key: AMQ-6783
> URL: https://issues.apache.org/jira/browse/AMQ-6783
> Project: ActiveMQ
> Issue Type: Bug
> Components: Broker
> Affects Versions: 5.16.0
> Reporter: Giovanni Liva
> Attachments: patchAMQ-6783.txt
>
>
> I the class org.apache.activemq.transport.vm.VMTransportFactory we can
> optimize the code of the lookupBroker method.
> When it is called with _waitForStart_ setted to -1, the while loop is never
> executed.
> I suggest to change the if condition from:
> {code:java}
> if (broker == null || waitForStart > 0) {
> final long expiry = System.currentTimeMillis() + waitForStart;
> while ((broker == null || !broker.isStarted()) && expiry >
> System.currentTimeMillis()) {
> ...
> }
> {code}
> To:
> {code:java}
> if (broker == null && waitForStart > 0) {
> final long expiry = System.currentTimeMillis() + waitForStart;
> while ((broker == null || !broker.isStarted()) && expiry >
> System.currentTimeMillis()) {
> ...
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)