πŸ’»
Albert's Til
GitHub
  • 맀일맀일 μ‘°κΈˆμ”© μ„±μž₯ν•˜κΈ°
    • README
    • CS
      • Network
      • HTTP
        • NO-CACHE
      • 였λ₯˜ μ½”λ“œ
      • ORM 도ꡬ
      • Design Pattern
        • CQRS Pattern
          • Event Sourcing and CQRS pattern
        • Builder Pattern
    • DB
      • MySQL
        • Timeline
        • Pagination
        • Index
        • Database Performance Optimization Strategies
        • B+ tree
        • MySQL Connectors VS MySQL Shell(Scripting) VS MySQL Workbench
        • MySQL Storage Engine Architecture
      • Normalization & Denormalization
      • JPA
        • @Transactional
        • Why JPA?
        • About JPA
        • N+1 Issue
        • Index
        • ElementCollection&CollectionTable
        • orphanRemoval
        • CascadeType
        • Use Subselect
        • Dynamic Instance Creation
        • Paging
        • Order
        • Spefication
        • mappedBy
      • MongoDB
        • ObjectId
      • Why MySQL?
      • ACID properties of transactions
      • Between JPA and JDBC
      • Identifiers in Hibernate/JPA
    • Java
      • Jackson de/serialize
      • Collections.singletonList() vs List.of()
      • Manage dependencies in Gradle
      • Logging Level
      • Bean Validation
      • JVM Internals
        • Threads
          • Frame
        • Shared Between Threads
          • Classloader
            • Class Loader Hierarchy
            • Loading Linking Initialization
      • Java Collection Framework
      • Annotation
      • Generic
      • λ””λ―Έν„° 법칙
    • Spring
      • Caching
      • Spring Integration Overview
        • ThreadPollTaskExecutor
        • Messaging Bridge
        • Channel Adapter
        • Poller
        • Configuration and @EnableIntegration
        • Message Endpoints
        • Message Channels
      • HATEOAS
      • @Autowired vs Constructor Dependency Injection
      • Spring Security
        • JWT 토큰 μ‚¬μš©ν•œ 인가
        • OAuth 2 Login
        • OAuth 2 인증
        • 인가
        • 인증
        • PasswordEncoder
      • IoC Container
      • Filter,Interceptor,AOP,Argument Resolver
      • Spring Annotation
      • About Spring
    • Kafka
      • Error Channel
    • Infra
      • Scale Up || Scale Out
      • Docker
        • Dockerfile
        • Docker Hub Deploy
        • Command
      • Cloud μœ ν˜•
        • Infrastructure as a Service
        • Platform as a Service
        • Software as a Service
      • 무쀑단 배포
        • μ—”μ§„μ—‘μŠ€(Nginx)
      • μ½”λ“œ μžλ™ 배포
        • Technical
      • AWS EC2
        • PEM(Privacy Enhanced Mail) ν‚€
      • AWS RDS
      • AWS S3
    • CodeSquad
      • Spring Boot Project 1μ£Όμ°¨ 회고
      • Spring Boot Project 2μ£Όμ°¨ 회고
      • Spirng Boot Project 3μ£Όμ°¨ 회고
      • Spring Boot Project 4μ£Όμ°¨ 회고
    • Foody Moody ν”„λ‘œμ νŠΈ
      • Query Performance Comparison
      • HeartCount Asynchronous Issue
      • DeferredResult
      • ResponseBodyEmitter
      • SseEmitter (Spring)
      • Server-Sent Events (SSE)
      • 기술 μŠ€νƒ 적용 이유
      • NO-CACHE(HTTP)
      • Transactional
    • DDD
      • AggregateId
    • Test
      • RestAssured
    • Coding and Algorithmic Problems
      • 819. Most Common Word
      • 344. Reverse String
      • 125. Valid Palindrome
      • 937. Reorder Data in Log Files
    • Node
      • Async... Await...
      • Custom Transactional Decorator Challenger
    • Python
      • Python Basic Grammar
        • Comments and Input/Output
        • Variable
        • Data type
        • Operations and syntax
        • List,Tuple,Dictionary,Set
        • Function
        • Conditional statement
        • Loop
    • HTML
      • HTML Basic
      • HTML Basic Tags
      • HTML Form Tags
      • HTML Table Tags
    • CSS
      • CSS Basic
      • CSS Practice
Powered by GitBook
On this page
  • μ„€μ •
  • setCorePoolSize:
  • setMaxPoolSize:
  • setQueueCapacity:
  • setThreadNamePrefix:
  • setRejectedExecutionHandler:
  • setWaitForTasksToCompleteOnShutdown:
  • setAwaitTerminationSeconds:
  • RejectedExecutionHandler μ •μ±…

Was this helpful?

  1. 맀일맀일 μ‘°κΈˆμ”© μ„±μž₯ν•˜κΈ°
  2. Spring
  3. Spring Integration Overview

ThreadPollTaskExecutor

Spring ν”„λ ˆμž„μ›Œν¬μ—μ„œ μ œκ³΅ν•˜λŠ” μŠ€λ ˆλ“œ 풀을 κ΄€λ¦¬ν•˜λŠ” ν΄λž˜μŠ€μž…λ‹ˆλ‹€

μ„€μ •

setCorePoolSize:

μ½”μ–΄ μŠ€λ ˆλ“œ ν’€μ˜ 크기λ₯Ό μ„€μ •ν•©λ‹ˆλ‹€. 기본적으둜 μƒμ„±λ˜μ–΄ μœ μ§€λ˜λŠ” μŠ€λ ˆλ“œμ˜ μ΅œμ†Œ κ°œμˆ˜μž…λ‹ˆλ‹€.

setMaxPoolSize:

μŠ€λ ˆλ“œ ν’€μ˜ μ΅œλŒ€ 크기λ₯Ό μ„€μ •ν•©λ‹ˆλ‹€. μš”μ²­μ΄ λ§Žμ„ λ•Œ 생성될 수 μžˆλŠ” μŠ€λ ˆλ“œμ˜ μ΅œλŒ€ κ°œμˆ˜μž…λ‹ˆλ‹€.

setQueueCapacity:

μž‘μ—… 큐의 μ΅œλŒ€ 크기λ₯Ό μ„€μ •ν•©λ‹ˆλ‹€. μ½”μ–΄ μŠ€λ ˆλ“œ 풀이 가득 μ°¬ 경우, 이 큐에 μž‘μ—…μ΄ λŒ€κΈ°ν•˜κ²Œ λ©λ‹ˆλ‹€.

setThreadNamePrefix:

μƒμ„±λ˜λŠ” μŠ€λ ˆλ“œμ˜ 이름에 λΆ™λŠ” 접두사λ₯Ό μ„€μ •ν•©λ‹ˆλ‹€.

setRejectedExecutionHandler:

μž‘μ—… 큐와 μŠ€λ ˆλ“œ 풀이 λͺ¨λ‘ 가득 찼을 λ•Œ, μƒˆλ‘œμš΄ μž‘μ—…μ΄ 듀어왔을 λ•Œμ˜ 처리 방식을 μ„€μ •ν•©λ‹ˆλ‹€.

setWaitForTasksToCompleteOnShutdown:

μŠ€λ ˆλ“œ 풀이 μ’…λ£Œλ  λ•Œ μ‹€ν–‰ 쀑인 μž‘μ—…μ΄ μ™„λ£Œλ  것인지 μ—¬λΆ€λ₯Ό μ„€μ •ν•©λ‹ˆλ‹€.

setAwaitTerminationSeconds:

setWaitForTasksToCompleteOnShutdown이 true둜 μ„€μ •λœ 경우, μ’…λ£Œ 전에 μ™„λ£Œλ₯Ό κΈ°λ‹€λ¦¬λŠ” μ‹œκ°„μ„ 초 λ‹¨μœ„λ‘œ μ„€μ •ν•©λ‹ˆλ‹€.

RejectedExecutionHandler μ •μ±…

  1. AbortPolicy (κΈ°λ³Έ μ •μ±…)

    • 이 정책을 μ‚¬μš©ν•˜λ©΄ RejectedExecutionException이 λ°œμƒν•©λ‹ˆλ‹€. 즉, μƒˆλ‘œμš΄ μž‘μ—…μ΄ μŠ€λ ˆλ“œ 풀에 제좜될 λ•Œ μŠ€λ ˆλ“œ 풀이 μ’…λ£Œλ˜κ±°λ‚˜ μ΅œλŒ€ 크기에 λ„λ‹¬ν•˜λ©΄ μ˜ˆμ™Έκ°€ λ°œμƒν•©λ‹ˆλ‹€.

    • μž₯점:

      • λ¬Έμ œκ°€ λ°œμƒν•  λ•Œ 즉각적인 ν”Όλ“œλ°±μ„ μ œκ³΅ν•©λ‹ˆλ‹€.

      • 기본적인 μ •μ±…μ΄λ―€λ‘œ μΆ”κ°€ ꡬ성 없이 μ‚¬μš© κ°€λŠ₯ν•©λ‹ˆλ‹€.

    • 단점:

      • μž‘μ—… μ œμΆœμ— μ‹€νŒ¨ν•  경우 RejectedExecutionException μ˜ˆμ™Έκ°€ λ°œμƒν•˜λ―€λ‘œ 이λ₯Ό 적절히 μ²˜λ¦¬ν•΄μ•Ό ν•©λ‹ˆλ‹€.

  2. CallerRunsPolicy

    • 이 정책은 ν˜ΈμΆœν•œ μŠ€λ ˆλ“œμ—μ„œ μž‘μ—…μ„ μ‹€ν–‰ν•©λ‹ˆλ‹€. μ΄λŠ” μŠ€λ ˆλ“œ ν’€μ—μ„œ μ‹€ν–‰λ˜λŠ” 것보닀 더 느릴 수 μžˆμ§€λ§Œ, μΆ”κ°€ μž‘μ—…μ„ λ²„λ¦¬κ±°λ‚˜ μ˜ˆμ™Έλ₯Ό λ°œμƒμ‹œν‚€μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

    • μž₯점:

      • μž‘μ—…μ΄ νκΈ°λ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

      • μŠ€λ ˆλ“œ ν’€μ˜ 병λͺ© ν˜„μƒμ„ 일뢀 μ™„ν™”ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

      • μΆ”κ°€ μž‘μ—…μ„ λ²„λ¦¬κ±°λ‚˜ μ˜ˆμ™Έλ₯Ό λ°œμƒμ‹œν‚€μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

    • 단점:

      • ν˜ΈμΆœν•œ μŠ€λ ˆλ“œμ—μ„œ μž‘μ—…μ΄ μ‹€ν–‰λ˜κΈ° λ•Œλ¬Έμ— ν•΄λ‹Ή μŠ€λ ˆλ“œμ˜ λ‹€λ₯Έ ν™œλ™μ΄ λΈ”λ‘œν‚Ήλ  수 μžˆμŠ΅λ‹ˆλ‹€.

      • 일반적인 κΈ°λŒ€(μž‘μ—…μ΄ λ³„λ„μ˜ μŠ€λ ˆλ“œμ—μ„œ 싀행될 것)λ₯Ό λ²—μ–΄λ‚  수 μžˆμŠ΅λ‹ˆλ‹€.

  3. DiscardPolicy

    • μƒˆλ‘œμš΄ μž‘μ—…μ΄ μŠ€λ ˆλ“œ 풀에 제좜될 λ•Œ μŠ€λ ˆλ“œ 풀이 꽉 μ°Όλ‹€λ©΄, κ·Έ μž‘μ—…μ„ λ‹¨μˆœνžˆ λ¬΄μ‹œν•©λ‹ˆλ‹€. μ˜ˆμ™ΈλŠ” λ°œμƒν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

    • μž₯점:

      • μ˜ˆμ™Έκ°€ λ°œμƒν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

    • 단점:

      • μƒˆλ‘œμš΄ μž‘μ—…μ΄ λ¬΄μ‹œλ˜λ―€λ‘œ 데이터 손싀 μœ„ν—˜μ΄ μžˆμŠ΅λ‹ˆλ‹€.

  4. DiscardOldestPolicy

    • μŠ€λ ˆλ“œ ν’€μ˜ μž‘μ—… 큐에 λŒ€κΈ° 쀑인 κ°€μž₯ 였래된 μž‘μ—…(κ°€μž₯ λ¨Όμ € λ“€μ–΄μ˜¨ μž‘μ—…)을 μ œκ±°ν•˜κ³ , μƒˆλ‘œμš΄ μž‘μ—…μ„ 큐에 μΆ”κ°€ν•©λ‹ˆλ‹€. μ΄λ ‡κ²Œ ν•˜λ©΄ 졜근의 μž‘μ—… μš”μ²­μ„ μœ μ§€ν•˜λŠ” λ™μ‹œμ— 큐의 크기λ₯Ό μ΄ˆκ³Όν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

    • μž₯점:

      • μ΅œμ‹ μ˜ μž‘μ—…μ„ 큐에 μœ μ§€ν•©λ‹ˆλ‹€.

      • μ˜ˆμ™Έκ°€ λ°œμƒν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

    • 단점:

      • κ°€μž₯ 였래된 μž‘μ—…μ΄ μ‚­μ œλ˜λ―€λ‘œ, 이전 μž‘μ—…μ— λŒ€ν•œ 데이터 손싀 μœ„ν—˜μ΄ μžˆμŠ΅λ‹ˆλ‹€.

Last updated 1 year ago

Was this helpful?