-
Notifications
You must be signed in to change notification settings - Fork 8
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
[APIS-1005] Extends the loadBalance Property of JDBC. #56
Conversation
throw e; | ||
String loadBalValue = connProperties.getConnLoadBal(); | ||
|
||
synchronized (this) { |
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.
이 구간에 synchronized 를 사용하지 말고 conn_count 함수를 증가시키는 함수를 만들고 해당 함수에만 synchronized로 하는 것이 어떨까요 ?
private synchronized int increment_conn_count() {
conn_count = conn_count+1;
if (conn_count >= Interger.MAX_VALUE) conn_count=1;
return conn_count;
}
그리고 adjustHostList() 함수에서 conn_count++ 대신 count = increment_conn_count(); 변경한 후 local 변수인 count을 이용하면 thread safety 해 보임.
혹시 UJCIManager.connect()가 thread safety 하지 않나요 ?
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 synchronized int increment_conn_count() { | ||
conn_count = conn_count + 1; | ||
return conn_count; |
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.
conn_count가 INT_MAX가 넘는 경우에 대해 처리가 필요해보입니다.
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.
conn_count 의 overflow에 대한 처리를 추가 했습니다.
http://jira.cubrid.org/browse/APIS-1005
Purpose
connection url의 loadBalance property 사용방법을 확장 하였다.
기존 기능에 Round-Robin 방식을 추가함
확장후 loadBalance 사용 방법
loadBalance=true (Round-Robin 방식)
loadBalance=false (기존과 동일, loadBalance 사용안함)
loadBalance=rr (Round-Robin 방식)
loadBalance=sh (Shuffle 방식)