문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
|
reactive_programming:reactor [2019/01/15 11:23] kwon37xi |
reactive_programming:reactor [2020/11/17 15:18] (현재) kwon37xi |
||
|---|---|---|---|
| 줄 2: | 줄 2: | ||
| * http:// | * http:// | ||
| * [[reactive_programming: | * [[reactive_programming: | ||
| + | * [[https:// | ||
| ===== 동기 호출을 비동기로 전환하기(JDBC 등) ===== | ===== 동기 호출을 비동기로 전환하기(JDBC 등) ===== | ||
| 줄 25: | 줄 26: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | <code java> | ||
| + | @Configuration | ||
| + | public class SchedulerConfiguration { | ||
| + | private final Integer connectionPoolSize; | ||
| + | public SchedulerConfiguration(@Value(" | ||
| + | this.connectionPoolSize = connectionPoolSize; | ||
| + | } | ||
| + | @Bean | ||
| + | public Scheduler jdbcScheduler() { | ||
| + | return Schedulers.fromExecutor(Executors.newFixedThreadPool(connectionPoolSize)); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | @Service | ||
| + | public class AddressService { | ||
| + | private final AddressRepository repository; | ||
| + | private final Scheduler scheduler; | ||
| + | public AddressRouter(AddressRepository repository, @Qualifier(" | ||
| + | this.repository = repository; | ||
| + | this.scheduler = scheduler; | ||
| + | } | ||
| + | public Mono< | ||
| + | return async(() -> repository.findAll()); | ||
| + | } | ||
| + | private <T> Mono< | ||
| + | return Mono.fromCallable(callable).publishOn(scheduler); | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Tuning ===== | ||
| + | * [[reactive_programming: | ||
| ===== 참조 ===== | ===== 참조 ===== | ||
| 줄 36: | 줄 70: | ||
| * [[http:// | * [[http:// | ||
| * [[https:// | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||