Package org.apache.cassandra.net

Examples of org.apache.cassandra.net.EndPoint


                map.put(topN[i], topN[i]);
                liveList.add(topN[i]) ;
            }
            else
            {
                EndPoint endPoint = getNextAvailableEndPoint(topN[i], Arrays.asList(topN), liveList);
                if(endPoint != null)
                {
                    map.put(endPoint, topN[i]);
                    liveList.add(endPoint) ;
                }
View Full Code Here


        catch( UnknownHostException ex )
        {
            logger_.info( LogUtil.throwableToString(ex) );
        }
      /* Incoming port is assumed to be the Storage port. We need to change it to the control port */
      EndPoint ep2 = new EndPoint(ep.getHost(), DatabaseDescriptor.getControlPort());       
        EndPointState epState = Gossiper.instance().getEndPointStateForEndPoint(ep2);
        return epState.isAlive();
    }
View Full Code Here

            /* Check if there were any hints in this message */
            byte[] hintedBytes = message.getHeader(RowMutation.HINT);
            if ( hintedBytes != null && hintedBytes.length > 0 )
            {
              EndPoint hint = EndPoint.fromBytes(hintedBytes);
                logger_.debug("Adding hint for " + hint);
                /* add necessary hints to this mutation */
                RowMutation hintedMutation = new RowMutation(rm.table(), HintedHandOffManager.key_);
                hintedMutation.addHints(rm.key() + ":" + hint.getHost());
                hintedMutation.apply();
            }

            long start = System.currentTimeMillis();

View Full Code Here

    }

    public Set<EndPoint> getLiveMembers()
    {
        Set<EndPoint> liveMbrs = new HashSet<EndPoint>(liveEndpoints_);
        liveMbrs.add( new EndPoint( localEndPoint_.getHost(), localEndPoint_.getPort() ) );
        return liveMbrs;
    }
View Full Code Here

        if ( rrIndex_ >= size )
        {
            rrIndex_ = -1;
        }

        EndPoint to = eps.get(++rrIndex_);
        logger_.trace("Sending a GossipDigestSynMessage to " + to + " ...");
        MessagingService.getMessagingInstance().sendUdpOneWay(message, to);
        return seeds_.contains(to);
    }
View Full Code Here

    {
        int size = epSet.size();
        /* Generate a random number from 0 -> size */
        List<EndPoint> liveEndPoints = new ArrayList<EndPoint>(epSet);
        int index = (size == 1) ? 0 : random_.nextInt(size);
        EndPoint to = liveEndPoints.get(index);
        logger_.trace("Sending a GossipDigestSynMessage to " + to + " ...");
        MessagingService.getMessagingInstance().sendUdpOneWay(message, to);
        return seeds_.contains(to);
    }
View Full Code Here

        localEndPoint_ = localEndPoint;
        /* Get the seeds from the config and initialize them. */
        Set<String> seedHosts = DatabaseDescriptor.getSeeds();
        for( String seedHost : seedHosts )
        {
            EndPoint seed = new EndPoint(seedHost, DatabaseDescriptor.getControlPort());
            if ( seed.equals(localEndPoint) )
                continue;
            seeds_.add(seed);
        }

        /* initialize the heartbeat state for this localEndPoint */
 
View Full Code Here

        List<String> fileList = new ArrayList<String>();
        List<Range> ranges  = new ArrayList<Range>();
        Range r = new Range(new StringToken("0"), new StringToken("zzzzzz"));
        ranges.add(r);

        boolean result = store.doAntiCompaction(ranges, new EndPoint("127.0.0.1", 9150), fileList);

        assertEquals(true, result); // some keys should have qualified
        assertEquals(true, fileList.size() >= 3); //Data, index, filter files
    }
View Full Code Here

        }
    }

    protected EndPoint getNextAvailableEndPoint(EndPoint startPoint, List<EndPoint> topN, List<EndPoint> liveNodes)
    {
        EndPoint endPoint = null;
        Map<Token, EndPoint> tokenToEndPointMap = tokenMetadata_.cloneTokenEndPointMap();
        List tokens = new ArrayList(tokenToEndPointMap.keySet());
        Collections.sort(tokens);
        Token token = tokenMetadata_.getToken(startPoint);
        int index = Collections.binarySearch(tokens, token);
        if(index < 0)
        {
            index = (index + 1) * (-1);
            if (index >= tokens.size())
                index = 0;
        }
        int totalNodes = tokens.size();
        int startIndex = (index+1)%totalNodes;
        for (int i = startIndex, count = 1; count < totalNodes ; ++count, i = (i+1)%totalNodes)
        {
            EndPoint tmpEndPoint = tokenToEndPointMap.get(tokens.get(i));
            if(FailureDetector.instance().isAlive(tmpEndPoint) && !topN.contains(tmpEndPoint) && !liveNodes.contains(tmpEndPoint))
            {
                endPoint = tmpEndPoint;
                break;
            }
View Full Code Here

                map.put(topN[i], topN[i]);
                liveList.add(topN[i]) ;
            }
            else
            {
                EndPoint endPoint = getNextAvailableEndPoint(topN[i], Arrays.asList(topN), liveList);
                if(endPoint != null)
                {
                    map.put(endPoint, topN[i]);
                    liveList.add(endPoint) ;
                }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.net.EndPoint

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.