Author: ron.sigal(a)jboss.com
Date: 2008-05-13 00:53:54 -0400 (Tue, 13 May 2008)
New Revision: 4177
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIClientInvoker.java
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java
Log:
JBREM-978: Moved several socket related calls to SecurityUtility.
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIClientInvoker.java
===================================================================
---
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIClientInvoker.java 2008-05-13
04:53:06 UTC (rev 4176)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIClientInvoker.java 2008-05-13
04:53:54 UTC (rev 4177)
@@ -229,25 +229,7 @@
log.debug(this + " looking up registry: " + host + "," +
port);
final Registry registry = LocateRegistry.getRegistry(host, registryPort);
log.debug(this + " trying to connect to: " + home);
- Remote remoteObj = null;
-
-// try
-// {
-// remoteObj = (Remote) AccessController.doPrivileged( new
PrivilegedExceptionAction()
-// {
-// public Object run() throws Exception
-// {
-// return registry.lookup("remoting/RMIServerInvoker/" +
port);
-// }
-// });
-// }
-// catch (PrivilegedActionException e)
-// {
-// log.debug(e.toString(), e);
-// throw (Exception) e.getCause();
-// }
-
- remoteObj = registry.lookup("remoting/RMIServerInvoker/" + port);
+ Remote remoteObj = SecurityUtility.lookup(registry,
"remoting/RMIServerInvoker/" + port);
log.debug("Remote RMI Stub: " + remoteObj);
setServerStub((RMIServerInvokerInf) remoteObj);
connected = true;
@@ -395,7 +377,7 @@
int simulatedTimeout = getSimulatedTimeout(configuration, metadata);
if (simulatedTimeout <= 0)
{
- Object result = server.transport(payload);
+ Object result = SecurityUtility.callTransport(server, payload);
return unmarshal(result, unmarshaller, metadata);
}
else
@@ -412,7 +394,7 @@
{
try
{
- resultHolder.value = server.transport(finalPayload);
+ resultHolder.value = SecurityUtility.callTransport(server,
finalPayload);
if (log.isTraceEnabled()) log.trace("result: " +
resultHolder.value);
}
catch (Exception e)
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java
===================================================================
---
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java 2008-05-13
04:53:06 UTC (rev 4176)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/rmi/RMIServerInvoker.java 2008-05-13
04:53:54 UTC (rev 4177)
@@ -52,7 +52,6 @@
import java.net.InetAddress;
import java.rmi.Remote;
import java.rmi.RemoteException;
-import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.ExportException;
import java.rmi.server.RMIServerSocketFactory;
@@ -191,10 +190,10 @@
locator.setHomeInUse(bindHome);
RMIServerSocketFactory ssf = new
RemotingRMIServerSocketFactory(getServerSocketFactory(), BACKLOG_DEFAULT, bindHost,
getTimeout());
csf = getRMIClientSocketFactory(clientConnectHost);
- stub = UnicastRemoteObject.exportObject(this, bindPort, csf, ssf);
+ stub = SecurityUtility.exportObject(this, bindPort, csf, ssf);
log.debug("Binding server to \"remoting/RMIServerInvoker/" +
bindPort + "\" in registry");
- registry.rebind("remoting/RMIServerInvoker/" + bindPort,
RMIServerInvoker.this);
+ SecurityUtility.rebind(registry, "remoting/RMIServerInvoker/" + bindPort,
this);
ClassLoader classLoader = SecurityUtility.getClassLoader(RMIServerInvoker.class);
unmarshaller = MarshalFactory.getUnMarshaller(getLocator(), classLoader);
marshaller = MarshalFactory.getMarshaller(getLocator(), classLoader);
@@ -260,14 +259,14 @@
{
log.debug("Creating registry for " + port);
- registry = LocateRegistry.createRegistry(port);
+ registry = SecurityUtility.createRegistry(port);
}
catch(ExportException exportEx)
{
log.debug("Locating registry for " + port);
// Probably means that the registry already exists, so just get it.
- registry = LocateRegistry.getRegistry(port);
+ registry = SecurityUtility.getRegistry(port);
}
if(log.isTraceEnabled())
{
@@ -294,7 +293,7 @@
log.debug("locator: " + locator + ", home: " +
locator.getHomeInUse());
log.debug(this + " primary: " + isPrimaryServer + " unbinding
" + "remoting/RMIServerInvoker/" + locator.getPort() + " from
registry");
Registry registry = getRegistry();
- registry.unbind("remoting/RMIServerInvoker/" + locator.getPort());
+ SecurityUtility.unbind(registry, "remoting/RMIServerInvoker/" +
locator.getPort());
log.debug("unbound " + "remoting/RMIServerInvoker/" +
locator.getPort() + " from registry");
}
catch(Exception e)
Show replies by date