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

VMTransportFactory code improvements

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.16.0
    • Fix Version/s: None
    • Component/s: Broker
    • Labels:
      None
    • Patch Info:
      Patch Available
    • Flags:
      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

            • Assignee:
              Unassigned
              Reporter:
              thisthatdc Giovanni Liva
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: