[jboss-jira] [JBoss JIRA] Created: (JBCACHE-1300) Standardize mechanism for setting defaultClassLoader
Brian Stansberry (JIRA)
jira-events at lists.jboss.org
Thu Feb 28 13:18:58 EST 2008
Standardize mechanism for setting defaultClassLoader
----------------------------------------------------
Key: JBCACHE-1300
URL: http://jira.jboss.com/jira/browse/JBCACHE-1300
Project: JBoss Cache
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Reporter: Brian Stansberry
Assigned To: Manik Surtani
Priority: Minor
Right now the default classloader used by the cache's marshaller is fixed to CacheImpl.class.getClassLoader(), with no clear mechanism for users to change that.
In the Hibernate/JBC testsuite I did the following:
public class CustomClassLoaderCacheFactory<K, V> extends DefaultCacheFactory<K, V>
{
private ClassLoader customClassLoader;
public CustomClassLoaderCacheFactory(ClassLoader customClassLoader)
{
this.customClassLoader = customClassLoader;
}
@Override
protected void bootstrap(CacheImpl cache, CacheSPI spi, Configuration configuration)
{
super.bootstrap(cache, spi, configuration);
// Replace the deployerClassLoader
componentRegistry.registerComponent("deployerClassLoader", customClassLoader, ClassLoader.class);
}
}
That works, but seems fragile, e.g .if how super.bootstrap() works changes it could break. It would be better to have something more standardized; perhaps a property on DefaultCacheFactory that could be set, w/ a guarantee in the DefaultCacheFactory javadoc that it will be used if set.
Or something else. :-) Manik, not sure where you're planning to go w/ defaultClassLoader; I'm just throwing this request out there to get the topic in JIRA.
OT: doing this is great in testsuites, as you can use it to configure a default classloader that can't see some of your test classes, and thus test marshalling.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list