-
Notifications
You must be signed in to change notification settings - Fork 70
refactor: replace ConnectionService with ServiceUtility #1534
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
base: main
Are you sure you want to change the base?
Conversation
…sterAwareWriterFailoverHandler
…new plugin services
3e3ca46
to
c465a00
Compare
} | ||
|
||
protected FullServicesContainer getNewServicesContainer() throws SQLException { | ||
return ServiceUtility.getInstance().createServiceContainer( |
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.
Just a suggestion. I've seen such piece of code at least twice. I think it makes sense to create a new method:
ServiceUtility.createNewFromSource(FullServicesContainer source, PluginService pluginService, Properties props)
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.
Is it the same pluginService that is sitting in serviceContainer? Can we use
this.servicesContainer.getPluginService()
instead?
private static final ReentrantLock initLock = new ReentrantLock(); | ||
|
||
private ServiceUtility() { | ||
if (instance != null) { |
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.
What is it for?
} | ||
|
||
public static ServiceUtility getInstance() { | ||
if (instance != null) { |
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.
This class is a simple stateless utility class. I think we can simplify logic a bit and use pre-initialized instance of ServiceUtility.
private static final ServiceUtility INSTANCE = new SericeUtility;
public ServiceUtility getInstance() { return INSTANCE; }
* {@link software.amazon.jdbc.util.ServiceUtility#createServiceContainer} followed by | ||
* {@link PluginService#forceConnect} instead. | ||
*/ | ||
@Deprecated |
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.
We're going to release 3.0 with some breaking changes. Do we want to add one more breaking change and completely remove this interface and implementation class?
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.