@Override public void process( EntryTaskScheduler<String, Void> scheduler, Collection<ScheduledEntry<String, Void>> entries) { if (entries.isEmpty()) { return; } InternalPartitionService partitionService = nodeEngine.getPartitionService(); OperationService operationService = nodeEngine.getOperationService(); for (ScheduledEntry<String, Void> entry : entries) { String name = entry.getKey(); int partitionId = partitionService.getPartitionId(nodeEngine.toData(name)); CheckAndEvictOperation op = new CheckAndEvictOperation(entry.getKey()); operationService.invokeOnPartition(QueueService.SERVICE_NAME, op, partitionId).getSafely(); } }
public void process( EntryTaskScheduler<String, Void> scheduler, Collection<ScheduledEntry<String, Void>> entries) { if (entries.isEmpty()) { return; } for (ScheduledEntry<String, Void> entry : entries) { String name = entry.getKey(); int partitionId = nodeEngine.getPartitionService().getPartitionId(nodeEngine.toData(name)); final Invocation inv = nodeEngine .getOperationService() .createInvocationBuilder( QueueService.SERVICE_NAME, new CheckAndEvictOperation(entry.getKey()), partitionId) .build(); inv.invoke(); } }
private void setDelays(MapContainer mapContainer, RecordInfo info, Data key, int extraDelay) { long deleteDelay = -1; long writeDelay = -1; long idleDelay; long ttlDelay; if (mapContainer.getMapStoreScheduler() != null) { final ScheduledEntry scheduledEntry = mapContainer.getMapStoreScheduler().get(key); if (scheduledEntry != null) { if (scheduledEntry.getValue() == null) { deleteDelay = extraDelay + findDelayMillis(scheduledEntry); } else { writeDelay = extraDelay + findDelayMillis(scheduledEntry); } } } idleDelay = getDelay(mapContainer.getIdleEvictionScheduler(), key, extraDelay); ttlDelay = getDelay(mapContainer.getTtlEvictionScheduler(), key, extraDelay); // set delays. info.setMapStoreDeleteDelayMillis(deleteDelay); info.setMapStoreWriteDelayMillis(writeDelay); info.setIdleDelayMillis(idleDelay); info.setTtlDelayMillis(ttlDelay); }
public long findDelayMillis(ScheduledEntry entry) { long diffMillis = (System.nanoTime() - entry.getScheduleTimeNanos()) / 1000000; return Math.max(0, entry.getScheduledDelayMillis() - diffMillis); }