Changeset ceda855a in vaadin


Ignore:
Timestamp:
Mar 21, 2012 1:27:27 PM (2 years ago)
Author:
Artur Signell <artur@…>
Branches:
master, 7.0, 7.1, 729110dbdbccbce7bd1e68b6b383a04b4747883d, 3aca4c731040c45664d2d8086ccc614692097f98
Children:
36dca644
Parents:
242b09c8
git-author:
Artur Signell <artur@…> (03/16/12 15:42:06)
git-committer:
Artur Signell <artur@…> (03/21/12 13:27:27)
Message:

Cleaned up code related to storing which type mappings have already been
sent to the client

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java

    r242b09c8 rceda855a  
    132132    public static final char VAR_ESCAPE_CHARACTER = '\u001b'; 
    133133 
    134     private final HashMap<Integer, OpenWindowCache> currentlyOpenWindowsInClient = new HashMap<Integer, OpenWindowCache>(); 
     134    private final HashMap<Integer, ClientCache> rootToClientCache = new HashMap<Integer, ClientCache>(); 
    135135 
    136136    private static final int MAX_BUFFER_SIZE = 64 * 1024; 
     
    800800        JsonPaintTarget paintTarget = new JsonPaintTarget(this, outWriter, 
    801801                !repaintAll); 
    802         OpenWindowCache windowCache = currentlyOpenWindowsInClient.get(Integer 
    803                 .valueOf(root.getRootId())); 
    804         if (windowCache == null) { 
    805             windowCache = new OpenWindowCache(); 
    806             currentlyOpenWindowsInClient.put(Integer.valueOf(root.getRootId()), 
    807                     windowCache); 
    808         } 
     802        ClientCache clientCache = getClientCache(root); 
    809803 
    810804        // TODO These seem unnecessary and could be removed/replaced by looping 
     
    11311125        boolean typeMappingsOpen = false; 
    11321126        for (Class<? extends Paintable> class1 : usedPaintableTypes) { 
    1133             if (windowCache.cache(class1)) { 
     1127            if (clientCache.cache(class1)) { 
    11341128                // client does not know the mapping key for this type, send 
    11351129                // mapping to client 
     
    11571151            dragAndDropService.printJSONResponse(outWriter); 
    11581152        } 
     1153    } 
     1154 
     1155    private ClientCache getClientCache(Root root) { 
     1156        Integer rootId = Integer.valueOf(root.getRootId()); 
     1157        ClientCache cache = rootToClientCache.get(rootId); 
     1158        if (cache == null) { 
     1159            cache = new ClientCache(); 
     1160            rootToClientCache.put(rootId, cache); 
     1161        } 
     1162        return cache; 
    11591163    } 
    11601164 
     
    12701274        } 
    12711275        // clean WindowCache 
    1272         OpenWindowCache openWindowCache = currentlyOpenWindowsInClient 
    1273                 .get(Integer.valueOf(root.getRootId())); 
    1274         if (openWindowCache != null) { 
    1275             openWindowCache.clear(); 
    1276         } 
     1276        getClientCache(root).clear(); 
    12771277    } 
    12781278 
     
    21922192     * TODO make customlayout templates (from theme) to be cached here. 
    21932193     */ 
    2194     class OpenWindowCache implements Serializable { 
     2194    class ClientCache implements Serializable { 
    21952195 
    21962196        private final Set<Object> res = new HashSet<Object>(); 
Note: See TracChangeset for help on using the changeset viewer.