petrov-mg commented on code in PR #13243:
URL: https://github.com/apache/ignite/pull/13243#discussion_r3441113614


##########
modules/core/src/main/java/org/apache/ignite/internal/thread/context/DistributedOperationAttributeManager.java:
##########
@@ -0,0 +1,117 @@
+/*
+ * 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.internal.thread.context;
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.DistributedOperationContextAttributesMessage;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class DistributedOperationAttributeManager {

Review Comment:
   DistributedOperationAttributeManager -> 
DistributedOperationContextAttributeManager



##########
modules/commons/src/main/java/org/apache/ignite/internal/thread/context/OperationContextAttribute.java:
##########
@@ -32,7 +32,7 @@ public class OperationContextAttribute<T> {
     static final AtomicInteger ID_GEN = new AtomicInteger();
 
     /** */
-    static final int MAX_ATTR_CNT = Integer.SIZE;
+    public static final int MAX_ATTR_CNT = Integer.SIZE;

Review Comment:
   We can revert this change.



##########
modules/core/src/main/java/org/apache/ignite/internal/thread/context/DistributedOperationAttributeManager.java:
##########
@@ -0,0 +1,117 @@
+/*
+ * 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.internal.thread.context;
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.DistributedOperationContextAttributesMessage;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class DistributedOperationAttributeManager {
+    /** */
+    public static final byte MAX_DISTRIBUTED_ATTR_ID = 7;

Review Comment:
   Let's use MAX_DISTRIBUTED_ATTR_**CNT** = 8;
   And change it to package private



##########
modules/core/src/main/java/org/apache/ignite/internal/thread/context/DistributedOperationAttributeManager.java:
##########
@@ -0,0 +1,117 @@
+/*
+ * 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.internal.thread.context;
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.DistributedOperationContextAttributesMessage;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class DistributedOperationAttributeManager {
+    /** */
+    public static final byte MAX_DISTRIBUTED_ATTR_ID = 7;
+
+    /** */
+    private static final DistributedOperationAttributeManager INSTANCE = new 
DistributedOperationAttributeManager();
+
+    /** Attributes by their id. */
+    private final Map<Byte, OperationContextAttribute<? extends Message>> 
attrs = new ConcurrentHashMap<>();
+
+    /** */
+    public static DistributedOperationAttributeManager instance() {
+        return INSTANCE;
+    }
+
+    /** */
+    public <T extends Message> OperationContextAttribute<T> 
createDistributedAttriubte(byte id, @Nullable T initVal) {
+        assert id >= 0;
+
+        if (attrs.size() == OperationContextAttribute.MAX_ATTR_CNT)
+            throw new IgniteException("Maximum number of ributed attributes is 
exceeded [" + OperationContextAttribute.MAX_ATTR_CNT + "].");
+
+        attrs.compute(id, (id0, attr0) -> {
+            if (attr0 != null)
+                throw new IgniteException("Duplicated distributed attribute 
id: " + id);
+
+            return OperationContextAttribute.newInstance(initVal);
+        });
+
+        return (OperationContextAttribute<T>)attrs.get(id);
+    }
+
+    /** */
+    public @Nullable DistributedOperationContextAttributesMessage 
collectDistributedAttributes() {
+        DistributedOperationContextAttributesMessage res = null;
+
+        for (Map.Entry<Byte, OperationContextAttribute<? extends Message>> e : 
attrs.entrySet()) {
+            OperationContextAttribute<? extends Message> attr = e.getValue();
+
+            Message curVal = OperationContext.get(attr);
+
+            assert attr.initialValue() == null || curVal == null || 
curVal.getClass().isAssignableFrom(attr.initialValue().getClass());

Review Comment:
   Frankly, I don't understand the purpose of this assertion.



##########
modules/core/src/main/java/org/apache/ignite/internal/thread/context/DistributedOperationAttributeManager.java:
##########
@@ -0,0 +1,117 @@
+/*
+ * 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.internal.thread.context;
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.DistributedOperationContextAttributesMessage;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class DistributedOperationAttributeManager {
+    /** */
+    public static final byte MAX_DISTRIBUTED_ATTR_ID = 7;
+
+    /** */
+    private static final DistributedOperationAttributeManager INSTANCE = new 
DistributedOperationAttributeManager();
+
+    /** Attributes by their id. */
+    private final Map<Byte, OperationContextAttribute<? extends Message>> 
attrs = new ConcurrentHashMap<>();
+
+    /** */
+    public static DistributedOperationAttributeManager instance() {
+        return INSTANCE;
+    }
+
+    /** */
+    public <T extends Message> OperationContextAttribute<T> 
createDistributedAttriubte(byte id, @Nullable T initVal) {
+        assert id >= 0;
+
+        if (attrs.size() == OperationContextAttribute.MAX_ATTR_CNT)
+            throw new IgniteException("Maximum number of ributed attributes is 
exceeded [" + OperationContextAttribute.MAX_ATTR_CNT + "].");

Review Comment:
   Typo.
   
   Let's use a single style - Error msg [param=val] and remove the dot at the 
end



##########
modules/core/src/main/java/org/apache/ignite/internal/thread/context/DistributedOperationAttributeManager.java:
##########
@@ -0,0 +1,117 @@
+/*
+ * 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.internal.thread.context;
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.DistributedOperationContextAttributesMessage;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class DistributedOperationAttributeManager {
+    /** */
+    public static final byte MAX_DISTRIBUTED_ATTR_ID = 7;
+
+    /** */
+    private static final DistributedOperationAttributeManager INSTANCE = new 
DistributedOperationAttributeManager();
+
+    /** Attributes by their id. */
+    private final Map<Byte, OperationContextAttribute<? extends Message>> 
attrs = new ConcurrentHashMap<>();
+
+    /** */
+    public static DistributedOperationAttributeManager instance() {
+        return INSTANCE;
+    }
+
+    /** */
+    public <T extends Message> OperationContextAttribute<T> 
createDistributedAttriubte(byte id, @Nullable T initVal) {
+        assert id >= 0;
+
+        if (attrs.size() == OperationContextAttribute.MAX_ATTR_CNT)
+            throw new IgniteException("Maximum number of ributed attributes is 
exceeded [" + OperationContextAttribute.MAX_ATTR_CNT + "].");
+
+        attrs.compute(id, (id0, attr0) -> {
+            if (attr0 != null)
+                throw new IgniteException("Duplicated distributed attribute 
id: " + id);
+
+            return OperationContextAttribute.newInstance(initVal);
+        });
+
+        return (OperationContextAttribute<T>)attrs.get(id);
+    }
+
+    /** */
+    public @Nullable DistributedOperationContextAttributesMessage 
collectDistributedAttributes() {
+        DistributedOperationContextAttributesMessage res = null;
+
+        for (Map.Entry<Byte, OperationContextAttribute<? extends Message>> e : 
attrs.entrySet()) {
+            OperationContextAttribute<? extends Message> attr = e.getValue();
+
+            Message curVal = OperationContext.get(attr);
+
+            assert attr.initialValue() == null || curVal == null || 
curVal.getClass().isAssignableFrom(attr.initialValue().getClass());
+
+            if (!Objects.equals(curVal, attr.initialValue())) {

Review Comment:
   We need to use  `==` not equals. The the same way the 
org.apache.ignite.internal.thread.context.OperationContext.ContextUpdater#set 
does.



##########
modules/core/src/main/java/org/apache/ignite/internal/thread/context/DistributedOperationAttributeManager.java:
##########
@@ -0,0 +1,117 @@
+/*
+ * 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.internal.thread.context;
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.DistributedOperationContextAttributesMessage;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class DistributedOperationAttributeManager {
+    /** */
+    public static final byte MAX_DISTRIBUTED_ATTR_ID = 7;
+
+    /** */
+    private static final DistributedOperationAttributeManager INSTANCE = new 
DistributedOperationAttributeManager();
+
+    /** Attributes by their id. */
+    private final Map<Byte, OperationContextAttribute<? extends Message>> 
attrs = new ConcurrentHashMap<>();
+
+    /** */
+    public static DistributedOperationAttributeManager instance() {
+        return INSTANCE;
+    }
+
+    /** */
+    public <T extends Message> OperationContextAttribute<T> 
createDistributedAttriubte(byte id, @Nullable T initVal) {
+        assert id >= 0;
+
+        if (attrs.size() == OperationContextAttribute.MAX_ATTR_CNT)
+            throw new IgniteException("Maximum number of ributed attributes is 
exceeded [" + OperationContextAttribute.MAX_ATTR_CNT + "].");
+
+        attrs.compute(id, (id0, attr0) -> {

Review Comment:
   We can make the method static and simplify this logic. 
   
   Check if distributed attribute ID is vacant.
   Reserve attribute.
   Register attribute.



##########
modules/core/src/main/java/org/apache/ignite/internal/thread/context/DistributedOperationAttributeManager.java:
##########
@@ -0,0 +1,117 @@
+/*
+ * 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.internal.thread.context;
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.DistributedOperationContextAttributesMessage;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class DistributedOperationAttributeManager {
+    /** */
+    public static final byte MAX_DISTRIBUTED_ATTR_ID = 7;
+
+    /** */
+    private static final DistributedOperationAttributeManager INSTANCE = new 
DistributedOperationAttributeManager();
+
+    /** Attributes by their id. */
+    private final Map<Byte, OperationContextAttribute<? extends Message>> 
attrs = new ConcurrentHashMap<>();
+
+    /** */
+    public static DistributedOperationAttributeManager instance() {
+        return INSTANCE;
+    }
+
+    /** */
+    public <T extends Message> OperationContextAttribute<T> 
createDistributedAttriubte(byte id, @Nullable T initVal) {
+        assert id >= 0;
+
+        if (attrs.size() == OperationContextAttribute.MAX_ATTR_CNT)

Review Comment:
   It seems that we should replace it with `id < MAX_DISTRIBUTED_ATTR_CNT`



##########
modules/core/src/main/java/org/apache/ignite/internal/thread/context/DistributedOperationAttributeManager.java:
##########
@@ -0,0 +1,117 @@
+/*
+ * 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.internal.thread.context;
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.DistributedOperationContextAttributesMessage;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class DistributedOperationAttributeManager {
+    /** */
+    public static final byte MAX_DISTRIBUTED_ATTR_ID = 7;
+
+    /** */
+    private static final DistributedOperationAttributeManager INSTANCE = new 
DistributedOperationAttributeManager();
+
+    /** Attributes by their id. */
+    private final Map<Byte, OperationContextAttribute<? extends Message>> 
attrs = new ConcurrentHashMap<>();

Review Comment:
   We can replace it with an array and keep it sorted by ID.



##########
modules/core/src/main/java/org/apache/ignite/internal/DistributedOperationContextAttributesMessage.java:
##########
@@ -0,0 +1,38 @@
+/*
+ * 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.internal;
+
+import java.util.List;
+import org.apache.ignite.internal.thread.context.OperationContext;
+import org.apache.ignite.plugin.extensions.communication.Message;
+
+/** Transport for {@link OperationContext} distibuted attributes. */
+public class DistributedOperationContextAttributesMessage implements Message {
+    /** Values of operation context attributes. */
+    @Order(0)
+    public List<Message> vals;
+
+    /** Bitmask of effective attributes ids. */
+    @Order(1)
+    public byte idBitmask;

Review Comment:
   Bitmask -> bitmap



##########
modules/core/src/main/java/org/apache/ignite/internal/thread/context/DistributedOperationAttributeManager.java:
##########
@@ -0,0 +1,117 @@
+/*
+ * 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.internal.thread.context;
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.DistributedOperationContextAttributesMessage;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class DistributedOperationAttributeManager {
+    /** */
+    public static final byte MAX_DISTRIBUTED_ATTR_ID = 7;
+
+    /** */
+    private static final DistributedOperationAttributeManager INSTANCE = new 
DistributedOperationAttributeManager();
+
+    /** Attributes by their id. */
+    private final Map<Byte, OperationContextAttribute<? extends Message>> 
attrs = new ConcurrentHashMap<>();
+
+    /** */
+    public static DistributedOperationAttributeManager instance() {
+        return INSTANCE;
+    }
+
+    /** */
+    public <T extends Message> OperationContextAttribute<T> 
createDistributedAttriubte(byte id, @Nullable T initVal) {
+        assert id >= 0;
+
+        if (attrs.size() == OperationContextAttribute.MAX_ATTR_CNT)
+            throw new IgniteException("Maximum number of ributed attributes is 
exceeded [" + OperationContextAttribute.MAX_ATTR_CNT + "].");
+
+        attrs.compute(id, (id0, attr0) -> {
+            if (attr0 != null)
+                throw new IgniteException("Duplicated distributed attribute 
id: " + id);
+
+            return OperationContextAttribute.newInstance(initVal);
+        });
+
+        return (OperationContextAttribute<T>)attrs.get(id);
+    }
+
+    /** */
+    public @Nullable DistributedOperationContextAttributesMessage 
collectDistributedAttributes() {
+        DistributedOperationContextAttributesMessage res = null;
+
+        for (Map.Entry<Byte, OperationContextAttribute<? extends Message>> e : 
attrs.entrySet()) {
+            OperationContextAttribute<? extends Message> attr = e.getValue();
+
+            Message curVal = OperationContext.get(attr);
+
+            assert attr.initialValue() == null || curVal == null || 
curVal.getClass().isAssignableFrom(attr.initialValue().getClass());
+
+            if (!Objects.equals(curVal, attr.initialValue())) {
+                if (res == null) {
+                    res = new DistributedOperationContextAttributesMessage();
+
+                    res.vals = new ArrayList<>(MAX_DISTRIBUTED_ATTR_ID / 2);
+                }
+
+                byte mask = (byte)(1 << e.getKey());
+
+                assert (res.idBitmask & mask) == 0;
+
+                res.vals.add(curVal);
+                res.idBitmask |= mask;
+            }
+        }
+
+        return res;
+    }
+
+    /** */
+    public Scope restoreDistributedAttributes(@Nullable 
DistributedOperationContextAttributesMessage msg) {
+        if (msg == null)
+            return Scope.NOOP_SCOPE;
+
+        assert msg.idBitmask != 0;
+        assert !F.isEmpty(msg.vals);
+        assert msg.vals.size() <= MAX_DISTRIBUTED_ATTR_ID;
+
+        OperationContext.ContextUpdater updater = 
OperationContext.ContextUpdater.create();
+
+        for (byte valIdx = 0, maskIdx = -1; valIdx < msg.vals.size(); 
++valIdx) {

Review Comment:
   Do we really need to start maskIdx at -1?



##########
modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java:
##########
@@ -76,6 +77,11 @@ public abstract class TcpDiscoveryAbstractMessage implements 
Message {
     @Order(4)
     Set<UUID> failedNodes;
 
+    /** Operation context attributes message. */
+    @GridToStringInclude
+    @Order(5)
+    public @Nullable DistributedOperationContextAttributesMessage opCtxMsg;

Review Comment:
   I would prefer to have getters and setters just like for all other variables.



##########
modules/core/src/main/java/org/apache/ignite/internal/DistributedOperationContextAttributesMessage.java:
##########
@@ -0,0 +1,38 @@
+/*
+ * 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.internal;
+
+import java.util.List;
+import org.apache.ignite.internal.thread.context.OperationContext;
+import org.apache.ignite.plugin.extensions.communication.Message;
+
+/** Transport for {@link OperationContext} distibuted attributes. */
+public class DistributedOperationContextAttributesMessage implements Message {
+    /** Values of operation context attributes. */
+    @Order(0)
+    public List<Message> vals;

Review Comment:
   I would prefer just plain array here.



-- 
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]

Reply via email to