本文整理汇总了Java中backtype.storm.topology.ReportedFailedException类的典型用法代码示例。如果您正苦于以下问题:Java ReportedFailedException类的具体用法?Java ReportedFailedException怎么用?Java ReportedFailedException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ReportedFailedException类属于backtype.storm.topology包,在下文中一共展示了ReportedFailedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateState
import backtype.storm.topology.ReportedFailedException; //导入依赖的package包/类
@Override
public void updateState(MapState<Map<String, Object>> state, List<TridentTuple> tuples, TridentCollector collector) {
List<Map<String, Object>> events = Lists.newArrayList();
List<List<Object>> keys = Lists.newArrayList();
for (TridentTuple t : tuples) {
if(t!=null) {
List<Object> l = Lists.newArrayList();
l.add(_generalKey + t.getValueByField(_key));
keys.add(l);
events.add((Map<String, Object>) t.getValueByField(_value));
//System.out.println("SAVED TO MEMCACHED KEY: " + _generalKey +t.getValueByField(_key) +
// " VALUE: " + t.getValueByField(_value));
}
}
try {
state.multiPut(keys, events);
} catch (ReportedFailedException e) {
Logger.getLogger(MemcachedUpdater.class.getName()).log(Level.WARNING, null, e);
}
}
示例2: updateState
import backtype.storm.topology.ReportedFailedException; //导入依赖的package包/类
@Override
public void updateState(MapState<Map<String, Object>> state, List<TridentTuple> tuples, TridentCollector collector) {
List<Map<String, Object>> events = new ArrayList<>();
List<List<Object>> keys = new ArrayList<>();
for (TridentTuple t : tuples) {
if (t != null) {
List<Object> l = new ArrayList<>();
l.add(_generalKey + t.getValueByField(_key));
keys.add(l);
if (t.getValueByField(_value) != null)
events.add((Map<String, Object>) t.getValueByField(_value));
if (_debug) {
System.out.println("SAVED TO RIAK KEY: " + _generalKey + t.getValueByField(_key)
+ " VALUE: " + t.getValueByField(_value));
}
}
}
try {
if (!events.isEmpty())
state.multiPut(keys, events);
} catch (ReportedFailedException e) {
Logger.getLogger(RiakUpdater.class.getName()).log(Level.WARNING, null, e);
}
}
示例3: checkCassandraException
import backtype.storm.topology.ReportedFailedException; //导入依赖的package包/类
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 QueryTimeoutException ||
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) {
throw new ReportedFailedException(e);
} else {
throw new RuntimeException(e);
}
}
示例4: checkMemcachedException
import backtype.storm.topology.ReportedFailedException; //导入依赖的package包/类
private void checkMemcachedException(Exception e) {
// _mexceptions.incr();
if(e instanceof RequestException ||
e instanceof ChannelException ||
e instanceof ServiceException ||
e instanceof ApplicationException ||
e instanceof ApiException ||
e instanceof CodecException ||
e instanceof ChannelBufferUsageException) {
throw new ReportedFailedException(e);
} else {
throw new RuntimeException(e);
}
}
示例5: failBatch
import backtype.storm.topology.ReportedFailedException; //导入依赖的package包/类
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;
}
}
示例6: handleLog
import backtype.storm.topology.ReportedFailedException; //导入依赖的package包/类
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;
}
}
示例7: handleRegular
import backtype.storm.topology.ReportedFailedException; //导入依赖的package包/类
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);
}
}
示例8: handlePrepareCommit
import backtype.storm.topology.ReportedFailedException; //导入依赖的package包/类
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);
}
}
示例9: handleRegular
import backtype.storm.topology.ReportedFailedException; //导入依赖的package包/类
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);
}
}
示例10: handlePrepareCommit
import backtype.storm.topology.ReportedFailedException; //导入依赖的package包/类
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);
}
}
示例11: handleLog
import backtype.storm.topology.ReportedFailedException; //导入依赖的package包/类
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;
}
}
示例12: execute
import backtype.storm.topology.ReportedFailedException; //导入依赖的package包/类
@Override
public void execute(Tuple tuple,
BasicOutputCollector outputCollector) {
String customerId = tuple.getStringByField("customer");
List<Sale> sales = (List<Sale>) tuple.getValueByField("sales");
try {
dbClient.save(customerId, sales);
} catch (Timeout e) {
throw new ReportedFailedException(e);
}
}
示例13: handleRegular
import backtype.storm.topology.ReportedFailedException; //导入依赖的package包/类
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);
}
}
示例14: handlePrepareCommit
import backtype.storm.topology.ReportedFailedException; //导入依赖的package包/类
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);
}
}
示例15: failBatch
import backtype.storm.topology.ReportedFailedException; //导入依赖的package包/类
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;
}
}