Package com.hazelcast.core

Examples of com.hazelcast.core.Member


            }
        }
    }

    public static String generateKeyNotOwnedBy(HazelcastInstance instance) {
        final Member localMember = instance.getCluster().getLocalMember();
        final PartitionService partitionService = instance.getPartitionService();
        for (; ; ) {
            String id = UUID.randomUUID().toString();
            Partition partition = partitionService.getPartition(id);
            if (!localMember.equals(partition.getOwner())) {
                return id;
            }
        }
    }
View Full Code Here


        for (int i = 0; i < k; i++) {
            final HazelcastInstance instance = instances[i];
            final IExecutorService service = instance.getExecutorService("testSubmitToKeyOwnerCallable");
            final String script = "hazelcast.getCluster().getLocalMember().getUuid().equals(memberUUID)";
            final HashMap map = new HashMap();
            final Member localMember = instance.getCluster().getLocalMember();
            map.put("memberUUID", localMember.getUuid());
            int key = 0;
            while (!localMember.equals(instance.getPartitionService().getPartition(++key).getOwner())) ;
            if (i % 2 == 0) {
                final Future f = service.submitToKeyOwner(new ScriptCallable(script, map), key);
                assertTrue((Boolean) f.get(60, TimeUnit.SECONDS));
            } else {
                service.submitToKeyOwner(new ScriptCallable(script, map), key, callback);
View Full Code Here

    public void testMemberLeftException_usingMemberImpl() throws IOException, ClassNotFoundException {
        String uuid = UuidUtil.buildRandomUuidString();
        String host = "127.0.0.1";
        int port = 5000;

        Member member = new MemberImpl(new Address(host, port), false, uuid, null);

        testMemberLeftException(uuid, host, port, member);
    }
View Full Code Here

    public void testMemberLeftException_usingSimpleMember() throws IOException, ClassNotFoundException {
        String uuid = UuidUtil.buildRandomUuidString();
        String host = "127.0.0.1";
        int port = 5000;

        Member member = new SimpleMemberImpl(uuid, new InetSocketAddress(host, port));
        testMemberLeftException(uuid, host, port, member);
    }
View Full Code Here

    @Test
    public void testInstance() {
        assertNotNull(instance);
        final Set<Member> members = instance.getCluster().getMembers();
        assertEquals(1, members.size());
        final Member member = members.iterator().next();
        final InetSocketAddress inetSocketAddress = member.getInetSocketAddress();
        assertEquals(5700, inetSocketAddress.getPort());
        assertEquals("test-instance", config.getInstanceName());
        assertEquals("HAZELCAST_ENTERPRISE_LICENSE_KEY", config.getLicenseKey());
    }
View Full Code Here

        assertEquals(5, h5.getCluster().getMembers().size());

        // Need to wait for at least as long as PROP_MAX_NO_MASTER_CONFIRMATION_SECONDS
        Thread.sleep(15 * 1000);

        Member master = h1.getCluster().getLocalMember();
        assertEquals(master, h2.getCluster().getMembers().iterator().next());
        assertEquals(master, h3.getCluster().getMembers().iterator().next());
        assertEquals(master, h4.getCluster().getMembers().iterator().next());
        assertEquals(master, h5.getCluster().getMembers().iterator().next());

View Full Code Here

        });
    }

    private static void load(boolean load, ExecutorService es, final MultiMap<String, byte[]> map) {
        if (load) {
            final Member thisMember = instance.getCluster().getLocalMember();
            for (int i = 0; i < entryCount; i++) {
                final String key = String.valueOf(i);
                Partition partition = instance.getPartitionService().getPartition(key);
                if (thisMember.equals(partition.getOwner())) {
                    es.execute(new Runnable() {
                        public void run() {
                            map.put(key, new byte[valueSize]);
                        }
                    });
View Full Code Here

            new Thread(new Runnable() {
                public void run() {
                    ITopic<Long> topic = instance.getTopic(name);
                    topic.addMessageListener(new MessageListener<Long>() {
                        public void onMessage(Message<Long> message) {
                            Member publishingMember = message.getPublishingMember();
                            if (publishingMember.equals(instance.getCluster().getLocalMember()))
                                count.incrementAndGet();
                            if (publishingMember.equals(message.getMessageObject()))
                                count1.incrementAndGet();
                            if (publishingMember.localMember())
                                count2.incrementAndGet();
                        }
                    });
                    mainLatch.countDown();
                }
View Full Code Here

                    } catch (InterruptedException e) {
                        e.printStackTrace();
                        return;
                    }

                    Member localMember = hz.getCluster().getLocalMember();
                    for (int j = 0; j < count; j++) {
                        topic.publish(new TestMessage(localMember, UuidUtil.buildRandomUuidString()));
                        publishLatch.countDown();
                    }
                }
View Full Code Here

                    } catch (InterruptedException e) {
                        e.printStackTrace();
                        return;
                    }

                    Member localMember = hz.getCluster().getLocalMember();
                    for (int j = 0; j < count; j++) {
                        topic.publish(new TestMessage(localMember, UUID.randomUUID().toString()));
                        publishLatch.countDown();
                    }
                }
View Full Code Here

TOP

Related Classes of com.hazelcast.core.Member

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.