Package com.hazelcast.core

Examples of com.hazelcast.core.Member


    protected void handlePartitions(String[] args) {
        Set<Partition> partitions = hazelcast.getPartitionService().getPartitions();
        Map<Member, Integer> partitionCounts = new HashMap<Member, Integer>();
        for (Partition partition : partitions) {
            Member owner = partition.getOwner();
            if (owner != null) {
                Integer count = partitionCounts.get(owner);
                int newCount = 1;
                if (count != null) {
                    newCount = count + 1;
View Full Code Here


                List<Member> members = new LinkedList(hazelcast.getCluster().getMembers());
                if (memberIndex >= members.size()) {
                    throw new IndexOutOfBoundsException("Member index: " + memberIndex + " must be smaller than " + members
                            .size());
                }
                Member member = members.get(memberIndex);
                future = executorService.submitToMember(callable, member);
            } else {
                future = executorService.submit(callable);
            }
            println("Result: " + future.get());
View Full Code Here

    @Override
    public Node getNode() {
        Node node = null;
        Cluster cluster = instance.getCluster();
        if (cluster != null) {
            Member member = cluster.getLocalMember();
            node = new HazelcastNode(member.getInetSocketAddress().getHostName(), member.getInetSocketAddress().getPort());
        }
        return node;
    }
View Full Code Here

        this.instance = instance;
        instance.getCluster().addMembershipListener(this);
    }

    public void memberAdded(MembershipEvent membershipEvent) {
        Member member = membershipEvent.getMember();
        try {
            Member local = instance.getCluster().getLocalMember();

            if (local.equals(member)) {
                if (synchronizers != null && !synchronizers.isEmpty()) {
                    Set<Group> groups = groupManager.listLocalGroups();
                    if (groups != null && !groups.isEmpty()) {
                        for (Group group : groups) {
                            for (Synchronizer synchronizer : synchronizers) {
View Full Code Here

        return config;
    }

    public void addEndpoint(Endpoint endpoint) {
        if (findEndpoint(endpoint.getURI()).size() > 0) {
            Member m = getOwningMember(endpoint.getURI());
            throw new IllegalStateException("Endpoint " + endpoint.getURI() + " already exists in domain " + domainURI + " at " + m.getInetSocketAddress());
        }
           
        String localMemberAddr = hazelcastInstance.getCluster().getLocalMember().getInetSocketAddress().toString();
        String endpointURI = endpoint.getURI();
        Transaction txn = hazelcastInstance.getTransaction();
View Full Code Here

        FactoryExtensionPoint modelFactories = extensionsRegistry.getExtensionPoint(FactoryExtensionPoint.class);
        this.messageFactory = modelFactories.getFactory(MessageFactory.class);
    }

    public Message invoke(Message msg) {
        Member owningMember = hzRegistry.getOwningMember(serviceURI);
        if (owningMember == null) {
            throw new ServiceRuntimeException("service not found: " + serviceURI);
        }
        String requestXML = getRequestXML(msg);
        Callable<String> callable = new ServiceInvoker(serviceURI, operation.getName(), requestXML);
View Full Code Here

    }

    private void sendChunk(boolean finalChunk) {
        if (recordCachePos > 0) {
            String name = replicatedRecordStore.getName();
            Member localMember = replicatedRecordStore.localMember;
            Operation operation = new ReplicatedMapInitChunkOperation(name, localMember, recordCache, recordCachePos, finalChunk);
            operationService.send(operation, callerAddress);

            // Reset chunk cache and pos
            recordCache = new ReplicatedRecord[chunkSize];
View Full Code Here

    }

    @Test
    public void isMemberSafe_localMember() throws Exception {
        final HazelcastInstance node = createHazelcastInstance();
        final Member localMember = node.getCluster().getLocalMember();
        final boolean safe = node.getPartitionService().isMemberSafe(localMember);

        assertTrue(safe);
    }
View Full Code Here

            throw new RuntimeException(e);
        }
    }

    public static String generateKeyOwnedBy(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

            ex.shutdownNow();
        }
    }

    private int getLocalPartitionsCount(HazelcastInstance h) {
        final Member localMember = h.getCluster().getLocalMember();
        Set<Partition> partitions = h.getPartitionService().getPartitions();
        int count = 0;
        for (Partition partition : partitions) {
            if (localMember.equals(partition.getOwner())) {
                count++;
            }
        }
        return count;
    }
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.