[jboss-cvs] JBossAS SVN: r77485 - branches/Branch_4_2/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:33:03 EDT 2008


Author: adrian at jboss.org
Date: 2008-08-26 09:33:03 -0400 (Tue, 26 Aug 2008)
New Revision: 77485

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

Modified: branches/Branch_4_2/iiop/src/main/org/jboss/tm/iiop/TxServerClientInterceptor.java
===================================================================
--- branches/Branch_4_2/iiop/src/main/org/jboss/tm/iiop/TxServerClientInterceptor.java	2008-08-26 13:09:32 UTC (rev 77484)
+++ branches/Branch_4_2/iiop/src/main/org/jboss/tm/iiop/TxServerClientInterceptor.java	2008-08-26 13:33:03 UTC (rev 77485)
@@ -61,8 +61,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)
@@ -89,21 +104,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