[jboss-dev-forums] [Design of JBossCache] - Re: Common marshalling infrastructure
manik.surtani@jboss.com
do-not-reply at jboss.com
Thu Aug 7 07:04:43 EDT 2008
Scott is right, this does apply to JBC as well. Currently what I do is I have a concept of cache regions, and users register class loaders per region. Any calls that are then sent over the wire contain the following:
[version id: short][region id: serialized Fqn][payload]
my unmarshalling code currently:
1. reads the version id and delegates to the appropriate unmarshaller
2. unmarshaller reads the region id and sets the TCL appropriate to that region
3. continues unmarshalling payload, etc
Pretty much like what Scott said.
So looking at your APIs, I would need to be able to do something like:
| marshallerFactory.setStreamHeader(new VersionHeader(versionId));
| marshallerFactory.setStreamHeader(new RegionHeader(myRegion));
| Marshaller m = marshallerFactory.createMarshalleroutput();
|
and when unmarshalling, StreamHeaders should also be able to react to headers being present such that:
| marshallerFactory.setStreamHeader(new VersionUnmarshallHeader());
| marshallerFactory.setStreamHeader(new RegionUnmarshallHeader());
| Unmarshaller m = marshallerFactory.createUnmarshallerInput();
|
such that VersionUnmarshallHeader can read the version short and set the appropriate ObjectMarshallerFactory and ClassMarshallerFactory pertaining to the version of the protocol, and the RegionUnmarshallHeader would read the Region Fqn and set the TCL as needed.
Perhaps the same StreamHeader impl could be used for both purposes - makes logical sense.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4169269#4169269
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4169269
More information about the jboss-dev-forums
mailing list