From ee4d43e76fabe5e658a9b4d321578f57c48a7db5 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Tue, 15 Nov 2005 03:08:23 +0000 Subject: [PATCH] Here too, _nondb is unsafe. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3760 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/whirled/data/SceneUpdate.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/java/com/threerings/whirled/data/SceneUpdate.java b/src/java/com/threerings/whirled/data/SceneUpdate.java index 480025394..12db67d31 100644 --- a/src/java/com/threerings/whirled/data/SceneUpdate.java +++ b/src/java/com/threerings/whirled/data/SceneUpdate.java @@ -116,7 +116,7 @@ public class SceneUpdate public void writeObject (ObjectOutputStream out) throws IOException { - if (_nondb) { + if (null == _dbSer.get()) { out.writeInt(_targetId); out.writeInt(_targetVersion); } @@ -129,7 +129,7 @@ public class SceneUpdate public void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException { - if (_nondb) { + if (null == _dbSer.get()) { _targetId = in.readInt(); _targetVersion = in.readInt(); } @@ -145,11 +145,11 @@ public class SceneUpdate public void persistTo (ObjectOutputStream out) throws IOException { - _nondb = false; + _dbSer.set(Boolean.TRUE); try { out.writeBareObject(this); } finally { - _nondb = true; + _dbSer.set(null); } } @@ -160,11 +160,11 @@ public class SceneUpdate public void unpersistFrom (ObjectInputStream in) throws IOException, ClassNotFoundException { - _nondb = false; + _dbSer.set(Boolean.TRUE); try { in.readBareObject(this); } finally { - _nondb = true; + _dbSer.set(null); } } @@ -197,5 +197,5 @@ public class SceneUpdate protected transient int _targetVersion; /** Used when serializing this update for storage in the database. */ - protected transient boolean _nondb = true; + protected static ThreadLocal _dbSer = new ThreadLocal(); }