@Override
 protected void writeInternal(ObjectDataOutput out) throws IOException {
   out.writeInt(migrationData.size());
   for (Map.Entry<String, QueueContainer> entry : migrationData.entrySet()) {
     out.writeUTF(entry.getKey());
     QueueContainer container = entry.getValue();
     container.writeData(out);
   }
 }
Пример #2
0
 @Override
 public void run() {
   QueueContainer queueContainer = getOrCreateContainer();
   if (queueContainer.hasEnoughCapacity()) {
     itemId = queueContainer.offer(data);
     response = true;
   } else {
     response = false;
   }
 }
 @Override
 protected void readInternal(ObjectDataInput in) throws IOException {
   int mapSize = in.readInt();
   migrationData = new HashMap<String, QueueContainer>(mapSize);
   for (int i = 0; i < mapSize; i++) {
     String name = in.readUTF();
     QueueContainer container = new QueueContainer(name);
     container.readData(in);
     migrationData.put(name, container);
   }
 }
 @Override
 public void run() {
   QueueService service = getService();
   NodeEngine nodeEngine = getNodeEngine();
   Config config = nodeEngine.getConfig();
   for (Map.Entry<String, QueueContainer> entry : migrationData.entrySet()) {
     String name = entry.getKey();
     QueueContainer container = entry.getValue();
     QueueConfig conf = config.findQueueConfig(name);
     container.setConfig(conf, nodeEngine, service);
     service.addContainer(name, container);
   }
 }
 @Override
 public void run() throws Exception {
   QueueContainer queueContainer = getOrCreateContainer();
   queueContainer.pollBackup(itemId);
   response = Boolean.TRUE;
 }
 @Override
 public void run() {
   QueueContainer queueContainer = getOrCreateContainer();
   response = queueContainer.getConfig().getMaxSize() - queueContainer.size();
 }
Пример #7
0
 @Override
 public boolean shouldWait() {
   QueueContainer container = getOrCreateContainer();
   return getWaitTimeout() != 0 && !container.hasEnoughCapacity();
 }
Пример #8
0
 @Override
 public void run() {
   QueueContainer queueContainer = getContainer();
   QueueItem item = queueContainer.peek();
   response = item != null ? item.getData() : null;
 }