Skip to content

Commit

Permalink
♻️ Some refactoring in PluginsFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
ujibang committed Dec 15, 2023
1 parent e40cb38 commit 47f49b6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/src/main/java/org/restheart/plugins/PluginsFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,14 @@ Set<PluginRecord<Provider<?>>> providers() {
return providersCache;
}

private static Map<String, Class<?>> providersTypes = new HashMap<>();
private static final Map<String, Class<?>> providersTypes = new HashMap<>();

/**
* NOTE: this is availabe only after providers instantiation happening in method providers()
* @return a Map whose keys are the provider's name and values are the classes of the provided objects
*/
static Map<String, Class<?>> providersTypes() {
if (PluginsScanner.providers().size() > 0 && providersTypes.keySet().size() == 0) {
if (!PluginsScanner.providers().isEmpty() && providersTypes.keySet().isEmpty()) {
throw new IllegalStateException("providersTypes are available only after providers instantiation happening in method providers()");
}
return providersTypes;
Expand Down Expand Up @@ -305,9 +305,9 @@ private Plugin instantiatePlugin(Class<Plugin> pc, String pluginType, String plu
}
}

private List<InstatiatedPlugin> PLUGINS_TO_INJECT_DEPS = new ArrayList<>();
private final List<InstatiatedPlugin> PLUGINS_TO_INJECT_DEPS = new ArrayList<>();

private HashMap<String, PluginRecord<?>> INSTANTIATED_PLUGINS_RECORDS = new HashMap<>();
private final HashMap<String, PluginRecord<?>> INSTANTIATED_PLUGINS_RECORDS = new HashMap<>();

void injectDependencies() {
for (var ip: PLUGINS_TO_INJECT_DEPS) {
Expand Down

0 comments on commit 47f49b6

Please sign in to comment.