本文整理汇总了Java中org.apache.cassandra.net.MessagingService.VERSION_22属性的典型用法代码示例。如果您正苦于以下问题:Java MessagingService.VERSION_22属性的具体用法?Java MessagingService.VERSION_22怎么用?Java MessagingService.VERSION_22使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.cassandra.net.MessagingService
的用法示例。
在下文中一共展示了MessagingService.VERSION_22属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: testSerializationNonCurrentVersion
/**
* This is just to test decodeMutations() when deserializing,
* since Batch will never be serialized at a version 2.2.
* @throws IOException
*/
@Test
public void testSerializationNonCurrentVersion() throws IOException
{
CFMetaData cfm = Keyspace.open(KEYSPACE).getColumnFamilyStore(CF_STANDARD).metadata;
long now = FBUtilities.timestampMicros();
int version = MessagingService.VERSION_22;
UUID uuid = UUIDGen.getTimeUUID();
List<Mutation> mutations = new ArrayList<>(10);
for (int i = 0; i < 10; i++)
{
mutations.add(new RowUpdateBuilder(cfm, FBUtilities.timestampMicros(), bytes(i))
.clustering("name" + i)
.add("val", "val" + i)
.build());
}
Batch batch1 = Batch.createLocal(uuid, now, mutations);
assertEquals(uuid, batch1.id);
assertEquals(now, batch1.creationTime);
assertEquals(mutations, batch1.decodedMutations);
DataOutputBuffer out = new DataOutputBuffer();
Batch.serializer.serialize(batch1, out, version);
assertEquals(out.getLength(), Batch.serializer.serializedSize(batch1, version));
DataInputPlus dis = new DataInputBuffer(out.getData());
Batch batch2 = Batch.serializer.deserialize(dis, version);
assertEquals(batch1.id, batch2.id);
assertEquals(batch1.creationTime, batch2.creationTime);
assertEquals(batch1.decodedMutations.size(), batch2.decodedMutations.size());
Iterator<Mutation> it1 = batch1.decodedMutations.iterator();
Iterator<Mutation> it2 = batch2.decodedMutations.iterator();
while (it1.hasNext())
assertEquals(it1.next().toString(), it2.next().toString());
}