From: mafor <nu...@jb...> - 2005-05-12 14:20:16
|
Currently Object*Streams are wrapped around the raw socket streams since the ObjectOutputStream needs to be reset between ping-packets. To be able to forward the raw socket streams directly to the marshallers (needed if you want to implement a proprietary protocol) one could implement a new subclassed OutputStream that wraps the ObjectOutputStream if needed. In this way the ObjectOutputStream is only used when needed and has the least impact on the architecture. See code below. This class is then used within ServerThread.java and SocketClientInvoker.java instead of the ObjectOutputStream. The marshallers has several options, either use the ResetOutputStream directly or ask it to generate or use an ObjectOutputStream. When a reset is being issued it is propagated to the ObjectOutputStream if available. The ObjectInputStream doesn't need to be reset (it is automatically reset from the stream) so it is simply removed. I have run some tests and it seems to work. Do you think this is possible way to go? package org.jboss.remoting; | | import java.io.IOException; | import java.io.ObjectOutputStream; | import java.io.OutputStream; | | public class ResetOutputStream extends OutputStream | { | ObjectOutputStream oout ; | OutputStream out ; | | public ResetOutputStream(OutputStream out) | { | this.out = out ; | } | | public void write(int value) throws IOException | { | out.write(value) ; | out.flush() ; | } | | public ObjectOutputStream getObjectStream() throws IOException | { | if( oout == null ) | oout = new ObjectOutputStream(out) ; | | return oout ; | } | | public void setObjectStream(ObjectOutputStream oout) | { | this.oout = oout ; | } | | public void reset() throws IOException | { | if( oout != null ) | oout.reset() ; | } | } View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3877472#3877472 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3877472 |