[jboss-user] [JBoss Microcontainer Development] - ClassPool bootstrap refactoring
Kabir Khan
do-not-reply at jboss.com
Mon Apr 26 07:10:21 EDT 2010
Kabir Khan [http://community.jboss.org/people/kabir.khan%40jboss.com] replied to the discussion
"ClassPool bootstrap refactoring"
To view the discussion, visit: http://community.jboss.org/message/539493#539493
--------------------------------------------------------------
AbstractMCServerBase now does (once it is working properly I will move the extra code to LifecycleEventListeners)
@Override
protected void doInitialize() throws IllegalStateException, InvalidConfigurationException, LifecycleEventException
{
// NEW CODE - 1
/*
* Make sure we have the correct classpools set up
*/
//Initialize jboss-reflect to use the correct classpools
JBossClClassPoolConfig config = JBossClClassPoolConfig.getInstance();
RepositoryClassPoolFactory factory = new RepositoryClassPoolFactory(config.getClassPoolRepository());
JavassistTypeInfoFactoryImpl.setPoolFactory(factory);
// NEW CODE - 1 - END
/*
* We need to start the bootstrap here so we can set the kernel
* before we fire start kernel events
*/
this.initializeBootstrap();
// Call Super implementation
super.doInitialize();
// NEW CODE - 2
//Install the bean configuring the classpools
BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("JBossClClassPoolConfig", JBossClClassPoolConfig.class.getName());
builder.setFactoryClass(JBossClClassPoolConfig.class.getName());
builder.setFactoryMethod("getInstance");
ValueMetaData inject = builder.createContextualInject(null, null, AutowireType.BY_NAME, InjectOption.CALLBACK);
//TODO add name to BeanMetaDataBuilder
((AbstractInjectionValueMetaData)inject).setValue("ClassLoading");
builder.addPropertyMetaData("classLoading", inject);
try
{
getKernel().getController().install(builder.getBeanMetaData());
}
catch (Throwable e)
{
// AutoGenerated
throw new RuntimeException(e);
}
// NEW CODE - 2 - END
}
The stuff in 1) sets up the classloader system so it understands the bootstrap classloaders
The stuff in 2) "listens" for ClassLoading and registers the container as a module Handler
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/539493#539493]
Start a new discussion in JBoss Microcontainer Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2115]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100426/215e5a4d/attachment.html
More information about the jboss-user
mailing list