1 of 1 people found this helpful
How about creating an interceptor do do this. To get the value, call InvocationContext#lookupEntry(key), where you get the key from the command being interceptor (DataCommand#getKey) and can then call CacheEntry#getValue() to get the actual object.
Thanks for the suggestion! I think using interceptors would work but I think I'd still be left navigating the object graph to find the places that need autowiring. Is that right? Does the interceptor work only at the top level object being stored or would the interceptor be called on each object in the graph that is being serialized? It sounds like the former which is the hole in my original thinking. I need to check for autowiring *each* object that is placed in the cache whether directly or via object references.
I did implement the v5 Externalizer solution and it has worked great. It is dependent on a ThreadLocal but the design works well and the Externalizers are easy enough to implement.
The interceptor gets called once per each cache.put() or equivalent op, not whenever an object of the graph is going to be serialized.
Nice to hear that the Externalizer extensions introduced in 5.0 are helping here. Is this code available somewhere?