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
ISPN-7754 forEach method #5280
ISPN-7754 forEach method #5280
Conversation
Implements the default forEach method in a distributed way
* to owning nodes to perform the operation in the most performant way. However this means the biconsumer must | ||
* have an appropriate {@link org.infinispan.commons.marshall.Externalizer} or be {@link java.io.Serializable} itself. | ||
* <p> | ||
* For transactional caches, whenever the values of the caches are collections, and the mapping function modifies the collection, the collection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not specific to collections: the values in cache must not be mutated, period, and we'll rather enforce that than remove the limitation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Err, actually this is a consumer, and you should not modify the collection - what would you do with the copy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is me that does copy/paste without thinking twice sometimes. So well, the comment is not correct, indeed !!
* This limitation could disappear in following releases if technically possible. | ||
*/ | ||
@Override | ||
void forEach(BiConsumer<? super K, ? super V> action); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the SerializableBiConsumer
overload?
@@ -357,6 +358,12 @@ public V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingF | |||
} | |||
|
|||
@Override | |||
public void forEach(BiConsumer<? super K, ? super V> action) { | |||
authzManager.checkPermission(subject, AuthorizationPermission.WRITE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be READ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it should be
return offset; | ||
} | ||
|
||
public void testForEach() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is silly. Accessing a static variable on (potentially) remote node...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disapprove the whole concept of running on remote nodes. Since you can't get any return value back from the forEach
invocation, and you should not modify the value itself, what's the point of the implementation at all?
Temporarily closing because of CI overload |
https://issues.jboss.org/browse/ISPN-7754