[Design of JCA on JBoss] - Pottential race condition in PoolFiller
by darran.lofthouse@jboss.com
I was looking at some of the optimisations in the JCA code and it looks like there is a potential race condition in the PoolFiller implementation, just wanted to check if you wanted a Jira task raising so it can be addressed?
http://anonsvn.jboss.org/repos/jbossas/branches/Branch_4_2/connector/src/...
The class PoolFiller.java uses two seperate synchronized blocks in the run method
| while (true)
| {
| try
| {
| InternalManagedConnectionPool mcp = null;
| //keep iterating through pools till empty, exception escapes.
| while (true)
| {
|
| synchronized (pools)
| {
| mcp = (InternalManagedConnectionPool)pools.removeFirst();
| }
| if (mcp == null)
| break;
|
| mcp.fillToMin();
| }
| }
| catch (Exception e)
| {
| }
|
| try
| {
| synchronized (pools)
| {
| pools.wait();
| }
| }
| catch (InterruptedException ie)
| {
| return;
| }
| }
It is possible that after the first synchronized block has finished a new connection pool is added to the list of pools before the second block is reached, the second block unconditionally waits and does not check that the list of pools is empty.
The wait could be wrapped with a call to isEmpty: -
| if (pools.isEmpty())
| {
| pools.wait();
| }
Or both synchronized blocks could be merged into one.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4019289#4019289
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4019289
19 years, 1 month
[Design of EJB 3.0] - Re: [long read] Info/help needed on extending EJB3 container
by Sintel
I've been thinking a bit more on the subject and I think I'm almost there. To add metadata at client side I would also need a new client-side aspect right? It isn't mentioned in the original response, only that ThreadMetaData can be used, but I don't see any way to use it other than with a new client-side aspect, in addition to the mergemetadata interceptor.
Looking at the code of InvokeRemoteInterceptor it seems there isn't really a problem in sending over references of objects from client to server and vice versa, through the use of metadata (I think if I use the AS_IS type only the unaltered reference gets sent which is sufficient, as the client's only job is to safeguard, not use it). So my new service could create a dispatcher on the server on the first invocation, which holds which target we need for the invocation. The server-side aspect can pass its reference to the client through the invocationresponse. The client can then include that reference with every invocation, the serveraspect asks that reference for the target and changes it in the invocation..
If this is all correct (confirmation?), it leaves me with this:
1) Where do i deploy my new developed aspects?
2) Is there an eclipse configuration that recognises @service etc?
3) Is there an alternative to deploying each beanimplementation in a seperate container?
Thanks for listening
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4019286#4019286
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4019286
19 years, 1 month