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

EntryListener.entryAdded() not called after IMap.evict() followed by IMap.get() #1542

Closed
patriziomunzi opened this issue Jan 9, 2014 · 8 comments

Comments

@patriziomunzi
Copy link

@patriziomunzi patriziomunzi commented Jan 9, 2014

If I call the evict method on a key and then the get method on the same key the listener entryAdded method does not fire.

this.instance.getMap(cacheName).evict(id);
this.instance.getMap(cacheName).get(id);

=====

    private class CacheEntryListener implements EntryListener<Object, Object> {
        @Override
        public void entryUpdated(EntryEvent<Object, Object> event) {
            if(_log.isDebugEnabled()) {
                _log.debug(cacheName + " - key: " + event.getKey() + " updated");
            }
        }
        @Override
        public void entryRemoved(EntryEvent<Object, Object> event) {
            if(_log.isDebugEnabled()) {
                _log.debug(cacheName + " - key: " + event.getKey() + " remove");
            }
        }
        @Override
        public void entryEvicted(EntryEvent<Object, Object> event) {
            if(_log.isDebugEnabled()) {
                _log.debug(cacheName + " - key: " + event.getKey() + " remove");
            }
        }
        @Override
        public void entryAdded(EntryEvent<Object, Object> event) {
            if(_log.isDebugEnabled()) {
                _log.debug(cacheName + " - key: " + event.getKey() + " added");
            }
        }
    }
@enesakar
Copy link
Contributor

@enesakar enesakar commented Jan 10, 2014

Not sure if the entryAdded for the second time is needed.
It is not the same situation with the first time add.
Think you take an action when an entry is added. Then after eviction, you will take this action again and again, although it is not added for first time.

@ghost ghost assigned enesakar Jan 10, 2014
@patriziomunzi
Copy link
Author

@patriziomunzi patriziomunzi commented Jan 10, 2014

I see your point, but I what if I want to get notified if a entry IS in the cache.

Maybe the update method could be fired.

Patrizio Munzi
email: patrizio.munzi@gmail.com
mobile: +39 393 7195164
skype: patrizio.munzi

On 10 Jan 2014, at 09:31, Enes Akar notifications@github.com wrote:

Not sure if the entryAdded for the second time is needed.
It is not the same situation with the first time add.
Think you take an action when an entry is added. Then after eviction, you will take this action again and again, although it is not added for first time.


Reply to this email directly or view it on GitHub.

@noctarius
Copy link
Contributor

@noctarius noctarius commented Jan 10, 2014

Well in your case it is something like an update since the real value still exists but is just evicted so an add should be an update.

@patriziomunzi
Copy link
Author

@patriziomunzi patriziomunzi commented Jan 10, 2014

yes exactly, firing an update could work for me. Is it something you can add?

On 10 Jan 2014, at 09:59, Christoph Engelbert notifications@github.com wrote:

Well in your case it is something like an update since the real value still exists but is just evicted so an add should be an update.


Reply to this email directly or view it on GitHub.

@noctarius
Copy link
Contributor

@noctarius noctarius commented Jan 10, 2014

I think not in a few minutes but it should answer someone with deeper knowledge of the eviction process.

@patriziomunzi
Copy link
Author

@patriziomunzi patriziomunzi commented Jan 10, 2014

Ok, waiting for your feedback, thnx

On 10 Jan 2014, at 10:06, Christoph Engelbert notifications@github.com wrote:

I think not in a few minutes but it should answer someone with deeper knowledge of the eviction process.


Reply to this email directly or view it on GitHub.

@gurbuzali gurbuzali added 3.x and removed defect labels Mar 11, 2014
@mdogan mdogan added the Team: Core label May 28, 2014
@ajermakovics
Copy link
Contributor

@ajermakovics ajermakovics commented Sep 29, 2014

Another option is to have another event type - Loaded, when something is loaded from a map store. That way you'd be able to distinguish between all the events

  • Evicted <-> Loaded
  • Added <-> Removed
@alparslanavci alparslanavci modified the milestones: 3.4, Backlog Oct 13, 2014
@ajermakovics ajermakovics added Team: Core and removed Team: Core labels Oct 14, 2014
@ahmetmircik
Copy link
Member

@ahmetmircik ahmetmircik commented Oct 30, 2014

related one #2407

@mdogan mdogan modified the milestones: 3.5, 3.4 Nov 4, 2014
@gurbuzali gurbuzali modified the milestones: Backlog, 3.5 May 13, 2015
@ahmetmircik ahmetmircik modified the milestones: 3.5, Backlog May 28, 2015
@gurbuzali gurbuzali modified the milestones: 3.5.1, 3.5 Jun 9, 2015
@enesakar enesakar modified the milestones: 3.5.1, 3.5.2 Jul 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

You can’t perform that action at this time.