Skip to content

Conversation

@unifolio0
Copy link

안녕하세요 이상!
revert를 이용하는 방법을 몰라서 해당 pr을 close하고 새로 브랜치 파서 올립니다!

Copy link

@kunsanglee kunsanglee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert 이슈 만들어서 죄송합니다 비토 🥲
간단히 코멘트 남겼으니 답변 주세요!

Comment on lines 26 to 49
@DisplayName("스레드 풀의 크기는 250이다")
@Test
void testServerStop() {
final var executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(250);
for (int i = 0; i < 350; i++) {
executor.submit(logWithSleep());
}
final int expectedPoolSize = 250;
final int expectedQueueSize = 100;

assertThat(expectedPoolSize).isEqualTo(executor.getPoolSize());
assertThat(expectedQueueSize).isEqualTo(executor.getQueue().size());
}

private Runnable logWithSleep() {
return () -> {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
};
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

비토가 이 테스트코드로 어떤 것을 검증하고 싶었는지 의도를 한 번 설명해 주실 수 있을까요? 🙇🏽‍♂️

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Connector 클래스에서 스레드 풀의 크기를 250으로 설정하고 있단 걸 검증하려고 했다가 방법을 못 찾아서 Connector클래스에서 스레드 풀을 설정한 것을 그대로 가져와서 해당 설정이면 스레드 풀의 크기가 250이란 걸 테스트 하려고 했습니다! Connector의 상수의 접근 제한자를 default로 바꿔서 해당 상수값을 가져와 더 이해하기 쉽도록 수정했습니다!

Copy link

@kunsanglee kunsanglee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 반영해주시느라 고생 많았습니다 🤩
비토의 의도를 들으니 더 명확하게 이해 가능했습니다.
4단계 까지 정말 고생 많았어요!
다음 미션도 화이팅입니다 💪

private static final int DEFAULT_PORT = 8080;
private static final int DEFAULT_ACCEPT_COUNT = 100;
private static final int DEFAULT_MAX_THREADS = 250;
static final int DEFAULT_MAX_THREADS = 250;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 좋네요

assertThatThrownBy(() -> {
try (Socket clientSocket = new Socket("localhost", 8080)) {}
}).isInstanceOf(Exception.class);
}).isInstanceOf(ConnectException.class);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 단순 예외가 발생한다 보다 의미 전달이 명확해서 시원하네요!

}

private Runnable logWithSleep() {
private Runnable threadSleep() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍

@kunsanglee kunsanglee merged commit c5c8634 into woowacourse:unifolio0 Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants