Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-6783

VMTransportFactory code improvements

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 5.16.0
    • None
    • Broker
    • 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()) {
      ...
      }
      

      Attachments

        1. patchAMQ-6783.txt
          1.0 kB
          Giovanni Liva

        Activity

          People

            mattrpav Matt Pavlovich
            thisthatdc Giovanni Liva
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: