Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EJBCLIENT-424] Refactor context data cleaning #607

Merged
merged 1 commit into from
Oct 25, 2023

Conversation

tadamski
Copy link
Contributor

No description provided.

@tadamski tadamski requested a review from chengfang as a code owner February 14, 2023 11:19
@tadamski
Copy link
Contributor Author

@chengfang @jbaesner could you please review? I think that after this fix we would only have jboss.returned.keys visible to the client (instead of all merged now)

if(returnedContextDataKeys != null) {
contextData.keySet().removeAll(returnedContextDataKeys);
}
contextData.keySet().removeIf(k -> (k != EJBClientInvocationContext.RETURNED_CONTEXT_DATA_KEY));
Copy link
Contributor

Choose a reason for hiding this comment

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

This method needs clear doc stating what it does. In your latest change above, it now removes all entries from context data, except the one entry that specifies the jboss.returned.keys, and its value is a set of string keys. Is this what's intended here? This is not what the javadoc says.

Should we use equals instead of != for comparison?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have fixed the comparision.

What I have noticed during diagnosis of some test failure is that it currently works in the following way on the server side after the request is processed:

  1. the context has fields that the client put there and jboss.returned.keys
  2. later in the process (after the cleaning above) the server adds to the context those keys from jboss.returned.keys that were returned by the server
  3. as a result we have: client keys, "jboss.returned.keys", and those keys returned by the server that are present in jboss.returned.keys

I think that after this fix we would only have the latter two. this is not a bug but imho it will clean things a bit

Regarding the docs, the filling process happens after the cleaning so all the keys from jboss.returned.keys should be eventually present

Copy link
Contributor Author

@tadamski tadamski left a comment

Choose a reason for hiding this comment

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

I was recently working again on JBEAP-24454 which is related to this issue and I'm pretty certain that this fix is appropriate. I'm merging the PR.

if(returnedContextDataKeys != null) {
contextData.keySet().removeAll(returnedContextDataKeys);
}
contextData.keySet().removeIf(k -> (k != EJBClientInvocationContext.RETURNED_CONTEXT_DATA_KEY));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have fixed the comparision.

What I have noticed during diagnosis of some test failure is that it currently works in the following way on the server side after the request is processed:

  1. the context has fields that the client put there and jboss.returned.keys
  2. later in the process (after the cleaning above) the server adds to the context those keys from jboss.returned.keys that were returned by the server
  3. as a result we have: client keys, "jboss.returned.keys", and those keys returned by the server that are present in jboss.returned.keys

I think that after this fix we would only have the latter two. this is not a bug but imho it will clean things a bit

Regarding the docs, the filling process happens after the cleaning so all the keys from jboss.returned.keys should be eventually present

@tadamski tadamski merged commit 1a10031 into wildfly:main Oct 25, 2023
7 of 9 checks passed
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