Principle diagram:
Master Class location: Master under the category of org.apache.spark.deploy.master spark-core_2.11-2.1.0.jar
// intercept part of the code // process the registration request Application Case RegisterApplication (Description, Driver) => // If the master state is standby, i.e. the current master, a STANDBY master, not the master Active // then the requesting Application Sign up, nothing will dry // TODO Prevent a REPEATED Registrations from some Driver IF (State == RecoveryState.STANDBY) { // the ignore, do not the send the Response } the else { logInfo ( " Registering App " + description.name) // with ApplicationDescription information, create ApplicationInfo Val App = createApplication (the Description, Driver) // Registration Application // will join ApplicationInfo cache, the Application --waitingApps join the queue waiting to be scheduled registerApplication (App) // details, see Code: Code. 1 the logInfo ( " Registered App " + description.name + " with ID " + app.id) // use persistent engine, the ApplicationInfo for persistence persistenceEngine.addApplication (App) / /Reverse to the ClientActor APPClient SparkDeploySchedulerBackend transmits a message, i.e. RegisteredApplication driver.send (RegisteredApplication (app.id, Self)) Schedule () // Schedule reschedule, - so far Application registration is completed } Code 1 private def registerApplication(app: ApplicationInfo): Unit = { val appAddress = app.driver.address if (addressToApp.contains(appAddress)) { logInfo("Attempted to re-register application at same address: " + appAddress) return } applicationMetricsSystem.registerSource(app.appSource) // In fact, here is the information of APP added memory cache Apps + = App idToApp(app.id) = app endpointToApp(app.driver) = app addressToApp(appAddress) = app // The APP added to the waiting queue scheduling is a waitingApps an ArrayBuffer waitingApps + = App IF (reverseProxy) { webUi.addProxyTargets(app.id, app.desc.appUiUrl) } }