Exemplo n.º 1
0
 @Override
 public void run() {
   QueueContainer queueContainer = getOrCreateContainer();
   if (queueContainer.hasEnoughCapacity()) {
     itemId = queueContainer.offer(data);
     response = true;
   } else {
     response = false;
   }
 }
Exemplo n.º 2
0
 @Override
 public boolean shouldWait() {
   QueueContainer container = getOrCreateContainer();
   return getWaitTimeout() != 0 && !container.hasEnoughCapacity();
 }