You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Giovanni Liva (JIRA)" <ji...@apache.org> on 2017/08/03 07:32:00 UTC

[jira] [Created] (AMQ-6783) VMTransportFactory code improvements

Giovanni Liva created AMQ-6783:
----------------------------------

             Summary: 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


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)