There are zillions of invocation dispatchers registered with a multitude

of codes. Currently the unit dump that is done once every 15 minutes is
chock-full of one-off units. Let us report the short class name of
the dispatcher, rather than the code with which an instance is registered.

Also: Thou shalt always iterate over the entrySet of a Map if thou planneth
to utilize both the key and the value.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3694 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2005-09-05 05:38:58 +00:00
parent c3f418d1ac
commit 92e4e9cfaf
2 changed files with 27 additions and 9 deletions
@@ -25,6 +25,7 @@ import java.lang.reflect.*;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import sun.misc.Perf;
@@ -309,8 +310,11 @@ public class PresentsDObjectMgr
cname = StringUtil.shortClassName(cname);
} else if (unit instanceof InvocationRequestEvent) {
InvocationRequestEvent ire = (InvocationRequestEvent)unit;
cname = "dobj.InvocationRequestEvent:" +
ire.getInvCode() + ":" + ire.getMethodId();
Class c = PresentsServer.invmgr.getDispatcherClass(
ire.getInvCode());
cname = (c == null)
? "dobj.InvocationRequestEvent:(no longer registered)"
: StringUtil.shortClassName(c) + ":" + ire.getMethodId();
} else {
cname = StringUtil.shortClassName(unit);
}
@@ -467,10 +471,10 @@ public class PresentsDObjectMgr
*/
public void dumpUnitProfiles ()
{
Iterator iter = _profiles.keySet().iterator();
while (iter.hasNext()) {
String cname = (String)iter.next();
UnitProfile uprof = (UnitProfile)_profiles.get(cname);
for (Iterator itr = _profiles.entrySet().iterator(); itr.hasNext(); ) {
Map.Entry entry = (Map.Entry) itr.next();
String cname = (String) entry.getKey();
UnitProfile uprof = (UnitProfile) entry.getValue();
Log.info("P: " + cname + " => " + uprof);
}
}
@@ -732,9 +736,10 @@ public class PresentsDObjectMgr
report.append("- Unit profiles: ").append(_profiles.size());
report.append("\n");
for (Iterator iter = _profiles.keySet().iterator(); iter.hasNext(); ) {
String cname = (String)iter.next();
UnitProfile uprof = (UnitProfile)_profiles.get(cname);
for (Iterator itr = _profiles.entrySet().iterator(); itr.hasNext(); ) {
Map.Entry entry = (Map.Entry) itr.next();
String cname = (String) entry.getKey();
UnitProfile uprof = (UnitProfile) entry.getValue();
report.append(" ").append(cname).append(" ").append(uprof);
report.append("\n");
}