Skip to content
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

Closed
wants to merge 5 commits into from

Conversation

davecramer
Copy link
Contributor

Small optimization to make the code simpler

@@ -105,12 +102,15 @@ public ConnectionPluginManager(ConnectionProvider connectionProvider, Connection
this.connectionWrapper = connectionWrapper;
}

public void lock() {
lock.lock();
public ResourceLock obtain() {
Copy link
Contributor

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() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"releaseLock"?

Copy link
Contributor Author

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.

public void close() {
this.unlock();
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

}
}

}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

@davecramer
Copy link
Contributor Author

close in favour of #265

@davecramer davecramer closed this Nov 17, 2022
@davecramer davecramer deleted the resourcelock branch November 17, 2022 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants