scala class和object的區別
Scala中類物件中不可有靜態變數和靜態方法,但是提供了“伴侶物件”的功能:在和類的同一個檔案中定義同名的Object物件:(須在同一檔案中;main方法定義在Object物件中)
-
private[spark] class Client(
-
val args: ClientArguments,
-
val hadoopConf: Configuration,
-
val sparkConf: SparkConf)
-
extends Logging {...}
-
-
object Client extends Logging {
-
def main(argStrings: Array[String]) {
-
if (!sys.props.contains("SPARK_SUBMIT")) {
-
logWarning("WARNING: This client is deprecated and will be removed in a " +
-
"future version of Spark. Use ./bin/spark-submit with \"--master yarn\"")
-
}
-
-
// Set an env variable indicating we are running in YARN mode.
-
// Note that any env variable with the SPARK_ prefix gets propagated to all (remote) processes
-
System.setProperty("SPARK_YARN_MODE", "true")
-
val sparkConf = new SparkConf
-
-
val args = new ClientArguments(argStrings, sparkConf)
-
// to maintain backwards-compatibility
-
if (!Utils.isDynamicAllocationEnabled(sparkConf)) {
-
sparkConf.setIfMissing("spark.executor.instances", args.numExecutors.toString)
-
}
-
new Client(args, sparkConf).run()
-
}
-
......
- }
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29754888/viewspace-1815301/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Scala進階(1)—— 反射 object 和 class反射Object
- self::class和static::class的區別
- SCSS @mixin和class 區別CSS
- swift中Class和Struct的區別SwiftStruct
- JS中class和id的區別JS
- 【Scala】Scala之ObjectObject
- Object.create(null) 和 {} 的區別ObjectNull
- scala中:: , +:, :+, :::, +++的區別
- Java之.class和.getClass()的區別Java
- C++中 struct 和 class 的區別C++Struct
- C++中struct 和 class的區別C++Struct
- v$lockv和$locked_object的區別Object
- Oracle中object_id和data_object_id的區別OracleObject
- Flink - 安裝包scala 2.12和scala 2.11的區別
- C# 中 Struct 和 Class 的區別總結C#Struct
- C++基礎(八)struct和class的區別C++Struct
- 【JAVA】Class.forName用法以及和new的區別Java
- Object類和String類equals方法的區別Object
- object-c [self class] 和 [self _cmd]Object
- Class.forName和ClassLoader.loadClass的區別
- for in,Object.keys,for of 的區別Object
- object_id 與data_object_id 的區別Object
- Object.create(null) 和 {} 區別是什麼ObjectNull
- Object與Class的關係Object
- class與classloader的getResourceAsStream區別
- TypeScript中,type、interface、class的區別TypeScript
- Scala中None, Nil, Nothing的區別None
- OC 匯入類 #import和@class 區別複習Import
- Object.seal()與Object.freeze()區別Object
- 從 Java 到 Scala(二):objectJavaObject
- TypeScript 中令人迷惑的物件型別:Object、{} 和 objectTypeScript物件型別Object
- Object.keys() 與 for in 區別Object
- data_object_id 及 object_id 的聯絡與區別Object
- 【PB】PB中object,control,custom class,custom visual,custom external等概念的區別Object
- Class.isAssignableFrom與instanceof的區別
- CSS中的class與id區別及用法CSS
- 從 Java 到 Scala (三): object 的應用JavaObject
- object is not an instance of declaring classObject