use of com.hazelcast.transaction.impl.Transaction.State.PREPARED in project hazelcast by hazelcast.
the class XATransaction method commitAsync.
public void commitAsync(BiConsumer callback) {
if (state != PREPARED) {
throw new IllegalStateException("Transaction is not prepared");
}
checkTimeout();
state = COMMITTING;
BiConsumer wrappedCallback = (input, throwable) -> {
try {
callback.accept(input, throwable);
} finally {
if (throwable != null) {
transactionLog.onCommitFailure();
} else {
transactionLog.onCommitSuccess();
}
}
};
transactionLog.commitAsync(nodeEngine, wrappedCallback);
// We should rethrow exception if transaction is not TWO_PHASE
state = COMMITTED;
}
Aggregations