Actually I was going to be a multithreading guide in developers. Android Com When I saw something that confused me ... (i
) Defining this thread pool class section, they mention that for the class A single creator should be a singleton, the author claims that doing this will not require the alignment of the code. I am confused why this thread is safe because it is a singleton, it can still be referred to by many sources, as well as memory stability errors etc.
- Since the constructor is private, only a method within the class can make an example of that class < / Li>
-
Created by just one instance of that class:
makes a static example of static {// PhotoManager sInstance = new PhotoManager () ; Fixed {...} block is safe because it is executed by a class loader, which is synchronized
Comments
Post a Comment