Class MetadataUpdateProposedMessage
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.binary.MetadataUpdateProposedMessage
-
- All Implemented Interfaces:
Serializable,DiscoveryCustomMessage
public final class MetadataUpdateProposedMessage extends Object implements DiscoveryCustomMessage
MetadataUpdateProposedMessage andMetadataUpdateAcceptedMessagemessages make a basis for discovery-based protocol for exchangingmetadatadescribing objects in binary format stored in Ignite caches. All interactions with binary metadata are performed throughBinaryMetadataHandlerinterface implemented inCacheObjectBinaryProcessorImplprocessor. Protocol works as follows:- Each thread aiming to add/update metadata sends MetadataUpdateProposedMessage and blocks until receiving acknowledge or reject for proposed update.
- Coordinator node checks whether proposed update is in conflict with current version of metadata for the same typeId. In case of conflict initial MetadataUpdateProposedMessage is marked rejected and sent to initiator.
- If there are no conflicts on coordinator, pending version for metadata of this typeId is bumped up by one; MetadataUpdateProposedMessage with pending version information is sent across the cluster.
- Each node on receiving non-rejected MetadataUpdateProposedMessage updates pending version for the typeId in metadata local cache.
-
When MetadataUpdateProposedMessage finishes pass,
ackis sent. Ack has the same accepted version as pending version of initial MetadataUpdateProposedMessage message. - Each node on receiving MetadataUpdateAcceptedMessage updates accepted version for the typeId. All threads waiting for arrival of ack with this accepted version are unblocked.
MetadataUpdateAcceptedMessagearrives with accepted version equals to pending version of this metadata to the moment when is was initially read by the thread.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MetadataUpdateProposedMessage(BinaryMetadata metadata, UUID origNodeId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable DiscoveryCustomMessageackMessage()Called when custom message has been handled by all nodes.@Nullable DiscoCachecreateDiscoCache(GridDiscoveryManager mgr, AffinityTopologyVersion topVer, DiscoCache discoCache)Creates new discovery cache if message caused topology version change.IgniteUuidid()booleanisMutable()BinaryMetadatametadata()voidmetadata(BinaryMetadata metadata)StringtoString()inttypeId()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage
stopProcess
-
-
-
-
Constructor Detail
-
MetadataUpdateProposedMessage
public MetadataUpdateProposedMessage(BinaryMetadata metadata, UUID origNodeId)
- Parameters:
metadata-BinaryMetadatarequested to be updated.origNodeId- ID of node requested update.
-
-
Method Detail
-
id
public IgniteUuid id()
- Specified by:
idin interfaceDiscoveryCustomMessage- Returns:
- Unique custom message ID.
-
ackMessage
@Nullable public @Nullable DiscoveryCustomMessage ackMessage()
Called when custom message has been handled by all nodes.- Specified by:
ackMessagein interfaceDiscoveryCustomMessage- Returns:
- Ack message or
nullif ack is not required.
-
isMutable
public boolean isMutable()
- Specified by:
isMutablein interfaceDiscoveryCustomMessage- Returns:
Trueif message can be modified during listener notification. Changes will be sent to next nodes.
-
createDiscoCache
@Nullable public @Nullable DiscoCache createDiscoCache(GridDiscoveryManager mgr, AffinityTopologyVersion topVer, DiscoCache discoCache)
Creates new discovery cache if message caused topology version change.- Specified by:
createDiscoCachein interfaceDiscoveryCustomMessage- Parameters:
mgr- Discovery manager.topVer- New topology version.discoCache- Current discovery cache.- Returns:
- Reused discovery cache.
-
metadata
public BinaryMetadata metadata()
-
metadata
public void metadata(BinaryMetadata metadata)
- Parameters:
metadata- Metadata.
-
typeId
public int typeId()
-
-