Uploaded image for project: 'Java Mission Control'
  1. Java Mission Control
  2. JMC-7357

Double-Checked Locking in Agent Plugin code

    XMLWordPrintable

Details

    Backports

      Description

        The method createSingleton() in PresetRepositoryFactory.java relies on double-checked locking, an incorrect idiom that does not achieve the intended effect.

         

        private static PresetRepository singleton; 
        public static PresetRepository createSingleton() { 
            if (singleton == null) { 
                 synchronized (PresetRepositoryFactory.class) {
                    if (singleton == null) { 
                       singleton = create(); 
                     } 
                   } 
             } 
             return singleton;
        

         

        Attachments

          Issue Links

            Activity

              People

                ghb Guru Hb (Inactive)
                bbanathur Bipin Banathur
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: