1919
2020import java .io .Serializable ;
2121import java .util .UUID ;
22+ import org .apache .ignite .IgniteCheckedException ;
2223import org .apache .ignite .configuration .CacheConfiguration ;
2324import org .apache .ignite .configuration .NearCacheConfiguration ;
25+ import org .apache .ignite .internal .CoreMessagesProvider ;
2426import org .apache .ignite .internal .GridKernalContext ;
27+ import org .apache .ignite .internal .MarshallableMessage ;
28+ import org .apache .ignite .internal .Order ;
2529import org .apache .ignite .internal .processors .query .QuerySchema ;
2630import org .apache .ignite .internal .util .tostring .GridToStringExclude ;
2731import org .apache .ignite .internal .util .typedef .T2 ;
32+ import org .apache .ignite .internal .util .typedef .internal .U ;
2833import org .apache .ignite .lang .IgniteUuid ;
34+ import org .apache .ignite .marshaller .Marshaller ;
2935import org .jetbrains .annotations .Nullable ;
3036
3137/**
3238 * Cache start/stop request.
3339 */
34- public class DynamicCacheChangeRequest implements Serializable {
40+ public class DynamicCacheChangeRequest implements MarshallableMessage , Serializable {
3541 /** */
3642 private static final long serialVersionUID = 0L ;
3743
3844 /** */
39- private UUID reqId ;
45+ @ Order (0 )
46+ UUID reqId ;
4047
4148 /** Start ID. */
42- private IgniteUuid deploymentId ;
49+ @ Order (1 )
50+ IgniteUuid deploymentId ;
4351
4452 /** Stop cache name. */
4553 @ GridToStringExclude
46- private String cacheName ;
54+ @ Order (2 )
55+ String cacheName ;
4756
4857 /** Cache start configuration. */
4958 @ GridToStringExclude
50- private CacheConfiguration startCfg ;
59+ private CacheConfiguration <?, ?> startCfg ;
60+
61+ /** Bytes of {@link #startCfg}. */
62+ @ Order (3 )
63+ byte [] cfgBytes ;
5164
5265 /** Cache type. */
53- private CacheType cacheType ;
66+ @ Order (4 )
67+ CacheType cacheType ;
5468
5569 /** Near node ID in case if near cache is being started. */
56- private UUID initiatingNodeId ;
70+ @ Order (5 )
71+ UUID initiatingNodeId ;
5772
5873 /** Near cache configuration. */
5974 @ GridToStringExclude
60- private NearCacheConfiguration nearCacheCfg ;
75+ private NearCacheConfiguration <?, ?> nearCacheCfg ;
76+
77+ /** Bytes of {@link #nearCacheCfg}. */
78+ @ Order (6 )
79+ byte [] nearCfgBytes ;
6180
6281 /** Start only client cache, do not start data nodes. */
63- private boolean clientStartOnly ;
82+ @ Order (7 )
83+ boolean clientStartOnly ;
6484
6585 /** Stop flag. */
66- private boolean stop ;
86+ @ Order (8 )
87+ boolean stop ;
6788
6889 /** Restart flag. */
69- private boolean restart ;
90+ @ Order (9 )
91+ boolean restart ;
7092
7193 /** Finalize update counters flag. */
72- private boolean finalizePartitionCounters ;
94+ @ Order (10 )
95+ boolean finalizePartitionCounters ;
7396
7497 /** Restart operation id. */
75- private IgniteUuid restartId ;
98+ @ Order (11 )
99+ IgniteUuid restartId ;
76100
77101 /** Cache active on start or not*/
78- private boolean disabledAfterStart ;
102+ @ Order (12 )
103+ boolean disabledAfterStart ;
79104
80105 /** Cache data destroy flag. Setting to <code>true</code> will cause removing all cache data.*/
81- private boolean destroy ;
106+ @ Order (13 )
107+ boolean destroy ;
82108
83109 /** Whether cache was created through SQL. */
84- private boolean sql ;
110+ @ Order (14 )
111+ boolean sql ;
85112
86113 /** Fail if exists flag. */
87- private boolean failIfExists ;
114+ @ Order (15 )
115+ boolean failIfExists ;
88116
89117 /** Template configuration flag. */
90- private boolean template ;
118+ @ Order (16 )
119+ boolean template ;
91120
92121 /** Reset lost partitions flag. */
93- private boolean resetLostPartitions ;
122+ @ Order (17 )
123+ boolean resetLostPartitions ;
94124
95125 /** Dynamic schema. */
96- private QuerySchema schema ;
126+ QuerySchema schema ;
97127
98- /** */
99- private transient boolean locallyConfigured ;
128+ /** Bytes of {@link #schema}. */
129+ @ Order (18 )
130+ byte [] schemaBytes ;
131+
132+ /** Is transient. */
133+ private boolean locallyConfigured ;
100134
101135 /** Encryption key. */
102- @ Nullable private byte [] encKey ;
136+ @ Order (19 )
137+ @ Nullable byte [] encKey ;
103138
104139 /** Id of encryption key. */
105- @ Nullable private Integer encKeyId ;
140+ @ Order (20 )
141+ int encKeyId ;
106142
107143 /** Master key digest. */
108- @ Nullable private byte [] masterKeyDigest ;
144+ @ Order (21 )
145+ @ Nullable byte [] masterKeyDigest ;
109146
110147 /** Cache configuration enrichment. */
111- private CacheConfigurationEnrichment cacheCfgEnrichment ;
148+ @ Order (22 )
149+ CacheConfigurationEnrichment cacheCfgEnrichment ;
150+
151+ /** Empty constructor for {@link CoreMessagesProvider}. */
152+ public DynamicCacheChangeRequest () {
153+ // No-op.
154+ }
112155
113156 /**
114157 * @param reqId Unique request ID.
@@ -123,6 +166,32 @@ public DynamicCacheChangeRequest(UUID reqId, String cacheName, UUID initiatingNo
123166 this .initiatingNodeId = initiatingNodeId ;
124167 }
125168
169+ /** {@inheritDoc} */
170+ @ Override public void prepareMarshal (Marshaller marsh ) throws IgniteCheckedException {
171+ cfgBytes = U .marshal (marsh , startCfg );
172+
173+ if (nearCacheCfg != null )
174+ nearCfgBytes = U .marshal (marsh , nearCacheCfg );
175+
176+ if (schema != null )
177+ schemaBytes = U .marshal (marsh , schema );
178+ }
179+
180+ /** {@inheritDoc} */
181+ @ Override public void finishUnmarshal (Marshaller marsh , ClassLoader clsLdr ) throws IgniteCheckedException {
182+ startCfg = U .unmarshal (marsh , cfgBytes , clsLdr );
183+
184+ if (nearCfgBytes != null )
185+ nearCacheCfg = U .unmarshal (marsh , nearCfgBytes , clsLdr );
186+
187+ if (schemaBytes != null )
188+ schema = U .unmarshal (marsh , schemaBytes , clsLdr );
189+
190+ cfgBytes = null ;
191+ nearCfgBytes = null ;
192+ schemaBytes = null ;
193+ }
194+
126195 /**
127196 * @param ctx Context.
128197 * @param cacheName Cache name.
@@ -338,28 +407,28 @@ public UUID initiatingNodeId() {
338407 /**
339408 * @return Near cache configuration.
340409 */
341- public NearCacheConfiguration nearCacheConfiguration () {
410+ public NearCacheConfiguration <?, ?> nearCacheConfiguration () {
342411 return nearCacheCfg ;
343412 }
344413
345414 /**
346415 * @param nearCacheCfg Near cache configuration.
347416 */
348- public void nearCacheConfiguration (NearCacheConfiguration nearCacheCfg ) {
417+ public void nearCacheConfiguration (NearCacheConfiguration <?, ?> nearCacheCfg ) {
349418 this .nearCacheCfg = nearCacheCfg ;
350419 }
351420
352421 /**
353422 * @return Cache configuration.
354423 */
355- public CacheConfiguration startCacheConfiguration () {
424+ public CacheConfiguration <?, ?> startCacheConfiguration () {
356425 return startCfg ;
357426 }
358427
359428 /**
360429 * @param startCfg Cache configuration.
361430 */
362- public void startCacheConfiguration (CacheConfiguration startCfg ) {
431+ public void startCacheConfiguration (CacheConfiguration <?, ?> startCfg ) {
363432 this .startCfg = startCfg ;
364433
365434 if (startCfg .getNearConfiguration () != null )
@@ -485,14 +554,14 @@ public void encryptionKey(@Nullable byte[] encKey) {
485554 *
486555 * @param encKeyId Encryption key id.
487556 */
488- public void encryptionKeyId (@ Nullable Integer encKeyId ) {
557+ public void encryptionKeyId (int encKeyId ) {
489558 this .encKeyId = encKeyId ;
490559 }
491560
492561 /**
493562 * @return Encryption key id.
494563 */
495- @ Nullable public Integer encryptionKeyId () {
564+ @ Nullable public int encryptionKeyId () {
496565 return encKeyId ;
497566 }
498567
0 commit comments