General J2EE: Distributed transactions within different JVMs and servers

  1. Hi!
    I am wondering if it possible to do the following architecture :

    ServerA initiates a Transaction and send call different services into ServerB with this transaction
    ServerB uses the transaction created into serverA to insert data.
    ServerA at the end of serverB calls, commit the transaction if no problem occurs, otherwise it rollbacks all data inserted if serverB reports any problem.
  2. It looks like a distributed transaction with a single remote datasource, so the answer would be yes.

    On your serverA you would have a JTA transaction which would be the transaction coordinator, and the transaction manager on serverB would participate in the transaction initiated by by the transaction coordinator.

    The 2PC protocol will assure you that serverA commits only if serverB commits