private void finishCommit( @Nonnull final ActorRef sender, @Nonnull final String transactionID, @Nonnull final CohortEntry cohortEntry) { LOG.debug( "{}: Finishing commit for transaction {}", persistenceId(), cohortEntry.getTransactionID()); try { cohortEntry.commit(); sender.tell(CommitTransactionReply.INSTANCE.toSerializable(), getSelf()); shardMBean.incrementCommittedTransactionCount(); shardMBean.setLastCommittedTransactionTime(System.currentTimeMillis()); } catch (Exception e) { sender.tell(new akka.actor.Status.Failure(e), getSelf()); LOG.error( "{}, An exception occurred while committing transaction {}", persistenceId(), transactionID, e); shardMBean.incrementFailedTransactionsCount(); } finally { commitCoordinator.currentTransactionComplete(transactionID, true); } }
void continueCommit(final CohortEntry cohortEntry) { final DataTreeCandidate candidate = cohortEntry.getCandidate(); // If we do not have any followers and we are not using persistence // or if cohortEntry has no modifications // we can apply modification to the state immediately if ((!hasFollowers() && !persistence().isRecoveryApplicable()) || isEmptyCommit(candidate)) { applyModificationToState( cohortEntry.getReplySender(), cohortEntry.getTransactionID(), candidate); } else { Shard.this.persistData( cohortEntry.getReplySender(), cohortEntry.getTransactionID(), DataTreeCandidatePayload.create(candidate)); } }