本文整理了Java中org.apache.samza.Partition.getPartitionId()
方法的一些代码示例,展示了Partition.getPartitionId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Partition.getPartitionId()
方法的具体详情如下:
包路径:org.apache.samza.Partition
类名称:Partition
方法名:getPartitionId
暂无
代码示例来源:origin: apache/samza
@Override
public void serialize(Partition partition, JsonGenerator jsonGenerator, SerializerProvider provider) throws IOException, JsonProcessingException {
jsonGenerator.writeObject(Integer.valueOf(partition.getPartitionId()));
}
}
代码示例来源:origin: org.apache.samza/samza-core_2.10
@Override
public void serialize(Partition partition, JsonGenerator jsonGenerator, SerializerProvider provider) throws IOException, JsonProcessingException {
jsonGenerator.writeObject(Integer.valueOf(partition.getPartitionId()));
}
}
代码示例来源:origin: org.apache.samza/samza-core
@Override
public void serialize(Partition partition, JsonGenerator jsonGenerator, SerializerProvider provider) throws IOException, JsonProcessingException {
jsonGenerator.writeObject(Integer.valueOf(partition.getPartitionId()));
}
}
代码示例来源:origin: apache/samza
/**
* get the max partition number of the changelog stream
*/
private void getChangeLogMaxPartitionNumber() {
int maxPartitionId = 0;
for (ContainerModel containerModel : containers.values()) {
for (TaskModel taskModel : containerModel.getTasks().values()) {
maxPartitionId = Math.max(maxPartitionId, taskModel.getChangelogPartition().getPartitionId());
}
}
maxPartitionNumber = maxPartitionId + 1;
}
代码示例来源:origin: org.apache.samza/samza-core_2.10
/**
* get the max partition number of the changelog stream
*/
private void getChangeLogMaxPartitionNumber() {
int maxPartitionId = 0;
for (ContainerModel containerModel : containers.values()) {
for (TaskModel taskModel : containerModel.getTasks().values()) {
maxPartitionId = Math.max(maxPartitionId, taskModel.getChangelogPartition().getPartitionId());
}
}
maxPartitionNumber = maxPartitionId + 1;
}
代码示例来源:origin: org.apache.samza/samza-core_2.12
/**
* get the max partition number of the changelog stream
*/
private void getChangeLogMaxPartitionNumber() {
int maxPartitionId = 0;
for (ContainerModel containerModel : containers.values()) {
for (TaskModel taskModel : containerModel.getTasks().values()) {
maxPartitionId = Math.max(maxPartitionId, taskModel.getChangelogPartition().getPartitionId());
}
}
maxPartitionNumber = maxPartitionId + 1;
}
代码示例来源:origin: apache/samza
private String serializeSystemStreamPartition(SystemStreamPartition ssp) {
// Create the Json string for SystemStreamPartition
Map<String, String> sspMap = new HashMap<>();
sspMap.put(SYSTEM_PROP_NAME, ssp.getSystem());
sspMap.put(STREAM_PROP_NAME, ssp.getStream());
sspMap.put(PARTITION_PROP_NAME, String.valueOf(ssp.getPartition().getPartitionId()));
return new String(jsonSerde.toBytes(sspMap));
}
代码示例来源:origin: apache/samza
@Override
public SystemStreamPartition getPreviousSSP(SystemStreamPartition currentSystemStreamPartition, int previousPartitionCount, int currentPartitionCount) {
Preconditions.checkNotNull(currentSystemStreamPartition);
Preconditions.checkArgument(currentPartitionCount % previousPartitionCount == 0,
String.format("New partition count: %d should be a multiple of previous partition count: %d.", currentPartitionCount, previousPartitionCount));
Partition partition = currentSystemStreamPartition.getPartition();
Preconditions.checkNotNull(partition, String.format("SystemStreamPartition: %s cannot have null partition", currentSystemStreamPartition));
int currentPartitionId = partition.getPartitionId();
int previousPartitionId = currentPartitionId % previousPartitionCount;
return new SystemStreamPartition(currentSystemStreamPartition.getSystemStream(), new Partition(previousPartitionId));
}
}
代码示例来源:origin: apache/samza
void setAggregateTime(SystemStreamPartition systemStreamPartition, long time) {
final Gauge<Long> aggregate = aggregates.computeIfAbsent(systemStreamPartition,
ssp -> newGauge(String.format("%s-%s-aggr-watermark",
ssp.getStream(), ssp.getPartition().getPartitionId()), 0L));
aggregate.set(time);
}
}
代码示例来源:origin: org.apache.samza/samza-core_2.12
void setAggregateTime(SystemStreamPartition systemStreamPartition, long time) {
final Gauge<Long> aggregate = aggregates.computeIfAbsent(systemStreamPartition,
ssp -> newGauge(String.format("%s-%s-aggr-watermark",
ssp.getStream(), ssp.getPartition().getPartitionId()), 0L));
aggregate.set(time);
}
}
代码示例来源:origin: org.apache.samza/samza-core
void setAggregateTime(SystemStreamPartition systemStreamPartition, long time) {
final Gauge<Long> aggregate = aggregates.computeIfAbsent(systemStreamPartition,
ssp -> newGauge(String.format("%s-%s-aggr-watermark",
ssp.getStream(), ssp.getPartition().getPartitionId()), 0L));
aggregate.set(time);
}
}
代码示例来源:origin: apache/samza
public Partition(SystemStreamPartition systemStreamPartition) {
this(systemStreamPartition.getSystem(),
systemStreamPartition.getStream(),
systemStreamPartition.getPartition().getPartitionId());
}
代码示例来源:origin: apache/samza
@Override
public void serialize(SystemStreamPartition ssp, JsonGenerator jgen, SerializerProvider provider) throws IOException {
String sspString = ssp.getSystem() + "." + ssp.getStream() + "." + String.valueOf(ssp.getPartition().getPartitionId());
jgen.writeFieldName(sspString);
}
}
代码示例来源:origin: org.apache.samza/samza-core_2.12
@Override
public void serialize(SystemStreamPartition ssp, JsonGenerator jgen, SerializerProvider provider) throws IOException {
String sspString = ssp.getSystem() + "." + ssp.getStream() + "." + String.valueOf(ssp.getPartition().getPartitionId());
jgen.writeFieldName(sspString);
}
}
代码示例来源:origin: org.apache.samza/samza-core_2.11
@Override
public void serialize(SystemStreamPartition ssp, JsonGenerator jgen, SerializerProvider provider) throws IOException {
String sspString = ssp.getSystem() + "." + ssp.getStream() + "." + String.valueOf(ssp.getPartition().getPartitionId());
jgen.writeFieldName(sspString);
}
}
代码示例来源:origin: org.apache.samza/samza-core
@Override
public void serialize(SystemStreamPartition ssp, JsonGenerator jgen, SerializerProvider provider) throws IOException {
String sspString = ssp.getSystem() + "." + ssp.getStream() + "." + String.valueOf(ssp.getPartition().getPartitionId());
jgen.writeFieldName(sspString);
}
}
代码示例来源:origin: apache/samza
void broadcastToOtherPartitions(ControlMessage message, SystemStreamPartition ssp, MessageCollector collector) {
SystemStream systemStream = ssp.getSystemStream();
int partitionCount = getPartitionCount(systemStream);
int currentPartition = ssp.getPartition().getPartitionId();
for (int i = 0; i < partitionCount; i++) {
if (i != currentPartition) {
OutgoingMessageEnvelope envelopeOut = new OutgoingMessageEnvelope(systemStream, i, null, message);
collector.send(envelopeOut);
}
}
}
代码示例来源:origin: org.apache.samza/samza-core_2.12
void broadcastToOtherPartitions(ControlMessage message, SystemStreamPartition ssp, MessageCollector collector) {
SystemStream systemStream = ssp.getSystemStream();
int partitionCount = getPartitionCount(systemStream);
int currentPartition = ssp.getPartition().getPartitionId();
for (int i = 0; i < partitionCount; i++) {
if (i != currentPartition) {
OutgoingMessageEnvelope envelopeOut = new OutgoingMessageEnvelope(systemStream, i, null, message);
collector.send(envelopeOut);
}
}
}
代码示例来源:origin: org.apache.samza/samza-core_2.11
void broadcastToOtherPartitions(ControlMessage message, SystemStreamPartition ssp, MessageCollector collector) {
SystemStream systemStream = ssp.getSystemStream();
int partitionCount = getPartitionCount(systemStream);
int currentPartition = ssp.getPartition().getPartitionId();
for (int i = 0; i < partitionCount; i++) {
if (i != currentPartition) {
OutgoingMessageEnvelope envelopeOut = new OutgoingMessageEnvelope(systemStream, i, null, message);
collector.send(envelopeOut);
}
}
}
代码示例来源:origin: org.apache.samza/samza-core_2.10
void broadcastToOtherPartitions(ControlMessage message, SystemStreamPartition ssp, MessageCollector collector) {
SystemStream systemStream = ssp.getSystemStream();
int partitionCount = getPartitionCount(systemStream);
int currentPartition = ssp.getPartition().getPartitionId();
for (int i = 0; i < partitionCount; i++) {
if (i != currentPartition) {
OutgoingMessageEnvelope envelopeOut = new OutgoingMessageEnvelope(systemStream, i, null, message);
collector.send(envelopeOut);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!