Software Engineer.

Java: Serialization

Notes and FormatWhat: Convert an object into a stream of bytes by storing the state of the object.What gets stored in the byte stream:The member variables/fieldsfunction signature (but NOT the function's code) impacts the bytes created for the objectHow: "The default serialization mechanism for an object writes the class of the object, the class signature, and the values of all non-transient and non-static fields. References to other objects (except in transient or static fields) cause those...
Read post

Java: Volatile and Synchronized

Gist: a volatile variable isn't enough synchronization.In Java, a "volatile" field is often presented as a weaker form of synchronization: a field that's specifically indicated to the compiler and runtime as "not-to-be-reordered", which, consequently, doesn't get cached; it is guaranteed to return the most recent write on the field to any threads accessing that field.Because "most recent write" doesn't always imply "every write", using volatile as a form of synchronization could become problemat...
Read post