Java 类org.apache.commons.collections4.map.PassiveExpiringMap 实例源码

项目:SumZeroTrading    文件:InteractiveBrokersBroker.java   
public InteractiveBrokersBroker(IBSocket ibSocket) {
    this.ibSocket = ibSocket;

    try {
        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);
}
项目:vertx-mqtt-broker    文件:MQTTSession.java   
public MQTTSession(Vertx vertx, ConfigParser config) {
    this.vertx = vertx;
    this.decoder = new MQTTDecoder();
    this.encoder = new MQTTEncoder();
    this.securityEnabled = config.isSecurityEnabled();
    this.retainSupport = config.isRetainSupport();
    this.subscriptions = new LinkedHashMap<>();
    this.qosUtils = new QOSUtils();
    PassiveExpiringMap.ConstantTimeToLiveExpirationPolicy<String, List<Subscription>>
            expirePeriod = new PassiveExpiringMap.ConstantTimeToLiveExpirationPolicy<>(
            30, TimeUnit.MINUTES);
    this.matchingSubscriptionsCache = new PassiveExpiringMap<>( expirePeriod, new HashMap<>() );

    this.topicsManager = new MQTTTopicsManagerOptimized();
    this.storeManager = new StoreManager(this.vertx);
    this.authenticatorAddress = config.getAuthenticatorAddress();

    this.queue = new LinkedList<>();
}
项目:vertx-mqtt-broker    文件:StoreVerticle.java   
@Override
    public void start() throws Exception {
        PassiveExpiringMap.ConstantTimeToLiveExpirationPolicy<String, Map<String, byte[]>>
                expirePeriod = new PassiveExpiringMap.ConstantTimeToLiveExpirationPolicy<>(
                        1, TimeUnit.DAYS);
        this.db = new PassiveExpiringMap<>( expirePeriod, new LinkedHashMap<>() );
        this.topicsManager = new MQTTTopicsManagerOptimized();

        MessageConsumer<JsonObject> consumer = vertx.eventBus().consumer(ADDRESS);
        consumer.handler(message -> {
            JsonObject request = message.body();
            MultiMap headers = message.headers();
            if (headers == null || !headers.contains("command")) {
                message.reply(new JsonObject().put("error", "Invalid message: missing 'command' header"));
            }
            JsonObject response = new JsonObject();
            String command = headers.get("command");
            switch (command) {
                case "saveRetainMessage":
                    response = saveRetainMessage(request);
                    break;
                case "getRetainedMessagesByTopicFilter":
                    response = getRetainedMessagesByTopicFilter(request);
                    break;
                case "deleteRetainMessage":
                    response = deleteRetainMessage(request);
                    break;
                default:
                    response = doDefault(request);
                    break;
            }
//            System.out.println("instance => "+ this + "db.size => "+ db.size());
            message.reply(response);
        });

    }
项目:tapir    文件:PacketDefragmentator.java   
public PacketDefragmentator(int order, int total, int ttl) throws Exception {
    super(order, total);
    this.ttl = ttl;
    this.accumulator = new PassiveExpiringMap<>(ttl);
}
项目:keti    文件:InMemoryAttributeCache.java   
InMemoryAttributeCache(final long maxCachedIntervalMinutes, final String zoneName,
        final BiFunction<String, String, String> getKey) {
    this.zoneName = zoneName;
    this.getKey = getKey;
    this.attributeCache = new PassiveExpiringMap<>(maxCachedIntervalMinutes);
}
项目:ptmatchadapter    文件:ServerAuthorizationService.java   
public final void setSessionData(Map<String, Object> map) {
  if (map == null) {
    sessionData = new PassiveExpiringMap<String, Object>(ENTRY_EXPIRATION_TIME);
  } else {
    sessionData = new PassiveExpiringMap<String, Object>(ENTRY_EXPIRATION_TIME,
        map);
  }
}