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.getHostName(), 7000);
        return new Message(from, StorageService.mutationStage_, verbHandlerName, bos.toByteArray());
    }
View Full Code Here


     * is reponsible for storing this key .
     */
    private static boolean checkIfProcessKey(String key)
    {
        EndPoint[] endPoints = StorageService.instance().getNStorageEndPoint(key);
        EndPoint localEndPoint = StorageService.getLocalStorageEndPoint();
        for(EndPoint endPoint : endPoints)
        {
            if(endPoint.equals(localEndPoint))
                return true;
        }
View Full Code Here

            for ( String node : nodes )
            {           
                logger_.debug("Processing node " + node);
                byte[] bytes = headers.remove(node);
                /* Send a message to this node to update its token to the one retreived. */
                EndPoint target = new EndPoint(node, DatabaseDescriptor.getStoragePort());
                token = new BigInteger(bytes);
               
                /* Reset the new TokenInfoMessage */
                tiMessage = new TokenUpdater.TokenInfoMessage(target, token );
                ByteArrayOutputStream bos = new ByteArrayOutputStream();
View Full Code Here

        String ipPort = args[0];
        String node = args[1];
        String file = args[2];
       
        String[] ipPortPair = ipPort.split(":");
        EndPoint target = new EndPoint(ipPortPair[0], Integer.valueOf(ipPortPair[1]));
        MembershipCleanerMessage mcMessage = new MembershipCleanerMessage(node);
       
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(bos);
        MembershipCleanerMessage.serializer().serialize(mcMessage, dos);
        /* Construct the token update message to be sent */
        Message mbrshipCleanerMessage = new Message( new EndPoint(FBUtilities.getHostName(), port_), "", StorageService.mbrshipCleanerVerbHandler_, new Object[]{bos.toByteArray()} );
       
        BufferedReader bufReader = new BufferedReader( new InputStreamReader( new FileInputStream(file) ) );
        String line = null;
      
        while ( ( line = bufReader.readLine() ) != null )
View Full Code Here

            /* Deserialize to get the token for this endpoint. */
            MembershipCleaner.MembershipCleanerMessage mcMessage = MembershipCleaner.MembershipCleanerMessage.serializer().deserialize(bufIn);
           
            String target = mcMessage.getTarget();
            logger_.info("Removing the node [" + target + "] from membership");
            EndPoint targetEndPoint = new EndPoint(target, DatabaseDescriptor.getControlPort());
            /* Remove the token related information for this endpoint */
            StorageService.instance().removeTokenState(targetEndPoint);
           
            /* Get the headers for this message */
            Map<String, byte[]> headers = message.getHeaders();
            headers.remove( StorageService.getLocalStorageEndPoint().getHost() );
            logger_.debug("Number of nodes in the header " + headers.size());
            Set<String> nodes = headers.keySet();
           
            for ( String node : nodes )
            {           
                logger_.debug("Processing node " + node);
                byte[] bytes = headers.remove(node);
                /* Send a message to this node to alter its membership state. */
                EndPoint targetNode = new EndPoint(node, DatabaseDescriptor.getStoragePort());               
               
                logger_.debug("Sending a membership clean message to " + targetNode);
                MessagingService.getMessagingInstance().sendOneWay(message, targetNode);
                break;
            }                       
View Full Code Here

        }
    RowMutationMessage rmMsg = new RowMutationMessage(rm);
        if( server_ != null)
        {
            Message message = RowMutationMessage.makeRowMutationMessage(rmMsg, StorageService.binaryVerbHandler_);
          EndPoint to = new EndPoint(server_, 7000);
      MessagingService.getMessagingInstance().sendOneWay(message, to);
        }
        else
        {
          for( String server : servers_ )
          {
                Message message = RowMutationMessage.makeRowMutationMessage(rmMsg, StorageService.binaryVerbHandler_);
            EndPoint to = new EndPoint(server, 7000);
        MessagingService.getMessagingInstance().sendOneWay(message, to);
          }
        }
  }
View Full Code Here

        String ipPort = args[0];
        String token = args[1];
        String file = args[2];
       
        String[] ipPortPair = ipPort.split(":");
        EndPoint target = new EndPoint(ipPortPair[0], Integer.valueOf(ipPortPair[1]));
        TokenInfoMessage tiMessage = new TokenInfoMessage( target, new BigInteger(token) );
       
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(bos);
        TokenInfoMessage.serializer().serialize(tiMessage, dos);
        /* Construct the token update message to be sent */
        Message tokenUpdateMessage = new Message( new EndPoint(FBUtilities.getHostName(), port_), "", StorageService.tokenVerbHandler_, new Object[]{bos.toByteArray()} );
       
        BufferedReader bufReader = new BufferedReader( new InputStreamReader( new FileInputStream(file) ) );
        String line = null;
      
        while ( ( line = bufReader.readLine() ) != null )
View Full Code Here

                logger_.debug("Merging the counting bloom filter in the sampler ...");               
                String[] peices = FBUtilities.strip(fileName, "-");
                Table.open(peices[0]).getColumnFamilyStore(peices[1]).addToList(streamContext.getTargetFile());               
            }
           
            EndPoint to = new EndPoint(host, DatabaseDescriptor.getStoragePort());
            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);
            MessagingService.getMessagingInstance().sendOneWay(message, to);          
View Full Code Here

        return zk_;
    }
   
    public boolean isLeader(EndPoint endpoint)
    {
        EndPoint leader = getLeader();
        return leader.equals(endpoint);
    }
View Full Code Here

    public void start() throws IOException
    {
        /* Start the DB */
        storageMetadata_ = DBManager.instance().start()
        /* Set up TCP endpoint */
        tcpAddr_ = new EndPoint(DatabaseDescriptor.getStoragePort());
        /* Set up UDP endpoint */
        udpAddr_ = new EndPoint(DatabaseDescriptor.getControlPort());
        /* Listen for application messages */
        MessagingService.getMessagingInstance().listen(tcpAddr_, false);
        /* Listen for control messages */
        MessagingService.getMessagingInstance().listenUDP(udpAddr_);
        /* Listen for HTTP messages */
        MessagingService.getMessagingInstance().listen( new EndPoint(DatabaseDescriptor.getHttpPort() ), true );
        /* start the analytics context package */
        AnalyticsContext.instance().start();
        /* starts a load timer thread */
        loadTimer_.schedule( new LoadDisseminator(), StorageService.threshold_, StorageService.threshold_);
       
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.