I'm not sure I'm the best person to answer whether adding an EntryEvent and beforeGet/afterGet callbacks for a get call is a good idea, but there is a way to do pre- and post-processing on get calls using the security framework AccessControl callback.
I attached an example of this. It includes a readme that describes it. Barry Oglesby GemFire Advanced Customer Engineering (ACE) For immediate support please contact Pivotal Support at http://support.pivotal.io/ On Thu, Jan 28, 2016 at 6:43 AM, Nilkanth Patel <[email protected]> wrote: > Hello, > > Is it possible to get beforeGet(), afterGet() events for Region.get() API > with current state of codebase..? > > Seeing the internal code, it seems *i need to add code *(that invoke > listener, writer callbacks) for these events, something similar to the way > events for Region.put() are invoked. is this a correct understanding..? > > If so, I need to create a EntryEventImpl (shown in Red colour ) and pass > it. What is the purpose of clientEvent here ? can i use clientEvent > directly > to create Get events or is it used for some different purpose? > > *LocalRegion.java* > > @Override > public Object get(Object key, Object aCallbackArgument, > boolean generateCallbacks, EntryEventImpl clientEvent) throws > TimeoutException, CacheLoaderException > { > *clientEvent = newGetEntryEvent(key, aCallbackArgument);* > Object result = get(key, aCallbackArgument, generateCallbacks, > false, false, null, *clientEvent*, false, true/*allowReadFromHDFS*/); > if (Token.isInvalid(result)) { > result = null; > } > return result; > } > > > > If so, hook (listener, writer calls ) for GET callbacks are ok as shown in > red colour...? > > *LocalRegion.java* > > public final Object getDeserializedValue(RegionEntry re, final KeyInfo > keyInfo, final boolean updateStats, boolean disableCopyOnRead, > boolean preferCD, EntryEventImpl clientEvent, boolean > returnTombstones, boolean allowReadFromHDFS, boolean retainResult) { > * //hook for before GET - call CacheWriter * > try{ > if (this.diskRegion != null) { > this.diskRegion.setClearCountReference(); > > > //code in try ends here *//hook for after GET - call CacheListener.* > }finally { > if (this.diskRegion != null) { > this.diskRegion.removeClearCountReference(); > } > } > > } > > > Looking forward to a quick help. > > Nilkanth. >
get-pre-post-processing-clean_01-28-2016.tgz
Description: GNU Zip compressed data
