Ifvwm
11/26/2020, 7:02 AMclass OnlyAudioRecorder public constructor(val hadoopAddr: String, val kafkaAddr: String ){
companion object{
val instance:OnlyAudioRecorder by lazy (mode = LazyThreadSafetyMode.SYNCHRONIZED){
OnlyAudioRecorder(hadoopAddr, kafkaAddr)
}
}
// why this hadoopAddr and kafkaAddr are not referenced?
andylamax
11/26/2020, 7:03 AMIfvwm
11/26/2020, 7:05 AMAgi Maulana
11/26/2020, 7:07 AMOnlyAudioRecorder
and companion object
actually these are different classesAgi Maulana
11/26/2020, 7:09 AMcompanion object
is not an inner class
of OnlyAudioRecorder
so the companion can not directly referencing any property in OnlyAudioRecorder
Ifvwm
11/26/2020, 7:16 AMAgi Maulana
11/26/2020, 10:35 AMhadoopAddr
and kafkaAddr
into companion object's property.Animesh Sahu
11/26/2020, 3:06 PMAnimesh Sahu
11/26/2020, 3:07 PMAnimesh Sahu
11/26/2020, 3:07 PMobject
instead of class with external setters to the field.Ifvwm
11/27/2020, 3:12 AM