示例#1
0
 private void handleAbortTransaction(final AbortTransaction abort) {
   doAbortTransaction(abort.getTransactionID(), getSender());
 }
示例#2
0
  @Override
  public void onReceiveCommand(final Object message) throws Exception {

    MessageTracker.Context context = appendEntriesReplyTracker.received(message);

    if (context.error().isPresent()) {
      LOG.trace(
          "{} : AppendEntriesReply failed to arrive at the expected interval {}",
          persistenceId(),
          context.error());
    }

    try {
      if (CreateTransaction.SERIALIZABLE_CLASS.isInstance(message)) {
        handleCreateTransaction(message);
      } else if (BatchedModifications.class.isInstance(message)) {
        handleBatchedModifications((BatchedModifications) message);
      } else if (message instanceof ForwardedReadyTransaction) {
        handleForwardedReadyTransaction((ForwardedReadyTransaction) message);
      } else if (message instanceof ReadyLocalTransaction) {
        handleReadyLocalTransaction((ReadyLocalTransaction) message);
      } else if (CanCommitTransaction.SERIALIZABLE_CLASS.isInstance(message)) {
        handleCanCommitTransaction(CanCommitTransaction.fromSerializable(message));
      } else if (CommitTransaction.SERIALIZABLE_CLASS.isInstance(message)) {
        handleCommitTransaction(CommitTransaction.fromSerializable(message));
      } else if (AbortTransaction.SERIALIZABLE_CLASS.isInstance(message)) {
        handleAbortTransaction(AbortTransaction.fromSerializable(message));
      } else if (CloseTransactionChain.SERIALIZABLE_CLASS.isInstance(message)) {
        closeTransactionChain(CloseTransactionChain.fromSerializable(message));
      } else if (message instanceof RegisterChangeListener) {
        changeSupport.onMessage((RegisterChangeListener) message, isLeader(), hasLeader());
      } else if (message instanceof RegisterDataTreeChangeListener) {
        treeChangeSupport.onMessage(
            (RegisterDataTreeChangeListener) message, isLeader(), hasLeader());
      } else if (message instanceof UpdateSchemaContext) {
        updateSchemaContext((UpdateSchemaContext) message);
      } else if (message instanceof PeerAddressResolved) {
        PeerAddressResolved resolved = (PeerAddressResolved) message;
        setPeerAddress(resolved.getPeerId().toString(), resolved.getPeerAddress());
      } else if (message.equals(TX_COMMIT_TIMEOUT_CHECK_MESSAGE)) {
        commitCoordinator.checkForExpiredTransactions(transactionCommitTimeout, this);
      } else if (message instanceof DatastoreContext) {
        onDatastoreContext((DatastoreContext) message);
      } else if (message instanceof RegisterRoleChangeListener) {
        roleChangeNotifier.get().forward(message, context());
      } else if (message instanceof FollowerInitialSyncUpStatus) {
        shardMBean.setFollowerInitialSyncStatus(
            ((FollowerInitialSyncUpStatus) message).isInitialSyncDone());
        context().parent().tell(message, self());
      } else if (GET_SHARD_MBEAN_MESSAGE.equals(message)) {
        sender().tell(getShardMBean(), self());
      } else if (message instanceof GetShardDataTree) {
        sender().tell(store.getDataTree(), self());
      } else if (message instanceof ServerRemoved) {
        context().parent().forward(message, context());
      } else if (ShardTransactionMessageRetrySupport.TIMER_MESSAGE_CLASS.isInstance(message)) {
        messageRetrySupport.onTimerMessage(message);
      } else {
        super.onReceiveCommand(message);
      }
    } finally {
      context.done();
    }
  }