Tweaks to allow serializing config attributes other than DSets.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6304 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Andrzej Kapolka
2010-11-25 00:03:52 +00:00
parent 8e5865995c
commit 902a4027ea
2 changed files with 20 additions and 12 deletions
+14 -3
View File
@@ -60,6 +60,9 @@ public class Streamer
*/
public synchronized static boolean isStreamable (Class<?> target)
{
// if we have not yet initialized ourselves, do so now
maybeInit();
while (true) {
// if we've got a streamer for it, it's good
if (_streamers.containsKey(target)) {
@@ -108,9 +111,7 @@ public class Streamer
throws IOException
{
// if we have not yet initialized ourselves, do so now
if (_streamers == null) {
_streamers = Maps.newHashMap(BasicStreamers.BSTREAMERS);
}
maybeInit();
Streamer stream = _streamers.get(target);
if (stream == null) {
@@ -487,6 +488,16 @@ public class Streamer
}
}
/**
* Initializes static state if necessary.
*/
protected synchronized static void maybeInit ()
{
if (_streamers == null) {
_streamers = Maps.newHashMap(BasicStreamers.BSTREAMERS);
}
}
/** Used to coerce the type system into quietude when reading enums from the wire. */
protected static enum EnumReader implements ByteEnum {
NOT_USED;