Functions Have State careful what you capture
Global State some special rules
val mainOnly = SomeData("a", 1)
val mainOnly = SomeData("a", 1) object GlobalObject { val data = SomeData("b", 2) }
@ThreadLocal val mainOnly = SomeData("a", 1) @ThreadLocal object GlobalObject { val data = SomeData("b", 2) }
@SharedImmutable val mainOnly = SomeData("a", 1) @ThreadLocal object GlobalObject { val data = SomeData("b", 2) }
Recommend
More recommend