List of usage examples for org.apache.commons.collections.map LRUMap put
public Object put(Object key, Object value)
From source file:org.LexGrid.util.sql.lgTables.SQLTableUtilities.java
private boolean insertIntoTransitiveClosure(String codingScheme, PreparedStatement insertTransitiveStmt, StringTriple association, StringTriple sourceCode, StringTriple targetCode, LRUMap insertedCache) { String key = sourceCode.a + ":" + sourceCode.c + ":" + targetCode.a + ":" + targetCode.c; boolean iInserted = false; if (!insertedCache.containsKey(key)) { // if it is not loaded in the main table, or already loaded // in the transitive table try {/* w ww .j a va 2 s . co m*/ int k = 1; insertTransitiveStmt.setString(k++, codingScheme); insertTransitiveStmt.setString(k++, association.a); insertTransitiveStmt.setString(k++, association.c); insertTransitiveStmt.setString(k++, association.b); insertTransitiveStmt.setString(k++, sourceCode.a); insertTransitiveStmt.setString(k++, sourceCode.c); insertTransitiveStmt.setString(k++, targetCode.a); insertTransitiveStmt.setString(k++, targetCode.c); insertTransitiveStmt.execute(); insertedCache.put(key, null); iInserted = true; } catch (SQLException e) { log.debug(e); // assume an exception means that it is a duplicate // error. ignore. // cheaper to do this (in theory) than check ahead of // time - duplicates should // be abnormal, not the rule. And we have a cache now. } } return iInserted; }
From source file:org.lockss.crawler.CrawlManagerStatus.java
public synchronized void setHistSize(int histMax) { LRUMap newmap = makeLRUMap(histMax); for (OrderedMapIterator iter = statusMap.orderedMapIterator(); iter.hasNext();) { newmap.put(iter.next(), iter.getValue()); }//from ww w. j av a 2 s .c om statusMap = newmap; }
From source file:org.lockss.plugin.AuSearchSet.java
public void addRecent404(String url) { if (isEmpty()) { return;// w w w . ja va2s. c o m } LRUMap map = recent404s; if (map == null) { if (recent404Size <= 0) { return; } map = new LRUMap(recent404Size); recent404s = map; } synchronized (map) { map.put(url, ""); } }
From source file:org.xenei.jena.security.SecuredItemImpl.java
void cachePut(final CacheKey key, final boolean value) { final LRUMap cache = SecuredItemImpl.CACHE.get(); if (cache != null) { cache.put(key, value); SecuredItemImpl.CACHE.set(cache); }//from ww w. j a v a 2 s . c o m }