More style cleanup.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5249 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-07-22 13:39:42 +00:00
parent c743432676
commit 67ce73b61d
9 changed files with 29 additions and 32 deletions
@@ -212,7 +212,7 @@ public abstract class FieldMarshaller
protected static void createMarshallers () protected static void createMarshallers ()
{ {
// create our table // create our table
_marshallers = new HashMap<Class,FieldMarshaller>(); _marshallers = new HashMap<Class, FieldMarshaller>();
// create a generic marshaller for streamable instances // create a generic marshaller for streamable instances
FieldMarshaller gmarsh = new FieldMarshaller() { FieldMarshaller gmarsh = new FieldMarshaller() {
@@ -354,7 +354,7 @@ public abstract class FieldMarshaller
} }
/** Contains a mapping from field type to field marshaller instance for that type. */ /** Contains a mapping from field type to field marshaller instance for that type. */
protected static HashMap<Class,FieldMarshaller> _marshallers; protected static HashMap<Class, FieldMarshaller> _marshallers;
/** Defines the signature to a custom field reader method. */ /** Defines the signature to a custom field reader method. */
protected static final Class[] READER_ARGS = { ObjectInputStream.class }; protected static final Class[] READER_ARGS = { ObjectInputStream.class };
@@ -64,7 +64,7 @@ public class ObjectInputStream extends DataInputStream
public void addTranslation (String oldname, String newname) public void addTranslation (String oldname, String newname)
{ {
if (_translations == null) { if (_translations == null) {
_translations = new HashMap<String,String>(); _translations = new HashMap<String, String>();
} }
_translations.put(oldname, newname); _translations.put(oldname, newname);
} }
@@ -251,7 +251,7 @@ public class ObjectInputStream extends DataInputStream
protected ClassLoader _loader = getClass().getClassLoader(); protected ClassLoader _loader = getClass().getClassLoader();
/** An optional set of class name translations to use when unserializing objects. */ /** An optional set of class name translations to use when unserializing objects. */
protected HashMap<String,String> _translations; protected HashMap<String, String> _translations;
/** Used to activate verbose debug logging. */ /** Used to activate verbose debug logging. */
protected static final boolean STREAM_DEBUG = false; protected static final boolean STREAM_DEBUG = false;
@@ -51,7 +51,7 @@ public class ObjectOutputStream extends DataOutputStream
public void addTranslation (String className, String streamedName) public void addTranslation (String className, String streamedName)
{ {
if (_translations == null) { if (_translations == null) {
_translations = new HashMap<String,String>(); _translations = new HashMap<String, String>();
} }
_translations.put(className, streamedName); _translations.put(className, streamedName);
} }
@@ -71,7 +71,7 @@ public class ObjectOutputStream extends DataOutputStream
// create our classmap if necessary // create our classmap if necessary
if (_classmap == null) { if (_classmap == null) {
_classmap = new HashMap<Class,ClassMapping>(); _classmap = new HashMap<Class, ClassMapping>();
} }
// otherwise, look up the class mapping record // otherwise, look up the class mapping record
@@ -200,7 +200,7 @@ public class ObjectOutputStream extends DataOutputStream
/** Used to map classes to numeric codes and the {@link Streamer} instance used to write /** Used to map classes to numeric codes and the {@link Streamer} instance used to write
* them. */ * them. */
protected HashMap<Class,ClassMapping> _classmap; protected HashMap<Class, ClassMapping> _classmap;
/** A counter used to assign codes to streamed classes. */ /** A counter used to assign codes to streamed classes. */
protected short _nextCode = 1; protected short _nextCode = 1;
@@ -212,5 +212,5 @@ public class ObjectOutputStream extends DataOutputStream
protected Streamer _streamer; protected Streamer _streamer;
/** An optional set of class name translations to use when serializing objects. */ /** An optional set of class name translations to use when serializing objects. */
protected HashMap<String,String> _translations; protected HashMap<String, String> _translations;
} }
+2 -2
View File
@@ -475,7 +475,7 @@ public class Streamer
*/ */
protected static void createStreamers () protected static void createStreamers ()
{ {
_streamers = new HashMap<Class,Streamer>(); _streamers = new HashMap<Class, Streamer>();
// register all of the basic streamers // register all of the basic streamers
int bscount = BasicStreamers.BSTREAMER_TYPES.length; int bscount = BasicStreamers.BSTREAMER_TYPES.length;
@@ -506,7 +506,7 @@ public class Streamer
protected Method _writer; protected Method _writer;
/** Contains the mapping from class names to configured streamer instances. */ /** Contains the mapping from class names to configured streamer instances. */
protected static HashMap<Class,Streamer> _streamers; protected static HashMap<Class, Streamer> _streamers;
/** The name of the custom reader method. */ /** The name of the custom reader method. */
protected static final String READER_METHOD_NAME = "readObject"; protected static final String READER_METHOD_NAME = "readObject";
@@ -457,7 +457,9 @@ public class BlockingCommunicator extends Communicator
// of the frame from the network, in which case we simply call it again because we can't do // of the frame from the network, in which case we simply call it again because we can't do
// anything until it has a whole frame; it will throw an exception if it hits EOF or if // anything until it has a whole frame; it will throw an exception if it hits EOF or if
// something goes awry) // something goes awry)
while (!_fin.readFrame(_channel)); while (!_fin.readFrame(_channel)) {
// noop!
}
try { try {
DownstreamMessage msg = (DownstreamMessage)_oin.readObject(); DownstreamMessage msg = (DownstreamMessage)_oin.readObject();
@@ -677,11 +679,11 @@ public class BlockingCommunicator extends Communicator
*/ */
protected class Writer extends LoopingThread protected class Writer extends LoopingThread
{ {
public Writer() public Writer ()
{ {
super("BlockingCommunicator_Writer"); super("BlockingCommunicator_Writer");
} }
@Override @Override
protected void iterate () protected void iterate ()
{ {
@@ -977,7 +979,7 @@ public class BlockingCommunicator extends Communicator
protected ClientDObjectMgr _omgr; protected ClientDObjectMgr _omgr;
protected ClassLoader _loader; protected ClassLoader _loader;
/** The number of times per port to try to establish a datagram "connection." */ /** The number of times per port to try to establish a datagram "connection". */
protected static final int DATAGRAM_ATTEMPTS_PER_PORT = 10; protected static final int DATAGRAM_ATTEMPTS_PER_PORT = 10;
/** The number of milliseconds to wait for a response datagram. */ /** The number of milliseconds to wait for a response datagram. */
@@ -56,14 +56,14 @@ public class ClientCommunicator extends BlockingCommunicator
protected void setPrefPort (String key, int port) { protected void setPrefPort (String key, int port) {
PresentsPrefs.config.setValue(key, port); PresentsPrefs.config.setValue(key, port);
} }
/** /**
* Gets our preferred connection port via our preferences mechanism. * Gets our preferred connection port via our preferences mechanism.
*/ */
protected int getPrefPort (String key, int defaultPort) { protected int getPrefPort (String key, int defaultPort) {
return PresentsPrefs.config.getValue(key, defaultPort); return PresentsPrefs.config.getValue(key, defaultPort);
} }
@Override // from BlockingCommunicator @Override // from BlockingCommunicator
protected void openChannel (InetAddress host) protected void openChannel (InetAddress host)
throws IOException throws IOException
@@ -62,7 +62,14 @@ public class ClientDObjectMgr
_client = client; _client = client;
// register a debug hook for dumping all objects in the distributed object table // register a debug hook for dumping all objects in the distributed object table
DebugChords.registerHook(DUMP_OTABLE_MODMASK, DUMP_OTABLE_KEYCODE, DUMP_OTABLE_HOOK); DebugChords.registerHook(DUMP_OTABLE_MODMASK, DUMP_OTABLE_KEYCODE, new DebugChords.Hook() {
public void invoke () {
log.info("Dumping " + _ocache.size() + " objects:");
for (DObject obj : _ocache.values()) {
log.info(obj.getClass().getName() + " " + obj);
}
}
});
// register a flush interval // register a flush interval
new Interval(client.getRunQueue()) { new Interval(client.getRunQueue()) {
@@ -448,6 +455,7 @@ public class ClientDObjectMgr
} }
} }
/** Represents a pending subscription request. */
protected static final class PendingRequest<T extends DObject> protected static final class PendingRequest<T extends DObject>
{ {
public int oid; public int oid;
@@ -499,21 +507,11 @@ public class ClientDObjectMgr
protected HashIntMap<PendingRequest<?>> _penders = new HashIntMap<PendingRequest<?>>(); protected HashIntMap<PendingRequest<?>> _penders = new HashIntMap<PendingRequest<?>>();
/** A mapping from distributed object class to flush delay. */ /** A mapping from distributed object class to flush delay. */
protected HashMap<Class<?>,Long> _delays = new HashMap<Class<?>,Long>(); protected HashMap<Class<?>, Long> _delays = new HashMap<Class<?>, Long>();
/** A set of objects waiting to be flushed. */ /** A set of objects waiting to be flushed. */
protected HashIntMap<FlushRecord> _flushes = new HashIntMap<FlushRecord>(); protected HashIntMap<FlushRecord> _flushes = new HashIntMap<FlushRecord>();
/** A debug hook that allows the dumping of all objects in the object table out to the log. */
protected DebugChords.Hook DUMP_OTABLE_HOOK = new DebugChords.Hook() {
public void invoke () {
log.info("Dumping " + _ocache.size() + " objects:");
for (DObject obj : _ocache.values()) {
log.info(obj.getClass().getName() + " " + obj);
}
}
};
/** The modifiers for our dump table debug hook (Alt+Shift). */ /** The modifiers for our dump table debug hook (Alt+Shift). */
protected static int DUMP_OTABLE_MODMASK = KeyEvent.ALT_DOWN_MASK|KeyEvent.SHIFT_DOWN_MASK; protected static int DUMP_OTABLE_MODMASK = KeyEvent.ALT_DOWN_MASK|KeyEvent.SHIFT_DOWN_MASK;
@@ -29,7 +29,7 @@ package com.threerings.presents.client;
* <pre> * <pre>
* public interface LocationService extends InvocationService * public interface LocationService extends InvocationService
* { * {
* *
* // Used to communicate responses to moveTo() requests. * // Used to communicate responses to moveTo() requests.
* public interface MoveListener extends InvocationListener * public interface MoveListener extends InvocationListener
* { * {
@@ -21,9 +21,6 @@
package com.threerings.presents.client; package com.threerings.presents.client;
import com.threerings.presents.client.Client;
import com.threerings.presents.client.InvocationService;
/** /**
* Provides a means by which to obtain access to a time base object which can be used to convert * Provides a means by which to obtain access to a time base object which can be used to convert
* delta times into absolute times. * delta times into absolute times.