private void invokeBundleFinHooks()

in winegrower-core/src/main/java/org/apache/winegrower/deployer/BundleContextImpl.java [332:348]


    private void invokeBundleFinHooks(final List<Bundle> bundles) {
        final Collection<ServiceReference<org.osgi.framework.hooks.bundle.FindHook>> findHooks = services.getHooks().getBundleFindHooks();
        if (!bundles.isEmpty() && !findHooks.isEmpty()) {
            findHooks.forEach(hook -> {
                final org.osgi.framework.hooks.bundle.FindHook fh = getService(hook);
                if (fh != null) {
                    try {
                        fh.find(getBundle().getBundleContext(), bundles);
                    } catch (final Throwable th) {
                        LoggerFactory.getLogger(BundleContextImpl.class).warn("Can't call '{}'", hook, th);
                    } finally {
                        ungetService(hook);
                    }
                }
            });
        }
    }