Package org.apache.commons.collections.map

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


 
  public VisibilityFilter(SortedKeyValueIterator<Key,Value> iterator, Authorizations authorizations, byte[] defaultVisibility) {
    setSource(iterator);
    this.ve = new VisibilityEvaluator(authorizations);
    this.defaultVisibility = new Text(defaultVisibility);
    this.cache = new LRUMap(1000);
    this.tmpVis = new Text();
  }
View Full Code Here


            rsvc.getInt(RuntimeConstants.RESOURCE_MANAGER_DEFAULTCACHE_SIZE, 89);
        if (maxSize > 0)
        {
            // Create a whole new Map here to avoid hanging on to a
            // handle to the unsynch'd LRUMap for our lifetime.
            Map lruCache = Collections.synchronizedMap(new LRUMap(maxSize));
            lruCache.putAll(cache);
            cache = lruCache;
        }
        rsvc.getLog().debug("ResourceCache: initialized ("+this.getClass()+')');
    }
View Full Code Here

    final AccumuloConfiguration acuConf = getAccumuloConfiguration(context);
   
    final String extension = acuConf.get(Property.TABLE_FILE_TYPE);
    final Path file = this.getDefaultWorkFile(context, "." + extension);
   
    final LRUMap validVisibilities = new LRUMap(1000);
   
    return new RecordWriter<Key,Value>() {
      FileSKVWriter out = null;
     
      @Override
      public void close(TaskAttemptContext context) throws IOException {
        if (out != null)
          out.close();
      }
     
      @Override
      public void write(Key key, Value value) throws IOException {
       
        Boolean wasChecked = (Boolean) validVisibilities.get(key.getColumnVisibilityData());
        if (wasChecked == null) {
          byte[] cv = key.getColumnVisibilityData().toArray();
          new ColumnVisibility(cv);
          validVisibilities.put(new ArrayByteSequence(Arrays.copyOf(cv, cv.length)), Boolean.TRUE);
        }
       
        if (out == null) {
          out = FileOperations.getInstance().openWriter(file.toString(), file.getFileSystem(conf), conf, acuConf);
          out.startDefaultLocalityGroup();
View Full Code Here

        {
            Integer i = getNumberOfSequentialViewsInSession(context);
            int j = getNumberOfViewsInSession(context);
            if (i != null && i.intValue() > 0)
            {
                _lastWindowKeys = new LRUMap((j / i.intValue()) + 1);
            }
            else
            {
                _lastWindowKeys = new LRUMap(j + 1);
            }
        }
        _lastWindowKeys.put(id, key);
    }
View Full Code Here

    private PreparedStatement getPreparedStatement(Connection conn, boolean callable) throws SQLException {
        Map<String, PreparedStatement> preparedStatementMap = perConnCache.get(conn);
        if (null == preparedStatementMap ) {
            @SuppressWarnings("unchecked") // LRUMap is not generic
            Map<String, PreparedStatement> lruMap = new LRUMap(MAX_OPEN_PREPARED_STATEMENTS) {
                private static final long serialVersionUID = 1L;
                @Override
                protected boolean removeLRU(LinkEntry entry) {
                    PreparedStatement preparedStatement = (PreparedStatement)entry.getValue();
                    close(preparedStatement);
View Full Code Here

    public MapQueryCache() {
        this(DEFAULT_CACHE_SIZE);
    }

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

        // init ivars from properties
        this.notifyingRemoteListeners = notifyRemote;

        // TODO: ENTRY EXPIRATION is not supported by commons LRU Map
        this.snapshots = new LRUMap(snapshotsCacheSize);

        // init event bridge only if we are notifying remote listeners
        if (notifyingRemoteListeners) {
            try {
                EventBridgeFactory factory = (EventBridgeFactory) Class.forName(
View Full Code Here

    scanning = IteratorScope.scan.equals(env.getIteratorScope());
    if (scanning) {
      String auths = options.get(AUTH_OPT);
      if (auths != null && !auths.isEmpty()) {
        ve = new VisibilityEvaluator(new Authorizations(auths.getBytes(Constants.UTF8)));
        visibleCache = new LRUMap(100);
      }
    }
   
    if (options.containsKey(MAX_BUFFER_SIZE_OPT)) {
      maxBufferSize = AccumuloConfiguration.getMemoryInBytes(options.get(MAX_BUFFER_SIZE_OPT));
    } else {
      maxBufferSize = DEFAULT_MAX_BUFFER_SIZE;
    }
   
    parsedVisibilitiesCache = new LRUMap(100);
  }
View Full Code Here

    copy.seekColumnFamilies = (seekColumnFamilies == null) ? null : new HashSet<ByteSequence>(seekColumnFamilies);
    copy.seekColumnFamiliesInclusive = seekColumnFamiliesInclusive;
   
    copy.ve = ve;
    if (visibleCache != null) {
      copy.visibleCache = new LRUMap(visibleCache.maxSize());
      copy.visibleCache.putAll(visibleCache);
    }
   
    if (parsedVisibilitiesCache != null) {
      copy.parsedVisibilitiesCache = new LRUMap(parsedVisibilitiesCache.maxSize());
      copy.parsedVisibilitiesCache.putAll(parsedVisibilitiesCache);
    }
   
    copy.maxBufferSize = maxBufferSize;
   
View Full Code Here

    protected Map<String, Template> templateCache;

    public void initialize(RuntimeServices rs) throws Exception {
        super.rsvc = rs;
        this.templateCache = new LRUMap(100);
    }
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.