-
Notifications
You must be signed in to change notification settings - Fork 388
[4단계 - Tomcat 구현하기] 비토(오상훈) 미션 제출합니다 #768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
kunsanglee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert 이슈 만들어서 죄송합니다 비토 🥲
간단히 코멘트 남겼으니 답변 주세요!
tomcat/src/test/java/org/apache/catalina/connector/ConnectorTest.java
Outdated
Show resolved
Hide resolved
tomcat/src/test/java/org/apache/catalina/connector/ConnectorTest.java
Outdated
Show resolved
Hide resolved
| @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); | ||
| } | ||
| }; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
비토가 이 테스트코드로 어떤 것을 검증하고 싶었는지 의도를 한 번 설명해 주실 수 있을까요? 🙇🏽♂️
There was a problem hiding this comment.
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로 바꿔서 해당 상수값을 가져와 더 이해하기 쉽도록 수정했습니다!
kunsanglee
left a comment
There was a problem hiding this 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; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍👍
안녕하세요 이상!
revert를 이용하는 방법을 몰라서 해당 pr을 close하고 새로 브랜치 파서 올립니다!