Package org.apache.cassandra.net

Examples of org.apache.cassandra.net.Message


            testRangeSliceCommandWrite();
       
        DataInputStream in = getInput("db.RangeSliceCommand.bin");
        for (int i = 0; i < 6; i++)
        {
            Message msg = messageSerializer.deserialize(in, getVersion());
            RangeSliceCommand cmd = RangeSliceCommand.read(msg);
        }
        in.close();
    }
View Full Code Here


    public Message getMessage(Integer version) throws IOException
    {
        DataOutputBuffer dob = new DataOutputBuffer();
        serializer.serialize(this, dob, version);
        return new Message(FBUtilities.getBroadcastAddress(), StorageService.Verb.SNAPSHOT, Arrays.copyOf(dob.getData(), dob.getLength()), version);
    }
View Full Code Here

        Header header = Header.serializer().deserialize(input, version);

        int bodySize = input.readInt();
        byte[] body = new byte[bodySize];
        input.readFully(body);
        Message message = new Message(header, body, version);
        assert message.getVerb() == StorageService.Verb.STREAM_REPLY : "Non-reply message received on stream socket";
        handler.doVerb(message, id);
    }
View Full Code Here

        StageManager.getStage(Stage.MIGRATION).submit(new WrappedRunnable()
        {
            public void runMayThrow() throws Exception
            {
                Message message = new Message(FBUtilities.getBroadcastAddress(),
                                              StorageService.Verb.MIGRATION_REQUEST,
                                              ArrayUtils.EMPTY_BYTE_ARRAY,
                                              Gossiper.instance.getVersion(endpoint));

                int retries = 0;
                while (retries < MIGRATION_REQUEST_RETRIES)
                {
                    if (!FailureDetector.instance.isAlive(endpoint))
                    {
                        logger.error("Can't send migration request: node {} is down.", endpoint);
                        return;
                    }

                    IAsyncResult iar = MessagingService.instance().sendRR(message, endpoint);

                    try
                    {
                        byte[] reply = iar.get(DatabaseDescriptor.getRpcTimeout(), TimeUnit.MILLISECONDS);

                        DefsTable.mergeRemoteSchema(reply, message.getVersion());
                        return;
                    }
                    catch(TimeoutException e)
                    {
                        retries++;
View Full Code Here

    private static void pushSchemaMutation(InetAddress endpoint, Collection<RowMutation> schema)
    {
        try
        {
            Message msg = makeMigrationMessage(schema, Gossiper.instance.getVersion(endpoint));
            MessagingService.instance().sendOneWay(msg, endpoint);
        }
        catch (IOException ex)
        {
            throw new IOError(ex);
View Full Code Here

     *
     * @throws IOException on failed serialization
     */
    private static Message makeMigrationMessage(Collection<RowMutation> schema, int version) throws IOException
    {
        return new Message(FBUtilities.getBroadcastAddress(), StorageService.Verb.DEFINITIONS_UPDATE, serializeSchema(schema, version), version);
    }
View Full Code Here

        return getMessage(StorageService.Verb.MUTATION, version);
    }

    public Message getMessage(StorageService.Verb verb, int version) throws IOException
    {
        return new Message(FBUtilities.getBroadcastAddress(), verb, getSerializedBuffer(version), version);
    }
View Full Code Here

        }
        catch (IOException e)
        {
            throw new IOError(e);
        }
        return new Message(FBUtilities.getBroadcastAddress(),
                           StorageService.Verb.INDEX_SCAN,
                           Arrays.copyOf(dob.getData(), dob.getLength()),
                           version);
    }
View Full Code Here

    }

    public Message makeMutationMessage(int version) throws IOException
    {
        byte[] bytes = FBUtilities.serialize(this, serializer, version);
        return new Message(FBUtilities.getBroadcastAddress(), StorageService.Verb.COUNTER_MUTATION, bytes, version);
    }
View Full Code Here

     * @param remote node to send notification to
     */
    private void sendReplicationNotification(InetAddress local, InetAddress remote)
    {
        // notify the remote token
        Message msg = new Message(local, StorageService.Verb.REPLICATION_FINISHED, new byte[0], Gossiper.instance.getVersion(remote));
        IFailureDetector failureDetector = FailureDetector.instance;
        if (logger_.isDebugEnabled())
            logger_.debug("Notifying " + remote.toString() + " of replication completion\n");
        while (failureDetector.isAlive(remote))
        {
View Full Code Here

TOP

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

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.