Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
5.16.0
-
None
-
None
-
Patch Available
-
Patch
Description
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:
if (broker == null || waitForStart > 0) { final long expiry = System.currentTimeMillis() + waitForStart; while ((broker == null || !broker.isStarted()) && expiry > System.currentTimeMillis()) { ... }
To:
if (broker == null && waitForStart > 0) { final long expiry = System.currentTimeMillis() + waitForStart; while ((broker == null || !broker.isStarted()) && expiry > System.currentTimeMillis()) { ... }