Yair Zaslavsky has posted comments on this change.

Change subject: 9. [WIP] core: Introducing configuration loader
......................................................................


Patch Set 16:

(2 comments)

http://gerrit.ovirt.org/#/c/24365/16/backend/manager/modules/extension-manager/src/main/java/org/ovirt/engine/core/extensions/mgr/ConfigurationLoader.java
File 
backend/manager/modules/extension-manager/src/main/java/org/ovirt/engine/core/extensions/mgr/ConfigurationLoader.java:

Line 65:                     loadedModules.put(moduleSpec, module);
Line 66:                     ServiceLoader<? extends Extension> serviceLoader =
Line 67:                             ServiceLoader.load(Extension.class, 
module.getClassLoader());
Line 68:                     for (Extension extension : serviceLoader) {
Line 69:                         
extensionsByType.put(extension.getClass().getName(), extension.getClass());
> Done
Hi,
The API with the filter does not accept a ClassLoader as a parameter.

public <T> Iterator<T> getServiceProviders(Class<T> category,
                                  ServiceRegistry.Filter filter,
                                  boolean useOrdering)

We have to pass the class loader of the module as a parameter.

Anyway, I'll change this code to iterate over the extensions and pickup only 
this that is relevant by the class name.
Line 70:                     }
Line 71:                 } catch (ModuleLoadException exception) {
Line 72:                     throw new 
ConfigurationException(String.format("The module '%1$s' cannot be loaded.", 
moduleSpec),
Line 73:                             exception);


Line 70:                     }
Line 71:                 } catch (ModuleLoadException exception) {
Line 72:                     throw new 
ConfigurationException(String.format("The module '%1$s' cannot be loaded.", 
moduleSpec),
Line 73:                             exception);
Line 74:                 }
> no reason to catch/rethrow exceptions such as this in middle of scope, you 
By throwing I can provide some more information at the log, if needed - for 
example - if jboss modules is not set, if the module cannot be loaded, the 
extension can't be instantiated , etc...
What do you suggest? to have several catch blocks at the end of the method? not 
to provide these strings at that i pass as the exception msg at 
ConfigurationException?
Line 75:             }
Line 76:             try {
Line 77:                 Class<? extends Extension> extensionClass = 
extensionsByType.get(config.getString(TYPE));
Line 78:                 if (extensionClass == null) {


-- 
To view, visit http://gerrit.ovirt.org/24365
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I182904177ec088e62b35bde870ec79725fabc4e4
Gerrit-PatchSet: 16
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yair Zaslavsky <yzasl...@redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com>
Gerrit-Reviewer: Martin Peřina <mper...@redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to