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

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

本文整理了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

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

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

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

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

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

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

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

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

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

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

/**
 * Returns a supplier of processors for {@link AvroSources#filesBuilder}.
 */
@Nonnull
public static <D, T> ProcessorMetaSupplier readFilesP(
    @Nonnull String directory,
    @Nonnull String glob,
    boolean sharedFileSystem,
    @Nonnull DistributedSupplier<? extends DatumReader<D>> datumReaderSupplier,
    @Nonnull DistributedBiFunction<String, ? super D, T> mapOutputFn
) {
  return ReadFilesP.metaSupplier(directory, glob, sharedFileSystem,
      path -> {
        DataFileReader<D> reader = new DataFileReader<>(path.toFile(), datumReaderSupplier.get());
        return StreamSupport.stream(reader.spliterator(), false)
                  .onClose(() -> uncheckRun(reader::close));
      },
      mapOutputFn);
}

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

} finally {
  if (connection != null) {
    uncheckRun(connection::close);

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

private byte[] createFlowControlPacket(Address member) throws IOException {
  try (BufferObjectDataOutput out = createObjectDataOutput(nodeEngine)) {
    final boolean[] hasData = {false};
    Map<Long, ExecutionContext> executionContexts = jobExecutionService.getExecutionContextsFor(member);
    out.writeInt(executionContexts.size());
    executionContexts.forEach((execId, exeCtx) -> uncheckRun(() -> {
      out.writeLong(execId);
      out.writeInt(exeCtx.receiverMap().values().stream().mapToInt(Map::size).sum());
      exeCtx.receiverMap().forEach((vertexId, ordinalToSenderToTasklet) ->
          ordinalToSenderToTasklet.forEach((ordinal, senderToTasklet) -> uncheckRun(() -> {
            out.writeInt(vertexId);
            out.writeInt(ordinal);
            out.writeInt(senderToTasklet.get(member).updateAndGetSendSeqLimitCompressed());
            hasData[0] = true;
          })));
    }));
    return hasData[0] ? out.toByteArray() : EMPTY_BYTES;
  }
}

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

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

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

public SenderTasklet(InboundEdgeStream inboundEdgeStream, NodeEngine nodeEngine, Address destinationAddress,
           long executionId, int destinationVertexId, int packetSizeLimit) {
  this.inboundEdgeStream = inboundEdgeStream;
  this.packetSizeLimit = packetSizeLimit;
  this.connection = getMemberConnection(nodeEngine, destinationAddress);
  this.outputBuffer = createObjectDataOutput(nodeEngine);
  uncheckRun(() -> outputBuffer.write(createStreamPacketHeader(
      nodeEngine, executionId, destinationVertexId, inboundEdgeStream.ordinal())));
  bufPosPastHeader = outputBuffer.position();
}

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

private void broadcastFlowControlPacket() {
  try {
    getRemoteMembers(nodeEngine).forEach(member -> uncheckRun(() -> {
      final byte[] packetBuf = createFlowControlPacket(member);
      if (packetBuf.length == 0) {
        return;
      }
      Connection conn = getMemberConnection(nodeEngine, member);
      if (conn != null) {
        conn.write(new Packet(packetBuf)
            .setPacketType(Packet.Type.JET)
            .raiseFlags(FLAG_URGENT | FLAG_JET_FLOW_CONTROL));
      }
    }));
  } catch (Throwable t) {
    logger.severe("Flow-control packet broadcast failed", t);
  }
}

相关文章

微信公众号

最新文章

更多