paulirwin opened a new pull request, #1119:
URL: https://github.com/apache/lucenenet/pull/1119

   - [X] You've read the [Contributor 
Guide](https://github.com/apache/lucenenet/blob/main/CONTRIBUTING.md) and [Code 
of Conduct](https://www.apache.org/foundation/policies/conduct.html).
   - [X] You've included unit or integration tests for your change, where 
applicable.
   - [X] You've included inline docs for your change, where applicable.
   - [X] There's an open issue for the PR that you are making. If you'd like to 
propose a change, please [open an 
issue](https://github.com/apache/lucenenet/issues/new/choose) to discuss the 
change or find an existing issue.
   
   Adds unit tests for LimitedConcurrencyLevelTaskScheduler.
   
   Fixes #1110
   
   ## Description
   
   This adds some Apache Harmony tests for ThreadPoolExecutor and adapts them 
for testing LimitedConcurrencyLevelTaskScheduler (used in Lucene.NET in place 
of ThreadPoolExecutor).
   
   This class, being a TaskScheduler, is only useful when used with i.e. a 
TaskFactory, so it does not have a very testable public API surface. So to 
exercise this class, some extension methods were added in the JSR166TestCase 
file to emulate a ThreadPoolExecutor's API surface. This keeps track of task 
state using a ConditionalWeakTable keyed on TaskScheduler, so that when the 
TaskScheduler is garbage collected, its state is cleaned up. The state is 
needed to track completed tasks, since LimitedConcurrencyLevelTaskScheduler 
removes/dequeues tasks when they are completed. This also implements the 
`joinPool` method in JSR166TestCase via waiting for all tracked tasks for the 
scheduler with a timeout.
   
   This does not port all of the tests from Harmony, since most are irrelevant, 
but it ports enough to test executing tasks, concurrency level, the number of 
running/completed tasks, shutdown state, etc.
   
   As noted in #1110, `FEATURE_THREADPOOL_UNSAFEQUEUEWORKITEM` was removed as 
all targets support this feature.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to