[jboss-cvs] JBossAS SVN: r65794 - trunk/iiop/src/main/org/jboss/proxy/ejb.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Oct 3 06:15:03 EDT 2007


Author: adrian at jboss.org
Date: 2007-10-03 06:15:03 -0400 (Wed, 03 Oct 2007)
New Revision: 65794

Modified:
   trunk/iiop/src/main/org/jboss/proxy/ejb/HomeHandleImplIIOP.java
Log:
[JBAS-4801] - HomeHandleIIOP should use the HandleDelegate for serialization

Modified: trunk/iiop/src/main/org/jboss/proxy/ejb/HomeHandleImplIIOP.java
===================================================================
--- trunk/iiop/src/main/org/jboss/proxy/ejb/HomeHandleImplIIOP.java	2007-10-03 10:14:48 UTC (rev 65793)
+++ trunk/iiop/src/main/org/jboss/proxy/ejb/HomeHandleImplIIOP.java	2007-10-03 10:15:03 UTC (rev 65794)
@@ -25,6 +25,8 @@
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.rmi.RemoteException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 import javax.ejb.EJBHome;
 import javax.ejb.HomeHandle;
@@ -41,6 +43,7 @@
  * @author  <a href="mailto:rickard.oberg at telkel.com">Rickard Öberg</a>.
  * @author  <a href="mailto:jason at planet57.com">Jason Dillon</a>
  * @author  <a href="mailto:reverbel at ime.usp.br">Francisco Reverbel</a>
+ * @author  adrian at jboss.org
  * @version $Revision$
  */
 public class HomeHandleImplIIOP
@@ -49,6 +52,26 @@
    /** @since 4.2.0 */
    static final long serialVersionUID = 8652819695513956661L;
 
+   static final boolean oldSerialization;
+   
+   static
+   {
+      oldSerialization = AccessController.doPrivileged(new PrivilegedAction<Boolean>() 
+      {
+         public Boolean run()
+         {
+            try
+            {
+               return Boolean.getBoolean("org.jboss.proxy.ejb.old.homehandle.serialization");
+            }
+            catch (Exception ignored)
+            {
+               return false;
+            }
+         }
+      });
+   }
+   
    /**
     * This handle encapsulates an stringfied CORBA reference for an 
     * <code>EJBHome</code>. 
@@ -143,17 +166,32 @@
       }
    }
 
-   public void writeObject(ObjectOutputStream oostream) throws IOException
+   private void writeObject(ObjectOutputStream oostream) throws IOException
    {
-      HandleDelegate delegate = HandleDelegateImpl.getDelegate();
-      delegate.writeEJBHome(getEJBHome(), oostream);
+      if (oldSerialization)
+      {
+         oostream.defaultWriteObject();
+      }
+      else
+      {
+         HandleDelegate delegate = HandleDelegateImpl.getDelegate();
+         delegate.writeEJBHome(getEJBHome(), oostream);
+      }
    }
 
-   public void readObject(ObjectInputStream oistream) throws IOException, ClassNotFoundException
+   private void readObject(ObjectInputStream oistream) throws IOException, ClassNotFoundException
    {
-      HandleDelegate delegate = HandleDelegateImpl.getDelegate();
-      EJBHome obj = delegate.readEJBHome(oistream);
-      this.ior = CorbaORB.getInstance().object_to_string((org.omg.CORBA.Object) obj);
-      this.stubClass = obj.getClass();
+      if (oldSerialization)
+      {
+         oistream.defaultReadObject();
+         stubClass = EJBHome.class;
+      }
+      else
+      {
+         HandleDelegate delegate = HandleDelegateImpl.getDelegate();
+         EJBHome obj = delegate.readEJBHome(oistream);
+         this.ior = CorbaORB.getInstance().object_to_string((org.omg.CORBA.Object) obj);
+         this.stubClass = obj.getClass();
+      }
    }
 }




More information about the jboss-cvs-commits mailing list