Commons Pool
  1. Commons Pool
  2. POOL-182

Issues with org.apache.commons.pool2.performance. PerformanceTest

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Labels:
      None

      Description

      the use volatiles : waiting,complete,totalBorrowTime, totalReturnTime, nrSamples
      is not correct.

      for ex the following totalBorrowTime += borrowTime is not atomic resulting in a
      race condition.

      one way to fix this is using the java.util.concurent Atomic variants or even
      better,
      make these variables members of MyThread and aggregate them at the end of the
      test,
      this way there will be no need to use Atomic and thus increasing efficiency, and
      accuracy of the test of the test.

      also:

      private boolean start;

      needs to be volatile, due to visibility issue.
      (when updating start other threads might not pick up the value)

        Activity

        Hide
        Mohit Soni added a comment -

        Current patch replaces use of volatiles with 'TaskStats' object and 'Callable'(s).
        Each thread executes a 'PerfTask' and collects the stats inside 'TaskStats' object.
        When all threads return, using 'TaskStats' objects of each thread, an aggregate 'TaskStats' object is created and output is displayed.

        Show
        Mohit Soni added a comment - Current patch replaces use of volatiles with 'TaskStats' object and 'Callable'(s). Each thread executes a 'PerfTask' and collects the stats inside 'TaskStats' object. When all threads return, using 'TaskStats' objects of each thread, an aggregate 'TaskStats' object is created and output is displayed.
        Hide
        Simone Tripodi added a comment -

        Thanks for the patch, unfortunately it contains also code reformat that makes not easier to understand what was really the subject of the modification.
        Can you please provide a second patch that only contains your suggestions?
        Thanks in advance!!!

        Show
        Simone Tripodi added a comment - Thanks for the patch, unfortunately it contains also code reformat that makes not easier to understand what was really the subject of the modification. Can you please provide a second patch that only contains your suggestions? Thanks in advance!!!
        Hide
        Mark Thomas added a comment -

        I merged the proposed match manually. Functional changes were kept. Cosmetic ones were not.

        Show
        Mark Thomas added a comment - I merged the proposed match manually. Functional changes were kept. Cosmetic ones were not.

          People

          • Assignee:
            Unassigned
            Reporter:
            Zoltan Farkas
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 4h
              4h
              Remaining:
              Remaining Estimate - 4h
              4h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development