Esempio n. 1
0
  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);
    }
  }
Esempio n. 2
0
 private void commitWithNewTransaction(final Modification modification) {
   ReadWriteShardDataTreeTransaction tx =
       store.newReadWriteTransaction(modification.toString(), null);
   modification.apply(tx.getSnapshot());
   try {
     snapshotCohort.syncCommitTransaction(tx);
     shardMBean.incrementCommittedTransactionCount();
     shardMBean.setLastCommittedTransactionTime(System.currentTimeMillis());
   } catch (Exception e) {
     shardMBean.incrementFailedTransactionsCount();
     LOG.error("{}: Failed to commit", persistenceId(), e);
   }
 }