package org.palm.hazelcast.config;

import com.hazelcast.config.Config;
import com.hazelcast.config.NetworkConfig;
import com.hazelcast.core.Hazelcast;

/**
 * 展示在代码执行时修改配置初始化方法
 * 
 * @author chkui
 */
public class HazelcastConfigRuntimeModify {
	public static void main(String[] args) {
		// 创建默认config对象
		Config config = new Config();
		// 获取NetworkConfig
		NetworkConfig netConfig = config.getNetworkConfig();
		System.out.println("Default port:" + netConfig.getPort());

		// 设置NetworkConfig
		netConfig.setPort(9701);
		System.out.println("Customer port:" + netConfig.getPort());
		
		// 初始化Hazelcast
		Hazelcast.newHazelcastInstance(config);
	}
}

@@ -57,32 +57,117 @@
 .config.Config;%0A
+import com.hazelcast.config.JoinConfig;%0Aimport com.hazelcast.config.MulticastConfig;%0A
 import com.hazel
@@ -185,32 +185,32 @@
 .NetworkConfig;%0A
-
 import com.hazel
@@ -421,28 +421,46 @@
 ();%0A
+%09%09%0A
 %09%09// %E8%8E%B7%E5%8F%96
-N
+n
 etwork
-Config
+%E5%85%83%E7%B4%A0%3Cnetwork%3E%3C/network%3E
 %0A%09%09N
@@ -576,16 +576,18 @@
 ));%0A
+%09%09
 %0A%09%09// %E8%AE%BE%E7%BD%AE
 Netw
@@ -582,29 +582,24 @@
 %0A%09%09// %E8%AE%BE%E7%BD%AE
-NetworkConfig
+%E7%BB%84%E7%BD%91%E8%B5%B7%E5%A7%8B%E7%9B%91%E5%90%AC%E7%AB%AF%E5%8F%A3
 %0A%09%09netCo
@@ -618,16 +618,16 @@
 (9701);%0A
-
 %09%09System
@@ -672,32 +672,345 @@
 fig.getPort());%0A
+%09%09// %E8%8E%B7%E5%8F%96join%E5%85%83%E7%B4%A0%3Cjoin%3E%3C/join%3E%0A%09%09JoinConfig joinConfig = netConfig.getJoin();%0A%09%09// %E8%8E%B7%E5%8F%96multicast%E5%85%83%E7%B4%A0%3Cmulticast%3E%3C/multicast%3E%0A%09%09MulticastConfig multicastConfig = joinConfig.getMulticastConfig();%0A%09%09// %E8%BE%93%E5%87%BA%E7%BB%84%E6%92%AD%E5%8D%8F%E8%AE%AE%E7%AB%AF%E5%8F%A3%0A%09%09System.out.println(multicastConfig.getMulticastPort());%0A%09%09// %E7%A6%81%E7%94%A8multicast%E5%8D%8F%E8%AE%AE%0A%09%09multicastConfig.setEnabled(false);%0A
 %09%09%0A%09%09// %E5%88%9D%E5%A7%8B%E5%8C%96Hazel

modify HazelcastConfigRuntimeModify. add more entrty modify code