Uploaded image for project: 'Commons Pool'
  1. Commons Pool
  2. POOL-46

[pool] BaseObjectPool closed boolean field needs to be volatile

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.2
    • 1.3
    • None
    • Operating System: All
      Platform: All

    • 38690

    Description

      The private field 'closed' in BaseObjectPool needs to be volatile because in a
      multi-threaded environment sub-classes that don't synchronize access before
      calling isOpen() (or asserOpen()) may not see changes to this value in a timely
      manner.

      In leu of attaching a patch I'll just show the correct declaration for line 82:

      private volatile boolean closed = false;

      Attachments

        Activity

          People

            Unassigned Unassigned
            sandymac@apache.org Sandy McArthur (from Bugzilla import)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: