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


##########
modules/core/src/main/java/org/apache/ignite/internal/thread/context/DistributedOperationContextManager.java:
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentSkipListMap;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.DistributedOperationContextMessage;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class DistributedOperationContextManager {
+    /** */
+    static final byte MAX_DISTRIBUTED_ATTR_CNT = Byte.SIZE;
+
+    /** */
+    private static final DistributedOperationContextManager INSTANCE = new 
DistributedOperationContextManager();
+
+    /** Attributes by their id. */
+    private final Map<Byte, OperationContextAttribute<? extends Message>> 
attrs = new ConcurrentSkipListMap<>();
+
+    /** */
+    public static DistributedOperationContextManager instance() {
+        return INSTANCE;
+    }
+
+    /** */
+    public <T extends Message> OperationContextAttribute<T> 
createDistributedAttribute(byte id, @Nullable T initVal) {
+        assert id >= 0 && id < MAX_DISTRIBUTED_ATTR_CNT : "Invalid distributed 
attributed id [id=" + id + "].";
+
+        if (attrs.size() == MAX_DISTRIBUTED_ATTR_CNT)
+            throw new IgniteException("Maximum number of distributed 
attributes is exceeded [max=" + MAX_DISTRIBUTED_ATTR_CNT + "].");

Review Comment:
   Let's remove dot from the end of the error message. 
   
   It seems we can safely remove this error because in this case `Duplicated 
distributed attribute id` will be raised.



##########
modules/core/src/main/java/org/apache/ignite/internal/thread/context/DistributedOperationContextManager.java:
##########
@@ -0,0 +1,114 @@
+/*
+ * 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.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentSkipListMap;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.DistributedOperationContextMessage;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class DistributedOperationContextManager {
+    /** */
+    static final byte MAX_DISTRIBUTED_ATTR_CNT = Byte.SIZE;
+
+    /** */
+    private static final DistributedOperationContextManager INSTANCE = new 
DistributedOperationContextManager();
+
+    /** Attributes by their id. */
+    private final Map<Byte, OperationContextAttribute<? extends Message>> 
attrs = new ConcurrentSkipListMap<>();
+
+    /** */
+    public static DistributedOperationContextManager instance() {
+        return INSTANCE;
+    }
+
+    /** */
+    public <T extends Message> OperationContextAttribute<T> 
createDistributedAttribute(byte id, @Nullable T initVal) {
+        assert id >= 0 && id < MAX_DISTRIBUTED_ATTR_CNT : "Invalid distributed 
attributed id [id=" + id + "].";
+
+        if (attrs.size() == MAX_DISTRIBUTED_ATTR_CNT)
+            throw new IgniteException("Maximum number of distributed 
attributes is exceeded [max=" + MAX_DISTRIBUTED_ATTR_CNT + "].");
+
+        return (OperationContextAttribute<T>)attrs.compute(id, (id0, attr0) -> 
{
+            if (attr0 != null)
+                throw new IgniteException("Duplicated distributed attribute id 
[id=" + id + "].");

Review Comment:
   Let's remove dot from the end of the error message. 



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