public static synchronized boolean parseProfile(final RoutingContext rc) {
        final ContentStorage.FileInformation fi = ContentStorage.get().getFileInfo(PersistableFolder.ROUTING_BASE.getFolder(), rc.profileFilename);
        rc.profileTimestamp = fi.lastModified + rc.getKeyValueChecksum() << 24;

        // invalidate cache at lookup-table update
        final ContentStorage.FileInformation lookupFile = ContentStorage.get().getFileInfo(Folder.fromPersistableFolder(PersistableFolder.ROUTING_BASE, ""), BRouterConstants.BROUTER_LOOKUPS_FILENAME);
        if (lookupFile.lastModified != lastLookupTimestamp) {
            if (lastLookupTimestamp != 0) {
                System.out.println("******** invalidating profile-cache after lookup-file update ******** ");
            }
            apc = new ProfileCache[apc.length];
            lastLookupTimestamp = lookupFile.lastModified;
        }

        ProfileCache lru = null;
        int unusedSlot = -1;

        // check for re-use
        for (int i = 0; i < apc.length; i++) {
            final ProfileCache pc = apc[i];

            if (pc != null) {
                if ((!pc.profilesBusy) && fi.name.equals(pc.lastProfileFilename)) {
                    if (rc.profileTimestamp == pc.lastProfileTimestamp) {
                        rc.expctxWay = pc.expctxWay;
                        rc.expctxNode = pc.expctxNode;
                        rc.readGlobalConfig();
                        pc.profilesBusy = true;
                        return true;
                    }
                    lru = pc; // name-match but timestamp-mismatch -> we overide this one
                    unusedSlot = -1;
                    break;
                }
                if (lru == null || lru.lastUseTime > pc.lastUseTime) {
                    lru = pc;
                }
            } else if (unusedSlot < 0) {
                unusedSlot = i;
            }
        }

        final BExpressionMetaData meta = new BExpressionMetaData();

        rc.expctxWay = new BExpressionContextWay(rc.memoryclass * 512, meta);
        rc.expctxNode = new BExpressionContextNode(0, meta);
        rc.expctxNode.setForeignContext(rc.expctxWay);

        meta.readMetaData();

        rc.expctxWay.parseFile(fi.uri, "global", rc.keyValues);
        rc.expctxNode.parseFile(fi.uri, "global", rc.keyValues);

        rc.readGlobalConfig();

        if (rc.processUnusedTags) {
            rc.expctxWay.setAllTagsUsed();
        }

        if (lru == null || unusedSlot >= 0) {
            lru = new ProfileCache();
            if (unusedSlot >= 0) {
                apc[unusedSlot] = lru;
                if (debug) {
                    System.out.println("******* adding new profile at idx=" + unusedSlot + " for " + fi.name);
                }
            }
        }

        if (lru.lastProfileFilename != null && debug) {
            System.out.println("******* replacing profile of age " + ((System.currentTimeMillis() - lru.lastUseTime) / 1000L) + " sec " + lru.lastProfileFilename + "->" + fi.name);
        }

        lru.lastProfileTimestamp = rc.profileTimestamp;
        lru.lastProfileFilename = fi.name;
        lru.expctxWay = rc.expctxWay;
        lru.expctxNode = rc.expctxNode;
        lru.profilesBusy = true;
        lru.lastUseTime = System.currentTimeMillis();
        return false;
    }
Container for routig configs

@author ab
main/src/main/java/cgeo/geocaching/brouter/core/ProfileCache.java