Package com.fasterxml.storemate.shared

Examples of com.fasterxml.storemate.shared.IpAndPort


            throw new IllegalStateException("No server nodes defined for client, can not build");
        }
        // Second: try resolving IPs...
        Iterator<IpAndPort> it = _nodes.iterator();
        while (it.hasNext()) {
            IpAndPort ip = it.next();
            try {
                ip.getIP();
            } catch (Exception e) {
                logError("Failed to resolve end point '"+ip.toString()+"', skipping. Problem: "+e.getMessage());
                it.remove();
            }
        }
        // Still some left?
        if (_nodes.isEmpty()) {
View Full Code Here


        long roundStart;
      
        while ((roundStart = System.currentTimeMillis()) < waitUntil) {
            Iterator<IpAndPort> it = nodes.iterator();
            while (it.hasNext()) {
                IpAndPort ip = it.next();
                final long requestTime = System.currentTimeMillis();
                long maxTimeout = waitUntil - requestTime;
                try {
                    ClusterStatusMessage resp = _accessor.getClusterStatus(ip,
                            Math.min(maxTimeout, BOOTSTRAP_TIMEOUT_MSECS));
View Full Code Here

    protected boolean _updateInitialState(Collection<IpAndPort> nodes,
            long waitUntil, ClusterViewByClientImpl<K> clusterView) throws IOException
    {
        Iterator<IpAndPort> it = nodes.iterator();
        while (it.hasNext()) {
            IpAndPort ip = it.next();
            final long requestTime = System.currentTimeMillis();
            long maxTimeout = waitUntil - requestTime;
            try {
                ClusterStatusMessage resp = _accessor.getClusterStatus(ip,
                        Math.min(maxTimeout, BOOTSTRAP_TIMEOUT_MSECS));
View Full Code Here

     * Method called to add information obtained indirectly; i.e. "gossip".
     */
    public synchronized void updateIndirectState(IpAndPort byNode, NodeState stateInfo)
    {
        // First: ensure references are properly resolved (eliminate "localhost" if need be):
        IpAndPort ip = stateInfo.getAddress();
        if (ip.isLocalReference()) {
            ip = byNode.withPort(ip.getPort());
        }
        final long nodeInfoTimestamp = stateInfo.getLastUpdated();
        // otherwise pretty simple:
        ClusterServerNodeImpl state = _nodes.get(ip);
        if (state == null) { // new info
View Full Code Here

        return forTesting(range, range);
    }

    protected static ClusterServerNodeImpl forTesting(KeyRange rangeActive, KeyRange rangePassive) {
        return new ClusterServerNodeImpl(null, // client not needed for kinds of tests
            new IpAndPort("localhost:"+rangeActive.getStart()),
                rangeActive, rangePassive);
    }
View Full Code Here

        return forTesting(range, range);
    }

    protected static ClusterServerNodeImpl forTesting(KeyRange rangeActive, KeyRange rangePassive) {
        return new ClusterServerNodeImpl(null, // client not needed for kinds of tests
            new IpAndPort("localhost:"+rangeActive.getStart()),
                rangeActive, rangePassive);
    }
View Full Code Here

     * Method called to add information obtained indirectly; i.e. "gossip".
     */
    public synchronized void updateIndirectState(IpAndPort byNode, NodeState stateInfo)
    {
        // First: ensure references are properly resolved (eliminate "localhost" if need be):
        IpAndPort ip = stateInfo.getAddress();
        if (ip.isLocalReference()) {
            ip = byNode.withPort(ip.getPort());
        }
        final long nodeInfoTimestamp = stateInfo.getLastUpdated();
        // otherwise pretty simple:
        ClusterServerNodeImpl state = _nodes.get(ip);
        if (state == null) { // new info
View Full Code Here

     * @return True if there was a status update
     */
    protected boolean updateStatus(NodeState nodeStatus, boolean byNodeItself)
    {
        // First: do we have info for the node?
        final IpAndPort endpoint = nodeStatus.getAddress();
        if (endpoint == null) {
            LOG.warn("Missing endpoint info (sender? "+byNodeItself+"); need to skip update");
            return false;
        }
        // also, local state must be produced locally; ignore what others think
        // (in future could try pro-active fixing but...)
        if (endpoint.equals(_localState.getAddress())) {
            return false;
        }
        ClusterPeerImpl<K,E> peer;

        try {
View Full Code Here

     * Method called when we get information on a peer for which we do not
     * have peer thread.
     */
    protected void _updateMissingPeer(NodeState nodeStatus, boolean forSender) throws IOException
    {
        final IpAndPort endpoint = nodeStatus.getAddress();
        /* Ok: let's also see if we have old state information in the
         * local DB. If we do, we may be able to avoid syncing from
         * the beginning of time; and/or obtain actual key range.
         */
        NodeStateStore<IpAndPort, ActiveNodeState> stateStore = _stores.getNodeStore();
View Full Code Here

         * Method called to add information obtained indirectly; i.e. "gossip".
         */
        public void updateIndirectState(IpAndPort byNode, NodeState stateInfo)
        {
            // First: ensure references are properly resolved (eliminate "localhost" if need be):
            IpAndPort ip = stateInfo.getAddress();
            if (ip.isLocalReference()) {
                ip = byNode.withPort(ip.getPort());
            }
            final long nodeInfoTimestamp = stateInfo.getLastUpdated();
            // otherwise pretty simple:
            RemoteClusterNode state = _nodes.get(ip);
            if (state == null) { // new info
View Full Code Here

TOP

Related Classes of com.fasterxml.storemate.shared.IpAndPort

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.