@Override
    public List<Node> getNodes(ByteArray key) {
        logger.debug("Giving pref to localhost ! ");
        List<Node> nodes = null;
        List<Node> reorderedNodes = new ArrayList<Node>();

        try {
            nodes = super.getNodes(key);
            if(nodes == null) {
                return null;
            }

            String currentHost = InetAddress.getLocalHost().getHostName();
            for(Node n: nodes) {
                if(currentHost.contains(n.getHost()) || n.getHost().contains(currentHost)) {
                    logger.debug("Found localhost ! ");
                    reorderedNodes.add(n);
                    nodes.remove(n);
                    break;
                }
            }
            reorderedNodes.addAll(nodes);
            nodes = reorderedNodes;
        } catch(VoldemortException e) {
            pipelineData.setFatalError(e);
            return null;
        } catch(UnknownHostException e) {
            e.printStackTrace();
            return null;
        }
        return nodes;
    }
@ Override public List < Node > getNodes ( ByteArray key ) { logger . debug ( "Giving pref to localhost ! " ) ; List < Node > nodes = null ; List < Node > reorderedNodes = new ArrayList < Node > ( ) ; try { nodes = super . getNodes ( key ) ; if ( nodes == null ) { return null ; } String currentHost = InetAddress . getLocalHost ( ) . getHostName ( ) ; for ( Node n : nodes ) { if ( currentHost . contains ( n . getHost ( ) ) || n . getHost ( ) . contains ( currentHost ) ) { logger . debug ( "Found localhost ! " ) ; reorderedNodes . add ( n ) ; nodes . remove ( n ) ; break ; } } reorderedNodes . addAll ( nodes ) ; nodes = reorderedNodes ; } catch ( VoldemortException e ) { pipelineData . setFatalError ( e ) ; return null ; } catch ( UnknownHostException e ) { e . printStackTrace ( ) ; return null ; } return nodes ; }
/*
If the current node exists in the nodes list, bring it to the front