Search in sources :

Example 11 with AdvancedNetworkConfig

use of com.hazelcast.config.AdvancedNetworkConfig in project hazelcast by hazelcast.

the class RestInstanceMultiendpointTest method createConfig.

@Override
protected Config createConfig() {
    Config c = new Config();
    AdvancedNetworkConfig anc = c.getAdvancedNetworkConfig();
    anc.setEnabled(true);
    return c;
}
Also used : AdvancedNetworkConfig(com.hazelcast.config.AdvancedNetworkConfig) Config(com.hazelcast.config.Config) RestServerEndpointConfig(com.hazelcast.config.RestServerEndpointConfig) AdvancedNetworkConfig(com.hazelcast.config.AdvancedNetworkConfig)

Example 12 with AdvancedNetworkConfig

use of com.hazelcast.config.AdvancedNetworkConfig in project hazelcast by hazelcast.

the class TestAwareInstanceFactory method newHazelcastInstance.

/**
 * Creates new member instance with TCP join configured. Uses
 * {@link com.hazelcast.test.AbstractHazelcastClassRunner#getTestMethodName()}
 * as the cluster name if it's not changed already.
 */
public HazelcastInstance newHazelcastInstance(Config config, NodeContext nodeCtx) {
    if (config == null) {
        config = new Config();
    }
    if (DEFAULT_CLUSTER_NAME.equals(config.getClusterName())) {
        config.setClusterName(getTestMethodName());
    }
    List<HazelcastInstance> members = getOrInitInstances(perMethodMembers);
    // Prepare Unified Networking (legacy)
    NetworkConfig unifiedNetworkingConfig = config.getNetworkConfig();
    unifiedNetworkingConfig.setPort(PORT.getAndIncrement());
    JoinConfig unifiedJoinConfig = unifiedNetworkingConfig.getJoin();
    unifiedJoinConfig.getMulticastConfig().setEnabled(false);
    TcpIpConfig unifiedTcpIpConfig = unifiedJoinConfig.getTcpIpConfig().setEnabled(true);
    for (HazelcastInstance member : members) {
        unifiedTcpIpConfig.addMember("127.0.0.1:" + getPort(member, MEMBER));
    }
    // Prepare Advanced Networking - Will be disabled by default but properly configured if needed
    AdvancedNetworkConfig advancedNetworkConfig = config.getAdvancedNetworkConfig();
    ServerSocketEndpointConfig memberEndpointConfig = (ServerSocketEndpointConfig) advancedNetworkConfig.getEndpointConfigs().get(MEMBER);
    memberEndpointConfig.setPort(PORT.getAndIncrement());
    JoinConfig advancedJoinConfig = advancedNetworkConfig.getJoin();
    advancedJoinConfig.getMulticastConfig().setEnabled(false);
    TcpIpConfig advancedTcpIpConfig = advancedJoinConfig.getTcpIpConfig().setEnabled(true);
    for (HazelcastInstance member : members) {
        advancedTcpIpConfig.addMember("127.0.0.1:" + getPort(member, MEMBER));
    }
    HazelcastInstance hz = HazelcastInstanceFactory.newHazelcastInstance(config, config.getInstanceName(), nodeCtx);
    members.add(hz);
    int nextPort = getPort(hz, MEMBER) + 1;
    int current;
    while (nextPort > (current = PORT.get())) {
        PORT.compareAndSet(current, nextPort);
    }
    return hz;
}
Also used : AdvancedNetworkConfig(com.hazelcast.config.AdvancedNetworkConfig) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig) NetworkConfig(com.hazelcast.config.NetworkConfig) TcpIpConfig(com.hazelcast.config.TcpIpConfig) JoinConfig(com.hazelcast.config.JoinConfig) AdvancedNetworkConfig(com.hazelcast.config.AdvancedNetworkConfig) NetworkConfig(com.hazelcast.config.NetworkConfig) AdvancedNetworkConfig(com.hazelcast.config.AdvancedNetworkConfig) JoinConfig(com.hazelcast.config.JoinConfig) ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig) TcpIpConfig(com.hazelcast.config.TcpIpConfig)

Aggregations

AdvancedNetworkConfig (com.hazelcast.config.AdvancedNetworkConfig)12 Config (com.hazelcast.config.Config)7 RestServerEndpointConfig (com.hazelcast.config.RestServerEndpointConfig)5 ServerSocketEndpointConfig (com.hazelcast.config.ServerSocketEndpointConfig)5 EndpointConfig (com.hazelcast.config.EndpointConfig)4 JoinConfig (com.hazelcast.config.JoinConfig)4 NetworkConfig (com.hazelcast.config.NetworkConfig)2 TcpIpConfig (com.hazelcast.config.TcpIpConfig)2 EndpointQualifier (com.hazelcast.instance.EndpointQualifier)2 AuditlogConfig (com.hazelcast.config.AuditlogConfig)1 EncryptionAtRestConfig (com.hazelcast.config.EncryptionAtRestConfig)1 MemberAddressProviderConfig (com.hazelcast.config.MemberAddressProviderConfig)1 MemcacheProtocolConfig (com.hazelcast.config.MemcacheProtocolConfig)1 PersistenceConfig (com.hazelcast.config.PersistenceConfig)1 RestApiConfig (com.hazelcast.config.RestApiConfig)1 SSLConfig (com.hazelcast.config.SSLConfig)1 SecurityConfig (com.hazelcast.config.SecurityConfig)1 WanBatchPublisherConfig (com.hazelcast.config.WanBatchPublisherConfig)1 WanReplicationConfig (com.hazelcast.config.WanReplicationConfig)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1