Class ProcessorMetaSupplier.SpecificMemberPms
- All Implemented Interfaces:
ProcessorMetaSupplier,DataSerializable,IdentifiedDataSerializable,Serializable
- Enclosing interface:
- ProcessorMetaSupplier
ProcessorSupplier
on a node with given Address or random member if address is not given.
Additionally, it ensures that total parallelism is 1.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.hazelcast.jet.core.ProcessorMetaSupplier
ProcessorMetaSupplier.Context, ProcessorMetaSupplier.ExpectNothingProcessorSupplier, ProcessorMetaSupplier.RandomMemberPms, ProcessorMetaSupplier.SpecificMemberPms -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSpecificMemberPms(ProcessorSupplier supplier, Address memberAddress) -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueif theProcessorMetaSupplier.close(Throwable)method of this instance is cooperative.Function<? super Address,? extends ProcessorSupplier> Called to create a mapping from memberAddressto theProcessorSupplierthat will be sent to that member.intReturns type identifier for this class.intReturns DataSerializableFactory factory ID for this class.voidinit(ProcessorMetaSupplier.Context context) Called on the cluster member that receives the job request.booleanReturnstrueif both theProcessorMetaSupplier.init(Context)andProcessorMetaSupplier.get(List)methods of this instance are cooperative.booleanReturnstrueif the same instance can be reused in different job executions or in different vertices.intReturns the local parallelism the vertex should be configured with.voidReads fields from the input streamvoidWrites object fields to output streamMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.hazelcast.jet.core.ProcessorMetaSupplier
close, getRequiredPermission, getTags
-
Field Details
-
supplier
-
memberAddress
-
-
Constructor Details
-
SpecificMemberPms
public SpecificMemberPms() -
SpecificMemberPms
-
-
Method Details
-
init
Description copied from interface:ProcessorMetaSupplierCalled on the cluster member that receives the job request. Gives access to the Hazelcast instance's services and provides the parallelism parameters determined from the cluster size.- Specified by:
initin interfaceProcessorMetaSupplier- Throws:
Exception- See Also:
-
get
@Nonnull public Function<? super Address,? extends ProcessorSupplier> get(@Nonnull List<Address> addresses) Description copied from interface:ProcessorMetaSupplierCalled to create a mapping from memberAddressto theProcessorSupplierthat 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.- Specified by:
getin interfaceProcessorMetaSupplier- See Also:
-
preferredLocalParallelism
public int preferredLocalParallelism()Description copied from interface:ProcessorMetaSupplierReturns the local parallelism the vertex should be configured with. The default implementation returnsVertex.LOCAL_PARALLELISM_USE_DEFAULT.- Specified by:
preferredLocalParallelismin interfaceProcessorMetaSupplier
-
isReusable
public boolean isReusable()Description copied from interface:ProcessorMetaSupplierReturnstrueif 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>)andProcessorMetaSupplier.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 afterProcessorMetaSupplier.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 afterProcessorMetaSupplier.close(java.lang.Throwable)). -
ProcessorMetaSupplier.get(java.util.List<com.hazelcast.cluster.Address>)can be invoked multiple times, but eachProcessorMetaSupplier.get(java.util.List<com.hazelcast.cluster.Address>)invocation will be preceded byProcessorMetaSupplier.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. - Meta-supplier method invocation sequences for different concurrent job executions may be interleaved.
ProcessorMetaSupplier.init(com.hazelcast.jet.core.ProcessorMetaSupplier.Context)method, for example, save some constant data fromProcessorMetaSupplier.Contextfor further usage. Note, however, that cluster topology may change and should not be stored.- Specified by:
isReusablein interfaceProcessorMetaSupplier
-
-
initIsCooperative
public boolean initIsCooperative()Description copied from interface:ProcessorMetaSupplierReturnstrueif both theProcessorMetaSupplier.init(Context)andProcessorMetaSupplier.get(List)methods of this instance are cooperative. If they are not, the call to theinit()andget()method is off-loaded to another thread.- Specified by:
initIsCooperativein interfaceProcessorMetaSupplier
-
closeIsCooperative
public boolean closeIsCooperative()Description copied from interface:ProcessorMetaSupplierReturnstrueif theProcessorMetaSupplier.close(Throwable)method of this instance is cooperative. If it's not, the call to theclose()method is off-loaded to another thread.- Specified by:
closeIsCooperativein interfaceProcessorMetaSupplier
-
writeData
Description copied from interface:DataSerializableWrites object fields to output stream- Specified by:
writeDatain interfaceDataSerializable- Parameters:
out- output- Throws:
IOException- if an I/O error occurs. In particular, anIOExceptionmay be thrown if the output stream has been closed.
-
readData
Description copied from interface:DataSerializableReads fields from the input stream- Specified by:
readDatain interfaceDataSerializable- Parameters:
in- input- Throws:
IOException- if an I/O error occurs. In particular, anIOExceptionmay be thrown if the input stream has been closed.
-
getFactoryId
public int getFactoryId()Description copied from interface:IdentifiedDataSerializableReturns DataSerializableFactory factory ID for this class.- Specified by:
getFactoryIdin interfaceIdentifiedDataSerializable- Returns:
- factory ID
-
getClassId
public int getClassId()Description copied from interface:IdentifiedDataSerializableReturns type identifier for this class. It should be unique per DataSerializableFactory.- Specified by:
getClassIdin interfaceIdentifiedDataSerializable- Returns:
- type ID
-