コード例 #1
0
  @Override
  public Status operationAdded(DsEvent e, DsTransaction transaction, DsOperation operation) {
    Status overallStatus = Status.OK;
    super.operationAdded(e, transaction, operation);
    numOps.incrementAndGet();

    final Tx tx = new Tx(transaction, getMetaData(), getConfig());
    final TableMetaData tMeta = getMetaData().getTableMetaData(operation.getTableName());
    final Op op = new Op(operation, tMeta, getConfig());

    operation.getTokens();
    if (isOperationMode()) {

      if (log.isDebugEnabled()) {
        log.debug(
            " Received operation: table='"
                + op.getTableName()
                + "'"
                + ", pos="
                + op.getPosition()
                + " (total_ops= "
                + tx.getTotalOps()
                + ", buffered="
                + tx.getSize()
                + ")"
                + ", ts="
                + op.getTimestamp());
      }

      Status operationStatus = processOperation(tx, op);

      if (Status.ABEND.equals(operationStatus)) {
        overallStatus = Status.ABEND;
      }
    }
    return overallStatus;
  }
コード例 #2
0
  @Override
  public Status transactionCommit(DsEvent e, DsTransaction transaction) {
    Status overallStatus = Status.OK;
    super.transactionCommit(e, transaction);

    Tx tx = txFactory.createAdapterTx(transaction, getMetaData(), getConfig());
    numTxs.incrementAndGet();

    if (log.isDebugEnabled()) {
      log.debug(
          "transactionCommit event, tx #"
              + numTxs.get()
              + ":"
              + ", pos="
              + tx.getTranID()
              + " (total_ops= "
              + tx.getTotalOps()
              + ", buffered="
              + tx.getSize()
              + ")"
              + ", ts="
              + tx.getTimestamp()
              + ")");
    }

    if (!isOperationMode()) {
      for (Op op : tx) {
        Status operationStatus = processOperation(tx, op);

        if (Status.ABEND.equals(operationStatus)) {
          overallStatus = Status.ABEND;
        }
      }
    }

    return overallStatus;
  }