Java源码示例:backtype.storm.topology.ReportedFailedException
示例1
protected void checkCassandraException(Exception e) {
_mexceptions.incr();
if (e instanceof AlreadyExistsException ||
e instanceof AuthenticationException ||
e instanceof DriverException ||
e instanceof DriverInternalError ||
e instanceof InvalidConfigurationInQueryException ||
e instanceof InvalidQueryException ||
e instanceof InvalidTypeException ||
e instanceof QueryExecutionException ||
e instanceof QueryValidationException ||
e instanceof ReadTimeoutException ||
e instanceof SyntaxError ||
e instanceof TraceRetrievalException ||
e instanceof TruncateException ||
e instanceof UnauthorizedException ||
e instanceof UnavailableException ||
e instanceof ReadTimeoutException ||
e instanceof WriteTimeoutException ||
e instanceof ReadFailureException ||
e instanceof WriteFailureException ||
e instanceof FunctionExecutionException) {
throw new ReportedFailedException(e);
} else {
throw new RuntimeException(e);
}
}
示例2
public void handleRegular(Tuple tuple) {
basicCollector.setContext(tuple);
try {
delegate.execute(tuple, basicCollector);
collector.ack(tuple);
} catch (FailedException e) {
if (e instanceof ReportedFailedException) {
collector.reportError(e);
}
collector.fail(tuple);
}
}
示例3
public void handlePrepareCommit(Tuple tuple) {
basicCollector.setContext(tuple);
try {
BatchId id = (BatchId) tuple.getValue(0);
((IPrepareCommit) delegate).prepareCommit(id, basicCollector);
collector.ack(tuple);
} catch (FailedException e) {
if (e instanceof ReportedFailedException) {
collector.reportError(e);
}
collector.fail(tuple);
}
}
示例4
private void failBatch(TrackedBatch tracked, FailedException e) {
if (e != null && e instanceof ReportedFailedException) {
_collector.reportError(e);
}
tracked.failed = true;
if (tracked.delayedAck != null) {
_collector.fail(tracked.delayedAck);
tracked.delayedAck = null;
}
}
示例5
private void handleLog(ShellMsg shellMsg) {
String msg = shellMsg.getMsg();
msg = "ShellLog " + _process.getProcessInfoString() + " " + msg;
ShellMsg.ShellLogLevel logLevel = shellMsg.getLogLevel();
switch (logLevel) {
case TRACE:
LOG.trace(msg);
break;
case DEBUG:
LOG.debug(msg);
break;
case INFO:
LOG.info(msg);
break;
case WARN:
LOG.warn(msg);
break;
case ERROR:
LOG.error(msg);
_collector.reportError(new ReportedFailedException(msg));
break;
default:
LOG.info(msg);
break;
}
}