anton-vinogradov opened a new pull request, #13427:
URL: https://github.com/apache/ignite/pull/13427
### Problem
`MarshallableMessage` means two things at once: "call me before sending" and
"I need a `Marshaller`". Six of its implementations use neither the marshaller
nor the class loader — they only convert their own fields into the form that
goes on the wire:
* `GridCacheEntryInfo` — turns an absolute TTL into a relative one and back;
* `GridDhtPartitionsFullMessage`, `GridDhtPartitionsSingleMessage` — copy
and zip the partition maps;
* `TcpDiscoveryNode` — wraps metrics into `NodeMetricsMessage`;
* `ColocationGroup` — packs assignments into bits;
* `GridNearTxPrepareRequest` — sets the expiry-transfer flag on its entries.
They still received a `Marshaller` in the generated companion, and "does
this message need a marshaller" could not be told from its type.
### Solution
A new interface for the second meaning:
```java
public interface CustomWireFormMessage extends Message {
void toWireForm() throws IgniteCheckedException;
void fromWireForm() throws IgniteCheckedException;
}
```
The six classes moved to it; the generator (`MessageProcessor`,
`MessageMarshallerGenerator`) and `AbstractMarshallableMessageFactoryProvider`
handle both interfaces. The `NonMarshallableMessage` check covers the new one
as well.
A class may implement both: the generated `TcpDiscoveryNodeMarshaller` keeps
its `Marshaller` for the `@Marshalled` fields and calls `toWireForm()` next to
it, while `GridCacheEntryInfoMarshaller` now has no `Marshaller` field at all.
Companions holding a `Marshaller` in core: 29 → 25.
Also fixed `GridTestUtils.loadMarshaller`: it picked the companion
constructor by `instanceof MarshallableMessage`, while the generator emits a
`Marshaller` constructor for `marshallable || hasMarshalled` — so the criterion
was wrong for classes with `@Marshalled` fields and no interface. It now asks
the constructor itself.
No wire format change. Part of IGNITE-28935.
### Verification
* `MessageProcessorTest` — 39/39 (the expected diagnostic text is updated:
the message now names both interfaces)
* `MessageFactoryMarshallerInitializationTest` — 3/3
* `DirectMarshallingMessagesTest` — 1/1
* `IgniteCacheEntryListenerAtomicTest` — 9/9
* `CacheExchangeMergeTest` — 35/35
* `GridCacheAtomicNearEnabledFullApiSelfTest` — 150/150
* `TcpDiscoverySelfTest` — 51 tests; `testMulticastIpFinder` failed once on
a local multicast flake and passes on a rerun
* full build of core and calcite with `-Pcheckstyle` — clean
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]