Package org.apache.cassandra.net

Examples of org.apache.cassandra.net.EndPoint


    public Message makeRowMutationMessage(String verbHandlerName) throws IOException
    {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(bos);
        serializer().serialize(this, dos);
        EndPoint local = StorageService.getLocalStorageEndPoint();
        EndPoint from = (local != null) ? local : new EndPoint(FBUtilities.getHostAddress(), 7000);
        return new Message(from, StorageService.mutationStage_, verbHandlerName, bos.toByteArray());
    }
View Full Code Here


                {
                    logger_.error("Not able to bootstrap with file " + streamContext.getTargetFile(), e);                   
                }
            }
           
            EndPoint to = new EndPoint(host, DatabaseDescriptor.getStoragePort());
            if (logger_.isDebugEnabled())
              logger_.debug("Sending a bootstrap terminate message with " + streamStatus + " to " + to);
            /* Send a StreamStatusMessage object which may require the source node to re-stream certain files. */
            StreamContextManager.StreamStatusMessage streamStatusMessage = new StreamContextManager.StreamStatusMessage(streamStatus);
            Message message = StreamContextManager.StreamStatusMessage.makeStreamStatusMessage(streamStatusMessage);
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);
                if (logger_.isDebugEnabled())
                  logger_.debug("Adding hint for " + hint);
                /* add necessary hints to this mutation */
                RowMutation hintedMutation = new RowMutation(Table.SYSTEM_TABLE, rm.table());
                hintedMutation.addHints(rm.key(), hint.getHost());
                hintedMutation.apply();
            }

            rowMutationCtx.row_.clear();
            rowMutationCtx.row_.setTable(rm.table());
View Full Code Here

     */
    public void callMe(String target,
        Message message)
    {
      String[] pieces = FBUtilities.strip(target, ":");
      EndPoint to = new EndPoint(pieces[0], Integer.parseInt(pieces[1]));
      MessagingService.getMessagingInstance().sendOneWay(message, to);     
    }
View Full Code Here

    }
    */

    private boolean isANeighbour(EndPoint neighbour)
    {
        EndPoint predecessor = storageService_.getPredecessor(StorageService.getLocalStorageEndPoint());
        if ( predecessor.equals(neighbour) )
            return true;

        EndPoint successor = storageService_.getSuccessor(StorageService.getLocalStorageEndPoint());
        if ( successor.equals(neighbour) )
            return true;

        return false;
    }
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_);
        if (logger_.isTraceEnabled())
            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);
        if (logger_.isTraceEnabled())
            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(InetAddress.getByName(seedHost).getHostAddress(),
                                         DatabaseDescriptor.getControlPort());
            if ( seed.equals(localEndPoint) )
                continue;
            seeds_.add(seed);
        }

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

{
    private static Logger logger_ = Logger.getLogger( JoinVerbHandler.class);

    public void doVerb(Message message)
    {
        EndPoint from = message.getFrom();
        if (logger_.isDebugEnabled())
          logger_.debug("Received a JoinMessage from " + from);

        byte[] bytes = message.getMessageBody();
        DataInputStream dis = new DataInputStream( new ByteArrayInputStream(bytes) );
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.