Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-5904

ClientUserTransaction singleton initialisation is not thread safe

    XMLWordPrintable

Details

    Description

      The ClientUserTransaction singleton initialistation is not thread safe:

      private static ClientUserTransaction singleton = null;

      public static ClientUserTransaction getSingleton()
      {
      if (singleton == null)
      singleton = new ClientUserTransaction();
      return singleton;
      }

      Two threads can race to create the singleton which means the ThreadLocal within the class can become
      "masked".

      The construction of the singleton needs moving to static initialisation.

      Attachments

        Issue Links

          Activity

            People

              adrian.brock Adrian Brock (Inactive)
              adrian.brock Adrian Brock (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: