}
public void process(EntryTaskScheduler<Data, Object> scheduler, Collection<ScheduledEntry<Data, Object>> entries) {
if (entries.isEmpty())
return;
NodeEngine nodeEngine = mapService.getNodeEngine();
if (entries.size() == 1) {
ScheduledEntry<Data, Object> entry = entries.iterator().next();
int partitionId = nodeEngine.getPartitionService().getPartitionId(entry.getKey());
// execute operation if the node is owner of the key (it can be backup)
if (nodeEngine.getThisAddress().equals(nodeEngine.getPartitionService().getPartitionOwner(partitionId))) {
Exception exception = tryStore(scheduler, entry);
if (exception != null) {
logger.severe(exception);
}
}
} else { // if entries size > 0, we will call storeAll
final Queue<ScheduledEntry> duplicateKeys = new LinkedList<ScheduledEntry>();
final Map<Object,Object> map = new HashMap<Object,Object>(entries.size());
for (ScheduledEntry<Data, Object> entry : entries) {
int partitionId = nodeEngine.getPartitionService().getPartitionId(entry.getKey());
// execute operation if the node is owner of the key (it can be backup)
if (nodeEngine.getThisAddress().equals(nodeEngine.getPartitionService().getPartitionOwner(partitionId))) {
final Object key = mapService.toObject(entry.getKey());
if (map.get(key) != null) {
duplicateKeys.offer(new ScheduledEntry<Object, Object>(key, entry.getValue(), entry.getScheduledDelayMillis(), entry.getActualDelaySeconds(), entry.getScheduleStartTimeInNanos()));
continue;
}