zstan commented on code in PR #12663:
URL: https://github.com/apache/ignite/pull/12663#discussion_r2757301954
##########
modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java:
##########
@@ -3242,46 +3241,19 @@ private void
sendMessageToClients(TcpDiscoveryAbstractMessage msg) {
if (spi.ensured(msg))
msgHist.add(msg);
- byte[] msgBytes = null;
-
for (ClientMessageWorker clientMsgWorker :
clientMsgWorkers.values()) {
- if (msgBytes == null) {
- try {
- msgBytes =
clientMsgWorker.ses.serializeMessage(msg);
- }
- catch (IgniteCheckedException | IOException e) {
- U.error(log, "Failed to serialize message to a
client: " + msg + ", recepient " +
- "client id: " + clientMsgWorker.clientNodeId,
e);
-
- break;
- }
- }
-
- TcpDiscoveryAbstractMessage msg0 = msg;
- byte[] msgBytes0 = msgBytes;
-
if (msg instanceof TcpDiscoveryNodeAddedMessage) {
TcpDiscoveryNodeAddedMessage nodeAddedMsg =
(TcpDiscoveryNodeAddedMessage)msg;
- TcpDiscoveryNode node = nodeAddedMsg.node();
-
- if (clientMsgWorker.clientNodeId.equals(node.id())) {
- try {
- // TODO:
https://issues.apache.org/jira/browse/IGNITE-27556 refactor serialization.
- msg0 = U.unmarshal(spi.marshaller(), msgBytes,
-
U.resolveClassLoader(spi.ignite().configuration()));
-
- prepareNodeAddedMessage(msg0,
clientMsgWorker.clientNodeId, null);
+ if
(clientMsgWorker.clientNodeId.equals(nodeAddedMsg.node().id())) {
+ msg = new
TcpDiscoveryNodeAddedMessage(nodeAddedMsg);
Review Comment:
plz also change notation for value :
org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeAddedMessage#msgs
it needs to be Nullable too
##########
modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java:
##########
@@ -7699,18 +7661,13 @@ void addMessage(TcpDiscoveryAbstractMessage msg,
@Nullable byte[] msgBytes) {
}
/** {@inheritDoc} */
- @Override protected void
processMessage(T2<TcpDiscoveryAbstractMessage, byte[]> msgT) {
+ @Override protected void processMessage(TcpDiscoveryAbstractMessage
msg) {
boolean success = false;
- TcpDiscoveryAbstractMessage msg = msgT.get1();
-
try {
assert msg.verified() : msg;
- byte[] msgBytes = msgT.get2();
-
- if (msgBytes == null)
- msgBytes = ses.serializeMessage(msg);
+ byte[] msgBytes = ses.serializeMessage(msg);
Review Comment:
probably it also need to be changed: a bit lines below we can see that if :
(msg instanceof TcpDiscoveryClientAckResponse) && clientVer == null this
**msgBytes** result is not used, probably you can make a bit improvement here ?
But it`s up to you.
--
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]