caosuwenwu closed pull request #7472: hh URL: https://github.com/apache/flink/pull/7472
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/README-code.md b/README-code.md new file mode 100644 index 00000000000..665b1313991 --- /dev/null +++ b/README-code.md @@ -0,0 +1 @@ +## 源码研读和注释分析 diff --git a/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java b/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java index c7c664d3f86..c6e6d9dd683 100644 --- a/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java +++ b/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java @@ -1102,16 +1102,21 @@ public int parseParameters(String[] args) { /** * Submits the job based on the arguments. */ + //todo client启动位置(通过bin/flink脚本可以获取此位置) public static void main(final String[] args) { + //todo 写入java环境有关参数配置和命令参数(run xxxxxxxxx)到日志里 ,日志文件log文件夹(flink-"user"-client-"ip".log) EnvironmentInformation.logEnvironmentInfo(LOG, "Command Line Client", args); // 1. find the configuration directory + //todo 获取bin/conf的路径 final String configurationDirectory = getConfigurationDirectoryFromEnv(); // 2. load the global configuration + //todo 获取flink-conf.yaml配置文件的参数,并且日志文件打印出来 final Configuration configuration = GlobalConfiguration.loadConfiguration(configurationDirectory); // 3. load the custom command lines + //todo 通过java反射出org.apache.flink.yarn.cli.FlinkYarnSessionCli类 final List<CustomCommandLine<?>> customCommandLines = loadCustomCommandLines( configuration, configurationDirectory); diff --git a/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java b/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java index d1695455130..aed0e25be0a 100644 --- a/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java +++ b/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java @@ -92,6 +92,10 @@ * actual implementation. This is easy for the JIT to recognize through class hierarchy analysis, * or by identifying that the invocations are monomorphic (all go to the same concrete * method implementation). Under these conditions, the JIT can perfectly inline methods. + * + * + *内存块源码地方,看import的类都是nio和io相关,其实就是二进制数据的输入输出,通过前面对象序列化 + *写到内存块中,不放在堆内存中,从而实现自己内存管理,内存这里flink序列化对与不同类型的提供不同序列化工具 */ @Internal public abstract class MemorySegment { diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/StandaloneSessionClusterEntrypoint.java b/flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/StandaloneSessionClusterEntrypoint.java index 127fc8b9831..e1676819002 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/StandaloneSessionClusterEntrypoint.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/StandaloneSessionClusterEntrypoint.java @@ -41,6 +41,7 @@ public StandaloneSessionClusterEntrypoint(Configuration configuration) { return new SessionDispatcherResourceManagerComponentFactory(StandaloneResourceManagerFactory.INSTANCE); } + //todo jobmanager启动位置 public static void main(String[] args) { // startup checks and logging EnvironmentInformation.logEnvironmentInfo(LOG, StandaloneSessionClusterEntrypoint.class.getSimpleName(), args); diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerRunner.java b/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerRunner.java index e06be5329cf..789d8f26e34 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerRunner.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerRunner.java @@ -268,7 +268,7 @@ protected void terminateJVM() { // -------------------------------------------------------------------------------------------- // Static entry point // -------------------------------------------------------------------------------------------- - + //todo taskmanager启动位置 public static void main(String[] args) throws Exception { // startup checks and logging EnvironmentInformation.logEnvironmentInfo(LOG, "TaskManager", args); ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services