Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The DiaryPool class creates a thread pool that reuses a fixed number of threads operating off a shared, unbounded queue. At any point, at most NoOfThreadsthreads NoOfThreads threads are actively processing tasks. If additional tasks are submitted when all threads are active, they will wait in the queue until a thread is available. The thread-local state of the thread persists when a thread is recycled.

...

In this execution order, it is expected that the two tasks (t2 and t3) that started using from doSomething2() are expected to observe the current day as Monday. However, because pool thread 1 is reused, t3 observes the day to be Friday.

...