Examples of CacheMap


Examples of com.sun.jmx.remote.opt.util.CacheMap

  delegatedContext(AccessControlContext authenticatedACC,
       Subject delegatedSubject)
      throws SecurityException {

  if (principalsCache == null || accCache == null) {
      principalsCache = new CacheMap(PRINCIPALS_CACHE_SIZE);
      accCache = new CacheMap(ACC_CACHE_SIZE);
  }

  // Retrieve the principals for the given
  // delegated subject from the cache
  //
View Full Code Here

Examples of com.sun.jmx.remote.util.CacheMap

       Subject delegatedSubject,
       boolean removeCallerContext)
      throws SecurityException {

  if (principalsCache == null || accCache == null) {
      principalsCache = new CacheMap(PRINCIPALS_CACHE_SIZE);
      accCache = new CacheMap(ACC_CACHE_SIZE);
  }

  // Retrieve the principals for the given
  // delegated subject from the cache
  //
View Full Code Here

Examples of com.sun.jmx.remote.util.CacheMap

        }
    }

    private static boolean test(int cacheSize) throws Exception {
        System.out.println("CacheMap test with cache size " + cacheSize);
        CacheMap map = new CacheMap(cacheSize);
        int size = 0;
        int maxIterations = cacheSize * 10;
        while (map.size() == size && size < maxIterations) {
            Integer key = new Integer(size);
            Object x = map.put(key, "x");
            if (x != null) {
                System.out.println("Map already had entry " + key + "!");
                return false;
            }
            x = map.get(key);
            if (!"x".equals(x)) {
                System.out.println("Got back surprising value: " + x);
                return false;
            }
            size++;
        }
        System.out.println("Map size is " + map.size() + " after inserting " +
                           size + " elements");
        do {
            System.gc();
            Thread.sleep(1);
            System.out.println("Map size is " + map.size() + " after GC");
        } while (map.size() > cacheSize);
        if (map.size() < cacheSize) {
            System.out.println("Map shrank to less than cache size: " +
                               map.size() + " (surprising but not wrong)");
        } else
            System.out.println("Map shrank to cache size as expected");
        int lowest = size - cacheSize;
        // lowest value that can still be in cache if LRU is respected
        for (Iterator it = map.entrySet().iterator(); it.hasNext(); ) {
            Map.Entry entry = (Map.Entry) it.next();
            Integer x = (Integer) entry.getKey();
            int xx = x.intValue();
            if (xx < lowest || xx >= size) {
                System.out.println("Old value remained (" + x + "), " +
                                   "expected none earlier than " + lowest);
                return false;
            }
            Object xxx = entry.getValue();
            if (!"x".equals(xxx)) {
                System.out.println("Got back surprising value: " + xxx);
                return false;
            }
        }
        if (map.size() > 0)
            System.out.println("Remaining elements are the most recent ones");
        System.out.println("Test passed");
        return true;
    }
View Full Code Here

Examples of org.apache.lenya.util.CacheMap

    /**
     * Ctor.
     */
    public SourceCacheImpl() {
        this.cache = new CacheMap(CAPACITY);
    }
View Full Code Here

Examples of org.apache.lenya.util.CacheMap

    protected static final int CAPACITY = 1000;
    private CacheMap cache;
   
    protected CacheMap getCache() {
        if (this.cache == null) {
            this.cache = new CacheMap(CAPACITY, getLogger());
        }
        return this.cache;
    }
View Full Code Here

Examples of org.apache.lenya.util.CacheMap

            if (resolver != null) {
                getManager().release(resolver);
            }
        }
       
        CacheMap cache = getCache();

        synchronized (cache) {
            controller = (AccessController) cache.get(key);
            if (controller == null) {
                getLogger().debug("No access controller in cache.");
                controller = doResolveAccessController(webappUrl);
                cache.put(key, controller);
            } else {
                getLogger().debug("Getting access controller from cache.");
            }
        }
View Full Code Here

Examples of org.apache.lenya.util.CacheMap

     * Returns the cache.
     * @return A cache object.
     */
    protected CacheMap getCache() {
        if (this.cache == null) {
            this.cache = new CacheMap(CAPACITY, getLogger());
        }
        return this.cache;
    }
View Full Code Here

Examples of org.apache.lenya.util.CacheMap

    /**
     * Ctor.
     */
    public SourceCacheImpl() {
        cache = new CacheMap(CAPACITY);
    }
View Full Code Here

Examples of org.apache.lenya.util.CacheMap

    /**
     * Ctor.
     */
    public SourceCacheImpl() {
        cache = new CacheMap(CAPACITY);
    }
View Full Code Here

Examples of org.apache.lenya.util.CacheMap

    /**
     * Ctor.
     */
    public SourceCacheImpl() {
        cache = new CacheMap(CAPACITY);
    }
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.