Enhanced debuggery, reenabled new streaming bits because now they should really
really work. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4705 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -87,8 +87,7 @@ public class ObjectInputStream
|
|||||||
var cname :String = Translations.getFromServer(jname);
|
var cname :String = Translations.getFromServer(jname);
|
||||||
cmap = new ClassMapping(code, cname, streamer);
|
cmap = new ClassMapping(code, cname, streamer);
|
||||||
_classMap[code] = cmap;
|
_classMap[code] = cmap;
|
||||||
if (DEBUG) log.debug(DEBUG_ID +
|
if (DEBUG) log.debug(DEBUG_ID + "Created mapping: (" + code + "): " + cname);
|
||||||
"Created mapping: (" + code + "): " + cname);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
cmap = (_classMap[code] as ClassMapping);
|
cmap = (_classMap[code] as ClassMapping);
|
||||||
@@ -96,8 +95,9 @@ public class ObjectInputStream
|
|||||||
throw new IOError("Read object for which we have no " +
|
throw new IOError("Read object for which we have no " +
|
||||||
"registered class metadata [code=" + code + "].");
|
"registered class metadata [code=" + code + "].");
|
||||||
}
|
}
|
||||||
if (DEBUG) log.debug(DEBUG_ID + "Read known code: (" +
|
if (DEBUG) {
|
||||||
code + ": " + cmap.classname + ")");
|
log.debug(DEBUG_ID + "Read known code: (" + code + ": " + cmap.classname + ")");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// log.debug("Creating object sleeve...");
|
// log.debug("Creating object sleeve...");
|
||||||
|
|||||||
@@ -70,6 +70,10 @@ public class ObjectOutputStream
|
|||||||
throw new Error("Too many unique classes written to ObjectOutputStream");
|
throw new Error("Too many unique classes written to ObjectOutputStream");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ObjectInputStream.DEBUG) {
|
||||||
|
log.debug("Assigning class code [code=" + cmap.code + ", class=" + cname + "].");
|
||||||
|
}
|
||||||
|
|
||||||
writeShort(-cmap.code);
|
writeShort(-cmap.code);
|
||||||
writeUTF((streamer == null) ? Translations.getToServer(cname)
|
writeUTF((streamer == null) ? Translations.getToServer(cname)
|
||||||
: streamer.getJavaClassName());
|
: streamer.getJavaClassName());
|
||||||
|
|||||||
@@ -57,8 +57,6 @@ public abstract class FieldMarshaller
|
|||||||
createMarshallers();
|
createMarshallers();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false) { // TEMP DISABLE
|
|
||||||
|
|
||||||
// first look to see if this field has custom reader/writer methods
|
// first look to see if this field has custom reader/writer methods
|
||||||
Method reader = null, writer = null;
|
Method reader = null, writer = null;
|
||||||
try {
|
try {
|
||||||
@@ -78,8 +76,6 @@ public abstract class FieldMarshaller
|
|||||||
// fall through to using reflection on the fields...
|
// fall through to using reflection on the fields...
|
||||||
}
|
}
|
||||||
|
|
||||||
} // END TEMP DISABLE
|
|
||||||
|
|
||||||
Class ftype = field.getType();
|
Class ftype = field.getType();
|
||||||
if (ftype.isInterface()) {
|
if (ftype.isInterface()) {
|
||||||
// if the class is a pure interface, use Object.
|
// if the class is a pure interface, use Object.
|
||||||
@@ -151,6 +147,11 @@ public abstract class FieldMarshaller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString ()
|
||||||
|
{
|
||||||
|
return "StreamerMarshaller:" + _streamer.toString();
|
||||||
|
}
|
||||||
|
|
||||||
/** The streamer we use to read and write our field. */
|
/** The streamer we use to read and write our field. */
|
||||||
protected Streamer _streamer;
|
protected Streamer _streamer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ public class ObjectInputStream extends DataInputStream
|
|||||||
Class sclass = Class.forName(cname, true, _loader);
|
Class sclass = Class.forName(cname, true, _loader);
|
||||||
Streamer streamer = Streamer.getStreamer(sclass);
|
Streamer streamer = Streamer.getStreamer(sclass);
|
||||||
if (STREAM_DEBUG) {
|
if (STREAM_DEBUG) {
|
||||||
log.info(hashCode() + ": New class '" + cname + "'.");
|
log.info(hashCode() + ": New class '" + cname + "' [code=" + code + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
|
|||||||
@@ -26,29 +26,12 @@ import java.io.DataOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import static com.threerings.NaryaLog.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to write {@link Streamable} objects to an {@link OutputStream}. Other common object types
|
* Used to write {@link Streamable} objects to an {@link OutputStream}. Other common object types
|
||||||
* are supported as well:
|
* are supported as well: <code>Boolean, Byte, Character, Short, Integer, Long, Float, Double,
|
||||||
*
|
* boolean[], byte[], char[], short[], int[], long[], float[], double[], Object[]</code>.
|
||||||
* <pre>
|
|
||||||
* Boolean
|
|
||||||
* Byte
|
|
||||||
* Character
|
|
||||||
* Short
|
|
||||||
* Integer
|
|
||||||
* Long
|
|
||||||
* Float
|
|
||||||
* Double
|
|
||||||
* boolean[]
|
|
||||||
* byte[]
|
|
||||||
* char[]
|
|
||||||
* short[]
|
|
||||||
* int[]
|
|
||||||
* long[]
|
|
||||||
* float[]
|
|
||||||
* double[]
|
|
||||||
* Object[]
|
|
||||||
* </pre>
|
|
||||||
*
|
*
|
||||||
* @see Streamable
|
* @see Streamable
|
||||||
*/
|
*/
|
||||||
@@ -102,6 +85,10 @@ public class ObjectOutputStream extends DataOutputStream
|
|||||||
// we specifically do not inline the getStreamer() call into the ClassMapping
|
// we specifically do not inline the getStreamer() call into the ClassMapping
|
||||||
// constructor because we want to be sure not to call _nextCode++ if getStreamer()
|
// constructor because we want to be sure not to call _nextCode++ if getStreamer()
|
||||||
// throws an exception
|
// throws an exception
|
||||||
|
if (ObjectInputStream.STREAM_DEBUG) {
|
||||||
|
log.info(hashCode() + ": Creating class mapping [code=" + _nextCode +
|
||||||
|
", class=" + sclass.getName() + "].");
|
||||||
|
}
|
||||||
cmap = new ClassMapping(_nextCode++, sclass, streamer);
|
cmap = new ClassMapping(_nextCode++, sclass, streamer);
|
||||||
_classmap.put(sclass, cmap);
|
_classmap.put(sclass, cmap);
|
||||||
|
|
||||||
|
|||||||
@@ -372,7 +372,8 @@ public class Streamer
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (ObjectInputStream.STREAM_DEBUG) {
|
if (ObjectInputStream.STREAM_DEBUG) {
|
||||||
log.info(in.hashCode() + ": Reading field '" + field.getName() + "'.");
|
log.info(in.hashCode() + ": Reading field '" + field.getName() + "' " +
|
||||||
|
"with " + fm + ".");
|
||||||
}
|
}
|
||||||
// gracefully deal with objects that have had new fields added to their class
|
// gracefully deal with objects that have had new fields added to their class
|
||||||
// definition
|
// definition
|
||||||
|
|||||||
Reference in New Issue
Block a user