public Range(T us, int bValue) { _bValue = bValue; _bigUs = new BigInteger(1, us.getData()); _distanceCache = new LHMCache<T, Integer>(256); }
@Override protected boolean removeEldestEntry(Map.Entry<K, V> eldest) { return size() > _max; } }
/** * @param rvClass the class that we are storing, i.e. an extension of SimpleDataStructure * @param len the length of the byte array in the SimpleDataStructure * @param max maximum size of the cache assuming 128MB of mem. * The actual max size will be scaled based on available memory. */ public SDSCache(Class<V> rvClass, int len, int max) { int size = (int) (max * FACTOR); _cache = new LHMCache<Integer, WeakReference<V>>(size); _datalen = len; try { _rvCon = rvClass.getConstructor(byte[].class); } catch (NoSuchMethodException e) { throw new RuntimeException("SDSCache init error", e); } _statName = "SDSCache." + rvClass.getSimpleName(); //if (_log.shouldLog(Log.DEBUG)) // _log.debug("New SDSCache for " + rvClass + " data size: " + len + // " max: " + size + " max mem: " + (len * size)); I2PAppContext.getGlobalContext().statManager().createRateStat(_statName, "Hit rate", "Router", new long[] { 10*60*1000 }); I2PAppContext.getGlobalContext().addShutdownTask(new Shutdown()); }
public NegativeLookupCache(RouterContext context) { this.counter = new ObjectCounter<Hash>(); this.badDests = new LHMCache<Hash, Destination>(MAX_BAD_DESTS); this._maxFails = context.getProperty("netdb.negativeCache.maxFails",MAX_FAILS); final long cleanTime = context.getProperty("netdb.negativeCache.cleanupInterval", CLEAN_TIME); SimpleTimer2.getInstance().addPeriodicEvent(new Cleaner(), cleanTime); }
_lists = new ArrayList<String>(); _invalid = new ArrayList<InvalidEntry>(); _negativeCache = new LHMCache<String, String>(NEGATIVE_CACHE_SIZE); BlockFile bf = null; RAIFile raf = null;
_testManager = testManager; _introManager = introManager; _failCache = new LHMCache<RemoteHostId, Object>(24);
_session.addMuxedSessionListener(_messageHandler, protocol, defaultOptions.getLocalPort()); _outboundQueue = new PacketQueue(_context, _timer); _recentlyClosed = new LHMCache<Long, Object>(64);
_session.addMuxedSessionListener(_messageHandler, protocol, defaultOptions.getLocalPort()); _outboundQueue = new PacketQueue(_context, _timer); _recentlyClosed = new LHMCache<Long, Object>(64);