當前位置: 首頁>>代碼示例>>Java>>正文


Java MapConfig.getTimeToLiveSeconds方法代碼示例

本文整理匯總了Java中com.hazelcast.config.MapConfig.getTimeToLiveSeconds方法的典型用法代碼示例。如果您正苦於以下問題:Java MapConfig.getTimeToLiveSeconds方法的具體用法?Java MapConfig.getTimeToLiveSeconds怎麽用?Java MapConfig.getTimeToLiveSeconds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.hazelcast.config.MapConfig的用法示例。


在下文中一共展示了MapConfig.getTimeToLiveSeconds方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: verify

import com.hazelcast.config.MapConfig; //導入方法依賴的package包/類
@Verify(global = false)
public void verify() {
    if (isClient(targetInstance)) {
        return;
    }

    MapConfig mapConfig = targetInstance.getConfig().getMapConfig(name);
    logger.info(name + ": MapConfig: " + mapConfig);

    MapStoreConfig mapStoreConfig = mapConfig.getMapStoreConfig();
    logger.info(name + ": MapStoreConfig: " + mapStoreConfig);

    int sleepSeconds = mapConfig.getTimeToLiveSeconds() * 2 + mapStoreConfig.getWriteDelaySeconds() * 2;
    logger.info("Sleeping for " + sleepSeconds + " seconds to wait for delay and TTL values.");
    sleepSeconds(sleepSeconds);

    MapStoreWithCounterPerKey mapStore = (MapStoreWithCounterPerKey) mapStoreConfig.getImplementation();
    logger.info(name + ": map size = " + map.size());
    logger.info(name + ": map store = " + mapStore);

    logger.info(name + ": Checking if some keys where stored more than once");
    for (Object key : mapStore.keySet()) {
        assertEquals("There were multiple calls to MapStore.store", 1, mapStore.valueOf(key));
    }
}
 
開發者ID:hazelcast,項目名稱:hazelcast-simulator,代碼行數:26,代碼來源:MapEvictAndStoreTest.java

示例2: getTimeout

import com.hazelcast.config.MapConfig; //導入方法依賴的package包/類
public static int getTimeout(final HazelcastInstance instance, final String regionName) {
    try {
        final MapConfig cfg = instance.getConfig().findMapConfig(regionName);
        if (cfg.getTimeToLiveSeconds() > 0) {
            // TTL in ms
            return cfg.getTimeToLiveSeconds() * SEC_TO_MS;
        }
    } catch (UnsupportedOperationException e) {
        // HazelcastInstance is instance of HazelcastClient.
        Logger.getLogger(HazelcastTimestamper.class).finest(e);
    }
    return CacheEnvironment.getDefaultCacheTimeoutInMillis();
}
 
開發者ID:hazelcast,項目名稱:hazelcast-hibernate5,代碼行數:14,代碼來源:HazelcastTimestamper.java

示例3: getTimeout

import com.hazelcast.config.MapConfig; //導入方法依賴的package包/類
public static int getTimeout(HazelcastInstance instance, String regionName) {
    try {
        final MapConfig cfg = instance.getConfig().findMapConfig(regionName);
        if (cfg.getTimeToLiveSeconds() > 0) {
            // TTL in ms
            return cfg.getTimeToLiveSeconds() * SEC_TO_MS;
        }
    } catch (UnsupportedOperationException e) {
        // HazelcastInstance is instance of HazelcastClient.
        Logger.getLogger(HazelcastTimestamper.class).finest(e);
    }
    return CacheEnvironment.getDefaultCacheTimeoutInMillis();
}
 
開發者ID:hazelcast,項目名稱:hazelcast-hibernate,代碼行數:14,代碼來源:HazelcastTimestamper.java

示例4: getTimeout

import com.hazelcast.config.MapConfig; //導入方法依賴的package包/類
public static int getTimeout(HazelcastInstance instance, String regionName) {
    try {
        final MapConfig cfg = instance.getConfig().findMapConfig(regionName);
        if (cfg.getTimeToLiveSeconds() > 0) {
            // TTL in ms.
            return cfg.getTimeToLiveSeconds() * SEC_TO_MS;
        }
    } catch (UnsupportedOperationException e) {
        // HazelcastInstance is instance of HazelcastClient.
        Logger.getLogger(HazelcastTimestamper.class).finest(e);
    }
    return CacheEnvironment.getDefaultCacheTimeoutInMillis();
}
 
開發者ID:hazelcast,項目名稱:hazelcast-hibernate,代碼行數:14,代碼來源:HazelcastTimestamper.java

示例5: getTimeout

import com.hazelcast.config.MapConfig; //導入方法依賴的package包/類
public static int getTimeout(HazelcastInstance instance, String regionName) {
    try {
        final MapConfig cfg = instance.getConfig().findMatchingMapConfig(regionName);
        if (cfg.getTimeToLiveSeconds() > 0) {
            return cfg.getTimeToLiveSeconds() * 1000; // TTL in ms.
        }
    } catch (UnsupportedOperationException ignored) {
        // HazelcastInstance is instance of HazelcastClient.
    }
    return CacheEnvironment.getDefaultCacheTimeoutInMillis();
}
 
開發者ID:mdogan,項目名稱:hazelcast-archive,代碼行數:12,代碼來源:HazelcastTimestamper.java

示例6: BQ

import com.hazelcast.config.MapConfig; //導入方法依賴的package包/類
BQ(String name) {
    this.name = name;
    String shortName = name.substring(Prefix.QUEUE.length());
    queueConfig = node.getConfig().findMatchingQueueConfig(shortName);
    MapConfig backingMapConfig = node.getConfig().findMatchingMapConfig(queueConfig.getBackingMapRef());
    int backingMapTTL = backingMapConfig.getTimeToLiveSeconds();
    this.maxSizePerJVM = (queueConfig.getMaxSizePerJVM() == 0) ? Integer.MAX_VALUE : queueConfig.getMaxSizePerJVM();
    this.ttl = (backingMapTTL == 0) ? Integer.MAX_VALUE : TimeUnit.SECONDS.toMillis(backingMapTTL);
    initializeListeners();
}
 
開發者ID:mdogan,項目名稱:hazelcast-archive,代碼行數:11,代碼來源:BlockingQueueManager.java


注:本文中的com.hazelcast.config.MapConfig.getTimeToLiveSeconds方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。