@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); } }
@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(); }
@Override public boolean shouldWait() { QueueContainer container = getOrCreateContainer(); return getWaitTimeout() != 0 && !container.hasEnoughCapacity(); }
@Override public void run() { QueueContainer queueContainer = getContainer(); QueueItem item = queueContainer.peek(); response = item != null ? item.getData() : null; }