From 67ce73b61dbf68819119006a23765762e6dc8407 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 22 Jul 2008 13:39:42 +0000 Subject: [PATCH] More style cleanup. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5249 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/io/FieldMarshaller.java | 4 ++-- .../com/threerings/io/ObjectInputStream.java | 4 ++-- .../com/threerings/io/ObjectOutputStream.java | 8 +++---- src/java/com/threerings/io/Streamer.java | 4 ++-- .../presents/client/BlockingCommunicator.java | 10 +++++---- .../presents/client/ClientCommunicator.java | 4 ++-- .../presents/client/ClientDObjectMgr.java | 22 +++++++++---------- .../presents/client/InvocationService.java | 2 +- .../presents/client/TimeBaseService.java | 3 --- 9 files changed, 29 insertions(+), 32 deletions(-) diff --git a/src/java/com/threerings/io/FieldMarshaller.java b/src/java/com/threerings/io/FieldMarshaller.java index 92e2b4df2..2587ba879 100644 --- a/src/java/com/threerings/io/FieldMarshaller.java +++ b/src/java/com/threerings/io/FieldMarshaller.java @@ -212,7 +212,7 @@ public abstract class FieldMarshaller protected static void createMarshallers () { // create our table - _marshallers = new HashMap(); + _marshallers = new HashMap(); // create a generic marshaller for streamable instances 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. */ - protected static HashMap _marshallers; + protected static HashMap _marshallers; /** Defines the signature to a custom field reader method. */ protected static final Class[] READER_ARGS = { ObjectInputStream.class }; diff --git a/src/java/com/threerings/io/ObjectInputStream.java b/src/java/com/threerings/io/ObjectInputStream.java index bab3b9fd0..76f92ae3a 100644 --- a/src/java/com/threerings/io/ObjectInputStream.java +++ b/src/java/com/threerings/io/ObjectInputStream.java @@ -64,7 +64,7 @@ public class ObjectInputStream extends DataInputStream public void addTranslation (String oldname, String newname) { if (_translations == null) { - _translations = new HashMap(); + _translations = new HashMap(); } _translations.put(oldname, newname); } @@ -251,7 +251,7 @@ public class ObjectInputStream extends DataInputStream protected ClassLoader _loader = getClass().getClassLoader(); /** An optional set of class name translations to use when unserializing objects. */ - protected HashMap _translations; + protected HashMap _translations; /** Used to activate verbose debug logging. */ protected static final boolean STREAM_DEBUG = false; diff --git a/src/java/com/threerings/io/ObjectOutputStream.java b/src/java/com/threerings/io/ObjectOutputStream.java index 477278a63..0ea25f2ca 100644 --- a/src/java/com/threerings/io/ObjectOutputStream.java +++ b/src/java/com/threerings/io/ObjectOutputStream.java @@ -51,7 +51,7 @@ public class ObjectOutputStream extends DataOutputStream public void addTranslation (String className, String streamedName) { if (_translations == null) { - _translations = new HashMap(); + _translations = new HashMap(); } _translations.put(className, streamedName); } @@ -71,7 +71,7 @@ public class ObjectOutputStream extends DataOutputStream // create our classmap if necessary if (_classmap == null) { - _classmap = new HashMap(); + _classmap = new HashMap(); } // 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 * them. */ - protected HashMap _classmap; + protected HashMap _classmap; /** A counter used to assign codes to streamed classes. */ protected short _nextCode = 1; @@ -212,5 +212,5 @@ public class ObjectOutputStream extends DataOutputStream protected Streamer _streamer; /** An optional set of class name translations to use when serializing objects. */ - protected HashMap _translations; + protected HashMap _translations; } diff --git a/src/java/com/threerings/io/Streamer.java b/src/java/com/threerings/io/Streamer.java index a87997a58..072ed4397 100644 --- a/src/java/com/threerings/io/Streamer.java +++ b/src/java/com/threerings/io/Streamer.java @@ -475,7 +475,7 @@ public class Streamer */ protected static void createStreamers () { - _streamers = new HashMap(); + _streamers = new HashMap(); // register all of the basic streamers int bscount = BasicStreamers.BSTREAMER_TYPES.length; @@ -506,7 +506,7 @@ public class Streamer protected Method _writer; /** Contains the mapping from class names to configured streamer instances. */ - protected static HashMap _streamers; + protected static HashMap _streamers; /** The name of the custom reader method. */ protected static final String READER_METHOD_NAME = "readObject"; diff --git a/src/java/com/threerings/presents/client/BlockingCommunicator.java b/src/java/com/threerings/presents/client/BlockingCommunicator.java index 8699c0973..6a14d614b 100644 --- a/src/java/com/threerings/presents/client/BlockingCommunicator.java +++ b/src/java/com/threerings/presents/client/BlockingCommunicator.java @@ -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 // anything until it has a whole frame; it will throw an exception if it hits EOF or if // something goes awry) - while (!_fin.readFrame(_channel)); + while (!_fin.readFrame(_channel)) { + // noop! + } try { DownstreamMessage msg = (DownstreamMessage)_oin.readObject(); @@ -677,11 +679,11 @@ public class BlockingCommunicator extends Communicator */ protected class Writer extends LoopingThread { - public Writer() + public Writer () { super("BlockingCommunicator_Writer"); } - + @Override protected void iterate () { @@ -977,7 +979,7 @@ public class BlockingCommunicator extends Communicator protected ClientDObjectMgr _omgr; 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; /** The number of milliseconds to wait for a response datagram. */ diff --git a/src/java/com/threerings/presents/client/ClientCommunicator.java b/src/java/com/threerings/presents/client/ClientCommunicator.java index b5a161238..e17987aaf 100644 --- a/src/java/com/threerings/presents/client/ClientCommunicator.java +++ b/src/java/com/threerings/presents/client/ClientCommunicator.java @@ -56,14 +56,14 @@ public class ClientCommunicator extends BlockingCommunicator protected void setPrefPort (String key, int port) { PresentsPrefs.config.setValue(key, port); } - + /** * Gets our preferred connection port via our preferences mechanism. */ protected int getPrefPort (String key, int defaultPort) { return PresentsPrefs.config.getValue(key, defaultPort); } - + @Override // from BlockingCommunicator protected void openChannel (InetAddress host) throws IOException diff --git a/src/java/com/threerings/presents/client/ClientDObjectMgr.java b/src/java/com/threerings/presents/client/ClientDObjectMgr.java index 835ceac64..86fee9351 100644 --- a/src/java/com/threerings/presents/client/ClientDObjectMgr.java +++ b/src/java/com/threerings/presents/client/ClientDObjectMgr.java @@ -62,7 +62,14 @@ public class ClientDObjectMgr _client = client; // 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 new Interval(client.getRunQueue()) { @@ -448,6 +455,7 @@ public class ClientDObjectMgr } } + /** Represents a pending subscription request. */ protected static final class PendingRequest { public int oid; @@ -499,21 +507,11 @@ public class ClientDObjectMgr protected HashIntMap> _penders = new HashIntMap>(); /** A mapping from distributed object class to flush delay. */ - protected HashMap,Long> _delays = new HashMap,Long>(); + protected HashMap, Long> _delays = new HashMap, Long>(); /** A set of objects waiting to be flushed. */ protected HashIntMap _flushes = new HashIntMap(); - /** 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). */ protected static int DUMP_OTABLE_MODMASK = KeyEvent.ALT_DOWN_MASK|KeyEvent.SHIFT_DOWN_MASK; diff --git a/src/java/com/threerings/presents/client/InvocationService.java b/src/java/com/threerings/presents/client/InvocationService.java index cda1a49ab..f5a464317 100644 --- a/src/java/com/threerings/presents/client/InvocationService.java +++ b/src/java/com/threerings/presents/client/InvocationService.java @@ -29,7 +29,7 @@ package com.threerings.presents.client; *
  * public interface LocationService extends InvocationService
  * {
- *     
+ *
  *     // Used to communicate responses to moveTo() requests.
  *     public interface MoveListener extends InvocationListener
  *     {
diff --git a/src/java/com/threerings/presents/client/TimeBaseService.java b/src/java/com/threerings/presents/client/TimeBaseService.java
index b3d78be50..cebcde935 100644
--- a/src/java/com/threerings/presents/client/TimeBaseService.java
+++ b/src/java/com/threerings/presents/client/TimeBaseService.java
@@ -21,9 +21,6 @@
 
 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
  * delta times into absolute times.