Title: [2517] trunk/openejb1/modules/core/src/java/org/openejb/core/ivm/BaseEjbProxyHandler.java: Removing use of MarshalledObject
- Revision
- 2517
- Author
- dblevins
- Date
- 2006-02-26 18:06:41 -0500 (Sun, 26 Feb 2006)
Log Message
Removing use of MarshalledObject
Apparently it's slow and definitely is causing problems in the
tomcat integration on windows.
Modified Paths
Diff
Modified: trunk/openejb1/modules/core/src/java/org/openejb/core/ivm/BaseEjbProxyHandler.java (2516 => 2517)
--- trunk/openejb1/modules/core/src/java/org/openejb/core/ivm/BaseEjbProxyHandler.java 2006-02-26 22:01:51 UTC (rev 2516)
+++ trunk/openejb1/modules/core/src/java/org/openejb/core/ivm/BaseEjbProxyHandler.java 2006-02-26 23:06:41 UTC (rev 2517)
@@ -47,6 +47,10 @@
import java.io.IOException;
import java.io.ObjectStreamException;
import java.io.Serializable;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ObjectInputStream;
import java.lang.reflect.Method;
import java.lang.reflect.UndeclaredThrowableException;
import java.rmi.MarshalledObject;
@@ -419,8 +423,15 @@
*/
/* change dereference to copy */
protected Object copyObj(Object object) throws IOException, ClassNotFoundException {
- MarshalledObject obj = new MarshalledObject(object);
- return obj.get();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(128);
+ ObjectOutputStream out = new ObjectOutputStream(baos);
+ out.writeObject(object);
+ out.close();
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ ObjectInputStream in = new ObjectInputStream(bais);
+ Object obj = in.readObject();
+ return obj;
}
/**