Skip to content

Commit

Permalink
[CONJ-1054] race condition when using CredentialPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Mar 2, 2023
1 parent 016a211 commit c94cf0d
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/
public final class CredentialPluginLoader {

private static final ServiceLoader<CredentialPlugin> loader =
ServiceLoader.load(CredentialPlugin.class, Driver.class.getClassLoader());

/**
* Get current Identity plugin according to option `identityType`.
*
Expand All @@ -28,6 +25,9 @@ public final class CredentialPluginLoader {
public static CredentialPlugin get(String type) throws SQLException {
if (type == null) return null;

ServiceLoader<CredentialPlugin> loader =
ServiceLoader.load(CredentialPlugin.class, Driver.class.getClassLoader());

for (CredentialPlugin implClass : loader) {
if (type.equals(implClass.type())) {
return implClass;
Expand Down

0 comments on commit c94cf0d

Please sign in to comment.