Package com.fasterxml.storemate.shared

Examples of com.fasterxml.storemate.shared.IpAndPort


    }

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


                try {
                    all.add(_fromDB(data));
                } catch (Exception e) {
                    String key = "N/A";
                    try {
                        IpAndPort ip = _keyFromDB(keyEntry);
                        key = ip.toString();
                    } catch (Exception e2) {
                        key = "[Corrupt Key]";
                    }
                    LOG.error("Invalid Node state entry in BDB, entry #{}, key '{}', skipping. Problem ({}): {}",
                            new Object[] { index, key, e.getClass().getName(), e.getMessage()});
View Full Code Here

    protected DatabaseEntry _key(String key) {
        return new DatabaseEntry(UTF8Encoder.encodeAsUTF8(key));
    }

    protected IpAndPort _keyFromDB(DatabaseEntry entry) {
        return new IpAndPort(UTF8Encoder.decodeFromUTF8(entry.getData()));
    }
View Full Code Here

                try {
                    all.add(_fromDB(data));
                } catch (Exception e) {
                    String key = "N/A";
                    try {
                        IpAndPort ip = _keyFromDB(keyEntry);
                        key = ip.toString();
                    } catch (Exception e2) {
                        key = "[Corrupt Key]";
                    }
                    LOG.error("Invalid Node state entry in BDB, entry #{}, key '{}', skipping. Problem ({}): {}",
                            new Object[] { index, key, e.getClass().getName(), e.getMessage()});
View Full Code Here

    protected DatabaseEntry _key(String key) {
        return new DatabaseEntry(UTF8Encoder.encodeAsUTF8(key));
    }

    protected IpAndPort _keyFromDB(DatabaseEntry entry) {
        return new IpAndPort(UTF8Encoder.decodeFromUTF8(entry.getData(),
                entry.getOffset(), entry.getSize()));
    }
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

                }
            }
        }
        for (int i = 0, end = nodes.size(); i < end; ++i) {
            NodeConfig node = nodes.get(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

     * @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 stateStore = _stores.getNodeStore();
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.