Examples of LRUMap


Examples of org.apache.commons.collections.map.LRUMap

        if (initCache) {
            cacheInitializer.run();
        }
        // limit cache to 1% of maxDoc(), but at least 10.
        this.docNumber2id = Collections.synchronizedMap(
                new LRUMap(Math.max(10, delegatee.maxDoc() / 100)));
        this.termDocsCache = new TermDocsCache(delegatee, FieldNames.PROPERTIES);
    }
View Full Code Here

Examples of org.apache.commons.collections.map.LRUMap

    public LRUStringConverter() {
        this(1000);
    }

    public LRUStringConverter(int size) {
        cache = Collections.synchronizedMap(new LRUMap(size));
    }
View Full Code Here

Examples of org.apache.commons.collections.map.LRUMap

      return "MessageFormat: Could not translate message: '" + pattern + "' using arguments " + Arrays.asList(args); //$NON-NLS-1$ //$NON-NLS-2$
    }
  }

  protected Map initialValue() {
    return new LRUMap(512);
  }
View Full Code Here

Examples of org.apache.commons.collections.map.LRUMap

  public synchronized int size() {
    return cache.size();
  }

  private void init() {
    cache = new LRUMap( strongReferenceCount );
  }
View Full Code Here

Examples of org.apache.commons.collections.map.LRUMap

     *                  registration.
     * @param cacheSize number of mappings this resolver may cache.
     */
    public CachingNamespaceResolver(AbstractNamespaceResolver base, int cacheSize) {
        this.base = base;
        qnameToJCRName = new LRUMap(cacheSize);
        jcrNameToQName = new LRUMap(cacheSize);
        this.base.addListener(this);
    }
View Full Code Here

Examples of org.apache.commons.collections.map.LRUMap

      if (initCache)
      {
         cacheInitializer.run();
      }
      // limit cache to 1% of maxDoc(), but at least 10.
      this.docNumber2uuid = Collections.synchronizedMap(new LRUMap(Math.max(10, delegatee.maxDoc() / 100)));
      this.termDocsCache = new TermDocsCache(delegatee, FieldNames.PROPERTIES);
   }
View Full Code Here

Examples of org.apache.commons.collections.map.LRUMap

         // minimum size is 0x40 * 0x10 = 1024
         size = 0x40;
      }
      for (int i = 0; i < docNumbers.length; i++)
      {
         docNumbers[i] = new LRUMap(size);
      }
   }
View Full Code Here

Examples of org.apache.commons.collections.map.LRUMap

    * @param reader the index reader from where the document number was read.
    * @param n the document number.
    */
   void put(String uuid, CachingIndexReader reader, int n)
   {
      LRUMap cacheSegment = docNumbers[getSegmentIndex(uuid.charAt(0))];
      //UUID key = UUID.fromString(uuid);
      String key = uuid;
      synchronized (cacheSegment)
      {
         Entry e = (Entry)cacheSegment.get(key);
         if (e != null)
         {
            // existing entry
            // ignore if reader is older than the one in entry
            if (reader.getCreationTick() <= e.creationTick)
            {
               if (log.isDebugEnabled())
               {
                  log.debug("Ignoring put(). New entry is not from a newer reader. " + "existing: " + e.creationTick
                     + ", new: " + reader.getCreationTick());
               }
               e = null;
            }
         }
         else
         {
            // entry did not exist
            e = new Entry(reader.getCreationTick(), n);
         }

         if (e != null)
         {
            cacheSegment.put(key, e);
         }
      }
   }
View Full Code Here

Examples of org.apache.commons.collections.map.LRUMap

    * @param uuid the key.
    * @return cache entry or <code>null</code>.
    */
   Entry get(String uuid)
   {
      LRUMap cacheSegment = docNumbers[getSegmentIndex(uuid.charAt(0))];
      // uuid may be invalid
      //        if (uuid.length() != UUID.UUID_FORMATTED_LENGTH) {
      //            return null;
      //        }
      String key = uuid;
      Entry entry;
      synchronized (cacheSegment)
      {
         entry = (Entry)cacheSegment.get(key);
      }
      if (log.isDebugEnabled())
      {
         accesses++;
         if (entry == null)
View Full Code Here

Examples of org.apache.commons.collections.map.LRUMap

  private static final Logger log = Logger.getLogger(VisibilityFilter.class);
 
  public VisibilityFilter(Authorizations authorizations, byte[] defaultVisibility) {
    this.ve = new VisibilityEvaluator(authorizations);
    this.defaultVisibility = new Text(defaultVisibility);
    this.cache = new LRUMap(1000);
    this.tmpVis = new Text();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.