A web service executing within a WS-AT transaction may wish to interpose a subordinate coordinator between itself and its own coordinator. To do so it needs to be able to start a subordinate WS-AT transaction. The current API for creating AT transactions requires calling UserTransactionFactory.userTransaction() to obtain an instance of UserTransaction and then calling begin() (or begin(final int timeout)) on the returned UserTransaction to start the transaction. If this is done within an existing AT transaction a WrongStateException is thrown. This request proposes to add the following methods to UserTransaction()
public void beginSubordinate() throws WrongStateException, SystemException;
public void beginSubordinate(int timeout) throws WrongStateException, SystemException;
These methods will begin a subordinate transaction so long as the thread is currently associated with a WS-AT transaction. WrongStateException will be thrown if the thread is not currently associated with a WS-AT transaction. SystemException will be thrown if a problem occurs starting the transaction (this can occur for much the same reasons it can occur with the normal begin methods).