Search in sources :

Example 1 with LRAStatus

use of io.narayana.lra.coordinator.domain.model.LRAStatus in project narayana by jbosstm.

the class LRAService method endLRA.

public LRAStatus endLRA(URL lraId, boolean compensate, boolean fromHierarchy) {
    lraTrace(lraId, "end LRA");
    Transaction transaction = getTransaction(lraId);
    if (!transaction.isActive() && !transaction.isRecovering() && transaction.isTopLevel())
        throw new IllegalLRAStateException(lraId.toString(), "LRA is closing or closed", "endLRA");
    transaction.end(compensate);
    if (transaction.currentLRA() != null)
        if (LRALogger.logger.isInfoEnabled())
            LRALogger.logger.infof("LRAServicve.endLRA LRA %s ended but is still associated with %s%n", lraId, transaction.currentLRA().get_uid().fileStringForm());
    finished(transaction, fromHierarchy);
    if (transaction.isTopLevel()) {
        // forget any nested LRAs
        // instruct compensators to clean up
        transaction.forgetAllParticipants();
    }
    return new LRAStatus(transaction);
}
Also used : Transaction(io.narayana.lra.coordinator.domain.model.Transaction) LRAStatus(io.narayana.lra.coordinator.domain.model.LRAStatus) IllegalLRAStateException(io.narayana.lra.client.IllegalLRAStateException)

Aggregations

IllegalLRAStateException (io.narayana.lra.client.IllegalLRAStateException)1 LRAStatus (io.narayana.lra.coordinator.domain.model.LRAStatus)1 Transaction (io.narayana.lra.coordinator.domain.model.Transaction)1