Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-7602

TestFromClientSide.testPoolBehavior is incorrect

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.94.5, 0.95.0
    • None
    • None

    Description

      The writer of this test misunderstood ThreadPoolExecutor.

      The test adds Threads as tasks to a ThreadPoolExecutor and then calls join on the Thread objects. But these are not the running threads, it work by pure accident, because Thread happens to implement Runnable.

      pool.submit(threads.get(0));
      ...
      threads.get(0).join();
      

      The join will always return immediately, because the thread never ran.
      This should instead synchronize on the Future returned from submit instead, otherwise there is no guarantee that the threads in the pool actually finished.

      Attachments

        1. 7602-0.94.txt
          2 kB
          Lars Hofhansl
        2. 7602-0.96.txt
          2 kB
          Lars Hofhansl

        Activity

          People

            larsh Lars Hofhansl
            larsh Lars Hofhansl
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: