I am currently reading about Singleton design pattern when I came across Eager Initialization versus Bill Pugh implementation, as far as I understand, the Bill Pugh implementation was introduced to make the initialization as lazy as possible together with avoiding the overhead of synchronization, so .... my question now : if I am using Eager initialization singleton and the class I am using is dedicated only for the creation of the singleton instance -the class has no other functionality, hence it's only accessed for the sake of the singleton object .... It will give the same behavior as the Bill Pugh implementation ... Am I right ?
hint : according to JLS , nothing different between class loading of inner class and top level class, except that top level should occur before inclosed inner.
Aucun commentaire:
Enregistrer un commentaire