Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1275

Add a tryAcquire() method to TimedSemaphore

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.4
    • 3.5
    • lang.concurrent.*
    • None

    Description

      In order to support non-blocking use cases and be more in-line with Java's Semaphore class, TimedSemaphore should support a tryAcquire() method:

      public boolean tryAcquire();
      

      The method checks whether another permit can be acquired. If so, it acquires the permit and returns true. Otherwise, it returns false without blocking the calling thread.

      Attachments

        1. LANG_1275.patch
          8 kB
          Oliver Heger

        Activity

          People

            Unassigned Unassigned
            oheger Oliver Heger
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: