All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aol.micro.server.reactive.JobSchedular Maven / Gradle / Ivy

There is a newer version: 0.91.11
Show newest version
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