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)

Reply via email to