Пример #1
0
    @Override
    public Integer call(JobContext jc) throws Exception {
      JavaRDD<Integer> rdd = jc.sc().parallelize(Arrays.asList(1, 2, 3, 4, 5));
      JavaFutureAction<?> future =
          jc.monitor(
              rdd.foreachAsync(
                  new VoidFunction<Integer>() {
                    @Override
                    public void call(Integer l) throws Exception {}
                  }));

      future.get(TIMEOUT, TimeUnit.SECONDS);

      return 1;
    }
Пример #2
0
 @Override
 public String call(JobContext jc) {
   return jc.sc().parallelize(Arrays.asList(1)).map(this).collect().get(0);
 }
Пример #3
0
 @Override
 public Long call(JobContext jc) {
   JavaRDD<Integer> rdd = jc.sc().parallelize(Arrays.asList(1, 2, 3, 4, 5));
   return rdd.count();
 }