本文整理汇总了Java中com.netflix.astyanax.serializers.LongSerializer类的典型用法代码示例。如果您正苦于以下问题:Java LongSerializer类的具体用法?Java LongSerializer怎么用?Java LongSerializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LongSerializer类属于com.netflix.astyanax.serializers包,在下文中一共展示了LongSerializer类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupColumnFamilies
import com.netflix.astyanax.serializers.LongSerializer; //导入依赖的package包/类
private void setupColumnFamilies()
{
this.scheduledUrlColumn = ColumnFamily
.newColumnFamily(SCHEDULED_COLUMN_NAME, LongSerializer.get(),
StringSerializer.get());
this.crawledUrlColumn = ColumnFamily
.newColumnFamily(CRAWLED_COLUMN_NAME, IntegerSerializer.get(),
StringSerializer.get());
this.robotsTxtColumn = ColumnFamily
.newColumnFamily(ROBOTSTXT_COLUMN_NAME, StringSerializer.get(),
StringSerializer.get());
this.hostColumn = ColumnFamily.newColumnFamily(HOST_COLUMN_NAME, StringSerializer.get(), StringSerializer.get());
try {
keyspace.createColumnFamily(crawledUrlColumn, null);
keyspace.createColumnFamily(scheduledUrlColumn, null);
keyspace.createColumnFamily(robotsTxtColumn, null);
keyspace.createColumnFamily(hostColumn, null);
} catch (ConnectionException e) {
e.printStackTrace();
}
}
示例2: AstyanaxCassandraContentStore
import com.netflix.astyanax.serializers.LongSerializer; //导入依赖的package包/类
private AstyanaxCassandraContentStore(
AstyanaxContext<Keyspace> context,
String cfName,
ConsistencyLevel readConsistency,
ConsistencyLevel writeConsistency,
ContentHasher hasher,
IdGenerator idGenerator,
MessageSender<ResourceUpdatedMessage> sender,
EquivalenceGraphStore graphStore,
Clock clock,
MetricRegistry metricRegistry,
String metricPrefix
) {
super(hasher, idGenerator, sender, graphStore, clock, metricRegistry, metricPrefix);
this.keyspace = checkNotNull(context.getClient());
this.readConsistency = checkNotNull(readConsistency);
this.writeConsistency = checkNotNull(writeConsistency);
this.mainCf = ColumnFamily.newColumnFamily(checkNotNull(cfName),
LongSerializer.get(), StringSerializer.get()
);
this.aliasIndex = AliasIndex.create(keyspace, cfName + "_aliases");
}
示例3: CassandraTopicStore
import com.netflix.astyanax.serializers.LongSerializer; //导入依赖的package包/类
public CassandraTopicStore(
AstyanaxContext<Keyspace> context,
String cfName,
ConsistencyLevel readCl,
ConsistencyLevel writeCl,
Equivalence<? super Topic> equivalence,
IdGenerator idGenerator,
MessageSender<ResourceUpdatedMessage> sender,
Clock clock,
MetricRegistry metricRegistry,
String metricPrefix
) {
super(idGenerator, equivalence, sender, clock, metricRegistry, metricPrefix);
this.keyspace = checkNotNull(context.getClient());
this.readConsistency = checkNotNull(readCl);
this.writeConsistency = checkNotNull(writeCl);
this.mainCf = ColumnFamily.newColumnFamily(checkNotNull(cfName),
LongSerializer.get(), StringSerializer.get()
);
this.aliasIndex = AliasIndex.create(keyspace, cfName + "_aliases");
}
示例4: getColumnFamilyViaColumnName
import com.netflix.astyanax.serializers.LongSerializer; //导入依赖的package包/类
/**
* returns a ColumnFamily given a columnFamilyName
* @param columnFamilyName
* @param rowKeyClass
* @return a constructed ColumnFamily
*/
@SuppressWarnings({"unchecked", "rawtypes"})
protected ColumnFamily getColumnFamilyViaColumnName(String columnFamilyName, Class rowKeyClass) {
if (rowKeyClass == String.class) {
return new ColumnFamily(columnFamilyName, StringSerializer.get(), StringSerializer.get());
} else if (rowKeyClass == Integer.class) {
return new ColumnFamily(columnFamilyName, IntegerSerializer.get(), StringSerializer.get());
} else if (rowKeyClass == Long.class) {
return new ColumnFamily(columnFamilyName, LongSerializer.get(), StringSerializer.get());
} else {
throw new IllegalArgumentException("RowKeyType is not supported: " + rowKeyClass.getSimpleName() + ". String/Integer/Long are supported, or you can define the ColumnFamily yourself and use the other constructor.");
}
}
示例5: getHecubaClientManager
import com.netflix.astyanax.serializers.LongSerializer; //导入依赖的package包/类
public HecubaClientManager<Long> getHecubaClientManager(CassandraParamsBean paramsBean) {
return new AstyanaxBasedHecubaClientManager<Long>(paramsBean, LongSerializer.get());
}
示例6: MetricColumnFamily
import com.netflix.astyanax.serializers.LongSerializer; //导入依赖的package包/类
public MetricColumnFamily(String name, TimeValue ttl) {
super(name, LocatorSerializer.get(), LongSerializer.get());
this.ttl = ttl;
}
示例7: readLong
import com.netflix.astyanax.serializers.LongSerializer; //导入依赖的package包/类
@Override
public Long readLong() {
return read( LongSerializer.get() );
}
示例8: testWritingResolvingContainerWhichOnlyChildRefsThrowsCorrectException
import com.netflix.astyanax.serializers.LongSerializer; //导入依赖的package包/类
@Test(expected = CorruptContentException.class)
public void testWritingResolvingContainerWhichOnlyChildRefsThrowsCorrectException()
throws Exception {
DateTime now = new DateTime(DateTimeZones.UTC);
ContentProtos.Content.Builder contentBuilder = ContentProtos.Content.newBuilder();
Episode episode2 = create(new Episode());
episode2.setId(12345L);
episode2.setThisOrChildLastUpdated(now);
Location location4 = new Location();
location4.setAvailable(true);
location4.setUri("location4");
Policy policy2 = new Policy();
policy2.setAvailabilityStart(now.plusHours(1));
policy2.setAvailabilityEnd(now.plusHours(2));
location4.setPolicy(policy2);
contentBuilder.addAvailableContent(
new ItemAndLocationSummarySerializer()
.serialize(
episode2.toRef(),
ImmutableList.of(location4.toSummary())
)
);
ColumnFamily<Long, String> columnFamily = ColumnFamily.newColumnFamily(
CONTENT_TABLE,
LongSerializer.get(),
StringSerializer.get()
);
MutationBatch batch = context.getClient().prepareMutationBatch();
ColumnListMutation<String> mutation = batch.withRow(columnFamily, 1234L);
mutation.putColumn("AVAILABLE:1238", contentBuilder.build().toByteArray());
batch.execute();
try {
resolve(1234L);
} catch (ExecutionException e) {
throw Throwables.propagate(e.getCause());
}
}