]> source.dussan.org Git - vaadin-framework.git/commitdiff
Use native collections in AbstractConnector
authorLeif Åstrand <leif@vaadin.com>
Tue, 5 Feb 2013 11:16:35 +0000 (13:16 +0200)
committerVaadin Code Review <review@vaadin.com>
Wed, 6 Feb 2013 14:30:15 +0000 (14:30 +0000)
Change-Id: I027cd296e5014d38e908915d537c58f87ebefc50

client/src/com/vaadin/client/ui/AbstractConnector.java

index 2791cfddd925d34396acc38226d55817692cecb1..f9c74cc5c9153776a61695ffe50a56b44b0cf601 100644 (file)
@@ -58,7 +58,7 @@ public abstract class AbstractConnector implements ServerConnector,
 
     private HandlerManager handlerManager;
     private FastStringMap<HandlerManager> statePropertyHandlerManagers;
-    private Map<String, Collection<ClientRpc>> rpcImplementations;
+    private FastStringMap<Collection<ClientRpc>> rpcImplementations;
     private final boolean debugLogging = false;
 
     private SharedState state;
@@ -68,7 +68,7 @@ public abstract class AbstractConnector implements ServerConnector,
      * A map from client-to-server RPC interface class to the RPC proxy that
      * sends outgoing RPC calls for that interface.
      */
-    private Map<Class<?>, ServerRpc> rpcProxyMap = new HashMap<Class<?>, ServerRpc>();
+    private FastStringMap<ServerRpc> rpcProxyMap = FastStringMap.create();
 
     /**
      * Temporary storage for last enabled state to be able to see if it has
@@ -145,7 +145,7 @@ public abstract class AbstractConnector implements ServerConnector,
             T implementation) {
         String rpcInterfaceId = rpcInterface.getName().replaceAll("\\$", ".");
         if (null == rpcImplementations) {
-            rpcImplementations = new HashMap<String, Collection<ClientRpc>>();
+            rpcImplementations = FastStringMap.create();
         }
         if (null == rpcImplementations.get(rpcInterfaceId)) {
             rpcImplementations.put(rpcInterfaceId, new ArrayList<ClientRpc>());
@@ -182,10 +182,11 @@ public abstract class AbstractConnector implements ServerConnector,
      *         server.
      */
     protected <T extends ServerRpc> T getRpcProxy(Class<T> rpcInterface) {
-        if (!rpcProxyMap.containsKey(rpcInterface)) {
-            rpcProxyMap.put(rpcInterface, RpcProxy.create(rpcInterface, this));
+        String name = rpcInterface.getName();
+        if (!rpcProxyMap.containsKey(name)) {
+            rpcProxyMap.put(name, RpcProxy.create(rpcInterface, this));
         }
-        return (T) rpcProxyMap.get(rpcInterface);
+        return (T) rpcProxyMap.get(name);
     }
 
     @Override