Tells the participant to prepare for commiting its state associated with the given transaction. This method returns a
boolean
flag stating whether the prepared state is read-only, meaning that no external state is modified by this participant. If this method returns true, then neither
commit
nor
abort
will be called.
If this method throws an exception, then the preparation failed, and the transaction will be aborted. If this method completes successfully, then the participant is required to be able to commit the transaction without failure.
@param txn the Transaction
object
@return true if this participant is read-only, false otherwise
@throws Exception if there are any failures in preparing
@throws IllegalStateException if this participant has already beenprepared, committed, or aborted, or if this participant is not participating in the given transaction