use of com.hazelcast.map.impl.querycache.QueryCacheScheduler in project hazelcast by hazelcast.
the class DefaultPublisherContext method startBackgroundAccumulatorScanner.
private void startBackgroundAccumulatorScanner() {
QueryCacheScheduler scheduler = context.getQueryCacheScheduler();
scheduler.scheduleWithRepetition(new AccumulatorScannerTask(context), SCAN_PERIOD_SECONDS);
}
use of com.hazelcast.map.impl.querycache.QueryCacheScheduler in project hazelcast by hazelcast.
the class ClientQueryCacheContextTest method testGetQueryCacheScheduler.
@Test
public void testGetQueryCacheScheduler() {
QueryCacheScheduler scheduler = context.getQueryCacheScheduler();
assertNotNull(scheduler);
final QuerySchedulerTask task = new QuerySchedulerTask();
scheduler.execute(task);
final QuerySchedulerRepetitionTask repetitionTask = new QuerySchedulerRepetitionTask();
scheduler.scheduleWithRepetition(repetitionTask, 1);
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertTrue(task.executed);
assertTrue(repetitionTask.counter.get() > 1);
}
});
scheduler.shutdown();
}
use of com.hazelcast.map.impl.querycache.QueryCacheScheduler in project hazelcast by hazelcast.
the class DefaultPublisherContext method startRemovalTask.
private void startRemovalTask(final Collection<PartitionAccumulatorRegistry> removalCandidates, String uuid) {
QueryCacheScheduler queryCacheScheduler = context.getQueryCacheScheduler();
ScheduledFuture scheduledFuture = queryCacheScheduler.scheduleWithRepetition(new Runnable() {
@Override
public void run() {
for (PartitionAccumulatorRegistry registry : removalCandidates) {
removePartitionAccumulatorRegistry(registry);
}
}
}, ORPHANED_QUERY_CACHE_REMOVAL_DELAY_SECONDS);
ScheduledFuture prevFuture = removalCandidateFutures.put(uuid, scheduledFuture);
if (prevFuture != null) {
prevFuture.cancel(false);
}
}
Aggregations