동시성 처리 관련 스레드 풀 설정 질문
미해결
@Test @DisplayName("쿠폰 여러 명 발급") void 쿠폰_여러_명_발급() throws InterruptedException { int threadCount = 1000; ExecutorService executorService = Executors.newFixedThreadPool(32); CountDownLatch latch = new CountDownLatch(threadCount); for (int i = 0; i < threadCount; i++) { final int threadNumber = i + 1; Integer key = i; executorService.submit(() -> { try { couponService.issueCoupon(param, usersMap.get(key)); } catch (PessimisticLockingFailureException e) { .... } 쿠폰 발급 동시성 처리 관련해서 테스트 코드 작성 간 궁금한 점이 있어서 질문을 올립니다. 구글링해서 작성해봤는데, 제가 이해하는 게 맞나 싶어서요... Executors.newFixedThreadPool(32) 이렇게 설정해주면, 32 개의 고정된 스레드 풀을 생성한다는 것이고 1,000 명의 유저가 해당 스레드 풀이 나눠서 작업이 수행된다는 것인가요 ? 그러니까 하나의 스레드에서 약 31명의 유저를 담당한다는 뜻일까요 ? 아니면 순차적으로 1,000 명의 유저를 하나의 스레드에 한 명씩 배치하여 작업하는 것이고, 실질적으로 한 순간에 32명의 유저만 작업한다는 뜻일까요 ? ㅠㅠㅠ
- java
- spring
- 멀티스레딩
- 동시성제어
- 동시성





