private void queueDrain(IBigQueue queue, long count) throws IOException {
   long queueSize = queue.size();
   count = queueSize < count ? queueSize : count;
   for (int i = 0; i < count; i++) {
     queue.dequeue();
   }
 }
 @Override
 public void doWork(final Handler h) {
   System.out.println("doing work round " + round);
   boolean hasErr = false;
   while (true) {
     try {
       byte[] e = queue.dequeue();
       if (e == null) {
         break;
       }
       h.process(fromBytes(e));
     } catch (IOException e) {
       logger.warn("failed to deQueue", e);
       hasErr = true;
       break;
     }
   }
   if (hasErr) {
     backOff += waitOnEmtpyInMs;
   } else {
     backOff = waitOnEmtpyInMs;
   }
   System.out.println("done-doing work " + round);
   round++;
   reSchedule(h);
 }