File tree Expand file tree Collapse file tree 6 files changed +75
-3
lines changed
kotlin/info/log/virtualthreadapi Expand file tree Collapse file tree 6 files changed +75
-3
lines changed Original file line number Diff line number Diff line change 8
8
- JVM 20
9
9
- Kotlin 1.9.0-Beta
10
10
- Spring Boot 3.1.0
11
+ - Apache Tomcat 10.1.8
11
12
12
13
참고
14
+
13
15
- https://youtrack.jetbrains.com/issue/KT-57669
14
- - Kotlin 1.9.0-Beta 부터 JVM 20 지원
16
+ - Kotlin 1.9.0-Beta 부터 JVM 20 지원
17
+
18
+ ## 관련 아티클
19
+
20
+ - https://spring.io/blog/2022/10/11/embracing-virtual-threads
15
21
16
22
## Trouble Shooting
17
23
18
- #### ![ img.png] ( README-image/img.png )
24
+ ### Kotlin JVM 버전 관련 컴파일러 에러
25
+
26
+ #### 문제
27
+
28
+ ![ img.png] ( README-image/img.png )
29
+
30
+ #### 해결
31
+
19
32
- project settings에서 Language Level 변경
20
- - ![ img_1.png] ( README-image/img_1.png )
33
+ - ![ img_1.png] ( README-image/img_1.png )
34
+ - IntelliJ 버그인지, 껐다 켜줘야 적용됨
Original file line number Diff line number Diff line change 1
1
2
2
rootProject.name = " java-concurrency-practice"
3
3
include(" platform-thread-api" )
4
+ include(" virtual-thread-api" )
4
5
include(" domain" )
Original file line number Diff line number Diff line change
1
+ dependencies {
2
+ implementation(project(" :domain" ))
3
+ implementation(" org.springframework.boot:spring-boot-starter-web" )
4
+ implementation(kotlin(" stdlib-jdk8" ))
5
+ }
Original file line number Diff line number Diff line change
1
+ package info.log.virtualthreadapi
2
+
3
+ import org.apache.coyote.ProtocolHandler
4
+ import org.springframework.boot.autoconfigure.SpringBootApplication
5
+ import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration
6
+ import org.springframework.boot.runApplication
7
+ import org.springframework.boot.web.embedded.tomcat.TomcatProtocolHandlerCustomizer
8
+ import org.springframework.context.annotation.Bean
9
+ import org.springframework.core.task.AsyncTaskExecutor
10
+ import org.springframework.core.task.support.TaskExecutorAdapter
11
+ import java.util.concurrent.Executors
12
+
13
+
14
+ @SpringBootApplication
15
+ class VirtualThreadApiApplication {
16
+ @Bean(TaskExecutionAutoConfiguration .APPLICATION_TASK_EXECUTOR_BEAN_NAME )
17
+ fun asyncTaskExecutor (): AsyncTaskExecutor {
18
+ return TaskExecutorAdapter (Executors .newVirtualThreadPerTaskExecutor())
19
+ }
20
+
21
+ @Bean
22
+ fun protocolHandlerVirtualThreadExecutorCustomizer (): TomcatProtocolHandlerCustomizer <* > {
23
+ return TomcatProtocolHandlerCustomizer { protocolHandler: ProtocolHandler ->
24
+ protocolHandler.executor = Executors .newVirtualThreadPerTaskExecutor()
25
+ }
26
+ }
27
+ }
28
+
29
+ fun main (args : Array <String >) {
30
+ runApplication<VirtualThreadApiApplication >(* args)
31
+ }
Original file line number Diff line number Diff line change
1
+ package info.log.virtualthreadapi.web
2
+
3
+ import info.log.domain.Person
4
+ import org.springframework.web.bind.annotation.GetMapping
5
+ import org.springframework.web.bind.annotation.RestController
6
+
7
+
8
+ @RestController
9
+ class HelloController {
10
+
11
+ @GetMapping(" /hello" )
12
+ fun hello (): List <Person > {
13
+ return Person .createPeopleListRandomly()
14
+ }
15
+ }
Original file line number Diff line number Diff line change
1
+ server :
2
+ port : 10000
3
+ tomcat :
4
+ max-connections : 8192
5
+ accept-count : 100
6
+ connection-timeout : 20000
You can’t perform that action at this time.
0 commit comments