[Design of JBossCache] - Re: JBCACHE-1170
by manik.surtani@jboss.com
Here's a kludgey solution that will work for you:
The only time the TL is used is when, on the remote end, the InactiveRegionAwareRpcDispatcher (IRARD) calls the CacheMarshaller to unmarshall an object. If this object is a method call, it's region is stored in a TL so we know which region to use for the return value.
The return value is marshalled by the RequestCorrelator, by passing in the result of a MethodCall invocation.
Since whenever the IRARD calls into the CacheMarshaller, it is …
[View More]always guaranteed to be a method call, we can change IRARD to call a particular method - say, regionalisedMethodCallFromByteBuffer() instead of the more generic objectFromByteBuffer(), which will return an instance of RegionalisedMethodCall.
| class RegionalisedMethodCall
| {
| MethodCall call;
| Region region;
| }
|
This way we can get rid of the TL altogether.
The IRARD then extracts the MethodCall, invokes it, and then returns an instance of RegionalisedReturnValue to the RequestCorrelator.
| class RegionalisedReturnValue
| {
| Object returnValue;
| Region region;
| }
|
The RequestCorrelator maybe (if not ASYNC) then calls CacheMarshaller.objectToByteBuffer() passing in the RegionalisedReturnValue.
And here's the kludgey bit. The CacheMarshaller first inspects the object passed in, and if it is a RegionalisedReturnValue, it only marshalls the return value in it, with the region passed in.
This would prevent any TL leaks if this is not called and won't require any changes in the way JGroups interacts with the marshaller.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140238#4140238
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4140238
[View Less]
16 years, 11 months