Package com.fasterxml.storemate.shared

Examples of com.fasterxml.storemate.shared.IpAndPort


        String str = request.getQueryParameter(ClusterMateConstants.QUERY_PARAM_CALLER);
        if (str == null || (str = str.trim()).length() == 0) {
            return null;
        }
        try {
            return new IpAndPort(str);
        } catch (Exception e) {
            LOG.warn("Invalid value for {}: '{}', problem: {}",
                    ClusterMateConstants.QUERY_PARAM_CALLER,
                    str, e.getMessage());
            return null;
View Full Code Here


    @SuppressWarnings("unchecked")
    public <RESP extends ServiceResponse> RESP handlePost(ServiceRequest request, RESP response,
            OperationDiagnostics metadata)
    {
        // First things first: need to have a caller
        IpAndPort caller = getCallerQueryParam(request);
        if (caller == null) {
            return badRequest(response,
                    "Missing or invalid '"+ClusterMateConstants.QUERY_PARAM_CALLER+"' value");
        }
        // as well as known state...
View Full Code Here

        ServerUtil.findLocalIPs(localIps);
        LOG.info("Local IPs: {}", localIps.toString());
        Map<IpAndPort,NodeDefinition> nodeDefs = new LinkedHashMap<IpAndPort,NodeDefinition>();

        for (NodeDefinition node : _readNodeDefs()) {
            IpAndPort ip = node.getAddress();
            LOG.info("Resolving node definitions for: "+ip.toString());
            // Entry for this instance?
            // NOTE: this call will resolve IP name to address; blocking call:
            InetAddress addr = ip.getIP();
            if (localIps.contains(addr) && ip.getPort() == thisInstancePort) {
                if (localDef != null) {
                    throw new IllegalStateException("Ambiguous definition: both "
                            +localDef.getAddress()+" and "+ip+" refer to this host");
                }
                localDef = node;
View Full Code Here

                copies = copies0;
            }
        }
        for (int i = 0, end = nodes.length; i < end; ++i) {
            NodeConfig node = nodes[i];
            IpAndPort ip = node.ipAndPort;
            final int index = (i+1);

            if (ip == null) {
                throw new IllegalStateException("Missing 'ipAndPort' value for node #"
                        +index+" (out of "+end+")");
View Full Code Here

        LOG.info("Merging {} configured peer entries with {} persistent entries",
                nodeDefs.size(), storedStates.size());
       
        // Iterate over entries that have been persisted:
        for (ActiveNodeState state : storedStates) {
            IpAndPort key = state.getAddress();
            // Then: is there config for that entry? If not, skip or remove:
            NodeDefinition def = orphanDefs.remove(key);
            if (def == null) {
                long staleTimeSecs = (_startTime - state.getLastSyncAttempt()) / 1000L;
                if (staleTimeSecs < SECS_IN_24H) {
View Full Code Here

    // Alternate internal ctor used when deserializing from simple String
    @JsonCreator
    public NodeConfig(String str) throws IllegalArgumentException
    {
        try {
            ipAndPort = new IpAndPort(str);
        } catch (Exception e) {
            throw new IllegalArgumentException("Invalid endpoint definition for constructing NodeConfig: \""
                    +str+"\"");
        }
    }
View Full Code Here

    }

    // constructor for unit tests
    public NodeConfig(String endpoint, int keyStart, int keyLength)
    {
        this(new IpAndPort(endpoint), keyStart, keyLength);
    }
View Full Code Here

        while (it.hasNext()) {
            if (!_running.get()) {
                LOG.warn("Terminating remote IP endpoint resolution");
                return false;
            }
            IpAndPort ip = it.next();
            try {
                ip.getIP();
            } catch (Exception e) {
                LOG.error("Failed to resolve end point '"+ip.toString()+"', removing. Problem: "+e.getMessage());
                it.remove();
            }
        }
        LOG.info("Completed remote IP endpoint resolution");
        return true;
View Full Code Here

        int round = 0;

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

        String str = request.getQueryParameter(ClusterMateConstants.QUERY_PARAM_CALLER);
        if (str == null || (str = str.trim()).length() == 0) {
            return null;
        }
        try {
            return new IpAndPort(str);
        } catch (Exception e) {
            LOG.warn("Invalid value for {}: '{}', problem: {}",
                    ClusterMateConstants.QUERY_PARAM_CALLER,
                    str, e.getMessage());
            return null;
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.