From a7334345fd8981b568fd3cbb5aa232f604c53bda Mon Sep 17 00:00:00 2001 From: Mike Thomas Date: Tue, 26 Apr 2011 22:24:45 +0000 Subject: [PATCH] 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 --- src/main/java/com/threerings/io/Streamer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/threerings/io/Streamer.java b/src/main/java/com/threerings/io/Streamer.java index bd6740298..6afdfafb7 100644 --- a/src/main/java/com/threerings/io/Streamer.java +++ b/src/main/java/com/threerings/io/Streamer.java @@ -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); }