Package com.dp.nebula.wormhole.common

Examples of com.dp.nebula.wormhole.common.WormholeException


        columnFamilies[i] = parts[0].getBytes(
            DEFAULT_ENCODING);
        qualifiers[i] = parts[1].getBytes(
            DEFAULT_ENCODING);
      } catch (UnsupportedEncodingException e) {
        throw new WormholeException(e,
            JobStatus.READ_FAILED.getStatus());
      }
    }
  }
View Full Code Here


          LOG.warn("field number is less than " + MININUM_FIELD_NUM + " consider it as an empty line:" + line.toString(','));
          continue;
        }
        String rowKey = line.getField(rowKeyIndex);
        if (StringUtils.isEmpty(rowKey)) {
          throw new WormholeException(
              "hbase rowkey should not be empty",
              JobStatus.WRITE_DATA_EXCEPTION.getStatus());
        }
        client.setRowKey(rowKey.getBytes(DEFAULT_ENCODING));
        for (int i = 0; i < rowKeyIndex; i++) {
          if (line.getField(i) == null) {
            continue;
          }
          client.addColumn(columnFamilies[i], qualifiers[i], line
              .getField(i).getBytes(DEFAULT_ENCODING));
        }
        for (int i = rowKeyIndex + 1; i < fieldNum; i++) {
          if (line.getField(i) == null) {
            continue;
          }
          client.addColumn(columnFamilies[i-1], qualifiers[i-1], line
              .getField(i).getBytes(DEFAULT_ENCODING));
        }
        client.insert();
        getMonitor().increaseSuccessLines();
      }
    } catch (Exception e) {
      throw new WormholeException(e, JobStatus.WRITE_DATA_EXCEPTION.getStatus());
    }
  }
View Full Code Here

  @Override
  public void commit() {
    try {
      client.flush();
    } catch (IOException e) {
      throw new WormholeException(e, JobStatus.WRITE_DATA_EXCEPTION.getStatus());
    }
  }
View Full Code Here

  @Override
  public void finish() {
    try {
      client.close();
    } catch (IOException e) {
      throw new WormholeException(e, JobStatus.WRITE_DATA_EXCEPTION.getStatus());
    }
  }
View Full Code Here

        DBUtils.update(conn, sql);
      }
      conn.close();
    }catch (Exception e) {
      logger.error(writerID + ": Mysql writer prepare failed. ");
      throw new WormholeException(e,JobStatus.PRE_WRITE_FAILED.getStatus() + errorCodeAdd,writerID);
    }
  }
View Full Code Here

        DBUtils.update(conn, sql);
      }
      conn.close();
    } catch (Exception e) {
      logger.error(writerID + ": Mysql writer roll back failed. ");
      throw new WormholeException(e,JobStatus.ROLL_BACK_FAILED.getStatus() + errorCodeAdd,writerID);
    }
  }
View Full Code Here

          DBUtils.update(conn, sql);
        }
        conn.close();
      }catch (Exception e) {
        logger.error(writerID + ": Mysql writer dopost failed. ");
        throw new WormholeException(e,JobStatus.POST_WRITE_FAILED.getStatus() + errorCodeAdd,writerID);
      }
    }
  }
View Full Code Here

      }
    } catch (Exception e) {
      logger.error(String.format(
          "HdfsWriter rename temp files failed :%s,%s",
          e.getMessage(), e.getCause()));
      throw new WormholeException(
          "HdfsWriter rename temp files failed in do-post stage",
          JobStatus.POST_WRITE_FAILED.getStatus());
    } finally {
      closeAll();
    }
View Full Code Here

    /* for connection session */
    Properties p = createProperties();
    try {
      DBSource.register(MysqlWriter.class, this.ip, this.writerID, this.dbname, p);
    } catch (Exception e) {
      throw new WormholeException(e, JobStatus.WRITE_CONNECTION_FAILED.getStatus() + errorCodeAdd);
    }
   
  }
View Full Code Here

          }
        }
      } while (!idxCreated && times++ <= MAX_LZO_CREATION_TRY_TIMES);

      if (!idxCreated) {
        throw new WormholeException(
            "lzo index creation failed after try "
                + MAX_LZO_CREATION_TRY_TIMES + " times",
            JobStatus.POST_WRITE_FAILED.getStatus());
      }

      if (existIncompleteFile(dir)) {
        logger.error(String.format(
            "HdfsWriter doPost stage create index %s failed:",
            directory));
        throw new WormholeException(
            "dfsWriter doPost stage create index failed",
            JobStatus.POST_WRITE_FAILED.getStatus());
      }
    } catch (IOException e) {
      logger.error(String.format(
          "HdfsWriter doPost stage get configuration failed:%s,%s",
          e.getMessage(), e.getCause()));
      throw new WormholeException(e,
          JobStatus.POST_WRITE_FAILED.getStatus());
    }
  }
View Full Code Here

TOP

Related Classes of com.dp.nebula.wormhole.common.WormholeException

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.