flink-1.12.2源码阅读环境备忘

  1. flink-runtime包SPI机制配置
final ServiceLoader<PipelineExecutorFactory> loader = ServiceLoader.load(PipelineExecutorFactory.class);

  SPI机制通常会根据配置加载RemoteExecutorFactory和LocalExecutorFactory,services下的文件未配置时,会加载不到ExecutionFactory,抛出以下异常

1 Exception in thread "main" java.lang.IllegalStateException: No ExecutorFactory found to execute the application.
2     at org.apache.flink.core.execution.DefaultExecutorServiceLoader.getExecutorFactory(DefaultExecutorServiceLoader.java:88)
3     at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.executeAsync(StreamExecutionEnvironment.java:1895)
4     at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1796)
5     at org.apache.flink.streaming.api.environment.LocalStreamEnvironment.execute(LocalStreamEnvironment.java:69)
6     at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1782)
7     at com.example.Main.main(Main.java:25)

 

posted @ 2021-04-21 20:17  wangwei0721  阅读(143)  评论(0)    收藏  举报