[jboss-cvs] JBossAS SVN: r77486 - trunk/iiop/src/main/org/jboss/tm/iiop.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Aug 26 09:36:45 EDT 2008


Author: adrian at jboss.org
Date: 2008-08-26 09:36:45 -0400 (Tue, 26 Aug 2008)
New Revision: 77486

Modified:
   trunk/iiop/src/main/org/jboss/tm/iiop/TxServerClientInterceptor.java
Log:
[JBAS-5880] - Statically initialise emptyPC to avoid memory caching issues

Modified: trunk/iiop/src/main/org/jboss/tm/iiop/TxServerClientInterceptor.java
===================================================================
--- trunk/iiop/src/main/org/jboss/tm/iiop/TxServerClientInterceptor.java	2008-08-26 13:33:03 UTC (rev 77485)
+++ trunk/iiop/src/main/org/jboss/tm/iiop/TxServerClientInterceptor.java	2008-08-26 13:36:45 UTC (rev 77486)
@@ -68,8 +68,23 @@
    private static final int txContextId = TransactionService.value;
    private static Codec codec;
    private static TransactionManager tm;
-   private static PropagationContext emptyPC;
+   private static final PropagationContext emptyPC;
 
+   static
+   {
+      // According to the spec, this should all be ignored
+      // But we get NPEs if it doesn't contain some content
+      emptyPC = new PropagationContext();
+      emptyPC.parents = new TransIdentity[0];
+      emptyPC.current = new TransIdentity();
+      emptyPC.current.otid = new otid_t();
+      emptyPC.current.otid.formatID = 666;
+      emptyPC.current.otid.bqual_length = 1;
+      emptyPC.current.otid.tid = new byte[] { (byte) 1 };
+      emptyPC.implementation_specific_data = ORB.init().create_any();
+      emptyPC.implementation_specific_data.insert_boolean(false);
+   }
+
    // Static methods ------------------------------------------------
 
    static void init(Codec codec)
@@ -96,21 +111,6 @@
 
    static PropagationContext getEmptyPropagationContext()
    {
-      if (emptyPC == null)
-      {
-         // According to the spec, this should all be ignored
-         // But we get NPEs if it doesn't contain some content
-         PropagationContext temp = new PropagationContext();
-         temp.parents = new TransIdentity[0];
-         temp.current = new TransIdentity();
-         temp.current.otid = new otid_t();
-         temp.current.otid.formatID = 666;
-         temp.current.otid.bqual_length = 1;
-         temp.current.otid.tid = new byte[] { (byte) 1 };
-         temp.implementation_specific_data = ORB.init().create_any();
-         temp.implementation_specific_data.insert_boolean(false);
-         emptyPC = temp;
-      }
       return emptyPC;
    }
    




More information about the jboss-cvs-commits mailing list