class FairQueue implements BlockingQueue<E> {

   @Override
   public E poll ()
   {
      final AtomicInteger count = this.count;
      if (count.get () == 0)
      {
         return null;
      }
      E x = null;
      int c = -1;
      final ReentrantLock lock = this.lock;
      lock.lock ();
      try
      {
         if (count.get () > 0)
         {
            x = getNext (true);
            c = count.getAndDecrement ();
            if (c > 1)
            {
               notEmpty.signal ();
            }
         }
      }
      finally
      {
         lock.unlock ();
      }
      return x;
   }

   public  FairQueue();

}