当前位置: 首页>>代码示例>>Java>>正文


Java MessagingService.VERSION_20属性代码示例

本文整理汇总了Java中org.apache.cassandra.net.MessagingService.VERSION_20属性的典型用法代码示例。如果您正苦于以下问题:Java MessagingService.VERSION_20属性的具体用法?Java MessagingService.VERSION_20怎么用?Java MessagingService.VERSION_20使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.cassandra.net.MessagingService的用法示例。


在下文中一共展示了MessagingService.VERSION_20属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deserialize

public ColumnFamily deserialize(DataInput in, ColumnFamily.Factory factory, ColumnSerializer.Flag flag, int version) throws IOException
{
    if (!in.readBoolean())
        return null;

    ColumnFamily cf = factory.create(Schema.instance.getCFMetaData(deserializeCfId(in, version)));

    if (cf.metadata().isSuper() && version < MessagingService.VERSION_20)
    {
        SuperColumns.deserializerSuperColumnFamily(in, cf, flag, version);
    }
    else
    {
        cf.delete(cf.getComparator().deletionInfoSerializer().deserialize(in, version));

        ColumnSerializer columnSerializer = cf.getComparator().columnSerializer();
        int size = in.readInt();
        for (int i = 0; i < size; ++i)
            cf.addColumn(columnSerializer.deserialize(in, flag));
    }
    return cf;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:22,代码来源:ColumnFamilySerializer.java

示例2: serializedSize

public long serializedSize(Mutation mutation, int version)
{
    TypeSizes sizes = TypeSizes.NATIVE;
    int size = 0;

    if (version < MessagingService.VERSION_20)
        size += sizes.sizeof(mutation.getKeyspaceName());

    int keySize = mutation.key().remaining();
    size += sizes.sizeof((short) keySize) + keySize;

    size += sizes.sizeof(mutation.modifications.size());
    for (Map.Entry<UUID,ColumnFamily> entry : mutation.modifications.entrySet())
        size += ColumnFamily.serializer.serializedSize(entry.getValue(), TypeSizes.NATIVE, version);

    return size;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:17,代码来源:Mutation.java

示例3: deserialize

public ColumnFamily deserialize(DataInput in, ColumnFamily.Factory factory, ColumnSerializer.Flag flag, int version) throws IOException
{
    if (!in.readBoolean())
        return null;

    ColumnFamily cf = factory.create(Schema.instance.getCFMetaData(deserializeCfId(in, version)));

    if (cf.metadata().isSuper() && version < MessagingService.VERSION_20)
    {
        SuperColumns.deserializerSuperColumnFamily(in, cf, flag, version);
    }
    else
    {
        cf.delete(DeletionInfo.serializer().deserialize(in, version, cf.getComparator()));

        ColumnSerializer columnSerializer = Column.serializer;
        int size = in.readInt();
        for (int i = 0; i < size; ++i)
            cf.addColumn(columnSerializer.deserialize(in, flag));
    }
    return cf;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:22,代码来源:ColumnFamilySerializer.java

示例4: contentSerializedSize

public long contentSerializedSize(ColumnFamily cf, TypeSizes typeSizes, int version)
{
    long size = 0L;

    if (cf.metadata().isSuper() && version < MessagingService.VERSION_20)
    {
        size += SuperColumns.serializedSize(cf, typeSizes, version);
    }
    else
    {
        size += DeletionInfo.serializer().serializedSize(cf.deletionInfo(), typeSizes, version);
        size += typeSizes.sizeof(cf.getColumnCount());
        for (Column column : cf)
            size += column.serializedSize(typeSizes);
    }
    return size;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:17,代码来源:ColumnFamilySerializer.java

示例5: serializedSize

public long serializedSize(RowMutation rm, int version)
{
    TypeSizes sizes = TypeSizes.NATIVE;
    int size = 0;

    if (version < MessagingService.VERSION_20)
        size += sizes.sizeof(rm.getKeyspaceName());

    int keySize = rm.key().remaining();
    size += sizes.sizeof((short) keySize) + keySize;

    size += sizes.sizeof(rm.modifications.size());
    for (Map.Entry<UUID,ColumnFamily> entry : rm.modifications.entrySet())
        size += ColumnFamily.serializer.serializedSize(entry.getValue(), TypeSizes.NATIVE, version);

    return size;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:17,代码来源:RowMutation.java

示例6: getMessagingVersion

public int getMessagingVersion()
{
    switch (version)
    {
        case VERSION_12:
            return MessagingService.VERSION_12;
        case VERSION_20:
            return MessagingService.VERSION_20;
        case VERSION_21:
            return MessagingService.VERSION_21;
        case VERSION_22:
            return MessagingService.VERSION_22;
        case VERSION_30:
            return MessagingService.VERSION_30;
        default:
            throw new IllegalStateException("Unknown commitlog version " + version);
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:18,代码来源:CommitLogDescriptor.java

示例7: serializedSize

public long serializedSize(Mutation mutation, int version)
{
    int size = 0;

    if (version < MessagingService.VERSION_20)
        size += TypeSizes.sizeof(mutation.getKeyspaceName());

    if (version < MessagingService.VERSION_30)
    {
        int keySize = mutation.key().getKey().remaining();
        size += TypeSizes.sizeof((short) keySize) + keySize;
        size += TypeSizes.sizeof(mutation.modifications.size());
    }
    else
    {
        size += TypeSizes.sizeofUnsignedVInt(mutation.modifications.size());
    }

    for (Map.Entry<UUID, PartitionUpdate> entry : mutation.modifications.entrySet())
        size += PartitionUpdate.serializer.serializedSize(entry.getValue(), version);

    return size;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:23,代码来源:Mutation.java

示例8: enqueue

public synchronized void enqueue(MessageOut<?> message, int id) throws IOException {
    long timestamp = System.currentTimeMillis();
    out.writeInt(MessagingService.PROTOCOL_MAGIC);

    if (targetVersion < MessagingService.VERSION_20)
        out.writeUTF(String.valueOf(id));
    else
        out.writeInt(id);
    out.writeInt((int) timestamp);
    message.serialize(out, targetVersion);
    out.flush();
}
 
开发者ID:tolbertam,项目名称:sstable-tools,代码行数:12,代码来源:StorageConnection.java

示例9: markAlive

private void markAlive(final InetAddress addr, final EndpointState localState)
{
    if (MessagingService.instance().getVersion(addr) < MessagingService.VERSION_20)
    {
        realMarkAlive(addr, localState);
        return;
    }

    localState.markDead();

    MessageOut<EchoMessage> echoMessage = new MessageOut<EchoMessage>(MessagingService.Verb.ECHO, new EchoMessage(), EchoMessage.serializer);
    logger.trace("Sending a EchoMessage to {}", addr);
    IAsyncCallback echoHandler = new IAsyncCallback()
    {
        public boolean isLatencyForSnitch()
        {
            return false;
        }

        public void response(MessageIn msg)
        {
            realMarkAlive(addr, localState);
        }
    };

    MessagingService.instance().sendRR(echoMessage, addr, echoHandler);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:27,代码来源:Gossiper.java

示例10: getMessagingVersion

public int getMessagingVersion()
{
    switch (version)
    {
        case VERSION_12:
            return MessagingService.VERSION_12;
        case VERSION_20:
            return MessagingService.VERSION_20;
        case VERSION_21:
            return MessagingService.VERSION_21;
        default:
            throw new IllegalStateException("Unknown commitlog version " + version);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:14,代码来源:CommitLogDescriptor.java

示例11: deserialize

public RangeTombstoneList deserialize(DataInput in, int version) throws IOException
{
    int size = in.readInt();
    if (size == 0)
        return null;

    RangeTombstoneList tombstones = new RangeTombstoneList(type, size);

    for (int i = 0; i < size; i++)
    {
        Composite start = type.serializer().deserialize(in);
        Composite end = type.serializer().deserialize(in);
        int delTime =  in.readInt();
        long markedAt = in.readLong();

        if (version >= MessagingService.VERSION_20)
        {
            tombstones.setInternal(i, start, end, markedAt, delTime);
        }
        else
        {
            /*
             * The old implementation used to have range sorted by left value, but with potentially
             * overlapping range. So we need to use the "slow" path.
             */
            tombstones.add(start, end, markedAt, delTime);
        }
    }

    // The "slow" path take care of updating the size, but not the fast one
    if (version >= MessagingService.VERSION_20)
        tombstones.size = size;
    return tombstones;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:34,代码来源:RangeTombstoneList.java

示例12: deserialize

public RangeTombstoneList deserialize(DataInput in, int version, Comparator<ByteBuffer> comparator) throws IOException
{
    int size = in.readInt();
    if (size == 0)
        return null;

    RangeTombstoneList tombstones = new RangeTombstoneList(comparator, size);

    for (int i = 0; i < size; i++)
    {
        ByteBuffer start = ByteBufferUtil.readWithShortLength(in);
        ByteBuffer end = ByteBufferUtil.readWithShortLength(in);
        int delTime =  in.readInt();
        long markedAt = in.readLong();

        if (version >= MessagingService.VERSION_20)
        {
            tombstones.setInternal(i, start, end, markedAt, delTime);
        }
        else
        {
            /*
             * The old implementation used to have range sorted by left value, but with potentially
             * overlapping range. So we need to use the "slow" path.
             */
            tombstones.add(start, end, markedAt, delTime);
        }
    }

    // The "slow" path take care of updating the size, but not the fast one
    if (version >= MessagingService.VERSION_20)
        tombstones.size = size;
    return tombstones;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:34,代码来源:RangeTombstoneList.java

示例13: markAlive

private void markAlive(final InetAddress addr, final EndpointState localState)
{
    if (MessagingService.instance().getVersion(addr) < MessagingService.VERSION_20)
    {
        realMarkAlive(addr, localState);
        return;
    }

    localState.markDead();

    MessageOut<EchoMessage> echoMessage = new MessageOut<EchoMessage>(MessagingService.Verb.ECHO, EchoMessage.instance, EchoMessage.serializer);
    logger.trace("Sending a EchoMessage to {}", addr);
    IAsyncCallback echoHandler = new IAsyncCallback()
    {
        public boolean isLatencyForSnitch()
        {
            return false;
        }

        public void response(MessageIn msg)
        {
            realMarkAlive(addr, localState);
        }
    };

    MessagingService.instance().sendRR(echoMessage, addr, echoHandler);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:27,代码来源:Gossiper.java


注:本文中的org.apache.cassandra.net.MessagingService.VERSION_20属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。