public static class ProcessorMetaSupplier.SpecificMemberPms extends Object implements ProcessorMetaSupplier, IdentifiedDataSerializable
ProcessorSupplier
on a node with given Address
.ProcessorMetaSupplier.Context, ProcessorMetaSupplier.ExpectNothingProcessorSupplier, ProcessorMetaSupplier.RandomMemberPms, ProcessorMetaSupplier.SpecificMemberPms
Modifier and Type | Method and Description |
---|---|
boolean |
closeIsCooperative()
Returns
true if the ProcessorMetaSupplier.close(Throwable) method of this
instance is cooperative. |
Function<? super Address,? extends ProcessorSupplier> |
get(List<Address> addresses)
Called to create a mapping from member
Address to the
ProcessorSupplier that will be sent to that member. |
int |
getClassId()
Returns type identifier for this class.
|
int |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
void |
init(ProcessorMetaSupplier.Context context)
Called on the cluster member that receives the job request.
|
boolean |
initIsCooperative()
Returns
true if the ProcessorMetaSupplier.init(Context) method of this
instance is cooperative. |
boolean |
isReusable()
Returns
true if the same instance can be reused in different job
executions or in different vertices. |
int |
preferredLocalParallelism()
Returns the local parallelism the vertex should be configured with.
|
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, forceTotalParallelismOne, forceTotalParallelismOne, forceTotalParallelismOne, forceTotalParallelismOne, forceTotalParallelismOne, getRequiredPermission, getTags, of, of, of, of, of, of, of, of, preferLocalParallelismOne, preferLocalParallelismOne, preferLocalParallelismOne, preferLocalParallelismOne, randomMember
public void init(@Nonnull ProcessorMetaSupplier.Context context) throws Exception
ProcessorMetaSupplier
init
in interface ProcessorMetaSupplier
Exception
ProcessorMetaSupplier.isReusable()
@Nonnull public Function<? super Address,? extends ProcessorSupplier> get(@Nonnull List<Address> addresses)
ProcessorMetaSupplier
Address
to the
ProcessorSupplier
that will be sent to that member. Jet calls
this method with a list of all cluster members' addresses and the
returned function must be a mapping that returns a non-null value for
each given address.
The method will be called once per job execution on the job's
coordinator member. init()
will have already
been called.
get
in interface ProcessorMetaSupplier
ProcessorMetaSupplier.isReusable()
public int preferredLocalParallelism()
ProcessorMetaSupplier
Vertex.LOCAL_PARALLELISM_USE_DEFAULT
.preferredLocalParallelism
in interface ProcessorMetaSupplier
public boolean isReusable()
ProcessorMetaSupplier
true
if the same instance can be reused in different job
executions or in different vertices. In that case, ProcessorMetaSupplier.init(com.hazelcast.jet.core.ProcessorMetaSupplier.Context)
, ProcessorMetaSupplier.get(java.util.List<com.hazelcast.cluster.Address>)
and ProcessorMetaSupplier.close(java.lang.Throwable)
methods must be thread-safe and obey additional
conditions defined below.
When a job is submitted from a client, the job definition is serialized, so the job coordinator will receive a different copy of processor meta-suppliers even if they are used multiple times within the same DAG, or across different DAGs, or submitted through different jobs. While this serialization mechanism ensures that processor meta-supplier instances do not share any internal state, it is unnecessary —and avoided— for jobs consisting of reusable meta-suppliers and submitted from the job coordinator —which is always the case for member-originated light jobs.
Non-reusable meta-suppliers (default) have a simple order of
method executions: ProcessorMetaSupplier.init(com.hazelcast.jet.core.ProcessorMetaSupplier.Context)
(once), ProcessorMetaSupplier.get(java.util.List<com.hazelcast.cluster.Address>)
(at most once after
ProcessorMetaSupplier.init(com.hazelcast.jet.core.ProcessorMetaSupplier.Context)
, ProcessorMetaSupplier.close(java.lang.Throwable)
(last).
Reusable meta-suppliers differ because the meta supplier instance may be shared and reused. That is why:
ProcessorMetaSupplier.init(com.hazelcast.jet.core.ProcessorMetaSupplier.Context)
can be invoked multiple times (also after
ProcessorMetaSupplier.close(java.lang.Throwable)
).
ProcessorMetaSupplier.get(java.util.List<com.hazelcast.cluster.Address>)
can be invoked multiple times, but each ProcessorMetaSupplier.get(java.util.List<com.hazelcast.cluster.Address>)
invocation will be preceded by ProcessorMetaSupplier.init(com.hazelcast.jet.core.ProcessorMetaSupplier.Context)
invocation for given
job execution.
ProcessorMetaSupplier.close(java.lang.Throwable)
can be invoked multiple times with or without
preceding invocations of the other methods.
ProcessorMetaSupplier.init(com.hazelcast.jet.core.ProcessorMetaSupplier.Context)
method, for
example, save some constant data from ProcessorMetaSupplier.Context
for further usage.
Note, however, that cluster topology may change and should not be stored.isReusable
in interface ProcessorMetaSupplier
public boolean initIsCooperative()
ProcessorMetaSupplier
true
if the ProcessorMetaSupplier.init(Context)
method of this
instance is cooperative. If it's not, the call to the init()
method is off-loaded to another thread.initIsCooperative
in interface ProcessorMetaSupplier
public boolean closeIsCooperative()
ProcessorMetaSupplier
true
if the ProcessorMetaSupplier.close(Throwable)
method of this
instance is cooperative. If it's not, the call to the close()
method is off-loaded to another thread.closeIsCooperative
in interface ProcessorMetaSupplier
public void writeData(ObjectDataOutput out) throws IOException
DataSerializable
writeData
in interface DataSerializable
out
- outputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
output stream has been closed.public void readData(ObjectDataInput in) throws IOException
DataSerializable
readData
in interface DataSerializable
in
- inputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
input stream has been closed.public int getFactoryId()
IdentifiedDataSerializable
getFactoryId
in interface IdentifiedDataSerializable
public int getClassId()
IdentifiedDataSerializable
getClassId
in interface IdentifiedDataSerializable
Copyright © 2023 Hazelcast, Inc.. All rights reserved.