Skip to content

Instantly share code, notes, and snippets.

@ghostdogpr
Created March 1, 2025 05:29
Show Gist options
  • Save ghostdogpr/12623d0c711eb59adfda044d2c63f38f to your computer and use it in GitHub Desktop.
Save ghostdogpr/12623d0c711eb59adfda044d2c63f38f to your computer and use it in GitHub Desktop.
import com.esotericsoftware.kryo.io.{Input, Output}
import com.twitter.chill.{KSerializer, Kryo}
import scala.runtime.LazyVals
import scala.runtime.LazyVals.LazyValControlState
class LazyValControlStateSerializer extends KSerializer[LazyValControlState] {
override def read(kryo: Kryo, input: Input, cls: Class[LazyValControlState]): LazyValControlState = {
kryo.readClassAndObject(input).asInstanceOf[LazyValControlState]
}
override def write(kryo: Kryo, output: Output, obj: LazyValControlState): Unit =
kryo.writeClassAndObject(output, null)
}
val ser = new LazyValControlStateSerializer
// code omitted
k.register(classOf[LazyVals.Waiting], ser)
k.register(classOf[LazyVals.Evaluating.type], ser)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment