We need to synchronize here. Otherwise, when we could be in the middle of initializing our marshallers, perhaps for another client on the same JVM, and continue on with our streaming thinking our marshallers are ready to go, only to find that they are, in fact, not yet ready to go.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6631 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Mike Thomas
2011-04-26 22:24:45 +00:00
parent 7faeb29c4f
commit a7334345fd
@@ -549,8 +549,10 @@ public abstract class Streamer
}
// otherwise, ensure the marshallers are initialized and call super
if (_marshallers == null) {
super.initMarshallers();
synchronized (this) {
if (_marshallers == null) {
super.initMarshallers();
}
}
super.writeObject(object, out, useWriter);
}