Code example for BlockingQueue

Methods: poll

0
   * @param timeout in milliseconds 
   * @return the requested object 
   * @throws InterruptedException 
   */ 
  public T request(long timeout) throws InterruptedException {
    return this.objects.poll(timeout, TimeUnit.MILLISECONDS);
  } 
 
  public void release(T object) throws InterruptedException {
    if (object != null) {
      this.objects.put(object);
    } 
  } 
 
  public void add(T object) throws InterruptedException {
    this.objects.offer(object);
  } 
 
  public int poolSize() { 
    return objects.size();
  }