title: Pool filler service with minimum and maximum threshold setting
body: <p>I'd like to make application which has a pool (unlimited) of some objects. When the pool's size reach some minimum threshold I want to start my pool filler service and produce a certain number of new objects (till reaching of maximum threshold).</p>
  
  <p>This is slightly modified version of <code>producer-consumer</code> problem, but somehow I got stuck. As it's easy to create <code>BlockingQueue</code> with limited size and keeping it filled, I have no idea how to solve my problem.</p>
  
  <p>I tried using <code>ReentrantLock</code> and it's <code>Condition</code> objects, but <code>Condition#signal()</code> method requires me to be inside lock, which is totally unnecessary in my case.</p>
  
  <p>In my opinion the best solution would be something like <code>CountDownLatch</code>. Consumers would decrease counter and eventually trigger pool filler service. What is wrong here is <code>CountDownLatch</code>'s unability to restart itself.</p>
  
  <p>Any ideas?</p>
  
  <p><em>in other words</em>: I have a buch of consumer threads and one which is a producer. Producer should wait until minimum threshold is reached, produce some objects, and then wait again.</p>