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

EntryProcessor mixed with MapInterceptor doesn't receive correct value #7414

Closed
travikk opened this issue Jan 28, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@travikk
Copy link

commented Jan 28, 2016

Hello,

If you consider the following code:

`
public class CacheTest {
public static void main(String[] args) {
HazelcastInstance hazelcast = Hazelcast.newHazelcastInstance();

    IMap map = hazelcast.getMap("test");
    map.addInterceptor(new MyInterceptor());
    map.addEntryListener(new MyListener(), true);
    map.put(1, "wsad");
    map.put(1, "qwerty");
}

static class MyListener implements EntryAddedListener, EntryUpdatedListener {
    @Override
    public void entryAdded(EntryEvent event) {
        System.out.println("Got event add");
    }

    @Override
    public void entryUpdated(EntryEvent event) {
        System.out.println("Got event update");
    }
}

static class MyInterceptor implements MapInterceptor {
    @Override
    public Object interceptGet(Object value) {
        return null;
    }

    @Override
    public void afterGet(Object value) {
    }

    @Override
    public Object interceptPut(Object oldValue, Object newValue) {
        return newValue.toString().toUpperCase();
    }

    @Override
    public void afterPut(Object value) {

    }

    @Override
    public Object interceptRemove(Object removedValue) {
        return null;
    }

    @Override
    public void afterRemove(Object value) {

    }
}

}

`

You will notice, that the interceptor right before put is changing strings to upper-case version of those values. The listener however receives an "old" value (lowercase version).
Is that to be expected or is it a bug in Hazelcast, or maybe a misconfiguration?

@gurbuzali gurbuzali added this to the 3.6.1 milestone Jan 28, 2016

@gurbuzali gurbuzali self-assigned this Jan 28, 2016

@gurbuzali

This comment has been minimized.

Copy link
Member

commented Jan 28, 2016

Thank you for the bug report and the reproducer

@travikk

This comment has been minimized.

Copy link
Author

commented Jan 28, 2016

@gurbuzali brilliant, thanks!

It says here, that it was added to 3.6.1 milestone, but in the referenced #7416 it says that it's been added to 3.7.
Which version should we expect this bug to be fixed in and what timeline are we looking at here?

Thank you very much for taking such a quick action on this!

@gurbuzali

This comment has been minimized.

Copy link
Member

commented Jan 28, 2016

we have a backport too #7417
I can't say much about the release timing but we've just released 3.6 so you may expect a patch release (3.6.1) in a month or so

@travikk

This comment has been minimized.

Copy link
Author

commented Jan 28, 2016

Great, thanks!

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.