I have a class that implements Serializable
and I protect the invariant of this class via a lock object which is of type Object
. Is it okay to make it transient or can it have any unwanted side effects?
Code :
class MyClass implements Serializable{
private final transient lock = new Object();
....
}