[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Registering a bean as an aspect in the bootstrap
kabir.khan@jboss.com
do-not-reply at jboss.com
Thu Feb 1 18:57:10 EST 2007
I have added some tests trying to mimic what is happening in the bootstrap. They are in org.jboss.test.microcontainer.test.DeployersInterceptedAspectManagerJMXTestCase and org.jboss.test.microcontainer.test.DeployersLifecycleAspectManagerJMXTestCase.
>From DeployersInterceptedAspectManagerJMXTestCase, which works as expected:
| <?xml version="1.0" encoding="UTF-8"?>
|
| <deployment xmlns="urn:jboss:bean-deployer:2.0">
| <bean name="JBossServer" class="org.jboss.test.microcontainer.support.deployers.JBossServer"/>
|
| <bean name="ProfileService" class="java.lang.Object"/>
|
| <bean name="JMXKernel" class="org.jboss.test.microcontainer.support.deployers.JMXKernel">
| <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
| <property name="serverImpl"><inject bean="JBossServer"/></property>
| </bean>
|
| <bean name="AspectManager" class="org.jboss.test.microcontainer.support.deployers.AspectManagerBean">
| <constructor>
| <parameter><![CDATA[
| <aop>
| </aop>]]>
| </parameter>
| </constructor>
| <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
| </bean>
|
| <aop:lifecycle-configure xmlns:aop="urn:jboss:aop-beans:1.0"
| name="Deployers"
| class="org.jboss.test.microcontainer.support.deployers.DeployerAspects"
| classes="org.jboss.test.microcontainer.support.deployers.IDeployer"
| manager-bean="AspectManager"
| manager-property="aspectManager"
| pointcut="execution(* $instanceof{org.jboss.test.microcontainer.support.deployers.IDeployer}->$implements{org.jboss.test.microcontainer.support.deployers.IDeployer}(..))">
| </aop:lifecycle-configure>
|
|
| <bean name="MainDeployer" class="org.jboss.test.microcontainer.support.deployers.SampleMainDeployer">
| <property name="deployers">
| <list>
| <bean name="SampleDeployer1" class="org.jboss.test.microcontainer.support.deployers.SampleDeployer">
| <property name="type">aop</property>
| </bean>
| <bean name="SampleDeployer2" class="org.jboss.test.microcontainer.support.deployers.SampleDeployer">
| <property name="type">beans</property>
| </bean>
| </list>
| </property>
| </bean>
|
| </deployment>
|
I've added some printlns to the KernelControllerContextAction to see when the difference actions get called:
| ---> Describe JBossServer
| ====> AOPDependencyBuilder - Has dependencies: false
| ---> Instantiate JBossServer
| ---> Configure JBossServer
| ---> CreateDestroyLifecycle JBossServer
| ---> StartStopLifecycle JBossServer
| ---> Install JBossServer
| ---> Describe ProfileService
| ---> Instantiate ProfileService
| ---> Configure ProfileService
| ---> CreateDestroyLifecycle ProfileService
| ---> StartStopLifecycle ProfileService
| ---> Install ProfileService
| ---> Describe JMXKernel
| ====> AOPDependencyBuilder - Has dependencies: false
| ---> Instantiate JMXKernel
| ---> Configure JMXKernel
| ---> CreateDestroyLifecycle JMXKernel
| ---> StartStopLifecycle JMXKernel
| ---> Install JMXKernel
| ---> Describe AspectManager
| ====> AOPDependencyBuilder - Has dependencies: false
| ---> Instantiate AspectManager
| ---> Configure AspectManager
| ---> CreateDestroyLifecycle AspectManager
| ---> StartStopLifecycle AspectManager
| ---> Install AspectManager
| ---> Describe Deployers
| ====> AOPDependencyBuilder - Has dependencies: false
| ---> Instantiate Deployers
| ---> Configure Deployers
| ---> CreateDestroyLifecycle Deployers
| ---> StartStopLifecycle Deployers
| ---> Install Deployers
| ---> Describe Deployers$Aspect
| ---> Instantiate Deployers$Aspect
| ---> Configure Deployers$Aspect
| ---> CreateDestroyLifecycle Deployers$Aspect
| ---> StartStopLifecycle Deployers$Aspect
| 1688 DEBUG [Aspect] Bound aspect Deployers$Aspect; deployed:true
| ---> Install Deployers$Aspect
| ---> Describe Deployers$AspectBinding
| ---> Instantiate Deployers$AspectBinding
| ---> Configure Deployers$AspectBinding
| ---> CreateDestroyLifecycle Deployers$AspectBinding
| ---> StartStopLifecycle Deployers$AspectBinding
| ----> Added binding execution(* $instanceof{org.jboss.test.microcontainer.support.deployers.IDeployer}->$implements{org.jboss.test.microcont
| ainer.support.deployers.IDeployer}(..))
| 1750 DEBUG [AspectBinding] Bound binding 5c4o02-s8c9is-exnuf357-1-exnuf3au-7
| ---> Install Deployers$AspectBinding
| ---> Describe Deployers$IntroductionBinding
| ---> Instantiate Deployers$IntroductionBinding
| ---> Configure Deployers$IntroductionBinding
| ---> CreateDestroyLifecycle Deployers$IntroductionBinding
| ---> StartStopLifecycle Deployers$IntroductionBinding
| ---> Install Deployers$IntroductionBinding
| ---> Describe SampleDeployer1
| 1797 DEBUG [GenericBeanAspectFactory] Creating advice 5c4o02-s8c9is-exnuf357-1-exnuf3ae-6
| 1797 DEBUG [DeployerAspects] ctor
| ====> AOPDependencyBuilder - Has dependencies: true
| ---> Instantiate SampleDeployer1
| 2016 DEBUG [SampleDeployer] ctor
| 2219 DEBUG [SampleDeployer] ctor
| ---> Configure SampleDeployer1
| ---> CreateDestroyLifecycle SampleDeployer1
| ---> StartStopLifecycle SampleDeployer1
| ---> Install SampleDeployer1
| ---> Describe SampleDeployer2
| ====> AOPDependencyBuilder - Has dependencies: true
| ---> Instantiate SampleDeployer2
| 2235 DEBUG [SampleDeployer] ctor
| 2281 DEBUG [SampleDeployer] ctor
| ---> Configure SampleDeployer2
| ---> CreateDestroyLifecycle SampleDeployer2
| ---> StartStopLifecycle SampleDeployer2
| ---> Install SampleDeployer2
| ---> Describe MainDeployer
| ====> AOPDependencyBuilder - Has dependencies: false
| ---> Instantiate MainDeployer
| ---> Configure MainDeployer
| 2297 DEBUG [SampleMainDeployer] setDeployers, size=2
| ---> CreateDestroyLifecycle MainDeployer
| ---> StartStopLifecycle MainDeployer
| ---> Install MainDeploy
|
I have reduced the conf/bootstrap-beans to the following:
| <?xml version="1.0" encoding="UTF-8"?>
|
| <!--
| The bootstrap of the server. This should only have the minimum
| needed to bootstrap the mc kernel and profile service.
| $Id:$
| -->
| <deployment xmlns="urn:jboss:bean-deployer:2.0">
|
| <bean name="ProfileService" class="org.jboss.system.server.profileservice.basic.ProfileServiceImpl">
| <constructor>
| <parameter>${jboss.server.name}</parameter>
| </constructor>
| <property name="profileRoot">${jboss.server.home.url}/profile</property>
| </bean>
|
| <bean name="JMXKernel" class="org.jboss.system.server.jmx.JMXKernel">
| <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
| <property name="serverImpl"><inject bean="JBossServer"/></property>
| </bean>
|
| <bean name="AspectManager" class="org.jboss.aop.deployers.AspectManagerJDK5">
| <constructor>
| <parameter><![CDATA[
| <aop>
| <aspect name="mainDeployer" class="org.jboss.profileservice.aop.MainDeployerAspect"/>
| <bind pointcut="execution(* $instanceof{org.jboss.deployers.spi.deployment.MainDeployer}->process(..))">
| <advice name="process" aspect="mainDeployer"/>
| </bind>
| <aspect name="persist" class="org.jboss.profileservice.aop.PersistAspect"/>
| <bind pointcut="execution(* $instanceof{org.jboss.managed.api.ManagedProperty}->setValue(..))">
| <advice name="setValue" aspect="persist"/>
| </bind>
| </aop>]]>
| </parameter>
| </constructor>
|
| <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
| <property name="enableLoadtimeWeaving">false</property>
| <property name="suppressTransformationErrors">true</property>
| <property name="prune">true</property>
| <property name="include">org.jboss.test, org.jboss.injbossaop, org.jboss.cache.jmx, org.jboss.cache.pojo.jmx, org.jboss.ha, org.jboss.invocation</property>
| <property name="exclude">org.jboss.</property>
| <property name="optimized">true</property>
| <property name="verbose">false</property>
| </bean>
|
| <aop:lifecycle-configure xmlns:aop="urn:jboss:aop-beans:1.0"
| name="Deployers"
| class="org.jboss.profileservice.aop.DeployerAspects"
| classes="org.jboss.deployers.spi.deployer.Deployer"
| manager-bean="AspectManager"
| manager-property="aspectManager"
| pointcut="execution(* $instanceof{org.jboss.deployers.spi.deployer.Deployer}->prepareDeploy(..))">
| </aop:lifecycle-configure>
|
| <bean name="MainDeployer" class="org.jboss.deployers.plugins.deployment.MainDeployerImpl">
| <property name="deployers">
| <list>
| <bean name="AspectDeployer" class="org.jboss.aop.deployers.AspectDeployer">
| <property name="type">aop</property>
| </bean>
| <bean name="BeanDeployer" class="org.jboss.deployers.plugins.deployers.kernel.BeanDeployer">
| <property name="type">beans</property>
| </bean>
| </list>
| </property>
| </bean>
|
| </deployment>
|
And seem to be getting a completely different order for how the beans are created in JBoss?
|
| Kabir at KabirDell ~/sourcecontrol/jboss-head/build/output/jboss-5.0.0.Beta2/bin
| $ run.sh
| =========================================================================
|
| JBoss Bootstrap Environment
|
| JBOSS_HOME: C:\cygwin\home\Kabir\sourcecontrol\jboss-head\build\output\jboss-5.0.0.Beta2
|
| JAVA: /c/Java/jdk/jdk1.5.0_09/bin/java
|
| JAVA_OPTS: -Dprogram.name=run.sh -server -Xms128m -Xmx512m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
|
| CLASSPATH: C:\cygwin\home\Kabir\sourcecontrol\jboss-head\build\output\jboss-5.0.0.Beta2\bin\run.jar;C:\Java\jdk\jdk1.5.0_09\lib\tools.jar
|
| =========================================================================
|
| 23:54:34,156 INFO [ServerImpl] Starting JBoss (Microcontainer)...
| 23:54:34,156 INFO [ServerImpl] Release ID: JBoss [Morpheus] 5.0.0.Beta2 (build: SVNTag=JBoss_5_0_0_Beta2 date=200701261503)
| 23:54:34,203 INFO [ServerImpl] Home Dir: C:\cygwin\home\Kabir\sourcecontrol\jboss-head\build\output\jboss-5.0.0.Beta2
| 23:54:34,203 INFO [ServerImpl] Home URL: file:/C:/cygwin/home/Kabir/sourcecontrol/jboss-head/build/output/jboss-5.0.0.Beta2/
| 23:54:34,203 INFO [ServerImpl] Library URL: file:/C:/cygwin/home/Kabir/sourcecontrol/jboss-head/build/output/jboss-5.0.0.Beta2/lib/
| 23:54:34,203 INFO [ServerImpl] Patch URL: null
| 23:54:34,203 INFO [ServerImpl] Server Name: default
| 23:54:34,203 INFO [ServerImpl] Server Home Dir: C:\cygwin\home\Kabir\sourcecontrol\jboss-head\build\output\jboss-5.0.0.Beta2\server\default
| 23:54:34,203 INFO [ServerImpl] Server Home URL: file:/C:/cygwin/home/Kabir/sourcecontrol/jboss-head/build/output/jboss-5.0.0.Beta2/server/default/
| 23:54:34,203 INFO [ServerImpl] Server Data Dir: C:\cygwin\home\Kabir\sourcecontrol\jboss-head\build\output\jboss-5.0.0.Beta2\server\default\data
| 23:54:34,203 INFO [ServerImpl] Server Temp Dir: C:\cygwin\home\Kabir\sourcecontrol\jboss-head\build\output\jboss-5.0.0.Beta2\server\default\tmp
| 23:54:34,203 INFO [ServerImpl] Server Config URL: file:/C:/cygwin/home/Kabir/sourcecontrol/jboss-head/build/output/jboss-5.0.0.Beta2/server/default/conf/
| 23:54:34,203 INFO [ServerImpl] Server Library URL: file:/C:/cygwin/home/Kabir/sourcecontrol/jboss-head/build/output/jboss-5.0.0.Beta2/server/default/lib/
| 23:54:34,203 INFO [ServerImpl] Root Deployment Filename: jboss-service.xml
| 23:54:34,218 INFO [ServerImpl] Starting Microcontainer, bootstrapURL=file:/C:/cygwin/home/Kabir/sourcecontrol/jboss-head/build/output/jboss-5.0.0.Beta2/server/default/conf/bootstrap-beans.xml
| ---> Describe ProfileService
| ====> AOPDependencyBuilder - Has dependencies: false
| ---> Instantiate ProfileService
| ---> Configure ProfileService
| ---> CreateDestroyLifecycle ProfileService
| ---> StartStopLifecycle ProfileService
| 23:54:35,531 INFO [ProfileImpl] Using profile root:C:\cygwin\home\Kabir\sourcecontrol\jboss-head\build\output\jboss-5.0.0.Beta2\bin\file:\C:\cygwin\home\Kabir\sourcecontrol\jboss-head\build\output\jboss-5.0.0.Beta2\server\default\profile
| ---> Install ProfileService
| ---> Describe JMXKernel
| ====> AOPDependencyBuilder - Has dependencies: false
| ---> Instantiate JMXKernel
| ---> Describe AspectManager
| ---> Instantiate AspectManager
| ---> Describe Deployers
| ====> AOPDependencyBuilder - Has dependencies: false
| ---> Instantiate Deployers
| ---> Configure Deployers
| ---> CreateDestroyLifecycle Deployers
| ---> StartStopLifecycle Deployers
| ---> Install Deployers
| ---> Describe Deployers$Aspect
| ---> Instantiate Deployers$Aspect
| ---> Describe Deployers$AspectBinding
| ---> Instantiate Deployers$AspectBinding
| ---> Describe Deployers$IntroductionBinding
| ---> Instantiate Deployers$IntroductionBinding
| ---> Describe AspectDeployer
| ---> Instantiate AspectDeployer
| ---> Configure AspectDeployer
| ---> CreateDestroyLifecycle AspectDeployer
| ---> StartStopLifecycle AspectDeployer
| ---> Install AspectDeployer
| ---> Describe BeanDeployer
| ====> AOPDependencyBuilder - Has dependencies: false
| ---> Instantiate BeanDeployer
| ---> Configure BeanDeployer
| ---> CreateDestroyLifecycle BeanDeployer
| ---> StartStopLifecycle BeanDeployer
| ---> Install BeanDeployer
| ---> Describe MainDeployer
| ====> AOPDependencyBuilder - Has dependencies: false
| ---> Instantiate MainDeployer
| ---> Configure MainDeployer
| ---> CreateDestroyLifecycle MainDeployer
| ---> StartStopLifecycle MainDeployer
| ---> Install MainDeployer
| ---> Describe JBossServer
| ====> AOPDependencyBuilder - Has dependencies: false
| ---> Configure JBossServer
| ---> CreateDestroyLifecycle JBossServer
| ---> StartStopLifecycle JBossServer
| ---> Install JBossServer
| ---> Configure JMXKernel
| ---> CreateDestroyLifecycle JMXKernel
| ---> StartStopLifecycle JMXKernel
| 23:54:38,312 INFO [ServerInfo] Java VM: Java HotSpot(TM) Server VM 1.5.0_09-b01,Sun Microsystems Inc.
| 23:54:38,312 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
| 23:54:38,343 INFO [JMXKernel] Legacy JMX core initialized
| ---> Install JMXKernel
| ---> Configure AspectManager
| ---> CreateDestroyLifecycle AspectManager
| ---> StartStopLifecycle AspectManager
| ---> Install AspectManager
| ---> Configure Deployers$IntroductionBinding
| ---> Configure Deployers$Aspect
| ---> CreateDestroyLifecycle Deployers$IntroductionBinding
| ---> CreateDestroyLifecycle Deployers$Aspect
| ---> StartStopLifecycle Deployers$IntroductionBinding
| ---> StartStopLifecycle Deployers$Aspect
| ---> Install Deployers$IntroductionBinding
| ---> Install Deployers$Aspect
| ---> Configure Deployers$AspectBinding
| ---> CreateDestroyLifecycle Deployers$AspectBinding
| ---> StartStopLifecycle Deployers$AspectBinding
| ----> Added binding execution(* $instanceof{org.jboss.deployers.spi.deployer.Deployer}->prepareDeploy(..))
| ---> Install Deployers$AspectBinding
| 23:54:38,546 INFO [ServerImpl] JBoss (Microcontainer) [5.0.0.Beta2 (build: SVNTag=JBoss_5_0_0_Beta2 date=200701261503)] Started in 4s:343ms
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4009754#4009754
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4009754
More information about the jboss-dev-forums
mailing list