Package org.apache.commons.collections.map

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


      IOUtils.cleanup(LOG, localFS);
    }
    LOG.info("Using leveldb path " + dbPath);
    db = factory.open(new File(dbPath.toString()), options);
    startTimeWriteCache =
        Collections.synchronizedMap(new LRUMap(getStartTimeWriteCacheSize(
            conf)));
    startTimeReadCache =
        Collections.synchronizedMap(new LRUMap(getStartTimeReadCacheSize(
            conf)));

    if (conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_TTL_ENABLE, true)) {
      deletionThread = new EntityDeletionThread(conf);
      deletionThread.start();
View Full Code Here

      if (_log.isDebugEnabled()) {
        _log.debug("Can't restore view state : session expired");
      }
    } else {
      synchronized (session) {
        LRUMap viewStates = (LRUMap) externalContext.getSessionMap()
            .get(VIEW_STATES_MAP);
        if (null != viewStates) {
          LRUMap logicalStates = (LRUMap) viewStates.get(viewId);
          if (null != logicalStates) {
            if (null != id) {
              restoredState = (Object[]) logicalStates.get(id);
              externalContext.getRequestMap().put(VIEW_SEQUENCE,
                  id);
              if (null == restoredState) {
                if (_log.isDebugEnabled()) {
                  _log
                      .debug("No saved view state found for a Id "
                          + id
                          + ". Restore last saved state");
                }
                restoredState = (Object[]) logicalStates
                    .get(logicalStates.lastKey());
              }
            } else {
              if (_log.isDebugEnabled()) {
                _log
                    .debug("No version Id for a saved view state in request. Restore last saved state");
              }
              restoredState = (Object[]) logicalStates
                  .get(logicalStates.lastKey());
            }
          } else if (_log.isDebugEnabled()) {
            _log
                .debug("Can't restore view state : no saved states for a ViewId "
                    + viewId);
View Full Code Here

    SerializedView serializedView;
    UIViewRoot viewRoot = context.getViewRoot();
    ExternalContext externalContext = context.getExternalContext();
    Object session = externalContext.getSession(true);
    synchronized (session) {
      LRUMap viewStates = (LRUMap) externalContext.getSessionMap().get(
          VIEW_STATES_MAP);
      if (null == viewStates) {
        viewStates = new LRUMap(getNumberOfViews(externalContext));
        externalContext.getSessionMap()
            .put(VIEW_STATES_MAP, viewStates);
      }
      Object id = getNextViewId(context);
      LRUMap logicalViewsMap = (LRUMap) viewStates.get(viewRoot
          .getViewId());
      if (null == logicalViewsMap) {
        logicalViewsMap = new LRUMap(getNumberOfViews(externalContext));
      }
      // Renew last seen view.
      viewStates.put(viewRoot.getViewId(), logicalViewsMap);
      logicalViewsMap.put(id, new Object[] { treeStructure, state });
      serializedView = new SerializedView(id, null);
    }
    return serializedView;
  }
View Full Code Here

  public Client parse(String agentString) {
    if (agentString == null) {
      return null;
    }
    if (cacheClient == null) {
      cacheClient = new LRUMap(CACHE_SIZE);
    }
    Client client = cacheClient.get(agentString);
    if (client != null) {
      return client;
    }
View Full Code Here

  public UserAgent parseUserAgent(String agentString) {
    if (agentString == null) {
      return null;
    }
    if (cacheUserAgent == null) {
      cacheUserAgent = new LRUMap(CACHE_SIZE);
    }
    UserAgent userAgent = cacheUserAgent.get(agentString);
    if (userAgent != null) {
      return userAgent;
    }
View Full Code Here

  public Device parseDevice(String agentString) {
    if (agentString == null) {
      return null;
    }
    if (cacheDevice == null) {
      cacheDevice = new LRUMap(CACHE_SIZE);
    }
    Device device = cacheDevice.get(agentString);
    if (device != null) {
      return device;
    }
View Full Code Here

    if (agentString == null) {
      return null;
    }

    if (cacheOS == null) {
      cacheOS = new LRUMap(CACHE_SIZE);
    }
    OS os = cacheOS.get(agentString);
    if (os != null) {
      return os;
    }
View Full Code Here

    public MapQueryCache() {
        this(DEFAULT_CACHE_SIZE);
    }

    public MapQueryCache(int maxSize) {
        this.map = new LRUMap(maxSize);
    }
View Full Code Here

        threadCache = new InheritableThreadLocal<Map<String, CacheEntry>>(){
            @Override
            protected Map<String, CacheEntry> initialValue(){
                // Bug 51942 - this map may be used from multiple threads
                @SuppressWarnings("unchecked") // LRUMap is not generic currently
                Map<String, CacheEntry> map = new LRUMap(getMaxSize());
                return Collections.<String, CacheEntry>synchronizedMap(map);
            }
        };
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.map.LRUMap

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.