Here too, _nondb is unsafe.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3760 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -116,7 +116,7 @@ public class SceneUpdate
|
|||||||
public void writeObject (ObjectOutputStream out)
|
public void writeObject (ObjectOutputStream out)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
if (_nondb) {
|
if (null == _dbSer.get()) {
|
||||||
out.writeInt(_targetId);
|
out.writeInt(_targetId);
|
||||||
out.writeInt(_targetVersion);
|
out.writeInt(_targetVersion);
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,7 @@ public class SceneUpdate
|
|||||||
public void readObject (ObjectInputStream in)
|
public void readObject (ObjectInputStream in)
|
||||||
throws IOException, ClassNotFoundException
|
throws IOException, ClassNotFoundException
|
||||||
{
|
{
|
||||||
if (_nondb) {
|
if (null == _dbSer.get()) {
|
||||||
_targetId = in.readInt();
|
_targetId = in.readInt();
|
||||||
_targetVersion = in.readInt();
|
_targetVersion = in.readInt();
|
||||||
}
|
}
|
||||||
@@ -145,11 +145,11 @@ public class SceneUpdate
|
|||||||
public void persistTo (ObjectOutputStream out)
|
public void persistTo (ObjectOutputStream out)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
_nondb = false;
|
_dbSer.set(Boolean.TRUE);
|
||||||
try {
|
try {
|
||||||
out.writeBareObject(this);
|
out.writeBareObject(this);
|
||||||
} finally {
|
} finally {
|
||||||
_nondb = true;
|
_dbSer.set(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,11 +160,11 @@ public class SceneUpdate
|
|||||||
public void unpersistFrom (ObjectInputStream in)
|
public void unpersistFrom (ObjectInputStream in)
|
||||||
throws IOException, ClassNotFoundException
|
throws IOException, ClassNotFoundException
|
||||||
{
|
{
|
||||||
_nondb = false;
|
_dbSer.set(Boolean.TRUE);
|
||||||
try {
|
try {
|
||||||
in.readBareObject(this);
|
in.readBareObject(this);
|
||||||
} finally {
|
} finally {
|
||||||
_nondb = true;
|
_dbSer.set(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,5 +197,5 @@ public class SceneUpdate
|
|||||||
protected transient int _targetVersion;
|
protected transient int _targetVersion;
|
||||||
|
|
||||||
/** Used when serializing this update for storage in the database. */
|
/** Used when serializing this update for storage in the database. */
|
||||||
protected transient boolean _nondb = true;
|
protected static ThreadLocal _dbSer = new ThreadLocal();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user