You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Andrea Esposito <an...@gmail.com> on 2014/07/02 14:59:11 UTC

Custom Serialization

Hi,
i have a non-serializable class and as workaround i'm trying to
re-instantiate it at each de-serialization. Thus, i created a wrapper class
and overridden the writeObject and readObject methods as follow:

> private def writeObject(oos: ObjectOutputStream) {
>     oos.defaultWriteObject()
>     oos.writeLong(nonSerializableVar.attr)
>   }
>
> private def readObject(in: ObjectInputStream) {
>   in.defaultReadObject()
>   nonSerializableVar = new NonSerializableVar()
>   nonSerializableVar.attr = in.readLong()
> }


However at runtime i receive: java.io.IOException:
com.ning.compress.lzf.LZFOutputStream already closed

Any hints?

There are other workarounds which could be performed?

Thanks in advance.

Best Regards,
EA