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 both the ProcessorMetaSupplier.init(Context) and ProcessorMetaSupplier.get(List) methods of this instance are 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, waitclose, forceTotalParallelismOne, forceTotalParallelismOne, forceTotalParallelismOne, forceTotalParallelismOne, forceTotalParallelismOne, getRequiredPermission, getTags, of, of, of, of, of, of, of, of, preferLocalParallelismOne, preferLocalParallelismOne, preferLocalParallelismOne, preferLocalParallelismOne, randomMemberpublic void init(@Nonnull ProcessorMetaSupplier.Context context) throws Exception
ProcessorMetaSupplierinit in interface ProcessorMetaSupplierExceptionProcessorMetaSupplier.isReusable()@Nonnull public Function<? super Address,? extends ProcessorSupplier> get(@Nonnull List<Address> addresses)
ProcessorMetaSupplierAddress 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 ProcessorMetaSupplierProcessorMetaSupplier.isReusable()public int preferredLocalParallelism()
ProcessorMetaSupplierVertex.LOCAL_PARALLELISM_USE_DEFAULT.preferredLocalParallelism in interface ProcessorMetaSupplierpublic boolean isReusable()
ProcessorMetaSuppliertrue 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 ProcessorMetaSupplierpublic boolean initIsCooperative()
ProcessorMetaSuppliertrue if both the ProcessorMetaSupplier.init(Context) and ProcessorMetaSupplier.get(List) methods of this instance are cooperative. If they are not,
the call to the init() and get() method is off-loaded to
another thread.initIsCooperative in interface ProcessorMetaSupplierpublic boolean closeIsCooperative()
ProcessorMetaSuppliertrue 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 ProcessorMetaSupplierpublic void writeData(ObjectDataOutput out) throws IOException
DataSerializablewriteData in interface DataSerializableout - 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
DataSerializablereadData in interface DataSerializablein - inputIOException - if an I/O error occurs. In particular,
an IOException may be thrown if the
input stream has been closed.public int getFactoryId()
IdentifiedDataSerializablegetFactoryId in interface IdentifiedDataSerializablepublic int getClassId()
IdentifiedDataSerializablegetClassId in interface IdentifiedDataSerializableCopyright © 2023 Hazelcast, Inc.. All rights reserved.