[Design the new POJO MicroContainer] - Re: Scoped Kernels
by bkeh12
Hi,kabir
pls,see previously posts for Ales.
| <beanfactory name="InterceptedAdvice" class="org.jboss.test.kernel.deployment.test.CalledInterceptor"/>
|
| <bean name="appScopeObject" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
| <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
| <!--classloader><inject bean="cll" /> </classloader-->
| </bean>
|
| <bean name="AspectManager" class="org.jboss.aop.AspectManager">
| <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
| <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment2")</annotation>
| <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
| </bean>
|
| <bean name="InterceptedAspect" class="org.jboss.aop.microcontainer.beans.Aspect">
| <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
| <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment2")</annotation>
| <property name="advice"><inject bean="InterceptedAdvice"/></property>
| <property name="manager"><inject bean="AspectManager"/></property>
| </bean>
|
| <bean name="InterceptedBinding" class="org.jboss.aop.microcontainer.beans.AspectBinding">
| <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
| <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment2")</annotation>
| <property name="pointcut">
| execution(* $instanceof{org.jboss.test.kernel.deployment.support.SimpleObjectWithBean}->*(..))
| </property>
| <property name="aspect"><inject bean="InterceptedAspect" property="definition"/></property>
| <property name="manager"><inject bean="AspectManager"/></property>
| </bean> ....
result this ..
anonymous wrote :
| [ScopedKernelController] Error installing to Start: name=InterceptedBinding state=Create
| org.jboss.aop.pointcut.ast.TokenMgrError: Lexical error at line 1, column 1. Encountered: "\n" (10), after : ""
thank
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021998#4021998
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021998
18 years, 10 months
[Design the new POJO MicroContainer] - Re: Scoped Kernels
by bkeh12
Hi,Ales
I try this for MC's "ScopingTestCase".
| <?xml version="1.0" encoding="UTF-8"?>
|
| <deployment xmlns="urn:jboss:bean-deployer:2.0">
|
| <!--classloader>
| <bean name="cl" class="org.jboss.test.kernel.deployment.support.NullClassLoader" />
| </classloader-->
|
|
| <beanfactory name="InterceptedAdvice" class="org.jboss.test.kernel.deployment.test.CalledInterceptor"/>
|
| <bean name="appScopeObject" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
| <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
| <!--classloader><inject bean="cll" /> </classloader-->
| </bean>
|
| <bean name="AspectManager" class="org.jboss.aop.AspectManager">
| <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
| <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment2")</annotation>
| <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
| </bean>
|
| <bean name="InterceptedAspect" class="org.jboss.aop.microcontainer.beans.Aspect">
| <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
| <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment2")</annotation>
| <property name="advice"><inject bean="InterceptedAdvice"/></property>
| <property name="manager"><inject bean="AspectManager"/></property>
| </bean>
|
| <bean name="InterceptedBinding" class="org.jboss.aop.microcontainer.beans.AspectBinding">
| <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
| <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment2")</annotation>
| <property name="pointcut">execution(* $instanceof{org.jboss.test.kernel.deployment.support.SimpleObjectWithBean}->*(..))</property>
| <property name="aspect"><inject bean="InterceptedAspect" property="definition"/></property>
| <property name="manager"><inject bean="AspectManager"/></property>
| </bean>
|
| <bean name="deploy1" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
| <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
| <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment1")</annotation>
| <property name="simpleBean"><inject bean="simple"/></property>
| </bean>
|
| <bean name="deploy2" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
| <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
| <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment2")</annotation>
| <property name="simpleBean"><inject bean="simple"/></property>
| </bean>
|
| <bean name="deploy3" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
| <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
| <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment3")</annotation>
| <property name="simpleBean"><inject bean="simpleFromBoot"/></property>
| </bean>
|
| <bean name="deploy4" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
| <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
| <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment4")</annotation>
| <property name="simpleBean"><inject bean="simpleFromApp"/></property>
| </bean>
|
| <bean name="simple" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
| <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
| <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment1")</annotation>
| <constructor>
| <parameter>deployment1</parameter>
| </constructor>
| </bean>
|
| <bean name="simple" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
| <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
| <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment2")</annotation>
| <constructor>
| <parameter>deployment2</parameter>
| </constructor>
| </bean>
|
| <bean name="simpleFromBoot" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
| <constructor>
| <parameter>fromBoot</parameter>
| </constructor>
| </bean>
|
| <bean name="simpleFromApp" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
| <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
| <constructor>
| <parameter>fromApp</parameter>
| </constructor>
| </bean>
|
| </deployment>
|
But result for this..
anonymous wrote :
| [ScopedKernelController] Still unresolved Instantiated:..{name=deploy1..idependOn=..name=deploy1 dependsOn=InterceptedAspect...
| [ScopedKernelController] Still unresolved Instantiated:..{name=deploy3..idependOn=..name=deploy3 dependsOn=InterceptedAspect...
| [ScopedKernelController] Still unresolved Instantiated:..{name=deploy4..idependOn=..name=deploy4 dependsOn=InterceptedAspect...
|
deploy2 work for InterceptedAspect is right.
why deploy1,3,4 dependsOn=InterceptedAspect ?
thank
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021986#4021986
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021986
18 years, 10 months
[Design of Messaging on JBoss (Messaging/JBoss)] - Why failoverValve has the ThreadLocal routine
by clebert.suconic@jboss.com
Basically this is the scenario... You have several threads trying to acquire the writeLock simultaneously... Different from a Tomcat Valve where from what I remember when I read the code, then don't have such requirement.
You have several threads... each one with a readLock...
then all of these threads will try to acquire a writeLock...
Any thread will be able to assume the writeLock... as there are other threads with readLocks.
so... before acquiring the writeLock, I would need to release the readLock...
But... as the Valve is Reentrant.. I needed to store the number of reentrances before releasing readLocks executed before.
The only solution to avoid the ThreadLocal would be to avoid reentrance on the Valve and aways release one readlock.. but I don't think that's completely possible. But if anyone can find a way to have this following test work (without releasing a readLock), we can apply the fix to the Valve:
public void testOnReadlocks() throws Exception
| {
| int THREAD_COUNT = 10;
| final ReadWriteLock readWriteLock = new WriterPreferenceReadWriteLock();
| final Object sync = new Object();
|
| Thread threads[] = new Thread[THREAD_COUNT];
|
| for (int i = 0; i < THREAD_COUNT; i++)
| {
| threads = new Thread()
| {
| public void run()
| {
| try
| {
| synchronized (sync)
| {
| sync.wait();
| }
| readWriteLock.readLock().acquire();
| readWriteLock.writeLock().acquire();
| }
| catch (Exception e)
| {
| e.printStackTrace();
| }
| }
| };
| threads.start();
| }
|
| Thread.sleep(2000);
|
| synchronized (sync)
| {
| sync.notify();
| }
|
| for (int i=0;i<threads.length;i++)
| {
| threads.join();
| }
| }
|
This test would hang forever
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021809#4021809
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021809
18 years, 10 months