[jboss-dev-forums] [Design of JBossCache] - Re: Implicit marshalled values - a better way of handling re
bstansberry@jboss.com
do-not-reply at jboss.com
Sat Dec 22 16:15:53 EST 2007
"manik.surtani at jboss.com" wrote :
| Or is there something clever in your MarshalledValue class that just passes the byte[] payload in writeExternal()?
Here's what it does (I take no credit or blame; long predates me ;) )
| public void writeExternal(ObjectOutput out) throws IOException
| {
| int length = serializedForm != null ? serializedForm.length : 0;
| out.writeInt(length);
| if( length > 0 )
| {
| out.write(serializedForm); // this is a byte[] created in the c'tor
| }
| out.writeInt(hashCode);
| }
The class is in the AS server module, org.jboss.invocation.MarshalledValue. It was originally written for use in remote invocations, and thus doesn't lazy-serialize. When we started using it for caching, that IMHO was a mistake; we should have written a version that has the behavior discussed on this thread.
anonymous wrote : Or any other JDK objects - Dates, etc.
Just have to be careful to exclude anything that can wrap a non-JDK type. Also can't use instanceof in type checking.
Re: "releaseObjectReferences(fqn)" as the method name, sounds good. The "flush" name was just me being lazy in my post. :)
+1 as well to having this be the default behavior.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115215#4115215
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115215
More information about the jboss-dev-forums
mailing list