[jboss-remoting-commits] JBoss Remoting SVN: r4482 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Sat Aug 9 04:06:04 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-08-09 04:06:04 -0400 (Sat, 09 Aug 2008)
New Revision: 4482

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java
Log:
JBREM-1000: Replaced class repositories with classloaders.

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java	2008-08-09 08:01:58 UTC (rev 4481)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/Connector.java	2008-08-09 08:06:04 UTC (rev 4482)
@@ -26,6 +26,7 @@
 import org.jboss.remoting.ConnectionListener;
 import org.jboss.remoting.InvokerLocator;
 import org.jboss.remoting.InvokerRegistry;
+import org.jboss.remoting.Remoting;
 import org.jboss.remoting.ServerConfiguration;
 import org.jboss.remoting.ServerInvocationHandler;
 import org.jboss.remoting.ServerInvocationHandlerWrapper;
@@ -141,6 +142,7 @@
 
    private Connector marshallerLoaderConnector = null;
    private boolean isMarshallerLoader = false;
+   private List remoteClassLoaders;
 
    private boolean isStarted = false;
    private boolean isCreated = false;
@@ -471,6 +473,18 @@
       // keep the local cache in synch
       locatorURI = invoker.getLocator().getLocatorURI();
 
+      if (remoteClassLoaders == null)
+      {
+         Object o = configuration.get(Remoting.REMOTE_CLASS_LOADERS);
+         if (o instanceof List)
+         {
+            setRemoteClassLoaders((List) o);
+         }
+         else
+         {
+            log.warn("value of " + Remoting.REMOTE_CLASS_LOADERS + " must be a List");
+         }
+      }
 
       if (!isMarshallerLoader)
       {
@@ -508,8 +522,7 @@
       // if loaderLocator is null, then probably not defined to have loader service (i.e. no loader port specified)
       if (loaderLocator != null)
       {
-         List repositories = getLoaderRepositories();
-         marshallerLoader = MarshallLoaderFactory.createMarshallLoader(loaderLocator, repositories, server);
+         marshallerLoader = MarshallLoaderFactory.createMarshallLoader(loaderLocator, remoteClassLoaders, server);
       }
       return marshallerLoader;
    }
@@ -973,41 +986,6 @@
       }
    }
 
-   private List getLoaderRepositories()
-   {
-      if (xml == null)
-      {
-         return null;
-      }
-
-      NodeList repositoryNodes = xml.getElementsByTagName("repository");
-      if (repositoryNodes.getLength() == 0)
-      {
-         return null;
-      }
-      
-      List repositories = new ArrayList();
-      for (int i = 0; i < repositoryNodes.getLength(); i++)
-      {
-         Node node = repositoryNodes.item(i);
-         String repositoryName = node.getFirstChild().getNodeValue();
-
-         try
-         {
-            ObjectName objName = new ObjectName(repositoryName);
-            repositories.add(objName);
-            log.info("repository: " + repositoryName);
-         }
-         catch (MalformedObjectNameException e)
-         {
-            log.debug("repository name is not an object name: " + repositoryName);
-            continue;
-         }
-      }
-      
-      return repositories;
-   }
-   
    private ServerInvocationHandler createHandlerProxy(ObjectName objName)
    {
       ServerInvocationHandler handler;
@@ -1459,4 +1437,17 @@
    {
       this.serverConfiguration = serverConfig;
    }
+   
+   public void setRemoteClassLoaders(List classLoaders)
+   {
+      if (classLoaders == null)
+         return;
+
+      SecurityManager sm = System.getSecurityManager();
+      if (sm != null)
+      {
+         sm.checkPermission(new RuntimePermission("setContextClassLoader"));
+      }
+      this.remoteClassLoaders = classLoaders;
+   }
 }




More information about the jboss-remoting-commits mailing list