petrov-mg commented on code in PR #13243: URL: https://github.com/apache/ignite/pull/13243#discussion_r3455763632
########## modules/core/src/main/java/org/apache/ignite/internal/thread/context/DistributedOperationContextManager.java: ########## @@ -0,0 +1,128 @@ +/* + * 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; + +/** + * A manager of {@link OperationContextAttribute} which are required to be propagated through a cluster. + * Has own attributes ids compared to a local node's {@link OperationContext}. + * + * @see OperationContext + * @see DistributedOperationContextMessage + */ +public class DistributedOperationContextManager { + /** */ + private static final DistributedOperationContextManager INSTANCE = new DistributedOperationContextManager(); + + /** Maximal number of supported distributed attributes. */ + static final byte MAX_DISTRIBUTED_ATTR_CNT = Byte.SIZE; + + /** Registered distributed attributes by their cluster-wide id. */ + private final Map<Byte, OperationContextAttribute<? extends Message>> attrs = new ConcurrentSkipListMap<>(); + + /** */ + public static DistributedOperationContextManager instance() { + return INSTANCE; + } + + /** Review Comment: ``` /** * Creates a new {@link OperationContext} attribute with the specified distributed ID and initial value. * * <p>The distributed ID is used to consistently identify the attribute across all nodes in the cluster. * It must be unique, and its value must be in the range from {@code 0} (inclusive) to {@code Byte.SIZE} (exclusive).</p> * * <p>The value of the created attribute is automatically captured and propagated between cluster nodes * during message transmission.</p> * * @see OperationContextAttribute#newInstance(Object) */ ``` -- 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]
