本文整理匯總了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));
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}