use of io.spine.server.tenant.TenantAwareFunction0 in project core-java by SpineEventEngine.
the class Rescheduler method rescheduleForTenant.
private void rescheduleForTenant(final TenantId tenantId) {
final TenantAwareFunction0<Iterator<Command>> func = new TenantAwareFunction0<Iterator<Command>>(tenantId) {
@Override
public Iterator<Command> apply() {
return commandStore().iterator(SCHEDULED);
}
};
final Iterator<Command> commands = func.execute(Empty.getDefaultInstance());
final TenantAwareOperation op = new TenantAwareOperation(tenantId) {
@Override
public void run() {
while (commands.hasNext()) {
final Command command = commands.next();
reschedule(command);
}
}
};
op.execute();
}
Aggregations