-
Notifications
You must be signed in to change notification settings - Fork 53
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
Simplify code using try with resources for the Reentrant lock #259
Conversation
@@ -105,12 +102,15 @@ public ConnectionPluginManager(ConnectionProvider connectionProvider, Connection | |||
this.connectionWrapper = connectionWrapper; | |||
} | |||
|
|||
public void lock() { | |||
lock.lock(); | |||
public ResourceLock obtain() { |
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.
I'd suggest to reconsider a method name. It's not clear what "obtain" on plugin manager object does. Does it obtain a plugin manager?
/* | ||
For testing only | ||
*/ | ||
public void closeResourceLock() { |
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.
"releaseLock"?
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.
I'm not married to any name. releaseLock is fine, and then we can use acquireLock instead of obtain.
… This is probably too specific
public void close() { | ||
this.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.
} | |
} | |
} | ||
} | ||
|
||
} |
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.
} | |
} | |
close in favour of #265 |
Small optimization to make the code simpler