use of io.confluent.ksql.engine.QueryCleanupService.QueryCleanupTask in project ksql by confluentinc.
the class KsqlEngineTest method awaitCleanupComplete.
private void awaitCleanupComplete(final KsqlEngine ksqlEngine) {
// add a task to the end of the queue to make sure that
// we've finished processing everything up until this point
Optional<String> nameTopology;
if (ksqlEngine.getKsqlConfig().getBoolean(KsqlConfig.KSQL_SHARED_RUNTIME_ENABLED)) {
nameTopology = Optional.of("test");
} else {
nameTopology = Optional.empty();
}
ksqlEngine.getCleanupService().addCleanupTask(new QueryCleanupTask(serviceContext, "", nameTopology, false, "", KsqlConfig.KSQL_SERVICE_ID_DEFAULT, KsqlConfig.KSQL_PERSISTENT_QUERY_NAME_PREFIX_DEFAULT) {
@Override
public void run() {
// do nothing
}
});
// with a condition variable wait/notify pattern
while (!ksqlEngine.getCleanupService().isEmpty()) {
Thread.yield();
}
}
Aggregations