[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting/transport/socket ...
Ron Sigal
ron_sigal at yahoo.com
Mon Jan 29 00:17:09 EST 2007
User: rsigal
Date: 07/01/29 00:17:09
Modified: src/main/org/jboss/remoting/transport/socket Tag:
remoting_2_x ClientSocketWrapper.java
Log:
JBREM-692: Changed to take advantage of PreferredStream(Un)Marshallers.
Revision Changes Path
No revision
No revision
1.15.10.5 +45 -8 JBossRemoting/src/main/org/jboss/remoting/transport/socket/ClientSocketWrapper.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ClientSocketWrapper.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/socket/ClientSocketWrapper.java,v
retrieving revision 1.15.10.4
retrieving revision 1.15.10.5
diff -u -b -r1.15.10.4 -r1.15.10.5
--- ClientSocketWrapper.java 23 Jan 2007 09:39:03 -0000 1.15.10.4
+++ ClientSocketWrapper.java 29 Jan 2007 05:17:09 -0000 1.15.10.5
@@ -24,10 +24,16 @@
import java.io.IOException;
import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Map;
import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.marshal.Marshaller;
+import org.jboss.remoting.marshal.PreferredStreamMarshaller;
+import org.jboss.remoting.marshal.PreferredStreamUnMarshaller;
+import org.jboss.remoting.marshal.UnMarshaller;
import org.jboss.logging.Logger;
/**
@@ -114,22 +120,53 @@
}
}
- out = createOutputStream(serializationType, socket);
- in = createInputStream(serializationType, socket);
+ Marshaller marshaller = null;
+ UnMarshaller unmarshaller = null;
+ if (metadata != null)
+ {
+ marshaller = (Marshaller) metadata.get(MARSHALLER);
+ unmarshaller = (UnMarshaller) metadata.get(UNMARSHALLER);
+ }
+
+ out = createOutputStream(serializationType, socket, marshaller);
+ in = createInputStream(serializationType, socket, unmarshaller);
}
- protected InputStream createInputStream(String serializationType, Socket socket)
+ protected InputStream createInputStream(String serializationType, Socket socket, UnMarshaller unmarshaller)
throws IOException
{
- if (trace) { log.trace(this + " getting input stream from " + socket); }
- return socket.getInputStream();
+ if (trace) { log.trace(this + " getting input stream from " + socket + ", " + unmarshaller); }
+
+ if (unmarshaller == null)
+ log.warn("got null unmarshaller");
+
+ InputStream is = socket.getInputStream();
+ if (unmarshaller instanceof PreferredStreamUnMarshaller)
+ {
+ PreferredStreamUnMarshaller psum = (PreferredStreamUnMarshaller) unmarshaller;
+ is = psum.getMarshallingStream(is);
+ }
+
+ return is;
}
- protected OutputStream createOutputStream(String serializationType, Socket socket)
+ protected OutputStream createOutputStream(String serializationType, Socket socket, Marshaller marshaller)
throws IOException
{
- if (trace) { log.trace(this + " getting output stream from " + socket); }
- return socket.getOutputStream();
+ if (trace) { log.trace(this + " getting output stream from " + socket + ", " + marshaller); }
+
+
+ if (marshaller == null)
+ log.warn("got null marshaller");
+
+ OutputStream os = socket.getOutputStream();
+ if (marshaller instanceof PreferredStreamMarshaller)
+ {
+ PreferredStreamMarshaller psm = (PreferredStreamMarshaller) marshaller;
+ os = psm.getMarshallingStream(os);
+ }
+
+ return os;
}
// Private --------------------------------------------------------------------------------------
More information about the jboss-cvs-commits
mailing list