Package org.apache.cassandra.net

Examples of org.apache.cassandra.net.EndPoint


    }
    */

    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


    {       
        /* node identifier for this endpoint on the identifier space */
        ApplicationState leaderState = epState.getApplicationState(LeaderElector.leaderState_);
        if (leaderState != null && !leader_.equals(endpoint))
        {
            EndPoint leader = EndPoint.fromString( leaderState.getState() );
            logger_.debug("New leader in the cluster is " + leader);
            leader_.set(endpoint);
        }
    }
View Full Code Here

                    /* Deploy locally */
                    CalloutManager.instance().addCallout(callout, script);
                }
                else
                {
                    EndPoint to = new EndPoint(mbr.getHost(), DatabaseDescriptor.getStoragePort());
                    logger_.debug("Deploying the script to " + mbr);
                    MessagingService.getMessagingInstance().sendOneWay(message, to);
                }
            }
        }
View Full Code Here

    Map<EndPoint, Message> messageMap = new HashMap<EndPoint, Message>();
    Message message = rm.makeRowMutationMessage();

    for (Map.Entry<EndPoint, EndPoint> entry : endpointMap.entrySet())
    {
            EndPoint target = entry.getKey();
            EndPoint hint = entry.getValue();
            if ( !target.equals(hint) )
      {
        Message hintedMessage = rm.makeRowMutationMessage();
        hintedMessage.addHeader(RowMutation.HINT, EndPoint.toBytes(hint) );
        logger_.debug("Sending the hint of " + target.getHost() + " to " + hint.getHost());
        messageMap.put(target, hintedMessage);
      }
      else
      {
        messageMap.put(target, message);
View Full Code Here

     * @return the row associated with command.key
     * @throws Exception
     */
    private static Row weakReadRemote(ReadCommand command) throws IOException
    {
        EndPoint endPoint = StorageService.instance().findSuitableEndPoint(command.key);
        assert endPoint != null;
        logger_.debug("weakreadremote reading " + command + " from " + endPoint);
        Message message = command.makeReadMessage();
        message.addHeader(ReadCommand.DO_REPAIR, ReadCommand.DO_REPAIR.getBytes());
        IAsyncResult iar = MessagingService.getMessagingInstance().sendRR(message, endPoint);
View Full Code Here

    table.touch(key, fData);
    }

    static void weakTouchProtocol(String tablename, String key, boolean fData) throws Exception
    {
      EndPoint endPoint = null;
      try
      {
        endPoint = StorageService.instance().findSuitableEndPoint(key);
      }
      catch( Throwable ex)
      {
        ex.printStackTrace();
      }
      if(endPoint != null)
      {
        if(endPoint.equals(StorageService.getLocalStorageEndPoint()))
        {
            touch_local(tablename, key, fData);
            return;
          }
            TouchMessage touchMessage = null;
View Full Code Here

        IResponseResolver<Row> readResponseResolver = new ReadResponseResolver();
        QuorumResponseHandler<Row> quorumResponseHandler = new QuorumResponseHandler<Row>(
                DatabaseDescriptor.getReplicationFactor(),
                readResponseResolver);
        EndPoint dataPoint = StorageService.instance().findSuitableEndPoint(command.key);
        List<EndPoint> endpointList = new ArrayList<EndPoint>(Arrays.asList(StorageService.instance().getNStorageEndPoint(command.key)));
        /* Remove the local storage endpoint from the list. */
        endpointList.remove(dataPoint);
        EndPoint[] endPoints = new EndPoint[endpointList.size() + 1];
        Message messages[] = new Message[endpointList.size() + 1];
View Full Code Here

       
        int i = 0;
        for ( String key : keys )
        {
            /* This is the primary */
            EndPoint dataPoint = StorageService.instance().findSuitableEndPoint(key);
            List<EndPoint> replicas = new ArrayList<EndPoint>( StorageService.instance().getNLiveStorageEndPoint(key) );
            replicas.remove(dataPoint);
            /* Get the messages to be sent index 0 is the data messages and index 1 is the digest message */
            Message[] message = messages.get(key);          
            msgList[i][0] = message[0];
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

     * is reponsible for storing this key .
     */
    boolean checkIfProcessKey(String key)
    {
    EndPoint[] endPoints = storageService_.getNStorageEndPoint(key);
      EndPoint localEndPoint = StorageService.getLocalStorageEndPoint();
      for(EndPoint endPoint : endPoints)
      {
        if(endPoint.equals(localEndPoint))
          return true;
      }
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.