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 · Fixed by #13181
Closed

Comments

@patriziomunzi
Copy link

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

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

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

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

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

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

@patriziomunzi
Copy link
Author

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
@ajermakovics
Copy link
Contributor

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

@ahmetmircik
Copy link
Member

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
@enesakar enesakar modified the milestones: 3.5.2, 3.5.1 Jul 25, 2015
@degerhz degerhz modified the milestones: 3.5.3, 3.5.2 Sep 8, 2015
@degerhz degerhz modified the milestones: 3.5.4, 3.5.3 Oct 6, 2015
@mdogan mdogan modified the milestones: Backlog, 3.5.4 Nov 2, 2015
@mmedenjak mmedenjak modified the milestones: Backlog, 3.11 Dec 10, 2017
@burakcelebi burakcelebi added Source: Community PR or issue was opened by a community user Priority: Low labels Jan 3, 2018
ufukyilmaz pushed a commit to ufukyilmaz/hazelcast that referenced this issue Mar 29, 2021
…lcast#1542)

* Move JobMetrics to own map to avoid querying
during job cleanup
* Change default number of results to store to 1,000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.