From 8af01ccb440640510dbf695fe0fb8bb5bd809bfb Mon Sep 17 00:00:00 2001 From: Nikita Amelchev Date: Wed, 25 Mar 2026 17:47:12 +0300 Subject: [PATCH 1/5] IGNITE-28364 Finalize migration of GridCacheMessage --- .../cache/GridCacheGroupIdMessage.java | 52 --------- .../processors/cache/GridCacheIdMessage.java | 52 --------- .../processors/cache/GridCacheIoManager.java | 5 +- .../processors/cache/GridCacheMessage.java | 78 +------------ .../GridCacheTxRecoveryResponse.java | 33 +----- .../GridDistributedLockResponse.java | 40 +------ .../GridDistributedTxPrepareResponse.java | 21 ---- .../distributed/dht/GridDhtCacheAdapter.java | 3 +- .../distributed/dht/GridDhtLockResponse.java | 33 +----- .../dht/GridDhtTxPrepareResponse.java | 33 +----- .../GridDhtAtomicDeferredUpdateResponse.java | 7 -- .../dht/atomic/GridDhtAtomicNearResponse.java | 40 +------ .../atomic/GridDhtAtomicUpdateResponse.java | 29 +---- .../atomic/GridNearAtomicUpdateResponse.java | 18 +-- .../preloader/GridDhtForceKeysResponse.java | 71 ++---------- .../distributed/near/GridNearGetResponse.java | 50 +-------- .../near/GridNearLockResponse.java | 75 +------------ .../near/GridNearSingleGetResponse.java | 50 +-------- .../near/GridNearTxFinishResponse.java | 39 +------ .../near/GridNearTxPrepareResponse.java | 105 ++---------------- .../cache/query/GridCacheQueryResponse.java | 41 +------ .../CacheContinuousQueryBatchAck.java | 20 +--- .../CacheContinuousQueryManager.java | 2 +- 23 files changed, 48 insertions(+), 849 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGroupIdMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGroupIdMessage.java index 4e41c0f6d1d09..d260dfe33a5b1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGroupIdMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGroupIdMessage.java @@ -17,12 +17,9 @@ package org.apache.ignite.internal.processors.cache; -import java.nio.ByteBuffer; import org.apache.ignite.internal.Order; import org.apache.ignite.internal.util.tostring.GridToStringInclude; import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.plugin.extensions.communication.MessageReader; -import org.apache.ignite.plugin.extensions.communication.MessageWriter; /** * Message related to particular cache group. @@ -40,55 +37,6 @@ public int groupId() { return grpId; } - /** {@inheritDoc} */ - @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) { - // TODO: Safe to remove only after all inheritors have migrated to the new ser/der scheme (IGNITE-25490). - writer.setBuffer(buf); - - if (!super.writeTo(buf, writer)) - return false; - - if (!writer.isHeaderWritten()) { - if (!writer.writeHeader(directType())) - return false; - - writer.onHeaderWritten(); - } - - switch (writer.state()) { - case 3: - if (!writer.writeInt(grpId)) - return false; - - writer.incrementState(); - - } - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) { - // TODO: Safe to remove only after all inheritors have migrated to the new ser/der scheme (IGNITE-25490). - reader.setBuffer(buf); - - if (!super.readFrom(buf, reader)) - return false; - - switch (reader.state()) { - case 3: - grpId = reader.readInt(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - } - - return true; - } - /** {@inheritDoc} */ @Override public String toString() { return S.toString(GridCacheGroupIdMessage.class, this); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIdMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIdMessage.java index ec677b647d52a..f0ebb72b7b5b1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIdMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIdMessage.java @@ -17,12 +17,9 @@ package org.apache.ignite.internal.processors.cache; -import java.nio.ByteBuffer; import org.apache.ignite.internal.Order; import org.apache.ignite.internal.util.tostring.GridToStringInclude; import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.plugin.extensions.communication.MessageReader; -import org.apache.ignite.plugin.extensions.communication.MessageWriter; /** * Message related to particular cache. @@ -40,55 +37,6 @@ public int cacheId() { return cacheId; } - /** {@inheritDoc} */ - @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) { - // TODO: Remove #writeTo() after all inheritors have migrated to the new ser/der scheme (IGNITE-25490). - writer.setBuffer(buf); - - if (!super.writeTo(buf, writer)) - return false; - - if (!writer.isHeaderWritten()) { - if (!writer.writeHeader(directType())) - return false; - - writer.onHeaderWritten(); - } - - switch (writer.state()) { - case 3: - if (!writer.writeInt(cacheId)) - return false; - - writer.incrementState(); - - } - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) { - // TODO: Remove #readFrom() after all inheritors have migrated to the new ser/der scheme (IGNITE-25490). - reader.setBuffer(buf); - - if (!super.readFrom(buf, reader)) - return false; - - switch (reader.state()) { - case 3: - cacheId = reader.readInt(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - } - - return true; - } - /** {@inheritDoc} */ @Override public String toString() { return S.toString(GridCacheIdMessage.class, this, "super", super.toString()); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java index 1d50737d4f846..202c75834e8ca 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java @@ -830,11 +830,10 @@ private void processFailedMessage(UUID nodeId, GridDhtForceKeysResponse res = new GridDhtForceKeysResponse( req.cacheId(), req.futureId(), - req.miniId() + req.miniId(), + req.classError() ); - res.error(req.classError()); - sendResponseOnFailedMessage(nodeId, res, cctx, plc); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java index 285e4d392d94c..ec670da2d1cbf 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java @@ -17,7 +17,6 @@ package org.apache.ignite.internal.processors.cache; -import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -38,8 +37,6 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.marshaller.Marshaller; import org.apache.ignite.plugin.extensions.communication.Message; -import org.apache.ignite.plugin.extensions.communication.MessageReader; -import org.apache.ignite.plugin.extensions.communication.MessageWriter; import org.jetbrains.annotations.Nullable; /** @@ -196,9 +193,9 @@ public void lastAffinityChangedTopologyVersion(AffinityTopologyVersion topVer) { } /** - * Deployment enabled flag indicates whether deployment info has to be added to this message. + * Deployment enabled flag indicates whether deployment info has to be added to this message. * - * @return {@code true} or if deployment info must be added to the the message, {@code false} otherwise. + * @return {@code true} or if deployment info must be added to the message, {@code false} otherwise. */ public abstract boolean addDeploymentInfo(); @@ -641,77 +638,6 @@ public IgniteLogger messageLogger(GridCacheSharedContext ctx) { return ctx.messageLogger(); } - /** {@inheritDoc} */ - @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) { - // TODO: Safe to remove only after all inheritors have migrated to the new ser/der scheme (IGNITE-25490). - writer.setBuffer(buf); - - if (!writer.isHeaderWritten()) { - if (!writer.writeHeader(directType())) - return false; - - writer.onHeaderWritten(); - } - - switch (writer.state()) { - case 0: - if (!writer.writeMessage(depInfo)) - return false; - - writer.incrementState(); - - case 1: - if (!writer.writeAffinityTopologyVersion(lastAffChangedTopVer)) - return false; - - writer.incrementState(); - - case 2: - if (!writer.writeLong(msgId)) - return false; - - writer.incrementState(); - - } - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) { - // TODO: Safe to remove only after all inheritors have migrated to the new ser/der scheme (IGNITE-25490). - reader.setBuffer(buf); - - switch (reader.state()) { - case 0: - depInfo = reader.readMessage(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - case 1: - lastAffChangedTopVer = reader.readAffinityTopologyVersion(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - case 2: - msgId = reader.readLong(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - } - - return true; - } - /** * @param str Bulder. * @param name Flag name. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java index 2c7fe02b70c7d..51dc8059c1f1b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java @@ -73,48 +73,21 @@ public GridCacheTxRecoveryResponse(GridCacheVersion txId, this.addDepInfo = addDepInfo; } - /** - * @return Future ID. - */ + /** @return Future ID. */ public IgniteUuid futureId() { return futId; } - /** - * @param futId Future ID. - */ - public void futureId(IgniteUuid futId) { - this.futId = futId; - } - - /** - * @return Mini future ID. - */ + /** @return Mini future ID. */ public IgniteUuid miniId() { return miniId; } - /** - * @param miniId Mini future ID. - */ - public void miniId(IgniteUuid miniId) { - this.miniId = miniId; - } - - /** - * @return {@code True} if all remote transactions were prepared. - */ + /** @return {@code True} if all remote transactions were prepared. */ public boolean success() { return success; } - /** - * @param success {@code True} if all remote transactions were prepared. - */ - public void success(boolean success) { - this.success = success; - } - /** {@inheritDoc} */ @Override public IgniteTxState txState() { return txState; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java index 64da50ca22b74..8327ad918c9ef 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java @@ -119,54 +119,16 @@ public GridDistributedLockResponse(int cacheId, vals = new ArrayList<>(cnt); } - /** - * - * @return Future ID. - */ + /** @return Future ID. */ public IgniteUuid futureId() { return futId; } - /** - * @param futId New future ID. - */ - public void futureId(IgniteUuid futId) { - this.futId = futId; - } - /** {@inheritDoc} */ @Override public Throwable error() { return ErrorMessage.error(errMsg); } - /** - * @return Error message. - */ - public ErrorMessage errorMessage() { - return errMsg; - } - - /** - * @param errMsg New error message. - */ - public void errorMessage(ErrorMessage errMsg) { - this.errMsg = errMsg; - } - - /** - * @return Values. - */ - public List values() { - return vals; - } - - /** - * @param vals New values. - */ - public void values(List vals) { - this.vals = vals; - } - /** * @param val Value. */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java index 9bfbeb33c3f01..94aecce2bf7c6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java @@ -82,13 +82,6 @@ public GridDistributedTxPrepareResponse(int part, GridCacheVersion xid, @Nullabl return part; } - /** - * @param part New Partition ID this message is targeted to. - */ - public void partition(int part) { - this.part = part; - } - /** {@inheritDoc} */ @Override @Nullable public Throwable error() { return ErrorMessage.error(errMsg); @@ -122,20 +115,6 @@ public void error(@Nullable Throwable err) { return 26; } - /** - * @return Error message. - */ - public @Nullable ErrorMessage errorMessage() { - return errMsg; - } - - /** - * @param errMsg New error message. - */ - public void errorMessage(@Nullable ErrorMessage errMsg) { - this.errMsg = errMsg; - } - /** {@inheritDoc} */ @Override public String toString() { return GridToStringBuilder.toString(GridDistributedTxPrepareResponse.class, this, "err", diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java index a44bebc0d8df2..7277db3ccd698 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java @@ -214,7 +214,8 @@ private void processForceKeysRequest0(ClusterNode node, GridDhtForceKeysRequest GridDhtForceKeysResponse res = new GridDhtForceKeysResponse( ctx.cacheId(), msg.futureId(), - msg.miniId()); + msg.miniId(), + null); GridDhtPartitionTopology top = ctx.topology(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java index 2e9a46f870877..4df50d7cb7013 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java @@ -86,20 +86,11 @@ public GridDhtLockResponse(int cacheId, GridCacheVersion lockVer, IgniteUuid fut this.miniId = miniId; } - /** - * @return Mini future ID. - */ + /** @return Mini future ID. */ public IgniteUuid miniId() { return miniId; } - /** - * @param miniId New mini future ID. - */ - public void miniId(IgniteUuid miniId) { - this.miniId = miniId; - } - /** * @param part Invalid partition. */ @@ -110,20 +101,11 @@ public void addInvalidPartition(int part) { invalidParts.add(part); } - /** - * @return Invalid partitions. - */ + /** @return Invalid partitions. */ public Collection invalidPartitions() { return invalidParts; } - /** - * @param invalidParts New invalid partitions. - */ - public void invalidPartitions(Collection invalidParts) { - this.invalidParts = invalidParts; - } - /** * Adds preload entry to lock response. * @@ -136,20 +118,11 @@ public void addPreloadEntry(GridCacheEntryInfo info) { preloadEntries.add(info); } - /** - * @return Preload entries returned from backup. - */ + /** @return Preload entries returned from backup. */ public Collection preloadEntries() { return preloadEntries; } - /** - * @param preloadEntries New preload entries returned from backup. - */ - public void preloadEntries(List preloadEntries) { - this.preloadEntries = preloadEntries; - } - /** {@inheritDoc} */ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java index fa947fc4e54c0..50618064d5880 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java @@ -126,34 +126,16 @@ public void nearEvicted(@Nullable Collection nearEvicted) { this.nearEvicted = nearEvicted; } - /** - * @return Future ID. - */ + /** @return Future ID. */ public IgniteUuid futureId() { return futId; } - /** - * @param futId New future ID. - */ - public void futureId(IgniteUuid futId) { - this.futId = futId; - } - - /** - * @return Mini future ID. - */ + /** @return Mini future ID. */ public int miniId() { return miniId; } - /** - * @param miniId New mini future ID. - */ - public void miniId(int miniId) { - this.miniId = miniId; - } - /** * @return Invalid partitions by cache ID. */ @@ -168,20 +150,11 @@ public void invalidPartitions(@Nullable Map invalidParts) { this.invalidParts = invalidParts; } - /** - * @return Preload entries found on backup node. - */ + /** @return Preload entries found on backup node. */ public @Nullable Collection preloadEntries() { return preloadEntries; } - /** - * @param preloadEntries New preload entries found on backup node. - */ - public void preloadEntries(@Nullable List preloadEntries) { - this.preloadEntries = preloadEntries; - } - /** * Adds preload entry. * diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java index fa9947d356061..0019ca2e4a1c0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java @@ -92,13 +92,6 @@ public GridLongList futureIds() { return futIds; } - /** - * @param futIds New list of ACKed future ids. - */ - public void futureIds(GridLongList futIds) { - this.futIds = futIds; - } - /** {@inheritDoc} */ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) { return ctx.atomicMessageLogger(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicNearResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicNearResponse.java index 5abd304a9184c..57524fb61f6f3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicNearResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicNearResponse.java @@ -103,46 +103,21 @@ public void errors(UpdateErrors errs) { this.errs = errs; } - /** - * @return Primary node ID. - */ + /** @return Primary node ID. */ public UUID primaryId() { return primaryId; } - /** - * @param primaryId Primary node ID. - */ - public void primaryId(UUID primaryId) { - this.primaryId = primaryId; - } - - /** - * @return Flags. - */ + /** @return Flags. */ public byte flags() { return flags; } - /** - * @param flags Flags. - */ - public void flags(byte flags) { - this.flags = flags; - } - /** {@inheritDoc} */ @Override public int partition() { return partId; } - /** - * @param partId Partition ID. - */ - public void partition(int partId) { - this.partId = partId; - } - /** * @param key Key. * @param e Error. @@ -180,20 +155,11 @@ private boolean isFlag(int mask) { return (flags & mask) != 0; } - /** - * @return Future ID. - */ + /** @return Future ID. */ public long futureId() { return futId; } - /** - * @param futId Future ID. - */ - public void futureId(long futId) { - this.futId = futId; - } - /** {@inheritDoc} */ @Override public int lookupIndex() { return CACHE_MSG_IDX; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java index 4787ca83b1963..3926b8d5615ea 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java @@ -77,34 +77,16 @@ public GridDhtAtomicUpdateResponse(int cacheId, int partId, long futId) { return CACHE_MSG_IDX; } - /** - * @return Future version. - */ + /** @return Future version. */ public long futureId() { return futId; } - /** - * @param futId New future version. - */ - public void futureId(long futId) { - this.futId = futId; - } - - /** - * @return Errors. - */ + /** @return Errors. */ public UpdateErrors errors() { return errs; } - /** - * @param errs Errors. - */ - public void errors(UpdateErrors errs) { - this.errs = errs; - } - /** * Sets update error. * @@ -141,13 +123,6 @@ public void nearEvicted(List nearEvicted) { return partId; } - /** - * @param partId Partition. - */ - public void partition(int partId) { - this.partId = partId; - } - /** {@inheritDoc} */ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java index 8cf631496129a..70ca84576d957 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java @@ -147,20 +147,11 @@ public void nodeId(UUID nodeId) { this.nodeId = nodeId; } - /** - * @return Future ID. - */ + /** @return Future ID. */ public long futureId() { return futId; } - /** - * @param futId New future ID. - */ - public void futureId(long futId) { - this.futId = futId; - } - /** * @return Errs. */ @@ -168,13 +159,6 @@ public UpdateErrors errors() { return errs; } - /** - * @param errs New errs. - */ - public void errors(UpdateErrors errs) { - this.errs = errs; - } - /** * Sets update error. * diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java index 2b739c3887728..cfe7f9d32d377 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java @@ -72,23 +72,16 @@ public GridDhtForceKeysResponse() { * @param cacheId Cache ID. * @param futId Request id. * @param miniId Mini-future ID. + * @param err Error. */ - public GridDhtForceKeysResponse(int cacheId, IgniteUuid futId, IgniteUuid miniId) { + public GridDhtForceKeysResponse(int cacheId, IgniteUuid futId, IgniteUuid miniId, IgniteCheckedException err) { assert futId != null; assert miniId != null; this.cacheId = cacheId; this.futId = futId; this.miniId = miniId; - } - - /** - * Sets error. - * - * @param err Error. - */ - public void error(IgniteCheckedException err) { - errorMessage(new ErrorMessage(err)); + this.errMsg = new ErrorMessage(err); } /** {@inheritDoc} */ @@ -96,76 +89,26 @@ public void error(IgniteCheckedException err) { return ErrorMessage.error(errMsg); } - /** - * @return The error message. - */ - @Nullable public ErrorMessage errorMessage() { - return errMsg; - } - - /** - * Sets the error message. - * - * @param errMsg Error message. - */ - public void errorMessage(@Nullable ErrorMessage errMsg) { - this.errMsg = errMsg; - } - - /** - * @return Keys. - */ + /** @return Keys. */ public Collection missedKeys() { return F.emptyIfNull(missedKeys); } - /** @param missedKeys Missed keys. */ - public void missedKeys(List missedKeys) { - this.missedKeys = missedKeys; - } - - /** - * @return Forced entries. - */ + /** @return Forced entries. */ public Collection forcedInfos() { return F.emptyIfNull(infos); } - /** - * @param infos Forced entries. - */ - public void forcedInfos(List infos) { - this.infos = infos; - } - - /** - * @return Future ID. - */ + /** @return Future ID. */ public IgniteUuid futureId() { return futId; } - /** - * @param futId Future ID. - */ - public void futureId(IgniteUuid futId) { - this.futId = futId; - } - - /** - * @return Mini-future ID. - */ + /** @return Mini-future ID. */ public IgniteUuid miniId() { return miniId; } - /** - * @param miniId Mini-future ID. - */ - public void miniId(IgniteUuid miniId) { - this.miniId = miniId; - } - /** * @param key Key. */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java index 0fec84749f5da..654c94aedf5ac 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java @@ -101,46 +101,21 @@ public GridNearGetResponse( this.addDepInfo = addDepInfo; } - /** - * @return Future ID. - */ + /** @return Future ID. */ public IgniteUuid futureId() { return futId; } - /** - * @param futId Future ID. - */ - public void futureId(IgniteUuid futId) { - this.futId = futId; - } - - /** - * @return Sub ID. - */ + /** @return Sub ID. */ public IgniteUuid miniId() { return miniId; } - /** - * @param miniId Sub ID. - */ - public void miniId(IgniteUuid miniId) { - this.miniId = miniId; - } - /** {@inheritDoc} */ @Override public GridCacheVersion version() { return ver; } - /** - * @param ver Version. - */ - public void version(GridCacheVersion ver) { - this.ver = ver; - } - /** * @return Entries. */ @@ -185,13 +160,6 @@ public void invalidPartitions(Collection invalidParts, @NotNull Affinit return topVer != null ? topVer : super.topologyVersion(); } - /** - * @param topVer Topology version if this response has invalid partitions. - */ - public void topologyVersion(AffinityTopologyVersion topVer) { - this.topVer = topVer; - } - /** {@inheritDoc} */ @Override public @Nullable Throwable error() { return ErrorMessage.error(errMsg); @@ -205,20 +173,6 @@ public void error(@Nullable Throwable err) { errMsg = new ErrorMessage(err); } - /** - * @return Error message. - */ - public @Nullable ErrorMessage errorMessage() { - return errMsg; - } - - /** - * @param errMsg Error message. - */ - public void errorMessage(@Nullable ErrorMessage errMsg) { - this.errMsg = errMsg; - } - /** {@inheritDoc} * @param ctx*/ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java index 16d3777ccc908..11c23b7f2c3b7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java @@ -114,34 +114,16 @@ public GridNearLockResponse( this.compatibleRemapVer = compatibleRemapVer; } - /** - * @return Topology version, which is set when client node should remap lock request. - */ + /** @return Topology version, which is set when client node should remap lock request. */ @Nullable public AffinityTopologyVersion clientRemapVersion() { return clientRemapVer; } - /** - * @param clientRemapVer New topology version, which is set when client node should remap lock request. - */ - public void clientRemapVersion(AffinityTopologyVersion clientRemapVer) { - this.clientRemapVer = clientRemapVer; - } - - /** - * @return Flag, indicating whether remap version is compatible with current version. - */ + /** @return Flag, indicating whether remap version is compatible with current version. */ public boolean compatibleRemapVersion() { return compatibleRemapVer; } - /** - * @param compatibleRemapVer New flag, indicating whether remap version is compatible with current version. - */ - public void compatibleRemapVersion(boolean compatibleRemapVer) { - this.compatibleRemapVer = compatibleRemapVer; - } - /** * @return Pending versions that are less than {@link #version()}. */ @@ -156,20 +138,11 @@ public void pending(Collection pending) { this.pending = pending; } - /** - * @return Mini future ID. - */ + /** @return Mini future ID. */ public int miniId() { return miniId; } - /** - * @param miniId New mini future ID. - */ - public void miniId(int miniId) { - this.miniId = miniId; - } - /** * @param idx Index. * @return DHT version. @@ -178,20 +151,6 @@ public GridCacheVersion dhtVersion(int idx) { return dhtVers == null ? null : dhtVers[idx]; } - /** - * @return DHT versions. - */ - public GridCacheVersion[] dhtVersions() { - return dhtVers; - } - - /** - * @param dhtVers New DHT versions. - */ - public void dhtVersions(GridCacheVersion[] dhtVers) { - this.dhtVers = dhtVers; - } - /** * Returns DHT candidate version for acquired near lock on DHT node. * @@ -202,20 +161,6 @@ public GridCacheVersion mappedVersion(int idx) { return mappedVers == null ? null : mappedVers[idx]; } - /** - * @return DHT candidate versions. - */ - public GridCacheVersion[] mappedVersions() { - return mappedVers; - } - - /** - * @param mappedVers New DHT candidate versions. - */ - public void mappedVersions(GridCacheVersion[] mappedVers) { - this.mappedVers = mappedVers; - } - /** * Gets filter evaluation result for fast-commit transaction. * @@ -228,20 +173,6 @@ public boolean filterResult(int idx) { return filterRes[idx]; } - /** - * @return Filter evaluation results for fast-commit transactions. - */ - public boolean[] filterResults() { - return filterRes; - } - - /** - * @param filterRes New filter evaluation results for fast-commit transactions. - */ - public void filterResults(boolean[] filterRes) { - this.filterRes = filterRes; - } - /** * @param val Value. * @param filterPassed Boolean flag indicating whether filter passed for fast-commit transaction. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java index c3c73676c980f..db0941b14ff9b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java @@ -106,20 +106,6 @@ public void error(Throwable err) { return ErrorMessage.error(errMsg); } - /** - * @return Error message. - */ - public ErrorMessage errorMessage() { - return errMsg; - } - - /** - * @param errMsg Error message. - */ - public void errorMessage(ErrorMessage errMsg) { - this.errMsg = errMsg; - } - /** * @return Topology version. */ @@ -148,48 +134,16 @@ public void setContainsValue() { flags |= CONTAINS_VAL_FLAG_MASK; } - /** - * @return Flags. - */ - public byte flags() { - return flags; - } - - /** - * @param flags Flags. - */ - public void flags(byte flags) { - this.flags = flags; - } - - /** - * @return Result. - */ + /** @return Result. */ public Message result() { return res; } - /** - * @param res Result. - */ - public void result(Message res) { - this.res = res; - } - - /** - * @return Future ID. - */ + /** @return Future ID. */ public long futureId() { return futId; } - /** - * @param futId Future ID. - */ - public void futureId(long futId) { - this.futId = futId; - } - /** {@inheritDoc} */ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java index 5cb53e7d94605..718c5171eee0f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java @@ -77,48 +77,11 @@ public GridNearTxFinishResponse(int part, return ErrorMessage.error(errMsg); } - /** - * @return Mini future ID. - */ + /** @return Mini future ID. */ public int miniId() { return miniId; } - /** - * Sets mini future ID. - */ - public void miniId(int miniId) { - this.miniId = miniId; - } - - /** - * @return Near thread ID. - */ - public long threadId() { - return nearThreadId; - } - - /** - * Sets near thread ID. - */ - public void threadId(long nearThreadId) { - this.nearThreadId = nearThreadId; - } - - /** - * @return Error message. - */ - public @Nullable ErrorMessage errorMessage() { - return errMsg; - } - - /** - * Sets error message. - */ - public void errorMessage(@Nullable ErrorMessage errMsg) { - this.errMsg = errMsg; - } - /** {@inheritDoc} */ @Override public short directType() { return 54; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java index 15be184ccca5e..57039e829fbdd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java @@ -138,34 +138,16 @@ public GridNearTxPrepareResponse( this.onePhaseCommit = onePhaseCommit; } - /** - * @return One-phase commit on primary flag. - */ + /** @return One-phase commit on primary flag. */ public boolean onePhaseCommit() { return onePhaseCommit; } - /** - * @param onePhaseCommit New one-phase commit on primary flag. - */ - public void onePhaseCommit(boolean onePhaseCommit) { - this.onePhaseCommit = onePhaseCommit; - } - - /** - * @return Topology version, which is set when client node should remap lock request. - */ + /** @return Topology version, which is set when client node should remap lock request. */ @Nullable public AffinityTopologyVersion clientRemapVersion() { return clientRemapVer; } - /** - * @param clientRemapVer New topology version, which is set when client node should remap lock request. - */ - public void clientRemapVersion(@Nullable AffinityTopologyVersion clientRemapVer) { - this.clientRemapVer = clientRemapVer; - } - /** * @return Versions that are less than lock version ({@link #version()}). */ @@ -180,62 +162,26 @@ public void pending(@Nullable Collection pending) { this.pending = pending; } - /** - * @return Mini future ID. - */ + /** @return Mini future ID. */ public int miniId() { return miniId; } - /** - * @param miniId New mini future ID. - */ - public void miniId(int miniId) { - this.miniId = miniId; - } - - /** - * @return Future ID. - */ + /** @return Future ID. */ public IgniteUuid futureId() { return futId; } - /** - * @param futId New future ID. - */ - public void futureId(IgniteUuid futId) { - this.futId = futId; - } - - /** - * @return DHT version. - */ + /** @return DHT version. */ public GridCacheVersion dhtVersion() { return dhtVer; } - /** - * @param dhtVer New DHT version. - */ - public void dhtVersion(GridCacheVersion dhtVer) { - this.dhtVer = dhtVer; - } - - /** - * @return Write version. - */ + /** @return Write version. */ public GridCacheVersion writeVersion() { return writeVer; } - /** - * @param writeVer New write version. - */ - public void writeVersion(GridCacheVersion writeVer) { - this.writeVer = writeVer; - } - /** * Adds owned value. * @@ -262,20 +208,11 @@ public Map ownedValues() { return ownedVals == null ? Collections.emptyMap() : Collections.unmodifiableMap(ownedVals); } - /** - * @return Cache return value. - */ + /** @return Cache return value. */ public GridCacheReturn returnValue() { return retVal; } - /** - * @param retVal New cache return value. - */ - public void returnValue(GridCacheReturn retVal) { - this.retVal = retVal; - } - /** * @param filterFailedKeys Keys that did not pass the filter. */ @@ -298,34 +235,6 @@ public boolean hasOwnedValue(IgniteTxKey key) { return F.mapContainsKey(ownedVals, key); } - /** - * @return OwnedVals' keys for marshalling. - */ - public @Nullable Collection ownedValuesKeys() { - return ownedValKeys; - } - - /** - * @param ownedValKeys New ownedVals' keys for marshalling. - */ - public void ownedValuesKeys(@Nullable Collection ownedValKeys) { - this.ownedValKeys = ownedValKeys; - } - - /** - * @return OwnedVals' values for marshalling. - */ - public @Nullable Collection ownedValuesValues() { - return ownedValVals; - } - - /** - * @param ownedValVals New ownedVals' values for marshalling. - */ - public void ownedValuesValues(@Nullable Collection ownedValVals) { - this.ownedValVals = ownedValVals; - } - /** {@inheritDoc} */ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException { super.prepareMarshal(ctx); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java index b858725a6b0c3..f811e06500579 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java @@ -209,30 +209,11 @@ public void data(Collection data) { this.data = (Collection)data; } - /** - * @return If this is last response for this request or not. - */ + /** @return If this is last response for this request or not. */ public boolean finished() { return finished; } - /** - * @param finished If this is last response for this request or not. - */ - public void finished(boolean finished) { - this.finished = finished; - } - - /** */ - public Collection dataBytes() { - return dataBytes; - } - - /** */ - public void dataBytes(Collection dataBytes) { - this.dataBytes = dataBytes; - } - /** * @return Request id. */ @@ -240,31 +221,11 @@ public long requestId() { return reqId; } - /** */ - public void requestId(long reqId) { - this.reqId = reqId; - } - /** {@inheritDoc} */ @Override public @Nullable Throwable error() { return ErrorMessage.error(errMsg); } - /** */ - public @Nullable ErrorMessage errorMessage() { - return errMsg; - } - - /** */ - public void errorMessage(@Nullable ErrorMessage errMsg) { - this.errMsg = errMsg; - } - - /** */ - public void fields(boolean fields) { - this.fields = fields; - } - /** * @return If fields query. */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryBatchAck.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryBatchAck.java index 8f0b348e833c3..44be8368748fb 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryBatchAck.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryBatchAck.java @@ -62,27 +62,11 @@ public UUID routineId() { return routineId; } - /** - * @param routineId Routine ID. - */ - public void routineId(UUID routineId) { - this.routineId = routineId; - } - - /** - * @return Update counters. - */ - public Map updateCntrs() { + /** @return Update counters. */ + public Map updateCounters() { return updateCntrs; } - /** - * @param updateCntrs Update counters. - */ - public void updateCntrs(Map updateCntrs) { - this.updateCntrs = updateCntrs; - } - /** {@inheritDoc} */ @Override public boolean addDeploymentInfo() { return false; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java index 1d388a088141e..922e4203af3bf 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java @@ -177,7 +177,7 @@ protected GridTimeoutProcessor.CancelableTask getCancelableTask() { CacheContinuousQueryListener lsnr = lsnrs.get(msg.routineId()); if (lsnr != null) - lsnr.cleanupOnAck(msg.updateCntrs()); + lsnr.cleanupOnAck(msg.updateCounters()); } }); From 8ddda895bc2b0079806679f68a96041165a848f6 Mon Sep 17 00:00:00 2001 From: Nikita Amelchev Date: Wed, 25 Mar 2026 18:08:34 +0300 Subject: [PATCH 2/5] IGNITE-28364 Finalize migration of GridCacheMessage --- .../dht/atomic/GridDhtAtomicDeferredUpdateResponse.java | 4 +--- .../distributed/dht/atomic/GridDhtAtomicUpdateResponse.java | 5 ----- .../distributed/dht/atomic/GridNearAtomicUpdateResponse.java | 4 +--- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java index 0019ca2e4a1c0..eb84c09dc2fe2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java @@ -85,9 +85,7 @@ void timeoutSender(@Nullable GridTimeoutObject timeoutSnd) { return false; } - /** - * @return List of ACKed future ids. - */ + /** @return List of ACKed future ids. */ public GridLongList futureIds() { return futIds; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java index 3926b8d5615ea..4fb32861b354b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java @@ -82,11 +82,6 @@ public long futureId() { return futId; } - /** @return Errors. */ - public UpdateErrors errors() { - return errs; - } - /** * Sets update error. * diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java index 70ca84576d957..41574d370b92e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java @@ -152,9 +152,7 @@ public long futureId() { return futId; } - /** - * @return Errs. - */ + /** @return Errs. */ public UpdateErrors errors() { return errs; } From 42649bd80bbb1135424a3c8e7468d7d6494b0104 Mon Sep 17 00:00:00 2001 From: Nikita Amelchev Date: Thu, 26 Mar 2026 10:14:04 +0300 Subject: [PATCH 3/5] IGNITE-28364 Finalize migration of GridCacheMessage --- .../GridCacheMessageSelfTest.java | 494 +----------------- .../spi/communication/GridTestMessage.java | 109 +--- .../spi/communication/TestBadMessage.java | 62 +++ .../ignite/spi/communication/TestMessage.java | 53 ++ .../spi/communication/TestMessage1.java | 67 +++ .../spi/communication/TestMessage2.java | 85 +++ 6 files changed, 285 insertions(+), 585 deletions(-) create mode 100644 modules/core/src/test/java/org/apache/ignite/spi/communication/TestBadMessage.java create mode 100644 modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage.java create mode 100644 modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage1.java create mode 100644 modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage2.java diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java index 6acfc4c101ca5..5357052713835 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java @@ -17,8 +17,6 @@ package org.apache.ignite.spi.communication; -import java.nio.ByteBuffer; -import java.util.ArrayList; import java.util.Collection; import java.util.UUID; import java.util.concurrent.CountDownLatch; @@ -30,7 +28,6 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.failure.AbstractFailureHandler; import org.apache.ignite.failure.FailureContext; -import org.apache.ignite.internal.GridDirectCollection; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.managers.communication.GridIoManager; import org.apache.ignite.internal.managers.communication.GridIoPolicy; @@ -40,14 +37,7 @@ import org.apache.ignite.plugin.AbstractTestPluginProvider; import org.apache.ignite.plugin.ExtensionRegistry; import org.apache.ignite.plugin.PluginContext; -import org.apache.ignite.plugin.extensions.communication.Message; -import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType; -import org.apache.ignite.plugin.extensions.communication.MessageCollectionType; -import org.apache.ignite.plugin.extensions.communication.MessageFactory; import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider; -import org.apache.ignite.plugin.extensions.communication.MessageItemType; -import org.apache.ignite.plugin.extensions.communication.MessageReader; -import org.apache.ignite.plugin.extensions.communication.MessageWriter; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -221,476 +211,6 @@ private void doSend() throws Exception { assert latch.await(3, SECONDS); } - /** */ - private static class TestMessage extends GridCacheMessage { - /** */ - public static final short DIRECT_TYPE = 202; - - /** */ - @GridDirectCollection(TestMessage1.class) - private Collection entries = new ArrayList<>(); - - /** - * @param entry Entry. - */ - public void add(TestMessage1 entry) { - entries.add(entry); - } - - /** {@inheritDoc} */ - @Override public boolean addDeploymentInfo() { - return false; - } - - /** - * @return COllection of test messages. - */ - public Collection entries() { - return entries; - } - - /** {@inheritDoc} */ - @Override public short directType() { - return DIRECT_TYPE; - } - - /** {@inheritDoc} */ - @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) { - writer.setBuffer(buf); - - if (!super.writeTo(buf, writer)) - return false; - - if (!writer.isHeaderWritten()) { - if (!writer.writeHeader(directType())) - return false; - - writer.onHeaderWritten(); - } - - switch (writer.state()) { - case 3: - if (!writer.writeCollection(entries, - new MessageCollectionType(new MessageItemType(MessageCollectionItemType.MSG), false))) - return false; - - writer.incrementState(); - - } - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) { - reader.setBuffer(buf); - - if (!super.readFrom(buf, reader)) - return false; - - switch (reader.state()) { - case 3: - entries = reader.readCollection(new MessageCollectionType(new MessageItemType(MessageCollectionItemType.MSG), false)); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - } - - return true; - } - } - - /** - * Test message class. - */ - static class TestMessage1 extends GridCacheMessage { - /** */ - public static final short DIRECT_TYPE = 203; - - /** Body. */ - private String body; - - /** */ - private Message msg; - - /** - * @param msg Message. - * @param body Message body. - */ - public void init(Message msg, String body) { - this.msg = msg; - this.body = body; - } - - /** {@inheritDoc} */ - @Override public boolean addDeploymentInfo() { - return false; - } - - /** - * @return Body. - */ - public String body() { - return body; - } - - /** - * @return Message. - */ - public Message message() { - return msg; - } - - /** {@inheritDoc} */ - @Override public short directType() { - return DIRECT_TYPE; - } - - /** {@inheritDoc} */ - @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) { - writer.setBuffer(buf); - - if (!super.writeTo(buf, writer)) - return false; - - if (!writer.isHeaderWritten()) { - if (!writer.writeHeader(directType())) - return false; - - writer.onHeaderWritten(); - } - - switch (writer.state()) { - case 3: - if (!writer.writeString(body)) - return false; - - writer.incrementState(); - - case 4: - if (!writer.writeMessage(msg)) - return false; - - writer.incrementState(); - - } - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) { - reader.setBuffer(buf); - - if (!super.readFrom(buf, reader)) - return false; - - switch (reader.state()) { - case 3: - body = reader.readString(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - case 4: - msg = reader.readMessage(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - } - - return true; - } - } - - /** - * Test message class. - */ - static class TestMessage2 extends GridCacheMessage { - /** */ - public static final short DIRECT_TYPE = 201; - - /** Node id. */ - private UUID nodeId; - - /** Integer field. */ - private int id; - - /** Body. */ - private String body; - - /** */ - private Message msg; - - /** - * @param mes Message. - */ - public void init(Message mes, UUID nodeId, int id, String body) { - this.nodeId = nodeId; - this.id = id; - this.msg = mes; - this.body = body; - } - - /** {@inheritDoc} */ - @Override public boolean addDeploymentInfo() { - return false; - } - - /** - * @return Body. - */ - public String body() { - return body; - } - - /** - * @return Message. - */ - public Message message() { - return msg; - } - - /** - * @return Node id. - */ - public UUID nodeId() { - return nodeId; - } - - /** - * @return Id. - */ - public int id() { - return id; - } - - /** {@inheritDoc} */ - @Override public short directType() { - return DIRECT_TYPE; - } - - /** {@inheritDoc} */ - @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) { - writer.setBuffer(buf); - - if (!super.writeTo(buf, writer)) - return false; - - if (!writer.isHeaderWritten()) { - if (!writer.writeHeader(directType())) - return false; - - writer.onHeaderWritten(); - } - - switch (writer.state()) { - case 3: - if (!writer.writeUuid(nodeId)) - return false; - - writer.incrementState(); - - case 4: - if (!writer.writeInt(id)) - return false; - - writer.incrementState(); - - case 5: - if (!writer.writeString(body)) - return false; - - writer.incrementState(); - - case 6: - if (!writer.writeMessage(msg)) - return false; - - writer.incrementState(); - } - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) { - reader.setBuffer(buf); - - if (!super.readFrom(buf, reader)) - return false; - - switch (reader.state()) { - case 3: - nodeId = reader.readUuid(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - case 4: - id = reader.readInt(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - case 5: - body = reader.readString(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - case 6: - msg = reader.readMessage(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - } - - return true; - } - } - - /** - * Test message class. - */ - static class TestBadMessage extends GridCacheMessage { - /** */ - public static final short DIRECT_TYPE = 204; - - /** Node id. */ - private UUID nodeId; - - /** Integer field. */ - private int id; - - /** Body. */ - private String body; - - /** */ - private Message msg; - - /** {@inheritDoc} */ - @Override public boolean addDeploymentInfo() { - return false; - } - - /** {@inheritDoc} */ - @Override public short directType() { - return DIRECT_TYPE; - } - - /** {@inheritDoc} */ - @Override public String toString() { - throw new RuntimeException("Exception while log message"); - } - - /** {@inheritDoc} */ - @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) { - writer.setBuffer(buf); - - if (!super.writeTo(buf, writer)) - return false; - - if (!writer.isHeaderWritten()) { - if (!writer.writeHeader(directType())) - return false; - - writer.onHeaderWritten(); - } - - switch (writer.state()) { - case 3: - if (!writer.writeUuid(nodeId)) - return false; - - writer.incrementState(); - - case 4: - if (!writer.writeInt(id)) - return false; - - writer.incrementState(); - - case 5: - if (!writer.writeString(body)) - return false; - - writer.incrementState(); - - case 6: - if (!writer.writeMessage(msg)) - return false; - - writer.incrementState(); - - } - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) { - reader.setBuffer(buf); - - if (!super.readFrom(buf, reader)) - return false; - - switch (reader.state()) { - case 3: - nodeId = reader.readUuid(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - case 4: - id = reader.readInt(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - case 5: - body = reader.readString(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - case 6: - msg = reader.readMessage(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - } - - return true; - } - } - /** */ private static class TestFailureHandler extends AbstractFailureHandler { /** {@inheritDoc} */ @@ -710,14 +230,12 @@ public static class TestPluginProvider extends AbstractTestPluginProvider { /** {@inheritDoc} */ @Override public void initExtensions(PluginContext ctx, ExtensionRegistry registry) { - registry.registerExtension(MessageFactoryProvider.class, new MessageFactoryProvider() { - @Override public void registerAll(MessageFactory factory) { - factory.register(TestMessage.DIRECT_TYPE, TestMessage::new); - factory.register(GridTestMessage.DIRECT_TYPE, GridTestMessage::new); - factory.register(TestMessage1.DIRECT_TYPE, TestMessage1::new); - factory.register(TestMessage2.DIRECT_TYPE, TestMessage2::new); - factory.register(TestBadMessage.DIRECT_TYPE, TestBadMessage::new); - } + registry.registerExtension(MessageFactoryProvider.class, factory -> { + factory.register(TestMessage.DIRECT_TYPE, TestMessage::new, new TestMessageSerializer()); + factory.register(GridTestMessage.DIRECT_TYPE, GridTestMessage::new, new GridTestMessageSerializer()); + factory.register(TestMessage1.DIRECT_TYPE, TestMessage1::new, new TestMessage1Serializer()); + factory.register(TestMessage2.DIRECT_TYPE, TestMessage2::new, new TestMessage2Serializer()); + factory.register(TestBadMessage.DIRECT_TYPE, TestBadMessage::new, new TestBadMessageSerializer()); }); } } diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java index 2e096ae06c68b..040ac62f1fc35 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java @@ -17,12 +17,10 @@ package org.apache.ignite.spi.communication; -import java.nio.ByteBuffer; import java.util.Objects; import java.util.UUID; +import org.apache.ignite.internal.Order; import org.apache.ignite.plugin.extensions.communication.Message; -import org.apache.ignite.plugin.extensions.communication.MessageReader; -import org.apache.ignite.plugin.extensions.communication.MessageWriter; /** * Test message for communication SPI tests. @@ -32,16 +30,20 @@ public class GridTestMessage implements Message { public static final short DIRECT_TYPE = 200; /** */ - private UUID srcNodeId; + @Order(0) + UUID srcNodeId; /** */ - private long msgId; + @Order(1) + long msgId; /** */ - private long resId; + @Order(2) + long resId; /** Network payload */ - private byte[] payload; + @Order(3) + byte[] payload; /** */ public GridTestMessage() { @@ -59,108 +61,21 @@ public GridTestMessage(UUID srcNodeId, long msgId, long resId) { this.resId = resId; } - /** - * @return Id of message originator. - */ + /** @return Id of message originator. */ public UUID getSourceNodeId() { return srcNodeId; } - /** - * @return Message sequence id. - */ + /** @return Message sequence id. */ public long getMsgId() { return msgId; } - /** - * @param payload Payload to be set. - */ + /** @param payload Payload to be set. */ public void payload(byte[] payload) { this.payload = payload; } - /** {@inheritDoc} */ - @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) { - writer.setBuffer(buf); - - if (!writer.isHeaderWritten()) { - if (!writer.writeHeader(directType())) - return false; - - writer.onHeaderWritten(); - } - - switch (writer.state()) { - case 0: - if (!writer.writeUuid(srcNodeId)) - return false; - - writer.incrementState(); - - case 1: - if (!writer.writeLong(msgId)) - return false; - - writer.incrementState(); - - case 2: - if (!writer.writeLong(resId)) - return false; - - writer.incrementState(); - - case 3: - if (!writer.writeByteArray(payload)) - return false; - - writer.incrementState(); - } - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) { - reader.setBuffer(buf); - - switch (reader.state()) { - case 0: - srcNodeId = reader.readUuid(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - case 1: - msgId = reader.readLong(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - case 2: - resId = reader.readLong(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - case 3: - payload = reader.readByteArray(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - } - - return true; - } - /** {@inheritDoc} */ @Override public short directType() { return DIRECT_TYPE; diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/TestBadMessage.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestBadMessage.java new file mode 100644 index 0000000000000..195432e4577b9 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestBadMessage.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.spi.communication; + +import java.util.UUID; +import org.apache.ignite.internal.Order; +import org.apache.ignite.internal.processors.cache.GridCacheMessage; +import org.apache.ignite.plugin.extensions.communication.Message; + +/** + * Test message class. + */ +public class TestBadMessage extends GridCacheMessage { + /** */ + public static final short DIRECT_TYPE = 204; + + /** Node id. */ + @Order(0) + UUID nodeId; + + /** Integer field. */ + @Order(1) + int id; + + /** Body. */ + @Order(2) + String body; + + /** */ + @Order(3) + Message msg; + + /** {@inheritDoc} */ + @Override public boolean addDeploymentInfo() { + return false; + } + + /** {@inheritDoc} */ + @Override public short directType() { + return DIRECT_TYPE; + } + + /** {@inheritDoc} */ + @Override public String toString() { + throw new RuntimeException("Exception while log message"); + } +} diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage.java new file mode 100644 index 0000000000000..d69e74a522fd1 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.spi.communication; + +import java.util.ArrayList; +import java.util.Collection; +import org.apache.ignite.internal.Order; +import org.apache.ignite.internal.processors.cache.GridCacheMessage; + +/** */ +public class TestMessage extends GridCacheMessage { + /** */ + public static final short DIRECT_TYPE = 202; + + /** */ + @Order(0) + Collection entries = new ArrayList<>(); + + /** @param entry Entry. */ + public void add(TestMessage1 entry) { + entries.add(entry); + } + + /** {@inheritDoc} */ + @Override public boolean addDeploymentInfo() { + return false; + } + + /** @return Collection of test messages. */ + public Collection entries() { + return entries; + } + + /** {@inheritDoc} */ + @Override public short directType() { + return DIRECT_TYPE; + } +} diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage1.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage1.java new file mode 100644 index 0000000000000..ea36359b45fe3 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage1.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.spi.communication; + +import org.apache.ignite.internal.Order; +import org.apache.ignite.internal.processors.cache.GridCacheMessage; +import org.apache.ignite.plugin.extensions.communication.Message; + +/** + * Test message class. + */ +public class TestMessage1 extends GridCacheMessage { + /** */ + public static final short DIRECT_TYPE = 203; + + /** Body. */ + @Order(0) + String body; + + /** */ + @Order(1) + Message msg; + + /** + * @param msg Message. + * @param body Message body. + */ + public void init(Message msg, String body) { + this.msg = msg; + this.body = body; + } + + /** {@inheritDoc} */ + @Override public boolean addDeploymentInfo() { + return false; + } + + /** @return Body. */ + public String body() { + return body; + } + + /** @return Message. */ + public Message message() { + return msg; + } + + /** {@inheritDoc} */ + @Override public short directType() { + return DIRECT_TYPE; + } +} diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage2.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage2.java new file mode 100644 index 0000000000000..5b71d33c359dd --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage2.java @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.spi.communication; + +import java.util.UUID; +import org.apache.ignite.internal.Order; +import org.apache.ignite.internal.processors.cache.GridCacheMessage; +import org.apache.ignite.plugin.extensions.communication.Message; + +/** + * Test message class. + */ +public class TestMessage2 extends GridCacheMessage { + /** */ + public static final short DIRECT_TYPE = 201; + + /** Node id. */ + @Order(0) + UUID nodeId; + + /** Integer field. */ + @Order(1) + int id; + + /** Body. */ + @Order(2) + String body; + + /** */ + @Order(3) + Message msg; + + /** @param mes Message. */ + public void init(Message mes, UUID nodeId, int id, String body) { + this.nodeId = nodeId; + this.id = id; + this.msg = mes; + this.body = body; + } + + /** {@inheritDoc} */ + @Override public boolean addDeploymentInfo() { + return false; + } + + /** @return Body.*/ + public String body() { + return body; + } + + /** @return Message. */ + public Message message() { + return msg; + } + + /** @return Node id. */ + public UUID nodeId() { + return nodeId; + } + + /** @return Id. */ + public int id() { + return id; + } + + /** {@inheritDoc} */ + @Override public short directType() { + return DIRECT_TYPE; + } +} From 60914451d61d20f8f8511b786f7f2a153bf2da6c Mon Sep 17 00:00:00 2001 From: Nikita Amelchev Date: Thu, 26 Mar 2026 13:47:49 +0300 Subject: [PATCH 4/5] IGNITE-28364 Finalize migration of GridCacheMessage --- ...ommunicationSpiSslVolatilePayloadTest.java | 10 ++- .../GridAbstractCommunicationSelfTest.java | 12 +-- .../spi/communication/GridTestMessage.java | 5 ++ .../TestVolatilePayloadMessage.java | 85 ++----------------- .../GridTcpCommunicationSpiAbstractTest.java | 9 +- ...unicationSpiConcurrentConnectSelfTest.java | 10 +-- ...GridTcpCommunicationSpiConfigSelfTest.java | 5 +- ...CommunicationSpiMultithreadedSelfTest.java | 5 +- ...cpCommunicationSpiRecoveryAckSelfTest.java | 10 +-- ...idTcpCommunicationSpiRecoverySelfTest.java | 5 +- ...mmunicationRecoveryAckClosureSelfTest.java | 10 +-- .../tcp/TcpCommunicationStatisticsTest.java | 8 +- 12 files changed, 40 insertions(+), 134 deletions(-) diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/TcpCommunicationSpiSslVolatilePayloadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/TcpCommunicationSpiSslVolatilePayloadTest.java index 9533c154c22b3..9be2ee3156092 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/TcpCommunicationSpiSslVolatilePayloadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/TcpCommunicationSpiSslVolatilePayloadTest.java @@ -18,7 +18,6 @@ package org.apache.ignite.internal.util.nio; import java.util.Arrays; -import java.util.Collections; import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; @@ -26,16 +25,17 @@ import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Supplier; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.internal.util.nio.ssl.BlockingSslHandler; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteRunnable; import org.apache.ignite.plugin.extensions.communication.Message; +import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider; import org.apache.ignite.spi.communication.CommunicationListener; import org.apache.ignite.spi.communication.CommunicationSpi; import org.apache.ignite.spi.communication.GridAbstractCommunicationSelfTest; import org.apache.ignite.spi.communication.TestVolatilePayloadMessage; +import org.apache.ignite.spi.communication.TestVolatilePayloadMessageSerializer; import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; import org.apache.ignite.spi.communication.tcp.internal.GridNioServerWrapper; import org.apache.ignite.spi.communication.tcp.messages.RecoveryLastReceivedMessage; @@ -94,8 +94,10 @@ public class TcpCommunicationSpiSslVolatilePayloadTest extends GridAbstractCommu } /** {@inheritDoc} */ - @Override protected Map> customMessageTypes() { - return Collections.singletonMap(TestVolatilePayloadMessage.DIRECT_TYPE, TestVolatilePayloadMessage::new); + @Override protected MessageFactoryProvider customMessageFactory() { + return f -> f.register( + TestVolatilePayloadMessage.DIRECT_TYPE, TestVolatilePayloadMessage::new, new TestVolatilePayloadMessageSerializer() + ); } /** {@inheritDoc} */ diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java index b2b94378e982e..b6256b6dc7cd9 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java @@ -25,7 +25,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.UUID; -import java.util.function.Supplier; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.configuration.IgniteConfiguration; @@ -35,7 +34,6 @@ import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.plugin.extensions.communication.Message; -import org.apache.ignite.plugin.extensions.communication.MessageFactory; import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider; import org.apache.ignite.spi.IgniteSpiAdapter; import org.apache.ignite.testframework.GridSpiTestContext; @@ -81,7 +79,7 @@ protected GridAbstractCommunicationSelfTest() { protected abstract CommunicationListener createMessageListener(UUID nodeId); /** */ - protected abstract Map> customMessageTypes(); + protected abstract MessageFactoryProvider customMessageFactory(); /** */ protected boolean isSslEnabled() { @@ -155,14 +153,8 @@ private void startSpis() throws Exception { GridSpiTestContext ctx = initSpiContext(); - MessageFactoryProvider testMsgFactory = new MessageFactoryProvider() { - @Override public void registerAll(MessageFactory factory) { - customMessageTypes().forEach(factory::register); - } - }; - ctx.messageFactory(new IgniteMessageFactoryImpl(new MessageFactoryProvider[] { - new GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory})); + new GridIoMessageFactory(jdk(), U.gridClassLoader()), customMessageFactory()})); ctx.setLocalNode(node); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java index 040ac62f1fc35..83a6ea91775b7 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java @@ -21,6 +21,7 @@ import java.util.UUID; import org.apache.ignite.internal.Order; import org.apache.ignite.plugin.extensions.communication.Message; +import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider; /** * Test message for communication SPI tests. @@ -29,6 +30,10 @@ public class GridTestMessage implements Message { /** */ public static final short DIRECT_TYPE = 200; + /** */ + public static final MessageFactoryProvider GRID_TEST_MESSAGE_FACTORY = f -> f.register( + GridTestMessage.DIRECT_TYPE, GridTestMessage::new, new GridTestMessageSerializer()); + /** */ @Order(0) UUID srcNodeId; diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/TestVolatilePayloadMessage.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestVolatilePayloadMessage.java index 16aa598c22248..1a428be60e358 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/TestVolatilePayloadMessage.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestVolatilePayloadMessage.java @@ -17,10 +17,8 @@ package org.apache.ignite.spi.communication; -import java.nio.ByteBuffer; +import org.apache.ignite.internal.Order; import org.apache.ignite.plugin.extensions.communication.Message; -import org.apache.ignite.plugin.extensions.communication.MessageReader; -import org.apache.ignite.plugin.extensions.communication.MessageWriter; /** */ public class TestVolatilePayloadMessage implements Message { @@ -28,13 +26,16 @@ public class TestVolatilePayloadMessage implements Message { public static final short DIRECT_TYPE = 210; /** */ - private int idx; + @Order(0) + int idx; /** */ - private byte[] payload; + @Order(1) + byte[] payload; /** */ - private int payloadLen; + @Order(2) + int payloadLen; /** */ public TestVolatilePayloadMessage() { @@ -53,81 +54,11 @@ public int index() { return idx; } - /** - * @return Network payload. - */ + /** @return Network payload. */ public byte[] payload() { return payload; } - /** {@inheritDoc} */ - @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) { - writer.setBuffer(buf); - - if (!writer.isHeaderWritten()) { - if (!writer.writeHeader(directType())) - return false; - - writer.onHeaderWritten(); - } - - switch (writer.state()) { - case 0: - if (!writer.writeInt(idx)) - return false; - - writer.incrementState(); - case 1: - if (!writer.writeInt(payloadLen)) - return false; - - writer.incrementState(); - case 2: - if (!writer.writeByteArray(payload)) - return false; - - writer.incrementState(); - } - - return true; - } - - /** {@inheritDoc} */ - @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) { - reader.setBuffer(buf); - - switch (reader.state()) { - case 0: - idx = reader.readInt(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - case 1: - payloadLen = reader.readInt(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - - case 2: - if (buf.remaining() < payloadLen) - return false; - - payload = reader.readByteArray(); - - if (!reader.isLastRead()) - return false; - - reader.incrementState(); - } - - return true; - } - /** {@inheritDoc} */ @Override public short directType() { return DIRECT_TYPE; diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiAbstractTest.java index d9fe1c6f81114..d355ba404a1cf 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiAbstractTest.java @@ -19,7 +19,6 @@ import java.util.ArrayList; import java.util.BitSet; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -29,7 +28,6 @@ import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.CyclicBarrier; -import java.util.function.Supplier; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.util.nio.GridCommunicationClient; @@ -38,6 +36,7 @@ import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.lang.IgniteRunnable; import org.apache.ignite.plugin.extensions.communication.Message; +import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider; import org.apache.ignite.spi.IgniteSpiAdapter; import org.apache.ignite.spi.communication.CommunicationListener; import org.apache.ignite.spi.communication.CommunicationSpi; @@ -46,6 +45,8 @@ import org.apache.ignite.testframework.GridTestUtils; import org.junit.Test; +import static org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY; + /** * Test for {@link TcpCommunicationSpi} */ @@ -86,8 +87,8 @@ abstract class GridTcpCommunicationSpiAbstractTest extends GridAbstractCommunica } /** {@inheritDoc} */ - @Override protected Map> customMessageTypes() { - return Collections.singletonMap(GridTestMessage.DIRECT_TYPE, GridTestMessage::new); + @Override protected MessageFactoryProvider customMessageFactory() { + return GRID_TEST_MESSAGE_FACTORY; } /** */ diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java index 54c6a40c1fa96..654e72892808d 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java @@ -47,7 +47,6 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteRunnable; import org.apache.ignite.plugin.extensions.communication.Message; -import org.apache.ignite.plugin.extensions.communication.MessageFactory; import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider; import org.apache.ignite.spi.IgniteSpiAdapter; import org.apache.ignite.spi.communication.CommunicationListener; @@ -65,6 +64,7 @@ import org.junit.Test; import static org.apache.ignite.marshaller.Marshallers.jdk; +import static org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY; /** * @@ -433,14 +433,8 @@ private void startSpis(MessageListener lsnr) throws Exception { GridSpiTestContext ctx = initSpiContext(); - MessageFactoryProvider testMsgFactory = new MessageFactoryProvider() { - @Override public void registerAll(MessageFactory factory) { - factory.register(GridTestMessage.DIRECT_TYPE, GridTestMessage::new); - } - }; - ctx.messageFactory(new IgniteMessageFactoryImpl( - new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory}) + new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), U.gridClassLoader()), GRID_TEST_MESSAGE_FACTORY}) ); ctx.setLocalNode(node); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java index 11a00c77265e8..d4f53758320ea 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java @@ -59,6 +59,7 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MACS; import static org.apache.ignite.internal.util.IgniteUtils.spiAttribute; import static org.apache.ignite.marshaller.Marshallers.jdk; +import static org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY; import static org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.ATTR_HOST_NAMES; import static org.apache.ignite.testframework.GridTestUtils.getFreeCommPort; @@ -250,10 +251,8 @@ private TcpCommunicationSpi initializeSpi(GridSpiTestContext ctx, node.setId(rsrcs.getNodeId()); - MessageFactoryProvider testMsgFactory = factory -> factory.register(GridTestMessage.DIRECT_TYPE, GridTestMessage::new); - ctx.messageFactory(new IgniteMessageFactoryImpl(new MessageFactoryProvider[]{ - new GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory})); + new GridIoMessageFactory(jdk(), U.gridClassLoader()), GRID_TEST_MESSAGE_FACTORY})); ctx.setLocalNode(node); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiMultithreadedSelfTest.java index 2d08829de4352..18909f7add40c 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiMultithreadedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiMultithreadedSelfTest.java @@ -65,6 +65,7 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MACS; import static org.apache.ignite.marshaller.Marshallers.jdk; +import static org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY; /** * Class for multithreaded {@link TcpCommunicationSpi} test. @@ -466,10 +467,8 @@ private int getSpiCount() { GridSpiTestContext ctx = initSpiContext(); - MessageFactoryProvider testMsgFactory = factory -> factory.register(GridTestMessage.DIRECT_TYPE, GridTestMessage::new); - ctx.messageFactory(new IgniteMessageFactoryImpl( - new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory}) + new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), U.gridClassLoader()), GRID_TEST_MESSAGE_FACTORY}) ); ctx.timeoutProcessor(timeoutProcessor); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java index d9673085e92fa..91343407e1af7 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java @@ -38,7 +38,6 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteRunnable; import org.apache.ignite.plugin.extensions.communication.Message; -import org.apache.ignite.plugin.extensions.communication.MessageFactory; import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider; import org.apache.ignite.spi.IgniteSpiAdapter; import org.apache.ignite.spi.IgniteSpiException; @@ -56,6 +55,7 @@ import org.junit.Test; import static org.apache.ignite.marshaller.Marshallers.jdk; +import static org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY; /** * @@ -399,14 +399,8 @@ private void startSpis(int ackCnt, int idleTimeout, int queueLimit) throws Excep GridSpiTestContext ctx = initSpiContext(); - MessageFactoryProvider testMsgFactory = new MessageFactoryProvider() { - @Override public void registerAll(MessageFactory factory) { - factory.register(GridTestMessage.DIRECT_TYPE, GridTestMessage::new); - } - }; - ctx.messageFactory(new IgniteMessageFactoryImpl( - new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory}) + new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), U.gridClassLoader()), GRID_TEST_MESSAGE_FACTORY}) ); ctx.setLocalNode(node); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java index 2169a66915fac..46bac32c8ff2b 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java @@ -60,6 +60,7 @@ import org.junit.Test; import static org.apache.ignite.marshaller.Marshallers.jdk; +import static org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY; /** * @@ -727,10 +728,8 @@ private void startSpis() throws Exception { GridSpiTestContext ctx = initSpiContext(); - MessageFactoryProvider testMsgFactory = factory -> factory.register(GridTestMessage.DIRECT_TYPE, GridTestMessage::new); - ctx.messageFactory(new IgniteMessageFactoryImpl( - new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory}) + new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), U.gridClassLoader()), GRID_TEST_MESSAGE_FACTORY}) ); ctx.setLocalNode(node); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java index de813ed505d3f..a1eff7105d7f3 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java @@ -41,7 +41,6 @@ import org.apache.ignite.lang.IgniteInClosure; import org.apache.ignite.lang.IgniteRunnable; import org.apache.ignite.plugin.extensions.communication.Message; -import org.apache.ignite.plugin.extensions.communication.MessageFactory; import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider; import org.apache.ignite.spi.IgniteSpiAdapter; import org.apache.ignite.spi.IgniteSpiException; @@ -59,6 +58,7 @@ import org.junit.Test; import static org.apache.ignite.marshaller.Marshallers.jdk; +import static org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY; /** * @@ -452,14 +452,8 @@ private void startSpis(int ackCnt, int idleTimeout, int queueLimit) throws Excep GridSpiTestContext ctx = initSpiContext(); - MessageFactoryProvider testMsgFactory = new MessageFactoryProvider() { - @Override public void registerAll(MessageFactory factory) { - factory.register(GridTestMessage.DIRECT_TYPE, GridTestMessage::new); - } - }; - ctx.messageFactory(new IgniteMessageFactoryImpl( - new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory}) + new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), U.gridClassLoader()), GRID_TEST_MESSAGE_FACTORY}) ); ctx.setLocalNode(node); diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationStatisticsTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationStatisticsTest.java index f4d852f655716..3fccdb1be0f43 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationStatisticsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationStatisticsTest.java @@ -38,13 +38,13 @@ import org.apache.ignite.plugin.ExtensionRegistry; import org.apache.ignite.plugin.PluginContext; import org.apache.ignite.plugin.extensions.communication.Message; -import org.apache.ignite.plugin.extensions.communication.MessageFactory; import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider; import org.apache.ignite.spi.IgniteSpiException; import org.apache.ignite.spi.communication.GridTestMessage; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; +import static org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY; import static org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.COMMUNICATION_METRICS_GROUP_NAME; import static org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.RECEIVED_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAME; import static org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.SENT_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAME; @@ -222,11 +222,7 @@ public static class TestPluginProvider extends AbstractTestPluginProvider { /** {@inheritDoc} */ @Override public void initExtensions(PluginContext ctx, ExtensionRegistry registry) { - registry.registerExtension(MessageFactoryProvider.class, new MessageFactoryProvider() { - @Override public void registerAll(MessageFactory factory) { - factory.register(GridTestMessage.DIRECT_TYPE, GridTestMessage::new); - } - }); + registry.registerExtension(MessageFactoryProvider.class, GRID_TEST_MESSAGE_FACTORY); } } } From 5ba7e493a296766618d3ebc5e7063ddfc97380d9 Mon Sep 17 00:00:00 2001 From: Nikita Amelchev Date: Thu, 26 Mar 2026 14:44:39 +0300 Subject: [PATCH 5/5] IGNITE-28364 Finalize migration of GridCacheMessage --- ...ommunicationConnectionPoolMetricsTest.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/CommunicationConnectionPoolMetricsTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/CommunicationConnectionPoolMetricsTest.java index b369b2e6f1c30..5d18e781e1e73 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/CommunicationConnectionPoolMetricsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/CommunicationConnectionPoolMetricsTest.java @@ -46,8 +46,8 @@ import org.apache.ignite.plugin.extensions.communication.Message; import org.apache.ignite.plugin.extensions.communication.MessageFactory; import org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider; +import org.apache.ignite.plugin.extensions.communication.MessageReader; import org.apache.ignite.plugin.extensions.communication.MessageWriter; -import org.apache.ignite.spi.communication.GridTestMessage; import org.apache.ignite.spi.communication.tcp.internal.ConnectionClientPool; import org.apache.ignite.spi.metric.IntMetric; import org.apache.ignite.spi.metric.LongMetric; @@ -542,7 +542,10 @@ public static MetricRegistryImpl metricsForCommunicationConnection(Ignite from, } /** */ - private static class TestMessage extends GridTestMessage { + private static class TestMessage implements Message { + /** */ + public static final short DIRECT_TYPE = 200; + /** */ private final int writeDelay; @@ -567,7 +570,22 @@ public TestMessage() { } } - return super.writeTo(buf, writer); + writer.setBuffer(buf); + + if (!writer.writeHeader(directType())) + return false; + + return true; + } + + /** {@inheritDoc} */ + @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) { + return true; + } + + /** {@inheritDoc} */ + @Override public short directType() { + return DIRECT_TYPE; } } }