Github user olegz commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1156#discussion_r86164431
  
    --- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractConfiguredComponent.java
 ---
    @@ -141,48 +191,64 @@ public void setProperty(final String name, final 
String value) {
          * @return true if removed; false otherwise
          * @throws java.lang.IllegalArgumentException if the name is null
          */
    -    @Override
    -    public boolean removeProperty(final String name) {
    +    private boolean removeProperty(final String name) {
             if (null == name) {
                 throw new IllegalArgumentException();
             }
     
    -        lock.lock();
    -        try {
    -            verifyModifiable();
    -
    -            try (final NarCloseable narCloseable = 
NarCloseable.withComponentNarLoader(component.getClass())) {
    -                final PropertyDescriptor descriptor = 
component.getPropertyDescriptor(name);
    -                String value = null;
    -                if (!descriptor.isRequired() && (value = 
properties.remove(descriptor)) != null) {
    -
    -                    if (descriptor.getControllerServiceDefinition() != 
null) {
    -                        if (value != null) {
    -                            final ControllerServiceNode oldNode = 
serviceProvider.getControllerServiceNode(value);
    -                            if (oldNode != null) {
    -                                oldNode.removeReference(this);
    -                            }
    -                        }
    -                    }
    +        final PropertyDescriptor descriptor = 
component.getPropertyDescriptor(name);
    +        String value = null;
    +        if (!descriptor.isRequired() && (value = 
properties.remove(descriptor)) != null) {
     
    -                    try {
    -                        component.onPropertyModified(descriptor, value, 
null);
    -                    } catch (final Exception e) {
    -                        // nothing really to do here...
    +            if (descriptor.getControllerServiceDefinition() != null) {
    +                if (value != null) {
    +                    final ControllerServiceNode oldNode = 
serviceProvider.getControllerServiceNode(value);
    +                    if (oldNode != null) {
    +                        oldNode.removeReference(this);
                         }
    -
    -                    return true;
                     }
                 }
    -        } finally {
    -            lock.unlock();
    +
    +            try {
    +                component.onPropertyModified(descriptor, value, null);
    +            } catch (final Exception e) {
    +                // nothing really to do here...
    +            }
    +
    +            return true;
             }
    +
             return false;
         }
     
    +    /**
    +     * Adds all of the modules identified by the given module paths to the 
InstanceClassLoader for this component.
    +     *
    +     * @param modulePaths a list of module paths where each entry can be a 
comma-separated list of multiple module paths
    +     */
    +    private void processClasspathModifiers(final Set<String> modulePaths) {
    +        try {
    +            final URL[] urls = 
ClassLoaderUtils.getURLsForClasspath(modulePaths, null, true);
    +
    +            final ClassLoader classLoader = 
Thread.currentThread().getContextClassLoader();
    +            if (!(classLoader instanceof InstanceClassLoader)) {
    +                // Really shouldn't happen, but if we somehow got here and 
don't have an InstanceClassLoader then log a warning and move on
    +                logger.warn("Unable to modify the classpath for {}, 
expected InstanceClassLoader, but found {}",
    +                        new Object[] { name, 
classLoader.getClass().getName()});
    +                return;
    --- End diff --
    
    I am wondering if this should really be a fatal condition. Let's say I have 
a processor that utilizes this mechanism and the additional classpath is a 
required property (e.g., like we have in new JMS). This means it can *only* 
work if such classpath is provided and successfully loaded. Letting it continue 
with simple warning message wil not accomplish anything, right?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to