Author: ron.sigal(a)jboss.com
Date: 2008-02-22 04:41:57 -0500 (Fri, 22 Feb 2008)
New Revision: 3475
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/serializable/SerializableUnMarshaller.java
Log:
JBREM-900: (1) Implements UpdateableClassloaderUnMarshaller; (2) eliminated direct
reference to customClassLoader.
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/serializable/SerializableUnMarshaller.java
===================================================================
---
remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/serializable/SerializableUnMarshaller.java 2008-02-22
09:39:54 UTC (rev 3474)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/serializable/SerializableUnMarshaller.java 2008-02-22
09:41:57 UTC (rev 3475)
@@ -26,11 +26,13 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
+import java.lang.ref.WeakReference;
import java.util.Map;
import org.jboss.remoting.Version;
import org.jboss.remoting.marshal.PreferredStreamUnMarshaller;
import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.remoting.marshal.UpdateableClassloaderUnMarshaller;
import org.jboss.remoting.marshal.VersionedUnMarshaller;
import org.jboss.remoting.serialization.SerializationManager;
import org.jboss.remoting.serialization.SerializationStreamFactory;
@@ -40,13 +42,14 @@
*
* @author <a href="mailto:tom@jboss.org">Tom Elrod</a>
*/
-public class SerializableUnMarshaller implements PreferredStreamUnMarshaller,
VersionedUnMarshaller
+public class SerializableUnMarshaller
+implements PreferredStreamUnMarshaller, VersionedUnMarshaller,
UpdateableClassloaderUnMarshaller
{
static final long serialVersionUID = -1554017376768780738L;
public final static String DATATYPE = "serializable";
- protected ClassLoader customClassLoader = null;
+ protected ClassLoader customClassLoader;
protected String serializationType;
@@ -69,7 +72,7 @@
{
BufferedInputStream bis = new BufferedInputStream(inputStream);
SerializationManager manager =
SerializationStreamFactory.getManagerInstance(getSerializationType());
- return manager.createInput(bis, customClassLoader);
+ return manager.createInput(bis, getClassLoader());
}
}
@@ -117,7 +120,7 @@
public Object read(InputStream inputStream, Map metadata, int version) throws
IOException, ClassNotFoundException
{
ObjectInputStream ois = (ObjectInputStream) getMarshallingStream(inputStream,
null);
- return
SerializationStreamFactory.getManagerInstance(getSerializationType()).receiveObject(ois,
customClassLoader, version);
+ return
SerializationStreamFactory.getManagerInstance(getSerializationType()).receiveObject(ois,
getClassLoader(), version);
}
@@ -131,12 +134,17 @@
{
this.customClassLoader = classloader;
}
+
+ public ClassLoader getClassLoader()
+ {
+ return customClassLoader;
+ }
public UnMarshaller cloneUnMarshaller()
throws CloneNotSupportedException
{
SerializableUnMarshaller unmarshaller = new SerializableUnMarshaller();
- unmarshaller.setClassLoader(this.customClassLoader);
+ unmarshaller.setClassLoader(getClassLoader());
return unmarshaller;
}