[Design of Messaging on JBoss (Messaging/JBoss)] - Transaction management in JCA adapter is screwed up
by timfox
I just took a look at the tx management code in the JCA adapter, and it looks just plain wrong in places.
JBMMessageHandler::onMessage.
Firstly it seems a transaction is *always* being started and committed/rolled back for *every* message. It's my understanding that this should only be done if the bean is using CMT and the transaction atttribute is Required.
For BMT or transaction attribute=NOT_SUPPORTED no transaction should be created.
Also
| if (activation.getActivationSpec().getAcknowledgeModeInt() == Session.SESSION_TRANSACTED || activation.getActivationSpec()
| .getAcknowledgeModeInt() == Session.CLIENT_ACKNOWLEDGE)
| {
| try
| {
| message.acknowledge();
| }
| catch (MessagingException e)
| {
| log.error("Failed to process message", e);
| }
| }
|
The above code is a nonsense, since a) it's illegal to use CLIENT_ACKNOWLEDGE in a MDB and b) if a session is transacted, message.acknowledge() does nothing anyway.
Also the code in JBMResourceAdapter::createSession seems just plain wrong - it seems to be creating XA sessions when ack mode = auto_ack !! ??
The specification "EJB core contracts and requirements" Chapter 5 should be read properly and the code in the adapter corrected.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4244258#4244258
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4244258
16 years, 8 months
[Design the new POJO MicroContainer] - JBKERNEL-12 - Scoped Deployments
by marius.bogoevici
I started looking at Scoped Deployments as part of some work surrounding the Spring Deployer. To wit, this means allowing Spring-instantiated beans to be registered as MC beans, essentially hiding their Spring nature from the rest of the application, and then allowing them to be injected in other application-server deployed objects, most notably EJBs. One desirable behaviour would be to allow for deploying these beans in a distinct scope, so that they don't start polluting the whole MC bean namespace. This would be useful in the case of EAR deployments, where the Spring-related beans would be visible only for the current EAR, but to nobody else.
The way I am seeing the scenario working is this:
1) Every Deployment could get an associated ScopedKernelController (one ScopeKey per Deployment).
2) A Deployer (AbstractRealDeployer) could have access to this Controller and could deploy/register beans into it
3) This way, deployers that are supposed to create instances through a third-party managed process (such as Spring AppContext bootstrapping, but this is really a particular case) can register their own MC beans, and there is a certain degree of isolation between the different deployments.
Now, one thing that I was trying to figure out was how much of this is currently supported by the current implementation, and how much is still there to be done. So, the beginning question is, what are the current thoughts regarding the Scoped Deployments feature, and if there is a list of outstanding TODOs?
As much as I could figure out from the current implementation, there is the possibility of deploying individual beans with scoping information, provided that the appropriate annotations are added on the metadata, as well as looking them up via the ScopeKeyLookupStrategy. However, there is no generic "deploy in XYZ scope" operation or "get the Controller corresponding to the XYZ scope", or "get Bean from XYZ scope". As well, every deployment gets some scope associated with it, but I can't see this being used in any practical fashion.
Also, while injection works properly with scoping (i.e. beans will be injected into other beans only if found in the appropriate scope), consuming scoped beans is somehow inconsistent, in that getBean("someBean") called on a Kernel will return the first encountered bean with a given name, defined in the global Kernel controller, or any of its children. If there are multiple beans with the same name defined in the Kernel, in different scopes, an arbitrary bean (first encountered) is chosen and returned.
Again, what I am looking here is:
a) some confirmation that things work in the way I described them (or some correction if they aren't), since there is no actual documentation to accompany the code;
b) some input on the what the current thinking is wrt Scoped Deployments, and the action items that are currently known as necessary (especially in the light of JBKERNEL-12 being still open)
c) some input regarding the action items necessary this context. For now, what I think it is needed is:
- on the MC side, allow for a more streamlined "deploy in context" API (essentially wrapping the existing scoping features)
- on the jboss-deployers side, make sure that every Deployment gets an associated ScopedKernelController and that this ScopedKernelController is available at deployment time
- all MC-registered beans created by a deployment are created in the Scope of the Deployment
- Kernel-aware beans that live in a particular deployment context can have access to the Controller that corresponds to their particular scope and can consume other MC beans (if they are visible from that particular scope)
Thanks for not giving up on reading this already ;) and I am looking forward to your comments,
Marius
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4244152#4244152
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4244152
16 years, 8 months
[Design of JCA on JBoss] - Re: About Project Plan & Implementation
by jesper.pedersen
anonymous wrote :
| When implementing Connection Management related contract, is old code that is implemented in the JBoss AS "trunk/connector" used for starting? Or, is it implemented from scratch?
|
Well, JBJCA is a new implementation, so it is from scratch. That being said we will of course reuse all the code we can from the existing implementation (Branch_5_x/connector).
Focus will be on splitting the classes (and especially inner classes) out, so each are more visible in the projects. Also interfaces should be used for all variables such that implementations can be changed using the container injection mechanism.
anonymous wrote :
| (This is also applicable for other modules, JDBC, JMS, Quartz, Timer etc.)
|
Focus is on the container first, this means deployer chain, core services and so on. Then we will focus on porting the JDBC layer over to the repository - and update it depending on the JDBC version in JDK7.
Mail will be ported too.
JMS and Timer are last as JBoss Messaging 2.0 will features its own resource adapter.
The key is that each component can be released individually once the project hits 1.0.0.
anonymous wrote :
| What is the work plan for Pojo JCA? I have looked at JIRA for release plan but it is not detailed.
|
A detailed work plan, no. We are currently focusing on implementing the deployer chain - and thereby provide feedback to the JSR-322 expert group regarding XSD and annotations.
Once that is up and running focus will be on implementing the core services; WorkManager, ConnectionManager and so on.
So it is really a matter of picking an area of interest and start to look into it. The cobertura target in the Ant file will provide you with an overview where testing is needed.
And breaking the tasks into smaller pieces such that each can be easier completed within a development cycle of a month. Note, we don't use sub-tasks - link the tasks together using the JIRA link mechanism.
anonymous wrote :
| When would you think to release first stable version ?
|
Well, first we need the TCK test suite for the final JCA 1.6 specification - both for the standalone environment and for the entire JavaEE6 environment.
Depending on our progress at that time we get a number which must end up at 100% ;)
That being said there are a couple of blockers out-side of the specification before we can go final.
The plan is to release monthly developer snapshots - hopefully each with new functionality that the users will find interesting.
anonymous wrote :
| I am asking questions because I really contribute on this :)
|
Sounds great :) You are always more than welcome to post your ideas, comments or questions about the project here.
Thanks for your contributions to the project !
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4244148#4244148
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4244148
16 years, 8 months