本文整理了Java中org.apache.storm.utils.Utils.asyncLoop()
方法的一些代码示例,展示了Utils.asyncLoop()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.asyncLoop()
方法的具体详情如下:
包路径:org.apache.storm.utils.Utils
类名称:Utils
方法名:asyncLoop
[英]Convenience method used when only the function is given.
[中]仅给出函数时使用的简便方法。
代码示例来源:origin: apache/storm
/**
* Convenience method used when only the function is given.
*
* @param afn the code to call on each iteration
* @return the newly created thread
*/
public static SmartThread asyncLoop(final Callable afn) {
return asyncLoop(afn, false, null, Thread.NORM_PRIORITY, false, true,
null);
}
代码示例来源:origin: apache/storm
/**
* Convenience method used when only the function and name suffix are given.
*
* @param afn the code to call on each iteration
* @param threadName a suffix to be appended to the thread name
* @return the newly created thread
*
* @see Thread
*/
public static SmartThread asyncLoop(final Callable afn, String threadName, final Thread.UncaughtExceptionHandler eh) {
return asyncLoop(afn, false, eh, Thread.NORM_PRIORITY, false, true,
threadName);
}
代码示例来源:origin: apache/storm
public SmartThread makeTransferThread() {
return Utils.asyncLoop(() -> {
if (transferQueue.consume(this) == 0) {
return 1L;
}
return 0L;
});
}
代码示例来源:origin: apache/storm
/**
* separated from mkExecutor in order to replace executor transfer in executor data for testing.
*/
public ExecutorShutdown execute() throws Exception {
LOG.info("Loading executor tasks " + componentId + ":" + executorId);
String handlerName = componentId + "-executor" + executorId;
Utils.SmartThread handler =
Utils.asyncLoop(this, false, reportErrorDie, Thread.NORM_PRIORITY, true, true, handlerName);
LOG.info("Finished loading executor " + componentId + ":" + executorId);
return new ExecutorShutdown(this, Lists.newArrayList(handler), idToTask, receiveQueue);
}
代码示例来源:origin: apache/storm
Utils.asyncLoop(new Callable<Long>() {
public Long call() {
if (logPrefix != null) {
代码示例来源:origin: org.apache.storm/storm-core
/**
* Convenience method used when only the function is given.
* @param afn the code to call on each iteration
* @return the newly created thread
*/
public static SmartThread asyncLoop(final Callable afn) {
return asyncLoop(afn, false, null, Thread.NORM_PRIORITY, false, true,
null);
}
代码示例来源:origin: org.apache.storm/storm-core
/**
* Convenience method used when only the function and name suffix are given.
* @param afn the code to call on each iteration
* @param threadName a suffix to be appended to the thread name
* @return the newly created thread
* @see java.lang.Thread
*/
public static SmartThread asyncLoop(final Callable afn, String threadName, final Thread.UncaughtExceptionHandler eh) {
return asyncLoop(afn, false, eh, Thread.NORM_PRIORITY, false, true,
threadName);
}
代码示例来源:origin: org.apache.storm/storm-core
Utils.asyncLoop(new Callable<Object>() {
public Object call() {
if (logPrefix != null ) {
内容来源于网络,如有侵权,请联系作者删除!