flow
-
코루틴(Coroutine) 기초프로그래밍/Kotlin 2024. 1. 29. 16:22
코루틴을 사용하기 전 의존성을 추가해야한다. dendendcies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3") testImplementation(kotlin("test)) } runBlocking 코루틴을 생성하는 코루틴 빌더. runBlocking으로 감싼 코드는 코루틴 내부의 코드가 수행이 끝날 때까지 스레드가 블록킹된다. fun main() { runBlocking { println("hello") println(Thread.currentThread().name) } println("world") println(Thread.currentThread().name) } // Hello // main @coroutine#..
-
토비의 봄 TV - Reactive Streams (1)Spring/Webflux 2022. 6. 4. 12:38
Reactive Programming 데이터가 변경될 때 마다 이벤트를 발생시켜서 데이터를 계속적으로 전달하는 Push 방식에 중점을 둔 프로그램 패러다임 Push 방식 (비동기 방식) 비동기 방식으로 데이터의 변화가 발생했을 때 변경이 발생한 곳에서 데이터를 보내주는 방식을 말한다. Iterable 과 Observable Iterable 데이터 순회를 가능하게 해주는 인터페이스이다. java 에서 제공되고 있는 Iterator 패턴의 인터페이스 list 와 같은 collection 들은 Iterable 을 상속 받고 있다. Iterable 를 상속받은 하위 객체들은 for-each loop 를 사용할 수 있다. Iterable 인터페이스 안에는 iterator 라는 메서드가 존재한다. Iterator ..