com.hazelcast.jet.impl.util.Util.uncheckRun()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(651)

本文整理了Java中com.hazelcast.jet.impl.util.Util.uncheckRun()方法的一些代码示例,展示了Util.uncheckRun()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.uncheckRun()方法的具体详情如下:
包路径:com.hazelcast.jet.impl.util.Util
类名称:Util
方法名:uncheckRun

Util.uncheckRun介绍

暂无

代码示例

代码示例来源:origin: hazelcast/hazelcast-jet-code-samples

  1. private static void waitForComplete(Job job) {
  2. while (job.getStatus() != JobStatus.COMPLETED) {
  3. uncheckRun(() -> SECONDS.sleep(1));
  4. }
  5. }
  6. }

代码示例来源:origin: hazelcast/hazelcast-jet-code-samples

  1. private static void waitForComplete(Job job) {
  2. while (job.getStatus() != JobStatus.COMPLETED) {
  3. uncheckRun(() -> SECONDS.sleep(1));
  4. }
  5. }
  6. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. private void submitBlockingTasklets(ExecutionTracker executionTracker, ClassLoader jobClassLoader,
  2. List<Tasklet> tasklets) {
  3. CountDownLatch startedLatch = new CountDownLatch(tasklets.size());
  4. executionTracker.blockingFutures = tasklets
  5. .stream()
  6. .map(t -> new BlockingWorker(new TaskletTracker(t, executionTracker, jobClassLoader), startedLatch))
  7. .map(blockingTaskletExecutor::submit)
  8. .collect(toList());
  9. // do not return from this method until all workers have started. Otherwise
  10. // on cancellation there is a race where the executor might not have started
  11. // the worker yet. This would results in taskletDone() never being called for
  12. // a worker.
  13. uncheckRun(startedLatch::await);
  14. }

代码示例来源:origin: hazelcast/hazelcast-jet-code-samples

  1. private void createAvroFile() throws IOException {
  2. Path inputPath = new Path(INPUT_PATH);
  3. FileSystem fs = FileSystem.get(new Configuration());
  4. fs.delete(inputPath, true);
  5. DataFileWriter<User> fileWriter = new DataFileWriter<>(new GenericDatumWriter<User>(User.SCHEMA));
  6. fileWriter.create(User.SCHEMA, fs.create(new Path(inputPath, "file.avro")));
  7. IntStream.range(0, 100)
  8. .mapToObj(i -> new User("name" + i, "pass" + i, i, i % 2 == 0))
  9. .forEach(user -> Util.uncheckRun(() -> fileWriter.append(user)));
  10. fileWriter.close();
  11. fs.close();
  12. }

代码示例来源:origin: hazelcast/hazelcast-jet-code-samples

  1. private static void cancel(Job job) {
  2. job.cancel();
  3. while (job.getStatus() != JobStatus.COMPLETED) {
  4. uncheckRun(() -> SECONDS.sleep(1));
  5. }
  6. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. /**
  2. * Returns a supplier of processors for {@link AvroSources#filesBuilder}.
  3. */
  4. @Nonnull
  5. public static <D, T> ProcessorMetaSupplier readFilesP(
  6. @Nonnull String directory,
  7. @Nonnull String glob,
  8. boolean sharedFileSystem,
  9. @Nonnull DistributedSupplier<? extends DatumReader<D>> datumReaderSupplier,
  10. @Nonnull DistributedBiFunction<String, ? super D, T> mapOutputFn
  11. ) {
  12. return ReadFilesP.metaSupplier(directory, glob, sharedFileSystem,
  13. path -> {
  14. DataFileReader<D> reader = new DataFileReader<>(path.toFile(), datumReaderSupplier.get());
  15. return StreamSupport.stream(reader.spliterator(), false)
  16. .onClose(() -> uncheckRun(reader::close));
  17. },
  18. mapOutputFn);
  19. }

代码示例来源:origin: hazelcast/hazelcast-jet-code-samples

  1. } finally {
  2. if (connection != null) {
  3. uncheckRun(connection::close);

代码示例来源:origin: hazelcast/hazelcast-jet

  1. private byte[] createFlowControlPacket(Address member) throws IOException {
  2. try (BufferObjectDataOutput out = createObjectDataOutput(nodeEngine)) {
  3. final boolean[] hasData = {false};
  4. Map<Long, ExecutionContext> executionContexts = jobExecutionService.getExecutionContextsFor(member);
  5. out.writeInt(executionContexts.size());
  6. executionContexts.forEach((execId, exeCtx) -> uncheckRun(() -> {
  7. out.writeLong(execId);
  8. out.writeInt(exeCtx.receiverMap().values().stream().mapToInt(Map::size).sum());
  9. exeCtx.receiverMap().forEach((vertexId, ordinalToSenderToTasklet) ->
  10. ordinalToSenderToTasklet.forEach((ordinal, senderToTasklet) -> uncheckRun(() -> {
  11. out.writeInt(vertexId);
  12. out.writeInt(ordinal);
  13. out.writeInt(senderToTasklet.get(member).updateAndGetSendSeqLimitCompressed());
  14. hasData[0] = true;
  15. })));
  16. }));
  17. return hasData[0] ? out.toByteArray() : EMPTY_BYTES;
  18. }
  19. }

代码示例来源:origin: com.hazelcast.jet/hazelcast-jet-hadoop

  1. @Override
  2. public void init(@Nonnull Context context) {
  3. outputCommitter = jobConf.getOutputCommitter();
  4. jobContext = new JobContextImpl(jobConf, new JobID());
  5. uncheckRun(() -> outputCommitter.setupJob(jobContext));
  6. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. public SenderTasklet(InboundEdgeStream inboundEdgeStream, NodeEngine nodeEngine, Address destinationAddress,
  2. long executionId, int destinationVertexId, int packetSizeLimit) {
  3. this.inboundEdgeStream = inboundEdgeStream;
  4. this.packetSizeLimit = packetSizeLimit;
  5. this.connection = getMemberConnection(nodeEngine, destinationAddress);
  6. this.outputBuffer = createObjectDataOutput(nodeEngine);
  7. uncheckRun(() -> outputBuffer.write(createStreamPacketHeader(
  8. nodeEngine, executionId, destinationVertexId, inboundEdgeStream.ordinal())));
  9. bufPosPastHeader = outputBuffer.position();
  10. }

代码示例来源:origin: hazelcast/hazelcast-jet

  1. private void broadcastFlowControlPacket() {
  2. try {
  3. getRemoteMembers(nodeEngine).forEach(member -> uncheckRun(() -> {
  4. final byte[] packetBuf = createFlowControlPacket(member);
  5. if (packetBuf.length == 0) {
  6. return;
  7. }
  8. Connection conn = getMemberConnection(nodeEngine, member);
  9. if (conn != null) {
  10. conn.write(new Packet(packetBuf)
  11. .setPacketType(Packet.Type.JET)
  12. .raiseFlags(FLAG_URGENT | FLAG_JET_FLOW_CONTROL));
  13. }
  14. }));
  15. } catch (Throwable t) {
  16. logger.severe("Flow-control packet broadcast failed", t);
  17. }
  18. }

相关文章