V
VisionSet
I have a bunch of model classes that I use on client and server. When a
model object gets serialized all the observers of that model that are my
clients view need to be removed. But I have internal model observers also -
not sure that was wise? Now at the present state of the design it is proper
to remove all observers whatever, but that may not end up being the case. I
know I can track the type of observer that is being added not a problem and
remove certain types when the time comes. My real question is where do I do
the removal? At present I do it like this:
private void writeObject(ObjectOutputStream s) throws IOException {
observers.clear();
s.defaultWriteObject();
}
Can anyone see a problem with that?
At the moment I could declare my observer collection transient, and lazily
reinstantiate, but like I said thats a bit presumptious.
Any other tips in this regard?
TIA
model object gets serialized all the observers of that model that are my
clients view need to be removed. But I have internal model observers also -
not sure that was wise? Now at the present state of the design it is proper
to remove all observers whatever, but that may not end up being the case. I
know I can track the type of observer that is being added not a problem and
remove certain types when the time comes. My real question is where do I do
the removal? At present I do it like this:
private void writeObject(ObjectOutputStream s) throws IOException {
observers.clear();
s.defaultWriteObject();
}
Can anyone see a problem with that?
At the moment I could declare my observer collection transient, and lazily
reinstantiate, but like I said thats a bit presumptious.
Any other tips in this regard?
TIA