Package org.apache.flume.channel.jdbc

Examples of org.apache.flume.channel.jdbc.JdbcChannelException


    }

    public Builder setHeaderValueSpill(long headerId, String valueSpill) {
      HeaderPart hp = bHeaderParts.get(headerId);
      if (hp == null) {
        throw new JdbcChannelException("Header not found for spill: "
            + headerId);
      }

      hp.setSpillValue(valueSpill);
View Full Code Here


  }

  @Override
  public void begin() {
    if (!active) {
      throw new JdbcChannelException("Inactive transaction");
    }
    if (count == 0) {
      // Lease a connection now
      try {
        connection = dataSource.getConnection();
      } catch (SQLException ex) {
        throw new JdbcChannelException("Unable to lease connection", ex);
      }
      // Clear any prior warnings on the connection
      try {
        connection.clearWarnings();
      } catch (SQLException ex) {
View Full Code Here

  }

  @Override
  public void commit() {
    if (!active) {
      throw new JdbcChannelException("Inactive transaction");
    }
    if (rollback) {
      throw new JdbcChannelException(
          "Cannot commit transaction marked for rollback");
    }
    LOGGER.debug("Tx count-commit: " + count + ", rollback: " + rollback);
  }
View Full Code Here

  }

  @Override
  public void rollback() {
    if (!active) {
      throw new JdbcChannelException("Inactive transaction");
    }
    LOGGER.warn("Marking transaction for rollback");
    rollback = true;
    LOGGER.debug("Tx count-rollback: " + count + ", rollback: " + rollback);
  }
View Full Code Here

  }

  @Override
  public void close() {
    if (!active) {
      throw new JdbcChannelException("Inactive transaction");
    }
    count--;
    LOGGER.debug("Tx count-close: " + count + ", rollback: " + rollback);
    if (count == 0) {
      active = false;
      try {
        if (rollback) {
          LOGGER.info("Attempting transaction roll-back");
          connection.rollback();
        } else {
          LOGGER.info("Attempting transaction commit");
          connection.commit();
        }
      } catch (SQLException ex) {
        throw new JdbcChannelException("Unable to finalize transaction", ex);
      } finally {
        if (connection != null) {
          // Log Warnings
          try {
            SQLWarning warning = connection.getWarnings();
View Full Code Here

    }
  }

  protected Connection getConnection() {
    if (!active) {
      throw new JdbcChannelException("Inactive transaction");
    }
    return connection;
  }
View Full Code Here

TOP

Related Classes of org.apache.flume.channel.jdbc.JdbcChannelException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.