
com.aol.micro.server.reactive.JobSchedular Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of micro-reactive Show documentation
Show all versions of micro-reactive Show documentation
Opinionated rest microservices
package com.aol.micro.server.reactive;
import java.util.concurrent.ScheduledExecutorService;
import lombok.AllArgsConstructor;
import com.aol.cyclops.control.ReactiveSeq;
import com.aol.cyclops.types.stream.HotStream;
import com.aol.micro.server.events.ScheduledJob;
import com.aol.micro.server.events.SystemData;
@AllArgsConstructor
public class JobSchedular {
private final ScheduledExecutorService ex;
public HotStream> schedule(String expression, ScheduledJob job){
return ReactiveSeq.generate(()->"new job")
.>map(drop->job.scheduleAndLog())
.schedule(expression,ex);
}
public HotStream> scheduleFixedDelay(long fixedDelay, ScheduledJob job){
return ReactiveSeq.generate(()->"new job")
.>map(drop->job.scheduleAndLog())
.scheduleFixedDelay(fixedDelay,ex);
}
public HotStream> scheduleFixedRate(long fixedRate, ScheduledJob job){
return ReactiveSeq.generate(()->"new job")
.>map(drop->job.scheduleAndLog())
.scheduleFixedRate(fixedRate,ex);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy