spring-templates / spring-concurrency-thread

Spring 프레임워크에서의 Thread 동시성 제어 문제를 다룹니다.
https://spring-templates.github.io/spring-concurrency-thread/
MIT License
0 stars 1 forks source link

Integrated develop #32

Closed haxr369 closed 5 months ago

haxr369 commented 5 months ago

개요

  1. AtomicInteger를 이용한 카운터
  2. CompletableFuture를 이용한 카운터
  3. Synchronized를 이용한 카운터

변경 사항

✨ Feat : 새로운 기 ✅ Test : 테스트 코드 추가

추가 정보

관련 이슈

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 90.47619% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 82.75%. Comparing base (ed4626c) to head (d7e8a86).

Files Patch % Lines
.../concurrency/counter/CompletableFutureCounter.java 81.81% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #32 +/- ## ============================================== + Coverage 62.50% 82.75% +20.25% - Complexity 4 14 +10 ============================================== Files 2 5 +3 Lines 8 29 +21 ============================================== + Hits 5 24 +19 - Misses 3 5 +2 ``` | [Flag](https://app.codecov.io/gh/spring-templates/spring-concurrency-thread/pull/32/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spring-templates) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/spring-templates/spring-concurrency-thread/pull/32/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spring-templates) | `82.75% <90.47%> (?)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spring-templates#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

haxr369 commented 5 months ago

Describe the bug

32 에 AtomicCounterTest에서 아래 그림처럼 카운트 횟수를 지정하는 totalCount를 Integer.MAX_VALUE로 하면 Out Of Memory가 뜨는 문제가 발생합니다.

image
Caused by: java.lang.OutOfMemoryError: Java heap space
    at java.base/java.util.concurrent.AbstractExecutorService.newTaskFor(AbstractExecutorService.java:98)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:122)
    at com.thread.concurrency.AtomicCounterTest.여러_더하기_수행_Executor(AtomicCounterTest.java:37)
    at java.base/java.lang.invoke.LambdaForm$DMH/0x000000a000288800.invokeVirtual(LambdaForm$DMH)
    at java.base/java.lang.invoke.LambdaForm$MH/0x000000a000190800.invoke(LambdaForm$MH)
    at java.base/java.lang.invoke.Invokers$Holder.invokeExact_MT(Invokers$Holder)

To Reproduce Steps to reproduce the behavior:

  1. Go to src/test/java/com/thread/concurrency/AtomicCounterTest.java
  2. totalCount를 Integer.MAX_VALUE로 변경
  3. 테스트 실행
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

ooMia commented 5 months ago

문제는 별도 이슈로 분리했어요