[jboss-user] [JBoss Microcontainer Development] - Making JavassistTypeInfo serializable

Kabir Khan do-not-reply at jboss.com
Tue Mar 30 13:48:50 EDT 2010

Kabir Khan [http://community.jboss.org/people/kabir.khan%40jboss.com] created the discussion

"Making JavassistTypeInfo serializable"

To view the discussion, visit: http://community.jboss.org/message/534718#534718

Looking at  https://jira.jboss.org/jira/browse/JBREFLECT-16 https://jira.jboss.org/jira/browse/JBREFLECT-16 I wanted to do the same as I did to make the reflect flavour properly serializable, which was simply to add this to ClassInfo, as mentioned here  http://community.jboss.org/message/534270#534270: http://community.jboss.org/message/534270#534270:

   protected Object writeReplace()
      return new MarshalledClassInfo(getType());
   public static class MarshalledClassInfo implements Serializable
      private static final long serialVersionUID = 1L;
      Class<?> type;
      public MarshalledClassInfo(Class<?> type)
         this.type = type;
      protected Object readResolve()
         TypeInfoFactory tif = new IntrospectionTypeInfoFactory();
         return tif.getTypeInfo(type);

If I do the same for JavassistTypeInfo, then that will load the class. Is that a bad thing? Probably...

The alternative for this simple implementation to work is to save the name and the classloader, and classloaders are not serializable.

Or am I missing something? When deserializing a class should that happen in the same classloader (or one with access to similar classes if serialized out of the vm) as the one that serialized it in the first place? If the answer is yes, then I can go forward with this.


Reply to this message by going to Community

Start a new discussion in JBoss Microcontainer Development at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100330/4131a144/attachment.html 

More information about the jboss-user mailing list