Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
themeConfluence
titleAsyncDataStream.java
linenumberstrue
public class AsyncDataStream {
 /**
  * Add an AsyncWaitOperator. The order of output stream records may be reordered.
  *
  * @param in Input data stream
  * @param func AsyncFunction
  * @bufSize The max number of async i/o operation that can be triggered
  * @return A new DataStream.
  */
 public static DataStream<OUT> unorderedWait(DataStream<IN> in, AsyncFunction<IN, OUT> func, int bufSize);
 public static DataStream<OUT> unorderedWait(DataStream<IN> in, AsyncFunction<IN, OUT> func);
 
 /**
  * Add an AsyncWaitOperator with RichAsyncFunction.
  */
 public static DataStream<OUT> unorderedWait(DataStream<IN> in, RichAsyncFunction<IN, OUT> func, int bufSize);
 public static DataStream<OUT> unorderedWait(DataStream<IN> in, RichAsyncFunction<IN, OUT> func);
 
 /**
  * Add an AsyncWaitOperator. The order of output stream records is guaranteed to be the same as input ones.
  *
  * @param func AsyncWaitFunction
  * @param func AsyncFunction
  * @bufSize The max number of async i/o operation that can be triggered
  * @return A new DataStream.
  */
 public static DataStream<OUT> orderedWait(DataStream<IN> in, AsyncFunction<IN, OUT> func, int bufSize);
 public static DataStream<OUT> orderedWait(DataStream<IN> in, AsyncFunction<IN, OUT> func);
 
 /**
  * Add an AsyncWaitOperator with RichAsyncFunction.
  */
 public static DataStream<OUT> orderedWait(DataStream<IN> in, RichAsyncFunction<IN, OUT> func, int bufSize);
 public static DataStream<OUT> orderedWait(DataStream<IN> in, RichAsyncFunction<IN, OUT> func);
}

Proposed Changes

Overview

...

Code Block
languagejava
themeConfluence
titleAsyncFunction.java
linenumberstrue
public interface AsyncFunction<IN, OUT> extends Function, Serializable {
  /**
   * Trigger async operation for each stream input.
   * The AsyncCollector should be registered into async client.
   *
   * @param input Stream Input
   * @param collector AsyncCollector
   */
  void asyncInvoke(IN input, AsyncCollector<OUT> collector) throws Exception;
}
 
public abstract class RichAsyncFunction<IN, OUT> extends AbstractRichFunction
    implements AsyncFunction<IN, OUT> {
  @Override
  public abstract void asyncInvoke(IN input, AsyncCollector<OUT> collector) throws Exception;
}

...