Re: Processing Streamed Data
Robert DiFalco <[email protected]>
| Newsgroups | gmane.comp.java.sun.rmi |
|---|---|
| Message-ID | <[email protected]> |
Lol, so what sux about this solution is that ObjectOutputStream and ObjectInputStream will cache every single object it serializes (including composite subobjects) and there is no way to change this behavior because you can only call #reset when depth equals zero, and it will always be at at least "one" because you are in the process of writing the outer (streaming) object. IOW, if you are streaming hundreds of thousands of objects in #writeExternal, you cannot ever clear the ObjectOutputStream#handles map. Same thing on the read side. Also, there is no easy way to change things so that every object called #writeUnshared and #readUnshared instead of #writeObject and #readObject. Fun stuff! This is because #writeObject and #readObject are declared as final and to override them you also have to reimplement pretty much everything else about ObjectInputStream and ObjectOutputStream too. R. -----Original Message----- From: Robert DiFalco Sent: Thursday, May 12, 2005 10:54 AM To: [email protected] Subject: Re: Processing Streamed Data FWIW, my current guess would be to make an Externalizable class with no data, and do all my database queries in #writeExternal flushing the data as appropriate. The client side logic for what to do with the streamed data would be in #readExternal. The client wouldn't really do anything with the returned object. Just something like this: Object o = server.readStreamedData(); The server would just implement the remote method like so: public Object readStreamedData() ... { return new MyExternalizable(); } Seems like cheating, but given that I can't find any preferred ways to do this with RMI, it seems like this would work. Thoughts? R. -----Original Message----- From: Robert DiFalco Sent: Thursday, May 12, 2005 10:40 AM To: [email protected] Subject: Processing Streamed Data I have a large set of data to process, consider say 400,000 records read from a database that I want to pass to another machine to build a local copy of the data. I would like the client to make a request for the data and then setup an ObjectInputStream to receive the streamed data from the server. The server would just create an ObjectOutputStream and write the objects one by one, with the client processing them with its ObjectInputStream until EOF is hit. What approach should I take for doing this with RMI, just using sockets it would be pretty simple. Is there already an established protocol (besides marshalling) that I could use to do this with RMI? TIA, R. ======================================================================== === To unsubscribe, send email to [email protected] and include in the body of the message "signoff RMI-USERS". For general help, send email to [email protected] and include in the body of the message "help". For a list of frequently asked RMI questions please refer to: http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html To view past RMI-USERS postings, please see: http://archives.java.sun.com/archives/rmi-users.html ======================================================================== === To unsubscribe, send email to [email protected] and include in the body of the message "signoff RMI-USERS". For general help, send email to [email protected] and include in the body of the message "help". For a list of frequently asked RMI questions please refer to: http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html To view past RMI-USERS postings, please see: http://archives.java.sun.com/archives/rmi-users.html =========================================================================== To unsubscribe, send email to [email protected] and include in the body of the message "signoff RMI-USERS". For general help, send email to [email protected] and include in the body of the message "help". For a list of frequently asked RMI questions please refer to: http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html To view past RMI-USERS postings, please see: http://archives.java.sun.com/archives/rmi-users.html