[jboss-remoting-commits] JBoss Remoting SVN: r4660 - remoting2/branches/2.2/src/main/org/jboss/remoting.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Wed Nov 12 23:51:40 EST 2008


Author: ron.sigal at jboss.com
Date: 2008-11-12 23:51:40 -0500 (Wed, 12 Nov 2008)
New Revision: 4660

Modified:
   remoting2/branches/2.2/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
Log:
JBREM-1042: Introduced parentFirstClassLoading variable and associated facility.

Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java	2008-11-13 04:19:42 UTC (rev 4659)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java	2008-11-13 04:51:40 UTC (rev 4660)
@@ -41,15 +41,18 @@
    private final Object clientLeaseLock = new Object();
    private LeasePinger leasePinger = null;
    private String invokerSessionID = new GUID().toString();
+   private boolean parentFirstClassLoading = true;
 
    public MicroRemoteClientInvoker(InvokerLocator locator)
    {
       super(locator);
+      init();
    }
 
    public MicroRemoteClientInvoker(InvokerLocator locator, Map configuration)
    {
       super(locator, configuration);
+      init();
    }
 
    /**
@@ -88,8 +91,15 @@
          // creating a new classloader containing the remoting class loader (for remote classloading)
          // and the current thread's class loader.  This allows to load remoting classes as well as
          // user's classes.
-         ClassLoader remotingClassLoader =
-            new RemotingClassLoader(getClassLoader(), Thread.currentThread().getContextClassLoader());
+         ClassLoader remotingClassLoader = null;
+         if (parentFirstClassLoading)
+         {
+            remotingClassLoader = new RemotingClassLoader(getClassLoader(), Thread.currentThread().getContextClassLoader());
+         }
+         else
+         {
+            remotingClassLoader = new RemotingClassLoader(Thread.currentThread().getContextClassLoader(), getClassLoader());
+         }
          
          // try by locator (in case unmarshaller class name specified)
          unmarshaller = MarshalFactory.getUnMarshaller(getLocator(), getClassLoader());
@@ -471,6 +481,24 @@
       }
       return type;
    }
+   
+   protected void init()
+   {
+      // Get the parent delegation order flag, default is parent first
+      Object flag = configuration.get(Remoting.CLASSLOADING_PARENT_FIRST_DELEGATION);
+      if(flag == null)
+      {
+         // Fallback to the system property
+         flag = System.getProperty(Remoting.CLASSLOADING_PARENT_FIRST_DELEGATION_PROP);
+      }
+      boolean parentFirst = true;
+      if (flag != null)
+      {
+         String sflag = flag.toString();
+         parentFirst = Boolean.valueOf(sflag).booleanValue();
+      }
+      parentFirstClassLoading = parentFirst;
+   }
 
    /**
     * Each implementation of the remote client invoker should have




More information about the jboss-remoting-commits mailing list