Java Code Examples for reactor.core.scheduler.Schedulers#newElastic()

The following examples show how to use reactor.core.scheduler.Schedulers#newElastic() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EmployeeScheduledStreamServiceImpl.java    From Spring-5.0-Cookbook with MIT License 5 votes vote down vote up
@Override
public Flux<Employee> elasticFlow() {
	
	Scheduler elastic = Schedulers.newElastic("elastic-runner");
	Predicate<Employee> validAge = (e) -> {
		System.out.println("filter thread " +Thread.currentThread().getName());
		return e.getAge() > 25;
	};
	Supplier<Flux<Employee>> deferredTask = ()->{
		System.out.println("defer thread "+Thread.currentThread().getName());
		return Flux.fromIterable(employeeDaoImpl.getEmployees());
	};
	Flux<Employee> deferred = Flux.defer(deferredTask).filter(validAge).subscribeOn(elastic);
	return deferred;
}
 
Example 2
Source File: ShakespearePlaysScrabbleParallelOpt.java    From reactor-core with Apache License 2.0 4 votes vote down vote up
@Setup
public void localSetup() {
	scheduler = Schedulers.newElastic("RcParallel");
}
 
Example 3
Source File: AbstractEventHandler.java    From spring-boot-admin with Apache License 2.0 4 votes vote down vote up
protected Scheduler createScheduler() {
	return Schedulers.newElastic(this.getClass().getSimpleName());
}