@@ -0,0 +1,2470 @@
+/**%0A *  Copyright 2011 Galiel 3.14 Ltd. All rights reserved.%0A *  Use is subject to license terms.%0A *%0A * Created on 12 April 2012%0A */%0Apackage com.htmlspeed.server;%0A%0Aimport java.util.HashMap;%0Aimport java.util.HashSet;%0A%0A/**%0A * CacheStructure%0A *%0A * Cache of resources loaded from content-server and from%0A * other websites into the memory of the html-speed server.%0A *%0A * @author  Eldad Zamler%0A * @version $Revision: 1.20 $$Date: 2013/08/21 12:59:12 $%0A */%0Apublic class CacheStructure%0A%7B%0A    /**%0A     * Used for synchronizing access to cache-structure.%0A     * rsrcs should only be accessed when globalLock is locked.%0A     */%0A    public final Object globalLock = new Object();%0A%0A    /**%0A     * A collection of all stateless (and half-state-full) resources that are currently%0A     * loaded into cache-structure. This collection is a hash map from url to rsrc.%0A     *%0A     * Important: rsrcs should only be accessed when globalLock is locked.%0A     */%0A    public HashMap%3CString, RsrcIfc%3E rsrcs = new HashMap%3CString,RsrcIfc%3E(8*1024);%0A%0A    /**%0A     * Urls of all previously loaded state-full resources.%0A     * Should only be accessed while globalLock is locked.%0A     */%0A    public HashSet%3CString%3E stateFullRsrcs = new HashSet%3CString%3E(8*1024);%0A%0A    /**%0A     * A doubly linked list of buffers containing original/optimized/gziped resources%0A     * ordered by load/usage time. Currently bufs is the only timed-buffers-list.%0A     */%0A    public RsrcsList rsrcsList;%0A%0A    /**%0A     * Private constructor of the single instance of CacheStructure%0A     */%0A    public CacheStructure(ConfigData configData)%0A    %7B%0A        rsrcsList = new RsrcsList(configData);%0A    %7D%0A%0A    /**%0A     * Note: should only be called when globalLock is locked.%0A     *%0A     * @param url full url of resource%0A     * @param configData used configuration%0A     * @return true when url is a previously loaded state-full rsrc or configured to be state-full%0A     */%0A    public boolean isStateFull(String url, ConfigData configData)%0A    %7B%0A        if (stateFullRsrcs.contains(url))%0A            return true;%0A        if (configData.isStateFull(url))%0A            return true;%0A        return false;%0A    %7D%0A%0A    /**%0A     * Adds full-url to list of previously-loaded (known) state-full resources.%0A     *%0A     * Note: should only be called when globalLock is locked.%0A     *%0A     * @param url full url of newly encountered state-full resource.%0A     */%0A    public void addStateFull(String url)%0A    %7B%0A        stateFullRsrcs.add(url);%0A    %7D%0A%0A%7D%0A

Create CacheStructure.java