-
1. Re: Cache Listeners post event call returning old values(for 100 milliseconds) instead of updated values
sudheerk84 Jan 17, 2012 9:17 AM (in response to sudheerk84)One more point to add is teh listener is asynch @Listener(sync = false).
Also in the cacheModified event , the updated valued is not directly accesible through apis , hence i use event.getCache().get(event.getKey()) to get the value.
-
2. Re: Cache Listeners post event call returning old values(for 100 milliseconds) instead of updated values
sudheerk84 Jan 18, 2012 5:31 AM (in response to sudheerk84)I figured out why this was happening.
Since the listener was asynchronous and isolation mode was repetable reads, before teh transaction committed it was always retruning old value. When i put a delay of 100 milliseconds , teh commit woudl go ahead and i woudl get new values.
So i figured out the that i shoudl not be accessing values from teh cache , instead i shoudl be using the Cache Modified event or Cacheremoved event, which will give teh new value. But i have issue with teh getting the value for cache created event (which i will post as seperate thread).
-
3. Re: Cache Listeners post event call returning old values(for 100 milliseconds) instead of updated values
galder.zamarreno Jan 18, 2012 7:56 AM (in response to sudheerk84)Indeed. This is already noted in our FAQs: https://docs.jboss.org/author/pages/viewpage.action?pageId=5832860
-
4. Re: Cache Listeners post event call returning old values(for 100 milliseconds) instead of updated values
sudheerk84 Jan 18, 2012 7:59 AM (in response to galder.zamarreno)Thanks you for the confirmation for cache modified entries.
How exactly do i access teh cache entry for cache created event ? (i have posted this as a seperate thread https://community.jboss.org/thread/177541?tstart=0 )
Sicne i am using tansactions , i need to get teh element and use this on successful transaction commit.