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

ISPN-7754 forEach method #5280

Closed
wants to merge 1 commit into from
Closed

Conversation

karesti
Copy link
Contributor

@karesti karesti commented Jul 11, 2017

@karesti karesti added this to the 9.2.0.Alpha1 milestone Jul 11, 2017
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
Copy link
Member

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.

Copy link
Member

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?

Copy link
Contributor Author

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);
Copy link
Member

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);
Copy link
Member

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?

Copy link
Contributor Author

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 {
Copy link
Member

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...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😢

Copy link
Member

@rvansa rvansa left a 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?

@tristantarrant
Copy link
Member

Temporarily closing because of CI overload

@karesti karesti deleted the ISPN-7754 branch February 6, 2019 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants