Serializing/deserializing a thread

I have a class
class A implements Serializable,Runnableand i create some objects out of it.
First of all, does it matter whether i serialize them and write them to a file, while the threads are running?
When i deserialize them, are they in the running state?
Thanks

First of all, does it matter whether i serialize them
and write them to a file, while the threads are
running?Depends on whether the operation makes any sense.
When i deserialize them, are they in the running state?No.

Similar Messages

  • XML serializing/deserializing versus parsing

    Hi all,
    This is not a strictly java question but after reading many discussions and creative solutions offered by different members of this forum, i feel that the right audience for my question are the folks in this very forum. Moderator, if you feel this question makes sense in a different forum, where it might get better responses feel free to move it.
    We are starting off on a new b2b web services project. Everyone in the group agreed that in order to appropriately serve the consumers in our space the best format to use is XML. We are java based and our first consumer is also java based, but we see in the future that our services will be consumed by other types of consumers as well. There seems to be a deep divide in how the xml structure should look like. There are two schools of thoughts. The first one (which is the popular one) is to have loosely typed tag names. Something like this
    <header>
    <map>
    <entry>
    <string>CUSTOMERNAME</string>
    <string>Mahesh</string>
    </entry>
    </map>
    </header>
    The idea being, we could dump regular marshalling/unmarshalling/parsing techniques in favor of a serializing/deserializing tool (Like XStream). The argument here is that we don't worry about a schema/parsing etc and always deal with some sort of generic collection. The other argument is that parsing is more heavier (in terms of performance) than serializing/deserializing.
    I believe that (i belong to the other less popular school of thought) any xml structure should have a real structure (strongly typed tag names). The problems i have with the proposed structure are
    1. They are not self describing, i.e. no wsdl
    2. They cant be parsed with a SAX parser (since there are no tag names, i dont think they can be parsed with a SAX parser, but if anyone here disagrees please correct me)
    3. Since regular parsing is out of the question, you cant predict how your consumers are using it.
    4. I think that the only place to use a serializing/deserializing technique is when you control both end points (producer and consumer).
    What i wanted to find out from the audience here is what they think of the pros/cons of the XML structure described above. Specifically in terms of
    1. Usablity
    2. Scalability
    3. Performance
    The generic structure is also being pitched as the 'next gen' way of defining and using XML. Is that true? Maybe i am just getting old and need to catch up.
    Any thoughts/comments are appreciated.

    user13698018 wrote:
    >
    What? Of course you can parse that "unstructured XML" with a SAX parser, why shouldn't you be able to do that? It's still XML after all.
    >
    You are right, it can be parsed. What i meant to say was i wont be able to extract information from it easily. For e.g. if i have to read the customer name what tag event will i look for? If i look for the event that fires off when i encounter tag name 'string' that will only give me the tag name and not the value. I have to come up with some sort of counter mechanism to disregard the first tag event and look at the second event. Is my assumption correct?Well, parsing the "freeform" XML with SAX requires a few tricks but can result in code that does pretty much the same thing.
    Since the information is exactly the same in both (except that one is a bit more verbose), I don't see any major differences in how it can be parsed.
    The only (seeming) difference is that for "strictly defined" XML you'll need to pre-define which tags/properties exist. But even that can be avoided by clever use of xs:any and allowing other namespaces (i.e. allow a mydata:favoriteColor tag inside your myStrictSchema:person tag).
    Once you do those, the two formats become even more equivalent: some of the advantages of having strictly-formed XML are lost (because you have to handle "unknown" tags again), while some of the disadvantages are lost as well (yeah! extensibility without modifying the core standard).
    In my (partially humble) opinion, the "free form XML" approach is often used when people are too lazy to investigate the wide variety of tools available via official XML techniques.
    >
    3. Since regular parsing is out of the question, you cant predict how your consumers are using it.
    >
    What i meant here was, if my consumers find regular parsing techniques difficult to parse they will resort to short cuts to extract the information (like regex to pull information) and that will make it difficult to predict how consumers are using the xml and hence make it difficult to plan for changes in the future. Am i over thinking here?That's always a possible problem and won't be avoided by any choice in data format. They will try it with "strict XML" and they will try it with "freeform XML". If you have some kind of consulting function, then you can try to communicate the dangers of this approach, but in the end you can hardly force people to "do it the right way".
    Which one would you use?I'd prefer the strictly specified one usually. But I don't know enough about the problem domain to give a qualified answer.

  • Stateful Serializing/Deserializing Problem in clusters

    I'm using a stateful session bean that hold some values. When i try to test replication in clusters, the bean is serialized and deserialized from one node to other. That is ok.
    The problem is when the state is too big (actuallly when the state is bigger than 1000bytes), the server is unable to replicate the stateful bean, and throws:
    StreamCorruptedException, "invalid type code: 00".
    I am using OC4J 10g (10.1.3.1).
    The stack trace is:
    08/10/10 13:33:37 java.lang.RuntimeException: java.io.StreamCorruptedException: invalid type code: 00
    08/10/10 13:33:37      at com.tester.beans.TesterBean.readObject(TesterBean.java:126)
    08/10/10 13:33:37      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    08/10/10 13:33:37      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    08/10/10 13:33:37      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    08/10/10 13:33:37      at java.lang.reflect.Method.invoke(Method.java:597)
    08/10/10 13:33:37      at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
    08/10/10 13:33:37      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1846)
    08/10/10 13:33:37      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
    08/10/10 13:33:37      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    08/10/10 13:33:37      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
    08/10/10 13:33:37      at com.evermind.server.ejb.EJBInputStream.readSession(EJBInputStream.java:263)
    08/10/10 13:33:37      at com.evermind.server.ejb.EJBInputStream.readSession(EJBInputStream.java:185)
    08/10/10 13:33:37      at com.oracle.bricks.j2ee.EJBLiveSession.unmarshall(EJBLiveSession.java:228)
    08/10/10 13:33:37      at com.oracle.bricks.j2ee.EJBSessionFacade.unmarshall(EJBSessionFacade.java:95)
    08/10/10 13:33:37      at com.evermind.server.ejb.JGroupEJBService.requestSession(JGroupEJBService.java:193)
    08/10/10 13:33:37      at com.evermind.server.ejb.StatefulSessionEJBHome.getSession(StatefulSessionEJBHome.java:670)
    08/10/10 13:33:37      at com.evermind.server.ejb.StatefulSessionEJBHome.getSession(StatefulSessionEJBHome.java:653)
    08/10/10 13:33:37      at com.evermind.server.ejb.StatefulSessionEJBHome.getSession(StatefulSessionEJBHome.java:648)
    08/10/10 13:33:37      at com.evermind.server.ejb.EJBInputStream.resolveObject(EJBInputStream.java:72)
    08/10/10 13:33:37      at java.io.ObjectInputStream.checkResolve(ObjectInputStream.java:1377)
    08/10/10 13:33:37      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    08/10/10 13:33:37      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
    08/10/10 13:33:37      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
    08/10/10 13:33:37      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
    08/10/10 13:33:37      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    08/10/10 13:33:37      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
    08/10/10 13:33:37      at com.oracle.jgroups.ObjectMarshaller.bytesToSerializable(ObjectMarshaller.java:177)
    08/10/10 13:33:37      at com.oracle.bricks.j2ee.LiveSession.<init>(LiveSession.java:134)
    08/10/10 13:33:37      at com.oracle.bricks.j2ee.SessionReplica.reify(SessionReplica.java:90)
    08/10/10 13:33:37      at com.oracle.bricks.Manager.get(Manager.java:261)
    08/10/10 13:33:37      at com.oracle.bricks.j2ee.SessionManager.get(SessionManager.java:133)
    08/10/10 13:33:37      at com.evermind.server.http.JGroupHttpService.getExistingSession(JGroupHttpService.java:144)
    08/10/10 13:33:37      at com.evermind.server.http.HttpApplication.getExistingSession(HttpApplication.java:1293)
    08/10/10 13:33:37      at com.evermind.server.http.EvermindHttpServletRequest.unprivileged_getSession(EvermindHttpServletRequest.java:2727)
    08/10/10 13:33:37      at com.evermind.server.http.EvermindHttpServletRequest.getSession(EvermindHttpServletRequest.java:2661)
    08/10/10 13:33:37      at com.evermind.server.http.EvermindHttpServletRequest.getSession(EvermindHttpServletRequest.java:2655)
    08/10/10 13:33:37      at tester.servlets.NewServlet.processRequest(NewServlet.java:61)
    08/10/10 13:33:37      at tester.servlets.NewServlet.doPost(NewServlet.java:132)
    08/10/10 13:33:37      at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    08/10/10 13:33:37      at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    08/10/10 13:33:37      at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
    08/10/10 13:33:37      at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
    08/10/10 13:33:37      at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
    08/10/10 13:33:37      at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
    08/10/10 13:33:37      at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
    08/10/10 13:33:37      at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
    08/10/10 13:33:37      at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    08/10/10 13:33:37      at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234)
    08/10/10 13:33:37      at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29)
    08/10/10 13:33:37      at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879)
    08/10/10 13:33:37      at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    08/10/10 13:33:37      at java.lang.Thread.run(Thread.java:619)
    08/10/10 13:33:37 Caused by: java.io.StreamCorruptedException: invalid type code: 00
    08/10/10 13:33:37      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1356)
    08/10/10 13:33:37      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
    08/10/10 13:33:37      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
    08/10/10 13:33:37      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
    08/10/10 13:33:37      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    08/10/10 13:33:37      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
    08/10/10 13:33:37      at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:480)
    08/10/10 13:33:37      at com.tester.beans.TesterBean.readObject(TesterBean.java:123)
    08/10/10 13:33:37      ... 51 more
    Any Idea, about the problems with the size of stateful session beans?
    Thnx.

    you MUST implement your own ArrayList, I have the same problem you have, gSOAP is fantastic exellent election, Axis mm... Ihave a lot of problems specially using collections
    I suggest use pure java to create the web service (wscompile, wsdeploy, these things makes a WSDL file)
    Implement your own ArrayList
    use gSOAP to create the clients stubs
    code a little to create the client

  • Serializing & Deserializing objects through ObjectMessage

    Hi,
    I'm having trouble sending objects/instances of a class (Data) through the message queue. I also made Data to be serializable.
    public class Data implements Serializable {
    }The following are snippets of code from the Message producer side:
    objectMessage = mySess.createObjectMessage();
    MessageProducer myMsgProducer = mySess.createProducer(myQueue);
    Data e = new Data();
    objectMessage.setObject(e);
    myMsgProducer.send(objectMessage);And the following are snippets of code from the message consumer:
    public void onMessage(Message message) {
                 if(message instanceof ObjectMessage ){
             try{
                  ObjectMessage objMsg = (ObjectMessage) message;
                  Data myData = (Data)objMsg.getObject();
             catch(JMSException e){
                  System.out.println("Exception occured: " + e.toString());
    }The result of attempting to cast the objMsg to a Data is an exception thrown.
    i did noticed however, that when I was debugging the message consumer, that the byteArrayInputStream values for both message and objMsg are null meaning that the data is not being sent or received. Any help would be greatly appreciated, thanks!
    Edited by: 883631 on Sep 13, 2011 4:09 PM
    Edited by: EJP on 14/09/2011 09:22: added {noformat}{noformat} tags. Please use them.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Sorry, the exception thrown is:
    Exception occured: com.sun.messaging.jms.MessageFormatException: [C4015]: Deserialize message failed. - cause: java.lang.ClassNotFoundException: MsgSender.Data
    Sep 14, 2011 8:53:50 AM com.sun.messaging.jmq.jmsclient.ExceptionHandler logCaughtException
    WARNING: [I500]: Caught JVM Exception: java.lang.ClassNotFoundException: MsgSender.Data
    where MsgSender is the name of the project that produces the messages to the queue.
    Data is the class that is both on the sender and receiver side, and the exception is thrown as a result of casting the object message back into a type Data.
    Data myData = (Data)objMsg.getObject();
    I hope this isn't too confusing. What I'm wondering is if there are extra steps to serializing your object or if the ObjectMessage's setObject method automatically does that for you so as long as you declare your class to implement Serializable. And if that's the case, how do you deserialize it back to the original object?
    Thank you

  • Serializing/Deserializing Objects..Urgent !!!

    Hello Everyone,
    Out of the blue I got an exception like
    java.io.StreamCorruptedException: invalid stream header
         at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
         at java.io.ObjectInputStream.<init>(Unknown Source)
    I am implementing "Applet to Servlet communication".
    Actually i am trying to deserialize the object which was passed to the servlet.But when i read it back i am geting the above exception.
    Can anyone throw some light on it?
    Her is my code
    APPLET CODE:
    private void interactWithServlet() {
    WBObject result = null;
    try {
    // Create an object we can use to communicate with the servlet
    URL servletURL = new URL(sURL);
    URLConnection servletConnection = servletURL.openConnection();
    servletConnection.setDoOutput(true);
    servletConnection.setUseCaches(false);
    servletConnection.setRequestProperty("Content-Type", "application/octet-stream;charset=utf-8");
    ObjectOutputStream request = new ObjectOutputStream(
    new BufferedOutputStream(servletConnection.getOutputStream()));
    WBObject wbObj=m_whiteBoardComponent.getDesignPanel().getWBObject();
    int size=wbObj.getChildren().size();
    for(int i=0;i<size;i++){
    PickObject pick=(PickObject)wbObj.getChildren().get(i);
    System.out.println("the pick object name is"+pick.getName());
    int count=pick.getChildren().size();
    for(int j=0;j<count;j++){
    ItemObject item=(ItemObject)pick.getChildren().get(j);
    System.out.println("the item object name is"+item.getName());
    request.writeObject(wbObj);
    request.flush();
    request.close();
    ObjectInputStream response = new ObjectInputStream(
    new BufferedInputStream(servletConnection.getInputStream()));
    result = (WBObject)response.readObject();
    System.out.println("The object is"+(result instanceof WBObject));
    response.close();
    } catch (Exception e) {
    e.printStackTrace();
    SERVLET CODE:
    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
    IOException {
    WBObject o = null;
    ObjectInputStream inputStream = new ObjectInputStream(
    new BufferedInputStream(req.getInputStream()));
    try {
    o = (WBObject)inputStream.readObject();
    inputStream.close();
    } catch( ClassNotFoundException ex ) {
    ex.printStackTrace();
    // send response
    resp.setStatus(HttpServletResponse.SC_OK);
    resp.setContentType("application/octet-stream;charset=utf-8");
    ObjectOutputStream oos = new ObjectOutputStream(
    new BufferedOutputStream(resp.getOutputStream()));
    oos.writeObject(o);
    oos.close();
    Best Regards
    Ashish

    client
    URLConnection servletConnection = servletURL.openConnection();try
    HttpURLConnection servletConnection = (HttpURLConnection)servletURL.openConnection();server
    // send response
    resp.setStatus(HttpServletResponse.SC_OK);
    resp.setContentType("application/octet-stream;charset=utf-8");
    ObjectOutputStream oos = new ObjectOutputStream(
    new BufferedOutputStream(resp.getOutputStream()));
    oos.writeObject(o);
    oos.close();try
    // send response
    //resp.setStatus(HttpServletResponse.SC_OK);
    //resp.setContentType("application/octet-stream;charset=utf-8");
    ObjectOutputStream oos = new ObjectOutputStream(
    new BufferedOutputStream(resp.getOutputStream()));
    oos.writeObject(o);
    oos.flush();
    oos.close();

  • Shutting down rogue threads: impossible?

    While designing a system that accepts 'plugins' that are sent by untrusted users, I ran across this problem:
    Imagine a malicious user intentionally sends this plugin:
    public void init()
    int[][] a = new int[123456][10]; //allocate tons of memory.
    while ( true ) ; //waste tons of CPU cycles.
    I want to 'defend' against this kind of thing, whether done intentionally or not.
    So far, I have found out the following things:
    A) There is no java-based profiler information. In other words, there is no such thing as a thread.getCpuLoad() kind of method. There is the JVMPI, so for now I guess I'll write various JNI libraries that will make the JVMPI interface callable from java.
    B) Even if the thread is identified, there is no way at all to destroy it. Thread.destroy() is unimplemented (returns NoSuchMethodError). Thread.suspend() still works, eventhough it is deprecated, and will stop a thread when doing something like while ( true ) ;. However, I have not found a way of reclaiming any allocated memory. Removing all references to the thread object and then running the garbage collector didn't help.
    C) There does not appear to be any thread kill functionality in JVMPI, though I might have missed something.
    D) There does not appear to be a relatively simple way to start up a new 'lite' JVM to run the untrusted code in. Starting up an entire new java executable through Runtime.getRuntime.process() might work, but the endgoal is to get tons of these little plugins running in their own threads. One JVM can actually handle this admirably, but I doubt one system can handle 70 to 80 concurrent JVMs.
    leading me to the conclusion:
    There is no way to really 'sandbox' untrusted code. Even if you can prevent them from opening files and such, they can perform a DoS attack bij allocating large amounts of memory and getting stuck in while ( true ) ; loops. Even if this behaviour is detected, there is no way to guard against it happening aside from suspending the thread and accepting the memory as unreclaimable until the JVM is restarted.
    I really hope there is a better solution than suspending and writing off the used memory, but if there is no way to really kill a thread, perhaps this can be worked on ASAP for the next release? destroy() exists. It needs implementation.
    Incidentally, there is no risk here of contaminating the state or causing deadlocks due to monitors being locked 'forever', as each such 'plugin' uses its own loader and cannot exchange data between the main system or any other plugin, except through serialized/deserialized stuff. While I understand the dangers of just cutting threads off, in this case, I have already taken precautions that one 'plugin' can't mess in any way with another.
    I did a 'test run' and wrote exactly such an applet. While it didn't hang the web-browser (Opera), it did cause Opera to use up all free CPU cycles, and there was no way to stop Opera from using up all CPU (or reclaiming the memory), short of completely exiting the browser.
    Didn't test with IE, or netscape.
    (That's Opera using JDK1.4 as JVM).
    I could of course be mistaken in all this and completely missed a way to completely kill an unresponsive thread, so I am hopefully awaiting corrections.
    --Reinier Zwitserloot.

    Weird.
    rogueThread.stop();
    rogueThread = null;
    System.gc();
    drops CPU use down to 0, and reduces the memory footprint back down to the original minimum. In other words, seems to do all the required functionality.
    I got the impression from the documentation explaining why stop/suspend/resume are deprecated that it wouldn't work unless the Thread was stuck in some kind of IO blocking call.
    Thanks a bunch!
    NB: Would anybody know of a code sample which won't respond to a stop and/or suspend? this quote from the deprecation explanation has me worried:
    "It should be noted that in all situations where a waiting thread doesn't respond to Thread.interrupt, it wouldn't respond to Thread.stop either."

  • Hashtable imcompletely deserialized?!

    If anyone could help me with this I would be most appreciative.
    I appear to have a situation where a serializable class with an internal Hashtable is not deserilizing correctly. The class containing the Hashtable is called PropDb. In PropDb I have this method...
    protected Hashtable  m_names = new Hashtable();
    public synchronized String getStringVal(String key) {
      if ((key != null) && (key.length() != 0))
        return (String)m_names.get(key);
      else
        return null;
    }Now here is the exception that is sometimes thrown...
    java.lang.NullPointerException
            at java.util.Hashtable.get(Unknown Source)
            at util.PropertyDB.getString(PropertyDB.java:635)Given that the key is not null, and looking at the source for Hashtable... the only other entities in Hashtable.get() that could throw the NullPointer are the internal data array or one of the data items in the data array!
    The reason I'm suspecting the serializing/deserializing is because it this NullPointer seems to come up "randomly"-- often enough to be a problem, but with no identifiable pattern!! So, can anyone tell me there are know issues with Hashtables deserializing in an incorrect state?
    Thank you very much.

    Hi there,
    I just wanted to mention that Hashtable's actions are strongly
    dependent by the hashcodes of the keys. Let's say that your
    KEY objects don't have constant hashCodes. Then the result of
    get() method is often wrong 'cause of the formula
         int hash = key.hashCode();
         int index = (hash & 0x7FFFFFFF) % tab.length;
       So if you want to serialize /deserialize Hashtable , I recommend you
    to override the hashCode() method of you Keys and write it in a way
    that gives you assurance that your key's hashcodes will remain constant after serialize/deserialize
    regards, Kaloyan

  • My class is serializing w/o implementing serializable

    I have a class Foo that implements Serializable.
    Foo has a data member that is an instance of class Bar.
    Class Bar does NOT implement Serializable.
    When I serialize an instance of Foo out to a file and
    then deserialize it back in, I'm seeing Bar's no-arg
    constructor being called.
    Shouldn't I be getting IOExceptions on the write and
    and read of my Foo instance when the JVM tries to
    write/read the Bar member, since only classes that implement
    Serializable can be serialized/deserialized?
    Oh, I'm using JDK 2SDK version 1.3.1
    -Steve

    From the Serializable API
    "To allow subtypes of non-serializable classes to be serialized, the subtype may assume responsibility for saving and restoring the state of the supertype's public, protected, and (if accessible) package fields. The subtype may assume this responsibility only if the class it extends has an accessible no-arg constructor to initialize the class's state. It is an error to declare a class Serializable in this case. The error will be detected at runtime."
    There seems to be a mistake in the second to last sentence. I would think itr should say 'It is an error to declare a class Serializable if this is not the case'.

  • Mutithreading for multiple roles in a distributed application?

    Hi experts,
    I am writing a background-running application that serves in three roles: Client, Middleware and Server. It does some thing like file-sharing in Kazaa. Client hands in requests thru Middleware to Server. Server send the file back and Middleware decrypt it before passing to Client.
    The middleware maintains a dictionary of file-links, server address where the file is stored and the decrypting key to the file.
    The dictionary is implemented by 3 vectors and get serialized/deserialized with the application exit/start.
    I want to exploit multithreading in this application. In other words, the application can work as different roles at the same time. For instance, the middleware is decypting file when a request is received for server, and the server starts to transfer file along with the decrypting.
    Issues: the dictionary shall be consistent
    My thought: Have a top level app class that deals with communication among peers. One class for each role. They all extends Thread. A new thread is instantiated and started when a corresponding request is received.
    A client thread calls wait() when a request is sent off. It is notified by the app when response comes back.
    The dictionary's read and write (i.e. add(), get()) are both synchronized to maintain consistency.
    My questions:
    1.Will my design work correctly?
    2.Is this the right/conventional way to do this sort of things?
    3.I am not sure about the wait(). Will it be better to write two methods, one for sending requests, the other one for dealing with responses?
    Thanks a lot in advance

    Hi, well, I thing I am not a expet but I think I can give you some help
    I think that you should let the main thread (that one created when the JVM runs Main method) only to run the GUI or other kind of user interface or no one will be able to close the program or request for files
    The main thread start the server thread and the server starts a new thread for handing each request just like you said
    For each request the main thread start a client ,it send the request and the input method will call read you will not have to call wait because the read method blocks until the response arives
    I could not undestand very well the middleware, could you tell me more about it?

  • Alternatives to needing class file during deserialization?

    Hi,
    I'm trying to find a way of deserializing an object without requiring its class file (eg, class A) to be present. In that case the JVM instance that's deserializing an instance of class A wouldn't need to worry about needing to access the class A from its classpath (file "A.class") or from any other source (such as a custom classloader loading class A's bytecodes over the network) in order to deserialize an instance of class A, except when the source is the serialization stream itself -- all data needed for serialization would be contained only within the serialization stream.
    I believe this should be doable by first serializing an instance of class java.lang.Class that represents class A (since java.lang.Class instances are serializable), and then serializing the instance of class A, as explained below. This technique isn't working, and I'm wondering if anyone knows why, and if there are other known techniques for accomplishing the same objective.
    I start out with these classes as a test that serialization is working:
    The class whose instance I'm serializing/deserializing:
    class A implements java.io.Serializable {
         public int x = 5;
    }Serialization code:
    import java.io.*;
    class Serialize {
         public static void main(String[] args) throws Exception {
              FileOutputStream fos = new FileOutputStream("a.ser");
              ObjectOutput out = new ObjectOutputStream(fos);
              A aRef = new A();
              out.writeObject(aRef);
              out.flush();
              out.close();
    }Deserialization code:
    import java.io.*;
    class Deserialize {
         public static void main(String[] args) throws Exception {
              FileInputStream fis = new FileInputStream("a.ser");
              ObjectInput in = new ObjectInputStream(fis);
              A aRef = (A)in.readObject();
              in.close();
              System.out.println(aRef.x); //expect 5
    }Here's what I do:
    (1) javac A.java Serialize.java Deserialize.java
    (2) java Serialize
    (3) java Deserialize
    This works fine, and prints "5" as expected.
    Now that I know that this base case works, I next try to serialize an instance of class java.lang.Class into the stream. This instance will represent class A, and can be obtained by specifying the literal "A.class" in the source code as shown below. Then I serialize an instance of class A as before. I'll then repeat step (1) and (2), erase the "A.class" file, and then do step 3. Here's the new code:
    The class whose instance I'm serializing/deserializing (same as before):
    class A implements java.io.Serializable {
         public int x = 5;
    }Serialization code:
    import java.io.*;
    class Serialize {
         public static void main(String[] args) throws Exception {
              FileOutputStream fos = new FileOutputStream("a.ser");
              ObjectOutput out = new ObjectOutputStream(fos);
              Class clazz = A.class;
              out.writeObject(clazz);
              A aRef = new A();
              out.writeObject(aRef);
              out.flush();
              out.close();
    }Deserialization code:
    import java.io.*;
    class Deserialize {
         public static void main(String[] args) throws Exception {
              FileInputStream fis = new FileInputStream("a.ser");
              ObjectInput in = new ObjectInputStream(fis);
              Class clazz = (Class)in.readObject(); //shouldn't this cause class A to be loaded?
              A aRef = (A)in.readObject();
              in.close();
              System.out.println(aRef.x); //expect "5"
              System.out.println(clazz); //expect "class A"
    }And now the revised steps:
    (1) javac A.java Serialize.java Deserialize.java
    (2) java Serialize
    *(3) Delete the "A.class" file because it shouldn't be needed since we're now serializing an instance of class Class that should fully represent class A.*
    (4) java Deserialize
    Bam... exception thrown at step 4:
    Exception in thread "main" java.lang.ClassNotFoundException: A
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClassInternal(Unknown Source)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Unknown Source)
            at java.io.ObjectInputStream.resolveClass(Unknown Source)
            at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
            at java.io.ObjectInputStream.readClassDesc(Unknown Source)
            at java.io.ObjectInputStream.readClass(Unknown Source)
            at java.io.ObjectInputStream.readObject0(Unknown Source)
            at java.io.ObjectInputStream.readObject(Unknown Source)
            at Deserialize.main(Deserialize.java:6)Why is a ClassNotFoundException thrown? Class A is already loaded automatically after the instance of class Class is deserialized, isn't it? It's possible that an instance of class Class doesn't store method bytecodes -- I'm not sure about that. But even so, I purposefully did not include any methods in class A -- I just made the data member public (bad form, but this is just a test).
    Any ideas why this isn't working, or a way(s) to accomplish the goal?
    Thanks,
    Will

    serializing java.lang.Class instance does not really write the content of the class file in to the stream. It only write a class descriptor. At the read end it will try to locate the class file locally and validate the class file with the information in the descriptor.
    You need to have mechanism to send the data of the class file itself in to the stream before sending the instance.
    take a look at the annotateClass and resolveClass methods in ObjectOutputStream and ObjectInputStream

  • General architectural question....

    Say you have a Person object like this:
    class Person {
      private String name,address,phone;
      public String getPhone() {
        return phone;
      public void setPhone(String phone) {
        this.phone=phone;
    }Now you have some "client" application which creates Persons and puts them in the cache:
    Person joe = new Person();
    cache.add("joe", joe);This application is maintaining a reference to joe. Perhaps it's even passing joe around to other classes. You want to make sure that when some class in this client app calls "joe.getPhone()" that it's getting a correct result, one that reflects changes made to the cached value by other JVMs. You could do this a few ways:
    - By maintaining a local hashmap of keys to objects and having that local map kept up to date by a CQC. In that case you'd not pass around object references in your app, just object keys. This doesn't work well for applications which were already written assuming a single-JVM architecture since all your code is passing around objects and calling getter/setter methods on those objects.
    - You could have the object implement MapListener and listen for updates to itself. Every time a MapEvent showed up it would have to repopulate its member variables with the values from the MapEvent. That's not great either because if your object has many member variables, you're doing a lot of unnecessary serializing/deserializing/repopulating everytime one variable is updated. Also if a CQC maintains a reference to a Person implementing MapListener, that person will never be garbage collected(right?).
    - You could change your getter/setter methods to interact with the cached values instead of the local member variable values but that's not good either because in cases of storage disabled nodes you're hitting the network every time you do a getXXX() even if the value has not changed. Also doesn't coherence's usage of reflection depend on the presence of typical getXXX/setXXX methods which look like the one above?
    There has got to be a better solution that I'm missing, right? I'd been running apps with storage disabled and CQCs keeping a local hashmap updated. Maybe it makes more sense to enable storage on each of the client app JVMs. I'd wanted to have many small storage disabled apps running on a single machine with just one or two storage enabled JVMs on it.
    Thanks,
    Andrew

    Hi Andrew,
    snidely_whiplash wrote:
    Say you have a Person object like this:
    class Person {
    private String name,address,phone;
    public String getPhone() {
    return phone;
    public void setPhone(String phone) {
    this.phone=phone;
    }Now you have some "client" application which creates Persons and puts them in the cache:
    Person joe = new Person();
    cache.add("joe", joe);This application is maintaining a reference to joe. Perhaps it's even passing joe around to other classes. You want to make sure that when some class in this client app calls "joe.getPhone()" That is not really safe, particularly it is not thread-safe, and you can't always expect it to work.
    that it's getting a correct result, one that reflects changes made to the cached value by other JVMs. And this will never work with Coherence, because any changes arriving from other nodes will always be deserialized into a new object instance created by Coherence, never into existing ones.
    You could do this a few ways:
    - By maintaining a local hashmap of keys to objects and having that local map kept up to date by a CQC. In that case you'd not pass around object references in your app, just object keys. This doesn't work well for applications which were already written assuming a single-JVM architecture since all your code is passing around objects and calling getter/setter methods on those objects.
    Nonetheless, passing on only keys and accessing the cache by key is the way it is intended to be used.
    - You could have the object implement MapListener and listen for updates to itself. Every time a MapEvent showed up it would have to repopulate its member variables with the values from the MapEvent. That's not great either because if your object has many member variables, you're doing a lot of unnecessary serializing/deserializing/repopulating everytime one variable is updated. Also if a CQC maintains a reference to a Person implementing MapListener, that person will never be garbage collected(right?). Also Coherence will not know that that object is supposed to be the cached object, therefore whenever you do a CQC.get() with the same key, you would get a different object, and poof, you don't have single object per identity anymore.
    >
    - You could change your getter/setter methods to interact with the cached values instead of the local member variable values but that's not good either because in cases of storage disabled nodes you're hitting the network every time you do a getXXX() even if the value has not changed. Also doesn't coherence's usage of reflection depend on the presence of typical getXXX/setXXX methods which look like the one above?I don't really see what you refer to here.
    >
    There has got to be a better solution that I'm missing, right? I'd been running apps with storage disabled and CQCs keeping a local hashmap updated. Maybe it makes more sense to enable storage on each of the client app JVMs. I'd wanted to have many small storage disabled apps running on a single machine with just one or two storage enabled JVMs on it. I don't really see where you are trying to get to. Even in case of storage-enabled JVMs, majority of the data in a partitioned cache (where storage disabled has a meaning) will not be local, similarly to storage-disabled JVMs where all of the data is not local.
    Altogether, Coherence was never intended and is not designed to be used as a pass-by-reference Map. You should expect your objects to be passed by value. Coherence only guarantees that data whicy you get from a cache.get or cache.entrySet or similar stuff is up-to-date (instead of stale data successfully overwritten with another entry) at the point in time of getting it, but you should not try to rely on certain cases where your objects are stored in Java object form.
    If you try to reproduce such functionality like a single objects for each identity being kept up-to-date, you would have to write your own repository of data objects and keep them up-to-date by a non-lite listener.
    Also, you would still have to
    - either resolve race conditions related to putting such an object back into the cache (the object being written to the network is vulnerable to modifications by the listener writing incoming changes to the object),
    - or copy state to your own object before putting an object to the cache, and then comes the problem of having multiple identities at that point for the object and it is problematic to ensure that the object that is kept is holding the correct state... all in all it exposes the problem of maintaining many synchronized instances of data without distributed locking (or having a very slow and not really reliable solution using distributed locking) and therefore having to reconcile changes from multiple directions (similar problems like the ones tackled by active-active push replication)
    Because of the above things, this is probably a bad idea.
    Best regards,
    Robert

  • EJB Handle return remote ref fails??

    Having a problem getting a remote reference on an EJB using a handle. Create a remote ref to an EJB and store three items and display said items - okay
    Get a handle to the remote ref and serialize and store - okay
    Deserialize - okay
    Cast to remote ref - NOT okay wants a home ref?
    This example is, by and large, similar to the example in section 6.8 of the EJB 2.0 Spec.
    Need to know why I cannot get the remote ref returned? Is there an OC4J issue? Please let me know when you can as would like to use this in a class.
    THANKS - Ken Cooper
    public class CartClient {
    public static void main(String[] args) {
    CartClient cartClient = new CartClient();
    try {
    Context context = getInitialContext();
    CartHome cartHome = (CartHome) PortableRemoteObject.narrow(context.lookup(
    "Cart"), CartHome.class);
    Cart cart;
    // Use one of the create() methods below to create a new instance
    cart = cartHome.create();
    // Call any of the Remote methods below to access the EJB
    // cart.getItems( );
    // cart.addItems( java.lang.String p );
    cart.addItems("Truck");
    cart.addItems("Car");
    cart.addItems("Boat");
    System.out.println(cart.getItems());
    // Serialize and store in C:\cartHandle
    Handle cartHandle = cart.getHandle();
    FileOutputStream out = new FileOutputStream("C:/cartHandle");
    ObjectOutputStream so = new ObjectOutputStream(out);
    so.writeObject(cartHandle);
    so.flush();
    System.out.println("Serialized");
    // Deserialize from C:\cartHandle
    FileInputStream in = new FileInputStream("C:/cartHandle");
    ObjectInputStream si = new ObjectInputStream(in);
    cartHandle = (Handle) si.readObject();
    System.out.println("DeSerialized");
    Cart cart2 = (Cart) PortableRemoteObject.narrow(cartHandle.getEJBObject(),
    Cart.class);
    System.out.println("Second: " + cart2.getItems());
    } catch (Throwable ex) {
    ex.printStackTrace();
    private static Context getInitialContext() throws NamingException {
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "admin");
    env.put(Context.SECURITY_CREDENTIALS, "welcome");
    env.put(Context.PROVIDER_URL,
    "ormi://localhost:23891/current-workspace-app");
    return new InitialContext(env);
    OUTPUT AND ERROR FROM EXECUTION
    C:\JDev9031\jdk\bin\javaw.exe -ojvm -classpath C:\JDev9031\jdev\mywork\del15aug\Project4\classes;......
    Start: TruckCarBoat
    Serialized
    DeSerialized
    com.evermind.server.rmi.OrionRemoteException: Error looking up EJBHome at location 'Cart'
    javax.ejb.EJBObject com.evermind.server.ejb.StatefulSessionHandle.getEJBObject()
    StatefulSessionHandle.java:56
    void mypackage4.CartClient.main(java.lang.String[])
    CartClient.java:53 (NOTE: The highlighted line above is line 53)

    Thank you all guys for your suggests, and sorry for my (long) silence: i was at home with hard cough. I think that unfortunally the problem is more in deep. This because:
    1) at the beginnnig, in my (many) attempts I've tried to give the server url in a lot of ways:
    a) only the IP;
    b) http://<IP>;
    c) http://<IP>: <port>;
    d) http://<server-name>;
    e) http://<server-name>:<server-port>;
    b) iiop://<IP>;
    c) iiop://<IP>: <port>;
    d) iiop://<server-name>;
    e) iiop://<server-name>:<server-port>;
    In this cases, using init.put(org.omg.CORBA.ORBInitialHost,<param-value>) (init is Java Properties object), I didn't get what I would: always AppServer running on Win2000 responded me, instead of the one running on Linux.
    Using instead using init.put(Context.PROVIDER_URL,<param-value>) , in case a) I got the error message Root exception is java.net.MalformedURLException: no protocol:<IP-number>. In case b), c), d) and e) I got invalid url - connection refused error message (Invalid URL: http://gandalf.engiweb.com. Root exception is java.net.ConnectException: Connection refused: connect).
    A collegue of mine is using WebSphere and everything seems to work correctly. I'm afraid that there is a problem (of misconfiguration?) in the Borland Application Server. This is a problem, because, if I have (suppose) server gandalf running, with the correct EJB, and the server Saruman running too, but with the scorrect EJB, or the ejb container down, always respond me Saruman, not Gandalf: my tests gave me this result.
    At the moment I don't know what to do, except migrate to WebSphere, or another Application Server.
    Thank you a lot for your interest. Bye!

  • How to set XML.ignoreWhitespace = false; in HttpService /Result?

    Please ask these kind of questions on flexcoders or the Adobe Flex Forums.  This is for development of the SDK itself.<br /><br />Matt<br /><br /><br />On 11/17/08 12:56 AM, "venubwal" <[email protected]> wrote:<br /><br />A new discussion was started by venubwal in<br /><br />Developers --<br />  How to set XML.ignoreWhitespace = false;  in HttpService /Result?<br /><br />I want to carry/preserve Leading & trailing spaces<white spaces> in event's result....<br />I am using service as :<br />_webService = new HTTPService();<br />_webService.url = serviceUrl;<br />_webService.method = "POST";<br />_webService.resultFormat = "e4x";<br />......<br />...Again i am checking it as -in<br />private function serviceResultHandler(event:ResultEvent):void<br />        {<br />        stopExecution();<br />        var doc:XMLDocument = new XMLDocument();<br /> doc.ignoreWhite = false;<br />        XML.ignoreWhitespace = false;<br />doc.parseXML(event.result as XML);<br />       Alert.show(event.result.toString(),"....serviceResultHandler...");<br /><br />But, i am not able see L&T spacesin alert() where I can see L&T spaces in Servlet/Java side which assigned as metaResponse<br />as....<br />      OutputStream writer = response.getOutputStream();<br />      OutputStreamWriter outputStreamWriter = new OutputStreamWriter(writer,"UTF-8");<br />JaxbSerializationUtil.serializeObjectToWriter(outputStreamWriter, metaResponse);<br /><br />________________________________<br />View/reply at How to set XML.ignoreWhitespace = false;  in HttpService /Result? <a href=http://www.adobeforums.com/webx?13@@.59b70bd4><br />Replies by email are OK.<br />Use the unsubscribe <a href=http://www.adobeforums.com/webx?280@@.59b70bd4!folder=.3c060fa3>  form to cancel your email subscription.

    By Using XML.ignoreWhitespace = false; <br />I am able to Store/Carry/Save L&T white spaces in XML and i can retrive values with whitespaces...<br /><br />It is in case of loading from Java<DB> to Flex.<br /><br />But the actual problem is with xmlObject.toString()/toXMLString()<br />is not able to carry whitespace, while it should carry as parameter to Java Servlet..so that it can be get using request.getParameter() [..then it is serializing/deserializing]<br /><br />So, how i can preserve the L&T whiteSpaces on XML.toString()/toXMLString() method.<br /><br />OR else<br />How we can set Http request attribute in Flex, so that we can use ( AnY_Object)request.getAttribute()...

  • How to get a collection of beans using web services

    Hi,
    I'm new to SOAP and Web Services I'd like to know whether the following is possible
    or not.
    I've created an EJB with this business interface:
    public interface Users implements EJBObject {
    public User[] getUsers( ) ...
    Where the User object is a bean with some properties:
    public User implements Serializable {
    public void setName( ... ) ...
    public String getName( ) ...
    public void setAddress( ... ) ...
    public String getAdress( ) ...
    I've create the ejb-jar.xml and weblogic-ejb-jar.xml that contain the definition
    of my EJB and then I try to deploy the web services using the ant task 'wsgen'.
    I get the following exception:
    org.xml.sax.SAXException: Could not find a codec that understood how to convert
    class [LUser; using http://schemas.xmlsoap.org/soap/encoding/
    : [ CodecFactory: http://xml.apache.org/xml-soap/literalxml=null, http://schemas.xmlsoap.org/soap/encoding/=null,
    =null]
    Can someone help to resolve this ? Also, I'd like to know if it's possible that
    a web service return a collection of beans as shown above ?
    Thanks for your help.
    Ludovic.

    Java beans are serialized/deserialized by the soap encoding codec
    itself. you dont have to write custom encoders. I think the error
    is because you dont have the java bean class on the server side.
    Java bean class file should be in the classpath or it should be
    added to the ejb jar file.
    thanks,
    -manoj
    Ludovic Deravet wrote:
    Thanks for your help. Indeed, that was my problem.
    But now I'm facing this one:
    [SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to
    deserialize a 'urn:local:ns0:return' using encoding style 'http://sch
    emas.xmlsoap.org/soap/encoding/'.;
    targetException=java.lang.IllegalArgumentException: No Deserializer found to
    deserialize a 'urn:local:ns0:
    return' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.]
    at org.apache.soap.rpc.Call.invoke(Call.java:246)
    at com.webservices.WSClient.main(WSClient.java:38)
    Did you implement your own deserializer to read your array of beans (called
    Data) ? Or do I need to do something else ?
    Thanks.
    Ludovic.
    "manoj cheenath" <[email protected]> wrote in message
    news:[email protected]...
    You can do this. I guess, the problem is because you have
    not defined a package for the bean.
    Try something like:
    package foo.bar;
    class User{
    I am attaching an example.
    -manoj
    Ludovic Deravet wrote:
    Hi,
    I'm new to SOAP and Web Services I'd like to know whether the following
    is possible
    or not.
    I've created an EJB with this business interface:
    public interface Users implements EJBObject {
    public User[] getUsers( ) ...
    Where the User object is a bean with some properties:
    public User implements Serializable {
    public void setName( ... ) ...
    public String getName( ) ...
    public void setAddress( ... ) ...
    public String getAdress( ) ...
    I've create the ejb-jar.xml and weblogic-ejb-jar.xml that contain thedefinition
    of my EJB and then I try to deploy the web services using the ant task'wsgen'.
    I get the following exception:
    org.xml.sax.SAXException: Could not find a codec that understood how toconvert
    class [LUser; using http://schemas.xmlsoap.org/soap/encoding/
    : [ CodecFactory: http://xml.apache.org/xml-soap/literalxml=null,
    http://schemas.xmlsoap.org/soap/encoding/=null,> > > =null
    Can someone help to resolve this ? Also, I'd like to know if it's
    possible that
    a web service return a collection of beans as shown above ?
    Thanks for your help.
    Ludovic.

  • RE: (forte-users) Serialisation

    Singh,
    Any message sent across partition boundaries is serialized. This includes
    method invokations, events and exceptions. The signature of the message
    itself is serialized, as well as the values of all parameters/attributes.
    Serializing a scalar value requires less overhead then serialising an
    object, however, the difference isn't as big as you might think. Objects
    have more attributes then just the value you're interested in and these
    attributes are serialised as well. Each object is an instance of a class and
    each class has a UUID, which is added to the serialized stream as well.
    However, methods are NOT serialised. What happens is this. Forte serializes
    an object into a stream containing only the values of the attributes
    (including nested attributes). This stream is given a header which sais of
    which class this object is an instance (the UUID is used for that). The
    receiving partition reads the serialized stream, finds the definition of the
    class (defined by UUID) in its own code, creates an instance of this class
    and fills the data out of the serialized stream into this new object.
    You can imagine what might happen if there is a mismatch between the
    class-definitions in both partitions. You either get
    serialization-deserialization errors, or the receiving partition complains
    that it doesn't even know the UUID of the received streamed object, or you
    get no errors at all and just have an object that displays different
    behaviour, depending what partition it's in.
    If there are no problems, then the main issue is the
    serializing-deserializing overhead. Note that the receiving partition has to
    instantiate a new object for every serialized object it receives and will
    therefore execute all code in the Init() method. This overhead is not
    required for scalar types, for which Forte only needs to reserve a small
    amount of memory space on the stack.
    Any call to a database is also a message sent across partitions and is
    therefore serialized. However, one partition is a Forte partition and the
    other one isn't. Therefore, Forte's internal serialization mechanism isn't
    used. Forte serializes the SQL-query into a format understood by the
    database (which is different for every vendor). Forte then receives a stream
    back which has a different format for every different database type. This
    stream is deserialized and written to attributes that Forte has reserved to
    contain the data. Whether these are scalar, datavalues or domains only
    impacts performance inside the Forte partition. It has no effect on the
    communication with the database.
    Pascal Rottier
    Atos Origin Nederland (BAS/West End User Computing)
    Tel. +31 (0)10-2661223
    Fax. +31 (0)10-2661199
    E-mail: Pascal.Rottiernl.origin-it.com
    ++++++++++++++++++++++++++++
    Philip Morris (Afd. MIS)
    Tel. +31 (0)164-295149
    Fax. +31 (0)164-294444
    E-mail: Rottier.Pascalpmintl.ch
    -----Original Message-----
    From: Singh [mailto:fortelistyahoo.com]
    Sent: Thursday, February 22, 2001 3:30 AM
    To: forte-userslists.xpedior.com
    Subject: (forte-users) Serialisation
    Hello All
    I have a question that has been bugging me for some
    time.
    We all know that it is better to use scalar data
    types, as opposed to objects, when passing data across
    a network.
    The reason, if I understand correctly, is that when
    you send an object across a network, the whole object
    (properties, attributes and methods) is deserialised
    into zero's and one's before being sent across and
    then serialised back into the object when it gets to
    the other side. This would take longer for an object
    since for a scalar value, just the value is
    deserialised and serialised.
    But when you are writing to a database from the tier
    before the database to the database, does it matter
    what type you use. The reason for saying this is that
    the values are serialised before they go across and
    then deserialised when they get to the base, in other
    words, they are sent as zero's and one's. For a scalar
    - just the value is sent across but for an object -
    does just the value go across or the complete object.
    If just the value of the object goes across, then it
    doesn't really matter whether a scalar or object is
    sent across.
    Am I correct in this assumption.
    Thanks in advance for your help.
    Regards,
    Singh
    For the archives, go to: http://lists.xpedior.com/forte-users and use
    the login: forte and the password: archive. To unsubscribe, send in a new
    email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.com

    Hi,
    I cannot get hold of Tech Note 10398..... can anyone email me a copy?
    Tx
    Etienne
    -----Original Message-----
    From: Klerk, Theo de [SMTP:Theo.de.Klerkcompaq.com]
    Sent: Wednesday, February 09, 2000 4:26 PM
    To: 'Jason de Cean'; 'Forte Users'
    Subject: RE: (forte-users) Serialisation
    There are a number of flags that will show you some of the required
    information in a log file (not within the application itself). Technote
    10398 has many more flags listed for a variety of obscure, useful, not so
    useful and exotic information:
    trc:cm:*:4 and *:8 - show packet serialisation, open, closes between
    partition communication
    trc:do:*:2 - proxy creation/deletion, exception events
    trc:do:*:5 - individual message tracing between proxies
    trc:do:*:8 - serialisation information
    Theo
    For the archives, go to: http://lists.xpedior.com/forte-users and use
    the login: forte and the password: archive. To unsubscribe, send in a new
    email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.com

Maybe you are looking for

  • Address book and syncing to Google

    Address Book help says: In Address Book, choose Address Book > Preferences, and then click General. Select the "Synchronize with Google" checkbox. I see no Checkbox, only .mac, exchange and Yahoo. All my s/w is up to date 10.5.3, Adddress book 4.1.1

  • How to get the table_name and its count(*) in a SQL

    Hi, Can anybody tell me how to write a sql to get the table_name and its count(*) in a SQL: Output should be: table_name count(*) XXX 261723 YYY 3343 Regards, G. Rajakumar.

  • Formula node to create a sine wave

    I am trying to create a Sine Wave to display on an XY Graph using a formula node. I've put in my formula which is: Sine=Emax*sin(2*pi*f*t). I am getting a very choppy almost triangular wave displayed on the xy graph. Any suggestions as to how to get

  • Installing iPod on a new computer

    Hi there, I've just got a new laptop and was wondering if I will need my iPod installation CD to make the iPod work on the new computer?

  • Dreamweaver 8 Trial won't load

    I'm hoping someone can help me. I am considering trying my hand at web design, so I downloaded the trial version of DW8 this morning to see if it might be good software to use. It has worked alright all day, but now when I try to go into it, it won't