[jboss-remoting-commits] JBoss Remoting SVN: r5282 - remoting2/branches/2.2/src/main/org/jboss/remoting/serialization/impl/jboss.
jboss-remoting-commits at lists.jboss.org
jboss-remoting-commits at lists.jboss.org
Tue May 19 16:53:07 EDT 2009
Author: ron.sigal at jboss.com
Date: 2009-05-19 16:53:07 -0400 (Tue, 19 May 2009)
New Revision: 5282
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/serialization/impl/jboss/JBossSerializationManager.java
Log:
JBREM-1127: Updates ObjectInputStream classloader if RemotingClassLoader's useCurrentThreadClassLoader variable is set to true.
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/serialization/impl/jboss/JBossSerializationManager.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/serialization/impl/jboss/JBossSerializationManager.java 2009-05-19 20:52:23 UTC (rev 5281)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/serialization/impl/jboss/JBossSerializationManager.java 2009-05-19 20:53:07 UTC (rev 5282)
@@ -25,6 +25,7 @@
import org.jboss.logging.Logger;
import org.jboss.remoting.loading.ObjectInputStreamWithClassLoader;
+import org.jboss.remoting.loading.RemotingClassLoader;
import org.jboss.remoting.serialization.IMarshalledValue;
import org.jboss.remoting.serialization.SerializationManager;
import org.jboss.remoting.serialization.SerializationStreamFactory;
@@ -95,18 +96,30 @@
{
ObjectInputStream objInputStream = null;
Object obj = null;
+ boolean useCurrentThreadClassLoader = false;
+
if (inputStream instanceof ObjectInputStreamWithClassLoader)
{
- if (((ObjectInputStreamWithClassLoader) inputStream).getClassLoader() == null)
+ ClassLoader cl = ((ObjectInputStreamWithClassLoader) inputStream).getClassLoader();
+ if (cl instanceof RemotingClassLoader)
{
+ useCurrentThreadClassLoader = ((RemotingClassLoader) cl).isUseCurrentThreadClassLoader();
+ }
+ if (cl == null || useCurrentThreadClassLoader)
+ {
((ObjectInputStreamWithClassLoader) inputStream).setClassLoader(customClassLoader);
}
objInputStream = (ObjectInputStream) inputStream;
}
else if (inputStream instanceof JBossObjectInputStream)
{
- if (((JBossObjectInputStream) inputStream).getClassLoader() == null)
+ ClassLoader cl = ((JBossObjectInputStream) inputStream).getClassLoader();
+ if (cl instanceof RemotingClassLoader)
{
+ useCurrentThreadClassLoader = ((RemotingClassLoader) cl).isUseCurrentThreadClassLoader();
+ }
+ if (cl == null || useCurrentThreadClassLoader )
+ {
((JBossObjectInputStream) inputStream).setClassLoader(customClassLoader);
}
objInputStream = (ObjectInputStream) inputStream;
More information about the jboss-remoting-commits
mailing list