From 2cb60864349eff99ee4d53f45ae532af81e37356 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Fri, 9 May 2008 21:46:43 +0000 Subject: [PATCH] Look ma, it's the last word in a small Ray-Charlie quibble. :) I just feel like: imagine if there were no Map.containsKey(). You would instead have to get() the value and see if it's not null. If you did that, you certainly wouldn't throw away the value if you were going to get it again right below, would you? So why would you do it simply because of the addition of a convenient method called containsKey()? git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5067 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/crowd/server/PlaceManager.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/java/com/threerings/crowd/server/PlaceManager.java b/src/java/com/threerings/crowd/server/PlaceManager.java index 2cc55c470..d1351e407 100644 --- a/src/java/com/threerings/crowd/server/PlaceManager.java +++ b/src/java/com/threerings/crowd/server/PlaceManager.java @@ -362,10 +362,13 @@ public class PlaceManager // Lazily create our dispatcher now that it's actually getting a message if (_dispatcher == null) { - if (!_dispatcherFinders.containsKey(getClass())) { - _dispatcherFinders.put(getClass(), new MethodFinder(getClass())); + Class clazz = getClass(); + MethodFinder finder = _dispatcherFinders.get(clazz); + if (finder == null) { + finder = new MethodFinder(clazz); + _dispatcherFinders.put(clazz, finder); } - _dispatcher = new DynamicListener(this, _dispatcherFinders.get(getClass())); + _dispatcher = new DynamicListener(this, finder); } _dispatcher.dispatchMethod(event.getName(), nargs); }