/** * Constructor copying elements from another map. * * <p>The maximum size is set from the map's size.</p> * * @param map the map to copy * @param scanUntilRemovable scan until a removeable entry is found, default false * @throws NullPointerException if the map is null * @throws IllegalArgumentException if the map is empty * @since 3.1 */ public LRUMap(final Map<? extends K, ? extends V> map, final boolean scanUntilRemovable) { this(map.size(), DEFAULT_LOAD_FACTOR, scanUntilRemovable); putAll(map); }
@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; }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public IValueConnector getModuleConnector(Module module) { if (module == null) { return null; } // we must rehash entries in case in case modules hashcode have changed and // still preserve LRU order. Map<Module, IValueConnector> buff = new LinkedHashMap<>(moduleConnectors); moduleConnectors.clear(); moduleConnectors.putAll(buff); IValueConnector moduleConnector = moduleConnectors.get(module); if (moduleConnector == null) { moduleConnector = createModelConnector(module.getName(), ModuleDescriptor.MODULE_DESCRIPTOR); moduleConnectors.put(module, moduleConnector); } moduleConnector.setConnectorValue(module); return moduleConnector; }