-
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
Lock initialization of AuroraHostListProvider #347
Conversation
@@ -207,6 +215,7 @@ protected void init() throws SQLException { | |||
} | |||
|
|||
this.isInitialized = true; | |||
lock.unlock(); |
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.
It might make sense to create a utility lock that implements Closable
and then wrap this in try
block, either way it should be in a try block with the unlock in a finally
: clusterRdsHostUrl; | ||
this.isPrimaryClusterId = true; | ||
try { | ||
lock.lock(); |
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.
Lock should be out of tr-finally block. We don't need to unlock if lock fails.
Addresses #343
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.