Package com.hazelcast.nio

Examples of com.hazelcast.nio.Address


                            trackableJobs.remove(jobId);
                        }
                    }
                });

                Address runningMember = future.getConnection().getRemoteEndpoint();
                trackableJobs.putIfAbsent(jobId, new ClientTrackableJob<T>(jobId, runningMember, completableFuture));
                return completableFuture;
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
View Full Code Here


            return partitionId;
        }

        @Override
        public Member getOwner() {
            Address address = partitionService.getPartitionOwner(partitionId);
            if (address == null) {
                return null;
            }

            //todo: why are we calling the partitionService twice, why don't we immediately get the member?
View Full Code Here

    }

    protected final boolean isValid() {
        final ClusterServiceImpl clusterService = getService();
        final Connection conn = getConnection();
        final Address masterAddress = conn != null ? conn.getEndPoint() : null;
        return conn == null ||  // which means this is a local call.
                               (masterAddress != null && masterAddress.equals(clusterService.getMasterAddress()));
    }
View Full Code Here

        return addresses[replicaIndex];
    }

    void setReplicaAddress(int replicaIndex, Address newAddress) {
        boolean changed = false;
        Address oldAddress;
        for (; ; ) {
            Address[] oldAddresses = addresses;
            oldAddress = oldAddresses[replicaIndex];
            if (partitionListener != null) {
                if (oldAddress == null) {
                    changed = newAddress != null;
                } else {
                    changed = !oldAddress.equals(newAddress);
                }
            }

            Address[] newAddresses = createNewAddresses(replicaIndex, newAddress, oldAddresses);
            if (ADDRESSES_UPDATER.compareAndSet(this, oldAddresses, newAddresses)) {
View Full Code Here

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder("Partition [").append(partitionId).append("]{\n");
        for (int i = 0; i < MAX_REPLICA_COUNT; i++) {
            Address address = addresses[i];
            if (address != null) {
                sb.append('\t');
                sb.append(i).append(":").append(address);
                sb.append("\n");
            }
View Full Code Here

        return send(request, target);
    }

    public <T> ICompletableFuture<T> invokeOnKeyOwner(ClientRequest request, Object key) throws Exception {
        ClientPartitionServiceImpl partitionService = (ClientPartitionServiceImpl) client.getClientPartitionService();
        final Address owner = partitionService.getPartitionOwner(partitionService.getPartitionId(key));
        if (owner != null) {
            return invokeOnTarget(request, owner);
        }
        return invokeOnRandomTarget(request);
    }
View Full Code Here

        return sendAndHandle(request, target, handler);
    }

    public <T> ICompletableFuture<T> invokeOnKeyOwner(ClientRequest request, Object key, EventHandler handler) throws Exception {
        ClientPartitionServiceImpl partitionService = (ClientPartitionServiceImpl) client.getClientPartitionService();
        final Address owner = partitionService.getPartitionOwner(partitionService.getPartitionId(key));
        if (owner != null) {
            return invokeOnTarget(request, owner, handler);
        }
        return invokeOnRandomTarget(request, handler);
    }
View Full Code Here

    private void getInitialPartitions() {
        final ClientClusterService clusterService = client.getClientClusterService();
        final Collection<MemberImpl> memberList = clusterService.getMemberList();
        for (MemberImpl member : memberList) {
            final Address target = member.getAddress();
            PartitionsResponse response = getPartitionsFrom(target);
            if (response != null) {
                processPartitionResponse(response);
                return;
            }
View Full Code Here

    private class RefreshTask implements Runnable {
        public void run() {
            if (updating.compareAndSet(false, true)) {
                try {
                    final ClientClusterService clusterService = client.getClientClusterService();
                    final Address master = clusterService.getMasterAddress();
                    final PartitionsResponse response = getPartitionsFrom(master);
                    if (response != null) {
                        processPartitionResponse(response);
                    }
                } catch (HazelcastInstanceNotActiveException ignored) {
View Full Code Here

        public int getPartitionId() {
            return partitionId;
        }

        public Member getOwner() {
            final Address owner = getPartitionOwner(partitionId);
            if (owner != null) {
                return client.getClientClusterService().getMember(owner);
            }
            return null;
        }
View Full Code Here

TOP

Related Classes of com.hazelcast.nio.Address

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.