arina-ielchiieva commented on a change in pull request #1794: DRILL-7196: Queries are still runnable on disabled plugins URL: https://github.com/apache/drill/pull/1794#discussion_r286352619
########## File path: exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java ########## @@ -133,23 +133,15 @@ public StoragePlugin createOrUpdate(String name, StoragePluginConfig config, boo boolean done = false; try { if (oldPlugin != null) { - if (config.isEnabled()) { - done = enabledPlugins.replace(name, oldPlugin, newPlugin); - } else { - done = enabledPlugins.remove(name, oldPlugin); - } - if (done) { - closePlugin(oldPlugin); - } - } else if (config.isEnabled()) { + done = (newPlugin == null) ? enabledPlugins.remove(name, oldPlugin) : enabledPlugins.replace(name, oldPlugin, newPlugin); + } else if (newPlugin != null) { done = (null == enabledPlugins.putIfAbsent(name, newPlugin)); } else { done = true; } } finally { - if (!done) { - closePlugin(newPlugin); - } + StoragePlugin pluginToClose = (done) ? oldPlugin : newPlugin; Review comment: ```suggestion StoragePlugin pluginToClose = done ? oldPlugin : newPlugin; ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services