[
https://issues.apache.org/jira/browse/FELIX-2197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12844846#action_12844846
]
Martin Zdila commented on FELIX-2197:
-------------------------------------
The usecase is in the issue description: We use Felix embedded and we pass
ClassLoaderHook to Felix via its properties.
Anyway, we finally decided not to use Terracotta in out project. But the
ClassLoaderHook feature for Felix would be useful for others who want to use
Terracotta. Equinox has such feature (even more capable, see the link in
description), so why Felix shouldn't ;-). The attached patch was only a quick
solution for us and if you decide to implement it, you will probably do it
better :-)
> Please implement something like Equinox's
> org.eclipse.osgi.baseadaptor.hooks.ClassLoadingHook
> ---------------------------------------------------------------------------------------------
>
> Key: FELIX-2197
> URL: https://issues.apache.org/jira/browse/FELIX-2197
> Project: Felix
> Issue Type: New Feature
> Components: Framework
> Affects Versions: felix-2.0.4
> Environment: irrelevant
> Reporter: Martin Zdila
> Attachments: framework.patch
>
>
> Please implement something like Equinox's
> org.eclipse.osgi.baseadaptor.hooks.ClassLoadingHook. We need it for running
> Felix under Terracotta (there is HOWTO for Equinox:
> http://www.terracotta.org/confluence/display/wiki/Run+with+Eclipse+Equinox).
> We patched the Felix Framework for the workaround. The patch is attached. We
> use it like this:
> ...
> import org.apache.felix.framework.ClassLoaderHook;
> import org.apache.felix.framework.Felix;
> import com.tc.object.bytecode.hook.impl.ClassProcessorHelper;
> import com.tc.object.loaders.NamedClassLoader;
> ...
> properties.put("classLoaderHook", new ClassLoaderHook() {
> @Override
> public void classLoaderCreared(final ClassLoader
> classLoader) {
> if (!(classLoader instanceof NamedClassLoader))
> {
> return;
> }
> System.out.println(classLoader.toString());
> ((NamedClassLoader)
> classLoader).__tc_setClassLoaderName(classLoader.toString());
>
> ClassProcessorHelper.registerGlobalLoader((NamedClassLoader) classLoader,
> null);
> }
> });
>
> return new Felix(properties);
> ...
> Thanks in advance.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.