JBoss Community

Re: JTA 1.2 Implementation Work

created by Paul Robinson in JBoss Transactions Development - View the full discussion

Tom,

 

Re: When something goes wrong internally to the implementation of the TransactionInterceptor or TransactionalContext, what RuntimeException should I throw?

It doesn't seem to be specified, so I'm thinking I can just throw some Narayana specific RuntimeException.

 

Can you provide an example, at the moment I am thinking javax.transaction.TransactionalException (from 3.7: Transactional Annotation)

Yes, I think I can use TransactionalException in the transaction interceptors. However, I was more thinking about what to do in the TransactionalContext. Here's an example:

 

The TransactionalContext needs to lookup the transaction manager. If this fails, a javax.transaction.SystemException is thrown. This has to be handled (it extends Exception) and the Context interface does not declare that any checked exceptions can be thrown from its methods. Therefore I need to wrap the javax.transaction.SystemException in some unchecked transaction.

 

TransactionalException is the only RuntimeException in the JTA 1.2 spec, so I'll just use whatever general unchecked exception we use in the JTA 1.1 implementation.

Reply to this message by going to Community

Start a new discussion in JBoss Transactions Development at Community