Package com.hazelcast.client.config

Examples of com.hazelcast.client.config.ClientConfig


    @BeforeClass
    public static void init() {
        server1 = Hazelcast.newHazelcastInstance();
        server2 = Hazelcast.newHazelcastInstance();
        ClientConfig clientConfig = new ClientConfig();
        clientConfig.getNetworkConfig().setSmartRouting(false);
        client = HazelcastClient.newHazelcastClient(clientConfig);
    }
View Full Code Here


    public ClientClusterServiceImpl(HazelcastClientInstanceImpl client) {
        this.client = client;
        this.connectionManager = client.getConnectionManager();
        this.clusterThread = createListenerThread();
        final ClientConfig clientConfig = getClientConfig();
        final List<ListenerConfig> listenerConfigs = client.getClientConfig().getListenerConfigs();
        if (listenerConfigs != null && !listenerConfigs.isEmpty()) {
            for (ListenerConfig listenerConfig : listenerConfigs) {
                EventListener listener = listenerConfig.getImplementation();
                if (listener == null) {
                    try {
                        listener = ClassLoaderUtil.newInstance(clientConfig.getClassLoader(), listenerConfig.getClassName());
                    } catch (Exception e) {
                        LOGGER.severe(e);
                    }
                }
                if (listener instanceof MembershipListener) {
View Full Code Here

    @Test(timeout = 40000)
    public void testChangeMemberAttributes() throws Exception {
        final int count = 100;

        final HazelcastInstance instance = Hazelcast.newHazelcastInstance();
        final ClientConfig config = new ClientConfig();
        final ListenerConfig listenerConfig = new ListenerConfig();
        final CountDownLatch countDownLatch = new CountDownLatch(count);
        listenerConfig.setImplementation(new LatchMembershipListener(countDownLatch));
        config.addListenerConfig(listenerConfig);
        HazelcastClient.newHazelcastClient(config);

        final Member localMember = instance.getCluster().getLocalMember();
        for (int i = 0; i < count; i++) {
            localMember.setStringAttribute("key" + i, HazelcastTestSupport.randomString());
View Full Code Here

import com.hazelcast.test.HazelcastTestSupport;

public abstract class AbstractClientMapReduceJobTest extends HazelcastTestSupport {

    protected ClientConfig buildClientConfig() {
        ClientConfig config = new XmlClientConfigBuilder().build();
        return config;
    }
View Full Code Here

        TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(1);
        final HazelcastInstance server = factory.newHazelcastInstance();

        Cluster cluster = server.getCluster();

        ClientConfig clientConfig = new ClientConfig();
        clientConfig.setLoadBalancer(roundRobinLB);

        roundRobinLB.init(cluster, clientConfig);

        Member member = cluster.getLocalMember();
        Member nextMember = roundRobinLB.next();
View Full Code Here

        TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(1);
        HazelcastInstance server = factory.newHazelcastInstance();
        Cluster cluster = server.getCluster();

        ClientConfig clientConfig = new ClientConfig();
        clientConfig.setLoadBalancer(randomLB);

        randomLB.init(cluster, clientConfig);

        Member member = cluster.getLocalMember();
        Member nextMember = randomLB.next();
View Full Code Here

    @Before
    public void init() {
        Config config = new Config();
        server1 = Hazelcast.newHazelcastInstance(config);

        ClientConfig clientConfig = new ClientConfig();
        clientConfig.setExecutorPoolSize(1);
        clientConfig.getNetworkConfig().setRedoOperation(true);
        client = HazelcastClient.newHazelcastClient(clientConfig);

        server2 = Hazelcast.newHazelcastInstance(config);

        map = client.getMap(randomString());
View Full Code Here

        Config config = new Config();
        config.getSerializationConfig().addPortableFactory(PortableHelpersFactory.ID, new PortableHelpersFactory());
        server1 = Hazelcast.newHazelcastInstance(config);
        server2 = Hazelcast.newHazelcastInstance(config);

        ClientConfig clientConfig = new ClientConfig();
        clientConfig.getSerializationConfig().addPortableFactory(PortableHelpersFactory.ID, new PortableHelpersFactory());
        client = HazelcastClient.newHazelcastClient(clientConfig);

        interceptor = new SimpleClientInterceptor();
    }
View Full Code Here

    public static void setup() throws Exception {
        Config config = new Config();
        config.getGroupConfig().setName(groupAName);
        server1GroupA = Hazelcast.newHazelcastInstance(config);

        ClientConfig clientConfig = new ClientConfig();
        clientConfig.setGroupConfig(new GroupConfig(config.getGroupConfig().getName()));
        client1GroupA = HazelcastClient.newHazelcastClient(clientConfig);
        client2GroupA = HazelcastClient.newHazelcastClient(clientConfig);

        //setup Group B
        config = new Config();
        config.getGroupConfig().setName(groupBName);
        server1GroupB = Hazelcast.newHazelcastInstance(config);

        clientConfig = new ClientConfig();
        clientConfig.setGroupConfig(new GroupConfig(config.getGroupConfig().getName()));
        client1GroupB = HazelcastClient.newHazelcastClient(clientConfig);
    }
View Full Code Here

        SessionFactory sf = createSessionFactory(props);
        HazelcastInstance hz = HazelcastAccessor.getHazelcastInstance(sf);
        assertTrue(hz instanceof HazelcastClientProxy);
        assertEquals(1, main.getCluster().getMembers().size());
        HazelcastClientProxy client = (HazelcastClientProxy) hz;
        ClientConfig clientConfig = client.getClientConfig();
        assertEquals("dev-custom", clientConfig.getGroupConfig().getName());
        assertEquals("dev-pass", clientConfig.getGroupConfig().getPassword());
        assertTrue(clientConfig.getNetworkConfig().isSmartRouting());
        assertTrue(clientConfig.getNetworkConfig().isRedoOperation());
        Hazelcast.newHazelcastInstance(new ClasspathXmlConfig("hazelcast-custom.xml"));
        assertEquals(2, hz.getCluster().getMembers().size());
        main.shutdown();
        Thread.sleep(1000 * 3); // let client to reconnect
        assertEquals(1, hz.getCluster().getMembers().size());
View Full Code Here

TOP

Related Classes of com.hazelcast.client.config.ClientConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.