• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java StreamingException类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.apache.hive.hcatalog.streaming.StreamingException的典型用法代码示例。如果您正苦于以下问题:Java StreamingException类的具体用法?Java StreamingException怎么用?Java StreamingException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

StreamingException类属于org.apache.hive.hcatalog.streaming包,在下文中一共展示了StreamingException类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: abortCurrTxnHelper

点赞 3

import org.apache.hive.hcatalog.streaming.StreamingException; //导入依赖的package包/类
private void abortCurrTxnHelper() throws TimeoutException, InterruptedException {
  try {
    timedCall(
        new CallRunner1<Void>() {
          @Override
          public Void call() throws StreamingException, InterruptedException {
            txnBatch.abort();
            LOG.info("Aborted txn " + txnBatch.getCurrentTxnId());
            return null;
          }
        }
    );
  } catch (StreamingException e) {
    LOG.warn("Unable to abort transaction " + txnBatch.getCurrentTxnId(), e);
    // continue to attempt to abort other txns in the batch
  }
}
 

开发者ID:moueimei,
项目名称:flume-release-1.7.0,
代码行数:18,
代码来源:HiveWriter.java

示例2: commitTxn

点赞 3

import org.apache.hive.hcatalog.streaming.StreamingException; //导入依赖的package包/类
private void commitTxn() throws CommitException, InterruptedException {
  if (LOG.isInfoEnabled()) {
    LOG.info("Committing Txn " + txnBatch.getCurrentTxnId() + " on EndPoint: " + endPoint);
  }
  try {
    timedCall(new CallRunner1<Void>() {
      @Override
      public Void call() throws StreamingException, InterruptedException {
        txnBatch.commit(); // could block
        return null;
      }
    });
  } catch (Exception e) {
    throw new CommitException(endPoint, txnBatch.getCurrentTxnId(), e);
  }
}
 

开发者ID:moueimei,
项目名称:flume-release-1.7.0,
代码行数:17,
代码来源:HiveWriter.java

示例3: nextTxnBatch

点赞 3

import org.apache.hive.hcatalog.streaming.StreamingException; //导入依赖的package包/类
private TransactionBatch nextTxnBatch(final RecordWriter recordWriter)
    throws InterruptedException, TxnBatchException {
  LOG.debug("Fetching new Txn Batch for {}", endPoint);
  TransactionBatch batch = null;
  try {
    batch = timedCall(new CallRunner1<TransactionBatch>() {
      @Override
      public TransactionBatch call() throws InterruptedException, StreamingException {
        return connection.fetchTransactionBatch(txnsPerBatch, recordWriter); // could block
      }
    });
    LOG.info("Acquired Transaction batch {}", batch);
  } catch (Exception e) {
    throw new TxnBatchException(endPoint, e);
  }
  return batch;
}
 

开发者ID:moueimei,
项目名称:flume-release-1.7.0,
代码行数:18,
代码来源:HiveWriter.java

示例4: createRecordWriter

点赞 2

import org.apache.hive.hcatalog.streaming.StreamingException; //导入依赖的package包/类
@Override
public RecordWriter createRecordWriter(HiveEndPoint endPoint)
    throws StreamingException, IOException, ClassNotFoundException {
  if (serdeSeparator == null) {
    return new DelimitedInputWriter(fieldToColMapping, delimiter, endPoint);
  }
  return new DelimitedInputWriter(fieldToColMapping, delimiter, endPoint, null, serdeSeparator);
}
 

开发者ID:moueimei,
项目名称:flume-release-1.7.0,
代码行数:9,
代码来源:HiveDelimitedTextSerializer.java

示例5: flush

点赞 2

import org.apache.hive.hcatalog.streaming.StreamingException; //导入依赖的package包/类
/**
 * Commits the current Txn.
 * If 'rollToNext' is true, will switch to next Txn in batch or to a
 *       new TxnBatch if current Txn batch is exhausted
 */
public void flush(boolean rollToNext)
    throws CommitException, TxnBatchException, TxnFailure, InterruptedException,
    WriteException {
  if (!batch.isEmpty()) {
    writeEventBatchToSerializer();
    batch.clear();
  }

  //0 Heart beat on TxnBatch
  if (hearbeatNeeded) {
    hearbeatNeeded = false;
    heartBeat();
  }
  lastUsed = System.currentTimeMillis();

  try {
    //1 commit txn & close batch if needed
    commitTxn();
    if (txnBatch.remainingTransactions() == 0) {
      closeTxnBatch();
      txnBatch = null;
      if (rollToNext) {
        txnBatch = nextTxnBatch(recordWriter);
      }
    }

    //2 roll to next Txn
    if (rollToNext) {
      LOG.debug("Switching to next Txn for {}", endPoint);
      txnBatch.beginNextTransaction(); // does not block
    }
  } catch (StreamingException e) {
    throw new TxnFailure(txnBatch, e);
  }
}
 

开发者ID:moueimei,
项目名称:flume-release-1.7.0,
代码行数:41,
代码来源:HiveWriter.java

示例6: newConnection

点赞 2

import org.apache.hive.hcatalog.streaming.StreamingException; //导入依赖的package包/类
private StreamingConnection newConnection(final String proxyUser)
    throws InterruptedException, ConnectException {
  try {
    return timedCall(new CallRunner1<StreamingConnection>() {
      @Override
      public StreamingConnection call() throws InterruptedException, StreamingException {
        return endPoint.newConnection(autoCreatePartitions); // could block
      }
    });
  } catch (Exception e) {
    throw new ConnectException(endPoint, e);
  }
}
 

开发者ID:moueimei,
项目名称:flume-release-1.7.0,
代码行数:14,
代码来源:HiveWriter.java

示例7: timedCall

点赞 2

import org.apache.hive.hcatalog.streaming.StreamingException; //导入依赖的package包/类
private <T> T timedCall(final CallRunner1<T> callRunner)
    throws TimeoutException, InterruptedException, StreamingException {
  Future<T> future = callTimeoutPool.submit(new Callable<T>() {
    @Override
    public T call() throws StreamingException, InterruptedException, Failure {
      return callRunner.call();
    }
  });

  try {
    if (callTimeout > 0) {
      return future.get(callTimeout, TimeUnit.MILLISECONDS);
    } else {
      return future.get();
    }
  } catch (TimeoutException eT) {
    future.cancel(true);
    sinkCounter.incrementConnectionFailedCount();
    throw eT;
  } catch (ExecutionException e1) {
    sinkCounter.incrementConnectionFailedCount();
    Throwable cause = e1.getCause();
    if (cause instanceof IOException) {
      throw new StreamingException("I/O Failure", (IOException) cause);
    } else if (cause instanceof StreamingException) {
      throw (StreamingException) cause;
    } else if (cause instanceof TimeoutException) {
      throw new StreamingException("Operation Timed Out.", (TimeoutException) cause);
    } else if (cause instanceof RuntimeException) {
      throw (RuntimeException) cause;
    } else if (cause instanceof InterruptedException) {
      throw (InterruptedException) cause;
    }
    throw new StreamingException(e1.getMessage(), e1);
  }
}
 

开发者ID:moueimei,
项目名称:flume-release-1.7.0,
代码行数:37,
代码来源:HiveWriter.java

示例8: load

点赞 2

import org.apache.hive.hcatalog.streaming.StreamingException; //导入依赖的package包/类
@Override
public StreamingConnection load(HiveEndPoint endPoint) throws StageException {
  StreamingConnection connection;
  try {
     connection = endPoint.newConnection(autoCreatePartitions, hiveConf, loginUgi);
  } catch (StreamingException | InterruptedException e) {
    throw new StageException(Errors.HIVE_09, e.toString(), e);
  }
  return connection;
}
 

开发者ID:streamsets,
项目名称:datacollector,
代码行数:11,
代码来源:HiveTarget.java

示例9: write

点赞 2

import org.apache.hive.hcatalog.streaming.StreamingException; //导入依赖的package包/类
@Override
public void write(TransactionBatch txnBatch, Event e)
        throws StreamingException, IOException, InterruptedException {
  txnBatch.write(e.getBody());
}
 

开发者ID:moueimei,
项目名称:flume-release-1.7.0,
代码行数:6,
代码来源:HiveDelimitedTextSerializer.java

示例10: write

点赞 2

import org.apache.hive.hcatalog.streaming.StreamingException; //导入依赖的package包/类
public void write(TransactionBatch batch, Event e)
throws StreamingException, IOException, InterruptedException;
 

开发者ID:moueimei,
项目名称:flume-release-1.7.0,
代码行数:3,
代码来源:HiveEventSerializer.java

示例11: createRecordWriter

点赞 2

import org.apache.hive.hcatalog.streaming.StreamingException; //导入依赖的package包/类
RecordWriter createRecordWriter(HiveEndPoint endPoint)
throws StreamingException, IOException, ClassNotFoundException;
 

开发者ID:moueimei,
项目名称:flume-release-1.7.0,
代码行数:3,
代码来源:HiveEventSerializer.java

示例12: createRecordWriter

点赞 2

import org.apache.hive.hcatalog.streaming.StreamingException; //导入依赖的package包/类
@Override
public RecordWriter createRecordWriter(HiveEndPoint endPoint)
        throws StreamingException, IOException, ClassNotFoundException {
  return new StrictJsonWriter(endPoint);
}
 

开发者ID:moueimei,
项目名称:flume-release-1.7.0,
代码行数:6,
代码来源:HiveJsonSerializer.java

示例13: createRecordWriter

点赞 2

import org.apache.hive.hcatalog.streaming.StreamingException; //导入依赖的package包/类
@Override
public RecordWriter createRecordWriter(HiveEndPoint hiveEndPoint) throws StreamingException, IOException, ClassNotFoundException {
  List<String> result = fields.stream().map(String::toLowerCase).collect(Collectors.toList());
  return new DelimitedInputWriter(result.toArray(new String[0]), fieldDelimiter, hiveEndPoint);
}
 

开发者ID:hortonworks,
项目名称:streamline,
代码行数:6,
代码来源:StreamlineHiveMapper.java

示例14: write

点赞 2

import org.apache.hive.hcatalog.streaming.StreamingException; //导入依赖的package包/类
@Override
public void write(TransactionBatch transactionBatch, Tuple tuple) throws StreamingException, IOException, InterruptedException {
    transactionBatch.write(mapRecord(tuple));
}
 

开发者ID:hortonworks,
项目名称:streamline,
代码行数:5,
代码来源:StreamlineHiveMapper.java

示例15: getBatch

点赞 2

import org.apache.hive.hcatalog.streaming.StreamingException; //导入依赖的package包/类
private TransactionBatch getBatch(int batchSize, HiveEndPoint endPoint) throws InterruptedException,
    StreamingException, ExecutionException {
  return hiveConnectionPool.get(endPoint).fetchTransactionBatch(batchSize, recordWriterPool.get(endPoint));
}
 

开发者ID:streamsets,
项目名称:datacollector,
代码行数:5,
代码来源:HiveTarget.java

示例16: call

点赞 1

import org.apache.hive.hcatalog.streaming.StreamingException; //导入依赖的package包/类
T call() throws StreamingException, InterruptedException, Failure; 

开发者ID:moueimei,
项目名称:flume-release-1.7.0,
代码行数:2,
代码来源:HiveWriter.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)