Skip to content

IGNITE-28770 : Introduce a operation context attributes registry v2#13243

Open
Vladsz83 wants to merge 14 commits into
apache:masterfrom
Vladsz83:IGNITE-28770-Introduce-a-operation-context-attributes-registry_v2
Open

IGNITE-28770 : Introduce a operation context attributes registry v2#13243
Vladsz83 wants to merge 14 commits into
apache:masterfrom
Vladsz83:IGNITE-28770-Introduce-a-operation-context-attributes-registry_v2

Conversation

@Vladsz83

Copy link
Copy Markdown
Contributor

No description provided.

private static final DistributedOperationAttributeManager INSTANCE = new DistributedOperationAttributeManager();

/** Attributes by their id. */
private final Map<Byte, OperationContextAttribute<? extends Message>> attrs = new ConcurrentHashMap<>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Vladsz83 Vladsz83 Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest a sorted map. I don't like structures like List<T2<Byte, OperationContextAttribute<? extends Message>>>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ок.

/** Operation context attributes message. */
@GridToStringInclude
@Order(5)
public @Nullable DistributedOperationContextAttributesMessage opCtxMsg;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer just plain array here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, static -> synchronized

}

/** */
public <T extends Message> OperationContextAttribute<T> createDistributedAttriubte(byte id, @Nullable T initVal) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo.

/** */
public class DistributedOperationContextAttributeManager {
/** */
static final byte MAX_DISTRIBUTED_ATTR_CNT = 7;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7 -> 8 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants