List of usage examples for org.apache.commons.collections.map LRUMap putAll
public void putAll(Map map)
From source file:org.lockss.plugin.AuSearchSet.java
private void set404CacheSize(int newSize) { if (newSize < 0) { // shouldn't happen, but ignore rather than throw log.error("AuSearchSet size < 0"); }/* w w w .j av a 2 s . c om*/ LRUMap map = recent404s; if (map == null) { recent404Size = newSize; return; } synchronized (map) { if (newSize == 0) { if (log.isDebug2()) log.debug2("Removing 404 cache."); recent404s = null; } else if (map.maxSize() < newSize) { LRUMap newMap = new LRUMap(newSize); newMap.putAll(map); if (log.isDebug2()) log.debug2("Enlarging 404 cache."); recent404s = newMap; } recent404Size = newSize; } }
From source file:org.lockss.protocol.PartnerList.java
/** Configure the PartnerList */ public void setConfig(Configuration config, Configuration oldConfig, Configuration.Differences changedKeys) { maxPartners = config.getInt(PARAM_MAX_PARTNERS, DEFAULT_MAX_PARTNERS); minPartners = Math.min(maxPartners, config.getInt(PARAM_MIN_PARTNERS, DEFAULT_MIN_PARTNERS)); if (maxPartners != partners.maxSize()) { LRUMap newPartners = new PartnersLRUMap(maxPartners); newPartners.putAll(partners); partners = newPartners;//from w ww . j a va 2 s .co m } minPartnerRemoveInterval = config.getTimeInterval(PARAM_MIN_PARTNER_REMOVE_INTERVAL, DEFAULT_MIN_PARTNER_REMOVE_INTERVAL); recentMulticastInterval = config.getTimeInterval(PARAM_RECENT_MULTICAST_INTERVAL, DEFAULT_RECENT_MULTICAST_INTERVAL); if (changedKeys.contains(PARAM_DEFAULT_LIST)) { List stringList = config.getList(PARAM_DEFAULT_LIST); List newDefaultList = new ArrayList(); for (Iterator iter = stringList.iterator(); iter.hasNext();) try { PeerIdentity partner = idMgr.stringToPeerIdentity((String) iter.next()); newDefaultList.add(partner); } catch (IdentityManager.MalformedIdentityKeyException uhe) { log.error("default partner list throvi ws " + uhe); } if (newDefaultList.isEmpty()) { log.error("Default partner list is empty"); } defaultPartnerList = newDefaultList; if (partners.isEmpty()) { addDefaultPartners(); } } }
From source file:org.lockss.util.UniqueRefLruCache.java
/** * Sets the NodeState cache size./*w ww .j ava2 s. c om*/ * @param newSize the new size */ public synchronized void setMaxSize(int newSize) { if (newSize <= 0) { throw new IllegalArgumentException("Negative cache size"); } if (lruMap.maxSize() != newSize) { LRUMap newMap = new LRUMap(newSize); newMap.putAll(lruMap); lruMap = newMap; } }