aws / aws-advanced-jdbc-wrapper

The Amazon Web Services JDBC Driver has been redesigned as an advanced JDBC wrapper. This wrapper is complementary to and extends the functionality of an existing JDBC driver to help an application take advantage of the features of clustered databases such as Amazon Aurora.
Apache License 2.0
207 stars 41 forks source link

fix: limitless connection plugin - add synchornized lock for synchron… #1109

Closed aaronchung-bitquill closed 3 weeks ago

aaronchung-bitquill commented 4 weeks ago

…ous fetch of routers

Summary

Add synchronized lock to the synchronous fetch of routers so synchronized will apply to all instances of the Limitless plugin.

Before this fix, I did a test spinning up 100 callables creating connections. I noticed limitlessRouterService#forceGetLimitlessRouters being called 10+ times at start up, when only 1 is needed. This should remedy that.

Also moved the retryCounter to finally block so that if an exception is encountered, there isnt an infinite loop.

Description

Added a static synchronized lock to the LimitlessConnectionPlugin to be used for synchronouslyGetLimitlessRouters().

Additional Reviewers

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.