[jboss-dev-forums] [Design the new POJO MicroContainer] - Changing the way AbstractVFSDeployment serializes root
alesj
do-not-reply at jboss.com
Mon Jun 16 11:28:03 EDT 2008
In AbstractVFSDeployment we do
| public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
| {
| super.readExternal(in);
| root = (VirtualFile) in.readObject();
| }
|
| public void writeExternal(ObjectOutput out) throws IOException
| {
| super.writeExternal(out);
| out.writeObject(root);
| }
|
I would change it to
| public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
| {
| super.readExternal(in);
| URL url = (URL)in.readObject();
| root = VFS.getRoot(url);
| }
|
| public void writeExternal(ObjectOutput out) throws IOException
| {
| super.writeExternal(out);
| out.writeObject(root.toURL());
| }
|
that way you don't serialize all the things that were already touched.
Only re-constructing lazy things on client side when needed.
The only thing with 2nd approach is that you loose parent info, and you probably get different vfs context.
But do we really care about that?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4158398#4158398
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4158398
More information about the jboss-dev-forums
mailing list