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

PagingPredicate with comparator fails to serialize when sending from client or member with clustersize > 1 #12208

Closed
gokhanoner opened this Issue Jan 26, 2018 · 0 comments

Comments

@gokhanoner
Copy link
Contributor

gokhanoner commented Jan 26, 2018

See code sample: https://github.com/hazelcast/hazelcast-code-samples/tree/master/distributed-map/paging-predicate

PagingPredicate try to serialize the comparator, which is not serializable by default & failed. Since code sample only run with 1 member, no serialization occurs & example run.

Instead, comparator should be a class like this:

class IdComparator implements Comparator<Map.Entry<Integer, Student>>, Serializable {

        @Override
        public int compare(Map.Entry<Integer, Student> o1, Map.Entry<Integer, Student> o2) {
            return o2.getValue().getId() - o1.getValue().getId();
        }
    }

And need to update the doc to clearly warn users to pass a Serializable Comparator.

@mmedenjak mmedenjak added this to the 3.10 milestone Jan 28, 2018

@jerrinot jerrinot modified the milestones: 3.10, 3.10.1 Mar 8, 2018

@mmedenjak mmedenjak modified the milestones: 3.10.1, 3.11 May 15, 2018

@mmedenjak mmedenjak modified the milestones: 3.11, 3.12 Sep 6, 2018

@taburet taburet self-assigned this Nov 6, 2018

taburet added a commit to taburet/hazelcast-code-samples that referenced this issue Nov 6, 2018

taburet added a commit to hazelcast/hazelcast-code-samples that referenced this issue Feb 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.