Package org.apache.commons.collections

Examples of org.apache.commons.collections.ReferenceMap


    try
    {
      Object cacheKey = getGrammarPoolCacheKey();
     
      // we're using thread local caches to avoid thread safety problems
      ReferenceMap cacheMap = (ReferenceMap) GRAMMAR_POOL_CACHE.get();
      if (cacheMap == null)
      {
        cacheMap = new ReferenceMap(ReferenceMap.WEAK, ReferenceMap.SOFT);
        GRAMMAR_POOL_CACHE.set(cacheMap);
      }
     
      Object grammarPool = cacheMap.get(cacheKey);
      if (grammarPool == null)
      {
        if (log.isDebugEnabled())
        {
          log.debug("Instantiating grammar pool of type " + poolClassName
              + " for cache key " + cacheKey);
        }

        grammarPool = ClassUtils.instantiateClass(poolClassName, Object.class);
        cacheMap.put(cacheKey, grammarPool);
      }
     
      parser.setProperty(XERCES_PARSER_PROPERTY_GRAMMAR_POOL, grammarPool);
    }
    catch (Exception e)
View Full Code Here


  {
    Object key = classCacheKey();
    Map contextMap = (Map) classCache.get(key);
    if (contextMap == null)
    {
      contextMap = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT);
      classCache.put(key, contextMap);
    }
    contextMap.put(className, loadedClass);
  }
View Full Code Here

   *
   * @param itf a interface or class that should be implemented by all classes cached by this object
   */
  public JRSingletonCache(Class itf)
  {
    cache = new ReferenceMap(ReferenceMap.WEAK, ReferenceMap.SOFT);
    this.itf = itf;
  }
View Full Code Here

  {
    Object contextKey = getContextKey();
    Map contextCache = (Map) cache.get(contextKey);
    if (contextCache == null)
    {
      contextCache = new ReferenceMap();
      cache.put(contextKey, contextCache);
    }
    return contextCache;
  }
View Full Code Here

   *            cache.
   */
  protected JRAbstractLRUVirtualizer(int maxSize)
  {
    this.pagedIn = new Cache(maxSize);
    this.pagedOut = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.WEAK);
    this.lastObject = null;

    this.lastObjectMap = new ReferenceMap(ReferenceMap.WEAK, ReferenceMap.WEAK);
    this.lastObjectSet = new ReferenceMap(ReferenceMap.WEAK, ReferenceMap.HARD);
  }
View Full Code Here

    initTemplatesMap();
   
    this.originProvider = factory.getParentOriginProvider();
    setElementOriginProvider(this.originProvider);
   
    transformedContentsCache = new ReferenceMap();
    boxContentsCache = new HashMap();
    clonePool = new JRClonePool(this, true, true);
  }
View Full Code Here

   
    this.templateFrames = cellContents.templateFrames;
   
    this.originProvider = cellContents.originProvider;
   
    transformedContentsCache = new ReferenceMap();
    boxContentsCache = new HashMap();
    clonePool = new JRClonePool(this, true, true);
   
    verticalPositionType = cellContents.verticalPositionType;
  }
View Full Code Here

  public StatefulPersistenceContext(SessionImplementor session) {
    this.session = session;

    entitiesByKey = new HashMap( INIT_COLL_SIZE );
    entitiesByUniqueKey = new HashMap( INIT_COLL_SIZE );
    proxiesByKey = new ReferenceMap( ReferenceMap.HARD, ReferenceMap.WEAK );
    entitySnapshotsByKey = new HashMap( INIT_COLL_SIZE );

    entityEntries = IdentityMap.instantiateSequenced( INIT_COLL_SIZE );
    collectionEntries = IdentityMap.instantiateSequenced( INIT_COLL_SIZE );
    collectionsByKey = new HashMap( INIT_COLL_SIZE );
View Full Code Here

        rtn.entitiesByUniqueKey.put( EntityUniqueKey.deserialize( ois, session ), ois.readObject() );
      }

      count = ois.readInt();
      log.trace( "staring deserialization of [" + count + "] proxiesByKey entries" );
      rtn.proxiesByKey = new ReferenceMap( ReferenceMap.HARD, ReferenceMap.WEAK, count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count, .75f );
      for ( int i = 0; i < count; i++ ) {
        EntityKey ek = EntityKey.deserialize( ois, session );
        Object proxy = ois.readObject();
        if ( proxy instanceof HibernateProxy ) {
          ( ( HibernateProxy ) proxy ).getHibernateLazyInitializer().setSession( session );
View Full Code Here

    // Constructors
    //-------------------------------------------------------------------------

    public AutoCache(boolean monitorizeCaches) {
        // Use a synchronized map
        cache = Collections.synchronizedMap(new ReferenceMap());
        if (monitorizeCaches)
            this.cacheMonitor = new CacheMonitor(Long.MAX_VALUE);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.ReferenceMap

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.