-
Notifications
You must be signed in to change notification settings - Fork 47
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
FEATURE: Add TCP connection keep-alive option. #673
Conversation
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.
리뷰 완료
@@ -919,6 +922,9 @@ private void handleIO(SelectionKey sk) { | |||
if (sk.isConnectable()) { | |||
getLogger().info("Connection state changed for %s", qa); | |||
final SocketChannel channel = qa.getChannel(); | |||
Socket socket = channel.socket(); | |||
socket.setTcpNoDelay(!connFactory.useNagleAlgorithm()); | |||
socket.setKeepAlive(keepAlive); |
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.
connFactory.getKeepAlive()
사용
connFactory.getKeepAlive()
값이 true인 경우만 socket,setKeepAlive() 호출하는 것보다, true/false 관계없이 무조건 호출하는 것이 나은 가요?
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.
ConnectionFactoryBuilder
내의 arcusMigrEnabled
, arcusMigrEnabled
등의 다른 property 변수와의 일관성을 위해 위와 같이 구현하였습니다.
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.
tcp socket option을 설정하는 useNagleAlgorithm()와 일관성을 맞춰주세요.
43a47cd
to
bfa7f2a
Compare
7784389
to
3ae1795
Compare
@@ -59,6 +59,7 @@ public class ConnectionFactoryBuilder { | |||
private boolean isDaemon = true; | |||
private boolean shouldOptimize = false; | |||
private boolean useNagle = false; | |||
protected boolean keepAlive = false; |
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.
여기만 protected인 이유가 있나요?
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.
수정하였습니다.
3ae1795
to
6d418fa
Compare
@Override | ||
public boolean getKeepAlive() { | ||
return inner.getKeepAlive(); | ||
} |
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.
ConnectionFactoryBuilderTest 클래스에 keepAlive 관련 테스트를 추가합시다.
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.
추가 완료 하였습니다.
6d418fa
to
8ac00dd
Compare
관련 이슈
https://github.com/jam2in/arcus-works/issues/441
Motivation
기존 구현은 사용자가 TCP Keep Alive 옵션을 설정하는 인터페이스를 제공하지 않는다.
이를
ConnectionFactoryBuilder
를 통해 사용자가 설정할 수 있도록 제공한다.keepAlive의 기본 옵션은
false
이다.