Java Concurrency - Shared Objects - The Basics

Static initialization is performed by the initialization phase JVM in the class. Because of the synchronization mechanism inside the JVM, so any object is initialized in this manner can be safely released

When used and shared objects in concurrent programs, you can use some practical strategies, including:
thread closed. Thread closed objects can only be owned by a thread, the object is enclosed in this thread, and can only be modified by this thread.
Read-only share. In the absence of additional synchronization, the shared object can be read only concurrent access by multiple threads, but any thread can not modify it. Shared objects include read-only immutable objects and facts immutable.
Thread-safe shared. Thread-safe objects in its internal synchronization, multiple threads can be accessed through the object's public interface without further synchronization.
Object of protection. The protected object can only be accessed through the locks held specific. Protection of objects included in the other thread-safe objects encapsulated object, and the object has been released and is protected by a specific lock.

Test subscript
\ (a ^ 2 a_2 \)

Guess you like

Origin www.cnblogs.com/zhshqcn/p/11760459.html