views:

19

answers:

1

From what I understand, the object state is just stored (values for fields, etc.), however, the execution context is anyways going to be lost.

What's the point of this? What bad can happen if so?

Note* this was taken from Effective Java By Joshua Bloch

+1  A: 

The execution context of a Thread consists of

  • the Java stack,
  • the snapshot of the hardware registers taken when the thread is suspended, and
  • other state such as the thread's presence in scheduler queues, and so on.

Since none of this information can be saved by serialization, the serialized Thread is useless.

Stephen C