1818package org .apache .ignite .internal .processors .marshaller ;
1919
2020import java .util .UUID ;
21+ import org .apache .ignite .internal .Order ;
2122import org .apache .ignite .internal .managers .discovery .DiscoveryCustomMessage ;
22- import org .apache .ignite .internal .util .tostring .GridToStringInclude ;
2323import org .apache .ignite .internal .util .typedef .internal .S ;
2424import org .apache .ignite .lang .IgniteUuid ;
25+ import org .apache .ignite .plugin .extensions .communication .Message ;
2526import org .jetbrains .annotations .Nullable ;
2627
2728/**
3334 * When it completes a pass around the cluster ring with no conflicts observed,
3435 * {@link MappingAcceptedMessage} is sent as an acknowledgement that everything is fine.
3536 */
36- public class MappingProposedMessage implements DiscoveryCustomMessage {
37+ public class MappingProposedMessage implements DiscoveryCustomMessage , Message {
3738 /** */
38- private enum ProposalStatus {
39+ enum ProposalStatus {
3940 /** */
4041 SUCCESSFUL ,
4142 /** */
@@ -48,20 +49,37 @@ private enum ProposalStatus {
4849 private static final long serialVersionUID = 0L ;
4950
5051 /** */
51- private final IgniteUuid id = IgniteUuid .randomUuid ();
52+ @ Order (0 )
53+ IgniteUuid id ;
5254
5355 /** */
54- private final UUID origNodeId ;
56+ @ Order (1 )
57+ UUID origNodeId ;
5558
5659 /** */
57- @ GridToStringInclude
58- private final MarshallerMappingItem mappingItem ;
60+ @ Order ( 2 )
61+ byte platformId ;
5962
6063 /** */
61- private ProposalStatus status = ProposalStatus .SUCCESSFUL ;
64+ @ Order (3 )
65+ int typeId ;
6266
6367 /** */
64- private String conflictingClsName ;
68+ @ Order (4 )
69+ String clsName ;
70+
71+ /** */
72+ @ Order (5 )
73+ ProposalStatus status ;
74+
75+ /** */
76+ @ Order (6 )
77+ String conflictingClsName ;
78+
79+ /** */
80+ public MappingProposedMessage () {
81+ // No-op.
82+ }
6583
6684 /**
6785 * @param mappingItem Mapping item.
@@ -70,8 +88,12 @@ private enum ProposalStatus {
7088 MappingProposedMessage (MarshallerMappingItem mappingItem , UUID origNodeId ) {
7189 assert origNodeId != null ;
7290
73- this .mappingItem = mappingItem ;
91+ id = IgniteUuid .randomUuid ();
92+ platformId = mappingItem .platformId ();
93+ typeId = mappingItem .typeId ();
94+ clsName = mappingItem .className ();
7495 this .origNodeId = origNodeId ;
96+ status = ProposalStatus .SUCCESSFUL ;
7597 }
7698
7799 /** {@inheritDoc} */
@@ -84,7 +106,7 @@ private enum ProposalStatus {
84106 */
85107 @ Nullable @ Override public DiscoveryCustomMessage ackMessage () {
86108 if (status == ProposalStatus .SUCCESSFUL )
87- return new MappingAcceptedMessage (mappingItem );
109+ return new MappingAcceptedMessage (mappingItem () );
88110 else
89111 return null ;
90112 }
@@ -96,7 +118,7 @@ private enum ProposalStatus {
96118
97119 /** */
98120 MarshallerMappingItem mappingItem () {
99- return mappingItem ;
121+ return new MarshallerMappingItem ( platformId , typeId , clsName ) ;
100122 }
101123
102124 /** */
@@ -130,6 +152,11 @@ String conflictingClassName() {
130152 return conflictingClsName ;
131153 }
132154
155+ /** {@inheritDoc} */
156+ @ Override public short directType () {
157+ return 518 ;
158+ }
159+
133160 /** {@inheritDoc} */
134161 @ Override public String toString () {
135162 return S .toString (MappingProposedMessage .class , this );
0 commit comments