public class Vertex extends Object implements com.hazelcast.nio.serialization.IdentifiedDataSerializable
edges
and pushes
data items to its outbound edges. Practically, a single vertex is represented
by a set of instances of Processor
. The localParallelism
property
determines the number of processor instances running on each cluster member.
Each processor is assigned a set of partition IDs it is responsible for. When an inbound edge is partitioned, the processor will receive only those data items whose partition ID it is responsible for. For data traveling over a partitioned edge which is also distributed, the whole cluster contains a single unique processor instance responsible for any given partition ID. For non-distributed edges, the processor is unique only within a member and each member has its own processor for any given partition ID. Finally, there is a guarantee of collation across all the partitioned edges impinging on a vertex: within each member, all the data with a given partition ID is received by the same processor.
A vertex is uniquely identified in a DAG by its name.
Modifier and Type | Field and Description |
---|---|
static int |
LOCAL_PARALLELISM_USE_DEFAULT
The value of
localParallelism(int) with the meaning
"use the default local parallelism". |
Constructor and Description |
---|
Vertex(String name,
DistributedSupplier<? extends Processor> processorSupplier)
Creates a vertex from a
Supplier<Processor> . |
Vertex(String name,
ProcessorMetaSupplier metaSupplier)
Creates a vertex from a
ProcessorMetaSupplier . |
Vertex(String name,
ProcessorSupplier processorSupplier)
Creates a vertex from a
ProcessorSupplier . |
Modifier and Type | Method and Description |
---|---|
int |
getFactoryId() |
int |
getId() |
int |
getLocalParallelism()
Returns the number of processors corresponding to this vertex that will
be created on each member.
|
ProcessorMetaSupplier |
getMetaSupplier()
Returns this vertex's meta-supplier of processors.
|
String |
getName()
Returns the name of this vertex.
|
static boolean |
isValidLocalParallelism(int parallelism)
Says whether the given integer is valid as the value of
localParallelism . |
Vertex |
localParallelism(int localParallelism)
Sets the number of processors corresponding to this vertex that will be
created on each member.
|
void |
readData(com.hazelcast.nio.ObjectDataInput in) |
String |
toString() |
void |
updateMetaSupplier(java.util.function.UnaryOperator<ProcessorMetaSupplier> updateFn)
Applies the provided operator function to the current processor
meta-supplier and replaces it with the one it returns.
|
void |
writeData(com.hazelcast.nio.ObjectDataOutput out) |
public static final int LOCAL_PARALLELISM_USE_DEFAULT
localParallelism(int)
with the meaning
"use the default local parallelism".public Vertex(@Nonnull String name, @Nonnull DistributedSupplier<? extends Processor> processorSupplier)
Supplier<Processor>
.
This is useful for vertices where all the Processor
instances
will be instantiated the same way.
NOTE: this constructor should not be abused with a stateful
implementation which produces a different processor each time. In such a
case the full ProcessorSupplier
type should be implemented.
name
- the unique name of the vertex. This name identifies the vertex in the snapshotprocessorSupplier
- the simple, parameterless supplier of Processor
instancespublic Vertex(@Nonnull String name, @Nonnull ProcessorSupplier processorSupplier)
ProcessorSupplier
.name
- the unique name of the vertex. This name identifies the vertex in the snapshotprocessorSupplier
- the supplier of Processor
instances which will be used on all memberspublic Vertex(@Nonnull String name, @Nonnull ProcessorMetaSupplier metaSupplier)
ProcessorMetaSupplier
.name
- the unique name of the vertex. This name identifies the vertex in the snapshotmetaSupplier
- the meta-supplier of ProcessorSupplier
s for each memberpublic static boolean isValidLocalParallelism(int parallelism)
localParallelism
.@Nonnull public Vertex localParallelism(int localParallelism)
If the value is -1, Jet will determine the vertex's local parallelism during job initialization from the global default and processor meta-supplier's preferred value.
public int getLocalParallelism()
-1
means that this
property is not set; in that case the default configured on the Jet
instance will be used.@Nonnull public ProcessorMetaSupplier getMetaSupplier()
public void updateMetaSupplier(@Nonnull java.util.function.UnaryOperator<ProcessorMetaSupplier> updateFn)
public void writeData(@Nonnull com.hazelcast.nio.ObjectDataOutput out) throws IOException
writeData
in interface com.hazelcast.nio.serialization.DataSerializable
IOException
public void readData(@Nonnull com.hazelcast.nio.ObjectDataInput in) throws IOException
readData
in interface com.hazelcast.nio.serialization.DataSerializable
IOException
public int getFactoryId()
getFactoryId
in interface com.hazelcast.nio.serialization.IdentifiedDataSerializable
public int getId()
getId
in interface com.hazelcast.nio.serialization.IdentifiedDataSerializable
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.