Package org.apache.commons.collections.map

Examples of org.apache.commons.collections.map.ReferenceMap$ValueIterator


         *
         * @param id node id
         * @return node or <code>null</code>
         */
        public AbstractNodeData retrieveFirst(NodeId id) {
            ReferenceMap map = (ReferenceMap) cache.get(id);
            if (map != null) {
                Iterator iter = map.values().iterator();
                try {
                    while (iter.hasNext()) {
                        AbstractNodeData data = (AbstractNodeData) iter.next();
                        if (data != null) {
                            return data;
View Full Code Here


         * @param id node id
         * @param parentId parent id
         * @return node or <code>null</code>
         */
        public AbstractNodeData retrieve(NodeId id, NodeId parentId) {
            ReferenceMap map = (ReferenceMap) cache.get(id);
            if (map != null) {
                return (AbstractNodeData) map.get(parentId);
            }
            return null;
        }
View Full Code Here

         *
         * @param data data to cache
         */
        public void cache(AbstractNodeData data) {
            NodeId id = data.getNodeState().getNodeId();
            ReferenceMap map = (ReferenceMap) cache.get(id);
            if (map == null) {
                map = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.WEAK);
                cache.put(id, map);
            }
            Object old = map.put(data.getPrimaryParentId(), data);
            if (old != null) {
                log.warn("overwriting cached item: " + old);
            }
        }
View Full Code Here

         * Evict some node from the cache.
         *
         * @param data data to evict
         */
        public void evict(AbstractNodeData data) {
            ReferenceMap map = (ReferenceMap) cache.get(data.getId());
            if (map != null) {
                map.remove(data.getPrimaryParentId());
            }
        }
View Full Code Here

        this.ntReg.addListener(this);
        this.store = store;

        // setup caches with soft references to node type
        // & item definition instances
        ntCache = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT);
        pdCache = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT);
        ndCache = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT);

        rootNodeDef =
            new NodeDefinitionImpl(ntReg.getRootNodeDef(), this, session);
        ndCache.put(rootNodeDef.unwrap().getId(), rootNodeDef);
    }
View Full Code Here

            session.setAttribute(LISTENER_REGISTERED, Boolean.TRUE);
        }
        Set listeners = (Set)session.getAttribute(LISTENER_REGISTRY);
        if (listeners == null) {
            listeners = MapBackedSet.decorate
                (new ReferenceMap (ReferenceMap.WEAK, ReferenceMap.HARD, true),
                 new Object());
            session.setAttribute(LISTENER_REGISTRY, listeners);
        }
        listeners.add (pl);
    }
View Full Code Here

     */
    // XXX is this thread safe?
    Map<String, ChannelCacheEntry> getChannelCache() {
        if (this.channelCache == null) {
            if ((this.channelCache = this.cacheTables.get(this.channel)) == null) {
                this.channelCache = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT, 2, .75f, true);
                this.cacheTables.put(this.channel, this.channelCache);
            }
        }
        return this.channelCache;
    }
View Full Code Here

    private IPersonAttributeDao pa;
    private Map<String, Map<String, List<Object>>> cache;

    public PersonDirPropertyFinder() {
        pa = PersonDirectory.getPersonAttributeDao();
        cache = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT, 120, .75f, true);
    }
View Full Code Here

     * Cache objects for each request
     */
    private final class MapCachingCacheLoader extends MapCachingDoubleCheckedCreator<String, Cache> {
        @SuppressWarnings("unchecked")
        private MapCachingCacheLoader() {
            super(new ReferenceMap(ReferenceMap.HARD, ReferenceMap.WEAK));
        }
View Full Code Here

        return (Map<K, V>) this.mapCacheCreator.get(cacheName);
    }

    private class MapCacheCreator extends MapCachingDoubleCheckedCreator<String, Map<?, ?>> {
        public MapCacheCreator() {
            super(new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT));
        }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.map.ReferenceMap$ValueIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.