protected Map<Class<?>, Class<?>[]> buildPolymorphicEntityMap(Map<Class<?>, Class<?>[]> polymorphicEntityMap, Class<?> ceilingClass, Class<?>[] filteredEntities) { if (polymorphicEntityMap == null) { polymorphicEntityMap = new LRUMap<>(1000); } polymorphicEntityMap.put(ceilingClass, filteredEntities); return polymorphicEntityMap; }
protected synchronized boolean switchToLRUMap() { if (!usingLRUMap) { if (size() > maxEntries) { lruMap = Collections.synchronizedMap(new LRUMap<K, V>(maxEntries)); lruMap.putAll(concurrentMap); usingLRUMap = true; concurrentMap.clear(); } } return usingLRUMap; // this could be set by another thread }
protected static final Map<String,Map<String, FieldMetadata>> METADATA_CACHE = new LRUMap<>(1000);
private void initializeCache() { if (cacheSize >= 1) { parseCache = new LRUMap<>(cacheSize); } else { parseCache = null; } }
public TransactionalLRULookupIndex(CacheIF cache, int lrusize) { this.cache = cache; this.lru = Collections.synchronizedMap(new LRUMap(lrusize)); this.lrusize = lrusize; }
QueryCache(DetachedQueryIF query, CacheIF<K, E> cache, int lrusize, E nullObject) { this.query = query; this.cache = cache; this.lru = Collections.synchronizedMap(new LRUMap<K, E>(lrusize)); this.lrusize = lrusize; NULLOBJECT = nullObject; }
private static Map<NetworkSnapshot, SortedMap<String, BgpAdvertisementsByVrf>> buildEnvironmentBgpTablesCache() { return Collections.synchronizedMap(new LRUMap<>(MAX_CACHED_ENVIRONMENT_BGP_TABLES)); }
private static Map<NetworkSnapshot, SortedMap<String, RoutesByVrf>> buildEnvironmentRoutingTablesCache() { return Collections.synchronizedMap(new LRUMap<>(MAX_CACHED_ENVIRONMENT_ROUTING_TABLES)); }
public CacheUtil(int cacheSizeIn) { cacheSize = cacheSizeIn; cache = Collections.synchronizedMap(new LRUMap<String, Object>(cacheSize)); }
public AbstractCache(int size) { if(size == Integer.MAX_VALUE) { // Unlimited impl = Collections.synchronizedMap(new LinkedHashMap<T, AttributedList<T>>()); } else if(size == 0) { impl = Collections.emptyMap(); } else { // Will inflate to the given size impl = Collections.synchronizedMap(new LRUMap<T, AttributedList<T>>(size)); } }
/** * Increment the number of instances of SecuredItem. */ public static void incrementUse() { final Integer i = SecuredItemImpl.COUNT.get(); if (i == null) { SecuredItemImpl.CACHE.set(new LRUMap<CacheKey, Boolean>(Math.max( SecuredItemImpl.MAX_CACHE, 100))); SecuredItemImpl.COUNT.set(1); } else { SecuredItemImpl.COUNT.set(i + 1); } }
@Override public synchronized void addWorkingBundle(String bundle_id, Object object) { removeOldWorkingBundles(bundle_id); if (timeStamps == null) timeStamps = new LRUMap(max_bundles); timeStamps.put(object, new Date()); if (workingBundles == null) workingBundles = new LRUMap(max_bundles); workingBundles.put(bundle_id, object); }
@Override public synchronized Object getWorkingBundle(String bundle_id) { removeOldWorkingBundles(bundle_id); if (bundle_id == null) return null; if (workingBundles == null) workingBundles = new LRUMap(max_bundles); return workingBundles.get(bundle_id); }
@Override public synchronized void removeWorkingBundle(String bundle_id) { removeOldWorkingBundles(bundle_id); if (workingBundles == null) workingBundles = new LRUMap(max_bundles); workingBundles.remove(bundle_id); }
public QueryLookup(String qname, TransactionIF txn, int lrusize, V nullObject) { this.qname = qname; this.txn = txn; this.cache = new ReferenceMap(AbstractReferenceMap.ReferenceStrength.SOFT, AbstractReferenceMap.ReferenceStrength.HARD); this.lru = new LRUMap(lrusize); NULLOBJECT = nullObject; }
public LocatorLookup(String qname, TransactionIF txn, TopicMapIF tm, int lrusize, E nullObject) { this.qname = qname; this.txn = txn; this.tm = tm; this.lrusize = lrusize; this.cache = new ReferenceMap<LocatorIF, E>(AbstractReferenceMap.ReferenceStrength.SOFT, AbstractReferenceMap.ReferenceStrength.HARD); this.lru = new LRUMap<LocatorIF, E>(lrusize); NULLOBJECT = nullObject; }
@Override public void setFetchSize(int i) throws SQLException { fetchSize = i; LRUMap<Long, Object[]> lruMap = new LRUMap<>(fetchSize + 1); lruMap.putAll(cache); cache = lruMap; }
@Override public void setFetchSize(int i) throws SQLException { fetchSize = i; LRUMap<Long, Row> lruMap = new LRUMap<>(fetchSize + 1); lruMap.putAll(cache); cache = lruMap; rowFetchFirstPk = new ArrayList<>(Arrays.asList(new Long[]{null})); currentBatch.clear(); currentBatchId = -1; }
@SuppressWarnings("unchecked") public ParserContext() { objectBuilderPool = new ObjectPool<>(new RecordBuilderFactory()); arrayBuilderPool = new ObjectPool<>(new ListBuilderFactory(), ATypeTag.ARRAY); tempBufferPool = new ObjectPool<>(new AbvsBuilderFactory()); nullBitmapPool = new ObjectPool<>(); serializedFieldNames = new LRUMap<>(SERIALIZED_FIELDNAME_MAP_MAX_SIZE); stringSerDe = SerializerDeserializerProvider.INSTANCE.getAStringSerializerDeserializer(); aString = new AMutableString(""); }