felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Zdila (JIRA)" <j...@apache.org>
Subject [jira] Created: (FELIX-2197) Please implement something like Equinox's org.eclipse.osgi.baseadaptor.hooks.ClassLoadingHook
Date Fri, 12 Mar 2010 09:59:27 GMT
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.


Mime
View raw message