Task not serializable: java.io.NotSerializableException when calling function outside closure only on classes not objects

后端 未结 9 1520
悲&欢浪女
悲&欢浪女 2020-11-22 05:29

Getting strange behavior when calling function outside of a closure:

  • when function is in a object everything is working
  • when function is in a class ge
9条回答
  •  孤独总比滥情好
    2020-11-22 06:01

    I'm not entirely certain that this applies to Scala but, in Java, I solved the NotSerializableException by refactoring my code so that the closure did not access a non-serializable final field.

提交回复
热议问题