示例#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();
 }