Vladsz83 commented on code in PR #13275:
URL: https://github.com/apache/ignite/pull/13275#discussion_r3476093031
##########
modules/core/src/main/java/org/apache/ignite/internal/thread/context/OperationContextDispatcher.java:
##########
@@ -37,69 +37,60 @@
* {@link OperationContextAttribute} instance that is consistent across all
cluster nodes.</p>
*
* <p>To enable propagation of an {@link OperationContextAttribute} value
across cluster nodes, the
- * attribute must be created using the {@link
#createDistributedAttribute(byte, Message)} method.
+ * attribute must be created using the {@link
#registerDistributedAttribute(byte, OperationContextAttribute)} method.
*
* <p> Note, that the maximum number of distributed attribute instances that
can be created is currently limited to
* {@link #MAX_DISTRIBUTED_ATTR_CNT} for implementation reasons.</p>
*
* @see OperationContext
- * @see DistributedOperationContextMessage
+ * @see OperationContextMessage
*/
-public class DistributedOperationContextManager {
- /** */
- private static final DistributedOperationContextManager INSTANCE = new
DistributedOperationContextManager();
-
+public class OperationContextDispatcher {
/** 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<Message>> attrs = new
ConcurrentSkipListMap<>();
+ private final Map<Byte, OperationContextAttribute<? extends Message>>
attrs = new ConcurrentSkipListMap<>();
- /** */
- public static DistributedOperationContextManager instance() {
- return INSTANCE;
- }
+ /** The initialization flag. */
+ private volatile boolean initialized;
/**
- * Creates a new {@link OperationContext} attribute with the specified
distributed ID and initial value.
+ * Registers an attribute of {@link OperationContext} with the specified
distributed ID.
*
* <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>
+ * It must be unique, and its value must be in the range [{@code 0} :
{@code Byte.SIZE}).</p>
*
- * <p>The value of the created attribute is automatically captured and
propagated between cluster nodes
+ * <p>A value of the attribute is automatically captured and propagated
between cluster nodes
* during message transmission.</p>
- *
- * @see OperationContextAttribute#newInstance(Object)
*/
- 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 + ']';
+ public <T extends Message> void registerDistributedAttribute(byte id,
OperationContextAttribute<T> attr) {
+ if (initialized)
+ throw new IgniteException("Initialization of distributed operation
context attributes has already finished.");
Review Comment:
Search for `new IgniteException(` pls. Using full stop with a undivided
sentence looks normal to me.
--
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]