本文整理匯總了Java中com.hazelcast.config.Config.getMapConfig方法的典型用法代碼示例。如果您正苦於以下問題:Java Config.getMapConfig方法的具體用法?Java Config.getMapConfig怎麽用?Java Config.getMapConfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.hazelcast.config.Config
的用法示例。
在下文中一共展示了Config.getMapConfig方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: correctHazelcastInstanceIsCreated
import com.hazelcast.config.Config; //導入方法依賴的package包/類
@Test
public void correctHazelcastInstanceIsCreated() throws Exception {
assertNotNull(this.hzInstance);
final Config config = this.hzInstance.getConfig();
assertFalse(config.getNetworkConfig().getJoin().getMulticastConfig().isEnabled());
assertEquals(Arrays.asList("localhost"), config.getNetworkConfig().getJoin().getTcpIpConfig().getMembers());
assertTrue(config.getNetworkConfig().isPortAutoIncrement());
assertEquals(5701, config.getNetworkConfig().getPort());
final MapConfig mapConfig = config.getMapConfig("tickets");
assertNotNull(mapConfig);
assertEquals(28800, mapConfig.getMaxIdleSeconds());
assertEquals(EvictionPolicy.LRU, mapConfig.getEvictionPolicy());
assertEquals(10, mapConfig.getEvictionPercentage());
}
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:16,代碼來源:DefaultHazelcastInstanceConfigurationTests.java
示例2: hazelcastInstanceIsCreatedNormally
import com.hazelcast.config.Config; //導入方法依賴的package包/類
@Test
public void hazelcastInstanceIsCreatedNormally() throws Exception {
assertNotNull(this.hzInstance);
final Config config = this.hzInstance.getConfig();
assertTrue(config.getNetworkConfig().getJoin().getMulticastConfig().isEnabled());
assertEquals(Arrays.asList("127.0.0.1"), config.getNetworkConfig().getJoin().getTcpIpConfig().getMembers());
assertFalse(config.getNetworkConfig().isPortAutoIncrement());
assertEquals(5801, config.getNetworkConfig().getPort());
final MapConfig mapConfig = config.getMapConfig("tickets-from-external-config");
assertNotNull(mapConfig);
assertEquals(20000, mapConfig.getMaxIdleSeconds());
assertEquals(EvictionPolicy.LFU, mapConfig.getEvictionPolicy());
assertEquals(99, mapConfig.getEvictionPercentage());
}
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:16,代碼來源:ProvidedHazelcastInstanceConfigurationTests.java
示例3: main
import com.hazelcast.config.Config; //導入方法依賴的package包/類
public static void main(String[] args) {
// 從classpath加載配置文件
Config config = new ClasspathXmlConfig("xmlconfig/simple-config.xml");
// 獲取網絡配置
NetworkConfig netConfig = config.getNetworkConfig();
// 獲取用戶定義的map配置
MapConfig mapConfigXml = config.getMapConfig("demo.config");
// 獲取係統默認的map配置
MapConfig mapConfigDefault = config.getMapConfig("default");
// 輸出集群監聽的起始端口號
System.out.println("Current port:" + netConfig.getPort());
// 輸出監聽端口的累加號
System.out.println("Current port count:" + netConfig.getPortCount());
// 輸出自定義map的備份副本個數
System.out.println("Config map backup count:" + mapConfigXml.getBackupCount());
// 輸出默認map的備份副本個數
System.out.println("Default map backup count:" + mapConfigDefault.getBackupCount());
// 測試創建Hazelcast實例並讀寫測試數據
HazelcastInstance instance1 = Hazelcast.newHazelcastInstance(config);
HazelcastInstance instance2 = Hazelcast.newHazelcastInstance(config);
Map<Integer, String> defaultMap1 = instance1.getMap("defaultMap");
defaultMap1.put(1, "testMap");
Map<Integer, String> configMap1 = instance1.getMap("configMap");
configMap1.put(1, "configMap");
Map<Integer, String> testMap2 = instance2.getMap("defaultMap");
System.out.println("Default map value:" + testMap2.get(1));
Map<Integer, String> configMap2 = instance2.getMap("configMap");
System.out.println("Config map value:" + configMap2.get(1));
}