Package com.fasterxml.clustermate.service

Examples of com.fasterxml.clustermate.service.NodeStateStore


        }

        LOG.info("Node definition used for this host: {}, found {} configured peer nodes",
            localDef, nodeDefs.size());
       
        final NodeStateStore nodes = _stores.getNodeStore();
        // Next: load state definitions from BDB
        List<ActiveNodeState> storedStates = nodes.readAll(_keyspace);
        LOG.info("Read {} persisted node entries from local store", storedStates.size());

        // First things first: find and update node for local node
        ActiveNodeState localAct = _remove(storedStates, localDef.getAddress());
        if (localAct == null) { // need to create?
            if (!_stuff.isRunningTests()) {
                LOG.warn("No persisted entry for local node: will create and store one");
            }
            localAct = new ActiveNodeState(localDef, _startTime);
        } else {
            // index may have changed; if so, override
            if (localAct.getIndex() != localDef.getIndex()) {
                LOG.warn("Node index of current node changed from {} to {} -- may change key range!",
                        localAct.getIndex(), localDef.getIndex());
                localAct = localAct.withIndex(localDef.getIndex());
            }
        }
        // one more thing: force dummy update on restart as well (official startup time too)
        localAct = localAct.withLastUpdated(_startTime);
        // Either way, need to update persisted version
        nodes.upsertEntry(localAct);
       
        // then merge entries; create/delete orphans
        Map<IpAndPort,ActiveNodeState> activeState = _mergeStates(nodes,
                localAct, nodeDefs, storedStates);
View Full Code Here


        }

        LOG.info("Node definition used for this host: {}, found {} configured peer nodes",
            localDef, nodeDefs.size());
       
        final NodeStateStore nodes = _stores.getNodeStore();
        // Next: load state definitions from BDB
        List<ActiveNodeState> storedStates = nodes.readAll(_keyspace);
        LOG.info("Read {} persisted node entries from local store", storedStates.size());

        // First things first: find and update node for local node
        ActiveNodeState localAct = _remove(storedStates, localDef.getAddress());
        if (localAct == null) { // need to create?
            if (!_stuff.isRunningTests()) {
                LOG.warn("No persisted entry for local node: will create and store one");
            }
            localAct = new ActiveNodeState(localDef, _startTime);
        } else {
            // index may have changed; if so, override
            if (localAct.getIndex() != localDef.getIndex()) {
                LOG.warn("Node index of current node changed from {} to {} -- may change key range!",
                        localAct.getIndex(), localDef.getIndex());
                localAct = localAct.withIndex(localDef.getIndex());
            }
        }
        // one more thing: force dummy update on restart as well (official startup time too)
        localAct = localAct.withLastUpdated(_startTime);
        // Either way, need to update persisted version
        nodes.upsertEntry(localAct);
       
        // then merge entries; create/delete orphans
        Map<IpAndPort,ActiveNodeState> activeState = _mergeStates(nodes,
                localAct, nodeDefs, storedStates);
View Full Code Here

        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();
        ActiveNodeState initialStatus = new ActiveNodeState(_localState, nodeStatus,
                _timeMaster.currentTimeMillis());
        // TODO: should perhaps also find by index + range?
        ActiveNodeState oldState = stateStore.findEntry(endpoint);

        ClusterPeerImpl<K,E> peer = null;
        // First common case: info was persisted earlier; we just "unthaw it"
        if (oldState != null) {
            if (oldState.equals(initialStatus)) {
View Full Code Here

TOP

Related Classes of com.fasterxml.clustermate.service.NodeStateStore

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.