5 Replies Latest reply: Mar 4, 2007 2:49 PM by 807606 RSS

    Serialization Question

    807606
      Hi guys,
      I'm working on a distributed application.
      My client side sends over tcp socket , serialized messages.The class that I serialize is called "AgentMessage". Serialization and deserialization seems to work correctly...but I have a question about keeping the state of a field (is a Vector) : I'll post the code to explain the problem...it's very simple :
      public class AgentMessage{
      private StaticPart sp;
      private DynElement de;
      private Vector oldde = new Vector();
      
           public AgentMessage(String agent, byte[] code, String mainclass,Certificate signerId, PrivateKey priv, String configuration,String pack, Serializable dclear, byte[] dsecret, PathEl[] dpath,byte[] c) {
      
                sp = new StaticPart(agent, code, mainclass, signerId,priv,configuration, pack);
                de = new DynElement(dclear, dsecret, c, dpath);
                oldde.add(de);
                     
           }
      My final aim is to maintain in the static vector all the "DynElement" objects....
      But ,when the message is deserialized in the server side of this app , I have to create a new instance of the class "AgentMessage"....so the elements in the vector would be lost.....
      How do I mantain a collection of these objects??
      Thanks a lot guys....
      Bye!!!
      A.P.