Author: ron.sigal(a)jboss.com
Date: 2008-05-21 23:21:34 -0400 (Wed, 21 May 2008)
New Revision: 4206
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
Log:
JBREM-978: Moved classloader retrieval to SecurityUtility.
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
===================================================================
---
remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java 2008-05-21
02:01:20 UTC (rev 4205)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java 2008-05-22
03:21:34 UTC (rev 4206)
@@ -9,11 +9,10 @@
import org.jboss.remoting.marshal.UnMarshaller;
import org.jboss.remoting.marshal.UpdateableClassloaderUnMarshaller;
import org.jboss.remoting.transport.ClientInvoker;
+import org.jboss.remoting.util.SecurityUtility;
import org.jboss.util.id.GUID;
import java.io.IOException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -117,13 +116,7 @@
// class loader. This allows to load remoting classes as well as user's
// classes. If possible, will simply reset context classloader on existing
// RemotingClassLoader.
- final ClassLoader contextClassLoader = (ClassLoader)
AccessController.doPrivileged( new PrivilegedAction()
- {
- public Object run()
- {
- return Thread.currentThread().getContextClassLoader();
- }
- });
+ final ClassLoader contextClassLoader =
SecurityUtility.getContextClassLoader(Thread.currentThread());
if (unmarshaller instanceof UpdateableClassloaderUnMarshaller)
{
UpdateableClassloaderUnMarshaller uclum = (UpdateableClassloaderUnMarshaller)
unmarshaller;
@@ -135,26 +128,13 @@
}
else
{
- rcl = (RemotingClassLoader)AccessController.doPrivileged( new
PrivilegedAction()
- {
- public Object run()
- {
- return new RemotingClassLoader(getClassLoader(),
contextClassLoader);
- }
- });
-
+ rcl = SecurityUtility.createRemotingClassLoader(getClassLoader(),
contextClassLoader);
unmarshaller.setClassLoader(rcl);
}
}
else
{
- rcl = (RemotingClassLoader)AccessController.doPrivileged( new
PrivilegedAction()
- {
- public Object run()
- {
- return new RemotingClassLoader(getClassLoader(), contextClassLoader);
- }
- });
+ rcl = SecurityUtility.createRemotingClassLoader(getClassLoader(),
contextClassLoader);
unmarshaller.setClassLoader(rcl);
}
}
@@ -370,25 +350,13 @@
public void setUnMarshaller(UnMarshaller unmarshaller)
{
- ClassLoader classLoader = (ClassLoader) AccessController.doPrivileged( new
PrivilegedAction()
- {
- public Object run()
- {
- return Thread.currentThread().getContextClassLoader();
- }
- });
+ ClassLoader classLoader =
SecurityUtility.getContextClassLoader(Thread.currentThread());
unmarshallers.put(classLoader, unmarshaller);
}
public UnMarshaller getUnMarshaller()
{
- ClassLoader classLoader = (ClassLoader) AccessController.doPrivileged( new
PrivilegedAction()
- {
- public Object run()
- {
- return Thread.currentThread().getContextClassLoader();
- }
- });
+ ClassLoader classLoader =
SecurityUtility.getContextClassLoader(Thread.currentThread());
return (UnMarshaller)unmarshallers.get(classLoader);
}
Show replies by date