A healthy dash of google-collections

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5798 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Dave Hoover
2009-05-23 01:04:08 +00:00
parent 1bdb2cae16
commit b222eed2fd
34 changed files with 152 additions and 91 deletions
@@ -23,6 +23,8 @@ package com.threerings.admin.client;
import java.util.HashMap;
import com.google.common.collect.Maps;
import com.threerings.presents.client.Client;
import com.threerings.presents.client.ClientAdapter;
import com.threerings.presents.dobj.DObjectManager;
@@ -41,7 +43,7 @@ public class ConfigObjectManager implements AdminService.ConfigInfoListener
{
public ConfigObjectManager (Client client)
{
_serverconfig = new HashMap<String, ConfigObject>();
_serverconfig = Maps.newHashMap();
_client = client;
_client.addClientObserver(new ClientAdapter() {
@Override
@@ -57,8 +59,8 @@ public class ConfigObjectManager implements AdminService.ConfigInfoListener
@Override
public void clientDidLogoff (Client client) {
// Clean up our subscription to the server's configuration
for (int ii = 0; ii < _csubscribers.length; ii++) {
_csubscribers[ii].cleanup();
for (ConfigObjectSubscriber _csubscriber : _csubscribers) {
_csubscriber.cleanup();
}
}
});
@@ -31,6 +31,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import com.google.common.collect.Maps;
import com.samskivert.io.ByteArrayOutInputStream;
import com.samskivert.util.StringUtil;
@@ -412,7 +414,7 @@ public abstract class ConfigRegistry
}
/** A mapping from identifying key to config object. */
protected HashMap<String, ObjectRecord> _configs = new HashMap<String, ObjectRecord>();
protected HashMap<String, ObjectRecord> _configs = Maps.newHashMap();
/** If we need to transition serialized Streamables to a new class format in init.. */
protected boolean _transitioning;
@@ -23,6 +23,7 @@ package com.threerings.admin.server;
import java.util.HashMap;
import com.google.common.collect.Maps;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -134,7 +135,7 @@ public class DatabaseConfigRegistry extends ConfigRegistry
_data = _repo.loadConfig(_node, _path);
} catch (DatabaseException pe) {
log.warning("Failed to load object configuration", "path", _path, pe);
_data = new HashMap<String, String>();
_data = Maps.newHashMap();
}
super.init();
@@ -23,6 +23,7 @@ package com.threerings.admin.server;
import java.util.ArrayList;
import com.google.common.collect.Lists;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -118,7 +119,7 @@ public class PeeredDatabaseConfigRegistry extends DatabaseConfigRegistry
PEER_CACHE_PREFIX + _path, new StreamableTuple<String, Object>(field, value));
}
protected ArrayList<String> _pendingSyncs = new ArrayList<String>();
protected ArrayList<String> _pendingSyncs = Lists.newArrayList();
}
protected PeerManager _peermgr;
@@ -24,6 +24,8 @@ package com.threerings.admin.server.persist;
import java.util.HashMap;
import java.util.Set;
import com.google.common.collect.Maps;
import com.samskivert.depot.DepotRepository;
import com.samskivert.depot.PersistenceContext;
import com.samskivert.depot.PersistentRecord;
@@ -49,7 +51,7 @@ public class ConfigRepository extends DepotRepository
*/
public HashMap<String, String> loadConfig (String node, String object)
{
HashMap<String, String> data = new HashMap<String, String>();
HashMap<String, String> data = Maps.newHashMap();
Where where = new Where(ConfigRecord.OBJECT, object, ConfigRecord.NODE, node);
for (ConfigRecord record : findAll(ConfigRecord.class, where)) {
data.put(record.field, record.value);