List of usage examples for org.apache.commons.collections4.map PassiveExpiringMap PassiveExpiringMap
public PassiveExpiringMap(final long timeToLive, final TimeUnit timeUnit)
From source file:br.com.apartida.acesso.utils.CacheLocate.java
/** * * @param chave//from w w w.ja va 2s .com * @return */ public Object get(final String chave) { if (cache == null) { cache = new PassiveExpiringMap(TIMEOUT, new HashMap<String, Object>()); } final Object obj = cache.get(chave); return obj; }
From source file:br.com.apartida.acesso.utils.CacheLocate.java
/** * * @param chave//from ww w . j a v a 2s . com * @param valor */ public void put(final String chave, final Object valor) { if (cache == null) { cache = new PassiveExpiringMap(TIMEOUT, new HashMap<String, Object>()); } final Object obj = cache.get(chave); if (obj == null) { cache.put(chave, valor); } }
From source file:com.sumzerotrading.broker.ib.InteractiveBrokersBroker.java
public InteractiveBrokersBroker(IBSocket ibSocket) { this.ibSocket = ibSocket; try {/* w w w . j a v a 2 s. c o m*/ loadOrderMaps(); } catch (Exception ex) { throw new SumZeroException(ex); } orderEventMap = new PassiveExpiringMap<>(30, TimeUnit.SECONDS); callbackInterface = ibSocket.getConnection(); callbackInterface.addIbConnectionDelegate(this); ibConnection = ibSocket.getClientSocket(); orderProcessor = new IBOrderEventProcessor(orderEventQueue, this); currencyOrderTimer = new Timer(true); currencyOrderTimer.schedule(getCurrencyOrderMonitor(), 0, 1000 * 60); }