IGNITE-28770 : Introduce a operation context attributes registry v2#13243
IGNITE-28770 : Introduce a operation context attributes registry v2#13243Vladsz83 wants to merge 14 commits into
Conversation
…-attributes-registry
…-attributes-registry
…-attributes-registry_v2
| private static final DistributedOperationAttributeManager INSTANCE = new DistributedOperationAttributeManager(); | ||
|
|
||
| /** Attributes by their id. */ | ||
| private final Map<Byte, OperationContextAttribute<? extends Message>> attrs = new ConcurrentHashMap<>(); |
There was a problem hiding this comment.
We can replace it with an array and keep it sorted by ID.
There was a problem hiding this comment.
I suggest a sorted map. I don't like structures like List<T2<Byte, OperationContextAttribute<? extends Message>>>
| /** Operation context attributes message. */ | ||
| @GridToStringInclude | ||
| @Order(5) | ||
| public @Nullable DistributedOperationContextAttributesMessage opCtxMsg; |
There was a problem hiding this comment.
I would prefer to have getters and setters just like for all other variables.
There was a problem hiding this comment.
We do not use getters and setters in the messages
| public class DistributedOperationContextAttributesMessage implements Message { | ||
| /** Values of operation context attributes. */ | ||
| @Order(0) | ||
| public List<Message> vals; |
There was a problem hiding this comment.
I would prefer just plain array here.
There was a problem hiding this comment.
I've reverted plain array. It cannot change its size while we do not know actual number of effective context attributes. Or we have to do another re-copy of it with actual size. It looks not better to me.
| 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) -> { |
There was a problem hiding this comment.
Sorry, static -> synchronized
| } | ||
|
|
||
| /** */ | ||
| public <T extends Message> OperationContextAttribute<T> createDistributedAttriubte(byte id, @Nullable T initVal) { |
| /** */ | ||
| public class DistributedOperationContextAttributeManager { | ||
| /** */ | ||
| static final byte MAX_DISTRIBUTED_ATTR_CNT = 7; |
No description provided.