本文整理了Java中backtype.storm.utils.Utils.sleep()
方法的一些代码示例,展示了Utils.sleep()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.sleep()
方法的具体详情如下:
包路径:backtype.storm.utils.Utils
类名称:Utils
方法名:sleep
暂无
代码示例来源:origin: alibaba/jstorm
public void nextTuple() {
Utils.sleep(100);
}
代码示例来源:origin: alibaba/mdrill
public void nextTuple() {
Utils.sleep(100);
}
代码示例来源:origin: alibaba/jstorm
public void nextTuple() {
if (_serveTuples.size() > 0) {
FixedTuple ft = _serveTuples.remove(0);
String id = UUID.randomUUID().toString();
_pending.put(id, ft);
_collector.emit(ft.stream, ft.values, id);
} else {
Utils.sleep(100);
}
}
代码示例来源:origin: alibaba/jstorm
@Override
public boolean isReady(long txid) {
if(!_waitToEmit) return true;
List allBatches = (List) RegisteredGlobalState.getState(_id);
if(allBatches.size() > _masterEmitted) {
_masterEmitted++;
return true;
} else {
Utils.sleep(2);
return false;
}
}
}
代码示例来源:origin: alibaba/mdrill
public void nextTuple() {
if(_serveTuples.size()>0) {
FixedTuple ft = _serveTuples.remove(0);
String id = UUID.randomUUID().toString();
_pending.put(id, ft);
_collector.emit(ft.stream, ft.values, id);
} else {
Utils.sleep(100);
}
}
代码示例来源:origin: alibaba/jstorm
@Override
public void nextTuple() {
Utils.sleep(100);
collector.emit(new Values(rand.nextInt(1000), System.currentTimeMillis() - (24 * 60 * 60 * 1000), ++msgId),
msgId);
}
代码示例来源:origin: alibaba/jstorm
public void nextTuple() {
Utils.sleep(100);
final String[] words = new String[] { "nathan", "mike", "jackson", "golda", "bertels" };
final Random rand = new Random();
final String word = words[rand.nextInt(words.length)];
_collector.emit(new Values(word));
}
代码示例来源:origin: alibaba/jstorm
/**
* Meant to be called only by the supervisor for stormjar/stormconf/stormcode files.
*
* @param key
* @param localFile
* @param cb
* @throws KeyNotFoundException
* @throws IOException
*/
public static void downloadResourcesAsSupervisorDirect(String key, String localFile,
ClientBlobStore cb) throws KeyNotFoundException, IOException {
final int MAX_RETRY_ATTEMPTS = 2;
final int ATTEMPTS_INTERVAL_TIME = 100;
for (int retryAttempts = 0; retryAttempts < MAX_RETRY_ATTEMPTS; retryAttempts++) {
if (downloadResourcesAsSupervisorAttempt(cb, key, localFile)) {
break;
}
Utils.sleep(ATTEMPTS_INTERVAL_TIME);
}
}
代码示例来源:origin: alibaba/jstorm
@Override
public void nextTuple() {
Utils.sleep(100);
String[] sentences = new String[] { "the cow jumped over the moon", "an apple a day keeps the doctor away",
"four score and seven years ago", "snow white and the seven dwarfs", "i am at two with nature" };
String sentence = sentences[_rand.nextInt(sentences.length)];
_collector.emit(new Values(sentence));
}
代码示例来源:origin: alibaba/jstorm
@Override
public void nextTuple() {
Utils.sleep(10);
collector.emit(new Values(rand.nextInt(1000), ip, port), msgId);
}
代码示例来源:origin: alibaba/mdrill
public void nextTuple() {
Utils.sleep(100);
final String[] words = new String[] {"nathan", "mike", "jackson", "golda", "bertels"};
final Random rand = new Random();
final String word = words[rand.nextInt(words.length)];
_collector.emit(new Values(word));
}
代码示例来源:origin: alibaba/mdrill
public void nextTuple() {
List<Object> tuple = (List<Object>) InprocMessaging.pollMessage(_id);
if(tuple!=null) {
_collector.emit(tuple, UUID.randomUUID().toString());
} else {
Utils.sleep(10);
}
}
代码示例来源:origin: alibaba/jstorm
long start = System.currentTimeMillis();
while (isAlive(process)){
Utils.sleep(100);
if (System.currentTimeMillis() - start > timeOut){
process.destroy();
Utils.sleep(10);
int ret = process.exitValue();
if (ret != 0) {
代码示例来源:origin: alibaba/jstorm
public void serializer(KryoTupleSerializer serializer) {
LOG.debug("start serializer of task: {}", taskId);
if (!AsyncLoopRunnable.getShutdown().get()) {
//note: sleep 1ms to reduce cpu usage when serializeQueue is empty
if (serializeQueue.population() == 0) {
Utils.sleep(1);
return;
}
try {
List<Object> objects = serializeQueue.retreiveAvailableBatch();
for (Object object : objects) {
if (object == null) {
continue;
}
serialize(serializer, object);
}
} catch (InterruptedException e) {
LOG.error("InterruptedException " + e.getCause());
} catch (TimeoutException ignored) {
} catch (AlertException e) {
LOG.error(e.getMessage(), e);
throw new RuntimeException(e);
}
}
}
代码示例来源:origin: alibaba/jstorm
@Override
public void nextTuple() {
if (shouldRecover()) {
handleRecovery();
startProgress();
} else if (shouldCheckpoint()) {
doCheckpoint();
startProgress();
} else {
Utils.sleep(sleepInterval);
}
}
代码示例来源:origin: alibaba/jstorm
Utils.sleep(1);
代码示例来源:origin: alibaba/mdrill
Utils.sleep(1);
代码示例来源:origin: alibaba/jstorm
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("wordCounter", conf, buildTopology(mapState, windowConfig));
Utils.sleep(60 * 1000);
cluster.shutdown();
代码示例来源:origin: openimaj/openimaj
@Override
public void nextTuple() {
getSomeMoreTuples();
if (this.tuples.size() == 0)
{
Utils.sleep(10);
return;
}
final EmitItem poll = this.tuples.poll();
collector.emit(poll.tuple, poll.sourceId);
// collector.emit(poll.tuple);
}
代码示例来源:origin: com.n3twork.storm/storm-core
public void nextTuple() {
Utils.sleep(100);
final String[] words = new String[] {"nathan", "mike", "jackson", "golda", "bertels"};
final Random rand = new Random();
final String word = words[rand.nextInt(words.length)];
_collector.emit(new Values(word));
}
内容来源于网络,如有侵权,请联系作者删除!